Dunqing
31e4c3b33e
fix(isolated-declarations): declare global {} should be kept even if it is not exported ( #3956 )
...
close : #3952
2024-06-29 05:07:21 +00:00
github-actions[bot]
4e3e1a39eb
Release crates v0.16.0 ( #3930 )
...
## [0.16.0] - 2024-06-26
- 6796891 ast: [**BREAKING**] Rename all instances of `BigintLiteral` to
`BigIntLiteral`. (#3898 ) (rzvxa)
- 1f85f1a ast: [**BREAKING**] Revert adding `span` field to the
`BindingPattern` type. (#3899 ) (rzvxa)
- ae09a97 ast: [**BREAKING**] Remove `Modifiers` from ts nodes (#3846 )
(Boshen)
- 1af5ed3 ast: [**BREAKING**] Replace `Modifiers` with `declare` and
`const` on `EnumDeclaration` (#3845 ) (Boshen)
- 0673677 ast: [**BREAKING**] Replace `Modifiers` with `declare` on
`Function` (#3844 ) (Boshen)
- ee6ec4e ast: [**BREAKING**] Replace `Modifiers` with `declare` and
`abstract` on `Class` (#3841 ) (Boshen)
- 9b38119 ast: [**BREAKING**] Replace `Modifiers` with `declare` on
`VariableDeclaration` (#3839 ) (Boshen)
- cfcef24 ast: [**BREAKING**] Add `directives` field to `TSModuleBlock`
(#3830 ) (Boshen)
- 4456034 ast: [**BREAKING**] Add `IdentifierReference` to
`ExportSpecifier` (#3820 ) (Boshen)
### Features
- 497769c ast: Add some visitor functions (#3785 ) (Dunqing)
- 4b06dc7 ast: Add TSType::TSIntrinsicKeyword to is_keyword (#3775 )
(Dunqing)
- 5847e16 ast,parser: Add `intrinsic` keyword (#3767 ) (Boshen)
- 2e026e1 ast_codegen: Generate `ast_kind.rs`. (#3888 ) (rzvxa)
- 09f4d3c ast_codegen: Add `ImplGetSpanGenerator`. (#3852 ) (rzvxa)
- 3e78f98 cfg: Add depth first search with hash sets. (#3771 ) (rzvxa)
- 01da2f7 codegen: Print TSThisParameter for TSCallSignatureDeclaration
and TSMethodSignature (#3792 ) (Dunqing)
- 2821e0e codegen: Print readonly keyword for TSIndexSignature (#3791 )
(Dunqing)
- 97575d8 codegen: Print TSClassImplements and TSThisParameter (#3786 )
(Dunqing)
- 5e2baf3 isolated-declarations: Report error for expando functions
(#3872 ) (Dunqing)
- 2cdb34f isolated-declarations: Support for class function overloads
(#3811 ) (Dunqing)
- 231b8f0 isolated-declarations: Support for export default function
overloads (#3809 ) (Dunqing)
- a37138f isolated-declarations: Improve the inference template literal
(#3797 ) (Dunqing)
- b0d7355 isolated-declarations: Transform const expression correctly
(#3793 ) (Dunqing)
- b38c34d isolated-declarations: Support inferring
ParenthesizedExpression (#3769 ) (Dunqing)
- 4134de8 isolated-declarations: Add ts error code to the error message
(#3755 ) (Dunqing)
- 94202de isolated-declarations: Add `export {}` when needed (#3754 )
(Dunqing)
- e95d8e3 isolated-declarations: Shrink span for arrow function that
needs an explicit return type (#3752 ) (Dunqing)
- df9971d isolated-declarations: Improve inferring the return type from
function (#3750 ) (Dunqing)
- 4aea2b1 isolated-declarations: Improve inferring the type of accessor
(#3749 ) (Dunqing)
- 9ea30c4 isolated-declarations: Treat AssignmentPattern as optional
(#3748 ) (Dunqing)
- dd540c8 minifier: Add skeleton for ReplaceGlobalDefines ast pass
(#3803 ) (Boshen)
- f3c3970 minifier: Add skeleton for RemoveDeadCode ast pass (#3802 )
(Boshen)
- 4fb90eb oxc: Export isolated-declarations (#3765 ) (Boshen)
- d5f6aeb semantic: Check for illegal symbol modifiers (#3838 ) (Don
Isaac)
- 01572f0 sourcemap: Impl `std::fmt::Display` for `Error` (#3902 )
(DonIsaac)
- 5501d5c transformer/typescript: Transform `import {} from "mod"` to
import `"mod"` (#3866 ) (Dunqing)
- 2a16ce0 traverse: Disable syntax check and disable build module record
(#3794 ) (Boshen)- d3cd3ea Oxc transform binding (#3896 ) (underfin)
### Bug Fixes
- 063cfde ast: Correct JSON serialization of `TSModuleBlock` (#3858 )
(overlookmotel)
- 66f404c ast: Fix JSON serialization of `BindingPattern` (#3856 )
(overlookmotel)
- 2766594 codegen: Print type parameters for MethodDefinition (#3922 )
(Dunqing)
- 27f0531 isolated-declarations: Private constructor reaching
unreachable (#3921 ) (Dunqing)
- 59ce38b isolated-declarations: Inferring of UnrayExpression
incorrectly (#3920 ) (Dunqing)
- 58e54f4 isolated-declarations: Report an error for parameters if they
are ObjectPattern or ArrayPattern without an explicit type (#3810 )
(Dunqing)
- cb8a272 isolated-declarations: Cannot infer nested `as const` (#3807 )
(Dunqing)
- d8ecce5 isolated-declarations: Infer BigInt number as `bigint` type
(#3806 ) (Dunqing)
- 4e241fc isolated-declarations: Missing `const` after transformed const
enum (#3805 ) (Dunqing)
- 683c7b0 isolated-declarations: Shouldn’t add declare in declaration
with export default (#3804 ) (Dunqing)
- 7d47fc3 isolated-declarations: Should stripe async and generator
keyword after transformed (#3790 ) (Dunqing)
- 8ce794d isolated-declarations: Inferring an incorrect return type when
there is an arrow function inside a function (#3768 ) (Dunqing)
- d29316a isolated-declarations: Transform incorrectly when there are
multiple functions with the same name (#3753 ) (Dunqing)
- bf1c250 isolated-declarations: False positives for non-exported
binding elements (#3751 ) (Dunqing)
- 275349a parser: Parse function type parameter name `accessor` (#3926 )
(Boshen)
- ef82c78 parser: Trailing comma is not allowed in
ParenthesizedExpression (#3885 ) (Dunqing)
- 13754cb parser: Change diagnostic to "modifier cannot be used here"
(#3853 ) (Boshen)
- 8c9fc63 semantic: Apply strict mode scope flag for strict mode TS
Modules (#3861 ) (overlookmotel)
- 99a40ce semantic: `export default foo` should have
`ExportLocalName::Default(NameSpan)` entry (#3823 ) (Boshen)
- 08fcfb3 transformer: Fix spans and scopes in TS enum transform (#3911 )
(overlookmotel)
- 17ad8f7 transformer: Create new scopes for new blocks in TS transform
(#3908 ) (overlookmotel)
- d76f34b transformer: TODO comments for missing scopes (#3837 )
(overlookmotel)
- e470731 transformer: TS transform handle when type exports first
(#3833 ) (overlookmotel)
- d774e54 transformer: TS transform generate do not copy statements
(#3832 ) (overlookmotel)
- ff1da27 transformer: Correct comment in example (#3831 )
(overlookmotel)
- 6dcc3f4 transformer: Fix TS annotation transform scopes (#3816 )
(overlookmotel)
- aea3e9a transformer: Correct spans for TS annotations transform
(#3782 ) (overlookmotel)
### Performance
- 92c21b2 diagnostics: Optimize string-buffer reallocations (#3897 )
(Luca Bruno)
- 4bf405d parser: Add a few more inline hints to cursor functions
(#3894 ) (Boshen)
- 10d1de5 semantic: Remove uneccessary allocation in builder (#3867 )
(DonIsaac)- 4f7ff7e Do not pass `&Atom` to functions (#3818 )
(overlookmotel)
### Refactor
- 6f26087 ast: Add comment about alternatives to `AstBuilder::copy`
(#3905 ) (overlookmotel)
- 442aca3 ast: Add comment not to use `AstBuilder::copy` (#3891 )
(overlookmotel)
- acf69fa ast: Refactor custom `Serialize` impls (#3859 ) (overlookmotel)
- 9e148e9 ast: Add line breaks (#3860 ) (overlookmotel)
- 363d3d5 ast: Add span field to the `BindingPattern` type. (#3855 )
(rzvxa)
- a648748 ast: Shorten code in AST builder (#3835 ) (overlookmotel)
- 1206967 ast: Reduce allocations in AST builder (#3834 ) (overlookmotel)
- 2f5d50e isolated-declarations: Remove `Modifiers` (#3847 ) (Boshen)
- 8027b1e minifier: Change prepass to ast_passes::remove_parens (#3801 )
(Boshen)
- a471e62 parser: Clean up `try_parse` (#3925 ) (Boshen)
- 3db2553 parser: Improve parsing of TypeScript type arguments (#3923 )
(Boshen)
- 4cf3c76 parser: Improve parsing of TypeScript types (#3903 ) (Boshen)
- 187f078 parser: Improve parsing of
`parse_function_or_constructor_type` (#3892 ) (Boshen)
- 97d59fc parser: Move code around for parsing `Modifiers` (#3849 )
(Boshen)
- 5ef28b7 transformer: Shorten code (#3912 ) (overlookmotel)
- d9f268d transformer: Shorten TS transform code (#3836 ) (overlookmotel)
- 21b0d01 transformer: Pass ref to function (#3781 ) (overlookmotel)
- 7c44703 transformer: Remove needless `pub` on TS enum transform
methods (#3774 ) (overlookmotel)
- 22c56d7 transformer: Move TSImportEqualsDeclaration transform code
(#3764 ) (overlookmotel)
- cd56aa9 transformer: Simplify TS export assignment transform (#3762 )
(overlookmotel)
- 512740d transformer: Move and simplify TS enum transform entry point
(#3760 ) (overlookmotel)
- 1061baa traverse: Separate `#[scope]` attr (#3901 ) (overlookmotel)
- fcd21a6 traverse: Indicate scope entry point with
`scope(enter_before)` attr (#3882 ) (overlookmotel)
- 24979c9 traverse: Use camel case props internally (#3880 )
(overlookmotel)
- 2045c92 traverse: Improve parsing attrs in traverse codegen (#3879 )
(overlookmotel)- d6437fe Clean up some usages of `with_labels` (#3854 )
(Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-27 20:38:31 +08:00
Dunqing
27665945f1
fix(codegen): print type parameters for MethodDefinition ( #3922 )
...
close : #3918
2024-06-26 07:21:42 +00:00
Dunqing
27f0531aac
fix(isolated-declarations): private constructor reaching unreachable ( #3921 )
...
fix : #3917
2024-06-26 07:21:38 +00:00
Dunqing
59ce38bb85
fix(isolated-declarations): inferring of UnrayExpression incorrectly ( #3920 )
...
close : #3914
2024-06-26 07:21:35 +00:00
rzvxa
6796891e2e
fix(ast)!: rename all instances of BigintLiteral to BigIntLiteral. ( #3898 )
...
Notice the casing! Just for the sake of consistency.
2024-06-25 14:39:42 +00:00
rzvxa
1f85f1a5f7
refactor(ast)!: revert adding span field to the BindingPattern type. ( #3899 )
...
Since this is a temporary solution in the time that we are waiting for the `#[span]` hint, And there are already other workarounds used in our `ast_codegen` I propose removing it right away - sorry in my opinion adding it in the first place was a mistake - in favor of adding an edge case in the codegen. It is better to do the refactoring in the codegen instead of the production code which people may depend on.
2024-06-25 09:43:48 +00:00
Dunqing
5e2baf3edd
feat(isolated-declarations): report error for expando functions ( #3872 )
...
close : #3703
2024-06-24 10:56:23 +00:00
Boshen
777f12b6fd
chore(isolated-declarations): run integration tests only once
2024-06-24 00:24:16 +08:00
rzvxa
363d3d57d7
refactor(ast): add span field to the BindingPattern type. ( #3855 )
...
So we don't have to introduce a special case while generating `GetSpan` implementations for all of our Ast types.
2024-06-23 16:00:40 +00:00
Boshen
2f5d50e710
refactor(isolated-declarations): remove Modifiers ( #3847 )
2024-06-23 12:46:36 +00:00
Boshen
ae09a97a09
refactor(ast)!: remove Modifiers from ts nodes ( #3846 )
2024-06-23 19:44:35 +08:00
Boshen
1af5ed3d89
refactor(ast)!: replace Modifiers with declare and const on EnumDeclaration ( #3845 )
2024-06-23 10:34:55 +00:00
Boshen
0673677317
refactor(ast)!: replace Modifiers with declare on Function ( #3844 )
2024-06-23 10:34:54 +00:00
Boshen
ee6ec4ee57
refactor(ast)!: replace Modifiers with declare and abstract on Class ( #3841 )
2024-06-23 10:34:53 +00:00
Boshen
9b38119ec9
refactor(ast)!: replace Modifiers with declare on VariableDeclaration ( #3839 )
...
part of #2958
2024-06-23 10:34:52 +00:00
Boshen
cfcef241db
feat(ast)!: add directives field to TSModuleBlock ( #3830 )
...
closes #3564
2024-06-22 18:14:08 +00:00
Boshen
445603444f
feat(ast)!: add IdentifierReference to ExportSpecifier ( #3820 )
...
closes #3795
closes #3796
2024-06-22 11:43:41 +00:00
overlookmotel
4f7ff7e3ad
perf: do not pass &Atom to functions ( #3818 )
...
`Atom` is just a wrapper around `&str`, so better not to pass `&Atom` to functions, as that's a double-reference. Prefer `Atom` or `&str` instead to avoid indirection.
2024-06-22 04:48:00 +00:00
Dunqing
2cdb34f6df
feat(isolated-declarations): support for class function overloads ( #3811 )
2024-06-21 14:37:10 +00:00
Dunqing
58e54f4aea
fix(isolated-declarations): report an error for parameters if they are ObjectPattern or ArrayPattern without an explicit type ( #3810 )
2024-06-21 10:20:28 +00:00
Dunqing
231b8f0946
feat(isolated-declarations): support for export default function overloads ( #3809 )
2024-06-21 10:20:25 +00:00
Dunqing
eadf495e85
chore(isolated-declarations): add tests from Deno ( #3808 )
2024-06-21 10:20:21 +00:00
Dunqing
cb8a272392
fix(isolated-declarations): cannot infer nested as const ( #3807 )
2024-06-21 10:20:17 +00:00
Dunqing
d8ecce5b3c
fix(isolated-declarations): infer BigInt number as bigint type ( #3806 )
2024-06-21 10:20:13 +00:00
Dunqing
4e241fcda8
fix(isolated-declarations): missing const after transformed const enum ( #3805 )
2024-06-21 10:20:10 +00:00
Dunqing
683c7b0dd1
fix(isolated-declarations): shouldn’t add declare in declaration with export default ( #3804 )
...
Added tests in #3808
2024-06-21 10:20:06 +00:00
Dunqing
a37138f1ec
feat(isolated-declarations): improve the inference template literal ( #3797 )
2024-06-20 15:02:45 +00:00
Dunqing
b0d7355c98
feat(isolated-declarations): transform const expression correctly ( #3793 )
2024-06-20 15:02:41 +00:00
Dunqing
2821e0e307
feat(codegen): print readonly keyword for TSIndexSignature ( #3791 )
2024-06-20 10:13:51 +00:00
Dunqing
7d47fc3fcc
fix(isolated-declarations): should stripe async and generator keyword after transformed ( #3790 )
2024-06-20 10:13:44 +00:00
Dunqing
97575d8cab
feat(codegen): print TSClassImplements and TSThisParameter ( #3786 )
...
close: https://github.com/oxc-project/oxc/issues/3692#issuecomment-2178994839
2024-06-20 06:15:23 +00:00
Dunqing
497769cb60
feat(ast): add some visitor functions ( #3785 )
2024-06-20 05:23:04 +00:00
Dunqing
b38c34dfce
feat(isolated-declarations): support inferring ParenthesizedExpression ( #3769 )
2024-06-19 15:43:21 +00:00
Dunqing
8ce794d740
fix(isolated-declarations): inferring an incorrect return type when there is an arrow function inside a function ( #3768 )
2024-06-19 15:43:15 +00:00
Dunqing
4134de8dcf
feat(isolated-declarations): add ts error code to the error message ( #3755 )
2024-06-19 14:33:29 +00:00
Dunqing
94202de250
feat(isolated-declarations): add export {} when needed ( #3754 )
...
https://github.com/microsoft/TypeScript/pull/58912
2024-06-19 14:33:27 +00:00
Dunqing
d29316a5ff
fix(isolated-declarations): transform incorrectly when there are multiple functions with the same name ( #3753 )
2024-06-19 14:33:25 +00:00
Dunqing
e95d8e3990
feat(isolated-declarations): shrink span for arrow function that needs an explicit return type ( #3752 )
...
Current `span` we can't be consistent with typescript.
We report the following
```ts
(a, b) =>
^^^^^^^^^
{ }
^
```
TypeScript reports the following
```ts
(a, b) =>
^^^^^^^^^
{}
```
The TypeScript only reports the first line, if we want it to be exactly the same we need to find the first newline position
2024-06-19 14:33:24 +00:00
Dunqing
bf1c250d56
fix(isolated-declarations): false positives for non-exported binding elements ( #3751 )
2024-06-19 14:06:08 +00:00
Dunqing
df9971da4c
feat(isolated-declarations): improve inferring the return type from function ( #3750 )
2024-06-19 14:06:05 +00:00
Dunqing
4aea2b158c
feat(isolated-declarations): improve inferring the type of accessor ( #3749 )
2024-06-19 14:06:02 +00:00
Dunqing
9ea30c41ff
feat(isolated-declarations): treat AssignmentPattern as optional ( #3748 )
2024-06-19 14:05:59 +00:00
Boshen
8c02c1dac3
chore(isolated-declarations): add snapshot testing ( #3756 )
2024-06-19 09:20:17 +00:00
github-actions[bot]
1b3cd6c24d
Release crates v0.15.0 ( #3743 )
...
## [0.15.0] - 2024-06-18
- 0537d29 cfg: [**BREAKING**] Move control flow to its own crate.
(#3728 ) (rzvxa)
- 5c38a0f codegen: [**BREAKING**] New code gen API (#3740 ) (Boshen)
- 4bce59d semantic/cfg: [**BREAKING**] Re-export `petgraph` as
`control_flow::graph`. (#3722 ) (rzvxa)
- 534242a codegen: [**BREAKING**] Remove
`CodegenOptions::enable_typescript` (#3674 ) (Boshen)
- 0578ece ast: [**BREAKING**] Remove
`ExportDefaultDeclarationKind::TSEnumDeclaration` (#3666 ) (Dunqing)
### Features
- 5a99d30 codegen: Improve codegen formatting (#3735 ) (Boshen)
- bf9b38a codegen: Improve codegen formatting (#3731 ) (Boshen)
- 4a004e2 codegen: Print TSImport remaining fields (#3695 ) (Dunqing)
- a56cb1b codegen: Print accessibility for MethodDefinition (#3690 )
(Dunqing)
- 38a75e5 coverage: Improve codegen (#3729 ) (Boshen)
- 750a534 coverage: Transformer idempotency test (#3691 ) (Boshen)
- ee627c3 isolated-declarations: Create unique name for `_default`
(#3730 ) (Dunqing)
- 81e9526 isolated-declarations: Inferring set accessor parameter type
from get accessor return type (#3725 ) (Dunqing)
- 77d5533 isolated-declarations: Report errors that are consistent with
typescript. (#3720 ) (Dunqing)
- 8f5655d linter: Add eslint/no-useless-constructor (#3594 ) (Don Isaac)
- 046ff3f linter/eslint: Add `no_unreachable` rule. (#3238 ) (rzvxa)
- 0b8098a napi: Isolated-declaration (#3718 ) (Boshen)
- 527bfc8 npm/oxc-transform: Setup npm/oxc-transform and publish
(Boshen)
- d65c652 parser: Display jsx mismatch error, e.g. `<Foo></Bar>` (#3696 )
(Boshen)
- 9c31ed9 semantic/cfg: Propagate unreachable edges through subgraphs.
(#3648 ) (rzvxa)
- d9c5b33 semantic/cfg: Add `Condition` instruction. (#3567 ) (Ali
Rezvani)
- f2dfd66 semantic/cfg: Add iteration instructions. (#3566 ) (rzvxa)
- 910193e transformer-dts: Report error for super class (#3711 )
(Dunqing)
- 413d7be transformer-dts: Transform enum support (#3710 ) (Dunqing)
- 35c382e transformer-dts: Remove type annotation from private field
(#3689 ) (Dunqing)
- 0e6d3ce transformer-dts: Report error for async function and generator
(#3688 ) (Dunqing)
- b22b59a transformer-dts: Transform namespace support (#3683 ) (Dunqing)
- 4f2db46 transformer-dts: `--isolatedDeclarations` dts transform
(#3664 ) (Dunqing)
### Bug Fixes
- 2158268 ast: Incorrect visit order in function (#3681 ) (Dunqing)
- da1e2d0 codegen: Improve typescript codegen (#3708 ) (Boshen)
- f1b793f isolated-declarations: Function overloads reaching unreachable
(#3739 ) (Dunqing)
- 0fbecdc isolated-declarations: Should be added to references, not
bindings (#3726 ) (Dunqing)
- 8f64d99 minifier: Respect `join_vars: false` option (#3724 )
(mysteryven)
- 70fc69b semantic: Add Eq to CtxFlags (#3651 ) (Yuji Sugiura)
- 7a58fec semantic/cfg: Issue in unlabeled `Ctx`s. (#3678 ) (rzvxa)
- abd6ac8 semantic/cfg: Discrete finalization path after `NewFunction`s.
(#3671 ) (rzvxa)
- e148a32 semantic/cfg: Correct unreachability propagation in
try-finally. (#3667 ) (Ali Rezvani)
- 59666e0 transformer: Do not rename accessible identifier references
(#3623 ) (Dunqing)
- 90743e2 traverse: Change visit order for `Function` (#3685 )
(overlookmotel)
### Performance
- 2717a1a semantic/cfg: Lower the visits in
`neighbors_filtered_by_edge_weight`. (#3676 ) (rzvxa)
### Refactor
- fa7a6ba codegen: Add `gen` method to ast nodes (#3687 ) (Boshen)
- 09b92b6 codegen: Move `gen_ts` into `gen` to make searching things
easier (#3680 ) (Boshen)
- 3c59735 isolated-declarations: Remove `TransformDtsCtx` (#3719 )
(Boshen)
- 815260e isolated-declarations: Decouple codegen (#3715 ) (Boshen)
- 7ec44f8 semantic: Rename `cfg` macro to `control_flow`. (#3742 )
(rzvxa)
- d8ad321 semantic: Make control flow generation optional. (#3737 )
(rzvxa)
- a94a72d semantic: Expose 1 checker function instead of 2 (#3694 )
(Boshen)
- bd8d115 semantic/cfg: Remove unused types. (#3677 ) (rzvxa)
- f702fb9 semantic/cfg: Cleanup control flow and it's builder. (#3650 )
(rzvxa)
- 4f16664 transformer_dts: Create a `Program` for codegen (#3679 )
(Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-19 01:15:55 +08:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt
2024-06-19 00:48:30 +08:00
Dunqing
f1b793fbba
fix(isolated-declarations): function overloads reaching unreachable ( #3739 )
2024-06-18 16:14:14 +00: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
Dunqing
ee627c355c
feat(isolated-declarations): create unique name for _default ( #3730 )
2024-06-18 03:40:45 +00:00
Dunqing
0fbecdcd81
fix(isolated-declarations): should be added to references, not bindings ( #3726 )
2024-06-17 16:47:02 +00:00