Samuel Attard
9ef028c2ad
feat(codegen): add ascii_only option ( #25994 )
...
Closes #17068 . Supersedes #18095 / #18118 .
Adds `CodegenOptions::ascii_only` (and `codegen.asciiOnly` in
`oxc_minify_napi`): escape every non-ASCII character in string literals,
untagged template literals, regexp literals, directives and identifier
names so the output is 7-bit clean — like esbuild `--charset=ascii` /
terser `format.ascii_only`. Off by default; the default path is
untouched (codegen bench and conformance unchanged).
```js
// Input
let café = "naïve 😀 ";
let re = /[–—]/u;
// Output with ascii_only: true
let caf\u00E9 = "na\u00EFve \u{1F600}";
let re = /[\u2013\u2014]/u;
```
Characters above U+FFFF use ES2015 code-point escapes. Regex patterns
use escaped surrogate pairs instead; RegExp.prototype.source reflects
the escaped spelling.
Tagged template quasis, JSX names/text/attribute strings, hashbangs and
preserved comments may still contain non-ASCII characters. JavaScript
expressions inside tagged templates and JSX are escaped normally.
Performance; with the option disabled, codegen codspeed benchmarks are
withing noise (<1%). With the option on, performance is only affected
for files that contain non ascii characters.
---
Our use case is a large Vite/Rolldown app served through proxies that
mangle non-ASCII JS (previously handled by terser's `ascii_only`);
#17068 also lists deno_core snapshots and Chrome extension content
scripts.
AI-assisted (Claude Code); I reviewed the code, wrote the tests, and
have been running this in production builds via a vendored
`oxc_codegen`.
---------
Co-authored-by: Samuel Attard <6634592+MarshallOfSound@users.noreply.github.com >
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
Co-authored-by: Dunqing <dengqing0821@gmail.com >
2026-09-10 17:10:02 +01:00
renovate[bot]
59e8d5fb91
chore(deps): update napi ( #26533 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) | Type |
Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.9.0` →
`3.9.1`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.9.0/3.9.1 ) |

|

|

|

| pnpm.catalog.default | patch |
| [napi](https://redirect.github.com/napi-rs/napi-rs ) | `3.12.2` →
`3.12.3` |

|

|

|

| workspace.dependencies | patch |
| [napi-derive](https://redirect.github.com/napi-rs/napi-rs ) | `3.6.3` →
`3.6.4` |

|

|

|

| workspace.dependencies | patch |
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.9.1`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.9.0...@napi-rs/cli@3.9.1 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.9.0...@napi-rs/cli@3.9.1 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions ) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC43MS4wIiwidXBkYXRlZEluVmVyIjoiNDQuNzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
2026-09-10 14:26:42 +00:00
oxc-guard
60fa13878c
release(crates): oxc v0.149.0 ( #26397 )
...
### 💥 BREAKING CHANGES
- 66744f0 parser: [**BREAKING**] Rename `panicked` to `fatal_error` in `ParserReturn` (#26382 ) (overlookmotel)
- 2c9a947 parser: [**BREAKING**] Reduce `MAX_LEN` to 256 bytes below `u32::MAX` (#26352 ) (overlookmotel)
### 🚀 Features
- 32bdc5b allocator: Construct `ArenaHashSet` with any `Default` hasher (#26372 ) (Dunqing)
- a17de58 minifier: Process of return/throw in non last position and fix async * inlining (#26214 ) (Armano)
- bfb4c57 parser: Distinguish unapplied no-side-effects comments (#26120 ) (碳苯 Carbon)
- 1d9b9d3 ast: Add `GetNodeId` trait (#26145 ) (camc314)
### 🐛 Bug Fixes
- b156333 codegen: Order accessibility before abstract on accessors (#26392 ) (camc314)
- 116c8b8 transformer/class-properties: Keep private methods in class-expression scope (#26308 ) (Changsu Seong)
- 1400a0f parser: Require a string source after `export ... from` (#26389 ) (camc314)
- 2da73b7 codegen: Print matching quoted import names as identifiers (#26386 ) (camc314)
- 0a81d29 codegen: Preserve private-in left operand precedence (#26383 ) (camc314)
- 9a02337 parser: Correctly round large nondecimal literals (#26379 ) (camc314)
- 3d95477 transformer: Gate async-only rewrites by owning transform (#26326 ) (Dunqing)
- f45a9ee transformer: Limit arguments capture to lowered async functions (#26317 ) (Dunqing)
- 789969f transformer: Gate this capture by owning async transform (#26227 ) (Dunqing)
- affeb14 minifier: Mangle class private members in Node API (#26118 ) (碳苯 Carbon)
- 8b35abd semantic: Detect duplicate private class elements (#26361 ) (camc314)
- 457ed57 semantic: Reject await and yield in rest parameter defaults (#26359 ) (camc314)
- 4b89c7b semantic: Reject jumps across arrow functions (#26357 ) (camc314)
- c966aca parser: Do not omit `<` token opening type argument list (#26328 ) (overlookmotel)
- f07dca5 ast_visit: Add the trimmed prefix length to translation table offsets (#26173 ) (Bharadwaj Pendyala)
- 3ab9bd1 parser: Do not re-lex template substitution tail after fatal error (#26230 ) (overlookmotel)
- 07851b9 parser: Fix debug assert failure when lexer error with tokens enabled (#26229 ) (overlookmotel)
- 00dea7a allocator: Gate `Allocator::data_end_ptr` behind fixed_size feature (#26248 ) (camc314)
- 853ffab ecmascript: Avoid `charAt` panic on 32-bit (#26244 ) (camc314)
- 34feccb runtime: Remove stale regenerator exports (#26243 ) (camc314)
### ⚡ Performance
- 34a242e minifier: Use `Ident` for property mangler (#26334 ) (sapphi-red)
- 5303f5c minifier: Unify merging of last expression into target sequence (#26264 ) (Armano)
- 2ca7d29 minifier: Consume nodes in minimize_statements in reverse order (#26258 ) (Armano)
- d2354b4 mangler: Use `Ident` for variable names to keep (#26333 ) (sapphi-red)
- 5b3e335 minifier: Use `Ident` instead of `Str` in `KeepVar` (#26332 ) (sapphi-red)
- 51366fb minifier: Use `IdentHashSet` in `PrivateMemberUsageStack` (#26331 ) (sapphi-red)
- d19c42a minifier: Merge nested if stmt in place instead of creating dummies (#26351 ) (Armano)
- 356def6 parser: Shrink annotation comment ranges (#26356 ) (overlookmotel)
- a5be474 parser: Shave instruction off `parse_jsx_element_name` (#26355 ) (overlookmotel)
- 9780663 parser: Remove fatal error guard from `parse_jsx_element_name` (#26354 ) (overlookmotel)
- 766e12f parser: Remove `token` field from `LexerCheckpoint` (#26350 ) (overlookmotel)
### 📚 Documentation
- d4b4e61 transformer: Document ES2015 target floor (#26378 ) (Dunqing)
- 67dd054 ast_visit: Correct out-of-date comments on `Utf8ToUtf16` converter (#26285 ) (overlookmotel)
- a8ed2a7 minifier: Fix stale validation instructions (#26251 ) (camc314)
2026-09-07 14:29:34 +00:00
碳苯 Carbon
affeb14f5a
fix(minifier): mangle class private members in Node API ( #26118 )
...
## Summary
Fixes #26097 .
The minify function did not work on class private fields,because their
mappings were not forwarded to codegen:
```rs
class Foo {
#privateField = 1;
method() {
return this.#privateField;
}
}
```
And this PR is to make it match what's expected:
```rs
class Foo {
#e = 1;
method() {
return this.#e;
}
}
```
2026-09-07 14:36:22 +09:00
renovate[bot]
8dd81f9bb8
chore(deps): update dependency @napi-rs/cli to v3.9.0 ( #26256 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) |
|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.8.6` →
`3.9.0`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.8.6/3.9.0 ) |

|

|

|

|
---
> [!WARNING]
> Some dependencies could not be looked up. Check the warning logs for
more information.
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.9.0`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.6...@napi-rs/cli@3.9.0 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.6...@napi-rs/cli@3.9.0 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC41Ny4zIiwidXBkYXRlZEluVmVyIjoiNDQuNjEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-09-04 14:22:16 +00:00
oxc-guard
894c8f9cd8
release(crates): oxc v0.148.0 ( #26198 )
...
### 💥 BREAKING CHANGES
- a31567a allocator: [**BREAKING**] Make `Allocator::cursor_ptr` and `data_end_ptr` private (#26081 ) (overlookmotel)
### 🚀 Features
- 784e9fa minifier: Invert `!0` and `!1` in place for boolean context to `1` and `0` (#26050 ) (Armano)
- 1e902cc minifier: Expand fold leading assignments into the var decl (#26142 ) (Armano)
- 3ed4f6a minifier: Expand de morgan's optimization to allow move of `!` (#25930 ) (Armano)
- 5672585 parser: Attach all comments to nodes (#25944 ) (camc314)
### 🐛 Bug Fixes
- 4adfb4c semantic: Validate chained continue labels (#26157 ) (camc314)
- b874f48 ecmascript: `Math.round` only exact half ties (#26150 ) (camc314)
- a625378 minifier: Coerce omitted `indexOf` search argument (#26149 ) (camc314)
- dc7398b ecmascript: Trim trailing whitespace in string to number (#26148 ) (camc314)
- 243b685 transformer/object-rest: Lower multiple declarators correctly (#26147 ) (camc314)
- dc09a3a parser: Avoid panic on escaped string export names (#26146 ) (camc314)
- e412cf2 linter: Clamp invalid JS plugin locations (#26144 ) (camc314)
- c3dedc9 semantic: Skip function body bindings in parameters (#26099 ) (Dunqing)
- e74de61 transform-react: Match Babel diagnostic reporting (#26128 ) (Boshen)
- d5163d0 parser: Correctly classify unapplied pure annotations (#26084 ) (camc314)
- 8531b9b linter/plugins: Alter method for obtaining mutable `Program` when sending AST to JS plugins (#26077 ) (overlookmotel)
- 9b51658 regular_expression: Allow oversized decimal escape for Annex B (#26070 ) (leaysgur)
- c8de4df regular_expression: Reject oversized backreferences (#26055 ) (camc314)
### ⚡ Performance
- ac4785a diagnostics: Use fixed ANSI styles (#26130 ) (Boshen)
- 07a0793 packages/codegen: Flatten output in chunks (#26109 ) (overlookmotel)
- 487427a packages/codegen: Faster string flattening (#26108 ) (overlookmotel)
- 7785583 packages/codegen: Ensure indent strings are flattened (#26107 ) (overlookmotel)
- 0dd4db3 packages/codegen: Store mapping positions in an `Int32Array` (#26085 ) (overlookmotel)
2026-09-01 08:15:07 +00:00
Boshen
63bc313934
chore(npm): update funding URL ( #26066 )
...
Update npm package funding links to the Oxc organization sponsorship page.
Closes #26062 .
AI-assisted with Codex.
2026-08-24 14:42:18 +00:00
oxc-guard
4e258430cd
release(crates): oxc v0.147.0 ( #26046 )
...
### 🚀 Features
- b6e9e5e minifier: Fold switch stmt whose parent is not block stmt (#25403 ) (Armano)
### 🐛 Bug Fixes
- 8a9bdbd estree: Include decorators in `FormalParameterRest ` spans (#26021 ) (camc314)
- 6f0c7cf minifier: Avoid merging `if` to `for` in sloppy mode when containing function declaration (#25638 ) (sapphi-red)
- 2cde1f6 rust: Address nightly deprecations (#25998 ) (Boshen)
- 6c5ad1b codegen: Only add mapping names for `PrivateIdentifier`s which have changed (#25958 ) (overlookmotel)
- 2dad1e0 parser: Track irregular line terminators in trivia (#25947 ) (camc314)
- 58ba651 minifier: Avoid merging `if` to `for` when the body contains a function declaration (#25637 ) (sapphi-red)
- a185ac3 codegen: Print `#` before private identifier in TS signature key (#25938 ) (overlookmotel)
- af82a07 minifier: Keep unary `+` when the other operand has side effects (#25645 ) (Kotaro Chikuba)
### ⚡ Performance
- 53f6270 packages/codegen: Eagerly initialize `mapNames` (#25979 ) (overlookmotel)
- 5b43c60 packages/codegen: Split recording mappings into multiple functions (#25978 ) (overlookmotel)
- cc947b5 packages/codegen: Reduce property lookups (#25977 ) (overlookmotel)
- c22a9cc packages/codegen: Combine condition checks (#25976 ) (overlookmotel)
- 215a6a5 packages/codegen: Add functions for writing/marking unnamed mappings (#25975 ) (overlookmotel)
- fe444cc codegen: Avoid allocations for single comment anchors (#25598 ) (camc314)
- a0aee81 minifier: Do not rebuild expression when substituting void to null (#25964 ) (Armano)
- 1004439 packages/codegen: Merge `mark` and `write` calls in `printImportAttributes` (#25972 ) (overlookmotel)
- 94c8a34 packages/codegen: Remove `node` param from `printString` and `printNonNegativeFloat` (#25971 ) (overlookmotel)
- 7e2b4b3 packages/codegen: `printNonNegativeFloat` write mapping directly (#25968 ) (overlookmotel)
- f09c8ab minifier: Avoid creation of unnecessary conditional expressions (#25931 ) (Armano)
- 53ff080 packages/codegen: Remove `lastWasPostfixClose` (#25888 ) (overlookmotel)
### 📚 Documentation
- 07de646 packages/codegen: Fix JSDoc comments on `write*` methods (#25966 ) (overlookmotel)
- 3b09c04 packages/codegen: Clarify comment (#25959 ) (overlookmotel)
2026-08-24 11:19:12 +00:00
oxc-guard
0389c4010e
release(crates): oxc v0.146.0 ( #25912 )
...
### 🚀 Features
- 83cb516 minifier: Improve negation of expressions in boolean context (#25755 ) (Armano)
### 🐛 Bug Fixes
- 134fb22 isolated-declarations: Preserve unresolved parameter types (#25909 ) (Dunqing)
- 526c2b3 codegen: Remove deprecated test APIs (#25889 ) (camc314)
- 344a9b2 codegen: Align enum template sourcemaps (#25872 ) (camc314)
### ⚡ Performance
- 5ef0c93 minifier: Unwrap all unary exprs without creating dummy expressions (#25891 ) (Armano)
- 8783524 packages/codegen: Remove loop from `growMappingBuffer` (#25886 ) (overlookmotel)
- b6b14c0 packages/codegen: Remove redundant branch (#25885 ) (overlookmotel)
- be6adf0 packages/sourcemap: Make `location` passed to `recordSourceMapping` always a number (#25884 ) (overlookmotel)
- f720f15 packages/codegen: Take named-mapping only code off hot path in `recordSourceMapping` (#25883 ) (overlookmotel)
- a734af5 packages/codegen: Remove redundant setting of `last` in `printImportAttributes` and `printIf` (#25882 ) (overlookmotel)
- c6e44c6 packages/codegen: Combine 2 writes in `printJSXElement` (#25881 ) (overlookmotel)
- 8801662 packages/codegen: Remove redundant mapping from `printParams` (#25880 ) (overlookmotel)
### 📚 Documentation
- 5ad330e packages/codegen: Reformat comments (#25876 ) (overlookmotel)
2026-08-19 08:29:51 +00:00
oxc-guard[bot]
4a4a1fb2e7
release(crates): oxc v0.145.0 ( #25865 )
...
### 💥 BREAKING CHANGES
- 365274e packages/codegen: [**BREAKING**] `printSync` return an object
(#25720 ) (overlookmotel)
### 🚀 Features
- 6a7eb60 packages/codegen: Alter capitalization of `sourceFilename`
option (#25854 ) (overlookmotel)
- 300763f packages/codegen: Add full source map support (#25585 )
(camc314)
- a169e4a napi/minify: Expose property name mangling options (#24741 )
(Dunqing)
- 2f5cdb1 minifier: Add property name mangling (#24740 ) (Dunqing)
- 4922141 mangler: Deduplicate private accessor names (#25601 ) (camc314)
- 1c4f519 napi: Add Relay transform plugin (#25503 ) (Boshen)
- a4478e9 codegen: Add `oxc-codegen` package (#25488 ) (overlookmotel)
### 🐛 Bug Fixes
- 0fbcf64 codegen: Validate sourcemap options (#25860 ) (camc314)
- 345f981 react_compiler: Skip node_modules by default (#25859 ) (Boshen)
- ab81f3f minifier: Drop side-effect-free additions (#25639 ) (Dunqing)
- 241c559 napi/minify: Accept RegExp for property filters (#25827 )
(Dunqing)
- 4cc7ea4 codegen: Reject invalid indent options (#25807 ) (camc314)
- 53f9295 isolated-declarations: Preserve undefined for defaulted any
(#25292 ) (camc314)
- 8ab883a codegen: Preserve property key annotations (#25766 ) (Dunqing)
- b13fd48 minifier: Model uninitialized module vars as undefined
(#25497 ) (Dunqing)
- f6000ac ecmascript: Fold `**` with `Number::exponentiate`, not IEEE
`pow` (#25644 ) (Kotaro Chikuba)
- b846abc isolated-declarations: Handle ambient expando properties
(#25655 ) (camc314)
- dec0a86 react-compiler: Standardize diagnostics (#25702 ) (Boshen)
- fca2e0c parser: Reject initialized lexical declarations in for-in
(#25700 ) (Boshen)
- ae9be8f parser: Forbid type parameters on quoted constructors (#25696 )
(Boshen)
- c5f188a react-compiler: Use Babel v1 validation defaults (#25676 )
(Boshen)
- db44651 napi: Disable reuseWorker in browser bindings (#25640 )
(leaysgur)
- ce35d47 react_compiler: Preserve JSX import source pragmas (#25592 )
(Boshen)
- 059784d semantic: Respect shadowed `Infinity` and `NaN` in enum
evaluation (#25604 ) (camc314)
- bb5a232 minifier: Keep variable declaration initilized with class when
keepNames is enabled (#25584 ) (sapphi-red)
- f49229d minifier: Keep side effects when rotating bitwise operands
(#25596 ) (Kotaro Chikuba)
- e82495b ecmascript: Derive `ToNumber` of `!x` from `ToBoolean`
(#25595 ) (Kotaro Chikuba)
- 509931b semantic: Classify global references per identifier (#25608 )
(camc314)
- 80484ce mangler: Correct base54 safety comment (#25606 ) (camc314)
- c1369a7 codegen: Resolve private names in class heritage (#25588 )
(camc314)
- c002f29 codegen: Escape sources for empty import specifiers (#25586 )
(camc314)
- 0c68b7f estree: Emit `decorators` on `FormalParameterRest` (#25582 )
(camc314)
- cdf1846 semantic: Allow legacy escapes in JSX attributes (#25576 )
(Boshen)
- e75e102 minifier: Preserve block statement in labeled iteration
statements (#25162 ) (Armano)
- 771d79a mangler: Exclude non-manglable symbols from slot assignment
(#25539 ) (sapphi-red)
- 76b19f5 minifier: Avoid duplicating large folded strings (#25532 )
(Dunqing)
- 59e8895 codegen: Validate starting indent level (#25550 ) (camc314)
- 88b34f2 clippy: Remove unneeded `unsafe` (#25551 ) (camc314)
- 23a7ad0 parser: Stop delimited lists at end of file (#25542 ) (Boshen)
- 73acba9 parser: Preserve fatal errors during await reparse (#25541 )
(Boshen)
- c3e99d1 minifier: Avoid invalid octal escapes in template folds
(#25495 ) (Dunqing)
- b4e6a9e codegen: Output newline after `export default interface`
(#25487 ) (overlookmotel)
- 5fcf683 minifier: Correct issue with try finally termination (#25185 )
(Armano)
- 1645d93 react_compiler: Preserve source spans (#25462 ) (Boshen)
- 8d7f9cf react_compiler: Honor eslint suppressions (#25394 ) (Boshen)
### ⚡ Performance
- 568203e ecmascript: Use binary search for known globals (#25817 )
(Boshen)
- c84ede3 estree_tokens: Share JS token update entry point (#25826 )
(Boshen)
- 9a6e862 minifier: Move owned statements directly (#25835 ) (Dunqing)
- 61b2aef minifier: Move owned AST nodes directly (#25837 ) (Dunqing)
- 673b04b minifier: Replace expressions without take_in dummies (#25836 )
(Dunqing)
- 63ff8ef linter: Outline diagnostic construction (#25762 ) (Boshen)
- 621808e diagnostics: Measure graphemes lazily (#25723 ) (Boshen)
- f62ed0e diagnostics: Optimize graphical number rendering (#25715 )
(Boshen)
- 7152834 diagnostics: Reduce graphical formatting overhead (#25714 )
(Boshen)
- 10fc4b7 diagnostics: Reduce graphical rendering allocations (#25711 )
(Boshen)
- 9c8abab diagnostics: Batch graphical reports (#25710 ) (Boshen)
- 757f3d4 mangler: Share allocated names across reused slots (#25605 )
(camc314)
- 5444cbf codegen: Skip escaping harmless `<` tokens (#25564 ) (camc314)
### 📚 Documentation
- 58f7ab9 packages/codegen: Reformat docs and comments (#25848 )
(overlookmotel)
- 627466e transform-react: Document all options (#25800 ) (Boshen)
- ce03ac1 packages/codegen: Fix JSDoc comments for `printSync` (#25722 )
(overlookmotel)
- 386a699 packages/codegen: Correct JSDoc comment (#25716 )
(overlookmotel)
- 31e571d mangler: Update code example (#25599 ) (camc314)
- fd62354 codegen: Revamp package readme (#25560 ) (camc314)
- ffa3153 codegen: Clarify raw transfer Node requirement (#25565 )
(camc314)
- c5d4063 codegen: Clarify binary walk allocations (#25562 ) (camc314)
- 5703d7a codegen: Correct stale printer comments (#25561 ) (camc314)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-08-18 22:26:40 +08:00
Dunqing
65da89795a
refactor(napi): share JavaScript RegExp conversion ( #25834 )
...
Oxc and Rolldown currently duplicate the N-API conversion between a JavaScript `RegExp` and owned Rust data.
This moves that conversion to `oxc_napi::JsRegExp`. It copies `source`, `flags`, and `lastIndex`, supports converting back to a JavaScript `RegExp`, and keeps regex compilation in each consumer. `oxc_minify_napi::JsRegExp` remains available as a re-export.
This is a good place to put since Rolldown already used `oxc_napi` and crate is exactly for napi related struct
2026-08-18 07:25:04 +00:00
Dunqing
241c559b83
fix(napi/minify): accept RegExp for property filters ( #25827 )
...
This follows up on #24741 and addresses API feedback received after it was merged.
### Feature
`mangleProps.include` and `mangleProps.exclude` now accept JavaScript `RegExp` values instead of strings.
The binding copies the regular expression source and flags before async minification starts, then compiles the pattern once with Rust's regex engine. Native and WASI bindings expose the same API. The core Rust minifier API is unchanged.
### Example
```js
mangleProps: {
include: /^_/,
exclude: /^__public/,
}
```
### Limitation
Matching uses Rust regex syntax. The `i`, `m`, `s`, and `u` flags are supported. Unsupported JavaScript syntax or flags are returned as option errors.
### AI assistance
OpenAI Codex was used for research, implementation, review, and testing. I reviewed and take responsibility for the changes.
2026-08-18 05:37:31 +00:00
Dunqing
a169e4adf8
feat(napi/minify): expose property name mangling options ( #24741 )
...
The property mangler added in #24740 is not available through `oxc-minify`. This adds `mangleProps` for configuring it and `mangleCache` for reusing chosen property names.
### Feature
- `include` selects property names to mangle. `exclude` and `reserved` keep names unchanged.
- `quoted` also mangles quoted property names. `debug` produces readable output names.
- `cache` fixes a property to a chosen name. A `false` value keeps the original name.
- Property mangling works in both sync and async APIs. It is separate from identifier mangling.
- When property mangling is enabled and the call succeeds, the result includes the updated `mangleCache`.
- Invalid `mangleProps` regexes and cache entries are returned in `result.errors`.
### Design
The binding converts JavaScript values into core minifier options and results. The core minifier still chooses names and rewrites properties, so both APIs follow the same rules.
A parser error may leave an incomplete AST. In that case, property mangling is skipped and no partial cache is returned.
### Example
```js
const result = minifySync(
"test.js",
"let local; obj._often; obj._rare; obj._often;",
{
compress: false,
mangle: false,
mangleProps: { include: "^_" },
},
);
result.code; // "let local;obj.e;obj.t;obj.e;"
result.mangleCache; // { _often: "e", _rare: "t" }
```
### Limitation
- `include` and `exclude` use Rust regex syntax. They match anywhere unless the pattern includes anchors.
- Do not reuse the cache on already-mangled output. A mapping is not always safe to apply twice.
- The cache only remembers recorded mappings. It cannot find unchanged names in another input or in external code. Reserve, exclude, or pin those names before the first call.
- String cache targets must be valid JavaScript `IdentifierName` values and cannot be `__proto__`, `constructor`, or `prototype`. The original name `__proto__` cannot be a cache key.
AI assistance: OpenAI Codex and Claude were used for research, implementation, adversarial review, and verification. The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
2026-08-18 02:40:36 +00:00
Dunqing
2f5cdb1231
feat(minifier): add property name mangling ( #24740 )
...
Oxc can shorten variable names and private class names, but it cannot shorten property names such as `obj._field`. This change adds optional property mangling. It replaces #23772 and gives bundlers a way to use the same property names across several files.
### Feature
- `include` selects names to mangle. `exclude` and `reserved` keep names unchanged.
- The cache can give a property a fixed output name or keep it unchanged.
- The mangler supports member access, object and class keys, destructuring, optional chains, the left side of `in`, and JSX property names.
- `mangle_quoted` also handles strings and template literals used directly as property keys. `/* @__KEY__ */` and `/* #__KEY__ */` can mark one other string or template literal as a property key.
- Short names are assigned in a stable order. More common properties get shorter names. Existing and reserved names are avoided.
- Bundlers can collect names from several programs, create one shared map, and apply it to every program.
- Numeric keys, `__proto__`, `constructor`, `prototype`, TypeScript-only keys, and private names are never changed by this pass.
### Design
Property names are part of JavaScript syntax, not local scope. For this reason, the code lives in `oxc_minifier`. It only reuses the short-name generator from `oxc_mangler`.
For one program, the order is:
```text
collect names → assign names → rewrite once → compress → mangle variables and private names
```
Property names are rewritten before compression because compression can remove information about quotes and comments.
For several programs, a bundler collects names from each program, merges the results, assigns one shared map, and rewrites each program once. Collection can run in parallel. All programs must use the same options.
The shared map keeps property names consistent inside one build. The cache has a different job: it keeps fixed names and reservations across separate minify calls.
### Example
With `include: "^_"` and `mangle_quoted: true`:
```js
obj[`_field`] = 1;
obj._field = 2;
```
becomes:
```js
obj[`e`] = 1;
obj.e = 2;
```
### Limitation
- Property mangling is unsafe when other code still uses the old property name. Public APIs and names shared with external code, host APIs, imported namespace objects, or separate builds must be excluded or reserved.
- Quote handling is per use. Without `mangle_quoted`, `obj._field` may change while `obj["_field"]` does not.
- The mangler cannot find names built at runtime or stored in arbitrary strings. Code that uses `eval`, `Function`, or `with` must reserve any affected names.
- Compression may create a matching property after this pass has finished. For example, `'f' + 'oo_'` may later become `foo_` and will not be mangled.
- TypeScript enum reverse mappings are not supported because the transform creates quoted strings.
- Multi-program support is a caller API. The caller must collect every program that shares mangled properties before assigning names.
The public `oxc-minify` API is stacked in #24741 . The downstream multi-chunk integration is shown in rolldown/rolldown#10374 .
Supersedes #23772 .
AI assistance: OpenAI Codex and Claude were used for research, implementation, review, and testing. The contributor is responsible for reviewing and understanding the changes before submission.
2026-08-17 07:50:51 +00:00
leaysgur
db446518ca
fix(napi): disable reuseWorker in browser bindings ( #25640 )
...
Fixes #25610
AI assistance: Codex was used to implement this change.
2026-08-14 11:11:20 +00:00
oxc-guard
b6f1458dec
release(crates): oxc v0.144.0 ( #25474 )
...
### 💥 BREAKING CHANGES
- a33788e ast: [**BREAKING**] Group class heritage into `ClassHeritage` (#25360 ) (camc314)
- 5c5cdcd ast: [**BREAKING**] Narrow `TSInterfaceHeritage::expression` to TSTypeName (#24360 ) (camc314)
- 6be314f ast: [**BREAKING**] Remove duplicated `VariableDeclarator::kind` (#25319 ) (camc314)
- 44fd320 ast: [**BREAKING**] Split TS external modules & Namespace Declarations (#25284 ) (camc314)
### 🚀 Features
- 9a37c41 napi: Restructure React transform options (#25326 ) (Boshen)
- b3c1b30 allocator: Add `ArenaVec::push_mut` (#25338 ) (overlookmotel)
### 🐛 Bug Fixes
- bbd6ed3 codegen: Wrap string literal in parens after directives (#25435 ) (overlookmotel)
- d07a293 codegen: Preserve cast parentheses in conditional tests (#25115 ) (camc314)
- 8b7d441 codegen: Preserve satisfies parentheses before bitwise operators (#25113 ) (camc314)
- e0fb2d7 minifier: Avoid unsafe return removal in labeled blocks (#25406 ) (Armano)
- c49f4ce parser: Preserve terminal license comments (#25400 ) (camc314)
- 9d19ab3 transform_react: Downgrade nonfatal compiler diagnostics (#25418 ) (Boshen)
- 937825c react_compiler: Disable exhaustive memo validation by default (#25417 ) (Boshen)
- 12937b3 parser: Reject comma expressions in class fields (#25385 ) (Cameron)
- 7d8a9b5 react_compiler: Preserve hook spans for React Refresh (#25393 ) (Boshen)
- 9e93ba6 parser: Reset auto-accessor initializer context (#25384 ) (camc314)
- cc2e28d parser: Reject trailing tokens in `Parser::parse_expression` (#25371 ) (camc314)
- 697c629 minifier: Preserve Annex B labeled-function bindings in implicit-return rewrite (#25349 ) (Armano)
- 4d723ca parser: Report TS1035 for quoted module names (#25305 ) (camc314)
- 0c9b980 semantic: Report module declaration diagnostics (#25285 ) (camc314)
- 2a1058a napi: Omit parser header from WASI declarations (#25254 ) (camc314)
### ⚡ Performance
- dd1430b semantic: Avoid allocation in class overload check (#25440 ) (camc314)
- e420816 parser: Optimize trailing comma tracking (#25376 ) (camc314)
- 6529d1a minifier: Short-circuit scope check when alternate already determines result (#25318 ) (Armano)
### 📚 Documentation
- fe111eb allocator: Improve doc comments for `Arena` methods (#24922 ) (overlookmotel)
2026-08-10 09:57:10 +00:00
renovate[bot]
b91dc3a1f1
chore(deps): update napi ( #25457 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) | Type |
Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.8.3` →
`3.8.5`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.8.3/3.8.5 ) |

|

|

|

| pnpm.catalog.default | patch |
| [napi](https://redirect.github.com/napi-rs/napi-rs ) | `3.12.0` →
`3.12.1` |

|

|

|

| workspace.dependencies | patch |
| [napi-build](https://redirect.github.com/napi-rs/napi-rs ) | `2.4.0` →
`2.4.1` |

|

|

|

| workspace.dependencies | patch |
| [napi-derive](https://redirect.github.com/napi-rs/napi-rs ) | `3.6.2` →
`3.6.3` |

|

|

|

| workspace.dependencies | patch |
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.8.5`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.4...a5b5f277ab56e7e7e903b392b15c79da7a6520ce )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.4...@napi-rs/cli@3.8.5 )
###
[`v3.8.4`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.3...@napi-rs/cli@3.8.4 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.3...@napi-rs/cli@3.8.4 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions ) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMi4wIiwidXBkYXRlZEluVmVyIjoiNDQuMTIuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron <cclark@cloudflare.com >
2026-08-10 08:39:38 +00:00
renovate[bot]
d0b8d6ff22
chore(deps): update dependency @napi-rs/cli to v3.8.3 ( #25434 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) |
|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.8.2` →
`3.8.3`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.8.2/3.8.3 ) |

|

|

|

|
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.8.3`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.2...@napi-rs/cli@3.8.3 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.2...@napi-rs/cli@3.8.3 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMi4wIiwidXBkYXRlZEluVmVyIjoiNDQuMTIuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
2026-08-09 13:25:05 +00:00
oxc-guard
45a17c25d1
release(crates): oxc v0.143.0 ( #25250 )
...
### 💥 BREAKING CHANGES
- 4120da0 semantic: [**BREAKING**] Return borrowed JSDoc so the parse cache works (#25186 ) (Connor Shea)
- f0a41c8 allocator: [**BREAKING**] Remove `ArenaBox::dangling` method (#25236 ) (overlookmotel)
- 067da8c ast: [**BREAKING**] Store single parameter in `TSIndexSignature::parameter` (#25154 ) (camc314)
- a0c7788 ast: [**BREAKING**] Change `TSIndexSignatureName::name` to `Ident` (#25150 ) (camc314)
- 1bdedd1 ast: [**BREAKING**] Introduce `ExportDeclaration`, `ExportFromDeclaration` (#25095 ) (camc314)
- c917f20 ast: [**BREAKING**] Introduce `ArrowFunctionBody` enum (#24987 ) (camc314)
- 7e1199c ast: [**BREAKING**] Remove conversion to `Box` from AST builder methods (#25038 ) (overlookmotel)
### 🚀 Features
- 3c8312e allocator: Make `Box` `Send` + `Sync` when the type it contains is (#25242 ) (overlookmotel)
- cb5bc08 ast: Derive `GetSpan` for `Comment` (#25147 ) (leaysgur)
- 8541e18 ast_tools: Generate minifier scope collector (#25088 ) (camc314)
- 5acdae2 ecmascript: Skip transparent TS expressions (#25072 ) (camc314)
- 85d0f4d napi: Add React Compiler transform binding (#24934 ) (Boshen)
- 70d6ece minifier: Fold safe integer exponentiation (#25009 ) (Dunqing)
- 73fc747 minifier: Enable termination statement optimization for do while (#24921 ) (Armano)
- 5eadfdb minifier: Fold safe integer division and remainder (#24981 ) (Dunqing)
### 🐛 Bug Fixes
- 6c9ee14 minifier: Preserve if-chain idempotency and correct side effects when alternate should not be moved (#25041 ) (Armano)
- 8a47ff3 ecmascript: Do not treat lone-surrogate strings as constants (#25084 ) (Dunqing)
- 468b970 isolated-declarations: Strip re-export attributes (#25090 ) (camc314)
- a70035d parser: Report export imports in namespaces (#25086 ) (camc314)
- 5d8ccf5 react_compiler: Preserve nonfatal diagnostics (#25066 ) (Boshen)
- d349e4a react_compiler: Match eslint suppression gating (#25068 ) (Boshen)
- 0dc16ba react_compiler: Track catch block declarations (#25067 ) (Boshen)
- e6734a5 minifier: Fold typeof comparisons with known object strings (#25017 ) (Dunqing)
- 3a9d5a5 minifier: Keep `typeof foo == ['object']` as-is (#24941 ) (sapphi-red)
- 10ec276 ast: Custom AST builder methods take `IntoIn<ArenaBox>` where child method does (#25033 ) (overlookmotel)
- fbe8d31 minifier: Respect targets when folding RegExp source (#24790 ) (Dunqing)
### ⚡ Performance
- fb402b0 minifier: Stop re-deriving printed numeric spellings (#25103 ) (Dunqing)
- 7251e52 react_compiler: Avoid large types on stack (#25037 ) (overlookmotel)
- e07718f isolated_declarations: Avoid large types on stack (#25036 ) (overlookmotel)
- 9fb1e3e transformer: Avoid large types on stack (#25035 ) (overlookmotel)
- 8b80f8b parser: Avoid large types on stack (#25034 ) (overlookmotel)
### 📚 Documentation
- 2ea0aa9 ast: Correct grammar in AST builder methods doc comments (#25173 ) (overlookmotel)
2026-08-03 11:07:37 +00:00
renovate[bot]
b937e3e2f1
chore(deps): update napi ( #25019 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) | Type |
Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.7.4` →
`3.8.2`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.7.4/3.8.2 ) |

|

|

|

| pnpm.catalog.default | minor |
| [napi](https://redirect.github.com/napi-rs/napi-rs ) | `3.11.0` →
`3.12.0` |

|

|

|

| workspace.dependencies | minor |
| [napi-build](https://redirect.github.com/napi-rs/napi-rs ) | `2.3.2` →
`2.4.0` |

|

|

|

| workspace.dependencies | minor |
| [napi-derive](https://redirect.github.com/napi-rs/napi-rs ) | `3.6.0` →
`3.6.2` |

|

|

|

| workspace.dependencies | patch |
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.8.2`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.1...@napi-rs/cli@3.8.2 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.1...@napi-rs/cli@3.8.2 )
###
[`v3.8.1`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.0...@napi-rs/cli@3.8.1 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.8.0...@napi-rs/cli@3.8.1 )
###
[`v3.8.0`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.7.4...@napi-rs/cli@3.8.0 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.7.4...@napi-rs/cli@3.8.0 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions ) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODAuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjMuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-08-03 11:21:03 +01:00
oxc-guard[bot]
fc702c1fa9
release(crates): oxc v0.142.0 ( #24977 )
...
### 💥 BREAKING CHANGES
- 1ac5ac7 ast: [**BREAKING**] Tighten bound on `AstBuild` trait (#24925 )
(overlookmotel)
### 🚀 Features
- c7c5696 minifier: Fold parenthesized boolean ternary tests (#24968 )
(Dunqing)
- 82c5806 minifier: Fold sequence branches in boolean ternaries (#24943 )
(Dunqing)
- cc623d9 ast_visit: Add VisitJsMut visitor (#24828 ) (Boshen)
- b31713a minifier: Add new IsTerminated trait and use it in exit-point
optimization (#24950 ) (Armano)
- e9e0f24 minifier: Shorten integer zero comparisons (#24933 ) (Dunqing)
- 34f5559 minifier: Convert switch with one case to if statement
(#24611 ) (Armano)
- 9107e74 str: Add `static_str!` macro (#24887 ) (overlookmotel)
- 4d6f623 parser: Emit error for type args in JS files (#24896 )
(camc314)
- ec08afc ast: Re-export `Ident` from `oxc_ast` crate (#24861 )
(overlookmotel)
- 73cfdfa oxc: Re-export `oxc_str` types from `oxc` crate (#24860 )
(overlookmotel)
- 11f5d1f ast_visit: Add `Utf8ToUtf16::convert_program_and_comments`
(#24859 ) (overlookmotel)
### 🐛 Bug Fixes
- cb5acfb minifier: Optimize termination statements in labeled
statements (#24813 ) (Armano)
- 4618300 minifier: Avoid longer numeric constant folds (#24875 )
(Dunqing)
- f7971f1 minifier: Keep side effects in typeof comparisons (#24940 )
(sapphi-red)
- 4597d6f minifier: Keep side effects when compressing `== true` to `==
1` (#24939 ) (sapphi-red)
- c3a48df minifier: Keep side effects values in template literals
(#24938 ) (sapphi-red)
- e19f183 minifier: Keep side effects when folding `Number` call
(#24937 ) (sapphi-red)
- 9d7745a react-compiler: Preserve warning bailouts (#24935 ) (Boshen)
- 0126aba codegen: Preserve orphaned file coverage comments (#24815 )
(Dunqing)
- 9fbbaf8 parser: Clarify return in class static blocks (#24899 )
(camc314)
- e7d5c78 str: Fix hygiene of `format_ident!` and `format_str!` macros
(#24886 ) (overlookmotel)
- 07e9acc ecmascript: Keep side effects in parent of `toString` calls
(#24846 ) (sapphi-red)
- 16a40ad ecmascript: Detect side effects in unused arguments to
`charCodeAt` (#24845 ) (sapphi-red)
- 5b4ae54 parser: Use specific for-await diagnostic (#24856 ) (camc314)
- ffcc33a parser: Report for-await in non-async functions (#24855 )
(camc314)
- df230d0 minifier: Avoid reordering this in nested class keys (#24785 )
(Dunqing)
- d24b76b minifier: Isolate derived constructor this state (#24784 )
(Dunqing)
- 582805d parser: Parse unary conditional after satisfies (#24807 )
(Boshen)
- 23b904f minifier: Preserve default parameter side effects (#24791 )
(Dunqing)
- 3048594 parser: Use correct diagnostic for `await using` in bare
switch case (#24798 ) (camc314)
- e80574f estree: Handle empty spans serializing `ImportMeta` and
`NewTarget` (#24775 ) (overlookmotel)
- 4b12840 minifier: Do not fold a `-0` ternary branch to `+a` (loses the
sign) (#23637 ) (Jerry Zhao)
- 133bb35 ecmascript: Detect side effects of `foo().#bar` correctly when
PropertyReadSideEffects::None (#24769 ) (sapphi-red)
### ⚡ Performance
- a086d91 ecmascript: Avoid number literal allocations (#24889 )
(Dunqing)
- 98f2ecb react_compiler: Compare value set pointers before probing in
state merge (#24805 ) (Marius Schulz)
- b287f29 estree: Avoid ident hash calculations when serializing
(#24774 ) (overlookmotel)
### 📚 Documentation
- 4d2e2bf ast: Fix incorrect return value in `common_js_require` docs
(#24945 ) (connorshea)
- b539e74 estree: Document custom serializers for `ImportMeta` and
`NewTarget` (#24777 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-07-27 23:07:40 +08:00
oxc-guard[bot]
14533a3dc1
release(crates): oxc v0.141.0 ( #24714 )
...
### 💥 BREAKING CHANGES
- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557 ) (camc314)
### 🚀 Features
- 4c71560 parser: More friendly error for spread element in dynamic
imports (#24705 ) (sapphi-red)
- 7b045cd minfier: Drop last break from last switch case (#24673 )
(Armano)
- 7d3c178 minifier: Remove unreachable recursive functions (#24125 )
(Dunqing)
- 94f99b3 ast: Allow `NONE` to be passed to AST builder methods where
`Option<ArenaVec>` is expected (#24629 ) (overlookmotel)
- 77230c5 ast: Accept arrays for `ArenaVec` params of AST builder
methods (#24621 ) (overlookmotel)
- f08b152 allocator: Implement `FromIn` for array to `Vec` conversion
(#24620 ) (overlookmotel)
- 2338c13 track-memory-allocations: Track heap deallocs, alloc bytes,
and peak growth (#24619 ) (Boshen)
- 7aa4739 syntax,transformer: Move JSX entity decoder to `oxc_syntax`
(#24617 ) (camc314)
- 2b097c4 str: Export `Str` as `ArenaStr` (#24604 ) (overlookmotel)
- 3acf4c1 minifier: Expand switch optimiation to remove empty cases
(#24520 ) (Armano)
- 129b759 parser: Improve diagnostics for unparenthesized LHS on
exponential expr (#24569 ) (camc314)
- 4d0c601 minifier: Fold arithmetic over undefined and null operands
(#24485 ) (Dunqing)
- 91541dd minifier: Drop empty switch statements (#24527 ) (Armano)
- d05224d ast_visit: Generate VisitJs visitor that skips TypeScript
type-space (#24499 ) (Boshen)
- 3d22307 parser: Add `ParseOptions::enable_ident_hashes` (#24491 )
(Boshen)
### 🐛 Bug Fixes
- 64c2241 minifier: Align class heritage removal with assumptions
(#24533 ) (Dunqing)
- 48b59f4 parser: Span ambient generator diagnostics (#24711 ) (camc314)
- e750a82 ecmascript: Fix false negative for may_have_side_effects on
dynamic property access (#24709 ) (sapphi-red)
- f145d73 minifier: Guard reordered identifier reads (#24698 ) (Dunqing)
- a2ef382 isolated-declarations: Reject `window.Symbol` as global symbol
reference (#24689 ) (camc314)
- b1bcf72 minifier: Invalidate facts for redeclared bindings (#24658 )
(Dunqing)
- 921b834 minifier: Don't treat a conditionally-assigned var as
write-once (#24650 ) (Dunqing)
- 061af1f minifier: Avoid stale pure function summaries (#24636 )
(Dunqing)
- 40c2f43 allocator: `Vec::from_array_in` do not allocate zero-length
array (#24628 ) (overlookmotel)
- 70994ae codegen: Preserve comments before expression operands (#24510 )
(Dunqing)
- 7b4baff parser: Reject new import member access (#23459 ) (camc314)
- 128b385 minifier: Clippy warning with no-debug-assertions (#24547 )
(camc314)
- 8421feb parser: Use first `as` span for imported name (#24537 )
(leaysgur)
- c517aa0 parser: Reject invalid accessor assertions (#24504 ) (camc314)
### ⚡ Performance
- 884d9eb parser: Pre-size cover-grammar assignment target buffers
(#24683 ) (Boshen)
- d3f07a0 diagnostics: Box OxcDiagnosticInner to reduce binary size
(#24665 ) (Boshen)
- bcc9de0 parser: Defer diagnostic creation until parse exit (#24663 )
(Boshen)
- c35d8ab allocator: Mark `ReplaceWith` panic path cold (#24515 )
(camc314)
- ba65790 semantic, allocator: Branchless `clone_in` for semantic IDs
(#24564 ) (overlookmotel)
- 747feec parser: Build AST nodes with the AST builder instead of
cloning (#24540 ) (Boshen)
- ba35a0d react_compiler: Use IndexVec for dense id-keyed maps (#24549 )
(Boshen)
- b685062 react_compiler: Keep small hot-path collections inline
(#24514 ) (Marius Schulz)
- a149e95 transformer: Outline rare expression exits (#24512 ) (camc314)
- 7808a6e react_compiler: Make aliasing effects cheap to intern and
clone (#24506 ) (Marius Schulz)
- 3a36f2a react_compiler: Store AbstractValue reasons as a u16 bitmask
(#24480 ) (Boshen)
- 1c96753 react_compiler: Use FxHashMap for the lookup-only aliasing
node map (#24490 ) (Boshen)
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-07-21 16:09:41 +01:00
oxc-guard[bot]
8e0ed2ebb9
release(crates): oxc v0.140.0 ( #24453 )
...
### 🚀 Features
- 616bfa2 minifier: Remove unreachable code after terminating statements
(#24441 ) (Dunqing)
- ddab89a data_structures: Add `likely` and `unlikely` functions
(#24368 ) (overlookmotel)
- a3a39f9 react_compiler: Implement enableEmitHookGuards codegen
(#24329 ) (Boshen)
- b79eef7 minifier: Apply De Morgan's law to negated comparison chains
in jump guards and loop tests (#24279 ) (Dunqing)
- 34ff7b4 minifier: Drop write-only property assignments to unused local
bindings by default (#24112 ) (Dunqing)
- 1b829d8 semantic: Record const enums in EnumData (#24268 ) (Dunqing)
- ba0944c semantic: Add `Scoping::set_symbol_span` (#24221 ) (camc314)
### 🐛 Bug Fixes
- 7d33363 minifier: Preserve guaranteed throws from class heritage
evaluation (#24349 ) (Dunqing)
- 058a62f semantic: Track ambient contexts in `SemanticBuilder` (#24327 )
(camc314)
- 721eb0b transformer/decorator: Scope accessor class binding (#24330 )
(camc314)
- 1ebdce3 semantic: Allow reserved keywords in ambient declaration types
(#24325 ) (camc314)
- 460176a track-memory-allocations: Exclude arena chunks from Sys allocs
(#24292 ) (Dunqing)
- af4922b transformer: Clear lowered namespace redeclarations (#24300 )
(camc314)
- ffd2765 semantic: Mark declared computed `MethodDefinition`s as type
references (#24296 ) (camc314)
- f17514b isolated-declarations: Emit const readonly fields as types
(#24288 ) (camc314)
- 40f769d minifier: Make `__proto__` write tracking execution-order
independent (#24280 ) (Dunqing)
- 6371fed transformer: Remove stale enum member bindings (#24272 )
(camc314)
- f05dfab transformer: Correct symbol flags for lowered namespaces
(#24271 ) (Dunqing)
- 84eeb55 transformer: Correct symbol flags for lowered enums (#24269 )
(Dunqing)
- c3057da transformer: Preserve generated class binding spans (#24220 )
(camc314)
- 8260096 transformer: Correct span for lowered namespace symbol
(#24222 ) (camc314)
- 42d00d3 semantic: Mark declared class heritage as type references
(#24237 ) (camc314)
- 588d997 semantic: Mark TS `PropertyDefinition`s computed fields as
type references (#24233 ) (camc314)
- 9b95632 semantic: Mark computed method keys in `TSMethodSignature`s as
type references (#24232 ) (camc314)
### ⚡ Performance
- 5b26643 transformer_plugins: Dispatch global defines by trailing name
(#23666 ) (Boshen)
- dce0f29 react_compiler: Replace all compiled functions in a single AST
walk (#24403 ) (Boshen)
- f85f0d8 ast: Delegate inherited enum variants in clone_in and estree
derives (#23555 ) (Boshen)
- 3ff0234 allocator: Remove `unwrap` from `ReplaceWith` (#24365 )
(overlookmotel)
- ab22e80 transformer: Fix Rust 1.97 performance regression (#24354 )
(camc314)
- b47585c parser: Use `ReplaceWith` instead of `TakeIn` (#24018 )
(overlookmotel)
- b227a06 minifier: Use `ReplaceWith` instead of `TakeIn` (#24017 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-07-14 15:02:22 +08:00
oxc-guard[bot]
69b2dfc181
release(crates): oxc v0.139.0 ( #24218 )
...
### 🚀 Features
- 260425f semantic/examples: Include unresolved references (#24214 )
(camc314)
- 2d9b0b3 minifier: Fold boolean-literal ternary branches in value
contexts (#24110 ) (Dunqing)
- 61fbf10 ast: Implement `ReplaceWith` on all AST types (#24013 )
(overlookmotel)
- 7db7a29 allocator: Add `ReplaceWith` trait (#24012 ) (overlookmotel)
- 4eb074e mangler: Add `reserved` option for names that must not be
mangled (#24041 ) (Dunqing)
- 2e62012 data_structures: Add `StringExt` trait (#24006 )
(overlookmotel)
- 60e7160 minifier: Drop side-effect-free IIFEs whose result is unused
(#23967 ) (Dunqing)
- 26dd9e2 ast: Add method to widen inherited enum ref to parent ref
(#23961 ) (overlookmotel)
### 🐛 Bug Fixes
- e8b50ee transformer: Clean up semantics for stripped TypeScript syntax
(#24180 ) (camc314)
- d966d0b react_compiler: Remove clippy allows (#24168 ) (Boshen)
- 854ef8d react_compiler: Compile generic functions instead of
over-bailing on type-param hoisting (#24158 ) (Boshen)
- 093586c react_compiler: Align memoization cache-slot allocation with
Babel (#24157 ) (Boshen)
- 09c8f59 react_compiler: Normalize snapshot fixture paths (#24142 )
(camc314)
- f13df97 react_compiler: Drop stray empty statement from catch bindings
(#24133 ) (Boshen)
- cb2a505 react_compiler: Codegen destructuring reassignment targets
(#24131 ) (Boshen)
- b82c394 react_compiler: Propagate codegen invariants instead of
emitting empty bodies (#24128 ) (Boshen)
- 5771982 react_compiler: Render unchanged programs as source in fixture
snapshots (#24129 ) (Boshen)
- 4b16e1a transformer/async-to-generator: Preserve direct eval scope
flags (#24136 ) (camc314)
- 4e9194f react_compiler: Lower `delete obj.prop` to
Property/ComputedDelete (#24123 ) (Boshen)
- 0b25582 ast: Type binding node `typeAnnotation` as `TSTypeAnnotation |
null` (#23113 ) (Boshen)
- 018c0e5 transformer: Hoist lowered async declarations (#22770 )
(camc314)
- 652fbaf mangler: Keep names of destructured exported bindings (#24036 )
(Dunqing)
- e274415 minifier: Don't drop global calls that throw despite pure
arguments (#23917 ) (Dunqing)
- 59abb30 minifier: Only merge string literals in `try_fold_add` when
the inner operator is `+` (#23622 ) (Jerry Zhao)
### ⚡ Performance
- c5ca77b transformer: Avoid cloning refresh options (#24191 ) (camc314)
- bf1a151 react_compiler: Compile out debug printers (#24184 ) (Boshen)
- abb44a0 transformer: Build fixed object-rest arguments (#24190 )
(camc314)
- a4db731 isolated_declarations: Use `ReplaceWith` instead of `TakeIn`
(#24016 ) (overlookmotel)
- ff10855 transformer: Use `ReplaceWith` instead of `TakeIn` (#24015 )
(overlookmotel)
- bd49aff ecmascript: Avoid heap-allocating Math.min/max/imul operands
(#23941 ) (Lawrence Lin)
- e4b708b react_compiler: Skip compiled files before prefilters (#24171 )
(Boshen)
- c59f2fe rust: Return impl ExactSizeIterator from slice-backed
accessors (#24144 ) (Boshen)
- 5d6d04a codegen: SWAR-skip boring byte runs in sourcemap line/column
scan (#24023 ) (Boshen)
- a55e0be traverse: Reduce string operations in `get_var_name_from_node`
(#24007 ) (overlookmotel)
- e6d48e1 transformer/nullish_coalescing: Move cold path into separate
function (#23989 ) (overlookmotel)
- c4e35b5 transformer/object_rest_spread: Pre-allocate capacity in `Vec`
(#23988 ) (overlookmotel)
- 527b8e5 transformer/decorators: Narrow type earlier (#23987 )
(overlookmotel)
### 📚 Documentation
- 30d17f5 allocator: Clarify docs for `TakeIn::take_in_box` (#24093 )
(overlookmotel)
- 675e6a8 ast: Correct doc comment for `PrivateFieldExpression` (#24008 )
(overlookmotel)
- e4c30e6 minifier: Explain what `dce` mode means (#23994 ) (Dunqing)
- 37cbf88 ast_macros: Document fields of `StructDetails` (#23959 )
(overlookmotel)
- 4de3e54 ast: Correct doc comment (#23948 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-07-06 23:26:26 +08:00
Dunqing
4eb074e69d
feat(mangler): add reserved option for names that must not be mangled ( #24041 )
...
Adds `MangleOptions::reserved` — equivalent to terser / uglify-js / swc `mangle.reserved`: names in the set are never used as mangled names, and bindings that already carry them keep them. Default empty; default output is byte-identical to main (minsize snapshot unchanged).
## Motivation
Node's cjs-module-lexer detects a CommonJS module's named exports by **lexically** scanning for `exports.<name> =` / `module.exports` token patterns — no scope analysis ([its README documents renamed identifiers as "DETECTS: NO EXPORTS"](https://github.com/nodejs/cjs-module-lexer )). UMD / CommonJS wrappers bind `exports` / `module` as ordinary function parameters, and the mangler renames them, erasing every named export the lexer can see.
Surfaced by the monitor-oxc mangler runtime test ([failing run](https://github.com/oxc-project/monitor-oxc/actions/runs/28569108563/job/84702922472 ), previously masked by #24033 / #24036 ): `archiver` does `import { queue } from "async"`, and `async`'s dist is a UMD bundle — mangled, the factory parameter `exports` became `e` and node fails with `Named export 'queue' not found`. With `reserved: ["exports", "module"]` the output imports correctly (verified end-to-end in node, including running a queue task).
## Why an opt-in list instead of always keeping these names
Renaming them is ecosystem-standard. Verified empirically — minifying the same UMD sample and importing it in node:
| minifier | renames `exports` param? | `import { queue }` from its output | escape hatch |
| --- | --- | --- | --- |
| terser 5.48 | yes | fails | `mangle.reserved` (verified working) |
| uglify-js 3.19 | yes | fails | `reserved` (verified working) |
| esbuild 0.28 `--minify` | yes | fails | none for identifier mangling |
| swc | yes | fails | terser-style `mangle.reserved` ([swc#3424](https://github.com/swc-project/swc/issues/3424 )) |
An earlier revision of this PR kept `exports` / `module` unconditionally; the Minification Size check showed the real cost: ~1% minified on UMD-heavy files (d3: +3.3 kB from ~590 `exports` references, flipping it to *larger than esbuild*), because the point is keeping the literal 7-char token at every export site. No other minifier pays this by default — and rolldown bundles bind `exports` / `module` in every CJS interop wrapper, where node's lexer never looks. So oxc gets the same escape hatch as terser/swc, with the same name.
`MangleOptions` loses `Copy` (it now holds the set); construction sites switch to `..MangleOptions::default()` / `clone()`. Exposed in `oxc-minify` NAPI options (`mangle.reserved: string[]`) and the mangler example (`--reserve-exports`).
monitor-oxc will pass `["exports", "module"]` for its mangler runtime test (its corpus imports prebuilt CJS/UMD dists directly).
For reference, esbuild solves this for its *own* node-platform CJS bundles differently — a dead-code annotation `0 && (module.exports = { a, b })` that cjs-module-lexer recognizes ([esbuild#960](https://github.com/evanw/esbuild/issues/960 ), [cjs-module-lexer#44](https://github.com/nodejs/cjs-module-lexer/issues/44 )); verified that pattern also works appended to fully-mangled output. That could be a future zero-size-cost alternative at the minifier level.
2026-07-02 09:31:28 +00:00
oxc-guard[bot]
8bf69a3076
release(crates): oxc v0.138.0 ( #23934 )
...
### 💥 BREAKING CHANGES
- 94fbacb ast: [**BREAKING**] Only export `AstBuilder` and `NONE` in
`builder` module (#23876 ) (overlookmotel)
- 8de5122 ecmascript: [**BREAKING**] Switch to new `AstBuilder` (#23834 )
(overlookmotel)
- dc0ef38 transformer: [**BREAKING**] Switch to new `AstBuilder`
(#23831 ) (overlookmotel)
- 88f4455 str: [**BREAKING**] `Str` and `Ident` methods take
`&GetAllocator` (#23781 ) (overlookmotel)
- 36009dd allocator: [**BREAKING**] `GetAllocator::allocator` take
`&self` (#23676 ) (overlookmotel)
- bd74f9d allocator: [**BREAKING**] Rename `AllocatorAccessor` trait to
`GetAllocator` (#23675 ) (overlookmotel)
### 🚀 Features
- 326fe25 transformer_plugins: Support `typeof` `define` keys (#23605 )
(Alexander Lichter)
- f2091b3 ast: Unify old and new `AstBuilder`s (#23875 ) (overlookmotel)
- cd1fd12 codegen: Expose `Codegen::print_string` API (#23785 ) (camc314)
- 785461b ast: Add custom builder methods to AST types (#23651 )
(overlookmotel)
- 05d1357 ast: Add AST creation methods to AST types (#23650 )
(overlookmotel)
- 2580eda str: Add `Str::from_str_in` and `Ident::from_str_in` methods
(#23767 ) (overlookmotel)
- 6883fcf minifier: Fold write-once falsy var to false in boolean
context (#23540 ) (Dunqing)
- fcbf993 allocator: Add `Vec::from_value_in` method (#23718 )
(overlookmotel)
- 989ddb7 allocator: Add `Vec::from_box_in` method (#23717 )
(overlookmotel)
- 9d1aa7f allocator: Improve `PartialEq` for `Vec` (#23716 )
(overlookmotel)
### 🐛 Bug Fixes
- da0e5bf minifier: Don't reorder a closed-over TDZ read when inlining a
var (#23771 ) (Dunqing)
- 0b3021f allocator: Remove `Vec::from_box_in` (#23873 ) (overlookmotel)
- 0ab64ec ast: Silence deprecation warnings within files defining
deprecated `AstBuilder` methods (#23889 ) (overlookmotel)
- 8c07cad all: Enable `disable_old_builder` Cargo feature for `oxc_ast`
crate in tests (#23888 ) (overlookmotel)
- 3800f01 ast: Legacy `AstBuilder` methods take `self` not `&self`
(#23891 ) (overlookmotel)
- 869ac20 semantic/cfg: Connect for update exit to loop test (#23791 )
(camc314)
- d3e92d5 semantic/cfg: Connect while branches from condition exit
(#23790 ) (camc314)
- 025045d ast: `ExportNamedDeclaration` plain builder methods return
boxed nodes (#23783 ) (overlookmotel)
- 7537c58 ast: Fix name of `AstBuilder` method for
`Expression::V8IntrinsicExpression` (#23766 ) (overlookmotel)
- 3f574f5 traverse: Fix unsoundness in `Traverse` walk functions
(#23745 ) (overlookmotel)
- 585760f parser: String in AST reference arena (#23721 ) (overlookmotel)
- 7231d55 allocator: Fix unsound lifetime extension in `Box::new_in`
(#23685 ) (overlookmotel)
### ⚡ Performance
- d5c916a semantic: Flatten hoisting_variables to avoid per-scope map
allocation (#23927 ) (Lawrence Lin)
- e71609d minifier: Bail member-expr folding before the side-effect walk
(#23924 ) (Lawrence Lin)
- e1f89ab minifier: Reduce string allocations folding addition (#23846 )
(overlookmotel)
- 9f6ee3b isolated-declarations: Pool scope maps to avoid per-scope
alloc/rehash (#23761 ) (Boshen)
- 0b07c4c semantic: Avoid heap alloc for catch-clause binding ids
(#23911 ) (Lawrence Lin)
- c5eef8b regular_expression: Skip capturing-group pre-parse when
pattern has no `(` (#23908 ) (Lawrence Lin)
- b4f5b4b isolated_declarations: Remove redundant clone of formal
parameter pattern (#23912 ) (Lawrence Lin)
- 53d083f isolated_declarations: Use `TakeIn` not `CloneIn` (#23847 )
(overlookmotel)
- 3ea9304 react_compiler: Use faster API to arena allocate strings
(#23849 ) (overlookmotel)
- a6d8e45 parser: Avoid span lookup for arrow expression body (#23788 )
(camc314)
- e1886a0 transformer, minifier: Use `static_ident!` macro to create
static `Ident`s (#23727 ) (overlookmotel)
- 5527bef transformer/object-rest-spread: Reduce iteration (#23720 )
(overlookmotel)
- 680ffbc transformer: Allocate AST nodes in arena directly (#23711 )
(overlookmotel)
- 1c63c66 parser: Allocate AST nodes in arena directly (#23712 )
(overlookmotel)
- 3855f0c minifier: Allocate AST nodes in arena directly (#23710 )
(overlookmotel)
- d025887 isolated_declarations: Allocate AST nodes in arena directly
(#23709 ) (overlookmotel)
- 10b96c6 parser: Remove string search from parsing JSX element name
(#23713 ) (overlookmotel)
### 📚 Documentation
- 3d61dea all: Correct capitalization in comments (#23887 )
(overlookmotel)
- aa1ad74 ast: Add `#[deprecated]` to legacy `AstBuilder` methods
(#23877 ) (overlookmotel)
- a4676db ast: Correct doc comment for `NONE` (#23765 ) (overlookmotel)
- 419ec80 syntax: Fix typo in doc comment (#23674 ) (overlookmotel)
### 🛡️ Security
- 3cdd18f deps: Update npm packages (#23690 ) (renovate[bot])
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-06-29 20:11:00 +01:00
oxc-guard[bot]
6d56d57535
release(crates): oxc v0.137.0 ( #23591 )
...
### 💥 BREAKING CHANGES
- 7a76cd3 estree: [**BREAKING**] Make whether to include TS fields a
runtime option (#23574 ) (overlookmotel)
- e7b6b68 estree: [**BREAKING**] `ESTree` config use methods not consts
(#23573 ) (overlookmotel)
### 🚀 Features
- 556cc6d data_structures: Add `CodeBuffer::as_str` method (#23571 )
(overlookmotel)
- 38c4b06 parser: Add friendly error for adjacent JSX elements (#23378 )
(sapphi-red)
- 53509a8 minifier: Treeshake pure typed arrays and Set/Map array
literals (#23469 ) (Dunqing)
- 09762d9 minifier: Inline const value for read-only vars (#22593 )
(Dunqing)
### 🐛 Bug Fixes
- 20375f9 react_compiler: Keep imports referenced only by a computed key
(#23586 ) (Boshen)
- 31bfd9b minifier: Keep Object introspection calls on a possible Proxy
(#23483 ) (Dunqing)
- 837a395 parser: Treat a line comment after ':' as leading, not
trailing (#23515 ) (Dunqing)
- e409fe0 minifier: Keep `new Map`/`WeakSet`/`WeakMap` with a string
argument (#23470 ) (Dunqing)
- ae02b4e ci/parser: Use `minimal` for vitest reporter (#23457 )
(camc314)
### ⚡ Performance
- cf24329 mangler: Compile slot sort once instead of per CAPACITY
(#23577 ) (Boshen)
- 4058a6a parser: Reduce code bloat from verify_modifiers
monomorphization (#23576 ) (Boshen)
- 053b0c1 estree: Remove pointless `mem::take` (#23572 ) (overlookmotel)
- dfb52b6 transformer: Pre-size statement vecs in TS enum & namespace
lowering (#23516 ) (Yunfei He)
- 970e09a minifier: Compute template-literal inline checks in a single
pass (#23467 ) (Yunfei He)
- 3170c0e semantic,mangler,minifier: Fix `Semantic::stats` node count
and reuse stats in mangler builds (#23352 ) (Boshen)
- d1fa6e0 minifier: Evaluate ternary branches once in
minimize_conditional_expression (#23479 ) (Yunfei He)
- 3fa8051 transformer: Pre-size JSX props vec to attribute count
(#23466 ) (Yunfei He)
- 488b382 react_compiler: Borrow binding names in prefilter instead of
allocating (#23471 ) (Yunfei He)
- bcb3894 minifier: Incremental scoping refresh, delete
LiveUsageCollector (#23197 ) (Dunqing)
### 📚 Documentation
- f68641e data_structures: Improve docs on safety contract (#23575 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-06-18 17:31:57 +08:00
oxc-guard[bot]
827248a7fb
release(crates): oxc v0.136.0 ( #23443 )
...
### 💥 BREAKING CHANGES
- 7a24911 codegen: [**BREAKING**] Borrow sourcemaps from codegen
(#23422 ) (Boshen)
- bb0ed44 transformer: [**BREAKING**] Disable styled-components
transpileTemplateLiterals by default (#23171 ) (Boshen)
### 🚀 Features
- 1490a0a linter/react: Implement react-compiler rule (#23202 ) (Boshen)
- 6c0bdf0 transformer/react-refresh: Support `module.property.useHook()`
(#23190 ) (Dunqing)
- 47991bd semantic: Report TS1228 for invalid type predicates (#23174 )
(camc314)
- 1d3af58 parser: Add TS2398 parameter property diagnostic (#23216 )
(camc314)
- 44313da semantic: Add `scope_is_descendant_of` api (#22313 ) (camc314)
- e5050c0 parser: Improve diagnostic for rest initializer (#23205 )
(camc314)
- ec266bb transformer: Run React Compiler as a feature-gated transform
pass (#23201 ) (Boshen)
- e7374fe parser: Report error for `const` modifier on interface type
parameter (#23173 ) (camc314)
- a7c1c9b parser: Report ambient definite variable assertions (#23165 )
(camc314)
- d169fcd parser: Report invalid class definite assertions (#23164 )
(camc314)
- 00244d8 parser: Report definite property initializer errors (#23160 )
(camc314)
### 🐛 Bug Fixes
- 52d0c31 transformer: Replace ambient dot defines (#23231 ) (camc314)
- 2c28748 transformer/class: Parent generated constructors to class
scope (#23222 ) (camc314)
- 8edd234 parser: Report accessor definite assertion on token (#23203 )
(camc314)
- de38a3f react_compiler: Keep imports referenced only by a local
re-export (#23176 ) (Boshen)
- f5721c2 codegen: Preserve parentheses around `intrinsic` type
reference (#23156 ) (Boshen)
- e89f81d parser: Don't emit TS1477 for parenthesized instantiation
expression (#23147 ) (Boshen)
- 8a04149 parser: Reject module-referencing imports/exports in a
namespace body (#22829 ) (Boshen)
### ⚡ Performance
- 2783295 parser: Table-driven operator precedence lookup (#23346 )
(Boshen)
- 231d5de parser: Single-match member expression dispatch (#23347 )
(Boshen)
- e89729b codegen: Accept one-shot wrap closures (#23265 ) (camc314)
- a6c11fa parser: Force-inline read_non_decimal to fold per-digit number
dispatch (#23157 ) (Boshen)
- d74964c parser: Store class definite assertion offset (#23170 )
(camc314)
- f0fda4d parser: Shrink-wrap cold diagnostic tails out of hot frames
(#23159 ) (Boshen)
- a082180 parser: Store definite assertion offset (#23167 ) (camc314)
- 534f9c6 oxc: Conditionally rebuild semantic in compiler pipeline
(#23153 ) (Boshen)
- b435c6a parser: Skip checkpoint for `infer T extends U` constraint in
disallow context (#23128 ) (Boshen)
- 7464dce parser: Peek instead of checkpoint/rewind for `export default`
modifier (#23124 ) (Boshen)
- 80a9a32 parser: Fast-path single-keyword TS declarations (#23083 )
(Boshen)
- da1a6c6 diagnostics: Migrate to allocation-optimized oxc-miette
(#23094 ) (Boshen)
- b7b08ce parser: Peek once for the static modifier disambiguation
(#23079 ) (Boshen)
- e7e07a3 parser: Fold unary dispatch into a single match (#23076 )
(Boshen)
### 📚 Documentation
- d241add semantic: Add `AGENTS.md` test guidance for agents (#23441 )
(camc314)
- 026f1ae parser: Add `AGENTS.md` test guidance for agents (#23440 )
(camc314)
- 09755ac transformer: Add `AGENTS.md` test guidance for agents (#23439 )
(camc314)
- e6bdfd4 lexer: Correct reference link for `byte_handlers!` (#23313 )
(Dunqing)
- 65b6d7a allocator: Fix memory leaks in `Arena` examples (#23257 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-06-15 20:05:34 +08:00
renovate[bot]
e745892d4c
chore(deps): update napi ( #23394 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) | Type |
Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.7.1` →
`3.7.2`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.7.1/3.7.2 ) |

|

|

|

| pnpm.catalog.default | patch |
| [napi](https://crates.io/crates/napi ) | `3.9.1` → `3.9.2` |

|

|

|

| workspace.dependencies | patch |
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.7.2`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.7.1...@napi-rs/cli@3.7.2 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.7.1...@napi-rs/cli@3.7.2 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions ) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMTkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIxOS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
2026-06-14 14:10:12 +01:00
Boshen
777f02ae10
refactor(diagnostics)!: return a Diagnostics type instead of Vec<OxcDiagnostic> ( #23217 )
...
## Summary
Introduces `oxc_diagnostics::Diagnostics` — a `Vec<OxcDiagnostic>` newtype that knows the difference between errors and warnings — and makes it the standard diagnostics return value across oxc.
- **New type**: `Diagnostics` with `has_errors()`, `has_warnings()`, `errors()`, `warnings()`, plus `Vec`-like ergonomics (Deref, `IntoIterator`, `Extend`, `From`/`Into<Vec>`) so most call sites are unchanged.
- **Return types**: `ParserReturn`, `SemanticBuilderReturn`, `IsolatedDeclarationsReturn`, the React Compiler `TransformResult`/`LintResult`, and `TransformerReturn` now expose `diagnostics: Diagnostics` instead of `errors: Vec<OxcDiagnostic>` (the React Compiler's separate `errors`/`warnings` are merged into one severity-tagged list).
- **Behaviour**: a React Compiler **error** now stops the transform (no output), while **warnings** flow through and the transform continues. `compile()` aborts codegen only when `diagnostics.has_errors()` — warnings alone no longer abort (previously any diagnostic did).
## Breaking change
Consumers reading `*.errors` on these return values must read `*.diagnostics`. React Compiler consumers that read `.errors`/`.warnings` separately should use `diagnostics.has_errors()` / `diagnostics.errors()` / `diagnostics.warnings()`.
Parser/semantic/isolated-declarations fatality is otherwise unchanged. Builds on the React Compiler transform feature (#23201 ).
🤖 Generated with [Claude Code](https://claude.com/claude-code )
2026-06-10 14:46:52 +00:00
oxc-guard[bot]
e9b8fd595c
release(crates): oxc v0.135.0 ( #23117 )
...
### 💥 BREAKING CHANGES
- ee4dc73 ast: [**BREAKING**] Add `#[non_exhaustive]` to AST nodes
(#23046 ) (overlookmotel)
- 4c35362 ast: [**BREAKING**] Add
`AstBuilder::template_element_escape_raw` and
`template_element_escape_raw_with_lone_surrogates` methods (#23047 )
(overlookmotel)
### 🚀 Features
- b846ab2 react_compiler: Integrate the Rust port of the React Compiler
(#22942 ) (Boshen)
- 5b8dd68 parser: Report TS1255 for invalid class definite assertions
(#22917 ) (camc314)
- 85efabf semantic: Make building the class table optional, off by
default (#22862 ) (Boshen)
### 🐛 Bug Fixes
- 556acdc codegen: Parenthesize TS-cast assignment targets (#23112 )
(Boshen)
- 37169ff codegen: Don't emit space between postfix `--` and `>` when
minifying (#23036 ) (Boshen)
- a4b1bf7 codegen: Drop redundant whitespace in minified TypeScript
output (#23038 ) (Boshen)
- cf53285 parser: Report reserved type-declaration names in the parser
(#23035 ) (Boshen)
- 4e44969 ast: Fix UB in `escape_template_element_raw` (#23052 )
(overlookmotel)
- c543154 parser: Report comma operator in JSX expression in the parser
(#23030 ) (Boshen)
- 325c94f codegen: Tighten conditional-type and constructor-type
whitespace when minifying (#23033 ) (Boshen)
- 95dd3a2 parser: Report `import type` alias to a non-external reference
in the parser (#23032 ) (Boshen)
- 90180b8 codegen: Drop space after `:` in function return type when
minifying (#23028 ) (Boshen)
- 6da876e parser: Report `abstract` private class field in the parser
(#23029 ) (Boshen)
- 28467ce codegen: Don't emit space before a postfix update operand when
minifying (#23027 ) (Boshen)
- cb29926 codegen: Drop redundant space after `export default` when
minifying (#23024 ) (Boshen)
- 62965ae codegen: Drop redundant space after `else` when minifying
(#23025 ) (Boshen)
- 989230a parser: Report compound assignment to non-simple target in the
parser (#23022 ) (Boshen)
- 06f367c parser: Report `super.#field` private access in the parser
(#23014 ) (Boshen)
- 184edef codegen: Print space before `const`/`declare` enum modifier
(#23013 ) (Boshen)
- 4d722e0 parser: Report duplicate switch `default` clause in the parser
(#23012 ) (Boshen)
- 597ed85 codegen: Parenthesize `let`/`async` for-of head target
(#23008 ) (Boshen)
- 8b631bf codegen: Remove stray space before mapped type value colon
(#23010 ) (Boshen)
- c08407e codegen: Don't over-parenthesize `in` inside an arrow in a
for-init (#23009 ) (Boshen)
- 600cd6f codegen: Parenthesize lower-precedence
`TSInstantiationExpression` operand (#23007 ) (Boshen)
- 187e1a5 codegen: Don't leak space after comment-only JSX expression
container (#23006 ) (Boshen)
- 294c473 codegen: Don't over-parenthesize `TSTypeAssertion` operand
(#23004 ) (Boshen)
- 786d96f codegen: Give `TSTypeAssertion` unary precedence (#23002 )
(Boshen)
- 1295882 parser: Report `new.target` and `import.meta` syntax errors in
the parser (#23003 ) (Boshen)
- d727b6b codegen: Parenthesize `await` expression as base of `**`
(#23001 ) (Boshen)
- 67dfa08 codegen: Keep parentheses around `new` callees containing a
call (#22997 ) (Boshen)
- 17e7cf3 parser: Disallow unerasable `as`/`satisfies` assertions
(#22986 ) (Boshen)
- beb46d3 parser: Commit to module goal on decorated exports (#22941 )
(Boshen)
- 49e63f7 isolated-declarations: Require annotations for satisfies
initializers (#22898 ) (camc314)
- 8c93601 isolated-declarations: Allow unknown enum initializer in
non-const enum (#22900 ) (camc314)
### ⚡ Performance
- 7d89909 parser: Peek instead of lookahead for yield disambiguation
(#23071 ) (Boshen)
- bf872f0 parser: Skip arrow lookahead for a parenthesized literal
(#23070 ) (Boshen)
- d19fc54 parser: Guard type-argument speculation behind an angle-token
check (#23069 ) (Boshen)
- 8eb5507 parser: Skip redundant member-rest re-scan on call entry
(#23068 ) (Boshen)
- 883dfc1 parser: Skip parse_call_expression_rest when no call follows
(#23063 ) (Boshen)
- b171153 parser: Peek before the await-using lookahead (#23059 )
(Boshen)
- 56f21bd parser: Use peek_token for the TS `asserts` type predicate
(#23058 ) (Boshen)
- 68805ac parser: Use peek_token instead of checkpoint/rewind for
single-token decisions (#23056 ) (Boshen)
- 1f9d8eb ast: `AstBuilder::template_element_escape_raw` avoid
allocation if no escape required (#23053 ) (overlookmotel)
- 502b04d semantic: Move cold function redeclaration handling into
`#[cold]` function (#22973 ) (overlookmotel)
### 📚 Documentation
- 275d318 napi/minifier: Point `target` to oxc docs (#23102 ) (camc314)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-06-08 22:17:46 +08:00
camc314
275d318e5d
docs(napi/minifier): point target to oxc docs ( #23102 )
2026-06-08 00:43:18 +00:00
oxc-guard[bot]
6c30f81eca
release(crates): oxc v0.134.0 ( #22882 )
...
### 🚀 Features
- 9c71f2e ast, codegen, formatter: Add `WithClauseKeyword::as_str`
helper and use it (#22791 ) (camc314)
### 🐛 Bug Fixes
- cf5769c parser: Reject TypeScript declarations in single-statement
context (#22827 ) (Boshen)
- c360fb6 parser: Reject generators in ambient contexts and overload
signatures (TS1221/TS1222) (#22848 ) (Boshen)
- cc60d8d parser: Reject invalid index signature parameter types
(TS1268/TS1337) (#22852 ) (Boshen)
- 3d13e29 parser: Reject `declare` in an already-ambient context
(TS1038) (#22850 ) (Boshen)
- 5152854 parser: Reject statements in ambient contexts (TS1036)
(#22849 ) (Boshen)
- 4f9afc5 parser: Reject `export as namespace` inside a namespace body
(TS1316) (#22846 ) (Boshen)
- 2eafea6 parser: Reject function implementations in ambient contexts
(TS1183) (#22845 ) (Boshen)
- c645615 parser: Reject incompatible class member modifiers (#22843 )
(Boshen)
- 276b78b parser: Reject module-referencing imports/exports in a
namespace body (#22836 ) (Boshen)
- 842ed1c parser: Parse `class implements` with `implements` as the
class name (#22801 ) (Boshen)
### ⚡ Performance
- 7e3a567 parser: Reuse cached token kind in delimited-list loops
(#22841 ) (Boshen)
- 9e741c2 parser: Use peek_token instead of lookahead on the modifier
path (#22842 ) (Boshen)
- 9e496a7 semantic: Defer declare lookup for empty accessors (#22810 )
(camc314)
2026-06-01 17:27:01 +01:00
renovate[bot]
b7568d54d7
chore(deps): update dependency @napi-rs/cli to v3.7.0 ( #22771 )
...
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/ ) |
[Adoption](https://docs.renovatebot.com/merge-confidence/ ) |
[Passing](https://docs.renovatebot.com/merge-confidence/ ) |
[Confidence](https://docs.renovatebot.com/merge-confidence/ ) |
|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ )
([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.6.2` →
`3.7.0`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.6.2/3.7.0 ) |

|

|

|

|
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
###
[`v3.7.0`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.6.2...@napi-rs/cli@3.7.0 )
[Compare
Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.6.2...@napi-rs/cli@3.7.0 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xOTQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE5NC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
2026-05-28 10:06:39 +01:00
oxc-guard[bot]
83328b65ce
release(crates): oxc v0.133.0 ( #22734 )
...
### 🚀 Features
- e857b0c napi/minify: Expose legalComments option and result (#20370 )
(Boshen)
- 661132d parser: More friendly error messages for rest assignment
target and rest binding element (#22719 ) (sapphi-red)
- ee659b6 transformer/legacy-decorator: Add `strictNullChecks` option
for nullable-union design:type (#22266 ) (Kyle Cannon)
### 🐛 Bug Fixes
- e1d064e transformer/class-properties: Reparent lifted private method
helpers (#22716 ) (Cameron)
- 4ac0fca minifier: Preserve `0 && (module.exports = { ... })`
cjs-module-lexer hint (#22729 ) (Dunqing)
- 40ff611 minifier: Mark peephole loop changed when dropping
dead-after-throw statement (#22722 ) (Dunqing)
- 2f7b210 codegen: Emit pife-arrow/function leading comments inside the
wrap (#22720 ) (Dunqing)
- e184f74 parser: Improve invalid `import` property access diagnostic
(#22693 ) (camc314)
- 7baed9c transformer/private-method: Clear inherited strict flags
(#22508 ) (camc314)
- a9ad27e parser: Keep annotation comments leading without preceding
newline (#22711 ) (Dunqing)
- 9ea4d64 minifier: Re-evaluate pure/no-side-effects flags after
peephole inlining (#22595 ) (Dunqing)
- 07afbb6 minifier: Drop empty-body IIFE wrapper when called with
arguments (#22589 ) (Dunqing)
- fa7c463 semantic: Correct TS enum member symbol spans (#22689 )
(camc314)
- 26b9396 semantic: Resolve parameter decorators outside parameter scope
(#22623 ) (camc314)
- b284045 parser: Switch to module goal eagerly on `export` (#22684 )
(Boshen)
- dfa931d semantic: Propagate unresolved auto-increment enum value
instead of defaulting to 0 (#22646 ) (Dunqing)
- 69a6ba6 transformer/legacy-decorator: Emit Array for ReadonlyArray<T>
in decorator metadata (#22265 ) (Kyle Cannon)
- e421ef0 transformer/legacy-decorator: Return runtime binding for
design:type (#22640 ) (Dunqing)
- d61e1d7 codegen: Preserve verbatim text of pure/no-side-effects
comments (#22525 ) (Dunqing)
- 702b14e minifier: Preserve IIFE structure in DCE-only mode (#22547 )
(Dunqing)
- 917da24 parser: Apply PURE comment through member-access chains
(#22566 ) (Dunqing)
- a069b1c codegen: Preserve quotes for cjs-module-lexer equality strings
(#22551 ) (Dunqing)
### ⚡ Performance
- 2f623b0 semantic: Skip unresolved checks for re-exports (#22660 )
(camc314)
- 0d9553d semantic: Early-exit `check_object_expression` for objects
with <2 properties (#22668 ) (Dunqing)
- d721ad9 semantic: Use direct grandparent lookup for TS type parameters
(#22658 ) (camc314)
- 0aff288 semantic: Reorder numeric literal strict mode checks (#22657 )
(camc314)
- 4d5ddb1 semantic: Reorder binding identifier checks (#22656 ) (camc314)
- e32acd8 semantic: Reorder identifier ambient binding check (#22653 )
(camc314)
- 09fe178 semantic: Reorder ident reference strict mode check (#22652 )
(camc314)
- 4b6add2 semantic: Avoid duplicate ident clone for bindings (#22663 )
(camc314)
- 82f9662 parser: Check identifier kind before context flag (#22662 )
(camc314)
- d7cd951 parser: Fast path identifier parsing and inline operator
helpers (#22650 ) (Boshen)
- 7b84314 semantic: Use direct byte access for numeric leading-zero
check (#22642 ) (camc314)
- 0345a31 semantic: Pre-size class elements hash map (#22618 ) (camc314)
- 04d3065 minifier: Drop per-call buffers in try_fold_concat (#22596 )
(Dunqing)
- 4f289f1 semantic: Resolve_references_for_current_scope without a temp
Vec (#22599 ) (Dunqing)
- e862c15 semantic: Avoid heap alloc for var hoist scope ids (#22603 )
(Dunqing)
- 8ff8674 semantic: Early return if `excess` is `0` in
`Stats::increase_by` (#22616 ) (camc314)
- 7a4120e semantic: Pre-reserve unresolved_references using
Stats::references (#22580 ) (Dunqing)
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com >
2026-05-26 14:28:43 +08:00
Boshen
e857b0cfe5
feat(napi/minify): expose legalComments option and result ( #20370 )
...
## Summary
- Add `legalComments` and `legalCommentsPath` fields to the NAPI `CodegenOptions` struct, accepting `"none"`, `"inline"`, `"eof"`, `"linked"`, `"external"`
- Add `legalComments: Vec<String>` to `MinifyResult`, populated from `CodegenReturn::legal_comments` when using `"linked"` or `"external"` mode
- Replace the `From<&CodegenOptions>` impl with a `to_codegen_options()` method that validates and maps string values to `oxc_codegen::LegalComment` variants
This enables downstream consumers (e.g. `oxc-webpack-plugin`) to use oxc's built-in legal comment extraction instead of regex-based post-processing.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
2026-05-26 04:31:38 +00:00
oxc-guard[bot]
63b129182d
release(crates): oxc v0.132.0 ( #22527 )
...
### 🐛 Bug Fixes
- 0f26de6 ecmascript: Resolve identifier value type via tracked
constants (#22234 ) (Alexander Lichter)
- c27a8cf minifier: Normalize `{ x: x }` shorthand so adjacent-if merge
is idempotent (#22401 ) (Dunqing)
- e431a0e parser: Break extends clause loop on fatal error (#22517 )
(Boshen)
- e9ec7c6 minifier: Fold optional chains by base nullishness (#22236 )
(Alexander Lichter)
- e6090e7 transformer: Keep enum IIFE when a non-inlinable value
reference remains (#22501 ) (Dunqing)
- 931b7d6 transformer: Inline const enum members through type-cast
wrappers (#22500 ) (Dunqing)
- b9615b2 codegen: Preserve string quotes in require() calls during
minification (#22475 ) (zennnnnnn11)
- c73c159 transformer/async-to-generator: Reparent parameter initializer
scopes (#22507 ) (camc314)
- ecfd3ca transformer/async-to-generator: Move only parameter bindings
(#22503 ) (camc314)
- 3ce3431 transformer/explicit-resource-managment: Preserve shadowed
for-head block (#22451 ) (camc314)
### ⚡ Performance
- ce92c6c semantic: `#[inline]` `Scoping::get_binding` (#22414 )
(Dunqing)
- 98be95c regular_expression: Track regex flags via bitflags (#22427 )
(Boshen)
- dbbc059 jsdoc: Skip should_attach_jsdoc when no remaining comments
(#22409 ) (Boshen)
- 217d7d8 minifier: Index `SymbolValues` by `SymbolId` (#22441 )
(Dunqing)
- d782b78 minifier: Use BitSet for LiveUsageCollector live references
(#22425 ) (Boshen)
2026-05-18 12:09:14 +01:00
oxc-guard[bot]
564ebbf46f
release(crates): oxc v0.131.0 ( #22459 )
...
### 🚀 Features
- bc91a17 codegen: Expose `Codegen::with_source_type` method (#22432 )
(camc314)
### 🐛 Bug Fixes
- 5ac7e79 minifier: Drop unused-var-init pure IIFEs and preserve
annotation for downstream (#22349 ) (Dunqing)
- 4ab57eb allocator: Fixed-size allocators use `VirtualAlloc` on Windows
(#22124 ) (overlookmotel)
- 66d77eb allocator: Fix segfault on Linux MUSL with fixed-size
allocators (#22388 ) (overlookmotel)
- b8fbc1f transformer/object-rest-spread: Correct scope id when moving
bindings (#22419 ) (camc314)
- 18edc2c codegen: Keep `Object.defineProperty` property name as plain
string in minify (#22400 ) (Dunqing)
- dda33de transformer/explicit-resource-management: Align lexical
binding scopes (#22320 ) (camc314)
- 8e79de8 transformer: Preserve for-await statement bodies (#22361 )
(camc314)
- 0cba210 transformer/class: Replace `new.target` in static blocks
(#22360 ) (camc314)
- 67ab1c9 transformer/es2018/for-await: Hoist for-await generated
bindings (#22355 ) (camc314)
- c3ceb4a transformer/object-rest-spread: Use hoisted scope for `for-of`
temp refs (#22347 ) (camc314)
### ⚡ Performance
- 73a9043 allocator/bitset: Avoid temp heap `String` allocation (#22403 )
(camc314)
- 8b2f4f9 transformer/object-rest-spread: Collect `Vec<SymbolId` over
`Vec<BindingIdentifier>` (#22418 ) (camc314)
- 83679ea parser: Split TriviaBuilder::handle_token hot/cold paths
(#22415 ) (Boshen)
- 2c7d781 codegen: Inline identifier-name accessors (#22411 ) (Boshen)
- 618bc76 diagnostics: Inline `OxcDiagnosticInner` to avoid heap
allocation (#22406 ) (Boshen)
- 0b4e158 parser: Reserve cap `2` for sequence expressions vec (#22374 )
(camc314)
- 5f3bdd0 codegen: Add `#[inline]` to `code`, `code_len` (#22373 )
(camc314)
Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com >
2026-05-15 15:38:24 +01:00
oxc-guard[bot]
650417ffd0
release(crates): oxc v0.130.0 ( #22316 )
...
### 🚀 Features
- 66c9b01 transformer/typescript: Debug_assert that `enum_eval` ran in
semantic (#22252 ) (Dunqing)
- ffe6475 minifier: Fold `Array` constructor with safe spreads (#22215 )
(camc314)
### 🐛 Bug Fixes
- d3d0b18 traverse: Handle `ChainElement::TSNonNullExpression` in
`GatherNodeParts` (#22247 ) (leaysgur)
- 4e880de transformer/object-rest-spread: Declare temp vars for computed
keys (#22284 ) (camc314)
- a7c3e22 semantic: Clear member write target for computed keys (#22302 )
(camc314)
- 6a8852d codegen: Emit newline after legal-comment orphan flush
(#22304 ) (Dunqing)
- 5da9fda transformer/explicit-resource-management: Preserve class names
(#22306 ) (Dunqing)
- b5d970f transformer/explicit-resource-management: Preserve class names
(#22290 ) (camc314)
- bc54fd4 minifier: Keep function / class names if direct eval is
present in the scope (#22241 ) (sapphi-red)
- 7a810c0 minifier: Refresh direct eval flags after DCE (#21787 )
(Dunqing)
- dd88726 transformer/legacy-decorator: Preserve accessor type
annotation for emitDecoratorMetadata (#21966 ) (Dunqing)
- 29a3cd7 codegen: Swap mapping/indent order for top-level decls
(#22206 ) (Dunqing)
- 73b4f40 minifier: Preserve catch binding with direct eval (#22221 )
(camc314)
- 0e13d17 minifier: Preserve optional chain base side effects (#22219 )
(camc314)
- 0c7c01c transformer/typescript: Inline optional-chain enum member
access (#21834 ) (Dunqing)
- a6aff7e codegen: Emit block/array/object end mapping at close char
(#22200 ) (Dunqing)
- a099b03 codegen: Emit call end mapping at `)` position, not past it
(#22199 ) (Dunqing)
- 5753774 minifier: Cap if-return ternary collapse for firefox (#21841 )
(Gurupungav Narayanan)
- 2493bdd codegen: Correct sourcemap end mappings for closing delimiters
(#22001 ) (Mark Dalgleish)
- 3b385e2 minifier: Bail optimizing `Array` with unknown arg count
(#22188 ) (camc314)
- 9fa2122 parser: Parse array computed class keys (#22159 ) (camc314)
### 📚 Documentation
- a4a6892 napi/parser: Correct code comment (#22278 ) (overlookmotel)
- 9305373 oxc: Update README (#22178 ) (camc314)
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-05-11 16:02:22 +01:00
oxc-guard[bot]
ec00055e64
release(crates): oxc v0.129.0 ( #22108 )
...
### 💥 BREAKING CHANGES
- 0ffbe0d allocator: [**BREAKING**] Remove `Allocator::end_ptr` method
(#21871 ) (overlookmotel)
### 🚀 Features
- 9593ec8 transformer/jsx: Add jsxDEV source metadata for fragments
(#21932 ) (Ido Rosenthal)
### 🐛 Bug Fixes
- 429deac napi/parser: Export `visitorKeys` from `wasm` entrypoint
(#21996 ) (NullVoxPopuli)
- e852911 codegen: Preserve legal comments orphaned by upstream passes
(#21575 ) (Dunqing)
- e3399ec transformer/class-properties: Preserve RHS in
logical-assignment to static private field (#21950 ) (Dunqing)
- c59c199 transformer/typescript: Emit class fields for parameter
properties (#21831 ) (Dunqing)
- aaabde4 parser: Attach legal comments to following token (#21670 )
(Dunqing)
### ⚡ Performance
- 0bf0cb9 allocator: Per-platform `Arena::new_fixed_size`
implementations (#22088 ) (overlookmotel)
### 📚 Documentation
- 62ec410 allocator: Correct doc comment for `Allocator::from_raw_parts`
(#22093 ) (overlookmotel)
- 3e152c6 allocator: Correct typos in comments (#22092 ) (overlookmotel)
- e220855 allocator: Correct doc comment for `Allocator::set_cursor_ptr`
(#21866 ) (overlookmotel)
---------
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
Co-authored-by: Cameron Clark <cameron.clark@hey.com >
2026-05-05 09:59:50 +01:00
oxc-guard[bot]
9951013ece
release(crates): oxc v0.128.0 ( #21837 )
...
### 💥 BREAKING CHANGES
- 502e804 ast: [**BREAKING**] Reduce size of `TSTypePredicateName`
(#21711 ) (overlookmotel)
- 5651539 ast: [**BREAKING**] Reduce size of `JSXExpression` (#21710 )
(overlookmotel)
- c44e280 ast: [**BREAKING**] Reduce size of `ArrayExpressionElement`
(#21709 ) (overlookmotel)
- c5b3deb syntax: [**BREAKING**] Remove `CommentNodeId` (#21679 )
(overlookmotel)
### 🚀 Features
- b738a39 allocator: Add `Allocator::cursor_ptr` method (#21773 )
(overlookmotel)
- 678767e ast: Generate node_id accessors for AST enum wrappers (#21653 )
(camc314)
- f091d77 minifier: Inline constant spread elements into arrays (#21095 )
(Armano)
### 🐛 Bug Fixes
- 0d608c2 minifier: Preserve raw CR in template literals (#21645 )
(Dunqing)
- a889ea9 minifier: Track pure functions in DCE mode (#21722 ) (Dunqing)
- 674dfac allocator: `Arena` retry allocation when chunk size approaches
maximum (#21777 ) (overlookmotel)
- f130cc0 allocator: Fix arithmetic overflow in
`Arena::new_chunk_memory_details` (#21745 ) (overlookmotel)
- b9bf239 allocator: Fix UB in `Arena::grow_zeroed` (#21739 )
(overlookmotel)
- d2b9389 allocator: Clippy warning when building without `testing`
feature (#21681 ) (camc314)
- 503dc86 codegen: Map sourcemaps from visible output starts (#21662 )
(Dunqing)
- c92bd3b transformer: Use SPAN for synthesized helper calls to prevent
comment misattribution (#21578 ) (Dunqing)
- 0d80441 codegen: Add mapping before printing `#` for private ident
(#21619 ) (camc314)
### ⚡ Performance
- 9fa362e napi/parser: Do not generate tokens except in tests (#21811 )
(overlookmotel)
- 0044392 allocator: Reduce branches when allocating new chunk (#21776 )
(overlookmotel)
- 7896bd0 allocator: `Allocator::used_bytes` do not use chunk iterator
(#21771 ) (overlookmotel)
- a5c562f allocator: Remove check in `Arena::new_chunk_memory_details`
(#21750 ) (overlookmotel)
- 35bbe1f allocator: `Arena` use unchecked size round up where
guaranteed no overflow (#21743 ) (overlookmotel)
- ffe229b allocator: Remove unnecessary check from
`Arena::try_alloc_layout_slow_impl` (#21732 ) (overlookmotel)
- 72fece5 allocator: Use `NonNull::offset_from_unsigned` in
`Arena::chunk_capacity` (#21731 ) (overlookmotel)
- cab32ae ast: Add `#[inline(always)]` to `node_id` methods on enums
with all variants unboxed (#21707 ) (overlookmotel)
- b179688 parser: Allocate `TriviaBuilder` comments in the arena
(#21512 ) (Boshen)
- 2290f31 lexer: Fix perf of `Token::set_*` methods on Rust 1.95.0
(#21659 ) (overlookmotel)
- 1b58029 allocator: Move code into cold path in `Arena::alloc_layout`
(#21622 ) (overlookmotel)
- 3cf7cef allocator: Reduce instructions on allocation hot path (#21510 )
(overlookmotel)
### 📚 Documentation
- ce65070 data_structures: Document why `as_ref` and `as_mut` on
`NonNullConst` and `NonNullMut` take `self` (#21800 ) (overlookmotel)
- 93b7dbd allocator: Improve doc comments for `ChunkFooter` (#21733 )
(overlookmotel)
- 295db8d transformer: Fix comment (#21717 ) (overlookmotel)
- 5c93af8 ast: Add comments explaining `#[inline(always)]` to `node_id`
methods on enums (#21706 ) (overlookmotel)
- e4cea25 transform: Use the `node:` namespace in the example (#19998 )
(루밀LuMir)
### 🛡️ Security
- d8076c9 deps: Update rolldown (#21639 ) (renovate)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-04-27 12:32:32 +01:00
renovate
d8076c9780
chore(deps): update rolldown ( #21639 )
...
This PR contains the following updates:
| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/ ) | [Adoption](https://docs.renovatebot.com/merge-confidence/ ) | [Passing](https://docs.renovatebot.com/merge-confidence/ ) | [Confidence](https://docs.renovatebot.com/merge-confidence/ ) |
|---|---|---|---|---|---|
| [rolldown](https://rolldown.rs/ ) ([source](https://redirect.github.com/rolldown/rolldown/tree/HEAD/packages/rolldown )) | [`1.0.0-rc.16` → `1.0.0-rc.17`](https://renovatebot.com/diffs/npm/rolldown/1.0.0-rc.16/1.0.0-rc.17 ) |  |  |  |  |
| [tsdown](http://tsdown.dev/ ) ([source](https://redirect.github.com/rolldown/tsdown )) | [`0.21.9` → `0.21.10`](https://renovatebot.com/diffs/npm/tsdown/0.21.9/0.21.10 ) |  |  |  |  |
---
### Release Notes
<details>
<summary>rolldown/rolldown (rolldown)</summary>
### [`v1.0.0-rc.17`](https://redirect.github.com/rolldown/rolldown/blob/HEAD/CHANGELOG.md#100-rc17---2026-04-22 )
[Compare Source](https://redirect.github.com/rolldown/rolldown/compare/v1.0.0-rc.16...v1.0.0-rc.17 )
##### 🐛 Bug Fixes
- link: error on missing export between TS modules ([#​9197](https://redirect.github.com/rolldown/rolldown/issues/9197 )) by [@​IWANABETHATGUY](https://redirect.github.com/IWANABETHATGUY )
- rolldown\_plugin\_vite\_import\_glob: import path should not be affected by absolute base option ([#​9145](https://redirect.github.com/rolldown/rolldown/issues/9145 )) by [@​kermanx](https://redirect.github.com/kermanx )
- `this.resolve()` returns null for bare relative paths without importer ([#​9142](https://redirect.github.com/rolldown/rolldown/issues/9142 )) by [@​Copilot](https://redirect.github.com/Copilot )
- collect destructured bindings in HMR module exports ([#​9146](https://redirect.github.com/rolldown/rolldown/issues/9146 )) by [@​h-a-n-a](https://redirect.github.com/h-a-n-a )
- esbuild-tests: handle 0.28.0 test cases ([#​9149](https://redirect.github.com/rolldown/rolldown/issues/9149 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- plugin/copy-module: honor external resolutions from other plugins ([#​9139](https://redirect.github.com/rolldown/rolldown/issues/9139 )) by [@​TheAlexLichter](https://redirect.github.com/TheAlexLichter )
- allow undefined in sourcesContent type ([#​9136](https://redirect.github.com/rolldown/rolldown/issues/9136 )) by [@​jurijzahn8019](https://redirect.github.com/jurijzahn8019 )
- reduce false positives in chunk optimizer circular dependency detection ([#​9049](https://redirect.github.com/rolldown/rolldown/issues/9049 )) by [@​AlonMiz](https://redirect.github.com/AlonMiz )
##### 🚜 Refactor
- chunk-optimizer: extract runtime-module placement into rehome\_runtime\_module ([#​9163](https://redirect.github.com/rolldown/rolldown/issues/9163 )) by [@​IWANABETHATGUY](https://redirect.github.com/IWANABETHATGUY )
##### 📚 Documentation
- add design doc for sort\_modules execution ordering ([#​9169](https://redirect.github.com/rolldown/rolldown/issues/9169 )) by [@​IWANABETHATGUY](https://redirect.github.com/IWANABETHATGUY )
- add document for `RenderedModule` ([#​9147](https://redirect.github.com/rolldown/rolldown/issues/9147 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
##### ⚡ Performance
- rolldown\_plugin\_vite\_import\_glob: skip self-import earlier using raw path comparison ([#​9193](https://redirect.github.com/rolldown/rolldown/issues/9193 )) by [@​shulaoda](https://redirect.github.com/shulaoda )
##### 🧪 Testing
- lazy: add `playground/lazy-compilation` ([#​7974](https://redirect.github.com/rolldown/rolldown/issues/7974 )) by [@​hyf0](https://redirect.github.com/hyf0 )
##### ⚙️ Miscellaneous Tasks
- use app token for release PR ([#​9198](https://redirect.github.com/rolldown/rolldown/issues/9198 )) by [@​Boshen](https://redirect.github.com/Boshen )
- upgrade oxc to 0.127.0 ([#​9194](https://redirect.github.com/rolldown/rolldown/issues/9194 )) by [@​Dunqing](https://redirect.github.com/Dunqing )
- use oxc security action ([#​9196](https://redirect.github.com/rolldown/rolldown/issues/9196 )) by [@​Boshen](https://redirect.github.com/Boshen )
- esbuild-tests: remove some tests from ignored list as enum inline is now supported ([#​9184](https://redirect.github.com/rolldown/rolldown/issues/9184 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- deps: update dependency vite-plus to v0.1.19 ([#​9183](https://redirect.github.com/rolldown/rolldown/issues/9183 )) by [@​renovate](https://redirect.github.com/renovate )\[bot]
- use vp instead of pnpm in check-wasi-binding-deps ([#​9182](https://redirect.github.com/rolldown/rolldown/issues/9182 )) by [@​shulaoda](https://redirect.github.com/shulaoda )
- verify wasm32-wasi binding deps match [@​rolldown/browser](https://redirect.github.com/rolldown/browser ) before publish ([#​9162](https://redirect.github.com/rolldown/rolldown/issues/9162 )) by [@​shulaoda](https://redirect.github.com/shulaoda )
- deps: update esbuild for tests to 0.28.0 ([#​9172](https://redirect.github.com/rolldown/rolldown/issues/9172 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- deps: update rollup submodule for tests to v4.60.2 ([#​9173](https://redirect.github.com/rolldown/rolldown/issues/9173 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- deps: update test262 submodule for tests ([#​9174](https://redirect.github.com/rolldown/rolldown/issues/9174 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- sort\_modules: fix stale async-entry sort key comment ([#​9170](https://redirect.github.com/rolldown/rolldown/issues/9170 )) by [@​IWANABETHATGUY](https://redirect.github.com/IWANABETHATGUY )
- deps: update npm packages ([#​9157](https://redirect.github.com/rolldown/rolldown/issues/9157 )) by [@​renovate](https://redirect.github.com/renovate )\[bot]
- deps: update dependency diff to v9 ([#​9158](https://redirect.github.com/rolldown/rolldown/issues/9158 )) by [@​renovate](https://redirect.github.com/renovate )\[bot]
- deps: update rust crates ([#​9156](https://redirect.github.com/rolldown/rolldown/issues/9156 )) by [@​renovate](https://redirect.github.com/renovate )\[bot]
- run Windows CI on PRs labeled with `ci: windows` ([#​9153](https://redirect.github.com/rolldown/rolldown/issues/9153 )) by [@​hyf0](https://redirect.github.com/hyf0 )
- update-test-dependencies: run setup-rust before file changes ([#​9151](https://redirect.github.com/rolldown/rolldown/issues/9151 )) by [@​sapphi-red](https://redirect.github.com/sapphi-red )
- deps: update dependency rust to v1.95.0 ([#​9140](https://redirect.github.com/rolldown/rolldown/issues/9140 )) by [@​renovate](https://redirect.github.com/renovate )\[bot]
##### ❤️ New Contributors
- [@​jurijzahn8019](https://redirect.github.com/jurijzahn8019 ) made their first contribution in [#​9136](https://redirect.github.com/rolldown/rolldown/pull/9136 )
- [@​AlonMiz](https://redirect.github.com/AlonMiz ) made their first contribution in [#​9049](https://redirect.github.com/rolldown/rolldown/pull/9049 )
</details>
<details>
<summary>rolldown/tsdown (tsdown)</summary>
### [`v0.21.10`](https://redirect.github.com/rolldown/tsdown/releases/tag/v0.21.10 )
[Compare Source](https://redirect.github.com/rolldown/tsdown/compare/v0.21.9...v0.21.10 )
##### 🚀 Features
- Upgrade rolldown - by [@​sxzz](https://redirect.github.com/sxzz ) [<samp>(8a449)</samp>](https://redirect.github.com/rolldown/tsdown/commit/8a4498d )
##### [View changes on GitHub](https://redirect.github.com/rolldown/tsdown/compare/v0.21.9...v0.21.10 )
</details>
---
### Configuration
📅 **Schedule**: (in timezone Asia/Shanghai)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions ) if that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMzkuNCIsInVwZGF0ZWRJblZlciI6IjQzLjEzOS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2026-04-23 10:20:58 +00:00
oxc-guard[bot]
161d6b5583
release(crates): oxc v0.127.0 ( #21572 )
...
### 🐛 Bug Fixes
- 48967e8 isolated_declarations: Drop required type check for private
parameter properties on private constructors (#21515 ) (Dunqing)
- 91e5bde transformer/typescript: Preserve computed-key static block
when class has an empty constructor (#21562 ) (Dunqing)
- 50e9d26 mangler: Assign correct slot to shadowed function-expression
names (#21535 ) (Dunqing)
- 065ce47 isolated_declarations: Collect types from private accessors
for paired inference (#21516 ) (Dunqing)
- 00fc136 codegen: Preserve coverage comments before object properties
(#21312 ) (bab)
- d676e0c minifier: Mark LHS of `??=` as read when converting from `==
null &&` (#21546 ) (Gunnlaugur Thor Briem)
### ⚡ Performance
- e45efc5 parser: Reduce `try_parse` usage in favour of `lookahead`
(#21532 ) (Boshen)
- ddb1bf8 parser: Avoid redundant `IdentifierReference` clone in
shorthand property (#21511 ) (Boshen)
- be2b392 allocator: Store pointers directly in `Arena` (#21483 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
Co-authored-by: Cameron <cameron.clark@hey.com >
2026-04-20 20:29:50 +01:00
Boshen
836fe9d51c
release(crates): oxc v0.126.0 ( #21471 )
...
### 💥 BREAKING CHANGES
- 24fb7eb allocator: [**BREAKING**] Rename `Box` and `Vec` methods
(#21395 ) (overlookmotel)
### 🚀 Features
- ce5072d parser: Support `turbopack` magic comments (#20803 ) (Kane
Wang)
- f5deb55 napi/transform: Expose `optimizeConstEnums` and
`optimizeEnums` options (#21388 ) (Dunqing)
- 24b03de data_structures: Introduce `NonNullConst` and `NonNullMut`
pointer types (#21425 ) (overlookmotel)
### 🐛 Bug Fixes
- d7a359a ecmascript: Treat update expressions as unconditionally
side-effectful (#21456 ) (Dunqing)
- 56af2f4 transformer/async-to-generator: Correct scope of inferred
named FE in async-to-generator (#21458 ) (Dunqing)
- b3ed467 minifier: Avoid illegal `var;` when folding unused arguments
copy loop (#21421 ) (fazba)
- b0e8f13 minifier: Preserve `var` inside `catch` with same-named
parameter (#21366 ) (Dunqing)
- 4fb73a7 transformer/typescript: Preserve execution order for accessor
with `useDefineForClassFields: false` (#21369 ) (Dunqing)
### ⚡ Performance
- da3cc16 parser: Refactor out `LexerContext` (#21275 ) (Ulrich Stark)
### 📚 Documentation
- c5b19bb allocator: Reformat comments in `Arena` (#21448 )
(overlookmotel)
- 091e88e lexer: Update doc comment about perf benefit of reading
through references (#21423 ) (overlookmotel)
- 922cbee allocator: Remove references to "bump" from comments (#21397 )
(overlookmotel)
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com >
2026-04-16 09:38:51 +08:00
Boshen
fb6b1b053f
release(crates): oxc v0.125.0 ( #21374 )
...
### 💥 BREAKING CHANGES
- 36cdc31 str: [**BREAKING**] Remove identity `FromIn` impl for `Ident`
(#21251 ) (overlookmotel)
- 382958a span: [**BREAKING**] Remove re-exports of string types from
`oxc_span` crate (#21246 ) (overlookmotel)
- c4aedfa str: [**BREAKING**] Add `static_ident!` macro (#21245 )
(overlookmotel)
### 🚀 Features
- e7e1aea transformer/typescript: Add `optimize_enums` option for
regular enum inlining (#20539 ) (Dunqing)
- 679f57f transformer/typescript: Implement const enum inlining and
declaration removal (#20508 ) (Dunqing)
- 6dd061c semantic: Extend `MemberWriteTarget` to cover all property
modification patterns (#21205 ) (Dunqing)
- f134e24 minifier: Support `property_write_side_effects` option to drop
unused property assignments (#20773 ) (Dunqing)
- 75663c0 semantic: Add enum member value evaluation for const enum
support (#20602 ) (Dunqing)
- 3cfe8ed semantic: Add `MemberWriteTarget` flag to `ReferenceFlags`
(#20772 ) (Dunqing)
### 🐛 Bug Fixes
- af1a586 transformer/class-properties: Use correct property name when
converting parameter properties (#21268 ) (Amal Jossy)
- b43250a allocator: Move allocation tracking into `Bump` (#21342 )
(overlookmotel)
- 36f505f allocator: `StringBuilder` use `Allocator::alloc_layout`
(#21340 ) (overlookmotel)
- 7a08a6f allocator: Fix allocation counting in
`Allocator::alloc_concat_strs_array` (#21336 ) (overlookmotel)
- 2338e28 ecmascript: Treat `this` as potentially having side effects
(#21297 ) (sapphi-red)
- bd8bd39 allocator: Remove unsafe hacks from `from_raw_parts` methods
(#21283 ) (overlookmotel)
- 8f4c340 allocator: Remove dangerous pointer const to mut cast (#21279 )
(overlookmotel)
- aa9259f parser: Add missing error code for optional param diagnostic
(#21258 ) (camc314)
- 04b3c2f str: Fix unsound casting const pointers to mut pointers
(#21242 ) (overlookmotel)
- ceadf6c str: Make `Ident::from_raw` an unsafe function (#21241 )
(overlookmotel)
- eab13b3 transformer/decorators: Avoid accessor storage name collisions
(#21106 ) (Dunqing)
- 07e8a30 transformer/react-refresh: Handle parenthesized variable
initializers (#21047 ) (camc314)
### ⚡ Performance
- c3ca6f6 allocator: `StringBuilder::from_strs_array_in` check for 0
length earlier (#21338 ) (overlookmotel)
- c2422bb allocator: `Allocator::alloc_concat_strs_array` check for 0
length earlier (#21337 ) (overlookmotel)
- 04b0fdc allocator: Mark `Allocator::alloc_layout` as
`#[inline(always)]` (#21335 ) (overlookmotel)
- 17aee9e allocator: Use `offset_from_unsigned` in
`ChunkFooter::as_raw_parts` (#21280 ) (overlookmotel)
- 61adedd minifier: Fix O(n²) perf on very many var decls (#21062 )
(Gunnlaugur Thor Briem)
- addcd02 napi/parser, linter/plugins: Raw transfer deserializer for
`Vec`s use shift instead of multiply where possible (#21142 )
(overlookmotel)
- 3068ded napi/parser, linter/plugins: Shift before add when calculating
positions in raw transfer deserializer (#21141 ) (overlookmotel)
- eb400b8 napi/parser, linter/plugins: Remove `uint32` buffer view
(#21140 ) (overlookmotel)
- 2675085 napi/parser: Lazy deserialization use only `Int32Array`
(#21139 ) (overlookmotel)
- 5b35a53 napi/parser: Deserializing tokens use only `int32` array
(#21138 ) (overlookmotel)
- f163d10 parser: Tokens raw deserialization use `Int32Array` (#21137 )
(overlookmotel)
- 7a86613 linter/plugins: Use `Int32Array`s for tokens and comments
buffers (#21136 ) (overlookmotel)
- 8c51121 napi/parser, linter/plugins: Raw transfer deserialize `Span`
fields as `i32`s (#21135 ) (overlookmotel)
- bc1bcdd napi/parser, linter/plugins: Inline trivial raw transfer field
deserializers into node object definitions (#21134 ) (overlookmotel)
- c0278ab napi/parser, linter/plugins: Use `Int32Array` in raw transfer
deserializer (#21132 ) (overlookmotel)
- 43482c7 linter/plugins: Use `>>` not `>>>` in binary search loops
(#21129 ) (overlookmotel)
### 📚 Documentation
- f5e1845 allocator: Upgrade headers in doc comments for `Bump` (#21263 )
(overlookmotel)
- 2870174 allocator: Upper case `SAFETY` in comments (#21253 )
(overlookmotel)
- 01bc269 str: Reformat `Ident` doc comments (#21240 ) (overlookmotel)
- dd47359 allocator: Add doc comments for panics and errors (#21230 )
(overlookmotel)
2026-04-13 11:25:53 +01:00
Dunqing
f134e241bd
feat(minifier): support property_write_side_effects option to drop unused property assignments ( #20773 )
...
## Summary
Add `property_write_side_effects` option to `TreeShakeOptions` (default `true`). When set to `false`, property assignments like `A.from = () => {}` are considered side-effect-free, enabling the minifier to drop declarations and fresh value bindings with property assignments when unused.
### Examples
```js
// Function declaration + property assignments → eliminated
function A() {}
A.from = () => {}
A.to = () => {}
// Output: (empty)
// Class declaration + property assignment → eliminated
class A {}
A.foo = 1
// Output: (empty)
// Const variable with arrow function → eliminated
const A = () => {}
A.foo = 1
// Output: (empty)
// Const variable with object literal → eliminated
const B = {}
B.foo = 1
// Output: (empty)
// Const variable with function expression → eliminated
const C = function() {}
C.foo = 1
// Output: (empty)
```
### How it works
1. Wires the existing `property_write_side_effects` from `oxc_ecmascript`'s `MayHaveSideEffectsContext` through the minifier's compress options
2. For member expression assignments, checks `may_have_side_effects()` then `is_member_assign_to_unused_binding()`
3. `is_member_assign_to_unused_binding` verifies:
- Single-level member expression only (`A.foo`, not `a.b.c`)
- All references to the symbol have the `MemberWriteTarget` flag (from parent PR)
- Symbol creates a fresh value (`is_fresh_value`) and is not exported
4. Fixed-point loop handles cascading: first pass drops assignments, `exit_program` cleans up references, second pass drops declarations
### Fresh value detection
A symbol is considered "fresh" (cannot alias another binding and property writes are side-effect-free) if it is:
- A **function declaration**
- A **class declaration** without static setters, static accessor properties, or static property definitions with values
- A variable initialized with an **array/arrow function/function expression** literal
- A variable initialized with an **object literal** without setter/getter properties or property values containing setters/getters
- A variable initialized with a **class expression** (same rules as class declarations above)
Non-fresh values (e.g. `const b = a`) are conservatively preserved to prevent breaking aliased references.
#### Setter/getter detection (addresses review feedback)
Following how esbuild, Terser, Rollup, and SWC handle setter cases — all tools preserve property writes when setters are visible in the AST:
- **Static setter methods**: `class A { static set foo(v) { ... } }` → not fresh
- **Static accessor properties**: `class A { static accessor foo = 0 }` → not fresh (auto-generates getter+setter)
- **Static property definitions with values**: `class A { static b = 0 }` → not fresh (matches SWC's conservative approach)
- **Static property values containing setters/getters**: `class A { static b = { set x(v) { ... } } }` → not fresh
- **Object literal setters/getters**: `{ set foo(v) { ... } }` or `{ get foo() { ... } }` → not fresh
- **Nested setters/getters in object property values**: `{ bar: { set x(v) { ... } } }` → not fresh
- **Non-static setters are fine**: `class A { set foo(v) { ... } }` → fresh (instance setters don't affect class-level property writes)
### Limitations
**Only single-level member expressions are supported** (`A.foo`, not `a.b.c`). Deep nested assignments like `a.b.c = 1` are always preserved because intermediate properties could alias external objects:
```js
const exported = {};
const a = { b: exported };
a.b.c = 1; // writes to exported.c — unsafe to drop!
export { exported };
```
Supporting deeper nesting would require full object graph tracking (like Rollup's `ObjectEntity` model), which is a much larger effort for marginal gain.
### Safety guards
Addresses concerns raised in [PR #20730 review](https://github.com/oxc-project/oxc/pull/20730#pullrequestreview-4011376657 ) and [comment](https://github.com/oxc-project/oxc/pull/20730#issuecomment-4131710117 ):
- **Aliases**: `const b = a; b.add = 1; export { a }` → kept (not fresh, could mutate exported `a` through alias)
- **Chained access**: `const b = { a }; b.a.add = 1; export { a }` → kept (only single-level member expressions allowed)
- **Exported symbols**: `export function A() {} A.foo = 1;` → kept (observable by importers)
- **Other reads**: `function A() {} A.foo = 1; console.log(A)` → kept (symbol has non-member-write references)
- **Side-effectful RHS**: `function A() {} A.foo = sideEffect()` → kept (`may_have_side_effects` returns true)
- **Globals**: `globalObj.foo = 1` → kept (no local binding)
- **Script mode top-level**: top-level bindings in script mode are kept (they're globals visible to other scripts)
- **Setters**: `class A { static set foo(v) { ... } } A.foo = 1` → kept (setter triggers side effects)
- **Static properties**: `class A { static b = 0 } A.b = 1` → kept (matches SWC's conservative approach)
### Comparison with other tools
| Tool | Approach | Option needed? |
|------|----------|---------------|
| **Rollup** | Structural aliasing analysis — tracks object identity through `LocalVariable.isReassigned` + `ObjectEntity` setter detection. Drops `A.foo = 1` automatically when `A` is a local unreassigned object with no setters. | No (always active) |
| **Rolldown** | Adds explicit [`treeshake.propertyWriteSideEffects`](https://rolldown.rs/reference/InputOptions.treeshake#propertywritesideeffects ) option (default `'always'`). Not in upstream Rollup. | Yes |
| **Terser** | Checks `is_constant_expression` on the base object after unwrapping property chain. If the base is constant within scope, drops the assignment. | No (always active, but less precise) |
| **esbuild** | All property assignments always preserved. Rationale: `Object.defineProperty` could install prototype setters. Only escape hatch is `/* @__PURE__ */` IIFE wrapping. | No option available |
| **SWC** | `may_have_side_effects` returns `true` for all assignments unconditionally. Classes with static property definitions are conservatively preserved. | No option available |
| **Oxc (this PR)** | Fresh value tracking (`is_fresh_value`) + `MemberWriteTarget` reference flags + explicit option. Closest to Rollup's aliasing analysis but gated behind an option like Rolldown. | Yes (`property_write_side_effects: false`) |
Closes #14207
## Test plan
- [x] 20 test cases covering all safety scenarios including setter/getter edge cases
- [x] All minifier tests pass (476/476)
- [x] No minsize regressions
- [x] Clippy clean
🤖 Generated with [Claude Code](https://claude.com/claude-code )
2026-04-09 11:13:42 +00:00
renovate
152b37a6e8
chore(deps): update napi ( #20829 )
...
This PR contains the following updates:
| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/ ) | [Adoption](https://docs.renovatebot.com/merge-confidence/ ) | [Passing](https://docs.renovatebot.com/merge-confidence/ ) | [Confidence](https://docs.renovatebot.com/merge-confidence/ ) | Type | Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/ ) ([source](https://redirect.github.com/napi-rs/napi-rs )) | [`3.5.1` → `3.6.0`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.5.1/3.6.0 ) |  |  |  |  | pnpm.catalog.default | minor |
| [napi](https://redirect.github.com/napi-rs/napi-rs ) | `3.8.3` → `3.8.4` |  |  |  |  | workspace.dependencies | patch |
| [napi-derive](https://redirect.github.com/napi-rs/napi-rs ) | `3.5.2` → `3.5.3` |  |  |  |  | workspace.dependencies | patch |
---
### Release Notes
<details>
<summary>napi-rs/napi-rs (@​napi-rs/cli)</summary>
### [`v3.6.0`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.5.1...@napi-rs/cli@3.6.0 )
[Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.5.1...@napi-rs/cli@3.6.0 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions ) if that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My45NC4xIiwidXBkYXRlZEluVmVyIjoiNDMuMTAyLjciLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->
2026-04-07 10:48:24 +00:00
Boshen
38aea543e4
release(crates): oxc v0.124.0 ( #21084 )
...
### 🐛 Bug Fixes
- fc7f60c allocator: Revert changes to
`get_current_chunk_footer_field_offset` (#20964 ) (overlookmotel)
- 31316c8 semantic: Rebind class expressions before identifier checks
(#20916 ) (camc314)
### ⚡ Performance
- fb52383 napi/parser, linter/plugins: Clear buffers and source texts
earlier (#21025 ) (overlookmotel)
- 3b7dec4 napi/parser, linter/plugins: Use `utf8Slice` for decoding
UTF-8 strings (#21022 ) (overlookmotel)
- 012c924 napi/parser, linter/plugins: Speed up decoding strings in raw
transfer (#21021 ) (overlookmotel)
- 55e1e9b napi/parser, linter/plugins: Initialize vars as 0 (#21020 )
(overlookmotel)
- c25ef02 napi/parser, linter/plugins: Simplify branch condition in
`deserializeStr` (#21019 ) (overlookmotel)
- 9f494c3 napi/parser, linter/plugins: Raw transfer use
`String.fromCharCode` in string decoding (#21018 ) (overlookmotel)
- 91cf105 allocator: Increase initial chunk size from 512B to 16KB
(#20968 ) (overlookmotel)
- cbc0c21 allocator: Add `#[cold]` to to error handling functions
(#20967 ) (overlookmotel)
- 0503a78 napi/parser, linter/plugins: Faster deserialization of `raw`
fields (#20923 ) (overlookmotel)
- a24f75e napi/parser: Optimize string deserialization for non-ASCII
sources (#20834 ) (Joshua Tuddenham)
### 📚 Documentation
- c78a57a syntax: Fix typo (#21044 ) (camc314)
- f5e228f allocator: Fix typo in comment (#20972 ) (overlookmotel)
- 7159d51 allocator: Improve doc comment examples for `vec2::Vec`
(#20969 ) (overlookmotel)
- b1da750 allocator, data_structures: Correct comments (#20966 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2026-04-07 09:34:33 +09:00
Boshen
990763453c
release(crates): oxc v0.123.0 ( #20862 )
2026-03-30 18:00:11 +08:00
Boshen
9dd33b080c
release(crates): oxc v0.122.0 ( #20648 )
2026-03-23 17:59:21 +08:00