Boshen
f54d330eca
feat(tasks/lint_rules): mark eslint/no-undef-init as done ( #7244 )
...
closes #6456
2024-11-12 11:55:37 +08:00
Dunqing
eea4ab830a
fix(transformer/helper-loader): incorrect SymbolFlags for default import when SourceType is script ( #7226 )
2024-11-09 14:32:44 +00:00
Boshen
b4258ee58e
feat(transformer): add defaulted Module::Preserve option ( #7225 )
2024-11-09 12:55:13 +00:00
overlookmotel
d27e14f065
refactor(ast): AstKind::as_* methods take self ( #5546 )
...
Make `AstKind::as_*` methods (e.g. `AstKind::as_boolean_literal`) take `self`, not `&self`.
`AstKind` is `Copy`.
See: https://github.com/oxc-project/oxc/issues/5506#issuecomment-2332912976
2024-11-09 09:39:13 +00:00
Dunqing
5cfdc05d06
feat(transformer/typescript): support transform export = and import = require(...) when module is commonjs ( #7206 )
...
close : #7141
2024-11-09 09:32:28 +00:00
BitterGourd
94865a9390
feat(rulegen): support outdent and dedent tagged template expressions ( #6866 )
...
close #6645
---------
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-11-09 17:26:27 +08:00
Boshen
b11ed2cf7b
refactor(ast)!: remove useless ObjectProperty::init field ( #7220 )
...
closes https://github.com/oxc-project/backlog/issues/143
2024-11-09 09:00:29 +00:00
Boshen
0e4adc15dd
feat(ast)!: remove invalid expressions from TSEnumMemberName ( #7219 )
2024-11-09 08:48:14 +00:00
Dunqing
e536d47e56
feat(transformer/babel): add support for trying to get the Module from BabelPlugins ( #7218 )
...
When configuring a `transform-modules-commonjs` plugin in `options.json`, we should treat it as a `CommonJS` module
2024-11-09 08:38:15 +00:00
Boshen
324c3fe184
feat(transformer): add TransformOptions::module option ( #7188 )
2024-11-09 08:38:15 +00:00
Boshen
846711cf41
feat(transformer)!: change API to take a &TransformOptions instead of TransformOptions ( #7213 )
...
closes #7185
`TransformOption`s has an initialization cost, it should be initialized once and shared across files.
2024-11-09 06:01:13 +00:00
ottomated
092de67c47
fix(types)!: append rest field into elements for objects and arrays to align with estree ( #7212 )
...
Fixes https://github.com/oxc-project/oxc/pull/7149#discussion_r1831677446 and removes the need for some manual typescript.
2024-11-09 05:23:53 +00:00
Dunqing
ede10dc030
fix(transformer/async-to-generator): incorrect transform when super expression is inside async method ( #7171 )
...
After transformation, super expressions have moved to unexpected places. This PR replaces super expression to call expression, and then inserts the super methods to the top of the method body.
For example:
Before:
```js
class G {
async method() {
super.foo()
}
}
```
After:
```js
class G {
method() {
var _superprop_getFoo = () => super.foo,
_this = this;
return _asyncToGenerator(function* () {
_superprop_getFoo().call(_this);
})();
}
}```
2024-11-08 08:18:45 +00:00
Dunqing
1910227590
feat(transformer/async-to-generator): support inferring the function name from the ObjectPropertyValue's key ( #7201 )
...
Support for inferring function name from ObjectPropertyValue's key
For example:
```js
({ foo: async function() {} })
```
After this, we will able to infer `foo` for the object method
2024-11-08 08:18:44 +00:00
Boshen
3a20b906f4
feat(transformer): add es target to engineTargets ( #7193 )
2024-11-08 03:25:21 +00:00
Dunqing
293d072e77
fix(transformer/async-to-generator): only transform object method in exit_function ( #7199 )
...
part of #7175
2024-11-08 03:03:27 +00:00
Dunqing
b4cb587477
chore(transformer_conformance): only ignore root fixtures directory ( #7198 )
...
This blocks us from adding tests for plugins.
See the URL a2244ff089/tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/arrow
2024-11-08 02:36:22 +00:00
Huáng Jùnliàng
9a6423a9f8
test(coverage): enable Babel es2022 tests ( #7194 )
...
Enabled the Babel es2022 tests. Previously they were skipped probably
because ES2022 was not yet supported at that time.
2024-11-08 09:29:36 +08:00
Boshen
6e1abde5ef
chore(transform_conformance): omit tests that we cannot pass right now ( #7192 )
2024-11-07 14:20:30 +00:00
Boshen
22898c855a
feat(transformer): warn BigInt when targeting < ES2020 ( #7184 )
...
closes #5822
2024-11-07 08:29:03 +00:00
Boshen
a579011e37
feat(transformer): add features ES2018NamedCapturingGroupsRegex and ES2018LookbehindRegex ( #7182 )
2024-11-07 07:39:33 +00:00
Boshen
ad3a2f518e
feat(tasks/compat_data): generate our own compat table ( #7176 )
2024-11-07 07:39:33 +00:00
Boshen
14ce0eef44
feat(tasks/compat_data): init compat data task ( #7156 )
2024-11-07 07:39:32 +00:00
ottomated
9d6cc9d3af
feat(estree): ESTree compatibility for all literals ( #7152 )
...
Adds some new estree macro directives:
- `#[estree(via = foo::Foo)`: Uses From to convert this struct to foo::Foo before serialization
- `#[estree(add_ts = "foo: string")]`: Adds additional fields to the typescript definitions
Used these to make all different literals estree-compatible.
2024-11-06 21:25:41 +00:00
ottomated
dc0215c906
feat(ast_tools): Add #[estree(append_to)], remove some custom serialization code ( #7149 )
...
Removed custom logic for ObjectPattern, ArrayPattern, etc. in favor of a custom attribute macro `#[estree(append_to = "foo")]` as part of #6347
2024-11-06 21:09:45 +00:00
renovate
3da9443b0e
chore(deps): update dependency @types/node to v22.9.0 ( #7145 )
...
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/node](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node ) ([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node )) | [`22.8.4` -> `22.9.0`](https://renovatebot.com/diffs/npm/@types%2fnode/22.8.4/22.9.0 ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) |
---
### Configuration
📅 **Schedule**: Branch creation - "before 10am on monday" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined).
🚦 **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:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNyIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2024-11-06 06:17:36 +00:00
Dunqing
b2a888df0d
fix(transformer/async-generator-functions): incorrect transformation for for await if it's not placed in a block ( #7148 )
...
Found in https://github.com/oxc-project/monitor-oxc/actions/runs/11681867380/job/32527898715
2024-11-06 05:51:01 +00:00
Dunqing
19892ede40
fix(transformer/async-generator-functions): transform incorrectly for for await if it's in LabeledStatement ( #7147 )
...
Found in https://github.com/oxc-project/monitor-oxc/actions/runs/11681867380/job/32527898715
2024-11-06 03:27:14 +00:00
Dunqing
8573f79c6d
feat(transformer): turn on async_to_generator and async_generator_functions plugins in enable_all ( #7135 )
2024-11-06 03:27:13 +00:00
Dunqing
cd1006fec1
refactor(transformer/async-generator-functions): do not transform yield expression where inside generator function ( #7134 )
2024-11-06 03:27:13 +00:00
Dunqing
2c5734d49b
refactor(transformer/async-generator-functions): do not transform await expression where inside ArrowFunctionExpression ( #7132 )
...
The `await expr` should be transformed in AsyncToGenerator rather than AsyncGeneratorFunctions
2024-11-06 03:27:12 +00:00
Dunqing
b6a575009a
feat(transformer/arrow-function-converter): move scope to changed scope for this_var if scope have changed ( #7125 )
...
The scope can be moved or deleted, we need to check whether the scope id is the same as the container's scope id, if not, we need to move the `this_var` to the target scope id.
2024-11-06 03:02:36 +00:00
Dunqing
df772411ea
feat(transformer): enable ArrowFunctionConverter in async-to-generator and async-generator-functions plugins ( #7113 )
...
Part of https://github.com/oxc-project/oxc/pull/7074
In async-to-generator and async-generator-functions plugins, we may need to transform the async arrow function to a regular generator function, now we can reuse the ability of the ArrowFunction plugin by enabling `ArrowFunctionConverter`.
I will fix semantic errors in the follow-up PR
2024-11-06 03:02:36 +00:00
Boshen
9386435efb
feat(transform_conformance): use node instead of bun for exec tests ( #7121 )
2024-11-05 14:20:48 +08:00
overlookmotel
cc8a1917e5
feat(ast): methods on AST nodes to get scope_id etc ( #7127 )
...
Add getter and setter methods to all AST types which have a `ScopeId`, `SymbolId` or `ReferenceId` field to get the contents of that field.
Before:
```rs
let symbol_id = ident.symbol_id.get().unwrap();
```
After:
```rs
let symbol_id = ident.symbol_id();
```
This allows removing boilerplate code from the transformer, and discouraging the anti-pattern of treating these fields as if they may contain either `Some` or `None` (after semantic, they will always be `Some`).
2024-11-05 02:25:27 +00:00
Boshen
c2802e63fc
feat(transform_conformance): add babel runtime to exec tests ( #7114 )
2024-11-04 14:38:15 +00:00
Dunqing
f80085c683
refactor(transformer/async-to-generator): move handling of MethodDefinition's value to exit_function ( #7105 )
...
Part of #7074
We need to handle this before the `arrow_function` plugin inserts `_this = this` because, in the `async-to-generator` plugin, we will move the body to an inner generator function. However, we don't want `_this = this` moved to the inner generator function as well. So as long as we move first, and then insert, we can fix this problem.
The new semantic error is related to another tricky problem, I will fix it in another PR
2024-11-04 14:32:42 +00:00
Boshen
50646a49ea
refactor(tasks/website): remove scraper dependency ( #7116 )
2024-11-04 14:16:11 +00:00
overlookmotel
25d7554ec4
refactor(ast_tools): rename visitable to is_visitable ( #7104 )
...
Pure refactor. Just rename fields and vars from `visitable` to `is_visitable`, to be more descriptive.
2024-11-03 17:20:25 +00:00
Dunqing
70e2582726
ci(transformer): enable unfinished plugins in benchmark ( #7040 )
...
Even the plugins are unfinished, we still want to enable all of them to track the performance changes during the development.
2024-11-02 15:17:21 +00:00
overlookmotel
f543a8d495
refactor(ast)!: remove AstBuilder::*_from_* methods ( #7073 )
...
Remove `AstBuilder::*_from_*` methods for constructing enums. In my opinion, it's not a great pattern, and this removes 2000 of lines of code from [ast_builder.rs](https://github.com/oxc-project/oxc/pull/7073/files#diff-e34fd45077ed0a48b7fee440fdbe4c22a01d787a70a311afebfc1d310785fb70 ).
2024-11-02 01:22:56 +00:00
overlookmotel
32b4a53692
refactor(ast_tools): remove LateCtx abstraction ( #7083 )
...
`LateCtx` is just a wrapper around `Schema`. Remove it and use `Schema` instead.
2024-11-01 22:31:03 +00:00
overlookmotel
2eb9aa9b89
refactor(ast_tools): remove dead code ( #7080 )
2024-11-01 21:59:28 +00:00
overlookmotel
d89fe2c326
refactor(ast_tools): shorten code ( #7079 )
...
Shorten code by importing `rust_ast::Module` at top level.
2024-11-01 21:51:29 +00:00
overlookmotel
00cc156fb5
refactor(ast_tools): simplify module loading ( #7078 )
...
Rename var for clarity and remove unnecessary `From` impl.
2024-11-01 21:51:29 +00:00
overlookmotel
f2d10683a8
refactor(ast_tools): remove dead code ( #7077 )
2024-11-01 21:42:14 +00:00
overlookmotel
248ff18ddd
refactor(ast_tools): output progress ( #7076 )
...
Flush `stdout` after writing progress.
2024-11-01 21:26:45 +00:00
Dunqing
a2244ff089
fix(transformer/async-to-generator): output is incorrect when arrow function without params ( #7052 )
2024-11-01 15:35:57 +00:00
Boshen
f83a760d8a
refactor(transformer): deserialize BabelOptions::presets ( #7047 )
2024-11-01 06:56:27 +00:00
Boshen
52c20d633c
refactor(transformer): deserialize BabelOptions::plugins ( #7045 )
2024-11-01 05:44:57 +00:00