Boshen
725571aad1
feat(napi/transformer): add jsx option to force parsing with jsx ( #4133 )
...
To mimic the esbuild `loader=jsx` or babel `babel-plugin-syntax-jsx` behavior.
2024-07-10 11:12:10 +00:00
github-actions[bot]
714bf1dd7f
Release crates v0.19.0 ( #4137 )
...
## [0.19.0] - 2024-07-09
- b936162 ast/ast_builder: [**BREAKING**] Shorter allocator utility
method names. (#4122 ) (rzvxa)
### Features
- 485c871 ast: Allow conversion from `Expression` into `Statement` with
`FromIn` trait. (#4124 ) (rzvxa)
### Refactor
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-09 20:32:06 +08:00
github-actions[bot]
e29cdbfe40
Release crates v0.18.0 ( #4136 )
...
## [0.18.0] - 2024-07-09
- d347aed ast: [**BREAKING**] Generate `ast_builder.rs`. (#3890 ) (rzvxa)
### Features
- c6c16a5 minifier: Dce all conditional expressions (#4135 ) (Boshen)
- 365d9ba oxc_codegen: Generate annotation comments before
`CallExpression` and `NewExpression` (#4119 ) (IWANABETHATGUY)
- 3a0f2aa parser: Check for illegal modifiers in modules and namespaces
(#4126 ) (DonIsaac)
- 2f53bdf semantic: Check for abstract ClassElements in non-abstract
classes (#4127 ) (DonIsaac)
- c4ee9f8 semantic: Check for abstract initializations and
implementations (#4125 ) (Don Isaac)
- 44c7fe3 span: Add various implementations of `FromIn` for `Atom`.
(#4090 ) (rzvxa)
### Bug Fixes
- cb1af04 isolated-declarations: Remove the `async` and `generator`
keywords from `MethodDefinition` (#4130 ) (Dunqing)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-09 19:56:10 +08:00
github-actions[bot]
c3f08ce8e0
Release crates v0.17.2 ( #4115 )
...
## [0.17.2] - 2024-07-08
### Features
- 115ac3b allocator: Introduce `FromIn` and `IntoIn` traits. (#4088 )
(rzvxa)
- 720983a napi/transform: Allow setting `sourceType` to `transform`
(#4113 ) (Boshen)
- e386b62 semantic: Check for invalid type import assignments (#4097 )
(DonIsaac)
### Bug Fixes
- 5472b7c codegen: 256 indentations level is not enough for codegen
(Boshen)
- 5c31236 isolated-declarations: Keep literal value for readonly
property (#4106 ) (Dunqing)
- e67c7d1 isolated-declarations: Do not infer type for private
parameters (#4105 ) (Dunqing)
- 3fcad5e isolated_declarations: Remove nested AssignmentPatterns from
inside parameters (#4077 ) (michaelm)
- f8d77e4 isolated_declarations: Infer type of template literal
expressions as string (#4068 ) (michaelm)
- 0f02608 semantic: Bind `TSImportEqualsDeclaration`s (#4100 ) (Don
Isaac)
- 4413e2d transformer: Missing initializer for readonly consructor
properties (#4103 ) (Don Isaac)
### Performance
- 7ed27b7 isolated-declarations: Use `FxHashSet` instead of `Vec` to
speed up the `contain` (#4074 ) (Dunqing)
- 9114c8e semantic: Keep a single map of unresolved references (#4107 )
(Luca Bruno)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-08 19:16:33 +08:00
Boshen
720983a965
feat(napi/transform): allow setting sourceType to transform ( #4113 )
...
closes #4071
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-07-08 19:09:45 +08:00
github-actions[bot]
51d56d37ff
Release crates v0.17.1 ( #4075 )
...
## [0.17.1] - 2024-07-06
### Bug Fixes
- aa585d3 ast_codegen, ast: Visit `ExpressionArrayElement` as
`Expression`. (#4061 ) (rzvxa)
- 564a75a codegen: Missing TypeParameters in TSConstructSignature
(#4063 ) (michaelm)
- adee728 isolated_declarations: Don't report an error for parameters if
they are ObjectPattern or ArrayPattern with an explicit type (#4065 )
(michaelm)
- 1b8f208 isolated_declarations: Correct emit for private static methods
(#4064 ) (michaelm)
- 719fb96 minifier: Omit dce `undefined` which can be a shadowed
variable (#4073 ) (Boshen)
- 150f4d9 napi/transform: Display error with spanned messages (Boshen)
### Performance
- 7fe2a2f parser: Do not copy comments (#4067 ) (overlookmotel)
### Refactor
- 8fa98e0 ast: Inline trivial functions and shorten code (#4066 )
(overlookmotel)
- 65aee19 isolated-declarations: Reorganize scope tree (#4070 ) (Luca
Bruno)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-07 01:29:52 +08:00
Boshen
150f4d90fc
fix(napi/transform): display error with spanned messages
2024-07-05 23:41:39 +08:00
github-actions[bot]
224f5ef2cc
Release crates v0.17.0 ( #4059 )
...
## [0.17.0] - 2024-07-05
- e32b4bc ast: [**BREAKING**] Store trivia comments in a sorted slice
(#4045 ) (Luca Bruno)
- 1df6ac0 ast: [**BREAKING**] Rename `visit_enum_memeber` to
`visit_ts_enum_member`. (#4000 ) (rzvxa)
- 4a0eaa0 ast: [**BREAKING**] Rename `visit_enum` to
`visit_ts_enum_declaration`. (#3998 ) (rzvxa)
- c98d8aa ast: [**BREAKING**] Rename `visit_arrow_expression` to
`visit_arrow_function_expression`. (#3995 ) (rzvxa)
### Features
- 1854a52 ast_codegen: Introduce the `#[span]` hint. (#4012 ) (rzvxa)
- 7538af1 ast_codegen: Add visit generator (#3954 ) (rzvxa)
- 7768d23 isolated-declarations: Support optional class methods (#4035 )
(Egor Blinov)
- 0da9dfb minifier: Add constant folding to remove dead code (#4058 )
(Boshen)
### Bug Fixes
- aaac2d8 codegen: Preserve parentheses from AST instead calculating
from operator precedence (#4055 ) (Boshen)
- 5e5b1b1 codegen: Correct accessibility emit for class
formal-parameters/methods/properties (#4042 ) (Egor Blinov)
- 7844734 codegen: Missing const keyword in TSTypeParamter (#4022 )
(Dunqing)
- 6254a41 codegen: Missing TypeParamters in TSCallSignature (#4021 )
(Dunqing)
- 3d29e9c isolated-declarations: Eliminate imports incorrectly when they
are used in `TSInferType` (#4043 ) (Dunqing)
- 02ea19a isolated-declarations: Should emit `export {}` when only
having `ImportDeclaration` (#4026 ) (Dunqing)
- 7c915f4 isolated-declarations: Binding elements with export should
report an error (#4025 ) (Dunqing)
- 05a047c isolated-declarations: Method following an abstract method
gets dropped (#4024 ) (Dunqing)
- c043bec isolated_declarations: Add mapped-type constraint to the scope
(#4037 ) (Egor Blinov)
- b007553 isolated_declarations: Fix readonly specifier on class
constructor params (#4030 ) (Egor Blinov)
- da62839 isolated_declarations: Inferring literal types for readonly
class fileds (#4027 ) (Egor Blinov)
### Refactor
- b51f75b ast_codegen: No longer outputs discard variable for empty
visitors. (#4008 ) (rzvxa)
- edb557c minifier: Add a folder struct for constant folding (#4057 )
(Boshen)
- 243c9f3 parser: Use function instead of trait to parse list with rest
element (#4028 ) (Boshen)
- 1dacb1f parser: Use function instead of trait to parse delimited lists
(#4014 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-05 15:46:50 +08:00
github-actions[bot]
e2c9015ef6
Release crates v0.16.3 ( #4013 )
...
## [0.16.3] - 2024-07-02
### Features
- b257d53 linter: Support report
`@typescript-eslint/consistent-type-imports` (#3895 ) (mysteryven)
### Bug Fixes
- 23038ad codegen: Print `TSFunctionType` inside `TSTypeAssertion`
(#3999 ) (Boshen)
- d995f94 semantic: Resolve reference incorrectly when a parameter
references a parameter that hasn't been defined yet (#4004 ) (Dunqing)
- bdee156 transformer/typescript: `declare class` incorrectly preserved
as runtime class (#3997 ) (Dunqing)
- a50ce3d transformer/typescript: Missing initializer for class
constructor arguments with `private` and `protected` modifier (#3996 )
(Dunqing)
### Refactor
- 0fe22a8 ast: Reorder fields to reflect their visit order. (#3994 )
(rzvxa)
- d0eac46 parser: Use function instead of trait to parse normal lists
(#4003 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-02 12:47:29 +08:00
underfin
0b56d50899
chore(napi): make transformer options optional ( #3989 )
2024-07-01 16:45:00 +08:00
Boshen
e44963acda
Revert "chore(napi/transform): support wasm build ( #3933 )"
...
This reverts commit 3e9e4c9912 .
2024-06-30 22:04:36 +08:00
github-actions[bot]
3870ed5a24
Release crates v0.16.2 ( #3983 )
...
## [0.16.2] - 2024-06-30
### Features
- dc6d45e ast,codegen: Add `TSParenthesizedType` and print type
parentheses correctly (#3979 ) (Boshen)
- 63f36da parser: Parse modifiers with `parse_modifiers` (take 2)
(#3977 ) (DonIsaac)
### Bug Fixes
- dac617d codegen: Print some missing typescript attributes (#3980 )
(Boshen)
- bd1141d isolated-declarations: If declarations is referenced in
`declare global` then keep it (#3982 ) (Dunqing)
### Performance
- b234ddd semantic: Only check for jsdoc if jsdoc building is enabled
(Boshen)
- 1eac3d2 semantic: Use `Atom<'a>` for `Reference`s (#3972 ) (Don Isaac)
- 0c81fbe syntax: Use `NonZeroU32` for `SymbolId` and `ReferenceId`
(#3970 ) (Boshen)
### Refactor
- 5845057 transformer: Pass in symbols and scopes (#3978 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-30 19:59:15 +08:00
Dunqing
3e9e4c9912
chore(napi/transform): support wasm build ( #3933 )
...
~~Encountered the same problem as
https://github.com/oxc-project/oxc-resolver/issues/190 . Fixed in
napi@2.16.7, but oxc use `3.x`~~
Fixed in napi@3.0.0-alpha.3
2024-06-30 19:49:02 +08:00
Boshen
5d6490e95d
chore: add crate oxc_transform_napi to release
2024-06-30 18:53:17 +08:00
Boshen
5845057bff
refactor(transformer): pass in symbols and scopes ( #3978 )
...
This PR adds a new method `build_with_symbols_and_scopes` to make semantic building optional, there may be prior steps that has the semantic data already built.
2024-06-30 06:33:48 +00:00
underfin
bbe8336c7b
feat(napi/transform): add crate-type: "lib" ( #3876 )
2024-06-26 21:57:53 +08:00
underfin
d3cd3ea2de
feat: oxc transform binding ( #3896 )
...
closes #3877
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-26 21:57:19 +08:00
Boshen
4f2f96e716
chore(napi/transform): remove unused dependencies
2024-06-20 23:26:57 +08:00
Boshen
05e97b615d
chore: fix clippy warning
2024-06-20 23:22:01 +08:00
Boshen
fe38a20715
refactor(napi/transform): output normal error messages
2024-06-20 23:14:17 +08:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt
2024-06-19 00:48:30 +08:00
Boshen
5c38a0fd69
feat(codegen)!: new code gen API ( #3740 )
...
This PR introduces two type alias to avoid the confusing const generic `pub struct Codegen<'a, const MINIFY: bool>`
* CodeGenerator - Code generator without whitespace removal.
* WhitespaceRemover - Code generator with whitespace removal.
Usage is changed to a builder pattern:
```rust
CodeGenerator::new()
.enable_comment(...)
.enable_sourcemap(...)
.build(&program);
```
2024-06-18 15:50:12 +00:00
Boshen
f42c325a06
refactor(napi): change "isolated declarations" to "transform" ( #3721 )
2024-06-17 14:09:18 +00:00