DonIsaac
5a55dcf39b
fix(linter/no-unused-vars): type specifier not deleted for type imports ( #5029 )
...
fixes a bug in eslint/no-unused-vars where, when unused type imports were deleted, the `type` modifier was not.
2024-08-21 00:11:45 +00:00
overlookmotel
c30e2e9cce
refactor(semantic)!: Reference::flag method return ReferenceFlag ( #5019 )
...
Closes #4992 .
2024-08-20 22:02:08 +00:00
camc314
2292606a1f
feat(linter): typescript-eslint/no-wrapper-object-types ( #5022 )
2024-08-20 21:45:38 +00:00
Don Isaac
c43945c808
fix(linter/consistent-function-scoping): allow functions passed as arguments ( #5011 )
2024-08-20 17:00:50 -04:00
Dunqing
4425b177d4
docs(transformer): add documentation for logical-assignment-operators plugin ( #5012 )
...
follow-up #4881
2024-08-20 16:32:37 +00:00
DonIsaac
86d0c0cb62
fix(linter): change consistent-function-scoping to suspicious ( #5010 )
2024-08-20 16:22:30 +00:00
overlookmotel
896b92f272
refactor(semantic): correct typo in doc comment ( #5009 )
...
Correct a typo in doc comment, and capitalize "ID" in couple of places.
2024-08-20 15:27:51 +00:00
Boshen
b4407c4e9a
refactor(oxc,mangler): oxc crate add mangler; mangler use options API
2024-08-20 22:58:59 +08:00
IWANABETHATGUY
0f64d106a0
refactor(minifier): remove duplicated helper move_out_expression ( #5007 )
2024-08-20 14:00:33 +00:00
overlookmotel
8d15e65a78
refactor(transformer): use into_member_expression ( #5006 )
...
Use new `into_member_expression` API introduced in #5005 in TS transforms.
2024-08-20 13:39:26 +00:00
overlookmotel
714373dc5e
feat(ast): inherit_variants! macro add into_* methods ( #5005 )
...
`inherit_variants!` macro generate `into_*` methods for owned objects. e.g.:
```rs
let expr: Expression = get_expr();
match expr {
match_member_expression!(Expression) => {
let member_expr: MemberExpression = expr.into_member_expression();
},
_ => {},
}
```
2024-08-20 12:11:54 +00:00
overlookmotel
7f3129efd1
fix(ast): correct code comment ( #5004 )
...
Comment showing macro expansion did not match the actual macro output.
2024-08-20 11:56:29 +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
cd9cf5efd8
refactor(oxc): remove remove_whitespace
2024-08-20 18:27:59 +08:00
Boshen
1f6b107339
chore(coverage): ignore test262 stage3 json-modules ( #5002 )
...
stage 3 https://github.com/tc39/proposal-json-modules
Ignoring due to https://github.com/tc39/proposal-json-modules/issues/27
2024-08-20 08:50:27 +00:00
Boshen
ce4d4698b4
feat(codegen)!: remove const generic MINIFY ( #5001 )
...
This is a premature optimization, makes the code complicated, and bloats the final binary size.
The minify option is moved to `CodegenOptions`
2024-08-20 08:13:27 +00:00
Boshen
b2ff2df5af
refactor(parser)!: remove builder pattern from Parser struct ( #5000 )
...
part of #4455
use `with_options(ParseOptions { ..ParseOptions::default() })` API instead.
2024-08-20 07:40:25 +00:00
Boshen
081e2a37d9
refactor(regular_expression): s/RegExpLiteral/RegularExpression
2024-08-20 14:26:32 +08:00
dalaoshu
ed9a1c499b
feat(linter/eslint-plugin-vitest): implement require-local-test-context-for-concurrent-snapshots ( #4951 )
...
Related to #4656
---------
Co-authored-by: Wang Wenzhe <mysteryven@gmail.com>
2024-08-20 13:41:35 +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
Burlin
f88970bc79
refactor(ast)!: Change order of fields in CallExpression ( #4859 )
...
fix : #4821
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-08-20 09:47:12 +08:00
Dunqing
38d4434473
refactor(transformer/nullish-coalescing-operator): move internal methods to bottom of the file ( #4996 )
...
follow-up #4993
2024-08-20 01:06:38 +00:00
Dunqing
f51d3f9169
feat(transformer/nullish-coalescing-operator): handles nullish coalescing expression in the FormalParamter ( #4975 )
...
### What I did in this PR
1. Replace `self.clone_identifier_reference` with `ctx.clone_identifier.reference`
2. Remove the usage of `ast.copy`
3. Handle below example correctly
### Example
```js
// Input
var foo = object.foo ?? "default";
// Output
var _object$foo;
var foo =
(_object$foo = object.foo) !== null && _object$foo !== void 0
? _object$foo
: "default";
```
2024-08-20 01:06:37 +00:00
Dunqing
f794870dd4
feat(transformer/nullish-coalescing-operator): generate the correct binding name ( #4974 )
...
match Babel's [implementation](440fe41333/packages/babel-plugin-transform-nullish-coalescing-operator/src/index.ts (L40) )
2024-08-20 01:06:36 +00:00
Dunqing
9df2f80cab
refactor(transformer/es2020): move all entry points to implementation of Traverse trait ( #4973 )
...
part of #4881
2024-08-20 01:06:36 +00:00
Dunqing
72ff2c67b9
feat(transformer/nullish-coalescing-operator): add comments in top of file ( #4972 )
...
part of #4881
2024-08-20 01:06:35 +00:00
DonIsaac
e331ca0a9d
docs(linter): improve documentation for several rules ( #4997 )
2024-08-20 00:55:48 +00:00
overlookmotel
cca7440d4b
refactor(ast): replace AstBuilder::move_statement_vec with move_vec ( #4988 )
...
Replace `AstBuilder::move_statement_vec` with a general `move_vec` method which handles any kind of `Vec`.
2024-08-19 21:09:14 +00:00
overlookmotel
6ffbd78947
fix(transformer): remove an AstBuilder::copy call from TS namespace transform ( #4987 )
...
Replace an unsafe `AstBuilder::copy` call with `AstBuilder::move_expression` in TS namespace transform.
2024-08-19 21:09:12 +00:00
overlookmotel
a8dfddaeab
fix(transformer): remove an AstBuilder::copy call from TS module transform ( #4986 )
...
Remove an unsafe `AstBuilder::copy` call from TS module transform. `IdentifierReference` is `Clone`, so we can just clone it rather than copy. Same result, but safe.
Also shorten the surrounding code a bit, using `.unwrap()` instead of an `unreachable!()` branch.
2024-08-19 21:09:11 +00:00
overlookmotel
1467eb306c
fix(transformer): remove an AstBuilder::copy call from TS enum transform ( #4985 )
...
Replace an unsafe `AstBuilder::copy` call with `AstBuilder::move_expression` in TS enum transform.
2024-08-19 21:09:10 +00:00
overlookmotel
1365feb6b1
fix(transformer): remove an AstBuilder::copy call for TS AssignmentTarget transform ( #4984 )
...
Add `AssignmentTarget::get_expression_mut` method and use it to remove an unsound `AstBuilder::copy` call from TS transform for `AssignmentTarget`s.
2024-08-19 21:09:09 +00:00
overlookmotel
edacf936ec
fix(transformer): remove an AstBuilder::copy call ( #4983 )
...
Remove one usage of unsound `AstBuilder::copy` method, using the new `get_inner_expression_mut` method introduced in #4920 .
2024-08-19 21:09:07 +00:00
overlookmotel
4796ece77d
refactor(transformer): TS annotations transform use move_expression ( #4982 )
...
Follow on after #4920 . #4920 removed a usage of `AstBuilder::copy` and replaced with 2 new methods `AstBuilder::move_identifier_reference` and `AstBuilder:: move_member_expression`.
We can instead use `AstBuilder::move_expression` earlier and then unpack the enum again. Hopefully the compiler can see that the 2 `unreachable!()` branches are indeed unreachable and elide them.
`move_expression` is preferable to `move_member_expression` as it only creates 1 temporary `Box<Expression::NullLiteral>` instead of 2.
2024-08-19 20:59:43 +00:00
overlookmotel
1bd5853310
docs(transformer): updated README re: order of methods ( #4993 )
...
Add to `oxc_transformer` README note about order methods laid out in
files.
The idea is that you can read code for a transformer from top to bottom,
and the logic flows in this direction.
2024-08-20 04:43:47 +08:00
DonIsaac
7c6bae2d65
feat(website): add link to rule source on docs page ( #4995 )
...

2024-08-19 20:40:14 +00:00
camc314
dd38a32ba6
feat(linter) expand jsx-props-no-spread-multi to catch member expressions ( #4981 )
...
closes #4894
2024-08-19 20:32:12 +00:00
DonIsaac
7b99386071
fix(linter): missing closing ticks in some example blocks ( #4994 )
...
These broken example blocks breaks codegen for the upstream PR in this stack.
2024-08-19 20:25:14 +00:00
Don Isaac
a0effab160
feat(linter): support more flexible config.globals values ( #4990 )
...
Support `"readable", `"writable"`, and boolean values for `GlobalValue`.
I also enhanced the documentation for `OxcGlobals`
## Screenshot
<img width="797" alt="image"
src="https://github.com/user-attachments/assets/8f76de4c-4ae8-44d1-9be1-720fc3c7e0ec ">
2024-08-19 16:23:47 -04:00
Don Isaac
4436774e8c
fix(website): sanitize JSON in section docs ( #4989 )
2024-08-19 16:23:31 -04:00
Dunqing
6b885fef46
feat(traverse): expose generate_uid_based_on_node and generate_uid_in_current_scope_based_on_node from TraverseCtx ( #4965 )
...
Both of these APIs were added in #4940 . But they weren't exposed.
2024-08-19 17:42:45 +00:00
overlookmotel
770652327d
refactor(span): clarify Atom conversion methods lifetimes ( #4978 )
...
Rename lifetimes on `FromIn` impls for `Atom`s to make it clear where the lifetime of the `Atom` comes from the allocator's lifetime.
2024-08-19 11:53:01 +00:00
overlookmotel
4012260c17
refactor(ast): AstBuilder::move_identifier_reference do not allocate empty string ( #4977 )
...
#4920 introduced `AstBuilder::move_identifier_reference`. Make this slightly cheaper by using a static empty `Atom` rather than relying on `"".into_in(allocator)` which allocates an empty string into arena.
2024-08-19 11:48:38 +00:00
Boshen
64ace42566
feat(transform_conformance): show transform conformance errors ( #4976 )
2024-08-19 09:01:34 +00:00
Boshen
0df1a94a1b
test(semantic): add more symbol and reference checks to PostTransformChecker
2024-08-19 15:44:17 +08:00
Boshen
4fdf26dac8
refactor(transform_conformance): add driver ( #4969 )
2024-08-19 07:27:39 +00:00
renovate[bot]
37b9b0e21d
chore(deps): update dependency @vscode/vsce to v3 ( #4968 )
...
[](https://renovatebot.com )
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@vscode/vsce](https://code.visualstudio.com )
([source](https://togithub.com/Microsoft/vsce )) | [`^2.27.0` ->
`^3.0.0`](https://renovatebot.com/diffs/npm/@vscode%2fvsce/2.32.0/3.0.0 )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
---
### Release Notes
<details>
<summary>Microsoft/vsce (@​vscode/vsce)</summary>
###
[`v3.0.0`](https://togithub.com/microsoft/vscode-vsce/releases/tag/v3.0.0 )
[Compare
Source](https://togithub.com/Microsoft/vsce/compare/v2.32.0...v3.0.0 )
#### Changes:
- [#​1035](https://togithub.com/Microsoft/vsce/issues/1035 ):
Update deprecated dependencies and move to Node 20
This list of changes was [auto
generated](https://dev.azure.com/monacotools/Monaco/\_build/results?buildId=288216\&view=logs ).
</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.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- 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 07:16:48 +00:00
Boshen
3f6014a042
chore(semantic): add PostTransformChecker ( #4967 )
2024-08-19 05:38:27 +00:00
DonIsaac
96422b6489
refactor(ast): make AstBuilder non-exhaustive ( #4925 )
2024-08-19 05:32:30 +00:00