Commit graph

6191 commits

Author SHA1 Message Date
Boshen
0fcff207c7
refactor(minifier): remove EmptyStatement in a single place (#8745) 2025-01-27 17:08:22 +08:00
Boshen
29417ddc03 feat(minifier): minimize !(a, b) -> a, !b (#8746) 2025-01-27 08:24:07 +00:00
Boshen
3ece991577 feat(minifier): remove unused import.meta statement (#8744) 2025-01-27 07:52:40 +00:00
Boshen
3ef980aa08 feat(minifier): remove unreachable statements after break and continue (#8743) 2025-01-27 07:41:10 +00:00
Dunqing
2e4ff91283 perf(manger): Revert "perf(manger): remove useless tmp_bindings (#8735)" (#8741)
#8735 removes `tmp_bindings` and then calls `Iterator::sorted_unstabled` instead, I thought it ideal but after I saw performance regression, I looked at `sorted_unstabled`'s implementation, and it will cause an allocation every run, but `tmp_bindings` only allocate once, then clear and reuse it in that loop.
2025-01-27 03:44:34 +00:00
dalaoshu
e85827b63f
fix(oxc_language_server): use file_path instead of uri_path (#8736)
closes #8594 

This is because previously, oxlintrc.path was determined by
`path.canonicalize().unwrap_or_else(|_| path.to_path_buf())`, but after
#8214, it was changed to `path.to_path_buf()`. As a result,
`\\?\D:\shulaoda` became `D:\shulaoda`. This caused the condition
`uri_path.starts_with(gitignore.path())` to evaluate as `true`,
preventing the bypass of the `is_ignore` check and exposing the original
code issue.


b1499e6711/crates/oxc_language_server/src/main.rs (L531-L533)
2025-01-26 15:40:22 +01:00
oxc-bot
2fb08b9e9c
release(crates): v0.48.1 (#8738)
## [0.48.1] - 2025-01-26

### Features

- b7f13e6 ast: Implement utf8 to utf16 span converter (#8687) (Boshen)
- 6589c3b mangler: Reuse variable names (#8562) (翠 / green)
- 29bd215 minifier: Minimize `Infinity.toString(radix)` to `'Infinity'`
(#8732) (Boshen)
- e0117db minifier: Replace `const` with `let` for non-exported
read-only variables (#8733) (sapphi-red)
- 9e32f55 minifier: Evaluate `Math.sqrt` and `Math.cbrt` (#8731)
(sapphi-red)
- 360d49e minifier: Replace `Math.pow` with `**` (#8730) (sapphi-red)
- 2e9a560 minifier: `NaN.toString(radix)` is always `NaN` (#8727)
(Boshen)
- cbe0e82 minifier: Minimize `foo(...[])` -> `foo()` (#8726) (Boshen)
- e9fb5fe minifier: Dce pure expressions such as `new Map()` (#8725)
(Boshen)

### Bug Fixes

- 0944758 codegen: Remove parens from `new (import(''), function() {})`
(#8707) (Boshen)
- 33de70a mangler: Handle cases where a var is declared in a block scope
(#8706) (翠 / green)
- d982cdb minifier: `Unknown.fromCharCode` should not be treated as
`String.fromCharCode` (#8709) (sapphi-red)
- e7ab96c transformer/jsx: Incorrect `isStaticChildren` argument for
`Fragment` with multiple children (#8713) (Dunqing)
- 3e509e1 transformer/typescript: Enum merging when same name declared
in outer scope (#8691) (branchseer)

### Performance

- dc0b0f2 manger: Remove useless `tmp_bindings` (#8735) (Dunqing)
- e472ced mangler: Optimize handling of collecting lived scope ids
(#8724) (Dunqing)
- 8587965 minifier: Normalize `undefined` to `void 0` before everything
else (#8699) (Boshen)

### Refactor

- 58002e2 ecmascript: Remove the lifetime annotation on
`MayHaveSideEffects` (#8717) (Boshen)
- 10e5920 linter: Move finishing default diagnostic message to
`GraphicalReporter` (#8683) (Sysix)
- 52a37d0 mangler: Simplify initialization of `slots` (#8734) (Dunqing)
- 6bc906c minifier: Allow mutating arguments in methods called from
`try_fold_known_string_methods` (#8729) (sapphi-red)
- bf8be23 minifier: Use `Ctx` (#8716) (Boshen)
- 0af0267 minifier: Side effect detection needs symbols resolution
(#8715) (Boshen)
- 32e0e47 minifier: Clean up `Normalize` (#8700) (Boshen)
- c792068 semantic: Simplify `ScopeTree::iter_bindings` (#8723)
(Dunqing)

### Testing

- 03229c5 minifier: Fix broken tests (#8722) (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-01-26 22:20:13 +08:00
Boshen
29bd215f4f
feat(minifier): minimize Infinity.toString(radix) to 'Infinity' (#8732)
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
2025-01-26 22:14:24 +08:00
sapphi-red
e0117db531
feat(minifier): replace const with let for non-exported read-only variables (#8733)
Replace `const` with `let` when that value does not have any assignments and not exposed.
2025-01-26 12:44:01 +00:00
Dunqing
dc0b0f2495 perf(manger): remove useless tmp_bindings (#8735)
We don't need `tmp_bindings` to store sorted bindings as `sorted_unstable` can return an iterator and nowhere else needs to use `tmp_bindings`.
2025-01-26 12:34:11 +00:00
Dunqing
52a37d0f06 refactor(mangler): simplify initialization of slots (#8734)
I just found that `Vec::resize_with` uses `iter::repeat_*` to initialize the value.
2025-01-26 12:34:10 +00:00
sapphi-red
9e32f55a8c
feat(minifier): evaluate Math.sqrt and Math.cbrt (#8731)
Replaces `Math.sqrt(a)` and `Math.cbrt(a)` when a is a constant and the result is an integer.
The motivation of this PR is to add a comment that `Math.sqrt` / `Math.cbrt` cannot be replaced to `**`, rather than the actual minification improvement.

**Reference**
- [Spec of `Math.sqrt`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-math.sqrt)
- [Spec of `Math.cbrt`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-math.cbrt)
- [Spec of `Number::exponentiate`](https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-numeric-types-number-exponentiate)
2025-01-26 12:14:28 +00:00
sapphi-red
360d49e962
feat(minifier): replace Math.pow with ** (#8730)
Replaces `Math.pow(a, b)` with `(+a) ** (+b)`. `+` does `ToNumber` and `**` does `Number::exponentiate` when both operands are number.
`+` is not added when `a` or `b` is already a number.

**Reference**
- [Spec of `Math.pow`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-math.pow)
- [Spec of `**`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-exp-operator-runtime-semantics-evaluation)
- [Spec of unary `+`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-unary-plus-operator-runtime-semantics-evaluation)
2025-01-26 11:24:19 +00:00
sapphi-red
6bc906c694
refactor(minifier): allow mutating arguments in methods called from try_fold_known_string_methods (#8729) 2025-01-26 20:11:29 +09:00
Dunqing
e472ced05f perf(mangler): optimize handling of collecting lived scope ids (#8724)
Just some low-hanging fruit optimization.

I initially want to dedupe for reference scopes, so that we can avoid calling `scope_tree.ancestors(used_scope_id).take_while(|s_id| *s_id != scope_id)` for duplicate `used_scope_id` but the overhead of calling `unique` or `dedup` is over the improvement.
2025-01-26 10:53:48 +00:00
Dunqing
c79206850c refactor(semantic): simplify ScopeTree::iter_bindings (#8723)
The previous implementation is a little weird, I think it should be a shortcut of `bindings.iter`, It is infrequent we need to iter all symbols and know its scope ID. Only two cases in tests, and no use case in `Rolldown`
2025-01-26 10:53:48 +00:00
Boshen
2e9a5602e9 feat(minifier): NaN.toString(radix) is always NaN (#8727) 2025-01-26 10:38:27 +00:00
Boshen
cbe0e8239d feat(minifier): minimize foo(...[]) -> foo() (#8726) 2025-01-26 10:30:33 +00:00
Boshen
e9fb5febdf
feat(minifier): dce pure expressions such as new Map() (#8725) 2025-01-26 18:08:34 +08:00
Boshen
03229c5367 test(minifier): fix broken tests (#8722) 2025-01-26 03:47:07 +00:00
Tyler Earls
37909337bd
feat(linter): add vitest/prefer-lowercase-title rule (#8152)
This pull request implements the
[vitest/prefer-lowercase-title](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md)
rule.

Since there was an existing jest rule with this title, I followed the
existing pattern in
[no-unused-vars](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs)
to group the jest and vitest rules together in a shared module. I used
the existing `jest/prefer-lowercase-title` documentation as a base and
modified it where it seemed appropriate. I added a `jest` and `vitest`
snapshot suffix for each respective test suite.

One item I wasn't 100% about is adding `bench` to the jest test names.
Without this change, the vitest test suite fails because of [this
check](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/utils/jest/parse_jest_fn.rs#L108)
which validates that we're only parsing valid jest functions from a
detected jest file. The unit tests that are sourced from the vitest
plugin are all read by the linting host as jest-like files, so adding
`bench` as a "valid" jest method allows us to lint a unit test using
this keyword. This seemed to me like the least invasive solution to
accommodate the new rule without breaking any existing code, but I'm
certainly open to alternatives.
2025-01-26 09:21:13 +08:00
Tyler Earls
1de6f854cb
fix(linter): no-lone-blocks erroring on block statements containing comments (#8720)
This PR fixes #8697 by checking if semantic detects a comment in the
span of an otherwise empty block statement.

I also formatted some of the existing test cases to improve readability.
2025-01-26 09:20:05 +08:00
branchseer
3e509e1c9b
fix(transformer/typescript): enum merging when same name declared in outer scope (#8691)
```typescript
var x = 10;
enum Merge { x = Math.random() }
enum Merge {
    y = x // <-- refers to Merge.x
}
```

This case wasn't covered in #8543 and by the [babel test
case](e568916ef3/packages/babel-plugin-transform-typescript/test/fixtures/enum/non-constant-member-reference/input.ts).
To handle it we still have to go through the scope ancestors.

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2025-01-26 09:18:00 +08:00
camchenry
77ef61a68e fix(linter): fix diagnostic spans for oxc/no-async-await (#8721)
Fixes broken diagnostic spans for async functions that did not correctly report on the `async` keyword. I changed the diagnostic reporting to look for the `async` keyword itself within a given span which is a little slower but worth it for accuracy I think.

I also updated the diagnostic to be async-specific as we don't report on await yet.
2025-01-25 20:55:20 +00:00
camchenry
d318238cd2 perf(linter): Remove sorting of rules in cache (#8718)
Experimentally removing this sort as the TODO indicated this might not be needed. If there's no performance loss, I'd say we should merge it.
2025-01-25 17:06:53 +00:00
Boshen
58002e270b refactor(ecmascript): remove the lifetime annotation on MayHaveSideEffects (#8717) 2025-01-25 16:21:03 +00:00
Dunqing
e7ab96cbb6 fix(transformer/jsx): incorrect isStaticChildren argument for Fragment with multiple children (#8713)
close: #8650
2025-01-25 16:11:28 +00:00
Boshen
bf8be23f11 refactor(minifier): use Ctx (#8716) 2025-01-25 16:03:18 +00:00
Boshen
0af0267077 refactor(minifier): side effect detection needs symbols resolution (#8715) 2025-01-25 15:01:00 +00:00
翠 / green
33de70ae71
fix(mangler): handle cases where a var is declared in a block scope (#8706)
This PR fixes the mangler that it was outputting `function _() { { var
a; let a; } }` for `function _() { { var x; let y; } }`.
This caused this error:
https://github.com/oxc-project/monitor-oxc/actions/runs/12962575667/job/36159286596#step:8:31

refs #8705
2025-01-25 19:30:03 +08:00
sapphi-red
d982cdba85
fix(minifier): Unknown.fromCharCode should not be treated as String.fromCharCode (#8709) 2025-01-25 10:56:09 +00:00
Boshen
0944758cc7 fix(codegen): remove parens from new (import(''), function() {}) (#8707) 2025-01-25 10:07:18 +00:00
Rintaro Itokawa
f15bdce53b
fix(linter): catch Promise in typescript/array-type rule (#8702)
close #8693 

Correctly catch `Promise<string[]>` and `Promise<Array<number>>`.
2025-01-25 17:30:33 +08:00
1zumii
e8e69179d1
feat(linter): unicorn/switch-cases-braces support options (#8704)
close #8492
2025-01-25 17:30:01 +08:00
翠 / green
6589c3bbb3
feat(mangler): reuse variable names (#8562)
Changed the mangler to reuse variable names where possible.

This will reduce the code size as shorter variable names can be used in
more places. But requires global information and limits parallelism in a
single file and requires more memory.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-25 14:00:24 +08:00
Boshen
32e0e4796c
refactor(minifier): clean up Normalize (#8700) 2025-01-25 13:52:35 +08:00
Boshen
8587965e45
perf(minifier): normalize undefined to void 0 before everything else (#8699)
so subsequent code don't need to lookup `undefined`.
2025-01-25 11:50:08 +08:00
Boshen
b7f13e636e feat(ast): implement utf8 to utf16 span converter (#8687)
closes #8629
2025-01-24 16:57:44 +00:00
Sysix
10e59209ef refactor(linter): move finishing default diagnostic message to GraphicalReporter (#8683)
Now every lint output is owned by is right OutputFormatter and his DiagnosticReporter 🥳
Next step is to setup a snapshot Tester, so I can remove the ToDos.

Reorded some lines so the outfor is now for: `cargo run -p oxlint -- test.js --max-warnings=2`
```
Found 4 warnings and 0 errors.
Exceeded maximum number of warnings. Found 4.
Finished in 5ms on 1 file with 97 rules using 24 threads.
```

and for `cargo run -p oxlint -- test.js`

```
Found 4 warnings and 0 errors.
Finished in 5ms on 1 file with 97 rules using 24 threads.
```

The output time and warnings/error count wil be always printed.
2025-01-24 16:39:17 +00:00
oxc-bot
b97767874f
release(oxlint): v0.15.8 (#8689)
## [0.15.8] - 2025-01-24

### Features

- 79ba9b5 linter: Added support to run in Node.JS legacy versions
(#8648) (Luiz Felipe Weber)
- dcaebe6 linter: Add "strict" option to `promise/prefer-await-to-then`
rule (#8674) (Neil Fisher)
- 4ae568e linter: Add DiagnosticResult to the Reporters for receiving a
sub part result (#8666) (Alexander S.)
- 8a0eb2a oxlint: Add stylish formatter (#8607) (Andrew Powell)

### Bug Fixes

- 40316af linter: Fix github `endColumn` output (#8647) (Alexander S.)
- dc912fa linter: Added missing $schema property to default config
(#8625) (Tapan Prakash)

### Refactor

- a3dc4c3 crates: Clean up snapshot files (#8680) (Boshen)
- e66da9f isolated_declarations, linter, minifier, prettier, semantic,
transformer: Remove unnecessary `ref` / `ref mut` syntax (#8643)
(overlookmotel)
- 23b49a6 linter: Use `cow_to_ascii_lowercase` instead
`cow_to_lowercase` (#8678) (Boshen)
- b8d9a51 span: Deal only in owned `Atom`s (#8641) (overlookmotel)
- ac4f98e span: Derive `Copy` on `Atom` (#8596) (branchseer)
- 259a47b vscode: Move commands and `findBinary` to separate files
(#8605) (Alexander S.)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-01-24 18:07:14 +08:00
oxc-bot
8a72b8ecc7
release(crates): v0.48.0 (#8686)
## [0.48.0] - 2025-01-24

- 54d0fac span: [**BREAKING**] Remove `PartialEq` impl for `&Atom`
(#8642) (overlookmotel)

### Features

- 2a2ad53 allocator: Add `Allocator::capacity` and `used_bytes` methods
(#8621) (overlookmotel)
- 6801c81 allocator: Add `Allocator::new` and `with_capacity` methods
(#8620) (overlookmotel)
- 99607d3 codegen: Print comments in `TSTypeLiteral` (#8679) (Boshen)
- 4ae568e linter: Add DiagnosticResult to the Reporters for receiving a
sub part result (#8666) (Alexander S.)
- 343690e minifier: Replace `Number.*_SAFE_INTEGER`/`Number.EPSILON`
(#8682) (sapphi-red)
- 0c5bb30 minifier: Replace
`Number.POSITIVE_INFINITY`/`Number.NEGATIVE_INFINITY`/`Number.NaN`
(#8681) (sapphi-red)
- 835b258 minifier: Compress `typeof foo === 'object' && foo !== null`
to `typeof foo == 'object' && !!foo` (#8638) (sapphi-red)
- 2bcbed2 minifier: Compress `(a = b) === null || a === undefined` to
`(a = b) == null` (#8637) (sapphi-red)

### Bug Fixes

- 40316af linter: Fix github `endColumn` output (#8647) (Alexander S.)
- 883d25b minifier: Keep esm in dce (#8677) (Boshen)
- 878ce10 minifier: `void 0` equals to `undefined` (#8673) (Boshen)
- ba201a6 minifier: Remove "non esbuild optimizations" which is
incorrect (#8668) (Boshen)
- 8c8b5fa minifier: Avoid minifing `String(a)` into `"" + a` for symbols
(#8612) (翠 / green)
- 4ff6e85 minifier: Remove expression statement `void 0` (#8602)
(Boshen)
- 93d643e minifier: Keep side effects when folding const conditional
exprs (#8591) (camc314)
- 178c232 parser: Parse `intrinsic` TS keyword (#8627) (Kevin Deng 三咲智子)
- 48717ab parser: Parse `true` as `TSLiteralType` (#8626) (Kevin Deng
三咲智子)
- d1c5dc4 semantic: Fix const assertions in `UnresolvedReferencesStack`
(#8653) (overlookmotel)

### Performance

- 787aaad allocator: Make `String` non-drop (#8617) (overlookmotel)
- d966e0a codegen: Do not check for comments if turned off (#8598)
(Boshen)
- 3fa87ff lexer: Peak 2 bytes after `!` (#8662) (Boshen)
- 9953ac7 minifier: Add `LatePeepholeOptimizations` (#8651) (Boshen)
- 00dc63f minifier: Only substitute typed array constructor once (#8649)
(Boshen)
- 3e19e4e minifier: Remove the useless empty statement removal code in
statement fusion (#8646) (Boshen)
- 5b3c412 minifier: Only run optimizations on local changes (#8644)
(Boshen)

### Documentation

- c1d243b allocator: Improve docs for `Allocator` (#8623)
(overlookmotel)
- 01a5e5d allocator: Improve docs for `HashMap` (#8616) (overlookmotel)
- 87568a1 allocator: Reformat docs (#8615) (overlookmotel)
- 3be0392 lexer: Fix doc comment (#8664) (overlookmotel)
- 5029547 semantic: Fix and reformat doc comments (#8652)
(overlookmotel)

### Refactor

- ae8db53 allocator: Move `Allocator` into own module (#8656)
(overlookmotel)
- 0f85bc6 allocator: Reduce repeat code to prevent `Drop` types in arena
(#8655) (overlookmotel)
- de76eb1 allocator: Reorder `Box` methods (#8654) (overlookmotel)
- 997859c ast: Align `#[estree(via)]` behavior (#8599) (sapphi-red)
- db863a3 codegen: Use `Stack` for `binary_expr_stack` (#8663) (Boshen)
- 8cce69a codegen: Remove `match_member_expression` (#8597) (Boshen)
- a3dc4c3 crates: Clean up snapshot files (#8680) (Boshen)
- e66da9f isolated_declarations, linter, minifier, prettier, semantic,
transformer: Remove unnecessary `ref` / `ref mut` syntax (#8643)
(overlookmotel)
- 23b49a6 linter: Use `cow_to_ascii_lowercase` instead
`cow_to_lowercase` (#8678) (Boshen)
- ce2b9da minifier: Remove `wrap_to_avoid_ambiguous_else` (#8676)
(Boshen)
- 75a579b minifier: Clean up
`has_no_side_effect_for_evaluation_same_target` (#8675) (Boshen)
- 1bb2539 minifier: Move more code into `minimize_conditions` local loop
(#8671) (Boshen)
- 13e4a45 minifier: Move conditional assignment to `minimize_conditions`
(#8669) (Boshen)
- ae895d8 minifier: Use `NonEmptyStack` for function stack (#8661)
(Boshen)
- 3802d28 minifier: Clean up `try_minimize_conditional` (#8660) (Boshen)
- dcc1f2b minifier: Rename `ast_passes` to `peephole` (#8635) (Boshen)
- 52458de minifier: Remove unused code and traits (#8632) (Boshen)
- 6f95cd5 minifier: Remove all the unnecessary fake ast passes (#8618)
(Boshen)
- 712cae0 minifier: Run the compressor on all test cases (#8604)
(Boshen)
- 864b8ef parser: Shorten code (#8640) (overlookmotel)
- b8d9a51 span: Deal only in owned `Atom`s (#8641) (overlookmotel)
- 20f52b1 span: Remove unnecessary lifetimes on `Atom` impls (#8639)
(overlookmotel)
- ac4f98e span: Derive `Copy` on `Atom` (#8596) (branchseer)
- a730f99 transformer: Move `create_prototype_member` to utils module
(#8657) (Dunqing)
- 61d96fd transformer/class-properties: Correct comments (#8636)
(overlookmotel)

### Testing

- 39dbd2d codegen: Fix snapshot file (#8685) (Boshen)
- d9f5e7f minifier: Enable passed esbuild tests (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-01-24 12:09:37 +08:00
Dunqing
233dc07738 feat(ast): derive Clone for TemplateElement and TemplateElementValue (#8658)
In #8614, we need to duplicate the same template literal, and derive `Copy` and `Clone` to avoid using `CloneIn`.
2025-01-24 03:58:33 +00:00
Boshen
39dbd2d472
test(codegen): fix snapshot file (#8685) 2025-01-24 11:58:02 +08:00
sapphi-red
343690e178
feat(minifier): replace Number.*_SAFE_INTEGER/Number.EPSILON (#8682)
The value of `Number.*_SAFE_INTEGER`, `Number.EPSILON` are constants as they cannot be changed. This PR replaces them with `2**53-1` / `-(2**53-1)` / `2**-52` for ES2016+. For ES2015, `Number.EPSILON` is not changed but `Number.*_SAFE_INTEGER`s are replaced with `9007199254740991` / `-9007199254740991`.

**Reference**
- Spec of [`Number.MAX_SAFE_INTEGER`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_safe_integer)
- Spec of [`Number.MIN_SAFE_INTEGER`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.min_safe_integer)
- Spec of [`Number.EPSILON`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.epsilon)

### Additional Information
- [`Number.MIN_VALUE`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.min_value) cannot be replaced as the value depends on the runtime
- [`Number.MAX_VALUE`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_value) can be replaced but I didn't come up with a shorter representation that does not lack precision
2025-01-24 03:47:52 +00:00
sapphi-red
0c5bb30859
feat(minifier): replace Number.POSITIVE_INFINITY/Number.NEGATIVE_INFINITY/Number.NaN (#8681)
The value of `Number.POSITIVE_INFINITY`, `Number.NEGATIVE_INFINITY`, `Number.NaN` are constants as they cannot be changed. This PR replaces them with `Infinity`/`-Infinity`/`NaN`.

**Reference**
- Spec of [`Number.POSITIVE_INFINITY`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.positive_infinity)
- Spec of [`Number.NEGATIVE_INFINITY`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.positive_infinity)
- Spec of [`Number.NaN`](https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.positive_infinity)
2025-01-23 15:26:22 +00:00
Boshen
a3dc4c3cbe refactor(crates): clean up snapshot files (#8680) 2025-01-23 14:43:32 +00:00
Boshen
99607d3f82 feat(codegen): print comments in TSTypeLiteral (#8679)
fixes #8665
2025-01-23 14:31:55 +00:00
Boshen
23b49a665f refactor(linter): use cow_to_ascii_lowercase instead cow_to_lowercase (#8678)
`cow_to_lowercase` is slow as it deals with unicode.

closes #8659
2025-01-23 13:46:52 +00:00
Boshen
883d25b27d fix(minifier): keep esm in dce (#8677)
fixes https://github.com/rolldown/rolldown/issues/3402
2025-01-23 13:30:41 +00:00
Boshen
ce2b9da5c7 refactor(minifier): remove wrap_to_avoid_ambiguous_else (#8676) 2025-01-23 13:20:32 +00:00