Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt
2024-06-19 00:48:30 +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
5a99d30eba
feat(codegen): improve codegen formatting ( #3735 )
2024-06-18 11:10:36 +00:00
Boshen
da1e2d0e9b
fix(codegen): improve typescript codegen ( #3708 )
...
Remaining issues are tracked in https://github.com/oxc-project/oxc/issues/3692
2024-06-17 09:34:54 +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
IWANABETHATGUY
9fe0863479
chore(oxc_codegen): Pass trivias reference instead of ownership in CommentGenRelated ( #3529 )
...
1. Avoid clone or move the ownership when generate comment with `oxc`
2024-06-04 23:21:06 +08:00
Dunqing
ddac2a0e12
refactor(codegen): reduce allocation for print_unquoted_str ( #3525 )
2024-06-04 16:46:56 +08:00
Dunqing
d8063b6210
fix(codegen): wrong escape string ( #3514 )
...
close : #3492
2024-06-03 15:48:01 +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
Don Isaac
a12ed0fd26
fix(codegen): using declaration in for statement ( #3285 )
...
Fixes conformance tests for `using` declarations in for statements, e.g.
```ts
for (using x = 1;;) {}
```
2024-05-14 23:10:47 -04:00
Dunqing
fd5002bc51
feat(codegen): correctly print type-only imports/exports ( #2993 )
2024-04-15 18:33:02 +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
Andrew McClenaghan
6b3b260dcc
feat(Codegen): Improve codegen ( #2460 )
...
This gets all the new TS types working to the same level TS output was
before and fixes a bunch of other codegen
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-21 14:41:57 +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
Wenzhe Wang
384d5acd7a
fix(codegen): lower the level of precedence in TaggedTemplateExpression ( #2391 )
2024-02-11 22:56:32 +08:00
Boshen
721f6cb74e
fix(codegen): format new expression + call expression with the correct parentheses ( #2330 )
...
closes #2328
2024-02-06 22:06:12 +08:00
Wenzhe Wang
0c225a49aa
fix(codegen): print space before with clause in import ( #2278 )
2024-02-02 14:52:32 +00:00
Wenzhe Wang
fa555ceed8
feat(codegen): change back to read raw ( #2222 )
2024-01-31 12:17:52 +08:00
Wenzhe Wang
9333264428
feat(codegen): print TemplateLiteral with print_str ( #2207 )
2024-01-29 23:09:29 +08:00
Yunfei He
d34650a1ac
fix(codegen): print necessary spaces for ExportAllDeclaration ( #2190 )
2024-01-29 01:05:09 +08:00
Wenzhe Wang
1ee6d8cea9
feat(codegen): move string test to codegen ( #2150 )
2024-01-23 23:49:36 +08:00