Commit graph

472 commits

Author SHA1 Message Date
mysteryven
d7849f8865 refactor(linter): find return statement by using CFG in react/require-render-return (#3353)
Maybe currently Class components are relatively few in quantity, didn't performance changed.
2024-05-19 14:59:12 +00:00
Dunqing
e2c6fe0cb1
feat(transformer): report errors when options have unknown fields (#3322) 2024-05-19 01:19:40 +08:00
Dunqing
9ee962add8 feat(transformer): support from_babel_options in TransformOptions (#3301)
Move `BabelOptions` to Transformer. The `output.json` is a standard babel configuration. We can reuse BabelOptions to read [babel.config.json](https://babeljs.io/docs/configuration#babelconfigjson) or our configuration(maybe oxc.config.json)

The current `from_babel_options` implementation is copied from the `transform_options` in `test_case.rs`, which I'll completely reimplement next
2024-05-16 10:10:39 +00:00
Dunqing
8ff1ffba74
feat(transformer_conformance): skip some tests that are known to fail (#3293)
I don't think we need to be completely consistent with Babel's output.
Because Babel's output doesn't always make sense.
2024-05-15 22:06:00 +08:00
Dunqing
b9d69ad665
feat(transformer): do not add self attribute in react/jsx plugin (#3287)
follow-up: https://github.com/oxc-project/oxc/pull/3258.
2024-05-15 17:59:57 +08:00
Dunqing
b4fa27a2ee
fix(transformer): do no add __self when the jsx is inside constructor (#3258) 2024-05-14 16:12:49 +01:00
Boshen
530455849b chore(tasks): add commit sha to snapshots to make sure submodules are not outdated (#3267)
If submodules are outdated, it'll panic with the following message

```
Repository is outdated, please run `just submodules` to update it.
```

For us maintainers, we'll need the env `UPDATE_SNAPSHOT` to force an update.
2024-05-14 10:18:00 +00:00
Dunqing
eefb66f750 feat(ast): add type to AccessorProperty to support TSAbractAccessorProperty (#3256) 2024-05-13 12:35:58 +00:00
Dunqing
34dd53cc98 feat(transformer): report ambient module cannot be nested error (#3253) 2024-05-13 07:51:06 +00:00
Boshen
dbde5b3a04
refactor(diagnostics): remove export of miette 2024-05-12 11:46:48 +08:00
Boshen
09f34fc942
refactor(semantic): unify diagnostic in checker 2024-05-12 01:07:28 +08:00
Boshen
7067f9c646
refactor(transformer): clean up more diagnostics 2024-05-12 00:57:58 +08:00
Dunqing
1b29e63300 feat(transformer): do not elide jsx imports if a jsx element appears somewhere (#3237) 2024-05-11 15:00:26 +00:00
Dunqing
fd6a1aa1d2 feat(transformer_conformance): correct source type (#3233) 2024-05-11 09:30:43 +00:00
Dunqing
6ac8a8479e
fix(transformer): correctly jsx-self inside arrow-function (#3224) 2024-05-11 00:48:18 +00:00
Dunqing
18d853bb2b
feat(transformer/react): support development mode (#3143) 2024-05-10 22:07:33 +08:00
Dunqing
0ba7778e5e
fix(parser): correctly parse cls.fn<C> = x (#3208)
close: #3206
2024-05-09 10:23:45 +08:00
overlookmotel
9590eb0cf4
fix(transform): implement transform-react-display-name with bottom-up lookup (#3183)
Sliced off from #3152.

Re-implement `transform-react-display-name` using bottom-up lookup
provided by `Traverse` trait.

This fixes the 1 remaining failing test case for this plugin (see
#2937).

`Traverse` is not complete yet (see #3182), so this is also not ready to
merge yet.
2024-05-08 15:33:39 +00:00
Dunqing
a227050ed0
chore: update babel repo (#3205) 2024-05-08 20:15:15 +08:00
Boshen
a63a45d5b2
refactor(transformer): remove the requirement of Semantic (#3140)
It seems like we need to rebuild the scopes and symbols while
traversing. We can't utilize the scopes and symbols built by semantic
because they are immutable.
2024-04-30 12:48:21 +08:00
Boshen
d76507699d
chore(transform_conformance): skip transform-destructuring (#3136) 2024-04-30 00:09:22 +08:00
Boshen
5a3f8a5811
feat(transform_conformance): handle parse error (#3135) 2024-04-30 00:07:53 +08:00
Dunqing
b5894964d1
fix(transformer/arrow-functions): should not transform this in class (#3129) 2024-04-29 13:44:10 +00:00
Dunqing
843318cdbe
refactor(transformer/typescript): reimplementation of Enum conversion based on Babel (#3102)
The remaining test cases will perform better with a scope
implementation, and while we can implement them without the scope, it
still requires us to do what the scope did.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-04-29 16:26:22 +08:00
Dunqing
905ee3fef1
feat(transformer): add arrow-functions plugin (#3083)
close: #2983
2024-04-29 08:04:01 +00:00
Dunqing
c3d8a85eb5
feat(semantic): report that enum member must have initializer (#3113)
See
https://www.typescriptlang.org/play/?target=99#code/KYOwrgtgBAglDeAoKKoEMoF4oFk0BcALAOgGcBLEACgEYBKAGmVQCMmBfRRUSKAIQTMUGbACIaAJgDMopqihtEnRABtg+KADMwIAMZYoVOlgB8USVIDc3cNADCg+SK07dRuaw6IgA
2024-04-27 22:08:02 +08:00
Boshen
78875b79fe
feat(transformer): implement typescript namespace (#3025)
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-04-25 10:26:11 +00:00
Dunqing
3831147b6d
feat(transformer/typescript): report error for export = <value> (#3021) 2024-04-18 18:56:29 +08:00
Dunqing
7416de217b
feat(transformer/typescript): reports error for import lib = require(...); (#3020) 2024-04-18 18:54:45 +08:00
Dunqing
e14ac17c72
feat(transformer/typescript): insert this assignment after the super call (#3018) 2024-04-18 18:53:01 +08:00
Boshen
722d4c2350
fix(transformer): TypeScriptOptions deserialize should fallback to default (#3012) 2024-04-17 16:27:50 +08:00
Dunqing
b72bdcaf96
feat(transformer/react): reports duplicate __self/__source prop error (#3009) 2024-04-17 13:34:31 +08:00
Boshen
df1996157f
chore(transform_conformance): ignore more unsupported plugins (#3008) 2024-04-16 18:59:21 +08:00
Dunqing
cdd3bc5a4e
feat(transformer_conformance): enable typescript when the typescript plugin is present (#3007) 2024-04-16 10:47:06 +00:00
Dunqing
99e038cfc0
fix(transformer/typescript): modifiers should not be removed (#3005)
`codegen` relies on the modifier to decide whether to print or not. For
example, if declare is present, nothing will be printed if typescript is
not enabled.

We may need to solve this problem in a way that doesn't rely on
modifers.
2024-04-16 10:33:13 +00:00
Boshen
ae9d681b4d
feat(transform_conformance): skip windows tests (#3003) 2024-04-16 17:50:43 +08:00
Boshen
85a3653994
feat(transformer): add "_jsxFileName" variable in jsx source plugin (#3000) 2024-04-16 17:40:24 +08:00
Boshen
67045467c7
fix(transformer): react development default value should be false (#3002) 2024-04-16 17:28:31 +08:00
Boshen
5f4c1e1d3e
chore(transform_conformance): skip custom presets (#3001) 2024-04-16 17:21:34 +08:00
Dunqing
afb1dd4b24
feat(transformer/typescript): support for transform TSImportEqualsDeclaration (#2998) 2024-04-16 06:45:41 +00:00
Dunqing
6732e8b9af
feat(transformer/typescript): support for transform enum (#2997)
The current implementation is copied from the previous implementation
2024-04-16 14:39:37 +08:00
Boshen
e43c245388
feat(transformer): add import helpers to manage module imports (#2996)
closes #2971
2024-04-16 14:33:44 +08:00
Dunqing
6a53fa367b
feat(transformer/typescript): correct elide imports/exports statements (#2995)
remove ts annotations one benefit: `IdentifierReference` only used on js
code

The `TypescriptReferenceCollector` implementation is inspired by
5f75019683/crates/swc_ecma_transforms_typescript/src/strip_import_export.rs (L9-L99)

This seems simpler to implement than using scope
2024-04-16 11:06:58 +08:00
Boshen
82e00bc951
refactor(transformer): remove boilerplate code around decorators to reduce noise (#2991) 2024-04-15 13:51:09 +08:00
Boshen
b4bfa2f34c
refactor(transform_conformance): correctly handle BABEL_8_BREAKING (#2990) 2024-04-15 13:41:45 +08:00
Boshen
5a286c3d9f
feat(transform_conformance): drop more unsupported plugins (#2984) 2024-04-14 23:04:04 +08:00
Boshen
9643cba4a4
feat(transform_conformance): drop all babel 7 specific tests (#2982)
@Dunqing Is this correct?
2024-04-14 23:02:38 +08:00
Boshen
c753c9fa74
feat(transform_conformance): handle deserialization errors (#2980) 2024-04-14 22:47:28 +08:00
Boshen
b6b63ac9bc
feat(transform_conformance): skip tests with plugin.js (#2978) 2024-04-14 21:55:32 +08:00
Boshen
7cf0927a38
feat(transform_conformance): skip tests with plugin.js (#2977) 2024-04-14 21:45:27 +08:00
Boshen
c211f1e57f
feat(transformer): add diagnostics to react transform (#2974) 2024-04-14 21:42:32 +08:00
Boshen
ef602af4cc
feat(transform_conformance): skip plugins we don't support yet (#2967) 2024-04-14 21:32:03 +08:00
Boshen
c7e70c80f0
fix(transformer): deserialize ReactJsxRuntime with camelCase (#2972) 2024-04-14 19:40:24 +08:00
Boshen
3a6eae1abd
feat(transformer): apply jsx self and source plugin inside jsx transform (#2966) 2024-04-14 19:10:59 +08:00
Boshen
10814d5331
fix(transformer): turn on react preset by default (#2968) 2024-04-14 19:04:59 +08:00
Boshen
35e3b0f1cb
fix(transformer): fix incorrect jsx whitespace text handling (#2969) 2024-04-14 18:40:40 +08:00
Boshen
bd9fc6d169
feat(transformer): react jsx transform (#2961) 2024-04-14 10:50:17 +08:00
Boshen
6561392202
feat(transform_conformance): add baseline for all TypeScript and jsx plugins 2024-04-13 19:05:39 +08:00
Miles Johnson
e67355045e
feat(transformer): start on TypeScript annotation removal (#2951) 2024-04-13 18:49:54 +08:00
Boshen
e651e50bda
feat(transformer): add the most basic plugin toggles (#2950) 2024-04-12 20:25:34 +08:00
Boshen
60ccbb105c
refactor(transformer): clean up some code (#2949) 2024-04-12 20:23:44 +08:00
Boshen
14754777a4
feat(transformer): implement react-jsx-source (#2948) 2024-04-12 20:21:54 +08:00
Boshen
f903a225a8
feat(transformer): implement react-jsx-self (#2946) 2024-04-12 18:08:36 +08:00
Boshen
0c04bf743f
feat(transformer): transform TypeScript namespace (#2942) 2024-04-12 10:19:13 +08:00
Boshen
f3a28c61b9
chore(transform_conformance): enable typescript plugin snapshot 2024-04-11 20:06:53 +08:00
Boshen
3419306ac0
feat(transformer): add filename (#2941) 2024-04-11 18:43:51 +08:00
Boshen
02adc76760
feat(transformer): implement plugin-transform-react-display-name top-down (#2937)
Missing case:


https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/nested/input.js

```js
var foo = qux(createReactClass({}));
var bar = qux(React.createClass({}));
```

This requires recursing down.

Top-down implementation in swc:


67ec5e09b9/crates/swc_ecma_transforms_react/src/display_name/mod.rs (L108-L132)

Or bottom-up in babel:


08b0472069/packages/babel-plugin-transform-react-display-name/src/index.ts (L87-L98)
2024-04-11 15:32:32 +08:00
Boshen
07bd85e25d
chore(transform_conformance): clear the conformance snapshot 2024-04-11 14:09:59 +08:00
Boshen
d65eab3b8b
feat(transformer): add react preset (#2921) 2024-04-09 12:39:33 +08:00
Boshen
7710d8caf1
feat(transformer): add compiler assumptions (#2872)
closes #2869
2024-03-31 02:04:21 +00:00
Boshen
7034bcc47d
feat(transformer): add proposal-decorators (#2868) 2024-03-30 21:07:36 +08:00
Boshen
ffadcb08d9
feat(transformer): add react plugins (#2867) 2024-03-30 20:56:10 +08:00
Boshen
293b9f482a
feat(transformer): add transform-typescript boilerplate (#2866) 2024-03-30 20:48:35 +08:00
Boshen
c1a2958a5a
chore: remove oxc_transformer for a reimplementation (#2865)
closes #2860
2024-03-30 17:19:46 +08:00
Dunqing
ec05a41525
chore: update transformer snapshots (#2838) 2024-03-27 15:02:09 +08:00
Dunqing
d67100730b
feat(tasks/transforme_conformance): support for testing oxc's test cases (#2835)
Related to:
https://github.com/oxc-project/oxc/pull/2822#issuecomment-2021802212

Although `babel` has a lot of test cases, we still need to add edge
cases that `babel` doesn't have.

This PR will allow us to add out test cases to
`/root/oxc/tasks/transform_conformance/tests`. The directory structure
is consistent with `babel`

For example
```shell
# cd /root/oxc/tasks/transform_conformance/tests
- babel-transform-plugin–optional-catch-binding
   - test
       - fixtures
           - your tests # add test cases here
```
2024-03-27 14:14:15 +08:00
Ali Rezvani
243131d7a4
feat(transformer): numeric separator plugin. (#2795)
[es2021 numeric
separator](https://babeljs.io/docs/babel-plugin-transform-numeric-separator)
2024-03-26 18:15:12 +08:00
Ali Rezvani
56493bd02b
feat(transformer): add transform literal for numeric literals. (#2797)
[es2015 transform
literals](https://babeljs.io/docs/babel-plugin-transform-literals)

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-26 16:27:32 +08:00
Dunqing
220f722f19
chore: update snapshots (#2817)
Babel repo is updated in #2813 and #2814
2024-03-26 11:53:26 +08:00
Dunqing
68e011c479
fix(tasks/transform-conformance) when the output file does not exist, the output content should be empty (#2808)
https://github.com/oxc-project/oxc/pull/2795#issuecomment-2018018675
2024-03-25 23:28:00 +08:00
underfin
d9b77d853b
refactor(sourcemap): change sourcemap name to take a reference (#2779) 2024-03-23 21:40:05 +08:00
Dunqing
7a12514151
fix(transformer/decorators): missing check private function (#2607) 2024-03-05 11:37:00 +08:00
Boshen
ef932a3c27
refactor(codegen): clean up API around building sourcemaps (#2602)
closes #2564
2024-03-04 16:03:33 +08:00
Dunqing
6d43e851e8
feat(transformer/typescript): support transform constructor method (#2551) 2024-03-01 21:12:30 +08:00
Dunqing
25e03cb0ef
feat(tasks/transformer): enable typescript when the typescript plugin is provided (#2548)
Babel has many test cases that are js files, but in ts syntax.
2024-03-01 21:04:55 +08:00
Dunqing
f760108094
feat(transformer): call build module record (#2529) 2024-02-28 14:35:35 +08:00
Dunqing
cd75c1ca59
feat(transformer/decorators): insert only one private in expression (#2486) 2024-02-26 15:48:47 +08:00
Dunqing
3d008abacb
feat(transformer/decorators): insert instanceBrand function (#2480) 2024-02-23 23:04:27 +08:00
Dunqing
2628c97eda
feat(transformer/decorators): transform getter function (#2473) 2024-02-23 10:11:45 +08:00
Andrew McClenaghan
e6d536cb9b
feat(codegen): configurable typescript codegen (#2443)
- Adds option to `CodegenOptions` - `enable_typescript` to enable output
of TS.
- Stops skipping output that is TS when `enable_typescript` is enabled
- Adds TS support to 
    - Function
    - FormalParameter
    - BindingPattern
 - Adds basic tests for TS generation

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-20 12:09:28 +08:00
Dunqing
27b2c212c4
refactor(transformer/decorators): if it is a private method definition, transform it (#2427) 2024-02-19 19:17:11 +08:00
Boshen
70a0076eed
refactor: remove global allocator from non-user facing apps (#2401)
The runtime performance gains does not out weight the compilation speed from
building the custom allocators, which takes about a minute to build on
slower machines.
2024-02-12 14:09:05 +08:00
Dunqing
8e221cb26e
fix(transformer): update snapshot (#2268) 2024-02-02 17:00:44 +08:00
Boshen
650f6c942f
refactor: use our forked version of miette::Reporter for tests (#2266) 2024-02-02 16:15:31 +08:00
Dunqing
02c18d8506
feat(transformer/decorators): support for static and private member decorators (#2246) 2024-02-01 15:19:14 +08:00
Dunqing
ba85b097e0
feat(transformer/decorators): support method decorator and is not static (#2238) 2024-02-01 11:36:22 +08:00
Dunqing
a79988d5e2
feat(transformer/decorators): support static member (#2235) 2024-01-31 19:11:27 +08:00
Dunqing
3b85e1813b
feat(transformer/decorators): ensure property key consistency (#2233) 2024-01-31 19:05:52 +08:00
Dunqing
e5719e9b4d
feat(transformer/decorators): support transform member decorators (#2171) 2024-01-26 10:14:19 +08:00
Boshen
889837704c
feat(semantic): cfg prototype (#2019)
Co-authored-by: U9G <git@u9g.dev>
2024-01-25 20:19:35 +08:00
underfin
2794064eef
feat(transfrom): transform-json-strings (#2168)
The pr intends to implement the plugin
`babel-plugin-transform-json-strings`. But here is only mutate
`Directive`, the `StringLiteral` is not implement. It need to changed
the `StringLiteral` printer.

I'm intend to add the raw of `StringLiteral`, it will be mutate at
plugin, and using the `raw` to print `StringLiteral`. If you other
ideas, please let me know.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-01-25 10:39:02 +00:00
underfin
989ab88bc6
fix(codegen): print Directive original string (#2157)
> A Use Strict Directive may not contain an EscapeSequence or
LineContinuation.

It is `Use Strict Directive` spec, but the `expression` of `Directive`
isn't original string value, it has error if using it to codegen, so
here using `directive` of `Directive` to codegen and not to escape it.
Here is crashed test cases.

``` js
'use str\
ict';
```
The babel will print the original string, I follow it and avoid using
`print_str` because it will escape string.

I also changed some code using the `expression` of `Directive` to check
`Use Strict Directive` .
2024-01-25 15:24:05 +08:00
Dunqing
51cecbb3ea
refactor(transformer/decorators): align the implementation of all versions (#2159) 2024-01-25 13:11:24 +08:00
Dunqing
7f89bfea0d
feat(transformer/decorators): support version 2023-05 (#2152) 2024-01-24 11:19:29 +08:00
Dunqing
04b401cbfd
feat(transformer/decorators): support transform the class decorators in export declaration (#2145) 2024-01-24 11:13:29 +08:00
Dunqing
9e598ff650
feat(transformer): add decorators plugin (#2139) 2024-01-24 11:09:19 +08:00
Dunqing
b5b2ef34af
feat(transformer/typescript): improve function parameters name (#2079) 2024-01-19 13:50:10 +08:00
Dunqing
7711f7abaf
feat(transformer/typescript): support only_remove_type_imports option (#2077) 2024-01-18 23:25:31 +08:00
Dunqing
f5bf5dece1
feat(transformer/typescript): support transform exported TSModuleBlock (#2076) 2024-01-18 23:20:26 +08:00
Dunqing
56ca8b6dfe
feat(transformer/typescript): support transform namespace (#2075) 2024-01-18 23:15:28 +08:00
Wenzhe Wang
32349af691
chore(tasks): remove redundant directory after exec (#2069) 2024-01-17 17:35:15 +08:00
Dunqing
b89e84cc2d
feat(transformer/typescript): keep imports if import specifiers is empty (#2058) 2024-01-17 16:14:31 +08:00
Dunqing
24ac957660
fix(semantic): incorrect reference flag (#2057) 2024-01-17 16:08:31 +08:00
Dunqing
3413bb3884
feat(transformer/typescript): remove type-related exports (#2056) 2024-01-17 16:04:30 +08:00
Dunqing
95d741abd6
feat(transformer/typescript): remove type only imports/exports correctly (#2055) 2024-01-17 15:58:04 +08:00
Boshen
a69b76ab77
chore: update snapshots 2024-01-15 21:13:05 +08:00
Dunqing
6c7f983de5
feat(transformer/typescript): remove export specifier that import_kind is type (#2015) 2024-01-13 21:25:59 +08:00
Dunqing
ead4e8df1f
feat(transformer/typescript): remove import if only have type reference (#2001) 2024-01-13 08:52:14 +00:00
Dunqing
0a086860da
feat(ast): visit TSModuleReference (#1998)
### Failed cases:

* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elision-qualifiedname/input.ts
* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react/input.ts

We need to distinguish whether a reference is a type or a js variable
2024-01-11 23:29:29 +08:00
Dunqing
afb2c501f5
feat(transformer): support for transform TSImportEqualsDeclaration (#1994) 2024-01-11 23:24:28 +08:00
underfin
78b427bc50
feat(transform): support es2015 new target (#1967)
Here implementing the es2015 new target transform, see detail at
https://babel.dev/docs/babel-plugin-transform-template-new-target.

Here has three kinds need to be distinguished.

- `NewTargetKind::Method`, it from `AstKind::ObjectMethod` or
`AstKind::MethodDefinitionKind::Get/Set/Method`. It will be transformed
to `void 0`.
- `NewTargetKind::Constructor`, is from `
AstKind::MethodDefinitionKind::Constructor`. It will be transformed to
`this.constructor`.
- `NewTargetKind::Function`, is from ` AstKind::Function`, here the
function is not the above function. It will be transformed to `this
instanceof _target ? this.constructor : void 0`, here `_target` comes
from the function name or is created by scope uid ident.
2024-01-10 23:59:56 +08:00
秦宇航
ae27a8d1e6
feat(transformer): add partial support for babel-plugin-transform-instanceof (#1802) 2023-12-25 15:06:41 +08:00
Boshen
cf91379d1b
ci: fix codecov not executing on conformance tests 2023-12-16 13:38:40 +08:00
Dunqing
32db5d29b3
feat(tasks/transformer): add function name plugin (#1676)
The plugin is added at https://github.com/oxc-project/oxc/pull/1510.
2023-12-15 11:29:34 +08:00
Boshen
ddab18f5af
chore: update snapshots - upgrading bun fixes this??? 2023-12-14 16:58:47 +08:00
Dunqing
f58b6279c8
feat(transformer): add arrow_functions plugin (#1663) 2023-12-13 20:46:28 +08:00
Ken-HH24
e331cc2677
feat(transformer): duplicate keys (#1649) 2023-12-10 18:07:32 +08:00
Miles Johnson
6cbc5dd75b
feat(transformer): Start on function_name transform. (#1510)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-12-04 13:35:44 +08:00
IWANABETHATGUY
c034eee5c1
feat(transformer): handle invalid react jsx runtime (#1502) 2023-11-28 23:19:58 +08:00
Boshen
37a592cc33
chore: update transform conformance exec snapshot 2023-11-28 16:38:20 +08:00
Boshen
7fca9504d2
chore: update snapshots 2023-11-28 16:27:10 +08:00
magic-akari
92c1d9d527
feat(transform): TypeScript Enum (#1173) 2023-11-28 10:33:01 +08:00
IWANABETHATGUY
b6393f052f
feat(transformer/react): handle babel 8 breaking removed-options (#1489)
1. removed options react jsx
2. Passed 4 test cases.
2023-11-22 11:01:40 +08:00
IWANABETHATGUY
f66e4d8ac3
feat(transformer): add transform property-literal plugin (#1458)
1. Add `transform-property-literal-plugin`
2. Passing 2 testcases.

---------

Co-authored-by: Wenzhe Wang <mysteryven@gmail.com>
2023-11-21 23:07:43 +08:00
IWANABETHATGUY
4fb4a85ab1
chore(transformer): 🤖 add diff section when conformance failed in filter mode (#1488) 2023-11-21 21:47:58 +08:00
Boshen
1a576f60a8
refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
Boshen
9780621925
chore: run fmt 2023-11-16 13:36:42 +08:00
Boshen
73d6d40778
rust: do not compile libs and bins that do not have tests (#1342) 2023-11-16 13:35:24 +08:00
Dunqing
7f01d48df3
feat(transformer/react-jsx): set automatic to the default value for runtime (#1270)
Align babel8
2023-11-14 09:26:21 +08:00
Dunqing
472707c04e
feat(task/transformer-conformance): skip babel 8 unsupported test cases (#1258)
Prior to babel8, object merging would use `babelHelper.extend`, which
caused most tests to fail
2023-11-13 11:05:36 +08:00
Dunqing
1eef241788
feat(transformer/react-jsx): support for throwing SpreadChildrenAreNotSupported error (#1234) 2023-11-12 18:37:19 +08:00
Dunqing
39e608734f
feat(transformer/react-jsx): support for throwing ImportSourceCannotBeSet error (#1224) 2023-11-12 11:17:23 +08:00
Dunqing
b7e8feb7c1
feat(transformer/react-jsx): support throw valueless-key error (#1221) 2023-11-11 20:10:07 +08:00
Dunqing
a22ced78f1
feat(transformer/react-jsx): implement throwIfNamespace option (#1220) 2023-11-11 13:31:45 +08:00
Boshen
50d2d88a36
chore(transform_conformance): update snapshot 2023-11-11 10:57:09 +08:00
Dunqing
48242367bb
fix(transformer/react-jsx): missing import jsxs in nested fragment (#1218) 2023-11-11 02:45:42 +00:00
Dunqing
a0f40cb058
fix(transformer/react-jsx): missing default options when plugin without config (#1219) 2023-11-11 10:38:28 +08:00
Boshen
fdd8018c8e
chore(transform_conformance): update snapshot 2023-11-10 18:28:48 +08:00
Dunqing
d9b450414b
feat(transformer/react-jsx): when the source type is a script, use require to import the react (#1207) 2023-11-10 18:17:31 +08:00
Dunqing
3e15fa624b
fix(transformer/react-jsx): undetectable comments in multiline comments (#1211) 2023-11-10 08:20:55 +00:00
Dunqing
8c624abf9c
feat(transformer/react-jsx): throw the pragma and pragmaFrag cannot be set when runtime is automatic error (#1196)
close: #1194

Here's a rough implementation of my idea of throwing an error.
2023-11-10 12:50:54 +08:00
Dunqing
b65094b995
fix(transformer/react-jsx): no need to wrap the Array when there is only one correct child element (#1205) 2023-11-10 10:52:37 +08:00
Dunqing
ae71b36f9b
fix(tasks): avoid overriding existing babel options (#1193) 2023-11-08 17:04:59 +08:00
Dunqing
d8864c15b0
fix(tasks/transform_conformance): only the filtered test cases should be included when passing a filter (#1197) 2023-11-08 17:03:01 +08:00
Dunqing
7d85492a03
feat(transformer/react-jsx): support the sourceType is a script (#1192) 2023-11-08 15:15:00 +08:00
Dunqing
28c0b85646
feat(transformer/react-jsx): support @jsxFrag annotation (#1189) 2023-11-08 11:35:40 +08:00
Dunqing
633c469d2d
feat(transformer/react-jsx): support @jsx annotation (#1182) 2023-11-07 20:30:26 +08:00
Dunqing
3cb7c0b199
feat(transformer/react-jsx): support pragmaFrag option (#1181) 2023-11-07 10:34:15 +00:00
Dunqing
4ed0813f9b
feat(transformer/react-jsx): support pragma option (#1180) 2023-11-07 18:26:54 +08:00
Dunqing
bf23d87848
feat(transformer/react-jsx): support @jsxImportSource annotation (#1179) 2023-11-07 17:29:38 +08:00
Dunqing
f0e452a599
feat(transformer): support importSource option in react_jsx (#1115) 2023-11-07 16:42:08 +08:00
Boshen
38c90db0fe
ci: check unused dependencies via cargo machete (#1143) 2023-11-04 14:45:44 +00:00
Wenzhe Wang
f71cb9f1da
feat(transform): support TemplateLiteral of babel/plugin-transform-template-literals (#1132)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-11-03 22:19:44 +08:00
Boshen
203cf37695
feat(transformer/react): read comment pragma @jsxRuntime classic / automatic (#1133)
closes #1120
2023-11-03 11:10:11 +08:00
Boshen
69150d812c
refactor(transformer): move Semantic into Transformer (#1130) 2023-11-02 13:10:15 +08:00
Wenzhe Wang
8105ee5872
feat(tasks): skip cases start with dot (#1114)
0effd92d88/packages/babel-helper-fixtures/src/index.ts (L223)
2023-10-30 23:34:43 +08:00
Boshen
262631da62
feat(transformer/react): implement fixup_whitespace_and_decode_entities (#1091) 2023-10-29 18:11:51 +08:00
Boshen
1051f15005
feat(transformer/jsx): escape xhtml in jsx attributes (#1088) 2023-10-29 15:16:50 +08:00
Boshen
1ad2dca45a
fix(transformer/react_jsx): add imports to the top body (#1087) 2023-10-29 15:05:52 +08:00
Boshen
e8a4e81298
feat(transformer): implement some of jsx decode entities (#1086) 2023-10-29 14:57:39 +08:00
Wenzhe Wang
094dfa5604
feat: support filter exec snap (#1084)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-10-29 05:39:32 +00:00
Boshen
fe4a5ed535
fix(transformer): fix position of inserted react import statement (#1082) 2023-10-28 23:05:02 +08:00
Boshen
0856111bea
feat(transformer): implement more of react transform attributes (#1081) 2023-10-28 22:47:39 +08:00
Boshen
96332c85c6
feat(transformer): import jsxs when children is static (#1080) 2023-10-28 17:25:25 +08:00
Boshen
c7a04f42e7
refactor(transformer): remove returning None from transform functions (#1079) 2023-10-28 16:55:38 +08:00
Boshen
d411258be4
feat(transformer): finish transform jsx attribute value (#1078) 2023-10-28 16:46:33 +08:00
Boshen
5fb27fbe8a
feat(transformer): implement key extraction for react automatic (#1077) 2023-10-28 16:34:54 +08:00
Boshen
394ed358f6
feat(transformer): implement react get_attribute_name (#1076) 2023-10-28 16:25:03 +08:00
Boshen
f60fd65f65
feat(transfomer): implement react has_key_after_props_spread (#1075) 2023-10-28 16:17:11 +08:00
Boshen
d6ba8910ba
feat(transformer): add props null to React.createElement (#1074) 2023-10-28 15:59:46 +08:00
Boshen
e16e7e44e0
feat(transformer): implement react transform attributes (#1071) 2023-10-28 02:12:23 +00:00
Wenzhe Wang
b5bfc361fc
feat(transform): transform jsx element name (#1070) 2023-10-27 08:13:40 +08:00
Boshen
d8f1a7fce6
feat(transformer): start implementing react jsx transform (#1057) 2023-10-26 17:27:05 +08:00
magic-akari
1b64e48ee1
feat(transformer): strip implicit type import for typescript (#1058) 2023-10-26 11:07:30 +08:00
Wenzhe Wang
ae74e08141
chore(tasks): only use bun to run babel exec.js (#1060) 2023-10-25 22:33:20 +08:00
Wenzhe Wang
7192520d2b
feat(transformer_conformance): use bun to run babel exec.js test cases (#1012)
closes #999 

Co-authored-by: Boshen <boshenc@gmail.com>
2023-10-25 03:06:07 +00:00
Boshen
af1a76bafa
feat(transformer): implement some of needs_explicit_esm for typescript (#1047)
Co-authored-by: magic-akari <akari.ccino@gmail.com>
2023-10-24 17:30:01 +08:00
Boshen
854b55a3e6
feat(codegen): json strings proposal (#1039) 2023-10-23 18:29:30 +08:00
Boshen
befc26a440
chore(transform_conformance): remove the duplicated test case 2023-10-23 17:22:27 +08:00
Boshen
d31a667e23
feat(transformer): drop this parameter from typescript functions (#1019) 2023-10-20 23:15:06 +08:00
Boshen
5e083b156c
refactor(transform_conformance): remove the Failed: prefix from snapshot 2023-10-20 16:49:04 +08:00
Boshen
4c4ccc6577
feat(transform_conformance): remove legacy decorator tests 2023-10-20 16:47:58 +08:00
Boshen
dfee8539f0
feat(transformer): add utils to make logical_assignment_operators pass (#1017) 2023-10-20 16:27:23 +08:00
Boshen
46a5c42c75
refactor(transformer): add TransformerCtx struct for easier access to symbols and scopes 2023-10-19 16:19:27 +08:00
Boshen
4b719026bf
feat(transform_conformance): handle non-existent output.js (#1007) 2023-10-17 20:44:35 +08:00
Boshen
052661d75e
refactor(transform_conformance): improve report format 2023-10-17 17:41:34 +08:00
Boshen
3605f7c0fc
fix(transform_conformance): fix for codecov 2023-10-17 15:34:50 +08:00
Boshen
1b3b100475
feat(transformer_conformance): read plugins options from babel options.json (#1006)
This PR correctly handles babel `options.json` such as
https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-nullish-coalescing-operator/test/fixtures/assumption-noDocumentAll/options.json
2023-10-17 14:52:51 +08:00
Boshen
678db1d955
feat(transformer): ES2020 Nullish Coalescing Operator (#1004)
The test runner needs an update for reading options.jon, which I'll work
on in the up coming PR.
2023-10-16 21:45:58 +08:00
Boshen
c060621512
feat(transformer): add unit tests and test coverage (#1001) 2023-10-16 14:07:29 +08:00
Boshen
0f72066f2e
feat(transformer): finish 2016 exponentiation operator (#996) 2023-10-16 09:30:04 +08:00
Boshen
b9d0d57fa2
feat(transform_conformance): improve how snapshot is displayed 2023-10-13 13:44:45 +08:00
Boshen
e0ca09b1c9
feat(codegen): implement the basics of non-minifying codegen (#987) 2023-10-13 13:34:21 +08:00
Boshen
ce79bc12ab
feat(transform_conformance): move Formatter to codegen (#986) 2023-10-12 15:13:14 +08:00
Boshen
8c12dff8a3
perf: speed tasks run by using a global allocator 2023-10-11 20:30:30 +08:00
magic-akari
dc08c949a2
feat(transformer): RegexpFlags (#977)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-10-11 07:15:19 -05:00
Boshen
822f4e1468
chore: remove tasks/transform_conformance/README.md
use issue instead https://github.com/web-infra-dev/oxc/issues/974
2023-10-10 21:01:34 +08:00
Wenzhe Wang
09df8e609a
feat(transform): sticky-regex (#968) 2023-10-09 19:12:14 +08:00
magic-akari
9ad2634091
feat(transformer): Class Static Block (#962) 2023-10-08 08:16:40 +08:00
magic-akari
21066a9ad7
feat(transformer): Shorthand Properties (#960) 2023-10-07 17:02:45 +08:00
Boshen
817f8c295e
ci: turn off doc tests because they are slow to compile and run (#961) 2023-10-07 17:01:23 +08:00
Boshen
b46f34e096
chore: bump submodules and snapshots 2023-10-06 16:15:35 +13:00
Cameron
5b1e1e5408
feat(parser): TypeScript 5.2 (#811)
- adds support for [Using
Declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management)

Closes #786
2023-10-05 12:52:14 +13:00
Boshen
8553817bc9
chore(transform_conformance): update test cases and README regarding regex 2023-09-18 17:49:36 +08:00
Boshen
5973e5aede
feat(transformer): setup typescript and react transformers (#930) 2023-09-18 16:56:41 +08:00
Boshen
46d2623c1f
feat(transform_conformance): add jsx and ts tests 2023-09-18 15:35:02 +08:00
Boshen
4e036630ed
feat(transform_conformance): add all babel tests 2023-09-17 09:56:13 +08:00
Boshen
5863f8ffdb
feat(transformer): logical assignment operators (#923) 2023-09-16 23:54:53 +08:00
Boshen
1bb649243a
feat(transformer_conformance): group tests in the snapshot (#922) 2023-09-16 21:29:21 +08:00
Boshen
7172953fe9
feat(transformer_conformance): snapshot passed and failed tests (#921) 2023-09-16 20:58:31 +08:00
Boshen
8f59eb0960
chore(transformer): add feature list to README 2023-09-16 18:51:00 +08:00
Boshen
f4cea34534
feat(transformer): add babel conformance test suite (#920) 2023-09-16 18:50:51 +08:00