Dunqing
3a6e4d91cf
feat(transformer_conformance): test ScopeTree and SymbolTable for correctness after transformation ( #4581 )
...
part of #4549
This test verifies that the correct symbols and scopes were added/changed during the transformation. From the snapshots, most of them are incorrect currently
2024-08-04 11:45:10 +00:00
Boshen
5845057bff
refactor(transformer): pass in symbols and scopes ( #3978 )
...
This PR adds a new method `build_with_symbols_and_scopes` to make semantic building optional, there may be prior steps that has the semantic data already built.
2024-06-30 06:33:48 +00:00
Boshen
4e9d8a5585
chore: fix some nightly clippy warnings
2024-06-19 00:53:58 +08:00
Boshen
5c38a0fd69
feat(codegen)!: new code gen API ( #3740 )
...
This PR introduces two type alias to avoid the confusing const generic `pub struct Codegen<'a, const MINIFY: bool>`
* CodeGenerator - Code generator without whitespace removal.
* WhitespaceRemover - Code generator with whitespace removal.
Usage is changed to a builder pattern:
```rust
CodeGenerator::new()
.enable_comment(...)
.enable_sourcemap(...)
.build(&program);
```
2024-06-18 15:50:12 +00:00
Boshen
534242a729
feat(codegen)!: remove CodegenOptions::enable_typescript ( #3674 )
...
The typescript transform pass is now required to strip typescript syntax
for codegen to print things properly.
Codegen will now print whatever is in the AST.
2024-06-14 21:56:00 +08:00
Boshen
b58d8eb88f
fix!(codegen): remove the unecessary 4th argument from Codegen::new ( #3640 )
2024-06-12 07:58:54 +00:00
Boshen
f6752b482f
feat!(ast): make Trivias clonable by adding Arc ( #3638 )
...
This makes `Trivias` cloneable and stops us from using `Rc::new` and
`Rc::clone` everywhere.
`Trivias` is rarely cloned so an `Arc` should suffice.
2024-06-12 13:16:10 +08:00
Dunqing
5793ff1986
refactor(transformer): replace &’a Trivias with Rc<Trivias> ( #3580 )
...
`Transformer` needs to borrow `Trivias`.
8be1cc8052 (r1630711060)
2024-06-11 13:23:41 +08:00
Dunqing
0007ee47be
chore(coverage, transformer_conformance): print all AST whether or not they are Typecript AST ( #3556 )
...
We have a conclusion that codegen will print whatever is in the AST,
instead of having an option to enable printing TypeScript syntax. I plan
to remove codegen's `enable_typescript` option after we strip out all
typescript AST in the transformer typescript plugin.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-06 15:45:20 +08:00
overlookmotel
8e4f33557d
fix(transformer): output empty file for TS definition files ( #3500 )
...
As discussed in
https://github.com/oxc-project/oxc/pull/3489#issuecomment-2143482458 ,
transformer should output an empty file for TS definition files.
2024-06-03 20:25:02 +08:00
IWANABETHATGUY
0cdb45a1ff
feat(oxc_codegen): preserve annotate comment ( #3465 )
...
1. Copy tests from
efa3dd2d8e/internal/bundler_tests/bundler_dce_test.go (L3833-L3971)
2. Add option to preserve annotate comment like `/* #__NO_SIDE_EFFECTS__
*/` and `/* #__PURE__ */`
2024-05-30 15:25:23 +08:00
Dunqing
816a782254
feat(transformer): support targets option of preset-env ( #3371 )
...
The implementation of the `targets` options was copied from
[swc](https://github.com/swc-project/swc/tree/main/crates/preset_env_base ),
which resulted in some added dependencies in transformer.
Currently, it has supported enabling plugins by `targets`
2024-05-27 10:33:40 +08: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
Boshen
dbde5b3a04
refactor(diagnostics): remove export of miette
2024-05-12 11:46:48 +08:00
Dunqing
fd6a1aa1d2
feat(transformer_conformance): correct source type ( #3233 )
2024-05-11 09:30:43 +00:00
Dunqing
18d853bb2b
feat(transformer/react): support development mode ( #3143 )
2024-05-10 22:07:33 +08: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
5a3f8a5811
feat(transform_conformance): handle parse error ( #3135 )
2024-04-30 00:07:53 +08:00
Dunqing
905ee3fef1
feat(transformer): add arrow-functions plugin ( #3083 )
...
close : #2983
2024-04-29 08:04:01 +00: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
Dunqing
cdd3bc5a4e
feat(transformer_conformance): enable typescript when the typescript plugin is present ( #3007 )
2024-04-16 10:47:06 +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
5f4c1e1d3e
chore(transform_conformance): skip custom presets ( #3001 )
2024-04-16 17:21:34 +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
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
7cf0927a38
feat(transform_conformance): skip tests with plugin.js ( #2977 )
2024-04-14 21:45:27 +08:00
Boshen
ef602af4cc
feat(transform_conformance): skip plugins we don't support yet ( #2967 )
2024-04-14 21:32:03 +08:00
Boshen
10814d5331
fix(transformer): turn on react preset by default ( #2968 )
2024-04-14 19:04:59 +08:00
Boshen
bd9fc6d169
feat(transformer): react jsx transform ( #2961 )
2024-04-14 10:50:17 +08:00
Boshen
e651e50bda
feat(transformer): add the most basic plugin toggles ( #2950 )
2024-04-12 20:25:34 +08:00
Boshen
3419306ac0
feat(transformer): add filename ( #2941 )
2024-04-11 18:43:51 +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
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
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
Boshen
ef932a3c27
refactor(codegen): clean up API around building sourcemaps ( #2602 )
...
closes #2564
2024-03-04 16:03:33 +08:00