sapphi-red
8f57929419
refactor(minifier): merge try_compress_type_of_equal_string into try_minimize_binary ( #8561 )
...
This compression can be handled by `try_minimize_binary`.
2025-01-17 11:01:54 +00:00
Boshen
927f43ff84
feat(minifier): improve .charCodeAt(arg) when arg is valid ( #8534 )
2025-01-16 06:36:34 +00:00
Boshen
b1d018622b
fix(minifier): do not fold !!void b ( #8533 )
2025-01-16 05:52:03 +00:00
oxc-bot
3e05055783
release(crates): v0.46.0 ( #8487 )
...
## [0.46.0] - 2025-01-14
- 7eb6ccd ast: [**BREAKING**] Remove unused and not useful `ContentHash`
(#8483 ) (Boshen)
### Features
- 8accfef minifier: Minify `var x; void x` -> `void 0` (#8466 ) (Boshen)
- 870a583 minifier: Fold `false['toString']` (#8447 ) (Boshen)
- 4ad695d napi/minify: Implement napi (#8478 ) (Boshen)
- 9d550aa span: Add `Atom::r#static` (#8479 ) (_Kerman)
### Bug Fixes
- 4071878 isolated-declarations: Retain `declare` declarations when they
are exported (#8477 ) (Dunqing)
- 7ee7634 isolated-declarations: Import statement disappears when import
binding is referenced in nested `typeof` (#8476 ) (Dunqing)
- 7252cb0 isolated-declarations: Unexpected error when global `Symbol`
as property key (#8475 ) (Dunqing)
- 4c6675c minifier: Do not convert while to fors in DCE (#8484 ) (Boshen)
- 1d6e84d minifier: Fix incorrect `null.toString()` and `1n.toString()`
(#8464 ) (Boshen)
- 25d4bf9 minifier: Remove usage of empty spans (#8462 ) (Boshen)
- dd64340 minifier: Keep `return undefined` in async generator function
(#8439 ) (Boshen)
- c444de8 transformer/arrow-functions: Transform `this` and `super`
incorrectly in async arrow function (#8435 ) (Dunqing)
- 270245f transformer/typescript: Correct the semantic for
TSImportEqualsDeclaration transformation (#8463 ) (Dunqing)
- 2a400d6 transformer/typescript: Retain TSImportEqualsDeclaration when
it is exported (Dunqing)
- ab694b0 transformer/typescript: Retain `TSImportEqualsDeclaration` in
`namespace` when its binding has been referenced or
`onlyRemoveTypeImports` is true (#8458 ) (Dunqing)
### Performance
- 7a8200c mangler: Allocate base54 name without heap allocation (#8472 )
(Boshen)
- 31dac22 mangler: Allocate data in arena (#8471 ) (Boshen)
- 8fc238a minifier: Merge `Normalize` and `RemoveSyntax` pass (#8467 )
(Boshen)
- 372eb09 minifier: Preallocate mangler's semantic data (#8451 ) (Boshen)
### Refactor
- 6e64eef codegen: Remove `match_expression!` (#8450 ) (Boshen)
- de5b288 span: Rename `Atom::new_const` method (#8480 ) (overlookmotel)
- c83ce5c transformer/typescript: Improve transforming namespace (#8459 )
(Dunqing)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-01-14 19:40:44 +08:00
Boshen
1d6e84dd33
fix(minifier): fix incorrect null.toString() and 1n.toString() ( #8464 )
2025-01-13 15:08:49 +00:00
oxc-bot
01722f34ff
release(crates): v0.45.0 ( #8434 )
...
## [0.45.0] - 2025-01-11
- 7f69561 ast: [**BREAKING**] `oxc_ast` do not export `BigUint` (#8428 )
(overlookmotel)
- d8b27af ast: [**BREAKING**] No unneccesary trailing underscores on
`AstBuilder` method names (#8283 ) (overlookmotel)
- 5106088 ast: [**BREAKING**] Remove `FromIn<Expression> for Statement`
(#8280 ) (overlookmotel)
### Features
- 6c7acac allocator: Implement `IntoIterator` for `&mut Vec` (#8389 )
(overlookmotel)
- 3212bcd ast_tools: Ignore `raw` field of `NumericLiteral` and
`StringLiteral` in `ContentEq` (#8417 ) (Boshen)
- ad146bb codegen: Print real newline when `\n` is inside template
literals (#8178 ) (Boshen)
- 41ddf60 minfier: Add `CompressOptions::target` (#8179 ) (Boshen)
- d56020b minifier: Drop `0` from `new Int8Array(0)` and other
TypedArrays (#8431 ) (sapphi-red)
- f935d94 minifier: Remove `new` from NativeErrors / `AggregateError`
(#8430 ) (sapphi-red)
- dab7a51 minifier: Minimize not `!(x === undefined)` -> `x !==
undefined` (#8429 ) (Boshen)
- 0e7bab8 minifier: Remove `if(false){}` in a single pass (#8421 )
(Boshen)
- 5b5b844 minifier: Fold `ambiguous if else` (#8415 ) (Boshen)
- 438a6e7 minifier: Minimize conditions in boolean context (#8381 )
(Boshen)
- 793cb43 minifier: `a != null ? a : b` -> `a ?? b` (#8352 ) (camc314)
- 814da55 minifier: Compress `x = x || 1` to `x ||= 1` (#8368 )
(sapphi-red)
- a596821 minifier: Compress `a.b = a.b + c` to `a.b += c` (#8367 )
(sapphi-red)
- 579eb60 minifier: Compress `a.b || (a.b = c)` to `a.b ||= c` (#8366 )
(sapphi-red)
- f367a16 minifier: Port esbuild conditional expr minification (#8351 )
(camc314)
- 8d52cd0 minifier: Merge assign expression in conditional expression
(#8345 ) (sapphi-red)
- a69d15f minifier: Compress `new Array(2)` -> `[,,]` (#8344 )
(sapphi-red)
- 819c475 minifier: Compress `new Array(7n)` -> `[7n]` (#8343 )
(sapphi-red)
- e085d66 minifier: Remove empty IIFE (#8340 ) (Boshen)
- 2c2e483 minifier: Fold object spread `({ ...null })` -> `({})` (#8339 )
(Boshen)
- 6220e05 minifier: Remove empty if statment `if (test) {}` -> `test`
(#8336 ) (Boshen)
- a76dfae minifier: Remove label statement with empty body (#8333 )
(Boshen)
- e88a6bd minifier: Minimize `!0 + null !== 1` -> `!0 + null != 1`
(#8332 ) (Boshen)
- ec88c68 minifier: Compress `a || (a = b)` to `a ||= b` (#8315 )
(sapphi-red)
- e6fe84d minifier: Compress `a = a + b` to `a += b` (#8314 )
(sapphi-red)
- 9ea4e31 minifier: Remove `new` from `new Error`/`new Function`/`new
RegExp` (#8313 ) (sapphi-red)
- 051fbb6 minifier: Minimize `x["0"]` -> x[0] (#8316 ) (Boshen)
- a542013 minifier: Minimize `do{}while(true)` -> `do;while(true)`
(#8311 ) (Boshen)
- e3ff81e minifier: Minimize `(x = 1) === 1` -> `(x = 1) == 1` (#8310 )
(Boshen)
- 4b68cc0 minifier: Minimize empty `try` statement (#8309 ) (Boshen)
- 922c514 minifier: Fold `.toString()` (#8308 ) (Boshen)
- 66a2443 minifier: Minify sequence expressions (#8305 ) (camc314)
- af65c36 minifier: Minimize double negated binary expressions (#8304 )
(camc314)
- 76c778b minifier: Remove logical nots when arg is a delete expression
(#8303 ) (camc314)
- 5ed439b minifier: Minify typeof in binary expressions (#8302 )
(camc314)
- 6afc590 minifier: Compress typeof addition string (#8301 ) (camc314)
- ecc789f minifier: Fold `if(x >> y == 0){}` -> `if(!(x >> y)){}`
(#8277 ) (Boshen)
- 0e3b79a minifier: Fold `String()` -> `''`, `Number()` -> `false`
(#8274 ) (Boshen)
- c9cf593 minifier: Compress property key `{[1]: _}` -> {1: _} (#8272 )
(Boshen)
- b92b2ab minifier: Fold `BigInt(1n)` -> `1n` (#8270 ) (Boshen)
- a4df387 minifier: Compress loose equals undefined (#8268 ) (camc314)
- f000596 minifier: Minify call expressionsto `Number` (#8267 ) (camc314)
- 092aeaf minifier: Flatten spread args in call expressions (#8266 )
(camc314)
- 04ec38d minifier: Remove unused arrow function expressions (#8262 )
(camc314)
- e446c15 minifier: Improve minimizing unary not expressions (#8261 )
(camc314)
- 7f19211 minifier: Minimize unary expression statements (#8256 )
(camc314)
- cec63e2 minifier: `{}` evals to `f64::NaN` (Boshen)
- 4d8a08d minifier: Improve constant evaluation (#8252 ) (Boshen)
- e84f267 minifier: Compress more property keys (#8253 ) (Boshen)
- d1224f9 minifier: Improve minimizing conditional expressions (#8251 )
(camc314)
- 65f46f5 minifier: Constant fold `String.fromCharCode` (#8248 ) (Boshen)
- bd8d677 minifier: Minimize `~undefined`, `~null`, `~true`, `~false`
(#8247 ) (Boshen)
- f73dc9e minifier: Constant fold `'x'.toString()` and `true.toString()`
(#8246 ) (Boshen)
- fd5af73 minifier: Minimize `Number` constructor (#8245 ) (Boshen)
- 2f52f33 minifier: Minsize `!!!foo ? bar : baz` -> `foo ? baz : bar`
(#8244 ) (Boshen)
- ccdc039 minifier: Always put literals on the rhs of equal op `1==x` =>
`x==1` (#8240 ) (Boshen)
- 39353b2 minifier: Improve minimizing conditionals (#8238 ) (Cameron)
- c90fc16 minifier: Restore conditional minification and fix edge case
(#8235 ) (camc314)
- 6c8ee9f minifier: Remove last redundant `return` statement (#8234 )
(Boshen)
- 51f4792 minifier: Minimize `foo ? foo : bar` and `foo ? bar : foo`
(#8229 ) (Boshen)
- 6e2ec17 minifier: Statement fusion switch cases; improved minimize
exit poitns (#8228 ) (Boshen)
- 574a242 minifier: Minimize all variants of `typeof x == 'undefined'`
(#8227 ) (Boshen)
- 2041477 minifier: Fold `if(x)return;y` -> `if(!x)y` (#8226 ) (Boshen)
- 9c1afa4 minifier: Optional catch binding when catch param is unused
(#8221 ) (Boshen)
- 4a29845 minifier: Add `ConvertToDottedProperties` (#8212 ) (Boshen)
- 2786dea minifier: Add `RemoveUnusedCode` (#8210 ) (Boshen)
- cd274ee minifier: Minimize logical exprs (#8209 ) (Cameron)
- 4ae15df minifier: Imprve more conditional expr minification with
boolean lit (#8208 ) (camc314)
- 3202b4f minifier: Imprve conditional expr minification with boolean
lit (#8207 ) (camc314)
- 3b45011 minifier: Handle conditional expr with boolean lit (#8206 )
(camc314)
- 4c2059a minifier: Reverse negated conditional exprs (#8205 ) (camc314)
- 4804933 minifier: Add `MinimizeExitPoints` and ExploitAssigns`
boilerplate (#8203 ) (Boshen)
- bf266e1 minifier: Try collapse conditional to logical or expr (#8197 )
(Cameron)
- 06e1780 minifier: Improve `StatementFusion` (#8194 ) (Boshen)
- 42e211a minifier: Only constant fold numbers when result is smaller
(#8092 ) (Boshen)
- d0de560 minifier: Change `NaN` to `f64::NAN` (#8191 ) (Boshen)
- cef8eb8 minifier: Change `foo?.['bar']` to `foo?.bar` (#8176 ) (翠 /
green)
- 8149e34 minifier: Optional catch binding when es target >= es2019
(#8180 ) (Boshen)
- fc43ec5 minifier: Fold `string.length` / `array.length` (#8172 )
(sapphi-red)
- 29dc0dc minifier: Change `foo['bar']` -> foo.bar (#8169 ) (Boshen)
- 3c5718d minifier: Fold `typeof foo == undefined` into `foo ==
undefined` when possible (#8160 ) (翠 / green)
- f3a36e1 minifier: Fold `typeof foo != "undefined"` into `typeof foo <
"u"` (#8159 ) (翠 / green)
- 37c9959 minifier: Normalize `Infinity` into `f64::Infinity` (#8148 )
(Boshen)
- 8fb71f5 minifier: Minify string `PropertyKey` (#8147 ) (Boshen)
- 6615e1e minifier: Constant fold `instanceof` (#8142 ) (翠 / green)
- 2b2a373 minifier: Minimize `a + 'b' + 'c'` -> `a + 'bc'` (#8137 )
(Boshen)
- 213364a minifier: Minimize `if (x) if (y) z` -> `if (x && y) z`
(#8136 ) (Boshen)
- 6b51e6d minifier: Minimize `if(foo) bar else baz` -> `foo ? bar : baz`
(#8133 ) (Boshen)
- f615bfa minifier: Minimize `if (x) return; return 1` -> `return x ?
void 0 : 1` (#8130 ) (Boshen)
- f0b1ee5 minifier: Minimize `if(!x) foo()` -> `x || foo()` (#8122 )
(Boshen)
- f8200a8 minifier: Minimize `if(foo) bar` -> `foo && bar` (#8121 )
(Boshen)
- 72d9967 minifier: Add `Normalize` ast pass (#8120 ) (Boshen)
- fef0b25 minifier: Collapse `var` into for loop initializer (#8119 )
(Boshen)
- 2331ea8 minifier: `typeof foo === 'number'` => `typeof foo ==
'number'` (#8112 ) (Boshen)
- ad9a0a9 mininifier: Minimize variants of `a instanceof b == true`
(#8241 ) (Boshen)
- 2da4365 parser: Missing initializer in destructuring declaration
inside for loop head (#8222 ) (Boshen)
- 55744fd semantic: Allow getting mutable reference to symbols table
(#8189 ) (Max Stoumen)
- 0592a8b transformer/class-properties: Transform private in expression
(#8202 ) (Dunqing)
- ad77ad5 transformer/class-properties: Transform static/instance
accessor methods (#8132 ) (Dunqing)
- e405f79 transformer/class-properties: Transform static private method
invoking (#8117 ) (Dunqing)
- 3303e99 transformer/class-properties: Insert statements after
statement of class expression (#8116 ) (Dunqing)
- 0cc71cf transformer/class-properties: Transform super expressions and
identifiers that refers to class binding in private method (#8106 )
(Dunqing)
- 58ed832 transformer/class-properties: Transform private field
expression which invokes private method (#8102 ) (Dunqing)
- f14567a transformer/class-properties: Transform callee which invokes
private method (#8100 ) (Dunqing)
- 13349ef transformer/class-properties: Transform private methods
(#8099 ) (Dunqing)
### Bug Fixes
- eb25bc0 allocator: Fix lifetimes on `IntoIterator` for `Vec` (#8388 )
(overlookmotel)
- 97a7992 ast: Fix `ContentEq` and `ContentHash` impls for literal types
(#8426 ) (overlookmotel)
- a1752a0 codegen: Fix incorrect minified `return 1n` output (#8374 )
(Boshen)
- 5a648bc codegen: Fix white space issue with do statements (#8348 )
(Boshen)
- b6d16f4 codegen: Print parenthesis on negative bigint lit when
neccessary (#8258 ) (camc314)
- 8ed9766 codegen: Source map builder panicked because it attempted to
subtract with overflow in `search_original_line_and_column` (#8185 )
(Dunqing)
- ad61e70 codegen: Print if else without block with proper indentation
(#8135 ) (Boshen)
- 74572de ecmascript: Incorrect `to_int_32` value for Infinity (#8144 )
(翠 / green)
- e1f8ea4 lexer: `Source` is not `Clone` (#8294 ) (overlookmotel)
- 5c63414 mangler: Keep exported symbols for `top_level: true` (#7927 )
(翠 / green)
- 3c93549 minifier: Dce if statement should keep side effects and vars
(#8433 ) (Boshen)
- 52f88c0 minifier: Rotate associative operators to make it more
idempotent (#8424 ) (camc314)
- a80460c minifier: Correctly set `self.changed` when minimizing if
stmts (#8420 ) (camc314)
- d4ca8d4 minifier: `!!x` is not idempotent in `RemoveDeadCode` (#8419 )
(Boshen)
- 357b61d minifier: Do not minify `Object.defineProperty` in sequence
expressions (#8416 ) (Boshen)
- 0efc845 minifier: `+0n` produces `TypeError` (#8410 ) (Boshen)
- 7ce6a7c minifier: `a in b` has error throwing side effect (#8406 )
(Boshen)
- 2f3a9dc minifier: Cannot transform property key `#constructor` (#8405 )
(Boshen)
- c0a3dda minifier: `instanceof` has error throwing side effect (#8378 )
(Boshen)
- 5516f7f minifier: Do not fold object comparisons (#8375 ) (Boshen)
- cb098c7 minifier: Computed property key `prototype` cannot be changed
(#8373 ) (Boshen)
- 82ee77e minifier: Do not remove shadowned `undefined` in return
statement (#8371 ) (Boshen)
- f87da16 minifier: Do not fold literals in `-0 != +0` (#8278 ) (Boshen)
- 62a2644 minifier: Handle arrow fn expressions correctly in
`is_in_boolean_context` (#8260 ) (camc314)
- d2f8eaa minifier: Fix panic in `peephole_minimize_conditions` (#8242 )
(Boshen)
- a698def minifier: Fix incorrect return value for `(x ? true : y)`
(#8233 ) (Boshen)
- 05be1fc minifier: Remove incorrect fold
`Expression::AssignmentExpression` (#8211 ) (Boshen)
- 56b7f13 minifier: Do not constant fold `0 instanceof F` (#8199 )
(Boshen)
- 75d5f17 minifier: Minify string `PropertyKey` (#8177 ) (sapphi-red)
- f88acb3 parser: Allow line breaks between `const` and `enum` (#8193 )
(branchseer)
- 79a8fc6 semantic: Report error for super property appearing in
function body (#8376 ) (Dunqing)
- 79af100 semantic: Reference flags not correctly resolved when after an
export stmt (#8134 ) (camc314)
- 3eaff2a transformer: Ensure last expression statement in arrow
function expression is wrapped in return (#8192 ) (Dunqing)
- 3feac27 transformer/arrow-functions: Outer `super()` in nested class
(#8382 ) (Dunqing)
- 335065d transformer/arrow-functions: Do not transform super that
inside nested non-async method (#8335 ) (Dunqing)
- e4d66e4 transformer/arrow-functions: Store `super_methods` on a
`Stack` to fix nested async methods (#8331 ) (Dunqing)
- 775a289 transformer/arrow-functions: `_this = this` should be inserted
after super call expression (#8024 ) (Dunqing)
- ac72adb transformer/private-methods: Fix panic if instance private
accessor in class (#8362 ) (overlookmotel)
- f1f129b transformer/private-methods: Create brand binding `var` in
hoist scope (#8361 ) (overlookmotel)
- ab61425 transformer/private-methods: No temp var for class when unused
private methods (#8360 ) (overlookmotel)
- 9a03bd2 transformer/typescript: Remove type-only `import =` when
`only_remove_type_imports` is true (#8275 ) (Dunqing)
- 0df1866 transformer/typescript: Create `Reference` for `require`
(#8355 ) (overlookmotel)
- 78d7c97 transformer/typescript: Create `Reference` for `Infinity`
(#8354 ) (overlookmotel)
- 2e7207f transformer/typescript: Should strip import specifiers type
with `only_remove_type_imports` (#8141 ) (underfin)
### Performance
- 07edf74 transformer/arrow-function: Stop traversal at function as
super() can't appear in a nested function (#8383 ) (Dunqing)
- 62e3f7e transformer/arrow-functions: Reduce size of inlined visitor
(#8322 ) (overlookmotel)
- aebe0ea transformer/arrow-functions: Use `NonEmptyStack` instead of
`Stack` (#8318 ) (overlookmotel)
### Documentation
- c8e4843 ast: Fix doc comment (#8286 ) (overlookmotel)
- e0a09ab data_structures: Improve docs for stack types (#8356 )
(overlookmotel)
- aaa009d minifier: Clarify assumptions for compressor (#8404 ) (翠 /
green)
- 05cba5b transformer/private-methods: Amend comments (#8398 )
(overlookmotel)
### Refactor
- b29655f ast: Rearrange impls for literal types in same order as they
are defined (#8425 ) (overlookmotel)
- 0db2a22 ast: `AstBuilder` enum builder methods use `alloc_*` methods
(#8281 ) (overlookmotel)
- aea9551 ast: Simplify `get_identifier_reference` of `TSType` and
`TSTypeName` (#8273 ) (Dunqing)
- 9c1844a data_structures: Remove `NonNull` shim (#8423 ) (overlookmotel)
- 1835687 ecmascript: Remove unnecessary `use` statement (#8284 )
(overlookmotel)
- 64bfdfe lexer: Tighten safety of lexer by always including lifetime on
`SourcePosition` (#8293 ) (overlookmotel)
- 0344e98 lexer: Make `handle_byte` a method of `Lexer` (#8291 )
(overlookmotel)
- fabf116 lexer: Replace `#[allow]` with `#[expect]` (#8289 )
(overlookmotel)
- 0462edb lexer: Rename function param (#8288 ) (overlookmotel)
- fb2acd8 minifier: Change minimize conditionals into a loop (#8413 )
(Boshen)
- baaec60 minifier: Remove the buggy `??` transform (#8411 ) (Boshen)
- 1c4658d minifier: Change ast passes order, `!in_fixed_loop` happen
last (#8380 ) (Boshen)
- 09f0f48 minifier: Remove the buggy `minimize_exit_points`
implementation (#8349 ) (Boshen)
- 9a5c66a minifier: Clean up (#8346 ) (Boshen)
- 98f2b1c minifier: Clean up `peephole_substitute_alternate_syntax`
(#8327 ) (Boshen)
- fc662b7 minifier: Handle big int values later (#8324 ) (Boshen)
- d16e598 minifier: Clean up `peephole_replace_known_methods` (#8306 )
(Boshen)
- b8d26ea minifier: Move optional catch param to
peephole_substitute_alternate_syntax (#8282 ) (Boshen)
- 0845162 minifier: Clean up `ReplaceKnownMethods` (Boshen)
- 7c7f5d7 minifier: Clean up `peephole_fold_constants` (Boshen)
- bf0fbce minifier: Improve constant fold numbers (#8239 ) (Boshen)
- 62f8fba minifier: Move all conditional minification logic to
minimze_conditions (#8231 ) (camc314)
- cfb51f2 minifier: Fuse ast passes (#8184 ) (Boshen)
- bf9cafe minifier: Clean up `peephole_substitute_alternate_syntax` a
little bit (Boshen)
- 75264ed minifier: Clean up `try_optimize_block` (#8139 ) (Boshen)
- c22062b minifier: Cleanup peephole_minimize_conditions (#8114 )
(Boshen)
- e594c39 minifier: Clean up `peephole_substitute_alternate_syntax.rs`
(#8111 ) (Boshen)
- 0903501 semantic: Check super usage based on scope (#8377 ) (Dunqing)
- 109b8fc transformer: Elide lifetimes where possible (#8285 )
(overlookmotel)
- fb389f7 transformer/arrow-function: Create a new ident instead of
clone (#8338 ) (Dunqing)
- dddbd29 transformer/arrow-functions: Reorder assertions (#8386 )
(overlookmotel)
- ce6c445 transformer/arrow-functions: Add TODO comments (#8328 )
(overlookmotel)
- 73d0025 transformer/arrow-functions: Reduce repeated code (#8323 )
(overlookmotel)
- 3dd08e9 transformer/arrow-functions: Do not inline non-trivial visitor
method (#8321 ) (overlookmotel)
- ea9cefb transformer/arrow-functions: Reorder visitor methods (#8320 )
(overlookmotel)
- 37199a4 transformer/arrow-functions: Rename lifetime (#8319 )
(overlookmotel)
- 57e9dcf transformer/arrow-functions: Shorten `AstBuilder` call (#8317 )
(overlookmotel)
- a5e3528 transformer/async-to-generator: Pass `TraverseCtx` to function
not `AstBuilder` (#8279 ) (overlookmotel)
- e7c89ba transformer/class-properties: TODO comments (#8392 )
(overlookmotel)
- 6790d1d transformer/class-properties: Simplify determining if class is
declaration (#8357 ) (overlookmotel)
- c786a13 transformer/class-properties: Share
`replace_class_name_with_temp_var` in class_properties (#8105 ) (Dunqing)
- f54f48e transformer/class-properties: Remove all `*_if_super` methods
in `static_block_and_prop_init` (#8104 ) (Dunqing)
- d82fb52 transformer/class-properties: Move `supers` to
`super_converter` (#8103 ) (Dunqing)
- 3dad85e transformer/private-methods: Remove unnecessary clone (#8400 )
(overlookmotel)
- aa5e65f transformer/private-methods: Simplify finding parent statement
of class expression (#8364 ) (overlookmotel)
- c786fd1 transformer/private-methods: TODO comments (#8363 )
(overlookmotel)
### Styling
- 4d2888d lexer: Reorder imports (#8290 ) (overlookmotel)
- e81f34f span: Reformat code (#8296 ) (overlookmotel)
- 45e2402 transformer/private-methods: Move comments (#8399 )
(overlookmotel)
- 0a1ffc0 transformer/private-methods: Rename var (#8397 )
(overlookmotel)
### Testing
- 16dcdaf lexer: Assert size of `Token` in 32-bit WASM (#8292 )
(overlookmotel)
- 3149fe0 minifier: Add anonymous function test case for logical
expression to logical assignment compression (#8347 ) (sapphi-red)
- 91b42de minifier: Enable some passing tests (#8250 ) (camc314)
- 1fa5341 minifier: Port tests from ConvertToDottedPropertiesTest
(#8175 ) (sapphi-red)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-01-11 22:34:31 +08:00
Boshen
0efc845c97
fix(minifier): +0n produces TypeError ( #8410 )
2025-01-10 07:18:06 +00:00
Boshen
7ce6a7c741
fix(minifier): a in b has error throwing side effect ( #8406 )
2025-01-10 05:23:07 +00:00
Boshen
438a6e7abc
feat(minifier): minimize conditions in boolean context ( #8381 )
2025-01-10 03:47:10 +00:00
renovate
772b71c838
chore(deps): update dependency rust to v1.84.0 ( #8391 )
...
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust ) | minor | `1.83.0` -> `1.84.0` |
---
### Release Notes
<details>
<summary>rust-lang/rust (rust)</summary>
### [`v1.84.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1840-2025-01-09 )
[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.83.0...1.84.0 )
\==========================
<a id="
Language"></a>
## Language
- [Allow `#[deny]` inside `#[forbid]` as a no-op](https://redirect.github.com/rust-lang/rust/pull/121560/ )
- [Show a warning when `-Ctarget-feature` is used to toggle features that can lead to unsoundness due to ABI mismatches](https://redirect.github.com/rust-lang/rust/pull/129884 )
- [Use the next-generation trait solver in coherence](https://redirect.github.com/rust-lang/rust/pull/130654 )
- [Allow coercions to drop the principal of trait objects](https://redirect.github.com/rust-lang/rust/pull/131857 )
- [Support `/` as the path separator for `include!()` in all cases on Windows](https://redirect.github.com/rust-lang/rust/pull/125205 )
- [Taking a raw ref (`raw (const|mut)`) of a deref of a pointer (`*ptr`) is now safe](https://redirect.github.com/rust-lang/rust/pull/129248 )
- [Stabilize s390x inline assembly](https://redirect.github.com/rust-lang/rust/pull/131258 )
- [Stabilize Arm64EC inline assembly](https://redirect.github.com/rust-lang/rust/pull/131781 )
- [Lint against creating pointers to immediately dropped temporaries](https://redirect.github.com/rust-lang/rust/pull/128985 )
- [Execute drop glue when unwinding in an `extern "C"` function](https://redirect.github.com/rust-lang/rust/pull/129582 )
<a id="1.84.0-Compiler"></a>
## Compiler
- [Add `--print host-tuple` flag to print the host target tuple and affirm the "target tuple" terminology over "target triple"](https://redirect.github.com/rust-lang/rust/pull/125579 )
- [Declaring functions with a calling convention not supported on the current target now triggers a hard error](https://redirect.github.com/rust-lang/rust/pull/129935 )
- [Set up indirect access to external data for `loongarch64-unknown-linux-{musl,ohos}`](https://redirect.github.com/rust-lang/rust/pull/131583 )
- [Enable XRay instrumentation for LoongArch Linux targets](https://redirect.github.com/rust-lang/rust/pull/131818 )
- [Extend the `unexpected_cfgs` lint to also warn in external macros](https://redirect.github.com/rust-lang/rust/pull/132577 )
- [Stabilize WebAssembly `multivalue`, `reference-types`, and `tail-call` target features](https://redirect.github.com/rust-lang/rust/pull/131080 )
- [Added Tier 2 support for the `wasm32v1-none` target](https://redirect.github.com/rust-lang/rust/pull/131487 )
<a id="1.84.0-Libraries"></a>
## Libraries
- [Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`](https://redirect.github.com/rust-lang/rust/pull/129329 )
- [Move `<float>::copysign`, `<float>::abs`, `<float>::signum` to `core`](https://redirect.github.com/rust-lang/rust/pull/131304 )
- [Add `LowerExp` and `UpperExp` implementations to `NonZero`](https://redirect.github.com/rust-lang/rust/pull/131377 )
- [Implement `FromStr` for `CString` and `TryFrom<CString>` for `String`](https://redirect.github.com/rust-lang/rust/pull/130608 )
- [`std::os::darwin` has been made public](https://redirect.github.com/rust-lang/rust/pull/123723 )
<a id="1.84.0-Stabilized-APIs"></a>
## Stabilized APIs
- [`Ipv6Addr::is_unique_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unique_local )
- [`Ipv6Addr::is_unicast_link_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unicast_link_local )
- [`core::ptr::with_exposed_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance.html )
- [`core::ptr::with_exposed_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance_mut.html )
- [`<ptr>::addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.addr )
- [`<ptr>::expose_provenance`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.expose_provenance )
- [`<ptr>::with_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.with_addr )
- [`<ptr>::map_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.map_addr )
- [`<int>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.isqrt )
- [`<int>::checked_isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.checked_isqrt )
- [`<uint>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.u32.html#method.isqrt )
- [`NonZero::isqrt`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html#impl-NonZero%3Cu128%3E/method.isqrt )
- [`core::ptr::without_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance.html )
- [`core::ptr::without_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance_mut.html )
- [`core::ptr::dangling`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling.html )
- [`core::ptr::dangling_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling_mut.html )
These APIs are now stable in const contexts
- [`AtomicBool::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.from_ptr )
- [`AtomicPtr::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicPtr.html#method.from_ptr )
- [`AtomicU8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html#method.from_ptr )
- [`AtomicU16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU16.html#method.from_ptr )
- [`AtomicU32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.from_ptr )
- [`AtomicU64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU64.html#method.from_ptr )
- [`AtomicUsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr )
- [`AtomicI8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html#method.from_ptr )
- [`AtomicI16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI16.html#method.from_ptr )
- [`AtomicI32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI32.html#method.from_ptr )
- [`AtomicI64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI64.html#method.from_ptr )
- [`AtomicIsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicIsize.html#method.from_ptr )
- [`<ptr>::is_null`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_null-1 )
- [`<ptr>::as_ref`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_ref-1 )
- [`<ptr>::as_mut`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_mut )
- [`Pin::new`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new )
- [`Pin::new_unchecked`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new_unchecked )
- [`Pin::get_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_ref )
- [`Pin::into_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.into_ref )
- [`Pin::get_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_mut )
- [`Pin::get_unchecked_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_unchecked_mut )
- [`Pin::static_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_ref )
- [`Pin::static_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_mut )
<a id="1.84.0-Cargo"></a>
## Cargo
- [Stabilize MSRV-aware resolver config](https://redirect.github.com/rust-lang/cargo/pull/14639/ )
- [Stabilize resolver v3](https://redirect.github.com/rust-lang/cargo/pull/14754/ )
<a id="1.84-Rustdoc"></a>
## Rustdoc
- [rustdoc-search: improve type-driven search](https://redirect.github.com/rust-lang/rust/pull/127589 )
<a id="1.84.0-Compatibility-Notes"></a>
## Compatibility Notes
- [Enable by default the `LSX` target feature for LoongArch Linux targets](https://redirect.github.com/rust-lang/rust/pull/132140 )
- [The unstable `-Zprofile` flag (“gcov-style” coverage instrumentation) has been removed.](https://redirect.github.com/rust-lang/rust/pull/131829 ) This does not affect the stable flags for coverage instrumentation (`-Cinstrument-coverage`) and profile-guided optimization (`-Cprofile-generate`, `-Cprofile-use`), which are unrelated and remain available.
- Support for the target named `wasm32-wasi` has been removed as the target is now named `wasm32-wasip1`. This completes the [transition](https://redirect.github.com/rust-lang/compiler-team/issues/607 ) [plan](https://redirect.github.com/rust-lang/compiler-team/issues/695 ) for this target following [the introduction of `wasm32-wasip1`](https://redirect.github.com/rust-lang/rust/pull/120468 ) in Rust 1.78. Compiler warnings on [use of `wasm32-wasi`](https://redirect.github.com/rust-lang/rust/pull/126662 ) introduced in Rust 1.81 are now gone as well as the target is removed.
- [The syntax `&pin (mut|const) T` is now parsed as a type which in theory could affect macro expansion results in some edge cases](https://redirect.github.com/rust-lang/rust/pull/130635#issuecomment-2375462821 )
- [Legacy syntax for calling `std::arch` functions is no longer permitted to declare items or bodies (such as closures, inline consts, or async blocks).](https://redirect.github.com/rust-lang/rust/pull/130443#issuecomment-2445678945 )
- The `wasm32-unknown-emscripten` target's binary release of the standard library is now [built with the latest emsdk 3.1.68](https://redirect.github.com/rust-lang/rust/pull/131533 ), which fixes an ABI-incompatibility with Emscripten >= 3.1.42. If you are locally using a version of emsdk with an incompatible ABI (e.g. before 3.1.42 or a future one), you should build your code with `-Zbuild-std` to ensure that `std` uses the correct ABI.
- [Declaring functions with a calling convention not supported on the current target now triggers a hard error](https://redirect.github.com/rust-lang/rust/pull/129935 )
- [The next-generation trait solver is now enabled for coherence, fixing multiple soundness issues](https://redirect.github.com/rust-lang/rust/pull/130654 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "before 11am on monday" in timezone Asia/Shanghai.
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, 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://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45Mi4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTIuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2025-01-09 18:11:17 +00:00
Boshen
c0a3ddac28
fix(minifier): instanceof has error throwing side effect ( #8378 )
2025-01-09 06:49:27 +00:00
Boshen
5516f7fcb9
fix(minifier): do not fold object comparisons ( #8375 )
2025-01-09 05:47:35 +00:00
Boshen
9a5c66ac6a
refactor(minifier): clean up ( #8346 )
2025-01-08 13:04:10 +00:00
Boshen
e88a6bdd94
feat(minifier): minimize !0 + null !== 1 -> !0 + null != 1 ( #8332 )
2025-01-08 04:36:42 +00:00
Boshen
922c5147b5
feat(minifier): fold .toString() ( #8308 )
2025-01-07 06:33:58 +00:00
camc314
66a24437ac
feat(minifier): minify sequence expressions ( #8305 )
2025-01-06 23:42:30 +00:00
overlookmotel
1835687b75
refactor(ecmascript): remove unnecessary use statement ( #8284 )
...
Tiny refactor. Unnecessary `use core::f64` snuck in in #8252 . Probably auto-added by IDE.
2025-01-06 11:42:26 +00:00
camc314
f000596edf
feat(minifier): minify call expressionsto Number ( #8267 )
2025-01-06 02:21:28 +00:00
Boshen
cec63e2119
feat(minifier): {} evals to f64::NaN
2025-01-05 23:09:57 +08:00
Boshen
4d8a08d2ac
feat(minifier): improve constant evaluation ( #8252 )
2025-01-05 12:41:57 +00:00
Boshen
bd8d677352
feat(minifier): minimize ~undefined, ~null, ~true, ~false ( #8247 )
2025-01-04 13:34:53 +00:00
Boshen
f73dc9ea9b
feat(minifier): constant fold 'x'.toString() and true.toString() ( #8246 )
2025-01-04 21:28:26 +08:00
Boshen
ad9a0a9c4a
feat(mininifier): minimize variants of a instanceof b == true ( #8241 )
2025-01-04 06:04:52 +00:00
Boshen
05be1fc639
fix(minifier): remove incorrect fold Expression::AssignmentExpression ( #8211 )
2025-01-01 05:44:01 +00:00
Boshen
56b7f133fa
fix(minifier): do not constant fold 0 instanceof F ( #8199 )
2024-12-31 08:46:57 +00:00
sapphi-red
fc43ec530e
feat(minifier): fold string.length / array.length ( #8172 )
2024-12-29 07:14:13 +00:00
翠 / green
74572de625
fix(ecmascript): incorrect to_int_32 value for Infinity ( #8144 )
...
https://tc39.es/ecma262/#sec-toint32
Infinity should return `0` when passed to `ToInt32` abstract operation.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-27 21:48:25 +08:00
翠 / green
6615e1ea93
feat(minifier): constant fold instanceof ( #8142 )
2024-12-27 21:45:31 +08:00
oxc-bot
5a1311e76c
release(crates): v0.44.0 ( #8110 )
...
## [0.44.0] - 2024-12-25
- ad2a620 ast: [**BREAKING**] Add missing
`AssignmentTargetProperty::computed` (#8097 ) (Boshen)
### Features
- c2daa20 ast: Add `Expression::into_inner_expression` (#8048 )
(overlookmotel)
- 618b6aa codege: Minify whitespace in object getter / setter (#8080 )
(Boshen)
- 4727667 codegen: Minify arrow expr `(x) => y` -> `x => y` (#8078 )
(Boshen)
- 0562830 codegen: Minify string with backtick when needed (#8095 )
(Boshen)
- 6237c05 codegen: Minify more whitespace (#8089 ) (Boshen)
- 6355b7c codegen: Minify `export { 's' as 's' }` -> `export { 's' }`
(#8093 ) (Boshen)
- fccfda9 codegen: Minify `class{static[computed]}` (#8088 ) (Boshen)
- f873139 codegen: Minify `for (_ of [])` -> `for(_ of[])` (#8086 )
(Boshen)
- 8b8cbcd codegen: Minify `case "foo"` -> `case"foo"` (#8085 ) (Boshen)
- 414c118 codegen: Minify `yield "s"` -> `yield"s"` (#8084 ) (Boshen)
- f8f067b codegen: Minify class method `async*fn(){}` (#8083 ) (Boshen)
- 1d5ae81 codegen: Minify `const [foo] = bar` -> `const[foo]=bar`
(#8079 ) (Boshen)
- e3f78fb codegen: `new Foo()` -> `new Foo` when minify (#8077 ) (Boshen)
- d84d60a codegen: Minify numbers with large exponents (#8074 ) (Boshen)
- 373279b codegen: Balance string quotes when minify whitespace (#8072 )
(Boshen)
- 5397fe9 minifier: Constant fold `undefined?.bar` -> `undefined`
(#8075 ) (Boshen)
- 1932f1e minifier: Fold `foo === undefined || foo === null` (#8063 ) (翠
/ green)
- 11c4bd8 span: Implement source type `{file basename}.d.{extension}.ts`
(#8109 ) (Boshen)
- be4feb4 syntax: Add `SymbolId::new` method (#8041 ) (overlookmotel)
- e632a7b transformer: Remove typescript symbols after transform (#8069 )
(Boshen)
### Bug Fixes
- bdc241d codegen: Disallow template literals in object property key
(#8108 ) (Boshen)
- 728ed20 codegen: Print `yield * ident` correctly (Boshen)
- b605baa minifier: Constant fold strings with tab char (#8096 ) (Boshen)
- de82492 parser: Report syntax errors for missing constructor
implementations (#8081 ) (camc314)
- 55d6eb9 parser: Disallow type parameters on class constructors (#8071 )
(injuly)
- be2c60d parser: Parse `import source from from 'mod'` (#8056 ) (Boshen)
- 708e9cf semantic: Report errors for missing class method impls (#8082 )
(camc314)
- 3057686 transformer/class-properties: Unwrap parenthesised expressions
(#8049 ) (overlookmotel)
- e67cd05 transformer/class-properties: Correctly resolve private fields
pointing to private accessors (#8047 ) (overlookmotel)
- 6b08c6e transformer/class-properties: Correctly resolve private fields
pointing to private methods (#8042 ) (overlookmotel)
- 274f117 transformer/nullish-coalescing: Use correct scope id for
binding (#8053 ) (camc314)
### Performance
- 78d2e83 sourcemap: Improve perf of `search_original_line_and_column`
(#7926 ) (Cameron)
### Refactor
- 7110c7b codegen: Add `print_quoted_utf16` and `print_unquoted_utf16`
methods (#8107 ) (Boshen)
- 8b54d89 minifier: Remove parens must happen on enter (#8060 ) (Boshen)
- 7cb84f3 minifier: Only minify on ast node exit (#8059 ) (Boshen)
- 77d845a minifier: Fuse DCE AST passes (#8058 ) (Boshen)
- 6123f5e minifier: Fold statements on exit (#8057 ) (Boshen)
- cbd5169 transformer/class-properties: Do not recreate private field if
not transforming it (#8044 ) (overlookmotel)
- 98e8a72 transformer/class-properties: Do not take mut ref when immut
ref will do (#8040 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-25 21:03:09 +08:00
Boshen
5397fe978a
feat(minifier): constant fold undefined?.bar -> undefined ( #8075 )
2024-12-23 15:20:37 +00:00
oxc-bot
d69de3629d
release(crates): v0.43.0 ( #8054 )
...
## [0.43.0] - 2024-12-21
- de4c772 traverse: [**BREAKING**] Rename `Ancestor::is_via_*` methods
to `is_parent_of_*` (#8031 ) (overlookmotel)
- ed75e42 semantic: [**BREAKING**] Make SymbolTable fields `pub(crate)`
instead of `pub` (#7999 ) (Boshen)
### Features
- 75b775c allocator: `Vec<u8>::into_string` (#8017 ) (overlookmotel)
- 8547e02 ast: Implement `allocator_api2` for `Allocator` (#8043 )
(Boshen)
- 63a95e4 ast: Add `AstBulder::move_property_key` (#7998 )
(overlookmotel)
- 897a1a8 transformer/class-properties: Exit faster from super
replacement visitor (#8028 ) (overlookmotel)
- 3ea4109 transformer/class-properties: Transform super update
expressions within static prop initializer (#7997 ) (Dunqing)
- cc57db3 transformer/class-properties: Transform super assignment
expressions within static prop initializer (#7991 ) (Dunqing)
- 6b6444b traverse: Record current block scope (#8007 ) (overlookmotel)
### Bug Fixes
- 043252d transformer/class-properties: Replace `this` and class name in
static blocks (#8035 ) (overlookmotel)
- 273795d transformer/class-properties: Run other transforms on static
properties, static blocks, and computed keys (#7982 ) (overlookmotel)
### Performance
- c0dd3f8 ast: `move_expression` and `move_statement` produce dummy with
no span (#7995 ) (overlookmotel)
- 862838f codegen: Remove useless to_owned (#8014 ) (Dunqing)
- 2736657 semantic: Allocate `UnresolvedReferences` in allocator (#8046 )
(Boshen)
- 2e8872c semantic: Allocate child scope in allocator (#8045 ) (Boshen)
- 414e828 semantic: Allocate symbol data in Allocator (#8012 ) (Boshen)
- 7aebed0 semantic: Allocate `Bindings` in allocator (#8021 ) (Boshen)
- 0f9308f transformer/react-refresh: Reduce allocations (#8018 )
(overlookmotel)
- 0deb9e6 transformer/react-refresh: Reserve capacity in hook key string
(#8016 ) (overlookmotel)
- 7b70347 transformer/react-refresh: Avoid allocating string in each
hook call (#8013 ) (Dunqing)
### Documentation
- df5c341 ast: Improve docs for `AstBuilder::move_*` methods (#7994 )
(overlookmotel)
### Refactor
- f1adf9f semantic: `ScopeTree::rename_binding` remove old binding first
(#8020 ) (overlookmotel)
- 02f968d semantic: Change `Bindings` to a plain `FxHashMap` (#8019 )
(Boshen)
- e7476a1 semantic: Remove `serialize` (#8015 ) (Boshen)
- 1cf7b83 semantic: Simplify handling namespace stack (#7987 ) (Dunqing)
- 48cb52b semantic: Remove resetting `current_reference_flags` in visit
functions (#7986 ) (Dunqing)
- 3250a47 semantic: Remove unused current_symbol_flags (#7985 ) (Dunqing)
- efe96ec semantic: Use `Stack` for function stack node ids (#7984 )
(Dunqing)
- ac097e9 transformer/class-properties: Rename file (#8036 )
(overlookmotel)
- 059a5dd transformer/class-properties: Do not pass `ScopeId` into
`insert_instance_inits` (#8001 ) (overlookmotel)
- 0a38eea transformer/class-properties: Use `temp_var_name_base` to
generate temp var names for `super` transform (#8004 ) (overlookmotel)
- d1b7181 transformer/class-properties: Rename var (#8006 )
(overlookmotel)
- 5a23d72 transformer/class-properties: Remove outdated comment (#8000 )
(overlookmotel)
- b3a5f3e transformer/class-properties: Mark
`transform_assignment_expression_if_super_member_assignment_target` as
inline (#7993 ) (Dunqing)
### Testing
- bcb33c0 semantic: Add a test for catch parameters reference (#7988 )
(Dunqing)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-21 15:07:21 +08:00
oxc-bot
3631eed975
release(crates): v0.42.0 ( #7983 )
...
## [0.42.0] - 2024-12-18
- 84b75a0 semantic: [**BREAKING**] Remove `ScopeFlags::Modifiers`
(#7935 ) (overlookmotel)
- c071494 semantic: [**BREAKING**] Remove `SymbolTable::rename` method
(#7868 ) (overlookmotel)
### Features
- 8b7c5ae ast: Add `AstBuilder::atom_from_cow` (#7974 ) (overlookmotel)
- 46e2e27 data_structures: Implement `Default` for `NonEmptyStack`
(#7946 ) (overlookmotel)
- db9e93b mangler: Mangle top level variables (#7907 ) (翠 / green)
- 075bd16 minifier: Fold bitwise operation (#7908 ) (翠 / green)
- c16a851 napi/transform: Add `jsx: 'preserve'` option (#7965 ) (Boshen)
- 81eedb1 parser: 'readonly' type modifier is only permitted on array
and tuple literal types. (#7880 ) (Boshen)
- b9322c6 semantic: Re-export all flags and ID types (#7886 )
(overlookmotel)
- c30a982 span: Add `impl From<ArenaString> for Atom` (#7973 )
(overlookmotel)
- 02b653c transformer/class-properties: Do not create temp var for
template literal computed key (#7919 ) (overlookmotel)
- feac02e transformer/class-properties: Only rename symbols if necessary
(#7896 ) (overlookmotel)
- 6bc530d transformer/class-properties: Transform super call expression
that is inside static prop initializer (#7831 ) (Dunqing)
- 53e2bc0 traverse: Add `TraverseScoping::rename_symbol` method (#7871 )
(overlookmotel)
### Bug Fixes
- 3659e6d cfg: Include export default code in CFG instructions (#7862 )
(Jan Olaf Martin)
- 850dd43 codegen: Missing `,` when generating type parameters with jsx
(#7929 ) (Dunqing)
- 4799471 minfier: Bigint bitwise operation only works with bigint
(#7937 ) (Boshen)
- de8a86e minifier: Incorrect minification in `try_fold_left_child_op`
(#7949 ) (翠 / green)
- 9a30910 oxc_transformer: Inject_global_variables should considering
string imported name (#7768 ) (IWANABETHATGUY)
- 111dc52 parser: Include export token in spans of
TSNamespaceExportDeclaration (#7963 ) (branchseer)
- 14c51ff semantic: Remove inherting `ScopeFlags::Modifier` from parent
scope (#7932 ) (Dunqing)
- 596aead semantic: Reset references flags when resolved (#7923 )
(Dunqing)
- 4924073 semantic: `ScopeTree::rename_binding` preserve order of
bindings (#7870 ) (overlookmotel)
- bb38065 transformer/class-properties: Do not transform `super.prop` in
nested method within static prop initializer (#7978 ) (overlookmotel)
- e76fbb0 transformer/class-properties: Fix symbol clashes in instance
prop initializers (#7872 ) (overlookmotel)
- c0576fa transformer/class-properties: Use UID for `args` in created
class constructor (#7866 ) (overlookmotel)
- d660d8d transformer/optional-chaining: Do not create unused reference
when `noDocumentAll` assumption (#7847 ) (overlookmotel)
- 4920c6a transformer/optional-chaining: Avoid creating a useless
reference when `noDocumentAll` is true (#7832 ) (Dunqing)
### Performance
- a5f04a7 ast: Faster `Comment::is_jsdoc` (#7905 ) (overlookmotel)
- 4b24335 codegen: Improve printing of statement comments (#7857 )
(Boshen)
- 71a40a2 codegen: Guard comment printing comments when there are no
comments (#7856 ) (Boshen)
- b31f123 transformer/class-properties: Do not re-generate same method
key (#7915 ) (overlookmotel)
- 8ca8fce transformer/class-properties: Reduce work updating scopes when
transforming static prop initializers (#7904 ) (overlookmotel)
- 80d0b3e transformer/class-properties: Fast path for instance prop
initializer scope re-parenting (#7901 ) (overlookmotel)
- 38aafa2 transformer/class-properties: Reduce size of
`transform_call_expression_for_super_member_expr` (#7859 )
(overlookmotel)
### Documentation
- e49de81 ast: Document `Expression::is_*` methods (#7853 )
(overlookmotel)
- 10a86b9 transformer: Fix comments (#7925 ) (overlookmotel)
- f4cb5d3 transformer: Clarify comment (#7918 ) (overlookmotel)
- 41a1456 transformer/class-properties: Correct doc comments (#7966 )
(overlookmotel)
- 18441af transformer/class-properties: Remove oudated todo for
assignment expression (#7955 ) (Dunqing)
- 1317c00 transformer/class-properties: Clarify doc comments (#7914 )
(overlookmotel)
- 9989b58 transformer/class-properties: Re-order file list in doc
comment (#7911 ) (overlookmotel)
- 7390048 transformer/class-properties: Reformat doc comment (#7909 )
(overlookmotel)
### Refactor
- beb982a ast: Use exhaustive match for `Argument` to
`ArrayExpressionElement` conversion (#7848 ) (overlookmotel)
- 3858221 global: Sort imports (#7883 ) (overlookmotel)
- 1314c97 minifier: Expose dce as an API instead of an option (#7957 )
(Boshen)
- 6551dfe semantic: Pass `&str` instead of `Cow` (#7972 ) (overlookmotel)
- b8d2bd2 semantic: Move determining references flags for export
specifier to `visit_export_named_declaration` (#7924 ) (Dunqing)
- 98d7946 semantic: Import flags and ID types from `oxc_syntax` (#7887 )
(overlookmotel)
- 1cf8f8f semantic: `SymbolTable::set_name` return old name (#7869 )
(overlookmotel)
- 5d42df8 semantic: Use `Expression::is_super` (#7851 ) (overlookmotel)
- 8cf9766 semantic, syntax, wasm: Remove `#![allow(non_snake_case)]`
(#7863 ) (overlookmotel)
- d59bbae transformer: Remove unneeded lint `#[allow]` (#7971 )
(overlookmotel)
- 2c94236 transformer: Improve encapsulation of transforms (#7888 )
(overlookmotel)
- 34091b2 transformer: Use `Expression::is_super` (#7852 )
(overlookmotel)
- d4d7bc0 transformer/async-to-generator: Avoid allocating unnecessary
`Atom`s (#7975 ) (overlookmotel)
- 2e5ffd3 transformer/class-properties: Store `temp_var_is_created` on
`ClassBindings` (#7981 ) (overlookmotel)
- 27cc6da transformer/class-properties: Store `is_declaration` only on
`ClassDetails` (#7980 ) (overlookmotel)
- ee282f8 transformer/class-properties: Remove `move_expression`s
(#7979 ) (overlookmotel)
- 94b376a transformer/class-properties: Simplify logic for when to
create temp binding (#7977 ) (overlookmotel)
- ff9d1b3 transformer/class-properties: Comments about shorter output
(#7976 ) (overlookmotel)
- 6fc40f0 transformer/class-properties: Pass `BoundIdentifier`s by
reference (#7968 ) (overlookmotel)
- 69eeeea transformer/class-properties: Methods take `&self` where
possible (#7967 ) (overlookmotel)
- 98340bb transformer/class-properties: Use stack of `ClassDetails`
(#7947 ) (overlookmotel)
- 088dd48 transformer/class-properties: Shorten code (#7913 )
(overlookmotel)
- 544ffbf transformer/class-properties: Split up code into multiple
files (#7912 ) (overlookmotel)
- dcaf674 transformer/class-properties: Rename file (#7910 )
(overlookmotel)
- 6243980 transformer/class-properties: Instance prop inits visitor use
`Visit` (#7867 ) (overlookmotel)
- eb47d43 transformer/class-properties: Re-use existing `Vec` (#7854 )
(overlookmotel)
- 1380b7b transformer/class-properties: Reduce visibility of method
(#7858 ) (overlookmotel)
- 0f5e078 transformer/class-properties: Rename `*_owner` to `owned_*`
(#7855 ) (Dunqing)
- 4ea90d4 transformer/react-refresh: Calculate signature key once
(#7970 ) (Dunqing)
- 15b9bff transformer/typescript: Reuse `Atom` (#7969 ) (overlookmotel)
### Styling
- fb897f6 data_structures: Add line break (#7882 ) (overlookmotel)
- 7fb9d47 rust: `cargo +nightly fmt` (#7877 ) (Boshen)
### Testing
- 523d48c transformer: Move named test to exports folder (#7922 )
(Dunqing)
- e766051 transformer: Skip test which uses filesystem under miri
(#7874 ) (overlookmotel)
- f39e65e transformer: Prevent lint error when running miri (#7873 )
(overlookmotel)
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2024-12-18 11:48:12 +08:00
Boshen
4799471c1e
fix(minfier): bigint bitwise operation only works with bigint ( #7937 )
2024-12-16 13:25:39 +00:00
翠 / green
075bd165a8
feat(minifier): fold bitwise operation ( #7908 )
...
This PR implements constant evaluation for bitwise operations (`&`, `|`,
`^`).
I wanted to play around with the minifier a bit 🙂
2024-12-15 21:27:05 +08:00
overlookmotel
3858221f45
refactor(global): sort imports ( #7883 )
...
Pure refactor. Re-order imports for clarity:
1. `std`
2. External crates
3. `oxc_*` crates
4. Current crate `use crate::...`
5. Super `use super::...`
6. Local modules
This order is from "furthest away" to "closest". This makes it clearer to see what is coming from where.
`cargo +nightly fmt` (#7877 ) did a lot of the work, but unfortunately `rustfmt` does not have an option to (a) put workspace crates in a separate block from external crates and (b) move `mod` statements to after `use` statements.
2024-12-14 15:07:21 +00:00
Boshen
7fb9d47460
style(rust): cargo +nightly fmt ( #7877 )
2024-12-14 06:03:31 +00:00
oxc-bot
1428527da6
release(crates): v0.41.0 ( #7846 )
...
## [0.41.0] - 2024-12-13
- fb325dc ast: [**BREAKING**] `span` field must be the first element
(#7821 ) (Boshen)
- 96a26d3 ast: [**BREAKING**] Rename `is_strict` methods to
`has_use_strict_directive` (#7783 ) (overlookmotel)
### Features
- 8991f33 ast: Add `visit_span` to `Visit` and `VisitMut` (#7816 )
(overlookmotel)
- f7900ab ast: Add `ArrowFunctionExpression::has_use_strict_directive`
method (#7784 ) (overlookmotel)
- e727ae9 transformer/class-properties: Transform super member
expressions that are inside static prop initializer (#7815 ) (Dunqing)
### Bug Fixes
- 7610dc1 parser: Parse `import source from 'mod'` (#7833 ) (Boshen)
- 9479e2b semantic: Missing references when `export {}` references a
type-only binding and a normal (#7812 ) (Yunfei He)
- 7a83230 semantic: Missing reference when `export default` references a
type alias binding (#7813 ) (Dunqing)
- 4a3bca8 semantic: Fix identifying strict mode arrow functions (#7785 )
(overlookmotel)
- 5b7e1ad transformer: Remove span of define value (#7811 ) (Hiroshi
Ogawa)
- 14896cb transformer/class-properties: Create temp vars in correct
scope (#7824 ) (overlookmotel)
- 25bb6da transformer/class-properties: Fix `ScopeId`s in instance prop
initializers (#7823 ) (overlookmotel)
- 65b109a transformer/class-properties: No `raw` for generated
`StringLiteral` (#7825 ) (overlookmotel)
- 2964a61 transformer/class-properties: Unwrap failed when private field
expression doesn't contain optional expression in `ChainExpression`
(#7798 ) (Dunqing)
- 6fa6785 transformer/class-properties: Panic when the callee or member
is `ParenthesisExpression` or TS-syntax expressions. (#7795 ) (Dunqing)
- bb22c67 transformer/class-properties: Fix `ScopeId`s in static prop
initializers (#7791 ) (overlookmotel)
- caa57f1 transformer/class-properties: Fix scope flags in static prop
initializers (#7786 ) (overlookmotel)
### Performance
- 4448b63 codegen: Faster writing indentation (#7820 ) (overlookmotel)
- afaaffa codegen: Fast path for `options.print_comments()` (#7806 )
(Boshen)
### Refactor
- 0f367e5 semantic: Improve the logic of resolving references to be
cleaner (#7829 ) (Dunqing)
- 5710950 semantic: Move export-related reference flags logic to visit
functions (#7828 ) (Dunqing)
- b290ebd transformer: Handle `<CWD>` in test runner (#7799 ) (Dunqing)
- e70deb9 transformer/class-properties: Locate instance props insertion
location in separate step (#7819 ) (overlookmotel)
- afc5f1e transformer/class-properties: De-deduplicate code (#7805 )
(overlookmotel)
- 47a91d2 transformer/class-properties: Shorten code (#7804 )
(overlookmotel)
- 54ef2b9 transformer/class-properties: Rename
`debug_assert_expr_is_not_parenthesis_or_typescript_syntax` (#7803 )
(overlookmotel)
- 3cdc47c transformer/class-properties: `#[inline(always)]` on
`assert_expr_neither_parenthesis_nor_typescript_syntax` (#7802 )
(overlookmotel)
### Testing
- d72c888 transformer/replace-global-defines: Remove panicking test
(#7838 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-13 21:25:13 +08:00
oxc-bot
bd572c609b
release(crates): v0.40.1 ( #7781 )
...
## [0.40.1] - 2024-12-10
### Bug Fixes
- 18d0ce3 napi: Rename `Error` to `OxcError` to avoid name collision
(#7780 ) (Boshen)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-11 00:35:34 +08:00
oxc-bot
6768f7ded2
release(crates): v0.40.0 ( #7775 )
2024-12-10 23:04:43 +08:00
oxc-bot
fee2143f4c
release(crates): v0.39.0 ( #7643 )
2024-12-04 19:43:22 +08:00
Boshen
9d6e14bb67
test(ecmascript): move tests to oxc_minifier due to cyclic dependency with oxc_parser ( #7542 )
2024-11-29 09:18:45 +00:00
Boshen
d942a8d41a
chore: Rust v1.83.0 changes ( #7535 )
...
This PR does not upgrade rustc. Only changes are applied.
We cannot upgrade to the lastet Rust version yet due to wasm-bindgen
breaking some generated types.
THere's also some elided lifetimes in `**/generated/**`, which requires
modification to ast tools.
2024-11-29 11:59:45 +08:00
Boshen
b0e1c03284
feat(ast)!: add StringLiteral::raw field ( #7393 )
...
part of #7254
2024-11-26 23:33:56 +08:00
7086cmd
24189f28ad
feat(ecma): implement array join method ( #6936 )
2024-11-26 11:28:07 +00:00
oxc-bot
00a7372eaf
release(crates): v0.38.0 ( #7490 )
2024-11-26 14:38:47 +08:00
oxc-bot
0918e520cf
release(crates): v0.37.0 ( #7399 )
2024-11-21 22:27:55 +08:00
oxc-bot
de107246c8
release(crates): v0.36.0 ( #7227 )
...
## [0.36.0] - 2024-11-09
- b11ed2c ast: [**BREAKING**] Remove useless `ObjectProperty::init`
field (#7220 ) (Boshen)
- 0e4adc1 ast: [**BREAKING**] Remove invalid expressions from
`TSEnumMemberName` (#7219 ) (Boshen)
- 846711c transformer: [**BREAKING**] Change API to take a
`&TransformOptions` instead of `TransformOptions` (#7213 ) (Boshen)
- 092de67 types: [**BREAKING**] Append `rest` field into `elements` for
objects and arrays to align with estree (#7212 ) (ottomated)
- d1d1874 ast: [**BREAKING**] Change `comment.span` to real position
that contain `//` and `/*` (#7154 ) (Boshen)
- 843bce4 ast: [**BREAKING**] `IdentifierReference::reference_id` return
`ReferenceId` (#7126 ) (overlookmotel)
### Features
- cc8a191 ast: Methods on AST nodes to get `scope_id` etc (#7127 )
(overlookmotel)
- dc0215c ast_tools: Add #[estree(append_to)], remove some custom
serialization code (#7149 ) (ottomated)
- 9d6cc9d estree: ESTree compatibility for all literals (#7152 )
(ottomated)
- b74686c isolated-declarations: Support transform TSExportAssignment
declaration (#7204 ) (Dunqing)
- ad3a2f5 tasks/compat_data: Generate our own compat table (#7176 )
(Boshen)
- b4258ee transformer: Add defaulted `Module::Preserve` option (#7225 )
(Boshen)
- 324c3fe transformer: Add `TransformOptions::module` option (#7188 )
(Boshen)
- a166a4a transformer: Add esbuild comma separated target API
`--target=es2020,chrome58` (#7210 ) (Boshen)
- 3a20b90 transformer: Add es target to `engineTargets` (#7193 ) (Boshen)
- 22898c8 transformer: Warn BigInt when targeting < ES2020 (#7184 )
(Boshen)
- a579011 transformer: Add features `ES2018NamedCapturingGroupsRegex`
and `ES2018LookbehindRegex` (#7182 ) (Boshen)
- 8573f79 transformer: Turn on async_to_generator and
async_generator_functions plugins in enable_all (#7135 ) (Dunqing)
- df77241 transformer: Enable `ArrowFunctionConverter` in
`async-to-generator` and `async-generator-functions` plugins (#7113 )
(Dunqing)
- b6a5750 transformer/arrow-function-converter: Move scope to changed
scope for `this_var` if scope have changed (#7125 ) (Dunqing)
- 1910227 transformer/async-to-generator: Support inferring the function
name from the ObjectPropertyValue's key (#7201 ) (Dunqing)
- ffa8604 transformer/async-to-generator: Do not transform await
expression if is not inside async function (#7138 ) (Dunqing)
- e536d47 transformer/babel: Add support for trying to get the `Module`
from `BabelPlugins` (#7218 ) (Dunqing)
- 5cfdc05 transformer/typescript: Support transform `export =` and
`import = require(...)` when module is commonjs (#7206 ) (Dunqing)
### Bug Fixes
- c82b273 transformer/async-generator-functions: Only transform object
method in exit_function (#7200 ) (Dunqing)
- b2a888d transformer/async-generator-functions: Incorrect
transformation for `for await` if it's not placed in a block (#7148 )
(Dunqing)
- 19892ed transformer/async-generator-functions: Transform incorrectly
for `for await` if it's in LabeledStatement (#7147 ) (Dunqing)
- ede10dc transformer/async-to-generator: Incorrect transform when super
expression is inside async method (#7171 ) (Dunqing)
- 293d072 transformer/async-to-generator: Only transform object method
in exit_function (#7199 ) (Dunqing)
- ae692d7 transformer/async_to_generator: Fix checking if function is
class method (#7117 ) (overlookmotel)
- eea4ab8 transformer/helper-loader: Incorrect `SymbolFlags` for default
import when `SourceType` is script (#7226 ) (Dunqing)
### Refactor
- d27e14f ast: `AstKind::as_*` methods take `self` (#5546 )
(overlookmotel)
- fac5042 ast: Use `scope_id` etc methods (#7130 ) (overlookmotel)
- a297765 minifier: Use `map` and `and_then` instead of let else (#7178 )
(7086cmd)
- fc86703 napi/transform: Change test files to TypeScript (#7221 )
(Boshen)
- c5485ae semantic: Add `ancestor_kinds` iterator function (#7217 )
(camchenry)
- abf1602 semantic: Rename `iter_parents` to `ancestors` (#7216 )
(camchenry)
- 42171eb semantic: Rename `ancestors` to `ancestor_ids` (#7215 )
(camchenry)
- de56083 transformer: Add `impl TryFrom<EngineTargets> for EnvOptions`
(#7191 ) (Boshen)
- 0a43c64 transformer: Move `ESTarget` to its own file (#7189 ) (Boshen)
- 0e1f12c transformer: Remove unimplemented `EnvOptions::bugfixes`
(#7162 ) (Boshen)
- a981caf transformer: Add `Engine` enum for `EngineTargets` (#7161 )
(Boshen)
- 8340243 transformer: Rename `Query` to `BrowserslistQuery` (#7143 )
(Boshen)
- 481f7e6 transformer: Change `Targets` to `EngineTargets` (#7142 )
(Boshen)
- 55e6989 transformer: Deserialize engine target strings to specific
keys (#7139 ) (Boshen)
- fdfd9a4 transformer: Use `scope_id` etc methods (#7128 )
(overlookmotel)
- ff8bd50 transformer: Move implementation of ArrowFunction to
common/ArrowFunctionConverter (#7107 ) (Dunqing)
- 4a515be transformer/arrow-function-coverter: Rename function name and
add some comments to explain confusing parts. (#7203 ) (Dunqing)
- c307e1b transformer/arrow-functions: Pass `ArenaBox` as function param
(#7169 ) (overlookmotel)
- 217d433 transformer/arrow-functions: Remove unused `&mut self`
function param (#7165 ) (overlookmotel)
- 426df71 transformer/arrow-functions: Use `scope_id` method (#7164 )
(overlookmotel)
- 11c5e12 transformer/arrow-functions: Correct comments (#7163 )
(overlookmotel)
- 1238506 transformer/async-generator-function: Remove inactive
`#[allow(clippy::unused_self)]` attrs (#7167 ) (overlookmotel)
- 84ee581 transformer/async-generator-functions: Simplify identifying
whether within an async generator function (#7170 ) (overlookmotel)
- 1b12328 transformer/async-generator-functions: Use `clone` not
`clone_in` on `LabelIdentifier` (#7172 ) (overlookmotel)
- cd1006f transformer/async-generator-functions: Do not transform yield
expression where inside generator function (#7134 ) (Dunqing)
- 2c5734d transformer/async-generator-functions: Do not transform await
expression where inside ArrowFunctionExpression (#7132 ) (Dunqing)
- 5ce83bd transformer/async-generator-functions: Remove dead code for
handle await expression (#7131 ) (Dunqing)
- e04ee97 transformer/async-generator-functions: Move handling of
`MethodDefinition`'s value to `exit_function` (#7106 ) (Dunqing)
- b57d5a5 transformer/async-to-generator: Remove unused `&self` function
param (#7166 ) (overlookmotel)
- f80085c transformer/async-to-generator: Move handling of
`MethodDefinition`'s value to `exit_function` (#7105 ) (Dunqing)
- e2241e6 transformer/jsx-self: Remove unused `&self` function params
(#7159 ) (overlookmotel)
- 1dfd241 transformer/optional-catch-binding: Remove inactive
`#[allow(clippy::unused_self)]` attr (#7158 ) (overlookmotel)
- fd9b44c transformer/typescript: Remove inactive
`#[allow(clippy::unused_self)]` attr (#7160 ) (overlookmotel)
- cacfb9b traverse: Use `symbol_id` etc methods (#7129 ) (overlookmotel)
### Styling
- 38a6df6 transformer/arrow-functions: Semicolon after return statements
(#7168 ) (overlookmotel)
- 64b7e3a transformer/async-generator-functions: Import
`oxc_allocator::Vec` as `ArenaVec` (#7173 ) (overlookmotel)
### Testing
- be819dd napi/transform: Add test for not default es transform (Boshen)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-10 00:31:14 +08:00
oxc-bot
12a6952782
release(crates): v0.35.0 ( #7110 )
...
## [0.35.0] - 2024-11-04
- f543a8d ast: [**BREAKING**] Remove `AstBuilder::*_from_*` methods
(#7073 ) (overlookmotel)
- b8daab3 transformer: [**BREAKING**] API to `TryFrom<&EnvOptions> for
TransformOptions` and `TryFrom<&BabelOptions> TransformOptions` (#7020 )
(Boshen)
- 9a6a2f9 semantic: [**BREAKING**] Remove
`SymbolTable::get_symbol_id_from_span` API (#6955 ) (Boshen)
### Features
- 854870e ast: Label AST fields with #[ts] (#6987 ) (ottomated)
- ce5b609 ast: Remove explicit untagged marker on enums (#6915 )
(ottomated)
- 9725e3c ast_tools: Add #[estree(always_flatten)] to Span (#6935 )
(ottomated)
- fbc297e ast_tools: Move tsify custom types to estree attribute macro
(#6934 ) (ottomated)
- 169fa22 ast_tools: Default enums to rename_all = "camelCase" (#6933 )
(ottomated)
- caa4b1f codegen: Improve printing of comments (#7108 ) (Boshen)
- 001058a codegen: Always print legal comments on its own line (#7089 )
(Boshen)
- 413973d codegen: Print linked and external legal comment (#7059 )
(Boshen)
- ee27b92 codegen: Print eof legal comments (#7058 ) (Boshen)
- 6516f9e codegen: Print inline legal comments (#7054 ) (Boshen)
- 1e2f012 linter: Add `oxc/no-map-spread` (#6751 ) (DonIsaac)
- 6d97af4 rust: Use `oxc-miette` (#6938 ) (Boshen)
- bfdbcf1 transformer: Add `EnvOptions::from_browerslist_query` API
(#7098 ) (Boshen)
- 21b8e49 transformer: Add `ESTarget` (#7091 ) (Boshen)
- fcaba4a transformer: Add `TransformerOptions::env` with `EnvOptions`
(#7037 ) (Boshen)
- 1d906c6 transformer: Class properties transform skeleton (#7038 )
(overlookmotel)
- 934cb5e transformer: Add `async_generator_functions` plugin (#6573 )
(Dunqing)
### Bug Fixes
- 0601271 ast: Fix `StaticMemberExpression.get_first_object` (#6969 )
(tomoya yanagibashi)
- da199c7 ecmascript: Allow getting PropName for object methods (#6967 )
(camchenry)
- f5a7134 linter/no-unused-vars: False positive for discarded reads
within sequences (#6907 ) (DonIsaac)
- 9ed9501 module_lexer: Add missing `export * from 'foo';` case (#7103 )
(Boshen)
- d15e408 napi/transform: Fix 'typescript.declaration' option not
working (#7012 ) (Boshen)
- dcdb9ea napi/transform: Fix test (Boshen)
- caaf00e parser: Fix incorrect parsed `TSIndexSignature` (#7016 )
(Boshen)
- b188b4a transformer: Fix typescript globals being recognized as
globals (#7100 ) (Boshen)
- a2244ff transformer/async-to-generator: Output is incorrect when arrow
function without params (#7052 ) (Dunqing)
- 7d12669 types: Move @oxc-project/types to dependencies (#6909 )
(ottomated)
### Performance
- 6ca01b9 ast: Reduce size of `Comment` (#6921 ) (overlookmotel)
- c58ec89 data_structures: Optimize `NonEmptyStack::pop` (#7021 )
(overlookmotel)
- fa9a4ec parser: Check `.` before `[` in `parse_member_expression_rest`
(#6979 ) (Boshen)
### Refactor
- b0211a1 ast: `StaticMemberExpression::get_first_object` use loop
instead of recursion (#7065 ) (overlookmotel)
- fc07458 ast: Move custom types `.d.ts` file (#6931 ) (overlookmotel)
- c41c013 ast: Rename lifetime (#6922 ) (overlookmotel)
- 335eb38 ast_tools: Faster formatting Rust code (#6972 ) (overlookmotel)
- 4cf0085 ast_tools: Reorder imports in generated code (#6926 )
(overlookmotel)
- dd79c1b codegen: Replace `daachorse` with string match for annotation
comment (#7064 ) (Boshen)
- 0bb1aa4 codegen: Move options to its own file (#7053 ) (Boshen)
- b021147 data_structures: Make all methods of `NonNull` shim
`#[inline(always)]` (#7024 ) (overlookmotel)
- fb1710a data_structures: Add `#[repr(transparent)]` to `NonNull` shim
(#7023 ) (overlookmotel)
- f1fc8db data_structures: Add `read` method to `NonNull` shim (#7022 )
(overlookmotel)
- cea0e6b isolated_declarations: Do not use `AstBuilder::*_from_*`
methods (#7071 ) (overlookmotel)
- 97caae1 minifier: Do not use `AstBuilder::*_from_*` methods (#7072 )
(overlookmotel)
- 2c7ac29 minifier: Remove `Tri`, use `Option<bool>` instead (#6912 )
(Boshen)
- 9926990 napi: Move custom types to bottom of file (#6930 )
(overlookmotel)
- 23157bd napi: Types file in root of types package (#6929 )
(overlookmotel)
- 953b051 parser: Remove `oxc_ecmascript` crate (#7109 ) (Boshen)
- fdd480d parser: Do not use `AstBuilder::*_from_*` methods (#7068 )
(overlookmotel)
- 9e85b10 parser: Add `ParserImpl::alloc` method (#7063 ) (overlookmotel)
- 17a938e parser: Use function `parse_type_member_semicolon` (#7018 )
(Boshen)
- aa1b29c parser: Remove `parse_ts_index_signature_member` function
(#7017 ) (Boshen)
- 7f1d1fe transform: Deserialize `BabelPreests::env` directly (#7051 )
(Boshen)
- 76947e2 transform: Refactor Babel Targets (#7026 ) (Boshen)
- d03e622 transformer: Do not use `AstBuilder::*_from_*` methods (#7070 )
(overlookmotel)
- 9d384ad transformer: Use `identifier_reference_with_reference_id`
builder method (#7056 ) (overlookmotel)
- 4688a06 transformer: Use `*_with_scope_id` builder methods where
possible (#7055 ) (overlookmotel)
- 7122e00 transformer: Use `ctx.alloc` over `ctx.ast.alloc` where
possible (#7066 ) (overlookmotel)
- a3b68b4 transformer: Flatten dir structure of options/babel/env
(#7049 ) (Boshen)
- 6d92f36 transformer: Deserialize `BabelOptions::compiler_assumptions`
(#7048 ) (Boshen)
- f83a760 transformer: Deserialize `BabelOptions::presets` (#7047 )
(Boshen)
- 52c20d6 transformer: Deserialize `BabelOptions::plugins` (#7045 )
(Boshen)
- e921df6 transformer: Rename `EnvOptions` to `BabelEnvOptions` (#7036 )
(Boshen)
- af5140f transformer: Isolate babel options logic (#7034 ) (Boshen)
- 12aa910 transformer: Clean up `env/targets/query.rs` (#7033 ) (Boshen)
- 3d174bb transformer: Clean up `BabelOptions` (#7029 ) (Boshen)
- 6284f84 transformer: Use `Browserslist::Version` (#7028 ) (Boshen)
- 5b11cdf transformer: Clean up TransformerOptions (#7005 ) (Boshen)
- f0c87d4 transformer: Mark all EnvOptions as not implemented (#7004 )
(Boshen)
- d9edef6 transformer: Combine ObjectRestSpread into a single file
(#7002 ) (Boshen)
- c945fe7 transformer: Import `oxc_allocator::Box` as `ArenaBox` (#6999 )
(overlookmotel)
- fc1af2e transformer: Import `oxc_allocator::Vec` as `ArenaVec` (#6998 )
(overlookmotel)
- 63e8bfe transformer: Rename `AString` to `ArenaString` (#6997 )
(overlookmotel)
- 562bb9a transformer/async-to-generator: Move transform methods to
`AsyncGeneratorExecutor` and make it public (#6992 ) (Dunqing)
- e23f7e6 transformer/common: `VarDeclarations` insert either `var` or
`let` statements (#7043 ) (overlookmotel)
- e5ecbb9 transformer/jsx: Return `&mut T` not `&mut ArenaBox<T>`
(#7001 ) (overlookmotel)
- 9e66c29 transformer/react-refresh: Small refactor (#6973 )
(overlookmotel)
- 1ca8cd2 transformer/react-refresh: Avoid panic for `init` of
`VariableDeclarator` isn't a `BindingIdentifier` (#6937 ) (Dunqing)
- 5f153ac transformer/react-refresh: Use `VarDeclarations` to insert
declarators (#6884 ) (Dunqing)
- df3b089 transformer/react-refresh: Use `StatementInjector` to insert
statements (#6881 ) (Dunqing)
- ae22671 transformer/typescript: Pass `&mut T` not `&mut ArenaBox<T>`
(#7000 ) (overlookmotel)
- 938ee87 traverse: Do not use `AstBuilder::*_from_*` methods (#7069 )
(overlookmotel)
### Styling
- 86ab091 transformer/common: Split up `StatementInjectorStore` methods
into blocks (#7042 ) (overlookmotel)
### Testing
- 64e2499 module_lexer: Use a single integration test for faster
compilation (#7097 ) (Boshen)
- 6133a50 transformer: Use a single integration test for faster
compilation (#7099 ) (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-11-04 17:40:05 +08:00
camchenry
da199c7476
fix(ecmascript): allow getting PropName for object methods ( #6967 )
...
Working on some lint rules and noticed that PropName didn't seem to be working as intended. According to the spec, we should definitely allow get/set/methods to have prop names:
https://tc39.es/ecma262/#sec-static-semantics-propname
<img width="694" alt="image" src="https://github.com/user-attachments/assets/60fdfeec-2320-4cd9-a786-901728e459b2 ">
However, we still need to retain this logic for checking `__proto__` because it has special rules.
2024-10-28 09:34:27 +00:00
oxc-bot
238e0866cb
release(crates): v0.34.0 ( #6908 )
...
## [0.34.0] - 2024-10-26
- 4618aa2 transformer: [**BREAKING**] Rename `TransformerOptions::react`
to `jsx` (#6888 ) (Boshen)
- 90c786c regular_expression: [**BREAKING**] Support ES2025 Duplicated
named capture groups (#6847 ) (leaysgur)
- 67a7bde napi/parser: [**BREAKING**] Add typings to napi/parser (#6796 )
(ottomated)
### Features
- 1145341 ast_tools: Output typescript to a separate package (#6755 )
(ottomated)
- 4429754 ecmascript: Constant eval `null` to number (#6879 ) (Boshen)
- fd57e00 ecmascript: Add abstract_relational_comparison to dce (#6846 )
(Boshen)
- 8bcaf59 minifier: Late peeophole optimization (#6882 ) (Boshen)
- 860cbca minifier: Implement folding simple arrow fns (#6875 ) (camc314)
- c26020e minifier: Implement folding String.prototype.replaceAll
(#6871 ) (camc314)
- 50744f3 minifier: Implement folding String.prototype.replace (#6870 )
(camc314)
- fccf82e minifier: Implement folding `substring` string fns (#6869 )
(camc314)
- e6a5a1b minifier: Implement folding `charCodeAt` string fns (#6475 )
(camc314)
- 0d0bb17 transformer: Complete the async-to-generator plugin (#6658 )
(Dunqing)
- 419343b traverse: Implement `GetAddress` for `Ancestor` (#6877 )
(overlookmotel)
### Bug Fixes
- a47c70e minifier: Fix remaining runtime bugs (#6855 ) (Boshen)
- 686727f minifier: Reference read has side effect (#6851 ) (Boshen)
- c658d93 minifier: Keep template literals with expressions (#6849 )
(Boshen)
- 4dc5e51 transformer: Only run typescript plugin for typescript source
(#6889 ) (Boshen)
- 076f5c3 transformer/typescript: Retain ExportNamedDeclaration without
specifiers and declaration (#6848 ) (Dunqing)
- b075982 types: Change @oxc/types package name (#6874 ) (ottomated)
### Documentation
- 6eeb0e6 ast: Mention typescript-eslint, field ordering and shape
(#6863 ) (Boshen)
- 99e3b32 napi: Remove JSON.parse from example (#6836 ) (ottomated)
### Refactor
- adb5039 allocator: Add `impl GetAddress for Address` (#6891 )
(overlookmotel)
- 3e7507f ast_tools: Reduce macro usage (#6895 ) (overlookmotel)
- 423d54c rust: Remove the annoying `clippy::wildcard_imports` (#6860 )
(Boshen)
- 2d95009 transformer: Implement `Debug` on `StatementInjector` internal
types (#6886 ) (overlookmotel)
- c383c34 transformer: Make `StatementInjectorStore` methods generic
over `GetAddress` (#6885 ) (overlookmotel)
- 1f29523 transformer: Rename ReactJsx to Jsx (#6883 ) (Boshen)
- 333b758 transformer: `StatementInjectorStore` methods take
`&Statement` as target (#6858 ) (overlookmotel)
- c19996c transformer: Add `StatementInjectorStore::insert_many_before`
method (#6857 ) (overlookmotel)
- 7339dde transformer: `StatementInjectorStore::insert_many_after` take
an iterator (#6856 ) (overlookmotel)
- 4348eae transformer/typescript: Re-order visitor methods (#6864 )
(overlookmotel)
- 3a56d59 transformer/typescript: Insert assignments after super by
`StatementInjector` (#6654 ) (Dunqing)
- a366fae traverse: Rename
`TraverseScoping::generate_binding_in_current_scope` (#6832 )
(overlookmotel)
- 3b99fe6 traverse: Move `generate_binding` to `TraverseScoping` (#6831 )
(overlookmotel)
- 60f487a traverse: `TraverseCtx::generate_binding` take an `Atom`
(#6830 ) (overlookmotel)
### Styling
- 262b2ed ast: Move crate doc comment to top of file (#6890 )
(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-10-26 09:39:53 +08:00