Boshen
b4258ee58e
feat(transformer): add defaulted Module::Preserve option ( #7225 )
2024-11-09 12:55: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
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
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
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
Boshen
6e1abde5ef
chore(transform_conformance): omit tests that we cannot pass right now ( #7192 )
2024-11-07 14:20:30 +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
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
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
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
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
Dunqing
934cb5e746
feat(transformer): add async_generator_functions plugin ( #6573 )
...
Passed 15/19 tests. The remaining 4 failed tests related to `this` expression, the problem same as I mentioned in #6658 . I will fix them in follow-up PRs.
2024-10-31 09:14:17 +00:00
overlookmotel
2a57a66753
test(transformer): support exec tests in Oxc folder ( #7030 )
...
Fix error when `tasks/transform_conformance/tests` contains exec tests.
2024-10-31 01:18:09 +00:00
Boshen
76947e2aec
refactor(transform): refactor Babel Targets ( #7026 )
...
Found a trick from serde to get us from `BabelTargets` to `Targets`.
2024-10-30 14:08:19 +00:00
Boshen
b8daab3663
refactor(transformer)!: API to TryFrom<&EnvOptions> for TransformOptions and TryFrom<&BabelOptions> TransformOptions ( #7020 )
...
…ions` and `TryFrom<&BabelOptions> TransformOptions`
2024-10-30 09:40:09 +00:00
Dunqing
1ca8cd2fd9
refactor(transformer/react-refresh): avoid panic for init of VariableDeclarator isn't a BindingIdentifier ( #6937 )
...
related: https://github.com/oxc-project/oxc/pull/6881#discussion_r1816597462
2024-10-28 01:19:53 +00:00
Boshen
6d97af46c7
feat(rust): use oxc-miette ( #6938 )
2024-10-27 13:30:20 +00:00
Dunqing
5f153aca0c
refactor(transformer/react-refresh): use VarDeclarations to insert declarators ( #6884 )
2024-10-27 07:05:24 +00:00
Dunqing
142da1d2ff
chore(transform_conformance): reorganize react-refresh related tests ( #6918 )
...
Move all tests that are copied from [react-refresh](https://github.com/facebook/react/blob/main/packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js ) to the `react-refresh` directory, and add a README to describe the source of these tests. This way we can better stay in sync with upstream.
related: https://github.com/oxc-project/oxc/pull/6884#discussion_r1816888813
2024-10-26 13:07:10 +00:00
Boshen
4dc5e51cb1
fix(transformer): only run typescript plugin for typescript source ( #6889 )
...
closes #6865
TypeScript plugin changes import / export statements so it needs to be turned off for non-typescript files. This should also give a little performance boost for non-typescript files.
2024-10-25 13:59:31 +00:00
Boshen
4618aa22d9
refactor(transformer)!: rename TransformerOptions::react to jsx ( #6888 )
2024-10-25 12:04:33 +00:00
Dunqing
0d0bb17ad9
feat(transformer): complete the async-to-generator plugin ( #6658 )
...
In this PR, most of the async functions have transformed correctly. But the async arrow functions don't fully transform correctly yet, it is related to we need to transform the arrow function to the generator function. For example:
Input:
```js
function declaration() {
const asy = async () => {
console.log(this.name)
}
}
```
Output:
```js
function declaration() {
const asy = babelHelpers.asyncToGenerator(function* () {
console.log(this.name);
});
}
```
Expected Output:
```js
function declaration() {
var _this = this;
const asy = /*#__PURE__*/function () {
var _ref = babelHelpers.asyncToGenerator(function* () {
console.log(_this.name);
});
return function asy() {
return _ref.apply(this, arguments);
};
}();
}
```
From the expected output, we haven't handled `this` correctly, which means even if the `arrow-function` plugin doesn't enable, we still need to handle this correctly as the `arrow-function` plugin does, and further question if `arrow-function` plugin is enabled, how to avoid these making conflict?
I thought we may move out the implementation of `arrow-function` and as a common helper, this way every plugin can handle this well
2024-10-25 03:23:31 +00:00
Dunqing
076f5c39f4
fix(transformer/typescript): retain ExportNamedDeclaration without specifiers and declaration ( #6848 )
...
close : #6825
2024-10-24 07:59:07 +00:00
overlookmotel
10484cdeeb
feat(transformer): class static block transform ( #6733 )
...
Add ES2022 class static block transform.
2024-10-22 03:40:02 +00:00
Boshen
3711c32f22
chore(coverage): bump test262, babel and TypeScript ( #6702 )
...
closes #6692
2024-10-20 15:02:26 +00:00
magic-akari
1d3d256db3
fix(transformer): Correctly trim JSX ( #6639 )
...
- Closes : #6638
2024-10-17 14:41:02 +00:00
Dunqing
a3dea9c542
feat(transformer/async-to-generator): handle arrow-function correctly ( #6640 )
2024-10-17 08:47:28 +00:00
Dunqing
673b66620b
chore(transform_conformance): do not extend plugins if current options has plugins ( #6627 )
...
I saw many tests were ignored even if they don't contain any unsupported plugins
2024-10-17 02:07:03 +00:00
Ethan Goh
a9260cf6d1
feat(transformer): async-to-generator plugin. ( #5590 )
...
Tests are still not passed. A lot need to do yet.
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-10-14 17:16:58 +08:00
Boshen
7645e5c34b
refactor(codegen)!: remove CommentOptions API ( #6451 )
2024-10-11 13:53:28 +00:00
overlookmotel
073b02af14
refactor(ast): type params field before params in TS function declaration types ( #6391 )
...
Our convention is that AST type fields are ordered in order they appear in source. Move `type_parameters` fields in TS function declaration types to before `this_param` and formal parameters.
2024-10-11 09:57:28 +00:00
Boshen
520096030a
refactor(oxc)!: remove passing Trivias around ( #6446 )
...
part of #6426
2024-10-11 06:09:25 +00:00
Boshen
2b7be08af4
feat(ast)! add source_text to Program ( #6444 )
2024-10-11 04:13:41 +00:00
overlookmotel
4fd89e8eed
test(transformer): fix indentation in transformer test fixtures ( #6346 )
...
Unimportant nit. Fix whitespace in the transformer test fixtures.
2024-10-08 01:32:07 +00:00
overlookmotel
cf20f3a89d
feat(transformer): exponentiation transform: support private fields ( #6345 )
...
Babel doesn't support private fields in this transform, but there's no reason not to. So we can.
2024-10-08 01:32:06 +00:00
overlookmotel
4aa4e6bec0
refactor(transformer): exponentiation transform: do not wrap in SequenceExpression if not needed ( #6343 )
...
`left **= right` is transformed to `left = Math.pow(left, right)`. There is no need to wrap it in a `SequenceExpression`.
2024-10-08 01:32:05 +00:00