oxc-bot
ff67f13f99
release(crates): v0.66.0 ( #10565 )
...
## [0.66.0] - 2025-04-23
### Features
- 7d5ad7d parser: Report error when `import type { type }` is used
(#10528 ) (camc314)
- 6e40fac parser: Report error when `export type { type }` is used
(#10524 ) (camc314)
### Bug Fixes
- 43ad4e9 ast: Box `this_param` in `TSCallSignatureDeclaration` (#10558 )
(Yuji Sugiura)
- 8eb3c0a ast/estree: Fix raw deser for `FormalParameter` (#10548 )
(overlookmotel)
- 3ebf220 codegen: Generate missing `type` in `export type {} from
'mod'` (#10539 ) (Boshen)
- f19b287 estree: Add `TSParameterProperty` (#10534 ) (Yuji Sugiura)
- 7284f16 isolated-declarations: Leading comments of
`ExportDefaultDeclaration` and `TSExportAssignment` appear in incorrect
places (#10559 ) (Dunqing)
- 4c316a5 isolated_declarations: Fix broken snapshot files (#10561 )
(Boshen)
- 84742d8 transformer/module_runner: Fix export default live binding
(#10560 ) (hi-ogawa)
- 6c115c7 transformer/module_runner: Fix execution order of re-export
(#10362 ) (hi-ogawa)
- b9d84b0 transformer/typescript: Remove `StringLiteral::raw` when
rewriting extensions (#10554 ) (overlookmotel)
### Performance
- 6a045c8 codegen: Speed up printing `Directive`s (#10551 )
(overlookmotel)
- 3418ae5 transformer/class-properties: Re-use
`InstanceInitializerVisitor` (#10543 ) (overlookmotel)
- 7fcf0ac transformer/typescript: Reduce allocations renaming extensions
(#10555 ) (overlookmotel)
### Documentation
- 1a9530c transformer/class-properties: Fix typo (#10542 )
(overlookmotel)
### Refactor
- 7e71282 transformer/class-properties: Correct outdated comment
(#10546 ) (overlookmotel)
- 596978b transformer/class-properties: Simplify to get `constructor`
method only once (#10493 ) (Dunqing)
- f13fe0a transformer/class-properties: Defer re-parenting initializers
scopes until all instance properties are transformed (#10495 ) (Dunqing)
- c83dad6 transformer/class-properties: Streamline handling scope of
instance property initializer (#10492 ) (Dunqing)
### Styling
- e10dfc8 traverse: Remove excess whitespace (#10544 ) (overlookmotel)
### Testing
- 227febf allocator: Ignore a slow doc test (#10521 ) (Dunqing)
- 14bb2be codegen: Add more tests for strings (#10552 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-04-23 22:42:12 +08:00
oxc-bot
0ab2cb4a22
release(crates): v0.65.0 ( #10522 )
2025-04-21 18:03:15 +08:00
ocavue
78cdb1c525
docs(transform): correct tsc's --isolatedDeclarations flag ( #10502 )
...
This PR fixes a typo about isolated declarations CLI option in the docs.
The correct option name is `--isolatedDeclarations` ([document
link](https://www.typescriptlang.org/docs/handbook/compiler-options.html#:~:text=%2D%2DisolatedDeclarations )).
I also add some other tiny improvements to the docs.
2025-04-19 13:46:21 +08:00
oxc-bot
619488a05a
release(crates): v0.64.0 ( #10459 )
2025-04-17 10:09:07 +08:00
hi-ogawa
1ff75bcde1
fix(transformer/module_runner): hoist export ( #10347 )
...
Aligning with https://github.com/vitejs/vite/pull/18983
I manually verified the test case output matches with the ones in Vite repo.
~I add a new TODO about "export default" getter, but this difference existed already. I plan to fix this separately.~ (EDIT: It turned out Vite's transform is the wrong one https://github.com/vitejs/vite/issues/19834 .)
2025-04-14 02:36:53 +00:00
Boshen
dfef8b5170
feat(transformer): enable using by default ( #10333 )
2025-04-09 13:08:28 +00:00
oxc-bot
eba5fcf33b
release(crates): v0.63.0 ( #10309 )
2025-04-08 13:52:15 +08:00
Boshen
78f1b3afa1
feat(transformer): enable using by default ( #10286 )
...
closes #9744
2025-04-07 09:23:26 +00:00
renovate[bot]
e34967eb20
chore(deps): lock file maintenance npm packages ( #10273 )
2025-04-07 16:43:16 +08:00
oxc-bot
3b72e5b151
release(crates): v0.62.0 ( #10158 )
2025-04-02 09:48:40 +08:00
oxc-bot
76b245dafc
release(crates): v0.61.2 ( #9983 )
2025-03-23 19:42:43 +08:00
oxc-bot
9a36e677b2
release(crates): v0.61.1 ( #9936 )
...
## [0.61.1] - 2025-03-21
### Features
- 8e3b20d napi/parser: Add portable wasm browser build (#9901 ) (Hiroshi
Ogawa)
- bc0670c tasks,oxc_allocator: Add new method clone_in_with_semantic_ids
for `CloneIn` trait (#9894 ) (IWANABETHATGUY)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-21 12:46:52 +08:00
oxc-bot
33c1c76955
release(crates): v0.61.0 ( #9923 )
...
## [0.61.0] - 2025-03-20
- c631291 parser: [**BREAKING**] Parse `TSImportAttributes` as
`ObjectExpression` (#9902 ) (Boshen)
- eef7eb6 minifier: [**BREAKING**] Rename
`CompressOptions::all_true`/`all_false` to `smallest`/`safest` (#9866 )
(sapphi-red)
### Features
- 38ad787 data_structures: Add `assert_unchecked!` macro (#9885 )
(overlookmotel)
- dcd356e minifier: Support `keep_names` option (#9867 ) (sapphi-red)
- 6565fc4 napi: Feature gate allocator (#9921 ) (Boshen)
- 2cedfe4 napi: Add codeframe to napi error (#9893 ) (Boshen)
- a9a47a6 parser: Add regex cargo feature to oxc_parser (#9879 ) (Toshit)
- d4a83ba parser: Report duplicate modifier `Accessibility modifier
already seen.` (#9890 ) (Boshen)
- 59c8f71 parser,codegen: Handle lone surrogate in string literal
(#9918 ) (Boshen)
### Bug Fixes
- 28a2ed3 estree/ast: Fix `IdentifierName` and `IdentifierReference`
(#9863 ) (hi-ogawa)
- 3d4c5f3 semantic: Correctly visit `IfStmt` `test` when building cfg
(#9864 ) (camc314)
- 1774225 transformer/using: Incorrect scope ids for bindings (#9871 )
(camc314)- 68018e1 Ast changes (Boshen)
### Performance
- 5f97f28 ast/estree: Speed up raw deser for `JSXElement` (#9895 )
(overlookmotel)
- b272893 mangler, minifier: Initialize a Vec with a specific value
using `Vec::from_iter_in` combined with `repeat_with` (#9908 ) (Dunqing)
- f7d078c semantic: Use `reserve_exact` instead of `reserve` to save
memory in pre-reserve (#9910 ) (Dunqing)
### Documentation
- 590a258 napi/parser: Add stackblitz link for wasm build (Boshen)
### Refactor
- 62e2859 ast/ast_builder: Use `self.vec_from_iter` instead of
`Vec::from_iter_in` for consistency (#9909 ) (Dunqing)
- b2f3d23 isolated_declarations: Remove unused `self` params (#9868 )
(overlookmotel)
- 961b95d napi: Move common code to `oxc_napi` (#9875 ) (Boshen)
- 233c1fc napi/playground: Add JSON.parse wrapper (#9880 ) (Hiroshi
Ogawa)
- dbe61c5 transformer/module-runner-transform: Remove redundant
converison (#9912 ) (Dunqing)
- ecdfe2e transformer/using: Move work to `exit_static_block` (#9713 )
(camc314)
### Testing
- 9314147 data_structures: Enable doc tests for `oxc_data_structures`
crate (#9884 ) (overlookmotel)
- 040e993 napi: Refactor NAPI parser benchmarks (#9911 ) (overlookmotel)
- e637e2e napi/parser: Tweak vitest config (#9878 ) (Hiroshi Ogawa)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-20 20:06:21 +08:00
Boshen
6565fc4261
feat(napi): feature gate allocator ( #9921 )
...
Rolldown already has allocator enabled, double allocator is a compile error.
2025-03-20 11:40:08 +00:00
Boshen
2cedfe4148
feat(napi): add codeframe to napi error ( #9893 )
...
closes #8684
2025-03-19 08:41:31 +00:00
Hiroshi Ogawa
e637e2edcf
test(napi/parser): tweak vitest config ( #9878 )
...
- fixed `@vitest/browser` version mismatch
- removed `--typecheck` since `tsc` catches same errors (and honestly
vitest typecheck mode is not so intuitive 🙃 )
- added `diff.expand: false` since raw transfer mismatch is huge (we
might change the default on Vitest side
https://github.com/vitest-dev/vitest/pull/7697 )
2025-03-19 09:28:45 +08:00
Boshen
961b95d834
refactor(napi): move common code to oxc_napi ( #9875 )
2025-03-18 16:06:53 +00:00
oxc-bot
9baa7568f8
release(crates): v0.60.0 ( #9861 )
2025-03-18 17:01:17 +08:00
Boshen
aa3dff887a
feat(napi): add mimalloc to parser and transformr ( #9859 )
2025-03-18 16:51:37 +08:00
hi-ogawa
7106e5dc0f
refactor(napi): disable unused browser fs ( #9848 )
...
I don't think file access is needed for napi packages. I've already disabled this on napi/playground.
2025-03-18 05:53:21 +00:00
oxc-bot
7cfe1a5e01
release(crates): v0.59.0 ( #9850 )
2025-03-18 13:50:33 +08:00
oxc-bot
7856a0b091
release(crates): v0.58.1 ( #9754 )
...
## [0.58.1] - 2025-03-13
### Features
- a8331f7 transformer: Turn off explicit resource management by default
(#9749 ) (Boshen)
### Bug Fixes
- cd3f2fb ast/estree: Fix `JSXOpeningFragment` (#9747 ) (Hiroshi Ogawa)
- fecec56 ast/estree: Fix `JSXOpeningElement` field order (#9746 )
(hi-ogawa)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-13 20:34:27 +08:00
Boshen
a8331f7b49
feat(transformer): Turn off explicit resource management by default ( #9749 )
2025-03-13 11:09:20 +00:00
oxc-bot
38d1302267
release(crates): v0.58.0 ( #9740 )
2025-03-13 16:58:56 +08:00
Dunqing
3429898cc5
feat(transformer/module_runner_transform): remove duplicate deps and dynamicDeps ( #9709 )
...
I found that the import source can be repeated, so it seems like removing the duplicate `deps` and `dynamicDeps` would be better, but I am not sure it is worth doing it.
2025-03-12 09:27:53 +00:00
oxc-bot
8d18dc4207
release(crates): v0.57.0 ( #9668 )
...
## [0.57.0] - 2025-03-11
- 510446a parser: [**BREAKING**] Align JSXNamespacedName with ESTree
(#9648 ) (Arnaud Barré)
- b0d979d semantic: [**BREAKING**] Make `Scoping::references` private
(#9629 ) (Boshen)
- 3c6f140 semantic: [**BREAKING**] Make `Scoping` methods consistent
(#9628 ) (Boshen)
- ef6e0cc semantic: [**BREAKING**] Combine `SymbolTable` and `ScopeTree`
into `Scoping` (#9615 ) (Boshen)
- 7331656 semantic: [**BREAKING**] Rename `SymbolTable` and `ScopeTree`
methods (#9613 ) (Boshen)
- 23738bf semantic: [**BREAKING**] Introduce `Scoping` (#9611 ) (Boshen)
### Features
- b6deff8 ecmascript: Support integer index access for array and string
in `may_have_side_effects` (#9603 ) (sapphi-red)
- 047fb01 minifier: Place `void 0` on right hand side if possible
(#9606 ) (sapphi-red)
- 36f8703 minifier: Compress `[] + string` to `string` (#9602 )
(sapphi-red)
- 554c4ce minifier: Compress constant integer index access (#9604 )
(sapphi-red)
- e3c2015 minifier: Allow compressing computed __proto__ more precisely
(#9595 ) (sapphi-red)
- 6a57198 minifier: Allow compressing computed constructor/prototype
keys precisely (#9594 ) (sapphi-red)
- 638007b parser: Apply `preserveParens` to `TSParenthesizedType`
(#9653 ) (Boshen)
### Bug Fixes
- eae1a41 ast: Align `TSImportType` field names with ts-eslint (#9664 )
(Boshen)
- 96eef8b ecmascript: `(foo() + "").length` may have a side effect
(#9605 ) (sapphi-red)
- 24d9261 minifier: Remove names from functions / classes in normal pass
to make the minifier idempotent (#9608 ) (sapphi-red)
- 6ac3635 napi/parser: Disable raw transfer on unsupported platforms
(#9651 ) (overlookmotel)
- cfdcfdb parser: Fix end span for optional binding pattern without type
annotation (#9652 ) (Boshen)
- 26da65d parser: Parse asi after class accessor property (#9623 )
(Boshen)
- 87462fd parser: Fix end span for `using` declaration (#9622 ) (Boshen)
- 29edb51 transformer: Fix module runner transform of export default
expression (#9661 ) (hi-ogawa)
### Documentation
- 31a2618 allocator: Add safety constraint for
`String::from_raw_parts_in` (#9640 ) (overlookmotel)
### Refactor
- 44101bd allocator: Refactor and improve safty comments of
`String::from_strs_array_in` (#9639 ) (overlookmotel)
- c6edafe napi: Remove `npm/oxc-*/` npm packages (#9631 ) (Boshen)
- a43c341 semantic: Add `Scoping` to `Semantic` (#9614 ) (Boshen)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-11 12:05:56 +08:00
Boshen
c6edafe08d
refactor(napi): remove npm/oxc-*/ npm packages ( #9631 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-09 22:43:06 +08:00
Boshen
23738bf9db
refactor(semantic)!: introduce Scoping ( #9611 )
...
part of #9607
2025-03-09 10:28:11 +00:00
oxc-bot
0ab76bf129
release(crates): v0.56.5 ( #9593 )
...
## [0.56.5] - 2025-03-07
### Refactor
- 5103322 semantic: Move `IsGlobalReference` to its own file (#9592 )
(Boshen)
- b7484b8 semantic: Remove `CompactStr` usage from `ClassTable` (#9591 )
(Boshen)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-07 23:34:02 +08:00
oxc-bot
5352483965
release(crates): v0.56.4 ( #9589 )
...
## [0.56.4] - 2025-03-07
### Bug Fixes
- c08b7fc napi: Commit wasi files (Boshen)
- 35626a4 npm: Change to `wasm32-wasip1-threads` target (Boshen)
### Refactor
- 62bffed rust: Allow a few annoying clippy rules (#9588 ) (Boshen)
- adf7987 transformer: Combine strings by `ctx.ast.atom_from_array`
(#9401 ) (Dunqing)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-07 20:30:37 +08:00
Boshen
c08b7fc0ce
fix(napi): commit wasi files
2025-03-07 19:53:33 +08:00
oxc-bot
48fa01cba5
release(crates): v0.56.3 ( #9587 )
2025-03-07 17:35:32 +08:00
oxc-bot
f82cbeea74
release(crates): v0.56.2 ( #9584 )
2025-03-07 15:31:20 +08:00
oxc-bot
109d06626d
release(crates): v0.56.1 ( #9582 )
2025-03-07 12:02:05 +08:00
Boshen
0bbb197c87
ci(npm): rework release pipeline ( #9581 )
2025-03-07 11:49:50 +08:00
oxc-bot
64080ee745
release(crates): v0.56.0 ( #9572 )
2025-03-06 09:47:22 +08:00
oxc-bot
4d973040c8
release(crates): v0.55.0 ( #9554 )
2025-03-05 14:19:54 +08:00
Dunqing
ffd485c74c
feat(transformer, napi/transform): expose moduleRunnerTransform function ( #9532 )
...
Expose a `moduleRunnerTransform` function that `Vite` can directly use it to speed-up ssr transform. In this way, `Vitest` also benefits without having to wait for `rolldown-vite`.
2025-03-04 14:53:51 +00:00
Dunqing
45ace4419b
feat(transformer): add /* @_PURE__ */ annotation for pure calls ( #9424 )
...
close : #6072
Many tests outputs are updated because we need to print `/* @_PURE__ */` for the pure calls.
2025-03-04 06:13:21 +00:00
oxc-bot
7bfb6076b5
release(crates): v0.54.0 ( #9524 )
...
## [0.54.0] - 2025-03-04
- 098f652 codegen: [**BREAKING**] Add `CommentAnnotation` to avoid
parsing comments again (#9506 ) (Boshen)
- a8d1d48 parser,codegen: [**BREAKING**] Parse and
print`#__NO_SIDE_EFFECTS__` (#9496 ) (Boshen)
- 355a4db napi/parser: [**BREAKING**] Remove `parse_without_return` API
(#9455 ) (Boshen)
- a5cde10 visit_ast: [**BREAKING**] Add `oxc_visit_ast` crate (#9428 )
(Boshen)
- abb15e0 ast: [**BREAKING**] Add `pure` field to `Function`,
`CallExpression`, and `NewExpression` (#9207 ) (overlookmotel)
### Features
- a9f0d2b ast_tools: Generate field offset assertions for more types
(#9449 ) (overlookmotel)
- 64f4a82 ecmascript: Handle pure call expression in chain expressions
(#9480 ) (sapphi-red)
- 32139d2 ecmascript: Support `/* @__PURE__ */` in may_have_side_effects
(#9409 ) (sapphi-red)
- f5453f6 minifier: Flatten spread args in new expressions (#9512 )
(sapphi-red)
- f8073f3 minifier: Support if with side effects in dead code
elimination (#9502 ) (sapphi-red)
- 10eb8f7 minifier: Use `remove_unused_expression` in
`try_fold_sequence_expression` in `remove_dead_code` (#9467 )
(sapphi-red)
- 70916db minifier: Remove unused expression in for init and update
(#9466 ) (sapphi-red)
- 26fde56 minifier: Inline simple IIFEs in `remove_unused_expression`
(#9465 ) (sapphi-red)
- ec2193e minifier: Support extracting arguments in pure calls in
`remove_unused_expression` (#9463 ) (sapphi-red)
- 007051c minifier: Compress `a != null && a.b()` to `a?.b()` in
`remove_unused_expression` (#9459 ) (sapphi-red)
- 50fce20 minifier: Support binary expression in
`remove_unused_expression` (#9456 ) (sapphi-red)
- ed9ede3 minifier: Support conditional expression in
`remove_unused_expression` (#9432 ) (sapphi-red)
- 3520538 minifier: Support object expression in
`remove_unused_expression` (#9430 ) (sapphi-red)
- fb8a93d minifier: Improve array expression handling in
`remove_unused_expression` (#9427 ) (sapphi-red)
- ff477cd minifier: Support template literals in
`remove_unused_expression` (#9426 ) (sapphi-red)
- 0d26113 minifier: Compress `/* @__PURE__ */ a() ? b : b` to `b`
(#9410 ) (sapphi-red)
- 68c77c8 napi/parser: Return semantic errors (#9460 ) (Boshen)
- 7d7f16c parser: Apply pure to rhs of binary expression (#9492 )
(Boshen)
- 2a08b14 parser: Support V8 intrinsics (#9379 ) (injuly)
- 9b7017c parser,codegen: Pure annotations (#9351 ) (Boshen)
- aa06932 transformer: Support `ModuleRunnerTransform` (#9371 ) (Dunqing)
### Bug Fixes
- 75f06ad codegen: Do not print comments when only `annotation_comments`
is enabled (#9518 ) (Dunqing)
- f5bbd5d ecmascript: Fix toString for negative numbers (#9508 )
(sapphi-red)
- d2cd975 ecmascript: Fix may_have_side_effects for `${a() === b}`
(#9478 ) (sapphi-red)
- 584d847 ecmascript: Objects passed to template literals may have side
effects (#9425 ) (sapphi-red)
- b371fdc estree/ast: Camel-case `typeAnnotation` field (#9420 )
(overlookmotel)
- 1fff993 minifier: Correctly remove dead code in `try` with `finally`
(#9503 ) (sapphi-red)
- 0b96ebe minifier: Don't inline IIFE with parameters (#9477 )
(sapphi-red)
- 071c84c minifier: Skip `try_fold_stmt_in_boolean_context` on
`ExpressionStatement` (#9458 ) (sapphi-red)
- 306284d minifier: Call mark_current_function_as_changed in
remove_unused_expression (#9457 ) (sapphi-red)
- 9c6ae9f parser: `@__NO_SIDE_EFFECTS` only affects const variable decl
(#9517 ) (Boshen)
- b7d5513 parser: Parse `@__NO_SIDE_EFFECTS__` between `export default`
and `async function` (#9514 ) (Boshen)
- 01de74c parser: Correctly fail parsing when parsing `foo.bar?.`
(#9499 ) (camc314)
- 58defe3 parser: Mark expression as pure in chain expression (#9479 )
(sapphi-red)
- 2a03689 parser: Mark expressions on the left side of logical and
conditional expressions as pure (#9414 ) (sapphi-red)
- 7fde233 transformer/legacy-decorator: Incorrect check for potentially
non-existent ident (#9491 ) (Dunqing)
- b4f050c transformer/legacy-decorator: Metadata incorrectly wrapped by
decorateParam (#9490 ) (Dunqing)
- 5f67fa9 transformer/optional-chaning: Keep `this` when transforming
`this.f?.()` (#9505 ) (camc314)
### Performance
- 10e4431 ast/estree: Skip escaping identifiers (#9398 ) (overlookmotel)
- b0a0a82 ast/estree: Reduce overhead serializing static strings (#9396 )
(overlookmotel)
- 27a8e50 isolated_declarations: Reserve sufficient capacity in
statements `Vec` (#9394 ) (overlookmotel)
### Refactor
- 8916335 ast/estree: Convert enums with converters on variants (#9438 )
(overlookmotel)
- dcff40c ast_tools: Generate layout assertions in multiple crates
(#9448 ) (overlookmotel)
- 19c4835 codegen: Simplify printing comments between arguments in
call-like expressions (#9501 ) (Dunqing)
- c880481 isolated_declarations: Rename var (#9390 ) (overlookmotel)
- 37e41f0 isolated_declarations: Use aliases `ArenaBox` / `ArenaVec`
(#9389 ) (overlookmotel)
- bbb450c minifier: Move `a != null && b` -> `a ?? b` compression to
`remove_unused_expression` (#9468 ) (sapphi-red)
- b93774c minifier: Move `try_fold_iife` to `remove_unused_expression`
(#9464 ) (sapphi-red)
- 96a9719 minifier: Use `may_have_side_effects` in
`remove_unused_expression` (#9413 ) (sapphi-red)
### Testing
- c187b11 ecmascript: Add comments and tests for cases where
`ToPropertyKey` throws an error (#9429 ) (sapphi-red)
- d129055 napi: Add tests for worker threads (#9408 ) (Boshen)
- 48d51e3 napi: Add tests for `hashbang` field (#9386 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-03-04 08:42:28 +08:00
Dunqing
b4f050cf58
fix(transformer/legacy-decorator): metadata incorrectly wrapped by decorateParam ( #9490 )
...
close: https://github.com/rolldown/rolldown/issues/3728#issuecomment-2693097569
Before, we need to make sure all metadata decorators are placed after parameter decorators. I tried to push them to the last parameter decorators. But it caused it to be incorrectly wrapped by `decorateParam`.
I re-check decorate helper implementation, I didn't see any potential runtime will caused by the decorators order. So I decide to always push to method's decorators
Before:
```js
_decorate([
_decorateParam(0, dce),
_decorateParam(0, _decorateMetadata("design:type", Function)),
_decorateParam(0, _decorateMetadata("design:paramtypes", [Object])),
_decorateParam(0, _decorateMetadata("design:returntype", void 0))
], C.prototype, "method", null);
```
After:
```js
_decorate([
_decorateMetadata("design:type", Function),
_decorateMetadata("design:paramtypes", [Object]),
_decorateMetadata("design:returntype", void 0),
_decorateParam(0, dce)
], C.prototype, "method", null);
```
2025-03-03 04:08:32 +00:00
Boshen
d129055dc6
test(napi): add tests for worker threads ( #9408 )
...
There are user code which may crash under some random circumstances
that we don't understand. Prevent these crashes with a test.
2025-02-27 07:19:11 +00:00
oxc-bot
41b3d2b9b7
release(crates): v0.53.0 ( #9381 )
...
## [0.53.0] - 2025-02-26
- https://github.com/oxc-project/oxc/pull/9289
- 4a5a7cf napi/parser: [**BREAKING**] Remove magic string; enable utf16
span converter by default (#9291 ) (Boshen)
### Features
- 5c775ea ast/estree: Enable serialization without TS fields (#9285 )
(overlookmotel)
- f21740e data_structures: Add `CodeBuffer::print_bytes_iter_unchecked`
method (#9337 ) (overlookmotel)
- e10fb97 ecmascript: Improve may_have_side_effects for `.length`
(#9366 ) (sapphi-red)
- 35e5ca9 ecmascript: Improve may_have_side_effects for `instanceof`
(#9365 ) (sapphi-red)
- 11012c6 ecmascript: Improve ValueType for coalesce operator (#9354 )
(sapphi-red)
- b7998fd ecmascript: To_number for object without toString (#9353 )
(sapphi-red)
- e51d563 minifier: Concatenate strings with template literals on right
side (#9356 ) (sapphi-red)
- 9d7db54 minifier: Concatenate strings with template literals (#9355 )
(sapphi-red)
- 835ee95 wasm: Return estree with utf16 span offsets (#9376 ) (Boshen)
### Bug Fixes
- 6a8f53f ast/estree: Visit `JSXOpeningFragment` and
`JSXClosingFragment` (#9342 ) (overlookmotel)
- e303767 ast/estree: Fix ESTree AST for imports and exports (#9282 )
(overlookmotel)
- 54d59f1 data_structures: Stack types correctly report allocation size
if allocation failure during grow (#9317 ) (overlookmotel)
- f5c8698 ecmascript: Correct may_have_side_effects for classes (#9367 )
(sapphi-red)
- d3ed128 minifier: Do not remove `=== 0` if the lhs can be NaN (#9352 )
(sapphi-red)
### Performance
- 82adab9 ast/estree: Speed up building UTF8-UTF16 translation table
with SIMD (#9359 ) (overlookmotel)
- 61939ca ast/estree: Faster UTF-8 to UTF-16 span conversion (#9349 )
(overlookmotel)
- 1bfc459 ast/estree: Pre-allocate `CodeBuffer` for JSON output (#9340 )
(overlookmotel)
- 018c523 ast/estree: `ESTree` serializer use `CodeBuffer` (#9331 )
(overlookmotel)
- 35ee399 codegen: Use `iter::repeat_n` in `CodeBuffer` (#9325 )
(overlookmotel)
### Documentation
- 8bd3e39 data_structures: Uppercase SAFETY comments (#9330 )
(overlookmotel)
### Refactor
- d94fc15 allocator: Reduce scope of `unsafe` blocks (#9319 )
(overlookmotel)
- 7427900 ast: Re-order `ExportDefaultDeclaration` fields (#9348 )
(overlookmotel)
- b09249c ast/estree: Rename serializers and serialization methods
(#9284 ) (overlookmotel)
- 55ed1df ast/estree: Shorten `ESTree` impls for enums (#9275 )
(overlookmotel)
- 9d98444 codegen, data_structures: Move `CodeBuffer` into
`oxc_data_structures` crate (#9326 ) (overlookmotel)
- 6a4e892 data_structures: Add debug assertion to
`CodeBuffer::peek_nth_char_back` and improve safety docs (#9336 )
(overlookmotel)
- fc46218 data_structures: `CodeBuffer::print_str` use
`Vec::extend_from_slice` (#9332 ) (overlookmotel)
- 690bae5 data_structures: Stack types const assert `T` is not zero-size
type (#9318 ) (overlookmotel)
- 10ba2ea data_structures: Reduce scope of `unsafe` blocks (#9316 )
(overlookmotel)
- beb8382 data_structures: `CodeBuffer::print_bytes_unchecked` take a
byte slice (#9327 ) (overlookmotel)
- faf966f ecmascript: Don't check side effects in constant_evaluation
(#9122 ) (sapphi-red)
- 2faabe1 estree: Make `itoa` dependency optional (#9338 )
(overlookmotel)
- 4e9e8cf lexer: Reduce scope of `unsafe` blocks (#9320 ) (overlookmotel)
- c31b53f mangler: Reduce scope of `unsafe` blocks (#9321 )
(overlookmotel)
- f10a6da mangler: Move base54 into seperate mod (#9278 ) (Cameron)
- 12e89e0 syntax: Reduce scope of `unsafe` blocks (#9322 )
(overlookmotel)
- f39be5f traverse: Reduce scope of `unsafe` blocks (#9323 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com >
2025-02-26 20:00:21 +08:00
Boshen
1d81adac48
Rust Edition 2024 ( #9289 )
...
closes #9271
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-22 11:56:25 +08:00
oxc-bot
ba8dcfd6aa
release(crates): v0.52.0 ( #9276 )
2025-02-21 23:51:58 +08:00
Boshen
c2ee8060dc
chore: include build.rs in napi crates
2025-02-21 23:37:03 +08:00
Boshen
c933c6d67a
chore(deps): bump napi ( #9274 )
2025-02-21 23:33:21 +08:00
Dunqing
8a5051eea1
feat(napi/transform): support enabling emitDecoratorMetadata ( #9190 )
2025-02-19 14:04:33 +00:00
Dunqing
90ba2838b4
feat(transformer/decorator): support emitting decorator metadata ( #9057 )
...
close : #9186
## Implementation
The Implementation port from [TypeScript]( https://github.com/microsoft/TypeScript/blob/d85767abfd83880cea17cea70f9913e9c4496dcc/src/compiler/transformers/ts.ts#L1119-L1136 )
## Example
Input:
```ts
class Demo {
@LogMethod
public foo(bar: number) {}
@Prop
prop: string = "hello";
}
```
Output:
```js
class Demo {
foo(bar) {}
prop = "hello";
}
babelHelpers.decorate([
LogMethod,
babelHelpers.decorateParam(0, babelHelpers.decorateMetadata("design:type", Function)),
babelHelpers.decorateParam(0, babelHelpers.decorateMetadata("design:paramtypes", [Number])),
babelHelpers.decorateParam(0, babelHelpers.decorateMetadata("design:returntype", void 0))
], Demo.prototype, "foo", null);
babelHelpers.decorate([Prop, babelHelpers.decorateMetadata("design:type", String)], Demo.prototype, "prop", void 0);
```
## Limitations
### Compared to TypeScript
We lack a type inference ability that TypeScript has, so we cannot determine the exact type of the TyepReference refers to. See [`LegacyDecoratorMetadata::serialize_type_reference_node`] does.
For example:
Input:
```ts
type Foo = string;
class Cls {
@dec
p: Foo = ""
}
```
TypeScript Output:
```js
class Cls {
constructor() {
this.p = "";
}
}
__decorate([
dec,
__metadata("design:type", String) // Infer the type of `Foo` is `String`
], Cls.prototype, "p", void 0);
```
OXC Output:
```js
var _ref;
class Cls {
p = "";
}
babelHelpers.decorate([
dec,
babelHelpers.decorateMetadata("design:type", typeof (_ref = typeof Foo === "undefined" && Foo) === "function" ? _ref : Object)
],
Cls.prototype, "p", void 0);
```
### Compared to SWC
SWC also has the above limitation, considering that SWC has been adopted in [NestJS](https://docs.nestjs.com/recipes/swc#jest--swc ), so the limitation may not be a problem. In addition, SWC provides additional support for inferring enum members, which we currently do not have. We haven't dived into how NestJS uses it, so we don't know if it matters, thus we may leave it until we receive feedback.
2025-02-19 14:04:32 +00:00
Arnaud Barré
8d7ceeeed4
ci(napi/transform): validate napi dts files ( #9183 )
...
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com >
2025-02-18 17:14:22 +08:00