oxc-bot
00a7372eaf
release(crates): v0.38.0 ( #7490 )
2024-11-26 14:38:47 +08:00
Hiroshi Ogawa
d5df615264
fix(oxc_codegen): don't emit empty span mapping ( #7448 )
2024-11-24 17:04:52 +08:00
oxc-bot
0918e520cf
release(crates): v0.37.0 ( #7399 )
2024-11-21 22:27:55 +08:00
Boshen
f059b0e655
fix(ast)!: add missing ChainExpression from TSNonNullExpression ( #7377 )
...
closes #7375
* `foo?.bar!`
* `foo?.[bar]!`
`TSNonNullExpression` was not wrapped inside `ChainExpression`.
2024-11-20 15:54:28 +00:00
Boshen
82773cb455
feat(codegen): remove underscore from bigint ( #7367 )
...
closes #7285
closes #7286
2024-11-20 09:08:51 +00:00
Dunqing
c587dd3cd6
fix(codegen): do not print parenthesis for in expression in ArrowFunctionExpression ( #7360 )
...
Please check out [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAACgpID0+ICIiIGluIHt9 )
2024-11-19 14:29:18 +00:00
Dunqing
58db9ef322
refactor(codegen): do not print unnecessary parentheses if both sides use the same logical operator ( #7325 )
...
As shown by the changing tests, we don't need to print parentheses for them.
### Comparison
In [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAAGEgPz8gKGIgPz8gKGMgPz8gZCkpOwooYSA/PyAoYiA/PyAoYyA/PyBkKSkpOwooYSB8fCAoYiB8fCBjKSkgfHwgZDsKYSB8fCAoYiB8fCAoYyB8fCBkKSk7CmEgJiYgKChiICYmIGMpICYmIGQp ), it will print parentheses as-is, in [SWC](https://play.swc.rs/?version=1.9.2&code=H4sIAAAAAAAAA0tUsLdX0EgCk8kgMkVT05pLIxGLMES8pgYkDiSTNTVBVIo1F5IgUDFIDKQ2UUFNTUEDKAykkjVBZIomAGEbiHtuAAAA&config=H4sIAAAAAAAAA1VQzW7DIAy%2B9ykin6tlyrHXTb3ttCdA1GmpACPbSIuqvPuAJml6w9%2Bv8ePQdXAXC6fuUZ5lSIYFeZsLIlNU81cQ0CmhWHZJ4biyKpVSztiQ%2BUmAGr6iVhPK8DkMsOJsoozEYd%2BQBb9xdBHPxF%2FeiJwd%2BossuVsVo7G68xXIhUSsv5TZYi27qSY59T1K%2BJBbn56W48vAOaoLTWuyUjDqLCz0%2FPYDTyRVNxovyw4QXHTjtF%2FdUiglIu%2FCKjXx6jf%2FYc1v6RDokhu5HL0etq5U0gLFu8BLuTZu6eDkZ7W3s8%2F%2FYy0r4MUBAAA%3D ), we have the same output now
2024-11-19 10:31:53 +00:00
Song Gao
cf3415b0e4
chore(doc): replace main/master to tag/commit to make the url always accessible ( #7298 )
2024-11-16 21:00:30 +08:00
overlookmotel
a0766e6a7f
fix(codegen): fix arithmetic overflow printing unspanned nodes ( #7292 )
...
Similar to #7289 . Check if `span.end` is 0 before doing `span.end - 1`, to prevent arithmetic overflow.
Also changed all checks to `span.end > 0`, just for consistency.
2024-11-15 16:04:02 +00:00
overlookmotel
33ec4e6182
fix(codegen): fix arithmetic overflow printing unspanned NewExpression ( #7289 )
...
`self.span.end - 1` overflows if the `NewExpression` is generated in transformer and has no span, so `self.span.end == 0`.
2024-11-15 02:56:49 +00:00
overlookmotel
44375a5662
refactor(ast)!: rename TSEnumMemberName enum variants ( #7250 )
...
Variants of `TSEnumMemberName` were previously only prefixed with `Static` to avoid naming conflicts with the variants inherited from `Expression` for non-static member names. #7219 removed the variants inherited from `Expression`, so all variants are now static. So we can shorten the names again (back to what they were before `inherit_variants!` was introduced).
2024-11-12 12:22:21 +00:00
Boshen
1282221e36
fix(codegen): print comments when block is empty ( #7236 )
...
part of #7190
2024-11-11 11:20:25 +00: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
Boshen
0e4adc15dd
feat(ast)!: remove invalid expressions from TSEnumMemberName ( #7219 )
2024-11-09 08:48:14 +00:00
Boshen
d1d187417b
feat(ast)!: change comment.span to real position that contain // and /* ( #7154 )
...
closes #7150
2024-11-06 05:10:33 +00: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
Boshen
40d8acfbd1
feat(codegen): improvement printing of legal comments ( #7111 )
2024-11-04 08:56:00 +00:00
Boshen
caa4b1fd2a
feat(codegen): improve printing of comments ( #7108 )
2024-11-04 05:12:59 +00:00
Boshen
001058a8e4
feat(codegen): always print legal comments on its own line ( #7089 )
2024-11-02 15:55:23 +08:00
Boshen
dd79c1bfb3
refactor(codegen): replace daachorse with string match for annotation comment ( #7064 )
2024-11-02 14:16:10 +08:00
Boshen
413973df66
feat(codegen): print linked and external legal comment ( #7059 )
...
part of #7050
2024-11-02 04:08:14 +00:00
Boshen
ee27b92465
feat(codegen): print eof legal comments ( #7058 )
...
part of https://github.com/oxc-project/oxc/issues/7050
2024-11-01 16:56:57 +00:00
Boshen
6516f9eabc
feat(codegen): print inline legal comments ( #7054 )
...
part of https://github.com/oxc-project/oxc/issues/7050
2024-11-01 16:56:56 +00:00
Boshen
0bb1aa4c64
refactor(codegen): move options to its own file ( #7053 )
2024-11-01 09:28:59 +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
Boshen
423d54cb74
refactor(rust): remove the annoying clippy::wildcard_imports ( #6860 )
2024-10-24 13:57:19 +00:00
oxc-bot
8f392e828e
release(crates): v0.33.0 ( #6843 )
2024-10-24 10:29:22 +08:00
Boshen
05ef03dbab
fix(codegen): correct print __proto__ shorthand ( #6802 )
2024-10-23 07:16:00 +00:00
Boshen
1b7897cf01
fix(codegen): print #field in {} << 0; correctly ( #6799 )
2024-10-23 05:34:22 +00:00
Boshen
2f6ad42348
fix(codegen): print negative bigint 1n- -1n correctly after constant folding ( #6798 )
...
closes #6767
2024-10-23 04:56:50 +00:00
Boshen
8f179534c2
fix(coverage): remove some broken cases ( #6797 )
2024-10-23 03:10:49 +00:00
DonIsaac
374b972143
docs(codegen): add #![warn(missing_docs)] to oxc_codegen ( #6711 )
...
Part of https://github.com/oxc-project/backlog/issues/130
2024-10-21 00:13:57 +00:00
oxc-bot
de99391032
release(crates): v0.32.0 ( #6691 )
...
## [0.32.0] - 2024-10-19
- c0e9d7e codegen: [**BREAKING**] `Codegen::into_source_text` consume
`Codegen` (#6539 ) (overlookmotel)
- 782f0a7 codegen: [**BREAKING**] Rename `print_char` method to
`print_ascii_byte` (#6512 ) (overlookmotel)
- 91c87dd codegen: [**BREAKING**] Remove `Codegen::enableSourceMap` API
(#6452 ) (Boshen)
- 7645e5c codegen: [**BREAKING**] Remove CommentOptions API (#6451 )
(Boshen)
- 5200960 oxc: [**BREAKING**] Remove passing `Trivias` around (#6446 )
(Boshen)
- 2808973 ast: [**BREAKING**] Add `Program::comments` (#6445 ) (Boshen)
### Features
- 5ee1ef3 allocator: Add `Vec::into_boxed_slice` (#6195 ) (DonIsaac)
- d9718ad ast_tools: Support `#[scope(exit_before)]` (#6350 ) (DonIsaac)
- e5ed6a5 codegen: Print negative numbers (#6624 ) (Boshen)
- 15c04e5 ecmascript: Add feature flag for constant evaluation (Boshen)
- d11770d ecmascript: Add `StringToNumber` (#6576 ) (Boshen)
- e561880 ecmascript: Add constant_evaluation and side_effects code
(#6550 ) (Boshen)
- 3556062 ecmascript: Add `ConstantEvaluation` (#6549 ) (Boshen)
- 39c2e66 ecmascript: Add `ToBigInt` and `StringToBigInt` (#6508 )
(Boshen)
- 6f22538 ecmascript: Add `ToBoolean`, `ToNumber`, `ToString` (#6502 )
(Boshen)
- 15dfc1d isolated-declarations: Impl `Default` for options (#6372 )
(DonIsaac)
- 071e564 minifier: Finish implementing folding object expressions
(#6586 ) (camc314)
- 590925a minifier: Finish implementing folding array expressions
(#6575 ) (camc314)
- ef237cf minifier: Complete implementation of statement fusion (#6566 )
(camc314)
- 97c8a36 minifier: Implement `collapse-variable-declarations` (#6464 )
(dalaoshu)
- 096e590 minifier: Implement folding `charAt` string fns (#6436 )
(camc314)
- e5a6f5d minifier: Implement converting template literals to strings
(#6486 ) (camc314)
- 14d0590 minifier: Implement folding of simple function calls
(`Boolean`) (#6484 ) (camc314)
- 7fbc7b6 minifier: Implement folding of simple function calls
(`String`) (#6483 ) (camc314)
- a4f57a4 minifier: Implement folding `indexOf` and `lastIndexOf` string
fns (#6435 ) (camc314)
- 3677ef8 minifier: Dce ExpressionStatements with no side effect (#6457 )
(7086cmd)
- 06ea121 minifier: Fold for statement (#6450 ) (7086cmd)
- a9544ae minifier: Partially implement minification for some known
string methods (#6424 ) (camc314)
- 9dc4ee9 minifier: Implement block stmt support for `StatementFusion`
(#6422 ) (camc314)
- ebbf77d minifier: Implement calculations for NumberValue (#6419 )
(7086cmd)
- 97ac179 minifier: Arithmetic operations for infinity. (#6332 )
(7086cmd)
- 13b0b0b minifier: Fold literal object constructors on window (#6379 )
(dalaoshu)
- e310e52 parser: Generate `Serialize` impls in ast_tools (#6404 )
(ottomated)
- 58467a5 parser: Better handling of invalid modifiers (#6482 )
(DonIsaac)
- 8ea6b72 parser: Better errors for reserved words used as identifier
names (#6478 ) (DonIsaac)
- b5b0af9 regular_expression: Support RegExp Modifiers (#6410 )
(leaysgur)
- a01a5df transformer: Pass TransformerCtx to async-to-generator plugin
(#6633 ) (Dunqing)
- a9260cf transformer: `async-to-generator` plugin. (#5590 ) (Ethan Goh)
- 8fe1b0a transformer: Support helper loader (#6162 ) (Dunqing)
- ab51c2a transformer: Support `DefaultImport` in `ModuleImports`
(#6434 ) (Dunqing)
- a3dea9c transformer/async-to-generator: Handle arrow-function
correctly (#6640 ) (Dunqing)
- 41c8675 transformer/object-rest-spread: Using helper loader (#6449 )
(Dunqing)
### Bug Fixes
- ba385fc codegen: Panic occurred when printing the comment of the right
parenthesis (#6593 ) (Dunqing)
- 02bfbfe codegen: Preserve parenthesis for `ChainExpression` (#6430 )
(Dunqing)
- 2ade16e codegen: Invalid codegen when `in` inside bin expr in or loop
(#6431 ) (camc314)
- 6896efc codegen: Fix `in` in sequence expr in for loops (#6428 )
(camc314)
- 7cc05f1 data_structures: Fix compilation failure on older Rust
versions (#6526 ) (overlookmotel)
- 2ce3e5f identifier: Add `ZWSP` to `is_irregular_whitespace` (#6662 )
(Boshen)
- 2673397 isolated_declarations: Fix potential memory leak (#6622 )
(overlookmotel)
- 389d261 minifier: `~~` operator should only work on numbers (#6598 )
(Boshen)
- 16bea12 minifier: Use `to_js_string()` instead of `fs64::to_string`
(#6597 ) (Boshen)
- a71e8a0 minifier: Preserve init variable declarations when removing
`for` statements during DCE (#6551 ) (magic-akari)
- 721cf0f parser: Should be treated comments where after `(` as leading
comments of next token (#6588 ) (Dunqing)
- b1bf12c parser: Do not parse `as` and `satisfies` expression in
javascript (#6442 ) (Boshen)
- 9f9057b regular_expression: Fixed control Y regular expression (#6524 )
(Tapan Prakash)
- c822b48 regular_expression: Fix CharacterClass negative codegen
(#6415 ) (leaysgur)
- 384d5be regular_expression: Flatten Spans on regex AST nodes (#6396 )
(ottomated)
- 834ee2a semantic: `TSConditionalType` scope enter/exit locations
(#6351 ) (DonIsaac)
- 1d3d256 transformer: Correctly trim JSX (#6639 ) (magic-akari)
- c6f2b5f transformer: `HelperLoader` common transform: do not assume
`babelHelpers` is global (#6569 ) (overlookmotel)
- 85d93ed transformer: Arrow function transform: correctly resolve
`this` in class accessor properties (#6386 ) (overlookmotel)
### Performance
- 77f3a1a codegen: Check last char with byte methods (#6509 )
(overlookmotel)
- 18b68ff codegen: Optimize `CodeBuffer::print_ascii_byte` (#6516 )
(overlookmotel)
- 4d8bc8c parser: Precompute `is_typescript` (#6443 ) (Boshen)
- 7c20056 regex: Reduce string allocations in `Display` impls (#6528 )
(DonIsaac)
- f70a413 transformer: Object spread transform: do not lookup `Object`
binding if not needed (#6570 ) (overlookmotel)
- ac77c87 traverse: Optimize `TraverseScoping::generate_uid_name`
(#6663 ) (overlookmotel)
### Documentation
- 9f555d7 allocator: Clarify docs for `Box` (#6625 ) (overlookmotel)
- 06e75b0 allocator: Enable lint warnings on missing docs, and add
missing doc comments (#6613 ) (DonIsaac)
- 7e909a7 codegen: Fix example for `CodeBuffer::print_ascii_bytes`
(#6535 ) (overlookmotel)
- 235d357 codegen: Improve doc comments for `CodeBuffer` (#6511 )
(overlookmotel)
- c8fa2eb codegen: Correct and reformat doc comments for `CodeBuffer`
(#6504 ) (overlookmotel)
- 40d1ee4 codegen: Fix and reformat `CodeBuffer` examples (#6499 )
(overlookmotel)
- de22b81 data-structures: Enable lint warnings on missing docs, and add
missing doc comments (#6612 ) (DonIsaac)
- 9e9fa9e span: Enable lint warnings on missing docs (#6617 )
(overlookmotel)
- 6a194f9 span: Document validity of `ModuleKind::Unambiguous` (#6423 )
(Boshen)
- 335b7f2 syntax: Enable lint warnings on missing docs, and add a lot of
documentation (#6611 ) (DonIsaac)
- f3451d7 transformer/async-to-generator: Remove empty lines from doc
comment (#6642 ) (overlookmotel)
- 448388a transformer/module_imports: Update outdated comments (#6574 )
(Dunqing)
### Refactor
- 073b02a ast: Type params field before params in TS function
declaration types (#6391 ) (overlookmotel)
- 458f8f3 ast_tools: Consistent comments on `AstBuilder` methods (#6664 )
(overlookmotel)
- 51fc63d codegen: Rename `CodeBuffer::print_bytes_unchecked` method
(#6517 ) (overlookmotel)
- 05a2ebd codegen: Reorder dependencies in `Cargo.toml` (#6514 )
(overlookmotel)
- e7f3e28 codegen: Rename var in `CodeBuffer` (#6510 ) (overlookmotel)
- 1bbd383 codegen: Rename `CodeBuffer::print_ascii_bytes` method (#6507 )
(overlookmotel)
- cd9fe9e codegen: Rename vars in `CodeBuffer` methods (#6506 )
(overlookmotel)
- fc536a5 codegen: Inline `CodeBuffer` methods (#6501 ) (overlookmotel)
- 7420620 codegen: Add `CodeBuffer::as_bytes` method (#6498 )
(overlookmotel)
- 8ae174b codegen: Rename `CodeBuffer::print_byte_unchecked` method
(#6496 ) (overlookmotel)
- 5843e01 codegen: Shorten `CodeBuffer::take_source_text` (#6495 )
(overlookmotel)
- 951def6 codegen: Clarify safety comments in `CodeBuffer` (#6494 )
(overlookmotel)
- 84a51ee codegen: Rename vars in `CodeBuffer` (#6493 ) (overlookmotel)
- 05bd616 codegen: Add line break (#6492 ) (overlookmotel)
- 204bf55 codegen: Add `CodeBuffer` to fix soundness hole (#6148 )
(DonIsaac)
- 702b574 codegen: Only print necessary parentheses in TSAsExpression
(#6429 ) (Dunqing)
- aa6ba24 ecmascript: Improve string to number conversion (#6577 )
(magic-akari)
- 6d041fb ecmascript: Remove `NumberValue` (#6519 ) (Boshen)
- 856cab5 ecmascript: Move ToInt32 from `oxc_syntax` to `oxc_ecmascript`
(#6471 ) (Boshen)
- 1ba2a24 ecmascript: Remove `HasProto` which is not part of the spec
(#6470 ) (Boshen)
- a504f96 isolated-declarations: Mark return struct as non exhaustive
(#6374 ) (DonIsaac)
- f4cdc56 minifier: Use constant folding unary expression from
`oxc_ecmascript` (#6647 ) (Boshen)
- 67ad08a minifier: Unify `ValueType` (#6545 ) (Boshen)
- bbca743 minifier: Move string methods to `oxc_ecmascript` (#6472 )
(Boshen)
- 702c049 minifier: Move compress block to dce (#6468 ) (7086cmd)
- 46a38c6 minifier: Remove allow `clippy::unused_self` (#6441 ) (Boshen)
- 994b60b minifier: Use builtin get_number_value. (#6335 ) (7086cmd)
- 435a89c oxc: Remove useless `allocator.alloc(program)` calls (#6571 )
(Boshen)
- c45723b parser: Fix typo in var name (#6500 ) (overlookmotel)
- 1a90ec4 rust: Backport v1.82.0 changes to main branch first (#6690 )
(Boshen)
- 3faee66 span: Remove unused `ContentHash::content_hash_slice` (#6609 )
(DonIsaac)
- 9281234 transformer: Shorten imports (#6643 ) (overlookmotel)
- 3af0840 transformer: `HelperLoader`: add import immediately (#6601 )
(overlookmotel)
- f81aa7f transformer: `HelperLoader` common transform: comments (#6599 )
(overlookmotel)
- 679cc68 transformer: `HelperLoader` common transform: construct string
directly in arena (#6596 ) (overlookmotel)
- c346ebb transformer: `HelperLoader` common transform: `Helper` enum
(#6595 ) (overlookmotel)
- 7a028b3 transformer: Remove unnecessary `#![warn]` attr (#6585 )
(overlookmotel)
- 8c6afe0 transformer: Reorder imports (#6582 ) (overlookmotel)
- 779ff46 transformer: `HelperLoader` common transform: `Helper` struct
(#6568 ) (overlookmotel)
- bc24a24 transformer: `HelperLoader` common transform: use hashmap
`Entry` API (#6567 ) (overlookmotel)
- 9f02fc7 transformer: `HelperLoader` common transform: re-order fields
(#6565 ) (overlookmotel)
- 50ecade transformer: `HelperLoader` common transform: remove `Rc`s
(#6564 ) (overlookmotel)
- 1c1e9fc transformer: `HelperLoader` common transform: reorder methods
(#6563 ) (overlookmotel)
- c9054c8 transformer: Rename `ImportKind` to `Import` (#6561 )
(overlookmotel)
- 9542c4e transformer: Add more specific methods to `ModuleImportsStore`
(#6560 ) (overlookmotel)
- 7e57a1d transformer: `ImportKind` use `BoundIdentifier` (#6559 )
(overlookmotel)
- 602df9d transformer: Re-order fields of `Common` and `TransformCtx`
(#6562 ) (overlookmotel)
- 390abca transformer/async-to-generator: Use `helper_call_expr` (#6634 )
(Dunqing)
- 2ff917f transformer/async-to-generator: Move internal methods below
entry points (#6632 ) (Dunqing)
### Styling
- fb916b2 regular_expression: Re-order dependencies in `Cargo.toml`
(#6672 ) (overlookmotel)
- 9d43a11 transformer: Re-order dependencies (#6659 ) (overlookmotel)
### Testing
- e7c89a5 codegen: Uncomment passed tests that are related to trailing
comments (#6589 ) (Dunqing)
- d816b0b codegen: Add test for `CodeBuffer::print_byte_unchecked`
(#6497 ) (overlookmotel)
- c5deb32 minifier: Port the rest of tests (#6420 ) (7086cmd)
- e59da61 minifier: Add all test cases for
`collapse_variable_declarations` (#6421 ) (dalaoshu)
- 73d6a4a minifier: Port all replace_known_methods tests. (#6418 )
(7086cmd)
---------
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-19 23:09:35 +08:00
Boshen
1a90ec4b85
refactor(rust): backport v1.82.0 changes to main branch first ( #6690 )
2024-10-19 14:30:55 +00:00
Boshen
f4cdc56577
refactor(minifier): use constant folding unary expression from oxc_ecmascript ( #6647 )
2024-10-17 15:30:38 +00:00
Boshen
e5ed6a56a8
feat(codegen): print negative numbers ( #6624 )
2024-10-16 22:38:54 +00:00
Dunqing
ba385fc9c1
fix(codegen): panic occurred when printing the comment of the right parenthesis ( #6593 )
...
fix: https://github.com/oxc-project/monitor-oxc/actions/runs/11349185798/job/31564783192
It's hard to add a test for this because I haven't figured out caused by which plugin
2024-10-15 16:23:43 +00:00
Dunqing
e7c89a596b
test(codegen): uncomment passed tests that are related to trailing comments ( #6589 )
...
Just uncomment them and replace whitespace with `\t`
2024-10-15 16:23:41 +00:00
overlookmotel
c0e9d7eb77
refactor(codegen)!: Codegen::into_source_text consume Codegen ( #6539 )
...
Breaking change. `Codegen::into_source_text` consume `Codegen`, instead of taking the `CodeBuffer` and substituting an empty one.
Keeping the `Codegen` alive seems unintuitive, as its state is then out of sync. Consuming the `CodeBuffer` is also marginally cheaper.
2024-10-14 01:09:03 +00:00
overlookmotel
7e909a7e6c
docs(codegen): fix example for CodeBuffer::print_ascii_bytes ( #6535 )
...
Fix example and add a test.
2024-10-14 01:09:02 +00:00
overlookmotel
77f3a1a9dd
perf(codegen): check last char with byte methods ( #6509 )
...
When checking what last char in buffer is, avoid calculating a `char` when only comparing to an ASCII char (byte) anyway.
2024-10-14 01:09:02 +00:00
overlookmotel
18b68ff90e
perf(codegen): optimize CodeBuffer::print_ascii_byte ( #6516 )
...
Optimize `CodeBuffer`'s `print_byte_unchecked` and `print_ascii_byte` methods by making a fast path for when the buffer has sufficient capacity to be pushed to without growing.
As discussed in https://github.com/oxc-project/oxc/pull/6148#issuecomment-2381635390
2024-10-14 01:09:01 +00:00
overlookmotel
51fc63da45
refactor(codegen): rename CodeBuffer::print_bytes_unchecked method ( #6517 )
2024-10-13 13:14:49 +00:00
overlookmotel
782f0a7a69
refactor(codegen)!: rename print_char method to print_ascii_byte ( #6512 )
...
`print_ascii_byte` is more descriptive of what this method does, and makes clear the invariant that `byte` must be ASCII.
2024-10-13 12:51:37 +00:00
overlookmotel
05a2ebd03c
refactor(codegen): reorder dependencies in Cargo.toml ( #6514 )
2024-10-13 12:37:20 +00:00
overlookmotel
235d357600
docs(codegen): improve doc comments for CodeBuffer ( #6511 )
2024-10-13 12:21:39 +00:00
overlookmotel
e7f3e28076
refactor(codegen): rename var in CodeBuffer ( #6510 )
2024-10-13 11:58:39 +00:00
overlookmotel
1bbd383d0f
refactor(codegen): rename CodeBuffer::print_ascii_bytes method ( #6507 )
...
Pure refactor.
2024-10-13 11:19:09 +00:00
overlookmotel
cd9fe9ec03
refactor(codegen): rename vars in CodeBuffer methods ( #6506 )
...
Pure refactor. Consistently use `byte` for bytes, and `ch` for `char`s.
2024-10-13 11:10:10 +00:00
overlookmotel
c8fa2eb17a
docs(codegen): correct and reformat doc comments for CodeBuffer ( #6504 )
...
Comment about `take_source_text` was erroneous. Clean up and reformat other doc comments.
2024-10-13 11:10:09 +00:00