Boshen
879a271d47
fix(minifier): do not join require calls for cjs-module-lexer ( #4875 )
2024-08-13 12:21:37 +00:00
oxc-bot
977b74af2d
Release crates v0.24.2 ( #4841 )
...
## [0.24.2] - 2024-08-12
### Features
- 8e10e25 allocator: Introduce `Address` (#4810 ) (overlookmotel)
### Bug Fixes
- 62f759c transformer/typescript: Generated assignment for constructor
arguments with access modifiers should be injected to the top of the
constructor (#4808 ) (Dunqing)
### Performance
- 504ac0b minifier: `InjectGlobalVariables` only add to
`replaced_dot_defines` once for each (#4803 ) (overlookmotel)
- 35f2742 minifier: Avoid repeated `Atom` creation in
`InjectGlobalVariables` (#4802 ) (overlookmotel)
### Documentation
- 8827659 ast: More doc comments for JSX nodes (#4830 ) (DonIsaac)
- 559baa5 parser: Clean up doc regarding performance; remove conformance
(Boshen)
### Refactor
- 0ea697b ast, ast_codegen: `CloneIn` implementations now initialize
semantic related cells with `Default` value. (#4819 ) (rzvxa)
- ecfa124 ast_codegen: Add line break to generated code (#4829 )
(overlookmotel)
- 096ac7b linter: Clean up jsx-a11y/anchor-is-valid (#4831 ) (DonIsaac)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-12 16:02:07 +08:00
Boshen
fae8a62a62
fix(minifier): temporarily bail constant folding for tagged template ( #4842 )
...
closes #4341
2024-08-12 07:38:25 +00:00
overlookmotel
504ac0b178
perf(minifier): InjectGlobalVariables only add to replaced_dot_defines once for each ( #4803 )
...
`InjectGlobalVariables` minifier plugin was previously adding an entry to `replaced_dot_defines` each time it made a replacement, resulting in many duplicate entries if a single dot define gets replaced multiple times. Only add once for each dot define.
2024-08-10 13:46:15 +00:00
overlookmotel
35f27420b9
perf(minifier): avoid repeated Atom creation in InjectGlobalVariables ( #4802 )
...
Re-use `Atom`s in `InjectGlobalVariables` minifier plugin.
Instead of allocating a new `Atom` on every replacement, create `Atom` lazily when making first replacement, and cache it.
As discussed in: https://github.com/oxc-project/oxc/pull/4759#discussion_r1711669464
2024-08-10 13:46:14 +00:00
oxc-bot
857bc73302
Release crates v0.24.1 ( #4798 )
...
## [0.24.1] - 2024-08-10
### Features
- b3c3125 linter: Overhaul unicorn/no-useless-spread (#4791 ) (DonIsaac)
- c519295 minifier: Add `InjectGlobalVariables` plugin
(`@rollup/plugin-inject`) (#4759 ) (Boshen)
### Bug Fixes
- fff9da3 ast, ast_codegen: Use `generate_derive` instead of visitable
for generating span derives. (#4747 ) (rzvxa)
- f5eeebd ast_macros: Raise compile error on invalid `generate_derive`
input. (#4766 ) (rzvxa)
- 4d0b40a napi/transform: Fix wrong isolated declarations emit (Boshen)
### Refactor
- daa0b2e ast: `oxc_ast` crate re-export AST types from other crates
(#4773 ) (overlookmotel)
- d4a3be8 ast_codegen: Line breaks between types in layout assertions
(#4781 ) (overlookmotel)
- dbb5f4c ast_codegen: Remove unnecessary imports from generated files
(#4774 ) (overlookmotel)
- 7ea058d ast_codegen: Replace Windows-style line breaks with Unix-style
(#4769 ) (overlookmotel)
- 2dea0ca ast_codegen: Consistent import order (#4761 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-10 15:26:40 +08:00
Boshen
c51929558d
feat(minifier): add InjectGlobalVariables plugin (@rollup/plugin-inject) ( #4759 )
2024-08-10 01:12:31 +00:00
oxc-bot
69dc6c9cb1
Release crates v0.24.0 ( #4749 )
...
## [0.24.0] - 2024-08-08
- 75f2207 traverse: [**BREAKING**] Replace `find_scope` with
`ancestor_scopes` returning iterator (#4693 ) (overlookmotel)
- 506709f traverse: [**BREAKING**] Replace `find_ancestor` with
`ancestors` returning iterator (#4692 ) (overlookmotel)
### Features
- 23b0040 allocator: Introduce `CloneIn` trait. (#4726 ) (rzvxa)
- 51c1ca0 ast: Derive `CloneIn` for AST types, using `generate_derive`.
(#4732 ) (rzvxa)
- e12bd1e ast: Allow conversion from TSAccessibility into &'static str
(#4711 ) (DonIsaac)
- fd2d9da ast: Improve `AstKind::debug_name` (#4553 ) (DonIsaac)
- b3b7028 ast: Implement missing Clone, Hash, and Display traits for
literals (#4552 ) (DonIsaac)
- 54047e0 ast: `GetSpanMut` trait (#4609 ) (overlookmotel)
- eae401c ast, ast_macros: Apply stable repr to all `#[ast]` enums
(#4373 ) (rzvxa)
- ec0b4cb ast_codegen: Add `derive_clone_in` generator. (#4731 ) (rzvxa)
- 2e91ad6 ast_codegen: Support for `generate_derive` marker. (#4728 )
(rzvxa)
- 82e2f6b ast_codegen: Process AST-related `syntax` types. (#4694 )
(rzvxa)
- 0c52c0d ast_codegen: Add alignment and size data to the schema.
(#4615 ) (rzvxa)
- 07607d3 ast_codegen, span: Process `Span` through ast_codegen (#4703 )
(overlookmotel)
- 125c5fd ast_codegen, span: Process `SourceType` through ast_codegen.
(#4696 ) (rzvxa)
- eaddc8f linter: Add fixer for eslint/func_names (#4714 ) (DonIsaac)
- 229a0e9 minifier: Implement dot define for member expressions (#3959 )
(camc314)
- 33f1312 semantic: Impl GetSpan for AstNode (#4717 ) (DonIsaac)
- e42ac3a sourcemap: Add `ConcatSourceMapBuilder::from_sourcemaps`
(#4639 ) (overlookmotel)
- 2e63618 span: Implement `CloneIn` for the AST-related items. (#4729 )
(rzvxa)
- 6a36616 syntax: Derive `CloneIn` for the AST-related items. (#4730 )
(rzvxa)
### Bug Fixes
- 4a56954 codegen: Print raw if value is number is Infinity (#4676 )
(Boshen)
- 94d3c31 minifier: Avoid removing function declaration from `KeepVar`
(#4722 ) (Boshen)
- bf43148 minifier: Do not `remove_syntax` in dead_code_elimination
(Boshen)
- bf48c7f minifier: Fix `keep_var` keeping vars from arrow functions
(#4680 ) (Boshen)
- 9be29af minifier: Temporarily fix shadowed `undefined` variable
(#4678 ) (Boshen)
- e8b662a minifier: Various fixes to pass minifier conformance (#4667 )
(Boshen)
- 01d85de napi/transform: Update napi files (Boshen)
- f290191 oxc_ast_macros: Fix `syn` lacking features to build (Boshen)
- a40a217 parser: Parse `assert` keyword in `TSImportAttributes` (#4610 )
(Boshen)
- 03c643a semantic: Incorrect `scope_id` for catch parameter symbols
(#4659 ) (Dunqing)
- 6c612d1 semantic/jsdoc: Handle whitespace absence (#4642 ) (leaysgur)
- 0d2c41a semantic/jsdoc: Panic on parsing `type_name_comment`. (#4632 )
(rzvxa)
- 9f8f299 syntax: Prevent creating invalid u32 IDs (#4675 )
(overlookmotel)
- 4797eaa transformer: Strip TS statements from for in/of statement
bodies (#4686 ) (overlookmotel)
- 5327acd transformer/react: The `require` IdentifierReference does not
have a `reference_id` (#4658 ) (Dunqing)
- 3987665 transformer/typescript: Incorrect enum-related
`symbol_id`/`reference_id` (#4660 ) (Dunqing)
- 4efd54b transformer/typescript: Incorrect `SymbolFlags` for jsx
imports (#4549 ) (Dunqing)
### Performance
- 8dd76e4 codegen: Reduce size of `LineOffsetTable` (#4643 )
(overlookmotel)
- b8e6753 codegen: `u32` indexes in `LineOffsetTable` for source maps
(#4641 ) (overlookmotel)
- 6ff200d linter: Change react rules and utils to use `Cow` and
`CompactStr` instead of `String` (#4603 ) (DonIsaac)
- 0f5e982 minifier: Only visit arrow expression after dropping
`console.log` (#4677 ) (Boshen)
- ff43dff sourcemap: Speed up VLQ encoding (#4633 ) (overlookmotel)
- a330773 sourcemap: Reduce string copying in `ConcatSourceMapBuilder`
(#4638 ) (overlookmotel)
- 372316b sourcemap: `ConcatSourceMapBuilder` extend `source_contents`
in separate loop (#4634 ) (overlookmotel)
- c7f1d48 sourcemap: Keep local copy of previous token in VLQ encode
(#4596 ) (overlookmotel)
- 590d795 sourcemap: Shorten main loop encoding VLQ (#4586 )
(overlookmotel)
### Documentation
- c69ada4 ast: Improve AST node documentation (#4051 ) (Rintaro Itokawa)
### Refactor
- 579b797 ast: Use type identifier instead of `CloneIn::Cloned` GAT.
(#4738 ) (rzvxa)
- 475266d ast: Use correct lifetimes for name-related methods (#4712 )
(DonIsaac)
- 83b6ca9 ast: Add explicit enum discriminants. (#4689 ) (rzvxa)
- ba70001 ast: Put `assert_layouts.rs` behind `debug_assertions` (#4621 )
(rzvxa)
- 3f53b6f ast: Make AST structs `repr(C)`. (#4614 ) (rzvxa)
- 452e0ee ast: Remove defunct `visit_as` + `visit_args` attrs from
`#[ast]` macro (#4599 ) (overlookmotel)
- 2218340 ast, ast_codegen: Use `generate_derive` for implementing
`GetSpan` and `GetSpanMut` traits. (#4735 ) (rzvxa)
- fbfd852 minifier: Add `NodeUtil` trait for accessing symbols on ast
nodes (#4734 ) (Boshen)
- e0832f8 minifier: Use `oxc_traverse` for AST passes (#4725 ) (Boshen)
- 17602db minifier: Move tests and files around (Boshen)
- 3289477 minifier: Clean up tests (#4724 ) (Boshen)
- e78cba6 minifier: Ast passes infrastructure (#4625 ) (Boshen)
- d25dea7 parser: Use `ast_builder` in more places. (#4612 ) (rzvxa)
- 09d9822 semantic: Simplify setting scope flags (#4674 ) (overlookmotel)
- 6e453db semantic: Simplify inherit scope flags from parent scope
(#4664 ) (Dunqing)
- e1429e5 span: Reduce #[cfg_attr] boilerplate in type defs (#4702 )
(overlookmotel)
- e24fb5b syntax: Add explicit enum discriminants to AST related types.
(#4691 ) (rzvxa)
- 3f3cb62 syntax, span: Reduce #[cfg_attr] boilerplate in type defs
(#4698 ) (overlookmotel)
- 54f9897 traverse: Simpler code for entering/exiting unconditional
scopes (#4685 ) (overlookmotel)
- 83546d3 traverse: Enter node before entering scope (#4684 )
(overlookmotel)- 9b51e04 Overhaul napi transformer package (#4592 )
(DonIsaac)
### Testing
- 49d5196 ast: Fix `assert_layouts.rs` offset tests on 32bit platforms.
(#4620 ) (rzvxa)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-08 14:00:57 +08:00
Boshen
fbfd852cf8
refactor(minifier): add NodeUtil trait for accessing symbols on ast nodes ( #4734 )
2024-08-08 02:48:25 +00:00
Boshen
e0832f8e18
refactor(minifier): use oxc_traverse for AST passes ( #4725 )
2024-08-07 13:26:29 +00:00
Boshen
17602db6de
refactor(minifier): move tests and files around
2024-08-07 20:01:55 +08:00
Boshen
3289477197
refactor(minifier): clean up tests ( #4724 )
2024-08-07 06:29:41 +00:00
Boshen
94d3c31933
fix(minifier): avoid removing function declaration from KeepVar ( #4722 )
2024-08-07 05:09:32 +00:00
oxc-bot
61337613da
Release crates v0.23.1 ( #4681 )
...
## [0.23.1] - 2024-08-06
### Features
- fd2d9da ast: Improve `AstKind::debug_name` (#4553 ) (DonIsaac)
- b3b7028 ast: Implement missing Clone, Hash, and Display traits for
literals (#4552 ) (DonIsaac)
- 54047e0 ast: `GetSpanMut` trait (#4609 ) (overlookmotel)
- eae401c ast, ast_macros: Apply stable repr to all `#[ast]` enums
(#4373 ) (rzvxa)
- 0c52c0d ast_codegen: Add alignment and size data to the schema.
(#4615 ) (rzvxa)
- 229a0e9 minifier: Implement dot define for member expressions (#3959 )
(camc314)
- e42ac3a sourcemap: Add `ConcatSourceMapBuilder::from_sourcemaps`
(#4639 ) (overlookmotel)
### Bug Fixes
- 4a56954 codegen: Print raw if value is number is Infinity (#4676 )
(Boshen)
- bf48c7f minifier: Fix `keep_var` keeping vars from arrow functions
(#4680 ) (Boshen)
- 9be29af minifier: Temporarily fix shadowed `undefined` variable
(#4678 ) (Boshen)
- e8b662a minifier: Various fixes to pass minifier conformance (#4667 )
(Boshen)
- a40a217 parser: Parse `assert` keyword in `TSImportAttributes` (#4610 )
(Boshen)
- 03c643a semantic: Incorrect `scope_id` for catch parameter symbols
(#4659 ) (Dunqing)
- 6c612d1 semantic/jsdoc: Handle whitespace absence (#4642 ) (leaysgur)
- 0d2c41a semantic/jsdoc: Panic on parsing `type_name_comment`. (#4632 )
(rzvxa)
- 9f8f299 syntax: Prevent creating invalid u32 IDs (#4675 )
(overlookmotel)
- 5327acd transformer/react: The `require` IdentifierReference does not
have a `reference_id` (#4658 ) (Dunqing)
- 3987665 transformer/typescript: Incorrect enum-related
`symbol_id`/`reference_id` (#4660 ) (Dunqing)
- 4efd54b transformer/typescript: Incorrect `SymbolFlags` for jsx
imports (#4549 ) (Dunqing)
### Performance
- 8dd76e4 codegen: Reduce size of `LineOffsetTable` (#4643 )
(overlookmotel)
- b8e6753 codegen: `u32` indexes in `LineOffsetTable` for source maps
(#4641 ) (overlookmotel)
- 6ff200d linter: Change react rules and utils to use `Cow` and
`CompactStr` instead of `String` (#4603 ) (DonIsaac)
- 0f5e982 minifier: Only visit arrow expression after dropping
`console.log` (#4677 ) (Boshen)
- ff43dff sourcemap: Speed up VLQ encoding (#4633 ) (overlookmotel)
- a330773 sourcemap: Reduce string copying in `ConcatSourceMapBuilder`
(#4638 ) (overlookmotel)
- 372316b sourcemap: `ConcatSourceMapBuilder` extend `source_contents`
in separate loop (#4634 ) (overlookmotel)
- c7f1d48 sourcemap: Keep local copy of previous token in VLQ encode
(#4596 ) (overlookmotel)
- 590d795 sourcemap: Shorten main loop encoding VLQ (#4586 )
(overlookmotel)
### Documentation
- c69ada4 ast: Improve AST node documentation (#4051 ) (Rintaro Itokawa)
### Refactor
- ba70001 ast: Put `assert_layouts.rs` behind `debug_assertions` (#4621 )
(rzvxa)
- 3f53b6f ast: Make AST structs `repr(C)`. (#4614 ) (rzvxa)
- 452e0ee ast: Remove defunct `visit_as` + `visit_args` attrs from
`#[ast]` macro (#4599 ) (overlookmotel)
- e78cba6 minifier: Ast passes infrastructure (#4625 ) (Boshen)
- d25dea7 parser: Use `ast_builder` in more places. (#4612 ) (rzvxa)
- 09d9822 semantic: Simplify setting scope flags (#4674 ) (overlookmotel)
- 6e453db semantic: Simplify inherit scope flags from parent scope
(#4664 ) (Dunqing)- 9b51e04 Overhaul napi transformer package (#4592 )
(DonIsaac)
### Testing
- 49d5196 ast: Fix `assert_layouts.rs` offset tests on 32bit platforms.
(#4620 ) (rzvxa)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-06 16:37:29 +08:00
Boshen
bf43148f1e
fix(minifier): do not remove_syntax in dead_code_elimination
2024-08-06 16:34:04 +08:00
Boshen
bf48c7f02a
fix(minifier): fix keep_var keeping vars from arrow functions ( #4680 )
2024-08-06 07:04:25 +00:00
Boshen
451ac4d0e3
chore: s/elimintation/elimination/
2024-08-06 14:18:44 +08:00
Boshen
9be29af9d4
fix(minifier): temporarily fix shadowed undefined variable ( #4678 )
2024-08-06 04:58:39 +00:00
Boshen
0f5e982d19
perf(minifier): only visit arrow expression after dropping console.log ( #4677 )
2024-08-06 04:20:41 +00:00
Boshen
e8b662a314
fix(minifier): various fixes to pass minifier conformance ( #4667 )
2024-08-05 16:31:19 +00:00
camc314
229a0e9c45
feat(minifier): implement dot define for member expressions ( #3959 )
...
adds the ability to transform
`process.env.NODE_ENV`
into
`"development"`
when that config is passed in
2024-08-05 12:04:13 +00:00
Boshen
e78cba6464
refactor(minifier): ast passes infrastructure ( #4625 )
...
After studying google closure compiler, I'm leaning towards a multi-ast-pass infrastructure for the minifier.
This is one of the few places where we are going to trade maintainability over performance, given the goal of the minifier is compression size not performance.
All of the terminologies and separation of concerns are aligned with google closure compiler.
Infrastructure of `terser` and `esbuild` are not suitable for us to study nor pursuit. Their code are so tightly coupled - I failed to comprehend any of them every time I try to walk through a piece of optmization. Google closure compiler despite being written in Java, it's actually the most readable minifier out there.
To improve performance between ast passes, I envision a change detection system over a portion of the code.
The benchmark will demonstrate the performance regression of running 5 ast passes instead of 2.
To complete this PR, I need to figure out "fix-point" and order of these ast passes.
2024-08-04 11:58:39 +00:00
oxc-bot
e02bac357a
Release crates v0.23.0 ( #4595 )
...
## [0.23.0] - 2024-08-01
- 27fd062 sourcemap: [**BREAKING**] Avoid passing `Result`s (#4541 )
(overlookmotel)
### Features
- a558492 codegen: Implement `BinaryExpressionVisitor` (#4548 ) (Boshen)
- 7446e98 codegen: Align more esbuild implementations (#4510 ) (Boshen)
- 35654e6 codegen: Align operator precedence with esbuild (#4509 )
(Boshen)
- b952942 linter: Add eslint/no-unused-vars (⭐ attempt 3.2) (#4445 )
(DonIsaac)
- 85e8418 linter: Add react/jsx-curly-brace-presence (#3949 ) (Don Isaac)
- cf1854b semantic: Remove `ReferenceFlags::Value` from non-type-only
exports that referenced type binding (#4511 ) (Dunqing)
### Bug Fixes
- b58ed80 codegen: Enable more test cases (#4585 ) (Boshen)
- 6a94e3f codegen: Fixes for esbuild test cases (#4503 ) (Boshen)
- d5c4b19 parser: Fix enum member parsing (#4543 ) (DonIsaac)
### Performance
- 4c6d19d allocator: Use capacity hint (#4584 ) (Luca Bruno)
- 7585e16 linter: Remove allocations for string comparisons (#4570 )
(DonIsaac)
- 55a8763 parser: Faster decoding unicode escapes in identifiers (#4579 )
(overlookmotel)
- ae1d38f parser: Fast path for ASCII when checking char after numeric
literal (#4577 ) (overlookmotel)
- 56ae615 parser: Make not at EOF the hot path in `Source` methods
(#4576 ) (overlookmotel)
- 25679e6 parser: Optimize `Lexer::hex_digit` (#4572 ) (overlookmotel)
- bb33bcc parser: Speed up lexing non-decimal numbers (#4571 )
(overlookmotel)
- ab8509e parser: Use `-` not `saturating_sub` (#4561 ) (overlookmotel)
- c9c38a1 parser: Support peeking over bytes (#4304 ) (lucab)
- 0870ee1 parser: Get and check lookahead token (#4534 ) (lucab)
- d00014e sourcemap: Elide bounds checks in VLQ encoding (#4583 )
(overlookmotel)
- 1fd9dd0 sourcemap: Use simd to escape JSON string (#4487 )
(Brooooooklyn)
### Documentation
- 0914e47 ast: Add doc comments to literal nodes (#4551 ) (DonIsaac)
- c6a11be ast: Auto-generate doc comments for AstBuilder methods (#4471 )
(DonIsaac)
### Refactor
- e68ed62 parser: Convert lexer byte handler for `|` to a single match
(#4575 ) (overlookmotel)
- bba824b parser: Convert `Lexer::read_minus` to a single match (#4574 )
(overlookmotel)
- ef5418a parser: Convert `Lexer::read_left_angle` to a single match
(#4573 ) (overlookmotel)
- 9e5be78 parser: Add `Lexer::consume_2_chars` (#4569 ) (overlookmotel)
- 649913e parser: Extract `u8` not `&u8` when iterating over bytes
(#4568 ) (overlookmotel)
- 59f00c0 parser: Rename function (#4566 ) (overlookmotel)
- 8e3e910 parser: Rename vars (#4565 ) (overlookmotel)
- 0c0601f parser: Rename function (#4564 ) (overlookmotel)
- 0acc4a7 parser: Fetch 2 bytes in `?` byte handler (#4563 )
(overlookmotel)
- 565eccf parser: Shorten lexer code (#4562 ) (overlookmotel)
- 148bdb5 parser: Adjust function inlining (#4530 ) (overlookmotel)
- 16c7b98 semantic: Move CatchClause scope binding logic to
visit_block_statement (#4505 ) (Dunqing)
- d6974d4 semantic: `AstNodeParentIter` fetch nodes lazily (#4533 )
(overlookmotel)
- d914b14 semantic: Reusing the same reference (#4529 ) (Dunqing)
- 7b5e1f5 semantic: Use `is_empty()` instead of `len() == 0` (#4532 )
(overlookmotel)
- 9db4259 semantic: Inline trivial methods (#4531 ) (overlookmotel)
- 7c42ffc sourcemap: Align Base64 chars lookup table to cache line
(#4535 ) (overlookmotel)
- 96602bf transformer/typescript: Determine whether to remove
`ExportSpeicifer` by `ReferenceFlags` (#4513 ) (Dunqing)
- e6a8af6 traverse: Speed up tests (#4538 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-01 16:55:41 +08:00
Boshen
a558492bf9
feat(codegen): implement BinaryExpressionVisitor ( #4548 )
...
part of https://github.com/oxc-project/backlog/issues/58
`monitor-oxc` run: https://github.com/oxc-project/monitor-oxc/actions/runs/10179047831
binary expression stack length tally using `counts` in top 100 npm packages from monitor-oxc:
```
29772 counts
( 1) 17652 (59.3%, 59.3%): 0
( 2) 5772 (19.4%, 78.7%): 1
( 3) 3204 (10.8%, 89.4%): 2
( 4) 1276 ( 4.3%, 93.7%): 3
( 5) 616 ( 2.1%, 95.8%): 4
( 6) 308 ( 1.0%, 96.8%): 5
( 7) 202 ( 0.7%, 97.5%): 6
( 8) 168 ( 0.6%, 98.1%): 7
( 9) 114 ( 0.4%, 98.5%): 9
( 10) 90 ( 0.3%, 98.8%): 8
( 11) 84 ( 0.3%, 99.0%): 13
( 12) 58 ( 0.2%, 99.2%): 10
( 13) 48 ( 0.2%, 99.4%): 12
( 14) 32 ( 0.1%, 99.5%): 11
( 15) 20 ( 0.1%, 99.6%): 134
( 16) 16 ( 0.1%, 99.6%): 18
( 17) 16 ( 0.1%, 99.7%): 20
( 18) 12 ( 0.0%, 99.7%): 19
( 19) 12 ( 0.0%, 99.8%): 35
( 20) 12 ( 0.0%, 99.8%): 51
( 21) 10 ( 0.0%, 99.8%): 15
( 22) 6 ( 0.0%, 99.9%): 17
( 23) 6 ( 0.0%, 99.9%): 21
( 24) 6 ( 0.0%, 99.9%): 45
( 25) 4 ( 0.0%, 99.9%): 14
( 26) 4 ( 0.0%, 99.9%): 26
( 27) 4 ( 0.0%, 99.9%): 53
( 28) 2 ( 0.0%, 99.9%): 172
( 29) 2 ( 0.0%, 99.9%): 214
( 30) 2 ( 0.0%,100.0%): 22
( 31) 2 ( 0.0%,100.0%): 27
( 32) 2 ( 0.0%,100.0%): 28
( 33) 2 ( 0.0%,100.0%): 29
( 34) 2 ( 0.0%,100.0%): 31
( 35) 2 ( 0.0%,100.0%): 36
( 36) 2 ( 0.0%,100.0%): 46
( 37) 2 ( 0.0%,100.0%): 55
```
2024-07-31 12:44:19 +00:00
Boshen
6a94e3f573
fix(codegen): fixes for esbuild test cases ( #4503 )
2024-07-28 08:57:15 +00:00
oxc-bot
80118cbf3b
Release crates v0.22.1 ( #4508 )
...
## [0.22.1] - 2024-07-27
### Features
- 2477330 ast: Add `AstKind::TSExportAssignment` (#4501 ) (Dunqing)
- aaee07e ast: Add `AstKind::AssignmentTargetPattern`,
`AstKind::ArrayAssignmentTarget` and `AstKind::ObjectAssignmentTarget`
(#4456 ) (Dunqing)
- fd363d1 ast: Add AstKind::get_container_scope_id (#4450 ) (DonIsaac)
- e2735ca span: Add `contains_inclusive` method (#4491 ) (DonIsaac)
### Bug Fixes
- 368112c ast: Remove `#[visit(ignore)]` from
`ExportDefaultDeclarationKind`'s `TSInterfaceDeclaration` (#4497 )
(Dunqing)
- 36bb680 semantic: `TSExportAssignment` cannot reference type binding
(#4502 ) (Dunqing)
- cb2fa49 semantic: `typeof` operator cannot reference type-only import
(#4500 ) (Dunqing)
- ef0e953 semantic: Generic passed to typeof not counted as a reference
(#4499 ) (Dunqing)
- 40cafb8 semantic: Params in `export default (function() {})` flagged
as `SymbolFlags::Export` (#4480 ) (Dunqing)
- 2e01a45 semantic: Non-exported namespace member symbols flagged as
exported (#4493 ) (Don Isaac)
- e4ca06a semantic: Incorrect symbol’s scope_id after var hoisting
(#4458 ) (Dunqing)
- 77bd5f1 semantic: Use correct span for namespace symbols (#4448 ) (Don
Isaac)
- 5db7bed sourcemap: Fix pre-calculation of required segments for
building JSON (#4490 ) (overlookmotel)
- 1667491 syntax: Correct `is_reserved_keyword_or_global_object`'s
incorrect function calling. (#4484 ) (Ethan Goh)
- 82ba2a0 syntax: Fix unsound use of `NonZeroU32` (#4466 )
(overlookmotel)
- c04b9aa transformer: Add to `SymbolTable::declarations` for all
symbols (#4460 ) (overlookmotel)
- ecdee88 transformer/typescript: Incorrect eliminate exports when the
referenced symbol is both value and type (#4507 ) (Dunqing)
### Performance
- 963a2d1 mangler: Reduce unnecessary allocation (#4498 ) (Dunqing)
- 868fc87 parser: Optimize conditional advance on ASCII values (#4298 )
(lucab)
- 24beaeb semantic: Give `AstNodeId` a niche (#4469 ) (overlookmotel)
- 348c1ad semantic: Remove `span` field from `Reference` (#4464 )
(overlookmotel)
- 6a9f4db semantic: Reduce storage size for symbol redeclarations
(#4463 ) (overlookmotel)
- 705e19f sourcemap: Reduce memory copies encoding JSON (#4489 )
(overlookmotel)
- 4d10c6c sourcemap: Pre allocate String buf while encoding (#4476 )
(Brooooooklyn)
### Documentation
- f5f0ba8 ast: Add doc comments to more AST nodes (#4413 ) (Don Isaac)
- 871b3d6 semantic: Add doc comments for SymbolTester and SemanticTester
(#4433 ) (DonIsaac)
### Refactor
- 9c5d2f9 ast/builder: Use `Box::new_in` over `.into_in` (#4428 )
(overlookmotel)
- ccb1835 semantic: Methods take `Span` as param, not `&Span` (#4470 )
(overlookmotel)
- f17254a semantic: Populate `declarations` field in
`SymbolTable::create_symbol` (#4461 ) (overlookmotel)
- a49f491 semantic: Re-order `SymbolTable` fields (#4459 )
(overlookmotel)
- 7cd53f3 semantic: Var hoisting (#4379 ) (Dunqing)
- 4f5a7cb semantic: Mark SemanticTester and SymbolTester as must_use
(#4430 ) (DonIsaac)
- c958a55 sourcemap: `push_list` method for building JSON (#4486 )
(overlookmotel)
- c99b3eb syntax: Give `ScopeId` a niche (#4468 ) (overlookmotel)
- 96fc94f syntax: Use `NonMaxU32` for IDs (#4467 ) (overlookmotel)
### Testing
- 4b274a8 semantic: Add more test cases for symbol references (#4429 )
(DonIsaac)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-07-28 09:58:29 +08:00
Boshen
e1ca4122d8
chore(codegen): port over esbuild codegen tests (all ignored right now) ( #4457 )
2024-07-25 10:00:34 +00:00
oxc-bot
aa56eb4d1d
Release crates v0.22.0 ( #4434 )
...
## [0.22.0] - 2024-07-23
- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329 )
(Dunqing)
- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364 ) (Dunqing)
### Features
- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309 )
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357 )
(Jaden Rodriguez)
- 68efcd4 linter/react-perf: Handle new objects and arrays in prop
assignment patterns (#4396 ) (DonIsaac)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407 )
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412 ) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334 ) (DonIsaac)
### Bug Fixes
- aece1df ast: Visit `Program`s `hashbang` field first (#4368 )
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391 ) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374 )
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350 ) (Boshen)
- ac08de8 linter/react_perf: Allow new objects, array, fns, etc in top
scope (#4395 ) (DonIsaac)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409 ) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410 ) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366 ) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348 ) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351 ) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352 ) (DonIsaac)
### Performance
- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401 ) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367 ) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390 ) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384 )
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383 ) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361 )
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356 )
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377 ) (DonIsaac)
### Refactor
- 504daed allocator: Rename fn params for `Box::new_in` (#4431 )
(overlookmotel)
- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376 )
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375 )
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289 )
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347 ) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346 )
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371 ) (rzvxa)
- 0e1ea90 isolated-declarations: Remove useless code from scope (#4420 )
(Dunqing)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349 ) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335 ) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370 )
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369 )
(overlookmotel)
- 729b288 semantic: Shorten code (#4358 ) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336 )
(DonIsaac)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-07-24 08:23:27 +08:00
Boshen
fb15a19040
chore: fix cyclic dependencies by moving mangler tests to oxc_minifier
2024-07-23 22:13:13 +08:00
Dunqing
426016d1d6
Revert "Release crates v0.22.0" ( #4418 )
...
Still release failed. Reverts oxc-project/oxc#4417
2024-07-23 15:51:01 +08:00
github-actions[bot]
f76113cd8f
Release crates v0.22.0 ( #4417 )
...
## [0.22.0] - 2024-07-23
- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329 )
(Dunqing)
- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364 ) (Dunqing)
### Features
- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309 )
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357 )
(Jaden Rodriguez)
- 68efcd4 linter/react-perf: Handle new objects and arrays in prop
assignment patterns (#4396 ) (DonIsaac)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407 )
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412 ) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334 ) (DonIsaac)
### Bug Fixes
- aece1df ast: Visit `Program`s `hashbang` field first (#4368 )
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391 ) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374 )
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350 ) (Boshen)
- ac08de8 linter/react_perf: Allow new objects, array, fns, etc in top
scope (#4395 ) (DonIsaac)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409 ) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410 ) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366 ) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348 ) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351 ) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352 ) (DonIsaac)
### Performance
- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401 ) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367 ) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390 ) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384 )
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383 ) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361 )
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356 )
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377 ) (DonIsaac)
### Refactor
- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376 )
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375 )
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289 )
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347 ) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346 )
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371 ) (rzvxa)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349 ) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335 ) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370 )
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369 )
(overlookmotel)
- 729b288 semantic: Shorten code (#4358 ) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336 )
(DonIsaac)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-23 13:24:08 +08:00
Dunqing
c1cf0e6dd9
Revert "Release crates v0.22.0" ( #4415 )
...
Reverts oxc-project/oxc#4414
2024-07-23 09:59:38 +08:00
github-actions[bot]
00c7b7dad4
Release crates v0.22.0 ( #4414 )
...
## [0.22.0] - 2024-07-22
- 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329 )
(Dunqing)
- f68b659 ast: [**BREAKING**] Reorder fields of
`ArrowFunctionExpression` (#4364 ) (Dunqing)
### Features
- d345b84 ast: Add `#[ast]` attribute to non-visited AST types. (#4309 )
(rzvxa)
- 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357 )
(Jaden Rodriguez)
- 0deb027 minfier: Dce `if (xxx) else if (false) { REMOVE }` (#4407 )
(Boshen)
- e33ec18 minifier: Compress `typeof foo == "undefined"` into `typeof
foo > "u"` (#4412 ) (Boshen)- 6068e6b Add error codes to OxcDiagnostic
(#4334 ) (DonIsaac)
### Bug Fixes
- aece1df ast: Visit `Program`s `hashbang` field first (#4368 )
(overlookmotel)
- 44a10c4 codegen: Object shorthand with parens `({x: (x)})` -> `({ x
})` (#4391 ) (Boshen)
- 3d88f20 codegen: Print shorthand for all `{ x }` variants (#4374 )
(Boshen)
- e624dff codegen,mangler: Do not print shorthand for `ObjectProperty`
(#4350 ) (Boshen)
- 267f7c4 minifier: Skip `Object.defineProperty(exports, ...)` for
`cjs-module-lexer` (#4409 ) (Boshen)
- bc8d4e5 semantic: Correct comment (#4410 ) (overlookmotel)
- 6ffce86 semantic: Align `visit_arrow_function_expression` field visit
order with ast (#4366 ) (Dunqing)
- 4cd5df0 sourcemap: Avoid negative line if token_chunks has same
prev_dst_line (#4348 ) (underfin)
- f8565ae transformer/typescript: Unexpectedly removed class binding
from ExportNamedDeclaration (#4351 ) (Dunqing)- ea33f94 Impl
PartialEq<str> for CompactStr (#4352 ) (DonIsaac)
### Performance
- 1b51511 semantic: Use `Atom` instead of `CompactStr` for
`UnresolvedReferencesStack` (#4401 ) (Dunqing)
- 40f9356 semantic: Calculate number of nodes, scopes, symbols,
references before visiting AST (#4367 ) (Dunqing)
- da13d93 semantic: Remove bounds checks on unresolved references stack
(#4390 ) (overlookmotel)
- e70c67b semantic: Remove a branch from `add_scope` (#4384 )
(overlookmotel)
- 402006f semantic: Simplify logic in `enter_scope` + `leave_scope`
(#4383 ) (overlookmotel)
- 7469e01 semantic: Remove branch from `Nodes::add_node` (#4361 )
(overlookmotel)
- 7eb2864 traverse: Speed up finding UID binding name (#4356 )
(overlookmotel)- a207923 Replace some CompactStr usages with Cows
(#4377 ) (DonIsaac)
### Refactor
- d213773 ast: Replace serde rename "lowercase" with "camelCase" (#4376 )
(overlookmotel)
- abfccbd ast: Reduce `#[cfg_attr]` boilerplate in AST type defs (#4375 )
(overlookmotel)
- 5f1c7ec ast: Rename the `visited_node` marker to `ast`. (#4289 )
(rzvxa)
- 58f6ec2 ast: Enter node before scope (#4347 ) (Dunqing)
- 59aea73 ast: Scope is created only if CatchClause has param (#4346 )
(Dunqing)
- 7a3e925 ast_codegen: Better visit marker parsing. (#4371 ) (rzvxa)
- 7a75e0f linter: Use diagnostic codes in lint rules (#4349 ) (DonIsaac)
- a2eabe1 parser: Use error codes for ts diagnostics (#4335 ) (DonIsaac)
- 5d77b36 semantic: `visit_program` visit `hashbang` field (#4370 )
(overlookmotel)
- f7b9ada semantic: `Program` visitor leave scope before node (#4369 )
(overlookmotel)
- 729b288 semantic: Shorten code (#4358 ) (overlookmotel)
- 21d0eee semantic: Use error codes for ts diagnostics (#4336 )
(DonIsaac)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-23 09:38:03 +08:00
Boshen
e33ec18d78
feat(minifier): compress typeof foo == "undefined" into typeof foo > "u" ( #4412 )
...
```
> monitor-oxc@ test /home/runner/work/monitor-oxc/monitor-oxc
> node src/main.test.mjs
/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.development.js:2375
if (void 0 === __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1 ;
^
ReferenceError: __REACT_DEVTOOLS_GLOBAL_HOOK__ is not defined
at injectInternals (/home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.development.js:2375:3)
```
2024-07-22 12:44:33 +00:00
Boshen
267f7c4398
fix(minifier): skip Object.defineProperty(exports, ...) for cjs-module-lexer ( #4409 )
...
```
> monitor-oxc@ test /home/runner/work/monitor-oxc/monitor-oxc
> node src/main.test.mjs
file:///home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/inquirer@[10](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:11 ).0.1/node_modules/inquirer/dist/esm/ui/prompt.mjs:2
import { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } from "rxjs";
^^^^^
SyntaxError: Named export 'EMPTY' not found. The requested module 'rxjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'rxjs';
const { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:[12](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:13 )3:5)
Node.js v20.15.1
```
Export is undefined when `enumerable` is "!0 ".
See `https://github.com/nodejs/cjs-module-lexer/issues/64 `
2024-07-22 20:32:15 +08:00
Boshen
0deb027e6b
feat(minfier): dce if (xxx) else if (false) { REMOVE } ( #4407 )
2024-07-22 19:57:35 +08:00
github-actions[bot]
7d751898b3
Release crates v0.21.0 ( #4344 )
...
## [0.21.0] - 2024-07-18
- d7ab0b8 semantic: [**BREAKING**] Simplify node creation (#4226 )
(lucab)
### Features
- af4dc01 ast: Align ts ast scope with typescript (#4253 ) (Dunqing)
- 83c2c62 codegen: Add option for choosing quotes; remove slow
`choose_quot` method (#4219 ) (Boshen)
- 5d17675 mangler: Add debug mode (#4314 ) (Boshen)
- e3e663b mangler: Initialize crate and integrate into minifier (#4197 )
(Boshen)
- c818472 minifier: Dce conditional expression `&&` or `||` (#4190 )
(Boshen)
- 8a190eb oxc: Export `oxc_mangler` (Boshen)
- 20cdb1f semantic: Align class scope with typescript (#4195 ) (Dunqing)
- 92ee774 semantic: Add `ScopeFlags::CatchClause` for use in CatchClause
(#4205 ) (Dunqing)
- 205c259 sourcemap: Support SourceMapBuilder#token_chunks (#4220 )
(underfin)
- 7eb960d transformer: Decode xml character entity `&#xhhhh` and
`&#nnnn;` (#4235 ) (Boshen)
### Bug Fixes
- bf3d8d3 codegen: Print annotation comment inside parens for new and
call expressions (#4290 ) (Boshen)
- 084ab76 codegen: Use `ryu-js` for f64 to string (Boshen)
- e167ef7 codegen: Print parenthesis properly (#4245 ) (Boshen)
- c65198f codegen: Choose the right quote for jsx attribute string
(#4236 ) (Boshen)
- be82c28 codegen: Print `JSXAttributeValue::StringLiteral` directly
(#4231 ) (Boshen)
- 3df9e69 mangler: No shorthand `BindingProperty`; handle var hoisting
and export variables (#4319 ) (Boshen)
- f144082 minifier: RemoveDeadCode should visit nested expression
(#4268 ) (underfin)
- 66b455a oxc_codegen: Avoid print same pure comments multiple time
(#4230 ) (IWANABETHATGUY)
- 9a87e41 parser: Avoid crashing on invalid const modifier (#4267 )
(lucab)
- 641a78b parser: Fix tests for number parsing (#4254 ) (overlookmotel)
- 9badac0 semantic: Avoid var hosting insert the var variable to the
`CatchClause` scope (#4337 ) (Dunqing)
- 95e15b6 semantic: Incorrect resolve references for `ExportSpecifier`
(#4320 ) (Dunqing)
- c362bf7 semantic: Incorrect resolve references for
`TSInterfaceHeritage` (#4311 ) (Dunqing)
- 351ecf2 semantic: Incorrect resolve references for `TSTypeQuery`
(#4310 ) (Dunqing)
- 1108f2a semantic: Resolve references to the incorrect symbol (#4280 )
(Dunqing)
- 22d56bd semantic: Do not resolve references after `FormalParameters`
in TS type (#4241 ) (overlookmotel)- 1c117eb Avoid print extra semicolon
after accessor property (#4199 ) (IWANABETHATGUY)
### Performance
- a8dc4f3 parser: Speed up parsing numbers with `_` separators (#4259 )
(overlookmotel)
- b94540d parser: Speed up parsing octal literals (#4258 )
(overlookmotel)
- a7b328c parser: Faster parsing decimal numbers (#4257 ) (overlookmotel)
- f9d3f2e semantic: Inline ast record functions (#4272 ) (overlookmotel)
- 8fad7db semantic: Reduce `AstNodeId` to `u32` (#4264 ) (overlookmotel)
- 23743db semantic: Do not record ast nodes for cfg if cfg disabled
(#4263 ) (overlookmotel)
- da69076 semantic: Reduce overhead of cfg recording ast nodes (#4262 )
(overlookmotel)
- cb15303 semantic: Reduce memory copies (#4216 ) (overlookmotel)
- ef4c1f4 semantic: Reduce lookups (#4214 ) (overlookmotel)
- f23e54f semantic: Recycle unresolved references hash maps (#4213 )
(overlookmotel)
- 2602ce2 semantic: Reuse existing map of unresolved refs (#4206 )
(lucab)
### Refactor
- 2c7bb9f ast: Pass final `ScopeFlags` into `visit_function` (#4283 )
(overlookmotel)
- 3e099fe ast: Move `enter_scope` after `visit_binding_identifier`
(#4246 ) (Dunqing)
- aab7aaa ast/visit: Fire node events as the outermost one. (#4203 )
(rzvxa)
- d1c4be0 codegen: Clean up annotation_comment (Boshen)
- 06197b8 codegen: Separate tests (Boshen)
- aa22073 codegen: Improve print API (#4196 ) (Boshen)
- c5731a5 semantic: Remove defunct code setting ScopeFlags twice (#4286 )
(overlookmotel)
- 16698bc semantic: Move function/class-specific code into specific
visitors (#4278 ) (overlookmotel)
- ee16668 semantic: Rename function param (#4277 ) (overlookmotel)
- 25f0771 semantic: Alter syntax of `control_flow!` macro (#4275 )
(overlookmotel)
- 639fd48 semantic: Comment why extra CFG enabled check (#4274 )
(overlookmotel)
- c418bf5 semantic: Directly record `current_node_id` when adding a
scope (#4265 ) (Dunqing)
- ace4f1f semantic: Update the order of `visit_function` and `Visit`
fields in the builder to be consistent (#4248 ) (Dunqing)
- 8bfeabf semantic: Simplify adding `SymbolFlags::Export` (#4249 )
(Dunqing)
- dc2b3c4 semantic: Add strict mode in scope flags for class definitions
(#4156 ) (Dunqing)
- 81ed588 semantic: Convert scope fields to IndexVecs (#4208 ) (lucab)
- bbe5ded semantic: Set `current_scope_id` to `scope_id` in
`enter_scope` (#4193 ) (Dunqing)
- 7f1addd semantic: Correct scope in CatchClause (#4192 ) (Dunqing)
- fc0b17d syntax: Turn the `AstNodeId::dummy` into a constant field.
(#4308 ) (rzvxa)
- a197e01 transformer/typescript: Remove unnecessary code (#4321 )
(Dunqing)
- 1458d81 visit: Add `#[inline]` to empty functions (#4330 )
(overlookmotel)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-18 14:39:07 +08:00
Dunqing
1f7ec62d44
chore: move mangler example to minifier ( #4343 )
...
```
Error: Circular dependency detected: oxc_codegen -> oxc_mangler
```
2024-07-18 06:27:16 +00:00
Dunqing
fc39ffa009
Revert "Release crates v0.21.0" ( #4342 )
...
Reverts oxc-project/oxc#4338
https://github.com/oxc-project/oxc/actions/runs/9986290706/job/27598542089
Release failed
2024-07-18 14:11:42 +08:00
github-actions[bot]
0abcf499b7
Release crates v0.21.0 ( #4338 )
...
## [0.21.0] - 2024-07-18
- d7ab0b8 semantic: [**BREAKING**] Simplify node creation (#4226 )
(lucab)
### Features
- af4dc01 ast: Align ts ast scope with typescript (#4253 ) (Dunqing)
- 83c2c62 codegen: Add option for choosing quotes; remove slow
`choose_quot` method (#4219 ) (Boshen)
- 5d17675 mangler: Add debug mode (#4314 ) (Boshen)
- e3e663b mangler: Initialize crate and integrate into minifier (#4197 )
(Boshen)
- c818472 minifier: Dce conditional expression `&&` or `||` (#4190 )
(Boshen)
- 8a190eb oxc: Export `oxc_mangler` (Boshen)
- 20cdb1f semantic: Align class scope with typescript (#4195 ) (Dunqing)
- 92ee774 semantic: Add `ScopeFlags::CatchClause` for use in CatchClause
(#4205 ) (Dunqing)
- 205c259 sourcemap: Support SourceMapBuilder#token_chunks (#4220 )
(underfin)
- 7eb960d transformer: Decode xml character entity `&#xhhhh` and
`&#nnnn;` (#4235 ) (Boshen)
### Bug Fixes
- bf3d8d3 codegen: Print annotation comment inside parens for new and
call expressions (#4290 ) (Boshen)
- 084ab76 codegen: Use `ryu-js` for f64 to string (Boshen)
- e167ef7 codegen: Print parenthesis properly (#4245 ) (Boshen)
- c65198f codegen: Choose the right quote for jsx attribute string
(#4236 ) (Boshen)
- be82c28 codegen: Print `JSXAttributeValue::StringLiteral` directly
(#4231 ) (Boshen)
- 3df9e69 mangler: No shorthand `BindingProperty`; handle var hoisting
and export variables (#4319 ) (Boshen)
- f144082 minifier: RemoveDeadCode should visit nested expression
(#4268 ) (underfin)
- 66b455a oxc_codegen: Avoid print same pure comments multiple time
(#4230 ) (IWANABETHATGUY)
- 9a87e41 parser: Avoid crashing on invalid const modifier (#4267 )
(lucab)
- 641a78b parser: Fix tests for number parsing (#4254 ) (overlookmotel)
- 9badac0 semantic: Avoid var hosting insert the var variable to the
`CatchClause` scope (#4337 ) (Dunqing)
- 95e15b6 semantic: Incorrect resolve references for `ExportSpecifier`
(#4320 ) (Dunqing)
- c362bf7 semantic: Incorrect resolve references for
`TSInterfaceHeritage` (#4311 ) (Dunqing)
- 351ecf2 semantic: Incorrect resolve references for `TSTypeQuery`
(#4310 ) (Dunqing)
- 1108f2a semantic: Resolve references to the incorrect symbol (#4280 )
(Dunqing)
- 22d56bd semantic: Do not resolve references after `FormalParameters`
in TS type (#4241 ) (overlookmotel)- 1c117eb Avoid print extra semicolon
after accessor property (#4199 ) (IWANABETHATGUY)
### Performance
- a8dc4f3 parser: Speed up parsing numbers with `_` separators (#4259 )
(overlookmotel)
- b94540d parser: Speed up parsing octal literals (#4258 )
(overlookmotel)
- a7b328c parser: Faster parsing decimal numbers (#4257 ) (overlookmotel)
- f9d3f2e semantic: Inline ast record functions (#4272 ) (overlookmotel)
- 8fad7db semantic: Reduce `AstNodeId` to `u32` (#4264 ) (overlookmotel)
- 23743db semantic: Do not record ast nodes for cfg if cfg disabled
(#4263 ) (overlookmotel)
- da69076 semantic: Reduce overhead of cfg recording ast nodes (#4262 )
(overlookmotel)
- cb15303 semantic: Reduce memory copies (#4216 ) (overlookmotel)
- ef4c1f4 semantic: Reduce lookups (#4214 ) (overlookmotel)
- f23e54f semantic: Recycle unresolved references hash maps (#4213 )
(overlookmotel)
- 2602ce2 semantic: Reuse existing map of unresolved refs (#4206 )
(lucab)
### Refactor
- 2c7bb9f ast: Pass final `ScopeFlags` into `visit_function` (#4283 )
(overlookmotel)
- 3e099fe ast: Move `enter_scope` after `visit_binding_identifier`
(#4246 ) (Dunqing)
- aab7aaa ast/visit: Fire node events as the outermost one. (#4203 )
(rzvxa)
- d1c4be0 codegen: Clean up annotation_comment (Boshen)
- 06197b8 codegen: Separate tests (Boshen)
- aa22073 codegen: Improve print API (#4196 ) (Boshen)
- c5731a5 semantic: Remove defunct code setting ScopeFlags twice (#4286 )
(overlookmotel)
- 16698bc semantic: Move function/class-specific code into specific
visitors (#4278 ) (overlookmotel)
- ee16668 semantic: Rename function param (#4277 ) (overlookmotel)
- 25f0771 semantic: Alter syntax of `control_flow!` macro (#4275 )
(overlookmotel)
- 639fd48 semantic: Comment why extra CFG enabled check (#4274 )
(overlookmotel)
- c418bf5 semantic: Directly record `current_node_id` when adding a
scope (#4265 ) (Dunqing)
- ace4f1f semantic: Update the order of `visit_function` and `Visit`
fields in the builder to be consistent (#4248 ) (Dunqing)
- 8bfeabf semantic: Simplify adding `SymbolFlags::Export` (#4249 )
(Dunqing)
- dc2b3c4 semantic: Add strict mode in scope flags for class definitions
(#4156 ) (Dunqing)
- 81ed588 semantic: Convert scope fields to IndexVecs (#4208 ) (lucab)
- bbe5ded semantic: Set `current_scope_id` to `scope_id` in
`enter_scope` (#4193 ) (Dunqing)
- 7f1addd semantic: Correct scope in CatchClause (#4192 ) (Dunqing)
- fc0b17d syntax: Turn the `AstNodeId::dummy` into a constant field.
(#4308 ) (rzvxa)
- a197e01 transformer/typescript: Remove unnecessary code (#4321 )
(Dunqing)
- 1458d81 visit: Add `#[inline]` to empty functions (#4330 )
(overlookmotel)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-18 13:56:35 +08:00
Boshen
5d17675cde
feat(mangler): add debug mode ( #4314 )
...
closes #4303
2024-07-17 04:59:23 +00:00
overlookmotel
2c7bb9f6c8
refactor(ast): pass final ScopeFlags into visit_function ( #4283 )
...
We have a strange workaround for `visit_function` where we pass in `ScopeFlags`, to support creating the scope inside `Function`, but setting different flags for `MethodDefinition`s.
Previously `visit_function` took `Option<ScopeFlags>` and then did `flags.unwrap_or(ScopeFlags::empty()) | ScopeFlags::Function` to it. Personally, I found this confusing. When I was looking at `MethodDefinition`, I was wondering "It's a function, why doesn't it set Function flag too?"
This changes makes it more explicit and clear what `ScopeFlags` everything has.
2024-07-16 07:22:07 +00:00
underfin
f144082a60
fix(minifier): RemoveDeadCode should visit nested expression ( #4268 )
2024-07-15 19:37:12 +08:00
Boshen
e167ef79c6
fix(codegen): print parenthesis properly ( #4245 )
...
`TSParenthesizedType` handles parenthesis in ts types.
It should be considered a bug if parenthesis is not printed correctly after this PR.
2024-07-14 04:13:10 +00:00
Boshen
ab41c52485
chore(minifier): add two || test cases to dce_if_statement
2024-07-13 11:41:43 +08:00
Boshen
83c2c62f7b
feat(codegen): add option for choosing quotes; remove slow choose_quot method ( #4219 )
2024-07-12 03:08:22 +00:00
Boshen
e3e663bae4
feat(mangler): initialize crate and integrate into minifier ( #4197 )
2024-07-11 10:35:13 +00:00
Boshen
c8184723f4
feat(minifier): dce conditional expression && or || ( #4190 )
2024-07-11 04:40:23 +00:00
github-actions[bot]
2a169d1969
Release crates v0.20.0 ( #4189 )
...
## [0.20.0] - 2024-07-11
- 5731e39 ast: [**BREAKING**] Store span details inside comment struct
(#4132 ) (Luca Bruno)
### Features
- 67fe75e ast, ast_codegen: Pass the `scope_id` to the `enter_scope`
event. (#4168 ) (rzvxa)
- 54cd04a minifier: Implement dce with var hoisting (#4160 ) (Boshen)
- 44a894a minifier: Implement return statement dce (#4155 ) (Boshen)
- 725571a napi/transformer: Add `jsx` option to force parsing with jsx
(#4133 ) (Boshen)
### Bug Fixes
- 48947a2 ast: Put `decorators` before everything else. (#4143 ) (rzvxa)
- 7a059ab cfg: Double resolution of labeled statements. (#4177 ) (rzvxa)
- 4a656c3 lexer: Incorrect lexing of large hex/octal/binary literals
(#4072 ) (DonIsaac)
- 28eeee0 parser: Fix asi error diagnostic pointing at invalid text
causing crash (#4163 ) (Boshen)
### Performance
- ddfa343 diagnostic: Use `Cow<'static, str>` over `String` (#4175 )
(DonIsaac)
- 2203143 semantic: Store unresolved refs in a stack (#4162 ) (lucab)
- fca9706 semantic: Faster search for leading comments (#4140 ) (Boshen)
### Documentation
- bdcc298 ast: Update the note regarding the `ast_codegen` markers.
(#4149 ) (rzvxa)
### Refactor
- 03ad1e3 semantic: Tweak comment argument type (#4157 ) (lucab)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-11 11:05:49 +08:00
Boshen
54cd04aead
feat(minifier): implement dce with var hoisting ( #4160 )
2024-07-10 11:03:21 +00:00