Commit graph

601 commits

Author SHA1 Message Date
Boshen
4abfa7682a
refactor(parser): add --ast and --comments to example 2024-09-14 09:02:23 +08:00
oxc-bot
bd48dfbf8b
release(crates): v0.29.0 (#5763)
## [0.29.0] - 2024-09-13

- 71116a1 index: [**BREAKING**] Remove ability to index `IndexVec` with
`usize` (#5733) (overlookmotel)

- c3dd2a0 ast: [**BREAKING**] Revert: reduce byte size of
`TaggedTemplateExpression::quasi` by `Boxing` it (#5679) (#5715)
(overlookmotel)

### Features

- 953fe17 ast: Provide `NONE` type for AST builder calls (#5737)
(overlookmotel)
- a362f51 index: Add `IndexVec::shrink_to` (#5713) (overlookmotel)
- e968e9f minifier: Constant fold nullish coalescing operator (#5761)
(Boshen)
- 6bc13f6 minifier: Add `MinimizeConditions` pass (#5747) (Boshen)
- 805fbac oxc_cfg: Better control flow graph dot dot repr (#5731)
(IWANABETHATGUY)
- f3baa49 semantic: Add `SemanticBuilder::with_stats` (#5757)
(overlookmotel)
- 7fa0cb3 semantic: Expose `Stats` (#5755) (overlookmotel)

### Bug Fixes

- 8ff013a minifier: Handle dce CallExpression::callee (#5752) (Boshen)
- 608b7d3 napi/transformer: Refresh plugin doesn't work even after
passing the refresh option (#5702) (Dunqing)
- 042afa9 syntax: Correctly check for valid `RedeclarationId`s (#5759)
(overlookmotel)
- 77d9170 transformer/react: IsStaticChildren should be false when there
is only one child (#5745) (Dunqing)

### Performance

- 333e2e0 index: Remove `Idx` bounds-checks from `first` + `last`
methods (#5726) (overlookmotel)
- d18c896 rust: Use `cow_utils` instead (#5664) (dalaoshu)

### Refactor

- 2890c98 minifier: Add tests for `remove_syntax` (#5749) (Boshen)
- 9a9d8f6 minifier: Replace `self.ast` with `ctx.ast` (#5748) (Boshen)
- 746f7b3 minifier: Align code with closure compiler (#5717) (Boshen)
- 21e2df5 minifier: Replace `VisitMut` with `Traverse` for inject and
define plugins (#5705) (Boshen)
- 4bdc202 rust: Remove some #[allow(unused)] (#5716) (Boshen)
- a35fb14 semantic: `Stats::assert_accurate` take `self` (#5758)
(overlookmotel)
- 4b896f1 semantic: Make `Stats` `Copy` (#5756) (overlookmotel)
- b4b460f semantic: `Stats` store counts as `u32` (#5754)
(overlookmotel)
- 667170c semantic: Rename `Counts` to `Stats` (#5753) (overlookmotel)
- cc0408b semantic: S/AstNodeId/NodeId (#5740) (Boshen)
- 7dfcdfc semantic: Remove `more-asserts` dependency (#5739)
(overlookmotel)
- 6436524 semantic: Fix dead code warning in release mode (#5728)
(overlookmotel)
- e02621d semantic: Re-order use statements (#5712) (overlookmotel)
- ac6203c semantic: Move `Counts` code into counter module (#5710)
(overlookmotel)
- 339fcfc semantic: Rename `Counts` in transform checker (#5709)
(overlookmotel)
- d8ec781 semantic: Remove `record_ast_node` call for `Program` (#5701)
(overlookmotel)

### Styling

- 1857ff0 semantic: Rename vars for node IDs (#5699) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-13 21:43:23 +08:00
overlookmotel
7dfcdfced6 refactor(semantic): remove more-asserts dependency (#5739)
Remove `more-asserts` dependency which was added in #5710.

As suggested by @Boshen in https://github.com/oxc-project/oxc/pull/5710#pullrequestreview-2299016692.
2024-09-13 02:53:00 +00:00
oxc-bot
1dad9fa301
release(oxlint): v0.9.5 (#5724)
## [0.9.5] - 2024-09-12

### Features

- 4b04f65 linter: Implement `no-plusplus` rule (#5570) (Cam McHenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-12 16:59:25 +08:00
oxc-bot
d06bab6260
release(oxlint): v0.9.4 (#5718)
## [0.9.4] - 2024-09-12

### Features

- 9ca2593 linter: Eslint/sort-keys  (#4845) (Na'aman Hirschfeld)
- 023c160 linter: Impl `Serialize` for `OxlintConfig` (#5594) (DonIsaac)
- 24d6a47 linter: Implement `eslint/no-invalid-regexp` (#5443) (Boshen)

### Bug Fixes

- af6d240 linter: Panic in consistent-function-scoping (#5613)
(DonIsaac)
- 54e2e76 linter: `react/no_set_state` + `react/no_string_refs` rules
find correct parent (#5615) (overlookmotel)
- 3b87ac4 linter: Fix no_unused_vars panic when encountering unicode
(#5582) (Boshen)

### Performance

- bfe9186 linter: Use `cow_replace` instead of `replace` (#5643)
(dalaoshu)
- e3ae5db linter: Use cow_to_ascii_lowercase/uppercase (#5637) (heygsc)
- a0370bf linter: Use cow_utils in no_script_url (#5633) (heygsc)
- 37e922c linter: `eslint/no_shadow_restricted_names` use
`run_on_symbol` (#5618) (overlookmotel)
- 0b7fccf linter: `react/no_set_state` + `react/no_string_refs` rules
reduce iteration over ancestors (#5616) (overlookmotel)
- 2c3f3fe linter: Make `jsx_key` slightly faster (#5585) (Boshen)
- cd81d12 linter: Add `should_run` to check path only once to
nextjs/no_typos (#5584) (Boshen)
- d18c896 rust: Use `cow_utils` instead (#5664) (dalaoshu)

### Documentation

- 64f9575 linter: Add plugin usage to example with configuration
(Boshen)
- 8c9179d linter: Fix typos (#5591) (Brian Donovan)

### Refactor

- 9e9435f linter: Add `LintFilter` (#5685) (DonIsaac)
- 4f70fe5 linter: Start internal/external split of LintPluginOptions
(#5660) (DonIsaac)
- 5ae9b48 linter: Start internal/external split of `OxlintOptions`
(#5659) (DonIsaac)
- c8bc6f0 linter: Use `std::ptr::eq` (#5649) (overlookmotel)
- a37c064 linter: Use `ContentHash` for `no_duplicate_case`; remove
`calculate_hash` (#5648) (Boshen)
- 0b3c1d7 linter: Start internal/external split of `OxlintConfig`
(#5595) (DonIsaac)
- 89bdf55 linter: Inline `Rule` trait default methods (#5619)
(overlookmotel)
- afea8d5 linter: Rename `Rule` trait method params (#5617)
(overlookmotel)
- 4e748b5 linter: Replace ast "compare by hash" to "compare by content"
(#5602) (dalaoshu)
- bac03e3 linter: Make fields of `LintServiceOptions` private (#5593)
(DonIsaac)
- 2661d8b linter: Jest prefer_strict_equal (#5588) (IWANABETHATGUY)
- 20d0068 oxlint: Move cli-related exports to `cli` module (#5139)
(DonIsaac)
- 067f9b5 semantic: Introduce `IsGlobalReference` trait (#5672)
(Boshen)- 26d9235 Enable clippy::ref_as_ptr (#5577) (夕舞八弦)

### Testing

- 8e79f8d linter: Add class method test cases for `oxc/no-async-await`
(#5550) (DonIsaac)
- 3835189 linter: Add test case for no_unused_vars in 3b87ac4 (Boshen)
- 5f27551 linter: Add a passing case to no_undef (#5580) (Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-12 13:56:38 +08:00
overlookmotel
ac6203c891 refactor(semantic): move Counts code into counter module (#5710)
Pure refactor. Move code for counting nodes etc, and verifying counts, into `counter` module.
2024-09-11 20:41:48 +00:00
dalaoshu
d18c896a2c
perf(rust): use cow_utils instead (#5664)
Related to #5586 and #5662

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-11 18:39:30 +08:00
oxc-bot
a727ee8aca
release(oxc): crates v0.28.0 (#5696)
## [0.28.0] - 2024-09-11

- afc4548 ast: [**BREAKING**] Educe byte size of
`TaggedTemplateExpression::quasi` by `Boxing` it (#5679) (Boshen)

- 7415e85 ast: [**BREAKING**] Reduce byte size of
`TSImportType::attributes` by `Box`ing it (#5678) (Boshen)

- ee4fb42 ast: [**BREAKING**] Reduce size of `WithClause` by `Box`ing it
(#5677) (Boshen)

- 1fa3e56 semantic: [**BREAKING**] Rename `SymbolTable::iter` to
`symbol_ids` (#5621) (overlookmotel)

- 96a1552 semantic: [**BREAKING**] Remove `SymbolTable::iter_rev`
(#5620) (overlookmotel)

- 4a8aec1 span: [**BREAKING**] Change `SourceType::js` to
`SourceType::cjs` and `SourceType::mjs` (#5606) (Boshen)

- 603817b oxc: [**BREAKING**] Add `SourceType::Unambiguous`; parse `.js`
as unambiguous (#5557) (Boshen)

- b060525 semantic: [**BREAKING**] Remove `source_type` argument from
`SemanticBuilder::new` (#5553) (Boshen)

### Features

- 2da5ad1 ast: Add `JSXElementName::get_identifier` method (#5556)
(overlookmotel)
- 2016bae coverage: Add regular expression idempotency test (#5676)
(Boshen)
- 68c3cf5 minifier: Fold `void 1` -> `void 0` (#5670) (Boshen)
- c6bbf94 minifier: Constant fold unary expression (#5669) (Boshen)
- 86256ea minifier: Constant fold `typeof` (#5666) (Boshen)
- e698418 napi/transform: Align output `SourceMap` with Rollup's
`ExistingRawSourceMap` (#5657) (Boshen)
- aba9194 napi/transform: Export react refresh options (#5533)
(underfin)
- 642295c semantic: Add `SymbolTable::delete_resolved_reference` method
(#5558) (overlookmotel)
- b3cbd56 span: `format_compact_str!` macro (#5610) (overlookmotel)
- 95a6d99 transformer: Enable the react refresh plugin in enable_all
(#5630) (Dunqing)
- 7b543df transformer/react: Handle `refresh_sig` and `refresh_reg`
options correctly (#5638) (Dunqing)
- 17226dd traverse: Add methods for deleting references (#5559)
(overlookmotel)

### Bug Fixes

- d62defb codegen: Do not print trailing commas for `ArrayExpression`
(#5551) (Boshen)
- 1bc08e2 coverage: Parse babel unambiguously (#5579) (Boshen)
- 28b934c coverage: Apply `always_strict` to test262 and typescript per
the specifcation (#5555) (Boshen)
- b9bf544 isolated-declarations: False positive for setter method in
`interface` (#5681) (Dunqing)
- 6e8409a isolated-declarations: Bindings referenced in
`TSModuleDeclaration` are removed incorrectly (#5680) (Dunqing)
- b8f8dd6 minifier/replace_global_defines: Do not replace shadowed
identifiers (#5691) (Boshen)
- 304ce25 regular_expression: Keep LegacyOctalEscape raw digits for
`to_string` (#5692) (leaysgur)
- 0511d55 regular_expression: Report more MayContainStrings error in
(nested)class (#5661) (leaysgur)
- 41582ea regular_expression: Improve RegExp `to_string()` results
(#5635) (leaysgur)
- 28aad28 regular_expression: Handle `-` in `/[\-]/u` as escaped
character (#5631) (leaysgur)
- f9e3a41 semantic: Bind `SymbolId` to function name in `if (foo)
function id() {}` (#5673) (Boshen)
- f49e6eb span: Treat `.js` as `module` file (reverts the previous
breaking change) (#5612) (Boshen)
- 919d17f transform_conformance: Only print semantic mismatch errors
when output is correct (#5589) (Boshen)
- 505d064 transformer: JSX transform delete references for
`JSXClosingElement`s (#5560) (overlookmotel)
- 9b7ecc7 transformer: RegExp transform only set span on final
expression (#5508) (overlookmotel)
- d1ece19 transformer: RegExp transform handle `Term::Quantifier`
(#5501) (overlookmotel)
- a1afd48 transformer/react: Incorrect scope_id for var hoisted in fast
refresh plugin (#5695) (Dunqing)
- f2f5e5a transformer/react: Missing scope_id for function in fast
refresh plugin (#5693) (Dunqing)
- a891c31 transformer/react: Refresh plugin has incorrect reference
flags (#5656) (Dunqing)
- 3e8b96f transformer/react: The refresh plugin cannot handle member
expressions with React hooks (#5655) (Dunqing)
- 0739b5f transformer/react: Don't transform declaration of function
overloads (#5642) (Dunqing)
- 3bf6aaf transformer/react: Support `emit_full_signatures` option in
refresh plugin (#5629) (Dunqing)
- 36d864a transformer/react: Don't transform if the variable does not
have a value reference (#5528) (Dunqing)

### Performance

- e8013d2 traverse: Faster string operations generating UIDs (#5626)
(overlookmotel)
- 4996874 traverse: `generate_uid` cache available binding names (#5611)
(overlookmotel)

### Documentation

- fefbbc1 sourcemap: Add trailing newline to README (#5539)
(overlookmotel)
- 9282647 transformer: Comment on RegExp transform for potential
improvement (#5514) (overlookmotel)
- 1c051ae traverse: Correct code comment 2 (#5607) (overlookmotel)
- 2e24a15 traverse: Correct code comment (#5604) (overlookmotel)

### Refactor

- 14ee086 ast: Inline `AstKind::as_*` methods (#5547) (overlookmotel)
- 2de6ea0 index, traverse: Remove unnecessary type annotations (#5650)
(overlookmotel)
- 0ac420d linter: Use meaningful names for diagnostic parameters (#5564)
(Don Isaac)
- 2da42ef regular_expression: Improve AST docs with refactoring
may_contain_strings (#5665) (leaysgur)
- dec1395 regular_expression: Align diagnostics (#5543) (leaysgur)
- 731ffaa semantic: Compare nodes by pointer equality (#5686)
(overlookmotel)
- 067f9b5 semantic: Introduce `IsGlobalReference` trait (#5672) (Boshen)
- d22a9b7 semantic: `SymbolTable::is_empty` use `is_empty` (#5622)
(overlookmotel)
- 3d190a5 span: Move `CompactStr` into separate file (#5609)
(overlookmotel)
- 5532628 span: Put types and impl in the same mod file (Boshen)
- ce71982 transformer: Shorten code in JSX transform (#5554)
(overlookmotel)
- 758a10c transformer: RegExp transform reuse var (#5527)
(overlookmotel)
- fad0a05 transformer: RegExp transform unbox early (#5504)
(overlookmotel)
- 19cdcc5 traverse: Revert changes to `walk.rs` (#5652) (overlookmotel)-
26d9235 Enable clippy::ref_as_ptr (#5577) (夕舞八弦)

### Styling

- e52d006 traverse: Fix formatting of traverse codegen (#5651)
(overlookmotel)
- 97e99bd traverse: Remove excess line break (#5603) (overlookmotel)-
694f032 Add trailing line breaks to `package.json` files (#5542)
(overlookmotel)

### Testing

- 2e367c9 traverse: Enable tests for `oxc_traverse` crate (#5625)
(overlookmotel)- dc92489 Add trailing line breaks to conformance
fixtures (#5541) (overlookmotel)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-11 17:57:55 +08:00
Dunqing
3bf6aaf06a fix(transformer/react): support emit_full_signatures option in refresh plugin (#5629) 2024-09-11 07:57:14 +00:00
Boshen
2016bae98c feat(coverage): add regular expression idempotency test (#5676)
closes #5634
2024-09-11 02:07:42 +00:00
heygsc
febb29f7f5
perf(formatter): use cow and put cow_ascii on clippy (#5646)
close: #5639 

part of: #5586

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-10 09:38:17 +08:00
overlookmotel
e8013d259e perf(traverse): faster string operations generating UIDs (#5626)
`get_unique_name` perform string manipulation faster, avoiding bounds checks, and use `itoa` crate for faster conversion of integers to strings for postfixes above 100.

No apparent difference on benchmarks, but I imagine that's only because it's outweighed by cost of hashing strings. If measured alone, I believe it would be a perf improvement.
2024-09-10 01:12:22 +00:00
overlookmotel
4996874dda perf(traverse): generate_uid cache available binding names (#5611)
Close #5488.

`generate_uid` previously iterated through every symbol and unresolved reference in the AST to find a unique var name. If the first var name it tried was already in use, it'd iterate again.

Instead build a hash map recording existing var names in use for every name which could clash with a UID (any var name starting with `_`). Once built, use that hash map to generate UIDs without iterating through all symbols again.

I had hoped to make `generate_uid` cheaper still by just recording the highest digits postfix for each var name, and then incrementing that postfix for each UID. i.e. if AST contains vars `_foo1` and `_foo6`, create UIDs starting at one number higher - `_foo7`, `_foo8` etc. This method would be more efficient, but unfortunately it does not match Babel, and so causes some of Babel's tests to fail.
2024-09-10 01:12:19 +00:00
heygsc
a0370bf506
perf(linter): use cow_utils in no_script_url (#5633)
part of #5586 

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-09 15:06:50 +08:00
oxc-bot
16009c09fd
release: oxlint v0.9.3 (#5569)
## [0.9.3] - 2024-09-07

### Features

- be3a432 linter: Implement typescript/no-magic-numbers (#4745)
(Alexander S.)
- 09aa86d linter/eslint: Implement `sort-vars` rule (#5430) (Jelle van
der Waa)
- 2ec2f7d linter/eslint: Implement no-alert (#5535) (Edwin Lim)
- a786acf linter/import: Add no-dynamic-require rule (#5389) (Jelle van
der Waa)
- 4473779 linter/node: Implement no-exports-assign (#5370) (dalaoshu)
- b846432 linter/oxc: Add fixer for `erasing-op` (#5377) (camc314)
- aff2c71 linter/react: Implement `self-closing-comp` (#5415) (Jelle van
der Waa)

### Bug Fixes

- 0df1d9d ast, codegen, linter: Panics in fixers. (#5431) (rzvxa)
- cdd1a91 linter: Typescript/no-magic-numbers: remove double minus for
reporting negative bigint numbers (#5565) (Alexander S.)
- ff88c1f linter: Don't mark binding rest elements as unused in TS
function overloads (#5470) (Cam McHenry)
- 088733b linter: Handle loops in `getter-return` rule (#5517) (Cam
McHenry)
- 82c0a16 linter: `tree_shaking/no_side_effects_in_initialization`
handle JSX correctly (#5450) (overlookmotel)
- 6285a02 linter: `eslint/radix` rule correctly check for unbound
symbols (#5446) (overlookmotel)
- c8ab353 linter/tree-shaking: Align JSXMemberExpression's report
(#5548) (mysteryven)
- 5187f38 linter/tree-shaking: Detect the correct export symbol
resolution (#5467) (mysteryven)

### Performance

- 8170954 linter/react: Add should_run conditions for react rules
(#5402) (Jelle van der Waa)

### Documentation

- a540215 linter: Update docs `Examples` for linter rules (#5513)
(dalaoshu)
- 7414190 linter: Update docs `Example` for linter rules (#5479)
(heygsc)

### Refactor

- 0ac420d linter: Use meaningful names for diagnostic parameters (#5564)
(Don Isaac)
- 81a394d linter: Deduplicate code in `oxc/no-async-await` (#5549)
(DonIsaac)
- 979c16c linter: Reduce nested if statements in
eslint/no_this_before_super (#5485) (IWANABETHATGUY)
- 1d3e973 linter: Simplify `eslint/radix` rule (#5445) (overlookmotel)
- fdb8857 linter: Use "parsed pattern" in `no_div_regex` rule. (#5417)
(rzvxa)
- 2ccbd93 linter: `react/jsx_no_undef` rule `get_member_ident` do not
return Option (#5411) (overlookmotel)

### Styling

- 2a43fa4 linter: Introduce the writing style from PR #5491 and reduce
the if nesting (#5512) (dalaoshu)- d8b29e7 Add trailing line breaks to
JSON files (#5544) (overlookmotel)- 694f032 Add trailing line breaks to
`package.json` files (#5542) (overlookmotel)

### Testing

- 340b535 linter/no-unused-vars: Arrow functions in tagged templates
(#5510) (Don Isaac)
- af69393 linter/no-useless-spread: Ensure spreads on identifiers pass
(#5561) (DonIsaac)- dc92489 Add trailing line breaks to conformance
fixtures (#5541) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-07 12:28:46 +08:00
oxc-bot
64eb2cccb7
release: crates v0.27.0 (#5538)
## [0.27.0] - 2024-09-06

- bd820f9 semantic: [**BREAKING**] Remove
`SymbolTable::get_symbol_id_from_name` and
`SymbolTable::get_scope_id_from_name` (#5480) (overlookmotel)

- cba93f5 ast: [**BREAKING**] Add `ThisExpression` variants to
`JSXElementName` and `JSXMemberExpressionObject` (#5466) (overlookmotel)

- 87c5df2 ast: [**BREAKING**] Rename `Expression::without_parentheses`
(#5448) (overlookmotel)

### Features

- e8bdd12 allocator: Add `AsMut` impl for `Box` (#5515) (overlookmotel)
- 90facd3 ast: Add `ContentHash` trait; remove noop `Hash`
implementation from `Span` (#5451) (rzvxa)
- 23285f4 ast: Add `ContentEq` trait. (#5427) (rzvxa)
- 59abf27 ast, parser: Add `oxc_regular_expression` types to the parser
and AST. (#5256) (rzvxa)
- 68a1c01 ast_tools: Add dedicated `Derive` trait. (#5278) (rzvxa)
- c782916 codegen: Print `type_parameters` in `TaggedTemplateExpression`
(#5438) (Dunqing)
- 4cb63fe index: Impl rayon related to trait for IndexVec (#5421)
(IWANABETHATGUY)
- ba4b68c minifier: Remove parenthesized expression for dce (#5439)
(Boshen)
- ed8ab6d oxc: Conditional expose `oxc_cfg` in `oxc` crate (#5524)
(IWANABETHATGUY)
- 91b39c4 oxc_diagnostic: Impl DerefMut for OxcDiagnostic (#5474)
(IWANABETHATGUY)
- 10279f5 parser: Add syntax error for hyphen in `JSXMemberExpression`
`<Foo.bar-baz />` (#5440) (Boshen)
- 0f50b1e semantic: Check for initializers in ambient
`VariableDeclaration`s (#5463) (DonIsaac)
- 62f7fff semantic: Check for non-declared, non-abstract object
accessors without bodies (#5461) (DonIsaac)
- 5407143 semantic: Check for non-declared, non-abstract class accessors
without bodies (#5460) (DonIsaac)
- 052e94c semantic: Check for parameter properties in constructor
overloads (#5459) (DonIsaac)
- 32d4bbb transformer: Add `TransformOptions::enable_all` method (#5495)
(Boshen)
- c59d8b3 transformer: Support all /regex/ to `new RegExp` transforms
(#5387) (Dunqing)
- cedf7a4 xtask: Impl `as_ast_kind` method for each variant (#5491)
(IWANABETHATGUY)

### Bug Fixes

- 0df1d9d ast, codegen, linter: Panics in fixers. (#5431) (rzvxa)
- fce549e diagnostics: Ignore `Interrupted` and `BrokenPipe` errors
while printing (#5526) (Boshen)
- ea7a52f napi/transform: Fix test (Boshen)
- 9b984b3 regex: Panic on displaying surrogated `UnicodeEscape`
characters. (#5469) (rzvxa)
- 88b7ddb regular_expression: Handle unterminated character class
(#5523) (leaysgur)
- 7a797ac semantic: Incorrect reference when `MemberExpression` used in
`TSPropertySignature` (#5525) (Dunqing)
- d8b9909 semantic: `IdentifierReference` within `TSPropertySignature`
cannot reference type-only import binding (#5441) (Dunqing)
- 8f9627d transformer: RegExp transform do not transform invalid regexps
(#5494) (overlookmotel)
- 2060efc transformer: RegExp transform don't transform all RegExps
(#5486) (overlookmotel)
- cfe5497 transformer: Do not create double reference in JSX transform
(#5414) (overlookmotel)
- 0617249 transformer/nullish-coalescing-operator: Incorrect reference
flags (#5408) (Dunqing)
- 0eb32a6 traverse: Invalid variable name generated by
`generate_uid_based_on_node` (#5407) (Dunqing)- b96bea4 Add back
lifetime (#5507) (IWANABETHATGUY)

### Performance

- bfabd8f syntax: Further optimize `is_identifier_name` (#5426)
(overlookmotel)
- aeda84f syntax: Optimize `is_identifier_name` (#5425) (overlookmotel)
- ed8937e transformer: Memoize rope instance (#5518) (Dunqing)
- bfab091 transformer: Store needed options only on `RegExp` (#5484)
(overlookmotel)
- b4765af transformer: Pre-calculate if unsupported patterns in RegExp
transform (#5483) (overlookmotel)
- 182ab91 transformer: Pre-calculate unsupported flags in RegExp
transform (#5482) (overlookmotel)

### Documentation

- 64db1b4 ast: Clarify docs for `RegExpPattern` (#5497) (overlookmotel)
- 3f204a9 span: Update docs about `ContentEq` `Vec` comparison speed
(#5478) (overlookmotel)- 00511fd Use `oxc_index` instead of `index_vec`
in doc comments (#5423) (IWANABETHATGUY)

### Refactor

- 9f6e0ed ast: Simplify `ContentEq` trait definition. (#5468) (rzvxa)
- a43e951 ast: Use loop instead of recursion (#5447) (overlookmotel)
- 2224cc4 ast: Renumber `JSXMemberExpressionObject` discriminants
(#5464) (overlookmotel)
- a952c47 ast: Use loop not recursion (#5449) (overlookmotel)
- d9d7e7c ast: Remove `IdentifierName` from `TSThisParameter` (#5327)
(overlookmotel)
- ccc8a27 ast, ast_tools: Use full method path for generated derives
trait calls. (#5462) (rzvxa)
- fdb8857 linter: Use "parsed pattern" in `no_div_regex` rule. (#5417)
(rzvxa)
- e7bd49d regular_expression: Correct typo (#5429) (overlookmotel)
- e4ed41d semantic: Change the reference flag to `ReferenceFlags::Type`
if it is used within a `TSTypeQuery` (#5444) (Dunqing)
- 94a6ac6 span: Use `Hasher` from `std` (#5476) (overlookmotel)
- b47aca0 syntax: Use `generate_derive` for `CloneIn` in types outside
of `oxc_ast` crate. (#5280) (rzvxa)
- a96866d transformer: Re-order imports (#5499) (overlookmotel)
- 6abde0a transformer: Clarify match in RegExp transform (#5498)
(overlookmotel)
- 09c522a transformer: RegExp transform report pattern parsing errors
(#5496) (overlookmotel)
- dd19823 transformer: RegExp transform do not take ownership of
`Pattern` then reallocate it (#5492) (overlookmotel)
- 2514cc9 transformer/react: Move all entry points to implementation of
Traverse trait (#5473) (Dunqing)
- c984219 transformer/typescript: Move all entry points to
implementation of Traverse trait (#5422) (Dunqing)

### Styling

- 2a43fa4 linter: Introduce the writing style from PR #5491 and reduce
the if nesting (#5512) (dalaoshu)

### Testing

- 340b535 linter/no-unused-vars: Arrow functions in tagged templates
(#5510) (Don Isaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-06 19:06:29 +08:00
IWANABETHATGUY
ed8ab6d7c8
feat(oxc): conditional expose oxc_cfg in oxc crate (#5524)
This is useful when the downside user wants to use `oxc_cfg`, and easy
to reuse `petgraph` in `oxc_cfg`
2024-09-06 14:07:43 +08:00
Boshen
32d4bbb519
feat(transformer): add TransformOptions::enable_all method (#5495)
Make it **really** explicit about which transformer options are being
turned on. I also need this in monitor-oxc.
2024-09-06 12:04:06 +08:00
Dunqing
c59d8b3c9b feat(transformer): support all /regex/ to new RegExp transforms (#5387)
related: #4754

The implementation port from [esbuild](332727499e/internal/js_parser/js_parser.go (L12820-L12840)). And cover all babel's regexp plugins

---

## The following description was generated by `Graphite` 😋

### TL;DR

Added support for transforming various RegExp features to ensure compatibility with older JavaScript environments.

### What changed?

- Implemented a new `RegExp` transformer to handle unsupported RegExp literal features
- Added options to control different RegExp transformations (e.g., sticky flag, unicode flag, dot-all flag, etc.)
- Updated the transformer to convert unsupported RegExp literals into `new RegExp()` constructor calls
- Added test cases for different RegExp transformations
- Integrated the new RegExp transformer into the existing transformation pipeline

### How to test?

1. Run the existing test suite to ensure no regressions
2. Execute the new RegExp-specific tests in the `tasks/transform_conformance/tests/esbuild-tests/test/fixtures/regexp/` directory
3. Try transforming code with various RegExp features using different target environments to verify correct transformations
2024-09-05 11:04:45 +00:00
rzvxa
fdb8857630 refactor(linter): use "parsed pattern" in no_div_regex rule. (#5417)
Part of #5416, Paves the road for upcoming refactors by adding the `oxc_regular_expression` dependency and a helper method for ease of access.
2024-09-04 14:00:47 +00:00
overlookmotel
bfabd8facc perf(syntax): further optimize is_identifier_name (#5426)
Follow-on after #5425. Further optimize `oxc_syntax::identifier::is_identifier_name` by processing string in blocks of 8 bytes, and checking if all bytes in a block are ASCII in one go, rather than testing each byte individually.
2024-09-03 13:48:36 +00:00
IWANABETHATGUY
4cb63fea4d feat(index): impl rayon related to trait for IndexVec (#5421)
1. Impl `rayon` related trait for `oxc_index::IndexVec`
2024-09-03 12:01:57 +00:00
Boshen
b1d7440401
chore(deps): update oxc-browserslist to v1.0.3 2024-09-03 14:07:11 +08:00
rzvxa
59abf27d95 feat(ast, parser): add oxc_regular_expression types to the parser and AST. (#5256)
closes #5060
2024-09-03 02:36:37 +00:00
oxc-bot
be1a6d4c84
Release crates v0.26.0 (#5418)
## [0.26.0] - 2024-09-03

- 1aa49af ast: [**BREAKING**] Remove
`JSXMemberExpressionObject::Identifier` variant (#5358) (Dunqing)

- 01cc2ce semantic: [**BREAKING**] Add `ScopeTree:get_child_ids` API
behind a runtime flag (#5403) (Boshen)

- b1d0075 napi/transform: [**BREAKING**] Align output API `sourceText`
-> `code` with babel (#5398) (Boshen)

- 32f7300 ast: [**BREAKING**] Add `JSXElementName::IdentifierReference`
and `JSXMemberExpressionObject::IdentifierReference` (#5223) (Dunqing)

- 23e8456 traverse: [**BREAKING**] `TraverseCtx::ancestor` with level 0
= equivalent to `parent` (#5294) (overlookmotel)

- 582ce9e traverse: [**BREAKING**] `TraverseCtx::ancestor` return
`Ancestor::None` if out of bounds (#5286) (overlookmotel)

- 234a24c ast: [**BREAKING**] Merge `UsingDeclaration` into
`VariableDeclaration` (#5270) (Kevin Deng 三咲智子)

- c100826 semantic: [**BREAKING**] Always create a scope for `for`
statements (#5110) (overlookmotel)

- d304d6f semantic: [**BREAKING**] Always create a scope for
`CatchClause` (#5109) (overlookmotel)

### Features

- 180b1a1 ast: Add `Function::name()` (#5361) (DonIsaac)
- 5505749 ast: Add `accessibility` field to `AccessorProperty` (#5290)
(Dunqing)
- 49cd5db ast,parser: Add `definite` flag to `AccessorProperty` node
(#5182) (DonIsaac)
- c2fa725 ast,parser: Parse `TSTypeAnnotations` on `AccessorProperty`
(#5179) (DonIsaac)
- 292d162 codegen: Print missing fields for `AccessorProperty` (#5291)
(Dunqing)
- 72740b3 isolated_declaration: Support sourcemap option (#5170)
(dalaoshu)
- f81e8a1 linter: Add `oxc/no-async-endpoint-handlers` (#5364)
(DonIsaac)
- 9c22ce9 linter: Add hyperlinks to diagnostic messages (#5318)
(DonIsaac)
- d22bd20 module_lexer: Distinguish for types-only imports and exports
(#5184) (Kevin Deng 三咲智子)
- 7dfd51a parser: Report class properties that are both definite and
optional (#5181) (DonIsaac)
- a563968 parser: Report errors on optional accessor properties (#5180)
(DonIsaac)
- 46b641b regular_expression: Validate max quantifier value (#5218)
(leaysgur)
- be4642f semantic: Transform checker check child scope IDs (#5410)
(overlookmotel)
- 6e969f9 semantic: Add `ScopeTree::delete_root_unresolved_reference`
(#5305) (overlookmotel)
- 1b20ceb span: Add `CompactStr::to_compact_string` method (#5385)
(Boshen)
- 5a137f0 span/source-type: Add SourceType factory methods (#5242)
(DonIsaac)
- f5e05db span/source-type: Impl `Display` and `Error` for
`UnknownExtension` (#5240) (DonIsaac)
- d04857b transformer: Support `Targets::from_query` method (#5336)
(Dunqing)
- 3d4a64c transformer: Make `Targets` public (#5335) (Dunqing)
- 0eb7602 transformer: Support `TransformOptions::from_preset_env` API
(#5323) (Dunqing)
- 08dc0ad transformer: Add `object-spread` plugin (#3133) (magic-akari)
- 01c0c3e transformer: Add remaining options to transformer options
(#5169) (Boshen)
- 056c667 transformer/arrow-functions: The output that uses `this`
inside blocks doesn't match Babel (#5188) (Dunqing)
- 0abfc50 transformer/typescript: Support `rewrite_import_extensions`
option (#5399) (Dunqing)

### Bug Fixes

- 8ebc23f ast: Serialize `TSParenthesizedType` with camelCase (#5199)
(Kevin Deng 三咲智子)
- 5c4c001 codegen: Print `export @decorator declare abstract class Foo`
correctly (#5303) (Boshen)
- 7b1546b codegen: Do not print comments when `--minify` (Boshen)
- ff7fa98 diagnostics: Improve "file is too long to fit on the screen"
(#5120) (Boshen)
- 8a17807 parser: Treat JSX element tags starting with `_` or `$` as
`IdentifierReference`s (#5343) (overlookmotel)
- d4c06ef parser: Revert "check for `@flow` with recoverable errors as
well" (#5297) (overlookmotel)
- e1d8b92 parser: Check for `@flow` with recoverable errors as well
(Boshen)
- e6fd52e parser: Change unterminated regex error to be non-recoverable
(#5285) (Boshen)
- 1686920 parser: Span for invalid regex flags (#5225) (leaysgur)
- cffce11 regular_expression: Prevent panic on too large number (#5282)
(leaysgur)
- 293413f semantic: Implicit return `UpdateExpression` in
`ArrowFunctionExpression` does not as read reference (#5161) (Dunqing)
- a6bb3b1 span/source-type: Consider `.cjs` and `.cts` files as
`ModuleKind::Script` (#5239) (DonIsaac)
- 35f03db transformer: `ArrowfunctionExpression`'s expression is true
but has more than one body statement (#5366) (Dunqing)
- 8d6b05c transformer: Class property with typescript value should not
be removed (#5298) (Boshen)
- 47e69a8 transformer-optional-catch-binding: The `unused` binding is
not in the correct scope (#5066) (Dunqing)
- 94ff94c transformer/arrow-functions: Reaches `unreachable` when
`<this.foo>` is inside an arrow function (#5356) (Dunqing)
- f8bb022 transformer/arrow-functions: Remove
`SymbolFlags::ArrowFunction` (#5190) (Dunqing)
- d9ba5ad transformer/arrow-functions: Correct scope for `_this` (#5189)
(Dunqing)
- 3acb3f6 transformer/react: Mismatch output caused by incorrect
transformation ordering (#5255) (Dunqing)
- 5754c89 transformer/typescript: Remove accessibility from
`AccessorProperty` (#5292) (Dunqing)
- d594818 traverse: `insert_scope_below` update child scopes records
(#5409) (overlookmotel)
- 25d6e20 traverse: Add missing visitors to `ChildScopeCollector`
(#5118) (overlookmotel)

### Performance

- 292f217 ast: Optimize `JSXIdentifier::is_reference` (#5344)
(overlookmotel)
- 12a7607 codegen: Inline `Codegen::print_list` (#5221) (overlookmotel)
- fb847bd codegen: Slightly faster `print_list` (#5192) (Boshen)
- a1523c6 transformer: Remove an allocation from arrow functions
transform (#5412) (overlookmotel)

### Documentation

- 8334bd4 transformer: Add documentation for `Targets::get_targets`
(#5337) (Dunqing)
- d51a954 transformer: Add documentation for arrow-functions plugin
(#5186) (Dunqing)

### Refactor

- c2d8c9e ast: Reduce allocations in
`AstBuilder::move_assignment_target` (#5367) (overlookmotel)
- 946c867 ast: Box `TSThisParameter` (#5325) (overlookmotel)
- 960e1d5 ast: Rename `IdentifierReference::new_with_reference_id`
(#5157) (overlookmotel)
- f63b568 ast: Remove `#[non_exhaustive]` attr from `AstBuilder` (#5130)
(overlookmotel)
- d4c3778 codegen: Rename vars (#5222) (overlookmotel)
- 543cad6 codegen: Remove some pub APIs (Boshen)
- cd63336 diagnostic: Change how diagnostic codes are rendered (#5317)
(DonIsaac)
- d236554 parser: Move `JSXIdentifier` conversion code into parser
(#5345) (overlookmotel)
- bc59dd2 parser: Improve example for `byte_search!` macro usage (#5234)
(overlookmotel)
- a3ddfdd parser: Improve lexer pointer maths (#5233) (overlookmotel)
- 3ae94b8 semantic: Change `build_module_record` to accept &Path instead
of PathBuf (Boshen)
- 05d25e2 semantic: Combine add scope methods (#5262) (overlookmotel)
- fdedc0f semantic: Transform checker: rename `SemanticData` to
`Scoping` (#5261) (overlookmotel)
- 1086109 semantic: Transform checker do not output spans in errors
(#5260) (overlookmotel)
- af5713e semantic: Transform checker continue checks if missing IDs
(#5259) (overlookmotel)
- 943454f semantic: Update transform checker for no conditional scopes
(#5252) (overlookmotel)
- 892a7fa semantic: Replace `ref` syntax (#5253) (overlookmotel)
- cbb4725 semantic: Add comment to transform checker (#5250)
(overlookmotel)
- a17cf33 semantic: Remove `ScopeTree::child_ids` (#5232) (Boshen)
- d5a4940 semantic: Rewrite handling of label statement errors (#5138)
(Boshen)
- 94f60e7 span/source-type: Make `SourceType` factories `const` (#5241)
(DonIsaac)
- 0de844d transformer: Remove unnecessary code from JSX transform
(#5339) (overlookmotel)
- 5136f01 transformer: Remove unnecessary type annotation (#5131)
(overlookmotel)
- 260c9d2 transformer/es2015: Move all entry points to implementation of
Traverse trait (#5187) (Dunqing)
- 1645115 transformer/object-reset-spread: Make plugin initialization
unconditional (#5319) (Dunqing)
- d2666fe transformer/object-rest-spread: Move plugin-relates files to
`object_rest_spread` mod (#5320) (Dunqing)
- 7e2a7af transformer/react: Remove `CalculateSignatureKey`
implementation from refresh (#5289) (Dunqing)
- b43a394 traverse: Correct code comments (#5293) (overlookmotel)
- d71f0ed traverse: Inline all passthrough methods (#5279)
(overlookmotel)
- 188ce07 traverse: Improve safety via type system (#5277)
(overlookmotel)
- 0f4a8b3 traverse: Add debug asserts for safety invariants (#5272)
(overlookmotel)
- 341e42a traverse: Make `Ancestor` an owned type (#5269)
(overlookmotel)
- eba5033 traverse: Codegen `ChildScopeCollector` (#5119)
(overlookmotel)
- f771d7c traverse: Remove unnecessary imports (#5116) (overlookmotel)
- c6590ae traverse: Move generated files into separate folder (#5115)
(overlookmotel)
- fc2e9ad traverse: Remove support for `#[scope(if(...))]` attr (#5114)
(overlookmotel)
- 1ba11a3 traverse: Refactor `ChildScopeCollector` (#5112)
(overlookmotel)
- 40e2f6e traverse: Remove unnecessary branch in `ChildScopeCollector`
(#5111) (overlookmotel)
- b39c0d6 wasm: Add `source_type` for parser, replace class options with
plain object (#5217) (Kevin Deng 三咲智子)

### Testing

- 7009177 parser: Fix incorrect flow error test (Boshen)
- be7b8c6 semantic: Add `JSXIdentifierReference`-related tests (#5224)
(Dunqing)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-03 10:36:02 +08:00
oxc-bot
953344dd42
Release oxlint v0.9.2 (#5401)
## [0.9.2] - 2024-09-02

### Features

- f81e8a1 linter: Add `oxc/no-async-endpoint-handlers` (#5364)
(DonIsaac)
- b103737 linter: Improve no-accumulating-spread (#5302) (camc314)
- 9c22ce9 linter: Add hyperlinks to diagnostic messages (#5318)
(DonIsaac)
- 1967c67 linter/eslint: Implement no-new-func (#5360) (dalaoshu)
- b867e5f linter/eslint-plugin-promise: Implement catch-or-return
(#5121) (Jelle van der Waa)
- 8d781e7 linter/oxc: Differentiate between array/object in
`no-accumulating-spread` loop diagnostic (#5375) (camc314)
- db55444 linter/oxc: Add fixer for `double-comparisons` (#5378)
(camc314)
- e5c755a linter/promise: Add `spec-only` rule (#5124) (Jelle van der
Waa)
- 4c0861f linter/unicorn: Add fixer for `prefer-type-error` (#5311)
(camc314)
- 084c2d1 linter/vitest: Implement prefer-to-be-object (#5321)
(dalaoshu)

### Bug Fixes

- 11b93af linter/unicorn: Consistent-function-scoping false positive on
assignment expression (#5312) (Arian94)

### Performance

- f052a6d linter: `react/jsx_no_undef` faster check for unbound
references (#5349) (overlookmotel)
- 05636b7 linter: Avoid unnecessary work in `jsx_a11y/anchor_is_valid`
rule (#5341) (overlookmotel)

### Refactor

- afb038e linter: `react/jsx_no_undef` use loop instead of recursion
(#5347) (overlookmotel)
- fe62687 linter: Simplify skipping JSX elements in
`unicorn/consistent_function_scoping` (#5351) (overlookmotel)
- 381d9fe linter: Shorten code in `react/jsx_no_useless_fragment`
(#5350) (overlookmotel)
- 83b9a82 linter: Fix indentation in
`nextjs/no_script_component_in_head` rule (#5338) (overlookmotel)
- 89f0188 linter: Improve docs for `react/jsx_no_target_blank` rule
(#5342) (overlookmotel)
- 57050ab linter: Shorten code in
`jsx_a11y/aria_activedescendant_has_tabindex` rule (#5340)
(overlookmotel)
- ed31d67 linter/jest: Fix indentation in code comment (#5372) (camc314)
- 2499cb9 linter/oxc: Update rule docs for `erasing-op` (#5376)
(camc314)
- 69493d2 linter/oxc: Improve diagnostic for `no-accumulating-spread` in
loops (#5374) (camc314)
- 024b585 linter/oxc: Improve code comment for `no-accumulating-spread`
(#5373) (camc314)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-02 20:30:22 +08:00
oxc-bot
53ff3493ef
Release oxlint v0.9.1 (#5316)
## [0.9.1] - 2024-08-29

### Features

- 6633972 linter: Add fixer for `no-empty` (#5276) (camc314)
- a58e448 linter/eslint: Add fixer to `no-var` (#5144) (camc314)
- a6e9769 linter/jsx-a11y: Add `label-has-associated-control` (#5163)
(Billy Levin)
- c8e8532 linter/unicorn: Add fixer to `throw-new-error` (#5275)
(camc314)
- 7ccde4b linter/unicorn: Add fixer to `prefer-date-now` (#5147)
(camc314)

### Bug Fixes

- 76e86f8 linter: Eslint-plugin-unicorn prefer-spread wrong linter
suggestion on variables of type string (#5265) (Arian94)
- b39544e linter/jest: Fixer for `prefer-jest-mocked` creates invalid
LHS expressions (#5243) (camc314)
- 9953fa5 linter/no-null: Incorrect fixer for `NullLiteral` within
`ReturnStatement` (#5247) (Dunqing)
- 318479e linter/no-unused-vars: Mark the class/function in the new
expression as used (#5306) (magic-akari)

### Refactor

- fa1d460 linter: Clean up Fixer and Message (#5308) (DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-29 13:04:52 +08:00
Billy Levin
a6e97690a7
feat(linter/jsx-a11y): add label-has-associated-control (#5163) 2024-08-26 23:33:55 -04:00
overlookmotel
b479afdafc ci: transformer benchmark measure transformer itself only (#5193)
Transformer benchmark measure only the transformer itself. Parse, generate `Semantic`, and drop `Semantic` outside of the measured section.

This should:

1. Give us greater visibility of how changes to transformer affect its performance.
2. Reduce variance in transformer benchmarks, since they will no longer include the variance introduced by `SemanticBuilder`.

Not ready to merge yet. We should first add an "end to end" benchmark testing the entire compilation process (parse - semantic - transform - minify - codegen).

This PR depends on https://github.com/Boshen/criterion2.rs/pull/49. This PR currently makes Oxc's dependency on `criterion2` a git dependency on that PR's branch. That can be changed once the upstream PR is merged.
2024-08-27 01:53:27 +00:00
Kevin Deng 三咲智子
1af7f04a36
feat(wasm): output panic info to console (#5238)
Playground Preview:
<img width="1769" alt="image"
src="https://github.com/user-attachments/assets/12143fb5-f6a6-48bc-8dee-cf85b6c52392">
2024-08-27 09:12:15 +08:00
oxc-bot
2a001a043c
Release oxlint v0.9.0 (#5219)
## [0.9.0] - 2024-08-26

- 5946748 linter: [**BREAKING**] Parse and display syntax errors for
regular expressions (#5214) (Boshen)

- b894d3b linter: [**BREAKING**] Make `no-unused-vars` correctness
(#5081) (DonIsaac)

### Features

- 1ce9630 linter/config: Implement FromIterator for LintPluginOptions
(#5102) (DonIsaac)
- 34bfaf6 linter/react: Add fixer to `jsx-props-no-spread-multi` (#5145)
(camc314)
- 982bd6e linter/unicorn: Add fixer to `require-array-join-separator`
(#5152) (camc314)
- a6704bd linter/unicorn: Add fixer to `prefer-set-size` (#5149)
(camc314)
- ac7edcc linter/unicorn: Add fixer to `prefer-array-some` (#5153)
(camc314)
- 1d01aa3 linter/unicorn: Add partial fixer for `prefer-array-flat`
(#5143) (camc314)
- 22d57f9 linter/unicorn: Add fixer to `prefer-string-slice` (#5150)
(Cameron)
- 2fe4415 linter/unicorn: Add fixer to `no-redundant-roles` (#5146)
(Cameron)
- d35c6f5 linter/unicorn: Add fixer to `prefer-regexp-test` (#5151)
(Cameron)
- 27db769 linter/unicorn: Add fixer to `text-encoding-identifier-case`
(#5154) (Cameron)
- f7958c4 linter/unicorn: Add prefer-structured-clone (#5095) (Jelle van
der Waa)
- 004ffa0 linter/vitest: Implement `prefer-each` (#5203) (dalaoshu)

### Bug Fixes

- aaaf26c linter: Error in fixer for prefer-to-have-length (#5197)
(dalaoshu)
- 1f5b6b6 linter: Bug in fixer for prefer-to-have-length (#5164)
(dalaoshu)
- 7eb052e linter: `no-hex-escape` fixer removing regex flags (#5137)
(Cameron)
- 76c66b4 linter/max-lines: Point span to end of file for disable
directive to work (#5117) (Boshen)
- 8ff6f2c linter/no-unused-vars: Panic on UsingDeclarations (#5206)
(DonIsaac)
- d29042e linter/no-unused-vars: Function expression in implicit arrow
function return (#5155) (DonIsaac)
- 36e4a28 linter/no-unused-vars: Panic in variable declarator usage
checks (#5160) (DonIsaac)
- ba62a71 linter/react: Fixed false positive with missing key inside
React.Children.toArray() for fragments (#5133) (Earl Chase)
- fd1031a linter/unicorn: Breaking fixer in case statements for
`no-null` (#5176) (DonIsaac)
- 7b86ed6 linter/unicorn: Handle type casts and parens in `no-null`
(#5175) (Don Isaac)
- b629e16 linter/unicorn: Improve diagnostic message for `no-null`
(#5172) (DonIsaac)

### Performance
- ce454cf Use simdutf8 to validate UTF-8 when reading files (#5196)
(dalaoshu)

### Refactor

- 543cad6 codegen: Remove some pub APIs (Boshen)
- 0d3661a linter: Remove meaningless `span0` (#5209) (dalaoshu)
- 2a91ef1 linter: `eslint/no_redeclare` rule use `run_on_symbol` not
`run_once` (#5201) (overlookmotel)
- 33599b0 linter: Split options into multiple files (#5101) (DonIsaac)
- 7ab6152 linter/unicorn: Clean up `no-null` (#5174) (DonIsaac)

### Testing

- a877e5a linter/no-unused-vars: Ensure type annotations on property
accessors are considered used (#5183) (DonIsaac)
- 7886618 linter/unicorn: Add fixer tests for `no-null` (#5173)
(DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-26 16:50:15 +08:00
renovate[bot]
04c5ca2ceb
chore(deps): update rust crates (#5208)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [flate2](https://togithub.com/rust-lang/flate2-rs) |
workspace.dependencies | patch | `1.0.31` -> `1.0.33` |
| [prettyplease](https://togithub.com/dtolnay/prettyplease) |
workspace.dependencies | patch | `0.2.20` -> `0.2.22` |
| [quote](https://togithub.com/dtolnay/quote) | workspace.dependencies |
patch | `1.0.36` -> `1.0.37` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies
| patch | `1.0.208` -> `1.0.209` |
| [serde_json](https://togithub.com/serde-rs/json) |
workspace.dependencies | patch | `1.0.125` -> `1.0.127` |

---

### Release Notes

<details>
<summary>rust-lang/flate2-rs (flate2)</summary>

###
[`v1.0.33`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.33):
- fix minimal manifest versions

[Compare
Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.32...1.0.33)

#### What's Changed

- Fix msrv: Run msrv checks with minimal versions by
[@&#8203;NobodyXu](https://togithub.com/NobodyXu) in
[https://github.com/rust-lang/flate2-rs/pull/425](https://togithub.com/rust-lang/flate2-rs/pull/425)

#### New Contributors

- [@&#8203;NobodyXu](https://togithub.com/NobodyXu) made their first
contribution in
[https://github.com/rust-lang/flate2-rs/pull/425](https://togithub.com/rust-lang/flate2-rs/pull/425)

**Full Changelog**:
https://github.com/rust-lang/flate2-rs/compare/1.0.32...1.0.33

###
[`v1.0.32`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.32):
- turn panic into error

[Compare
Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.31...1.0.32)

#### What's Changed

##### Fix

- Return error instead of packing on Z_MEM_ERROR by
[@&#8203;crazymerlyn](https://togithub.com/crazymerlyn) in
[https://github.com/rust-lang/flate2-rs/pull/423](https://togithub.com/rust-lang/flate2-rs/pull/423)

##### Other

- prepare new release by [@&#8203;Byron](https://togithub.com/Byron) in
[https://github.com/rust-lang/flate2-rs/pull/416](https://togithub.com/rust-lang/flate2-rs/pull/416)
- update miniz_oxide dependency to 0.8.x by
[@&#8203;oyvindln](https://togithub.com/oyvindln) in
[https://github.com/rust-lang/flate2-rs/pull/420](https://togithub.com/rust-lang/flate2-rs/pull/420)
- update maintenance guide with recent news by
[@&#8203;Byron](https://togithub.com/Byron) in
[https://github.com/rust-lang/flate2-rs/pull/419](https://togithub.com/rust-lang/flate2-rs/pull/419)
- Check minimal version of Rust that compiles by
[@&#8203;jongiddy](https://togithub.com/jongiddy) in
[https://github.com/rust-lang/flate2-rs/pull/421](https://togithub.com/rust-lang/flate2-rs/pull/421)
- Remove non-existent build in CI by
[@&#8203;jongiddy](https://togithub.com/jongiddy) in
[https://github.com/rust-lang/flate2-rs/pull/422](https://togithub.com/rust-lang/flate2-rs/pull/422)

#### New Contributors

- [@&#8203;crazymerlyn](https://togithub.com/crazymerlyn) made their
first contribution in
[https://github.com/rust-lang/flate2-rs/pull/423](https://togithub.com/rust-lang/flate2-rs/pull/423)

**Full Changelog**:
https://github.com/rust-lang/flate2-rs/compare/1.0.31...1.0.32

</details>

<details>
<summary>dtolnay/prettyplease (prettyplease)</summary>

###
[`v0.2.22`](https://togithub.com/dtolnay/prettyplease/releases/tag/0.2.22)

[Compare
Source](https://togithub.com/dtolnay/prettyplease/compare/0.2.21...0.2.22)

- Support formatting precise capture `use<>` syntax
([#&#8203;80](https://togithub.com/dtolnay/prettyplease/issues/80))

###
[`v0.2.21`](https://togithub.com/dtolnay/prettyplease/releases/tag/0.2.21)

[Compare
Source](https://togithub.com/dtolnay/prettyplease/compare/0.2.20...0.2.21)

- Support formatting tail-call `become` expressions
([#&#8203;79](https://togithub.com/dtolnay/prettyplease/issues/79))

</details>

<details>
<summary>dtolnay/quote (quote)</summary>

### [`v1.0.37`](https://togithub.com/dtolnay/quote/releases/tag/1.0.37)

[Compare
Source](https://togithub.com/dtolnay/quote/compare/1.0.36...1.0.37)

- Implement ToTokens for CStr and CString
([#&#8203;283](https://togithub.com/dtolnay/quote/issues/283))

</details>

<details>
<summary>serde-rs/serde (serde)</summary>

###
[`v1.0.209`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.209)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.208...v1.0.209)

- Fix deserialization of empty structs and empty tuples inside of
untagged enums
([#&#8203;2805](https://togithub.com/serde-rs/serde/issues/2805), thanks
[@&#8203;Mingun](https://togithub.com/Mingun))

</details>

<details>
<summary>serde-rs/json (serde_json)</summary>

###
[`v1.0.127`](https://togithub.com/serde-rs/json/releases/tag/1.0.127)

[Compare
Source](https://togithub.com/serde-rs/json/compare/1.0.126...1.0.127)

- Add more removal methods to OccupiedEntry
([#&#8203;1179](https://togithub.com/serde-rs/json/issues/1179), thanks
[@&#8203;GREsau](https://togithub.com/GREsau))

###
[`v1.0.126`](https://togithub.com/serde-rs/json/releases/tag/1.0.126)

[Compare
Source](https://togithub.com/serde-rs/json/compare/1.0.125...1.0.126)

- Improve string parsing on targets that use 32-bit pointers but also
have fast 64-bit integer arithmetic, such as
aarch64-unknown-linux-gnu_ilp32 and x86\_64-unknown-linux-gnux32
([#&#8203;1182](https://togithub.com/serde-rs/json/issues/1182), thanks
[@&#8203;CryZe](https://togithub.com/CryZe))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-26 03:19:54 +00:00
dalaoshu
ce454cf426
perf: use simdutf8 to validate UTF-8 when reading files (#5196)
closes #5191

---------

Co-authored-by: overlookmotel <j@dummett.org>
2024-08-26 10:14:21 +08:00
Boshen
dd3ad4d68e
chore(regular_expression): remove circular dependency
Error: Circular dependency detected: oxc_parser -> oxc_regular_expression
2024-08-23 16:16:10 +08:00
Boshen
fc4eba5096
chore: publish oxc_regular_expression 2024-08-23 16:16:10 +08:00
oxc-bot
0b900110a2
Release crates v0.25.0 (#5107)
## [0.25.0] - 2024-08-23

- 78f135d ast: [**BREAKING**] Remove `ReferenceFlag` from
`IdentifierReference` (#5077) (Boshen)

- f2b8d82 semantic: [**BREAKING**] `ScopeTree::get_child_ids` +
`get_child_ids_mut` return value not `Option` (#5058) (overlookmotel)

- 5f4c9ab semantic: [**BREAKING**] Rename `SymbolTable::get_flag` to
`get_flags` (#5030) (overlookmotel)

- 58bf215 semantic: [**BREAKING**] Rename `Reference::flag` and
`flag_mut` methods to plural (#5025) (overlookmotel)

- c4c08a7 ast: [**BREAKING**] Rename
`IdentifierReference::reference_flags` field (#5024) (overlookmotel)

- d262a58 syntax: [**BREAKING**] Rename `ReferenceFlag` to
`ReferenceFlags` (#5023) (overlookmotel)

- c30e2e9 semantic: [**BREAKING**] `Reference::flag` method return
`ReferenceFlag` (#5019) (overlookmotel)

- ce4d469 codegen: [**BREAKING**] Remove const generic `MINIFY` (#5001)
(Boshen)

- b2ff2df parser: [**BREAKING**] Remove builder pattern from `Parser`
struct (#5000) (Boshen)

- f88970b ast: [**BREAKING**] Change order of fields in CallExpression
(#4859) (Burlin)

### Features

- 714373d ast: `inherit_variants!` macro add `into_*` methods (#5005)
(overlookmotel)
- 6800e69 oxc: Add `Compiler` and `CompilerInterface` (#4954) (Boshen)
- 2b21be3 oxc_minifier: Define plugin with postfix wildcard (#4979)
(IWANABETHATGUY)
- afe728a parser: Parse regular expression with regex parser (#4998)
(Boshen)
- 4b49cf8 transformer: Always pass in symbols and scopes (#5087)
(Boshen)
- f51d3f9 transformer/nullish-coalescing-operator: Handles nullish
coalescing expression in the FormalParamter (#4975) (Dunqing)
- f794870 transformer/nullish-coalescing-operator: Generate the correct
binding name (#4974) (Dunqing)
- 72ff2c6 transformer/nullish-coalescing-operator: Add comments in top
of file (#4972) (Dunqing)
- 6b885fe traverse: Expose `generate_uid_based_on_node` and
`generate_uid_in_current_scope_based_on_node` from `TraverseCtx` (#4965)
(Dunqing)

### Bug Fixes

- 7f3129e ast: Correct code comment (#5004) (overlookmotel)
- 1bd9365 coverage: Correctly check semantic data after transform
(#5035) (Boshen)
- 185eb20 isolated_declarations: Namespaces that are default exported
should be considered for expando functions (#4935) (michaelm)
- 2a5e15d npm: `libc` field should not be `null` (Boshen)
- efbdced parser: Only show flow error if it's a flow file (#5069)
(Boshen)
- ad2be97 semantic: Incorrect semantic check for label has same name
(#5041) (heygsc)
- d5de97d semantic: Transform checker check reference flags (#5092)
(overlookmotel)
- 90c74ee semantic: Transform checker check reference symbol IDs (#5090)
(overlookmotel)
- a8005b9 semantic: Transform checker check symbol redeclarations
(#5089) (overlookmotel)
- 205bff7 semantic: Transform checker check symbol references (#5088)
(overlookmotel)
- 4a57086 semantic: Transform checker check symbol IDs (#5078)
(overlookmotel)
- ea7d216 semantic: Transform checker check symbol spans (#5076)
(overlookmotel)
- 1b6b27a semantic: Transform checker check symbol flags (#5074)
(overlookmotel)
- 6d87b0f semantic: Fix error message for duplicated label (#5071)
(Boshen)
- 05fff16 semantic: Transform checker compare binding symbol IDs (#5057)
(overlookmotel)
- f187b71 semantic: Transform checker compare scope children (#5056)
(overlookmotel)
- b52c6a4 semantic: Transform checker compare scope parents (#5055)
(overlookmotel)
- da64014 semantic: Transform checker catch more scope flags mismatches
(#5054) (overlookmotel)
- 67d1a96 semantic: Transform checker compare scope flags (#5052)
(overlookmotel)
- 863b9cb semantic: Transform checker handle conditional scopes (#5040)
(overlookmotel)
- 47029c4 semantic: Transform checker output symbol names in errors
(#5038) (overlookmotel)
- 6ffbd78 transformer: Remove an `AstBuilder::copy` call from TS
namespace transform (#4987) (overlookmotel)
- a8dfdda transformer: Remove an `AstBuilder::copy` call from TS module
transform (#4986) (overlookmotel)
- 1467eb3 transformer: Remove an `AstBuilder::copy` call from TS enum
transform (#4985) (overlookmotel)
- 1365feb transformer: Remove an `AstBuilder::copy` call for TS
`AssignmentTarget` transform (#4984) (overlookmotel)
- edacf93 transformer: Remove an `AstBuilder::copy` call (#4983)
(overlookmotel)
- 3b35332 transformer/logical-assignment-operators: Fix semantic errors
(#5047) (Dunqing)- b7db235 Comments gen regression (#5003)
(IWANABETHATGUY)

### Documentation

- 178d1bd transformer: Add documentation for exponentiation-operator
plugin (#5084) (Dunqing)
- d50eb72 transformer: Add documentation for `optional-catch-binding`
plugin (#5064) (Dunqing)
- 4425b17 transformer: Add documentation for
`logical-assignment-operators` plugin (#5012) (Dunqing)
- 1bd5853 transformer: Updated README re: order of methods (#4993)
(overlookmotel)

### Refactor

- a4247e9 allocator: Move `Box` and `Vec` into separate files (#5034)
(overlookmotel)
- cca7440 ast: Replace `AstBuilder::move_statement_vec` with `move_vec`
(#4988) (overlookmotel)
- 4012260 ast: `AstBuilder::move_identifier_reference` do not allocate
empty string (#4977) (overlookmotel)
- 96422b6 ast: Make AstBuilder non-exhaustive (#4925) (DonIsaac)
- ca70cc7 linter, mangler, parser, semantic, transformer, traverse,
wasm: Rename various `flag` vars to `flags` (#5028) (overlookmotel)
- 0f64d10 minifier: Remove duplicated helper `move_out_expression`
(#5007) (IWANABETHATGUY)
- cd9cf5e oxc: Remove `remove_whitespace` (Boshen)
- b4407c4 oxc,mangler: `oxc` crate add mangler; mangler use options API
(Boshen)
- 9da6a21 semantic: Rename transform checker output for reference symbol
mismatches (#5091) (overlookmotel)
- fb46eaf semantic: Add remap functions to transform checker (#5082)
(overlookmotel)
- a00bf18 semantic: Add `IdMapping` to transform checker (#5079)
(overlookmotel)
- b14a302 semantic: Transform checker: change symbol name mismatch error
(#5075) (overlookmotel)
- b8c6ce5 semantic: Rename vars in transform checker (#5072)
(overlookmotel)
- 7156fd2 semantic: Transform checker `Pair` structure (#5053)
(overlookmotel)
- 0ba6f50 semantic: Simplify raising errors in transform checker (#5051)
(overlookmotel)
- ee7ac8b semantic: Store all data in `PostTransformChecker` in
transform checker (#5050) (overlookmotel)
- 4e1f4ab semantic: Add `SemanticIds` to transformer checker (#5048)
(overlookmotel)
- c1da574 semantic: Add comments to transformer checker (#5045)
(overlookmotel)
- 8cded08 semantic: Rename error labels in transformer checker snapshots
(#5044) (overlookmotel)
- 602244f semantic: Rename vars in transformer checker (#5043)
(overlookmotel)
- ae94b9a semantic: Remove unused function params in transformer checker
(#5042) (overlookmotel)
- 586e15c semantic: Reformat transform checker errors (#5039)
(overlookmotel)
- d69e34e semantic: Fix indentation (#5037) (overlookmotel)
- 4336a32 semantic: Rename fields in snapshots from `flag` to `flags`
(#5032) (overlookmotel)
- 83dfb14 semantic: Rename vars from `flag` to `flags` (#5031)
(overlookmotel)
- 3b7de18 semantic: Rename `SemanticBuilder::current_reference_flags`
field (#5027) (overlookmotel)
- 0bacdd8 semantic: Rename `Reference::flag` field to `flags` (#5026)
(overlookmotel)
- 896b92f semantic: Correct typo in doc comment (#5009) (overlookmotel)
- d677b8e semantic: Do not reserve space in `resolved_references`
(#4962) (overlookmotel)
- a7ef30d semantic: `UnresolvedReferencesStack` contain only
`ReferenceId` (#4960) (overlookmotel)
- 59d15c7 semantic: `root_unresolved_references` contain only
`ReferenceId` (#4959) (overlookmotel)
- 7706523 span: Clarify `Atom` conversion methods lifetimes (#4978)
(overlookmotel)
- 4fdf26d transform_conformance: Add driver (#4969) (Boshen)
- 8d15e65 transformer: Use `into_member_expression` (#5006)
(overlookmotel)
- 4796ece transformer: TS annotations transform use `move_expression`
(#4982) (overlookmotel)
- a9fcf29 transformer/es2016: Move all entry points to implementation of
Traverse trait (#5085) (Dunqing)
- deda6ac transformer/es2019: Move all entry points to implementation of
Traverse trait (#5065) (Dunqing)
- 9df2f80 transformer/es2020: Move all entry points to implementation of
Traverse trait (#4973) (Dunqing)
- 3f9433c transformer/es2021: Move all entry points to implementation of
Traverse trait (#5013) (Dunqing)
- c60a50d transformer/exponentiation-operator: Use built-in
`ctx.clone_identifier_reference` (#5086) (Dunqing)
- bcc8da9 transformer/logical-assignment-operator: Use
`ctx.clone_identifier_reference` (#5014) (Dunqing)
- 38d4434 transformer/nullish-coalescing-operator: Move internal methods
to bottom of the file (#4996) (Dunqing)

### Testing

- 0df1a94 semantic: Add more symbol and reference checks to
`PostTransformChecker` (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-23 15:37:36 +08:00
oxc-bot
8ef85a43c0
Release oxlint v0.8.0 (#5104)
## [0.8.0] - 2024-08-23

- 5f4c9ab semantic: [**BREAKING**] Rename `SymbolTable::get_flag` to
`get_flags` (#5030) (overlookmotel)

- ce4d469 codegen: [**BREAKING**] Remove const generic `MINIFY` (#5001)
(Boshen)

- b2ff2df parser: [**BREAKING**] Remove builder pattern from `Parser`
struct (#5000) (Boshen)

- f88970b ast: [**BREAKING**] Change order of fields in CallExpression
(#4859) (Burlin)

### Features

- 2292606 linter: Typescript-eslint/no-wrapper-object-types (#5022)
(camc314)
- a0effab linter: Support more flexible config.globals values (#4990)
(Don Isaac)
- cdbfcfb linter: Start import fixer for eslint/no-unused-vars (#4849)
(DonIsaac)
- 915cb4d linter: Add dangerous fixer for oxc only used in recursion
(#4805) (camc314)
- 3f28c77 linter/eslint: Improve no-dupe-keys (#4943) (DonIsaac)
- e1582a5 linter/eslint: Improve no-duplicate-case rule (#4942)
(DonIsaac)
- f1e4611 linter/eslint-plugin-vitest: Implement no-conditional-in-test
(#4971) (dalaoshu)
- 14bf5d5 linter/eslint-plugin-vitest: Implement
no-restricted-vi-methods (#4956) (dalaoshu)
- ed9a1c4 linter/eslint-plugin-vitest: Implement
require-local-test-context-for-concurrent-snapshots (#4951) (dalaoshu)
- 7859f58 linter/eslint-plugin-vitest: Implement no-conditional-tests
(#4955) (dalaoshu)
- 841174f linter/no-unused-vars: Delete non-root arrows, skip `await`
(#5083) (Don Isaac)

### Bug Fixes

- 86d0c0c linter: Change consistent-function-scoping to suspicious
(#5010) (DonIsaac)
- 7b99386 linter: Missing closing ticks in some example blocks (#4994)
(DonIsaac)
- 9c64b12 linter: Improve no-zero-fractions rule for member expressions
and scientific notation (#4793) (Burlin)
- c43945c linter/consistent-function-scoping: Allow functions passed as
arguments (#5011) (Don Isaac)
- 9354779 linter/no-unused-vars: Give `argsIgnorePattern` the same
default behavior as `varsIgnorePattern` (#5018) (DonIsaac)
- 5a55dcf linter/no-unused-vars: `type` specifier not deleted for type
imports (#5029) (DonIsaac)
- 4081293 linter/no-unused-vars: Panic in fixer when removing
destructures (#4923) (Don Isaac)
- ddf83ff linter/react: Fixed false positive with missing key inside
React.Children.toArray() (#4945) (Earl Chase)
- 508644a linter/tree-shaking: Correct the calculation of `>>`, `<<` and
`>>>` (#4932) (mysteryven)
- e99836d linter/unicorn: Allow set spreading in no-useless-spread
(#4944) (Don Isaac)
- 5f8a7c2 oxlint: Rules in the configuration file are not being
correctly … (#4949) (dalaoshu)

### Documentation

- e331ca0 linter: Improve documentation for several rules (#4997)
(DonIsaac)
- cd9f1cd linter/consistent-function-scoping: Improve rule documentation
(#5015) (DonIsaac)

### Refactor

- eca6fdb linter: Move plugin options into separate struct (#5100)
(DonIsaac)
- 06f2d81 linter: Avoid unnecessary temp `Vec`s (#4963) (overlookmotel)
- 4cb8c37 linter: Move default_true to utils (#4947) (Don Isaac)
- ca70cc7 linter, mangler, parser, semantic, transformer, traverse,
wasm: Rename various `flag` vars to `flags` (#5028) (overlookmotel)
- 59d15c7 semantic: `root_unresolved_references` contain only
`ReferenceId` (#4959) (overlookmotel)

### Testing

- c21d735 linter/no-unused-vars: Add ignored destructuring test cases
(#4922) (Don Isaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-23 11:09:14 +08:00
Boshen
4b49cf8ce4 feat(transformer): always pass in symbols and scopes (#5087)
We no longer need to build semantic data inside the transformer.

The caller should be responsible for handling semantic data and its
errors.

The best way to achieve this in via `CompilerInterface`.

closes #3565
2024-08-22 16:06:31 +00:00
leaysgur
96f57984eb refactor(regular_expression): Misc refactoring for body_parser (#5062)
- Add examples to list all `RegExp`s in source code
- Refactor `MayContainStrings` related part
2024-08-22 11:21:41 +00:00
Boshen
afe728a73a feat(parser): parse regular expression with regex parser (#4998)
Many false positives and incorrect errors. @leaysgur Enjoy 😁

Run `just conformance` to update the snapshot.
2024-08-22 03:09:55 +00:00
IWANABETHATGUY
b7db235065
fix: comments gen regression (#5003)
try to fix: https://github.com/rolldown/rolldown/issues/2013
1. Before we only considering the ast is untouched, but considering the
scenario.
```js

const a = /*__PURE__*/ test(),
//    ^^^              ^^^^^^ is removed during transform
	b = a();

```
Then according to the previous algorithm, `PURE` will attach to `b =
a()`
2. Now, we try to attach comments as much as possible unless the
comments are separated by comments, for the case above, `PURE` will not
be attached to `a()` since the content between `b = a()` and `/*
__PURE__*/` is not all whitespace.
3. we added back `MoveMap`, for the special case 
```js
/*__NODE_SIDE_EFFECTS__*/ export const c = 100;
// ^^^^^^^^^^^^^^^^^^^^^         should be attached to first declarator,
//                        ^^^^^^ are not whitespace

```
2024-08-20 18:57:12 +08:00
Boshen
8d3f61bb54
chore(oxc_regular_expression): rename crate 2024-08-20 10:59:00 +08:00
leaysgur
368364d47b feat(regex_parser): Implement RegExp parser (#3824)
Part of #1164

## Progress updates 🗞️

Waiting for the review and advice, while thinking how to handle escaped string when `new RegExp(pat)`.

## TODOs

- [x] `RegExp(Literal = Body + Flags)#parse()` structure
- [x] Base `Reader` impl to handle both unicode(u32) and utf-16(u16) units
- [x] Global `Span` and local offset conversion
- [x] Design AST shapes
  - [x] Keep `enum` size small by `Box<'a, T>`
  - [x] Rework AST shapes
- [x] Split body and flags w/ validating literal
- [x] Parse `RegExpFlags`
- [x] Parse `RegExpBody` = `Pattern`
- [x] Parse `Pattern` > `Disjunction`
- [x] Parse `Disjunction` > `Alternative`
- [x] Parse `Alternative` > `Term`
- [x] Parse `Term` > `Assertion`
	- [x] Parse `BoundaryAssertion`
	- [x] Parse `LookaroundAssertion`
- [x] Parse `Term` > `Quantifier`
- [x] Parse `Term` > `Atom`
	- [x] Parse `Atom` > `PatternCharacter`
	- [x] Parse `Atom` > `.`
	- [x] Parse `Atom` > `\AtomEscape`
		- [x] Parse `\AtomEscape` > `DecimalEscape`
		- [x] Parse `\AtomEscape` > `CharacterClassEscape`
			- [x] Parse `CharacterClassEscape` > `\d, \D, \s, \S, \w, \W`
			- [x] Parse `CharacterClassEscape` > `\p{UnicodePropertyValueExpression}, \P{UnicodePropertyValueExpression}`
		- [x] Parse `\AtomEscape` > `CharacterEscape`
			- [x] Parse `CharacterEscape` > `ControlEscape`
			- [x] Parse `CharacterEscape` > `c AsciiLetter`
			- [x] Parse `CharacterEscape` > `0`
			- [x] Parse `CharacterEscape` > `HexEscapeSequence`
			- [x] Parse `CharacterEscape` > `RegExpUnicodeEscapeSequence`
			- [x] Parse `CharacterEscape` > `IdentityEscape`
		- [x] Parse `\AtomEscape` > `kGroupName`
	- [x] Parse `Atom` > `[CharacterClass]`
    	- [x] Parse `[CharacterClass]` > `ClassContents` > `[~UnicodeSetsMode] NonemptyClassRanges`
    	- [x] Parse `[CharacterClass]` > `ClassContents` > `[+UnicodeSetsMode] ClassSetExpression`
          - [x] Parse `ClassSetExpression` > `ClassUnion`
          - [x] Parse `ClassSetExpression` > `ClassIntersection`
          - [x] Parse `ClassSetExpression` > `ClassSubtraction`
          - [x] Parse `ClassSetExpression` > `ClassSetOperand`
          - [x] Parse `ClassSetExpression` > `ClassSetRange`
          - [x] Parse `ClassSetExpression` > `ClassSetCharacter`
	- [x] Parse `Atom` > `(GroupSpecifier)`
	- [x] Parse `Atom` > `(?:Disjunction)`
- [x] Annex B
    - [x] Parse `QuantifiableAssertion`
	- [x] Parse `ExtendedAtom`
      - [x] Parse `ExtendedAtom` > `\ [lookahead = c]`
      - [x] Parse `ExtendedAtom` > `InvalidBracedQuantifier`
      - [x] Parse `ExtendedAtom` > `ExtendedPatternCharacter`
      - [x] Parse `ExtendedAtom` > `\AtomEscape` > `CharacterEscape` > `LegacyOctalEscapeSequence`
- [x] Early errors
	- [x] Pattern :: Disjunction(1/2)
	- [x] Pattern :: Disjunction(2/2)
	- [x] QuantifierPrefix :: { DecimalDigits , DecimalDigits }
	- [x] ExtendedAtom :: InvalidBracedQuantifier (Annex B)
	- [x] AtomEscape :: k GroupName
	- [x] AtomEscape :: DecimalEscape
	- [x] NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents(1/2)
	- [x] NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents(2/2)
	- [x] NonemptyClassRanges :: ClassAtom - ClassAtom ClassContents(Annex B)
	- [x] NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtom ClassContents(1/2)
	- [x] NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtom ClassContents(2/2)
	- [x] NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtom ClassContents(Annex B)
	- [x] RegExpIdentifierStart :: \ RegExpUnicodeEscapeSequence
	- [x] RegExpIdentifierStart :: UnicodeLeadSurrogate UnicodeTrailSurrogate
	- [x] RegExpIdentifierPart :: \ RegExpUnicodeEscapeSequence
	- [x] RegExpIdentifierPart :: UnicodeLeadSurrogate UnicodeTrailSurrogate
	- [x] UnicodePropertyValueExpression :: UnicodePropertyName = UnicodePropertyValue(1/2)
	- [x] UnicodePropertyValueExpression :: UnicodePropertyName = UnicodePropertyValue(2/2)
	- [x] UnicodePropertyValueExpression :: LoneUnicodePropertyNameOrValue(1/2)
	- [x] UnicodePropertyValueExpression :: LoneUnicodePropertyNameOrValue(2/2)
	- [x] CharacterClassEscape :: P{ UnicodePropertyValueExpression }
	- [x] CharacterClass :: [^ ClassContents ]
	- [x] NestedClass :: [^ ClassContents ]
	- [x] ClassSetRange :: ClassSetCharacter - ClassSetCharacter
- [x] Add `Span` to `Err(OxcDiagnostic::error())` calls
- [x] Perf improvement
	- [x] `Reader#peek()` should avoid `iter.next()` equivalent
	- [x] ~~Use `char` everywhere and split and push 2 surrogates(pair) for `Character`?~~
	- [x] ~~Try 1(+1) loop parsing for capturing groups?~~

## Follow up

- [x] @Boshen Test suite > #4242
  - [x] Investigate CI errors...
- Next...
  - Support ES2025 Duplicate named capturing groups?
  - Support ES20XX Stage3 Modifiers?
2024-08-20 02:19:24 +00:00
DonIsaac
7c6bae2d65 feat(website): add link to rule source on docs page (#4995)
![image](https://github.com/user-attachments/assets/70e02c73-5d28-443e-91b0-f32d0623a1ca)
2024-08-19 20:40:14 +00:00
Boshen
4fdf26dac8 refactor(transform_conformance): add driver (#4969) 2024-08-19 07:27:39 +00:00
renovate[bot]
5f074d03c9
chore(deps): update rust crates (#4961)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [indexmap](https://togithub.com/indexmap-rs/indexmap) |
workspace.dependencies | minor | `2.3.0` -> `2.4.0` |
| [markdown](https://togithub.com/wooorm/markdown-rs) | dev-dependencies
| patch | `1.0.0-alpha.19` -> `1.0.0-alpha.20` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies
| patch | `1.0.206` -> `1.0.208` |
| [serde_json](https://togithub.com/serde-rs/json) |
workspace.dependencies | patch | `1.0.124` -> `1.0.125` |
| [tokio](https://tokio.rs)
([source](https://togithub.com/tokio-rs/tokio)) | workspace.dependencies
| patch | `1.39.2` -> `1.39.3` |
| [wasm-bindgen](https://rustwasm.github.io/)
([source](https://togithub.com/rustwasm/wasm-bindgen)) |
workspace.dependencies | patch | `0.2.92` -> `0.2.93` |

---

### Release Notes

<details>
<summary>indexmap-rs/indexmap (indexmap)</summary>

###
[`v2.4.0`](https://togithub.com/indexmap-rs/indexmap/blob/HEAD/RELEASES.md#240)

[Compare
Source](https://togithub.com/indexmap-rs/indexmap/compare/2.3.0...2.4.0)

- Added methods `IndexMap::append` and `IndexSet::append`, moving all
items from
one map or set into another, and leaving the original capacity for
reuse.

</details>

<details>
<summary>wooorm/markdown-rs (markdown)</summary>

###
[`v1.0.0-alpha.20`](https://togithub.com/wooorm/markdown-rs/releases/tag/1.0.0-alpha.20)

[Compare
Source](https://togithub.com/wooorm/markdown-rs/compare/1.0.0-alpha.19...1.0.0-alpha.20)

- [`6144c58`](https://togithub.com/wooorm/markdown-rs/commit/6144c58)
Fix padded code (text) in mdast
by [@&#8203;yshavit](https://togithub.com/yshavit) in
[https://github.com/wooorm/markdown-rs/pull/123](https://togithub.com/wooorm/markdown-rs/pull/123)

**Full Changelog**:
https://github.com/wooorm/markdown-rs/compare/1.0.0-alpha.19...1.0.0-alpha.20

</details>

<details>
<summary>serde-rs/serde (serde)</summary>

###
[`v1.0.208`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.208)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.207...v1.0.208)

- Support serializing and deserializing unit structs in a `flatten`
field ([#&#8203;2802](https://togithub.com/serde-rs/serde/issues/2802),
thanks [@&#8203;jonhoo](https://togithub.com/jonhoo))

###
[`v1.0.207`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.207)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.206...v1.0.207)

- Improve interactions between `flatten` attribute and
`skip_serializing`/`skip_deserializing`
([#&#8203;2795](https://togithub.com/serde-rs/serde/issues/2795), thanks
[@&#8203;Mingun](https://togithub.com/Mingun))

</details>

<details>
<summary>serde-rs/json (serde_json)</summary>

###
[`v1.0.125`](https://togithub.com/serde-rs/json/releases/tag/1.0.125)

[Compare
Source](https://togithub.com/serde-rs/json/compare/v1.0.124...1.0.125)

- Speed up \uXXXX parsing and improve handling of unpaired surrogates
when deserializing to bytes
([#&#8203;1172](https://togithub.com/serde-rs/json/issues/1172),
[#&#8203;1175](https://togithub.com/serde-rs/json/issues/1175), thanks
[@&#8203;purplesyringa](https://togithub.com/purplesyringa))

</details>

<details>
<summary>tokio-rs/tokio (tokio)</summary>

###
[`v1.39.3`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.39.3):
Tokio v1.39.3

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.39.2...tokio-1.39.3)

### 1.39.3 (August 17th, 2024)

This release fixes a regression where the unix socket api stopped
accepting the abstract socket namespace. ([#&#8203;6772])

[#&#8203;6772]: https://togithub.com/tokio-rs/tokio/pull/6772

</details>

<details>
<summary>rustwasm/wasm-bindgen (wasm-bindgen)</summary>

###
[`v0.2.93`](https://togithub.com/rustwasm/wasm-bindgen/blob/HEAD/CHANGELOG.md#0293)

[Compare
Source](https://togithub.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Released 2024-08-13

##### Added

- Allow exporting functions named `default`. Throw error in
wasm-bindgen-cli if --target web and
    an exported symbol is named `default`.
    [#&#8203;3930](https://togithub.com/rustwasm/wasm-bindgen/pull/3930)

- Added support for arbitrary expressions when using
`#[wasm_bindgen(typescript_custom_section)]`.
    [#&#8203;3901](https://togithub.com/rustwasm/wasm-bindgen/pull/3901)

-   Implement `From<NonNull<T>>` for `JsValue`.
    [#&#8203;3877](https://togithub.com/rustwasm/wasm-bindgen/pull/3877)

- Add method `copy_within` for TypedArray, add methods
`find_last`,`find_last_index` for Array.
    [#&#8203;3888](https://togithub.com/rustwasm/wasm-bindgen/pull/3888)

-   Added support for returning `Vec`s from async functions.
    [#&#8203;3630](https://togithub.com/rustwasm/wasm-bindgen/pull/3630)

-   Added bindings for `InputDeviceInfo` and `MediaTrackCapabilities`.
    [#&#8203;3935](https://togithub.com/rustwasm/wasm-bindgen/pull/3935)

-   Add bindings for `RTCRtpReceiver.getCapabilities(DOMString)` method.
    [#&#8203;3941](https://togithub.com/rustwasm/wasm-bindgen/pull/3941)

-   Add bindings for `VisualViewport`.
    [#&#8203;3931](https://togithub.com/rustwasm/wasm-bindgen/pull/3931)

-   Add bindings for `queueMicrotask`.
    [#&#8203;3981](https://togithub.com/rustwasm/wasm-bindgen/pull/3981)

-   Add experimental bindings for User Agent Client Hints API
    [#&#8203;3989](https://togithub.com/rustwasm/wasm-bindgen/pull/3989)

-   Add bindings for `FocusOptions`.
    [#&#8203;3996](https://togithub.com/rustwasm/wasm-bindgen/pull/3996)

-   Add bindings for `RTCRtpReceiver.jitterBufferTarget`.
    [#&#8203;3968](https://togithub.com/rustwasm/wasm-bindgen/pull/3968)

-   Generate getters for all WebIDL dictionary types.
    [#&#8203;3993](https://togithub.com/rustwasm/wasm-bindgen/pull/3993)

- Support for iterable in WebIDL. Gives `entries`, `keys`, `values`
methods for regular and asynchronous, as well as `for_each` for regular,
iterables.
    [#&#8203;3962](https://togithub.com/rustwasm/wasm-bindgen/pull/3962)

-   Add bindings for `HTMLTableCellElement.abbr` and `scope` properties.
    [#&#8203;3972](https://togithub.com/rustwasm/wasm-bindgen/pull/3972)

-   Add WebIDL definitions relating to `Popover API`.
    [#&#8203;3977](https://togithub.com/rustwasm/wasm-bindgen/pull/3977)

- Added the `thread_stack_size` property to the object parameter of
`default()` (`init()`) and `initSync()`, making it possible to set the
stack size of spawned threads. `__wbindgen_thread_destroy()` now has a
third optional parameter for the stack size, the default stack size is
assumed when not passing it. When calling from the thread to be
destroyed, by passing no parameters, the correct stack size is
determined internally.
    [#&#8203;3995](https://togithub.com/rustwasm/wasm-bindgen/pull/3995)

-   Added bindings to the Device Memory API.
    [#&#8203;4011](https://togithub.com/rustwasm/wasm-bindgen/pull/4011)

- Added support for WebIDL records. This added new methods to various
APIs, notably `ClipboardItem()`, `GPUDeviceDescriptor.requiredLimits`
and `Header()`.
    [#&#8203;4030](https://togithub.com/rustwasm/wasm-bindgen/pull/4030)

- Added an official MSRV policy. Library MSRV changes will be
accompanied by a minor version bump. CLI tool MSRV can change with any
version bump.
    [#&#8203;4038](https://togithub.com/rustwasm/wasm-bindgen/pull/4038)

-   Added bindings to `NavigatorOptions.vibrate`.
    [#&#8203;4041](https://togithub.com/rustwasm/wasm-bindgen/pull/4041)

- Added an experimental Node.JS ES module target, in comparison the
current `node` target uses CommonJS, with `--target
experimental-nodejs-module` or when testing with
`wasm_bindgen_test_configure!(run_in_node_experimental)`.
    [#&#8203;4027](https://togithub.com/rustwasm/wasm-bindgen/pull/4027)

- Added importing strings as `JsString` through
`#[wasm_bindgen(thread_local, static_string)] static STRING: JsString =
"a string literal";`.
    [#&#8203;4055](https://togithub.com/rustwasm/wasm-bindgen/pull/4055)

- Added experimental test coverage support for
`wasm-bindgen-test-runner`, see the guide for more information.
    [#&#8203;4060](https://togithub.com/rustwasm/wasm-bindgen/pull/4060)

##### Changed

-   Stabilize Web Share API.
    [#&#8203;3882](https://togithub.com/rustwasm/wasm-bindgen/pull/3882)

- Generate JS bindings for WebIDL dictionary setters instead of using
`Reflect`. This increases the size of the Web API bindings but should be
more performant. Also, importing getters/setters from JS now supports
specifying the JS attribute name as a string, e.g.
`#[wasm_bindgen(method, setter = "x-cdm-codecs")]`.
    [#&#8203;3898](https://togithub.com/rustwasm/wasm-bindgen/pull/3898)

- Greatly improve the performance of sending WebIDL 'string enums'
across the JavaScript boundary by converting the enum variant string
to/from an int.
    [#&#8203;3915](https://togithub.com/rustwasm/wasm-bindgen/pull/3915)

-   Use `table.fill` when appropriate.
    [#&#8203;3446](https://togithub.com/rustwasm/wasm-bindgen/pull/3446)

-   Annotated methods in WebCodecs that throw.
    [#&#8203;3970](https://togithub.com/rustwasm/wasm-bindgen/pull/3970)

-   Update and stabilize the Clipboard API.
    [#&#8203;3992](https://togithub.com/rustwasm/wasm-bindgen/pull/3992)

- Deprecate builder-pattern type setters for WebIDL dictionary types and
introduce non-mutable setters instead.
    [#&#8203;3993](https://togithub.com/rustwasm/wasm-bindgen/pull/3993)

- Allow imported async functions to return any type that can be
converted from a `JsValue`.
    [#&#8203;3919](https://togithub.com/rustwasm/wasm-bindgen/pull/3919)

-   Update Web Authentication API to level 3.
    [#&#8203;4000](https://togithub.com/rustwasm/wasm-bindgen/pull/4000)

- Deprecate `AudioBufferSourceNode.onended` and
`AudioBufferSourceNode.stop()`.
    [#&#8203;4020](https://togithub.com/rustwasm/wasm-bindgen/pull/4020)

-   Increase default stack size for spawned threads from 1 to 2 MB.
    [#&#8203;3995](https://togithub.com/rustwasm/wasm-bindgen/pull/3995)

- Deprecated parameters to `default` (`init`) and `initSync` in favor of
an object.
    [#&#8203;3995](https://togithub.com/rustwasm/wasm-bindgen/pull/3995)

- Update `AbortSignal` and `AbortController` according to the WHATWG
specification.
    [#&#8203;4026](https://togithub.com/rustwasm/wasm-bindgen/pull/4026)

-   Update the Indexed DB API.
    [#&#8203;4027](https://togithub.com/rustwasm/wasm-bindgen/pull/4027)

- `UnwrapThrowExt for Result` now makes use of the required `Debug`
bound to display the error as well.
    [#&#8203;4035](https://togithub.com/rustwasm/wasm-bindgen/pull/4035)
    [#&#8203;4049](https://togithub.com/rustwasm/wasm-bindgen/pull/4049)

- MSRV of CLI tools bumped to v1.76. This does not affect libraries like
`wasm-bindgen`, `js-sys` and `web-sys`!
    [#&#8203;4037](https://togithub.com/rustwasm/wasm-bindgen/pull/4037)

- Filtered files in published crates, significantly reducing the package
size and notably excluding any bash files.
    [#&#8203;4046](https://togithub.com/rustwasm/wasm-bindgen/pull/4046)

- Deprecated `JsStatic` in favor of `#[wasm_bindgen(thread_local)]`,
which creates a `std:🧵:LocalKey`. The syntax is otherwise the
same.
    [#&#8203;4057](https://togithub.com/rustwasm/wasm-bindgen/pull/4057)

- Removed `impl Deref for JsStatic` when compiling with
`cfg(target_feature = "atomics")`, which was unsound.
    [#&#8203;4057](https://togithub.com/rustwasm/wasm-bindgen/pull/4057)

-   Updated the WebGPU WebIDL to the current draft as of 2024-08-05.
    [#&#8203;4062](https://togithub.com/rustwasm/wasm-bindgen/pull/4062)

-   Use object URLs for linked modules without `--split-linked-modules`.
    [#&#8203;4067](https://togithub.com/rustwasm/wasm-bindgen/pull/4067)

##### Fixed

- Copy port from headless test server when using
`WASM_BINDGEN_TEST_ADDRESS`.
    [#&#8203;3873](https://togithub.com/rustwasm/wasm-bindgen/pull/3873)

-   Fix `catch` not being thread-safe.
    [#&#8203;3879](https://togithub.com/rustwasm/wasm-bindgen/pull/3879)

-   Fix MSRV compilation.
    [#&#8203;3927](https://togithub.com/rustwasm/wasm-bindgen/pull/3927)

-   Fix `clippy::empty_docs` lint.
    [#&#8203;3946](https://togithub.com/rustwasm/wasm-bindgen/pull/3946)

- Fix missing target features in module when enabling reference types or
multi-value transformation.
    [#&#8203;3967](https://togithub.com/rustwasm/wasm-bindgen/pull/3967)

-   Fixed Rust values getting GC'd while still borrowed.
    [#&#8203;3940](https://togithub.com/rustwasm/wasm-bindgen/pull/3940)

- Fixed Rust values not getting GC'd if they were created via. a
constructor.
    [#&#8203;3940](https://togithub.com/rustwasm/wasm-bindgen/pull/3940)

-   Fix triggering `clippy::mem_forget` lint in exported structs.
    [#&#8203;3985](https://togithub.com/rustwasm/wasm-bindgen/pull/3985)

-   Fix MDN links to static interface methods.
    [#&#8203;4010](https://togithub.com/rustwasm/wasm-bindgen/pull/4010)

-   Fixed Deno support.
    [#&#8203;3990](https://togithub.com/rustwasm/wasm-bindgen/pull/3990)

-   Fix `__wbindgen_thread_destroy()` ignoring parameters.
    [#&#8203;3995](https://togithub.com/rustwasm/wasm-bindgen/pull/3995)

- Fix `no_std` support and therefor compiling with `default-features =
false`.
    [#&#8203;4005](https://togithub.com/rustwasm/wasm-bindgen/pull/4005)

-   Fix byte order for big-endian platforms.
    [#&#8203;4015](https://togithub.com/rustwasm/wasm-bindgen/pull/4015)

- Allow ex/importing structs, functions and parameters named with raw
identifiers.
    [#&#8203;4025](https://togithub.com/rustwasm/wasm-bindgen/pull/4025)

-   Implement a more reliable way to detect the stack pointer.
    [#&#8203;4036](https://togithub.com/rustwasm/wasm-bindgen/pull/4036)

- `#[track_caller]` is now always applied on `UnwrapThrowExt` methods
when not targetting `wasm32-unknown-unknown`.
    [#&#8203;4042](https://togithub.com/rustwasm/wasm-bindgen/pull/4042)

- Fixed linked modules emitting snippet files when not using
`--split-linked-modules`.
    [#&#8203;4066](https://togithub.com/rustwasm/wasm-bindgen/pull/4066)

***

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-19 00:07:21 +00:00
oxc-bot
5d0fb979cb
Release crates v0.24.3 (#4950)
## [0.24.3] - 2024-08-18

### Features

- d49fb16 oxc_codegen: Support generate range leading comments (#4898)
(IWANABETHATGUY)
- 80d0d1f semantic: Check for invalid interface heritage clauses (#4928)
(DonIsaac)
- 48821c0 semantic,syntax: Add SymbolFlags::ArrowFunction (#4946)
(DonIsaac)
- f1fcdde transformer: Support react fast refresh (#4587) (Dunqing)
- 0d79122 transformer: Support logical-assignment-operators plugin
(#4890) (Dunqing)
- ab1d08c transformer: Support `optional-catch-binding` plugin (#4885)
(Dunqing)
- 69da9fd transformer: Support nullish-coalescing-operator plugin
(#4884) (Dunqing)
- 3a66e58 transformer: Support exponentiation operator plugin (#4876)
(Dunqing)
- f88cbcd transformer: Add `BoundIdentifier::new_uid_in_current_scope`
method (#4903) (overlookmotel)
- 1e6d0fe transformer: Add methods to `BoundIdentifier` (#4897)
(overlookmotel)
- fd34640 traverse: Support `generate_uid_based_on_node` method in
`TraverseCtx` (#4940) (Dunqing)
- 72a37fc traverse: Support `clone_identifier_reference` method in
`TraverseCtx` (#4880) (Dunqing)

### Bug Fixes

- c0b26f4 ast: Do not include `scope_id` fields in JSON AST (#4858)
(overlookmotel)
- bbf9ec0 codegen: Add missing `declare` to `PropertyDefinition` (#4937)
(Boshen)
- f210cf7 codegen: Print `TSSatisfiesExpression` and
`TSInstantiationExpression` (#4936) (Boshen)
- 21f5762 codegen: Minify large numbers (#4889) (Boshen)
- e8de4bd codegen: Fix whitespace issue when minifying `x in new
Error()` (#4886) (Boshen)
- a226962 codegen: Print `TSNonNullExpression` (#4869) (Boshen)
- 3da33d3 codegen: Missing parenthesis for `PrivateInExpression` (#4865)
(Boshen)
- 1808529 codegen: Dedupe pure annotation comments (#4862)
(IWANABETHATGUY)
- d3bbc62 isolated-declarations: Declare modifier of PropertyDefinition
should not be retained (#4941) (Dunqing)
- 8e80f59 isolated_declarations: Class properties should still be lifted
from private constructors (#4934) (michaelm)
- b3ec9e5 isolated_declarations: Always emit module declarations that
perform augmentation (#4919) (michaelm)
- 0fb0b71 isolated_declarations: Always emit module declarations (#4911)
(michaelm)
- 4a16916 isolated_declarations: Support expando functions (#4910)
(michaelm)
- 508644a linter/tree-shaking: Correct the calculation of `>>`, `<<` and
`>>>` (#4932) (mysteryven)
- 46cb1c1 minifier: Handle `Object.definedPropert(exports` for
@babel/types/lib/index.js (#4933) (Boshen)
- 81fd637 minifier: Do not fold `0 && (module.exports = {})` for
`cjs-module-lexer` (#4878) (Boshen)
- 879a271 minifier: Do not join `require` calls for `cjs-module-lexer`
(#4875) (Boshen)
- 1bdde2c parser: Detect @flow in `/** @flow */ comment (#4861) (Boshen)
- 2476dce transformer: Remove an `ast.copy` from
`NullishCoalescingOperator` transform (#4913) (overlookmotel)
- 248a757 transformer/typescript: Typescript syntax within
`SimpleAssignmentTarget` with `MemberExpressions` is not stripped
(#4920) (Dunqing)

### Documentation

- 47c9552 ast, ast_macros, ast_tools: Better documentation for `Ast`
helper attributes. (#4856) (rzvxa)
- 0a01a47 semantic: Improve documentation (#4850) (DonIsaac)
- 9c700ed transformer: Add README including style guide (#4899)
(overlookmotel)

### Refactor

- a6967b3 allocator: Correct code comment (#4904) (overlookmotel)
- 90d0b2b allocator, ast, span, ast_tools: Use `allocator` as var name
for `Allocator` (#4900) (overlookmotel)
- 1eb59d2 ast, isolated_declarations, transformer: Mark
`AstBuilder::copy` as an unsafe function (#4907) (overlookmotel)
- 8e8fcd0 ast_tools: Rename `oxc_ast_codegen` to `oxc_ast_tools`.
(#4846) (rzvxa)
- 786bf07 index: Shorten code and correct comment (#4905)
(overlookmotel)
- ea1e64a semantic: Make SemanticBuilder opaque (#4851) (DonIsaac)
- 5fd1701 sourcemap: Lower the `msrv`. (#4873) (rzvxa)
- 48a1c32 syntax: Inline trivial bitflags methods (#4877)
(overlookmotel)
- 452187a transformer: Rename `BoundIdentifier::new_uid_in_root_scope`
(#4902) (overlookmotel)
- 707a01f transformer: Re-order `BoundIdentifier` methods (#4896)
(overlookmotel)
- 117dff2 transformer: Improve comments for `BoundIdentifier` helper
(#4895) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-18 14:16:25 +08:00
Boshen
873d502993
refactor(coverage): use the oxc crate 2024-08-17 22:40:08 +08:00
Boshen
4c989d0fda
chore(parser): remove multi-thread example
because `ouroboros` has a few heavy dependencies, including an older
version of itertools.
2024-08-16 22:57:10 +08:00
Boshen
c220730779 feat(coverage): check symbols and scopes after transformation (#4917)
closes https://github.com/oxc-project/oxc/issues/4790

@overlookmotel enjoy ... take a look at the snapshots and probably nothing else.

The snapshots are minimal right now, but it's already showing symbols from import specifiers are not being removed. We can iterate on the snapshot representation to aid debugging later.

I'll extend this to `transformer_conformance` and `oxc-monitor` in an up coming PR.
2024-08-16 07:05:11 +00:00