Commit graph

92 commits

Author SHA1 Message Date
Boshen
a1752a062c fix(codegen): fix incorrect minified return 1n output (#8374) 2025-01-09 05:01:41 +00:00
Boshen
5a648bc3cd fix(codegen): fix white space issue with do statements (#8348) 2025-01-08 13:28:10 +00:00
Boshen
a542013773 feat(minifier): minimize do{}while(true) -> do;while(true) (#8311) 2025-01-07 12:55:03 +00:00
Boshen
ad146bbb90 feat(codegen): print real newline when \n is inside template literals (#8178) 2024-12-29 12:20:47 +00:00
Boshen
ad61e70186 fix(codegen): print if else without block with proper indentation (#8135) 2024-12-27 00:39:52 +00:00
Boshen
bdc241d41d fix(codegen): disallow template literals in object property key (#8108) 2024-12-25 11:22:54 +00:00
Boshen
47276679f5 feat(codegen): minify arrow expr (x) => y -> x => y (#8078) 2024-12-24 14:25:01 +00:00
Boshen
728ed20c1c
fix(codegen): print yield * ident correctly 2024-12-24 21:57:58 +08:00
Boshen
0562830549 feat(codegen): minify string with backtick when needed (#8095) 2024-12-24 13:39:31 +00:00
Boshen
ad2a620d61 fix(ast)!: add missing AssignmentTargetProperty::computed (#8097) 2024-12-24 13:27:00 +00:00
Boshen
6237c0527f feat(codegen): minify more whitespace (#8089) 2024-12-24 09:54:13 +00:00
Boshen
6355b7ca70 feat(codegen): minify export { 's' as 's' } -> export { 's' } (#8093) 2024-12-24 09:17:51 +00:00
Boshen
fccfda91c1 feat(codegen): minify class{static[computed]} (#8088) 2024-12-24 05:06:57 +00:00
Boshen
414c118309 feat(codegen): minify yield "s" -> yield"s" (#8084) 2024-12-24 00:41:28 +00:00
Boshen
f8f067bfc6 feat(codegen): minify class method async*fn(){} (#8083) 2024-12-24 00:35:29 +00:00
Boshen
618b6aa085 feat(codege): minify whitespace in object getter / setter (#8080) 2024-12-23 16:36:03 +00:00
Boshen
1d5ae817d7 feat(codegen): minify const [foo] = bar -> const[foo]=bar (#8079) 2024-12-23 16:20:37 +00:00
Boshen
e3f78fba0b feat(codegen): new Foo() -> new Foo when minify (#8077) 2024-12-23 15:34:31 +00:00
Boshen
d84d60a3a9 feat(codegen): minify numbers with large exponents (#8074) 2024-12-23 13:35:52 +00:00
Boshen
373279b7f4 feat(codegen): balance string quotes when minify whitespace (#8072) 2024-12-23 13:24:22 +00:00
Dunqing
850dd43597 fix(codegen): missing , when generating type parameters with jsx (#7929)
close: #7917
2024-12-16 05:35:06 +00:00
Boshen
7fb9d47460 style(rust): cargo +nightly fmt (#7877) 2024-12-14 06:03:31 +00:00
Boshen
a222f2b055 fix(codegen): print delete 2e308 as delete (0, Infinity) (#7761)
closes #7736
2024-12-10 08:37:50 +00:00
Boshen
b701232098 fix(codegen): print quote correctly for directive (#7735)
closes #7734
2024-12-09 07:17:02 +00:00
Dunqing
8c3a954336 fix(codegen): missing parens for in in for in loop init (#7705)
Well, this looks like an accidental change before, `Context::empty().and_forbid_in(false)` does nothing at all.
2024-12-06 15:52:05 +00:00
Dunqing
4afbe5599e fix(codegen): missing parens for in in for loop init when it includes two binary expression (#7703)
close: #7690

I don't know the logic much, it works without `left_ctx` and no tests failed
2024-12-06 15:52:04 +00:00
Boshen
d0b78f7361 feat(codegen): minify whitespace for some expressions (#7671)
part of #7638
2024-12-05 06:59:17 +00:00
Boshen
c523ccb7ef feat(codegen): better whitespace minification for import / export statements (#7650)
part of #7638
2024-12-04 19:24:03 +00:00
Boshen
e787e9d41a fix(codegen): print parentheses correctly for ClassHeritage (#7637)
closes #7631
2024-12-04 06:43:32 +00:00
Boshen
82773cb455 feat(codegen): remove underscore from bigint (#7367)
closes #7285
closes #7286
2024-11-20 09:08:51 +00:00
Dunqing
c587dd3cd6 fix(codegen): do not print parenthesis for in expression in ArrowFunctionExpression (#7360)
Please check out [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAACgpID0+ICIiIGluIHt9)
2024-11-19 14:29:18 +00:00
Dunqing
58db9ef322 refactor(codegen): do not print unnecessary parentheses if both sides use the same logical operator (#7325)
As shown by the changing tests, we don't need to print parentheses for them.

### Comparison
In [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAAGEgPz8gKGIgPz8gKGMgPz8gZCkpOwooYSA/PyAoYiA/PyAoYyA/PyBkKSkpOwooYSB8fCAoYiB8fCBjKSkgfHwgZDsKYSB8fCAoYiB8fCAoYyB8fCBkKSk7CmEgJiYgKChiICYmIGMpICYmIGQp), it will print parentheses as-is, in [SWC](https://play.swc.rs/?version=1.9.2&code=H4sIAAAAAAAAA0tUsLdX0EgCk8kgMkVT05pLIxGLMES8pgYkDiSTNTVBVIo1F5IgUDFIDKQ2UUFNTUEDKAykkjVBZIomAGEbiHtuAAAA&config=H4sIAAAAAAAAA1VQzW7DIAy%2B9ykin6tlyrHXTb3ttCdA1GmpACPbSIuqvPuAJml6w9%2Bv8ePQdXAXC6fuUZ5lSIYFeZsLIlNU81cQ0CmhWHZJ4biyKpVSztiQ%2BUmAGr6iVhPK8DkMsOJsoozEYd%2BQBb9xdBHPxF%2FeiJwd%2BossuVsVo7G68xXIhUSsv5TZYi27qSY59T1K%2BJBbn56W48vAOaoLTWuyUjDqLCz0%2FPYDTyRVNxovyw4QXHTjtF%2FdUiglIu%2FCKjXx6jf%2FYc1v6RDokhu5HL0etq5U0gLFu8BLuTZu6eDkZ7W3s8%2F%2FYy0r4MUBAAA%3D), we have the same output now
2024-11-19 10:31:53 +00:00
Song Gao
cf3415b0e4
chore(doc): replace main/master to tag/commit to make the url always accessible (#7298) 2024-11-16 21:00:30 +08:00
Boshen
1282221e36 fix(codegen): print comments when block is empty (#7236)
part of #7190
2024-11-11 11:20:25 +00:00
Boshen
d1d187417b feat(ast)!: change comment.span to real position that contain // and /* (#7154)
closes #7150
2024-11-06 05:10:33 +00:00
Boshen
40d8acfbd1 feat(codegen): improvement printing of legal comments (#7111) 2024-11-04 08:56:00 +00:00
Boshen
caa4b1fd2a feat(codegen): improve printing of comments (#7108) 2024-11-04 05:12:59 +00:00
Boshen
001058a8e4
feat(codegen): always print legal comments on its own line (#7089) 2024-11-02 15:55:23 +08:00
Boshen
413973df66 feat(codegen): print linked and external legal comment (#7059)
part of #7050
2024-11-02 04:08:14 +00:00
Boshen
ee27b92465 feat(codegen): print eof legal comments (#7058)
part of https://github.com/oxc-project/oxc/issues/7050
2024-11-01 16:56:57 +00:00
Boshen
6516f9eabc feat(codegen): print inline legal comments (#7054)
part of https://github.com/oxc-project/oxc/issues/7050
2024-11-01 16:56:56 +00:00
Boshen
05ef03dbab fix(codegen): correct print __proto__ shorthand (#6802) 2024-10-23 07:16:00 +00:00
Boshen
1b7897cf01 fix(codegen): print #field in {} << 0; correctly (#6799) 2024-10-23 05:34:22 +00:00
Boshen
e5ed6a56a8 feat(codegen): print negative numbers (#6624) 2024-10-16 22:38:54 +00:00
Dunqing
e7c89a596b test(codegen): uncomment passed tests that are related to trailing comments (#6589)
Just uncomment them and replace whitespace with `\t`
2024-10-15 16:23:41 +00:00
Dunqing
02bfbfeef5 fix(codegen): preserve parenthesis for ChainExpression (#6430)
close: #6385

The fixing way was referenced from `esbuild`, it is according to these [states](332727499e/internal/js_ast/js_ast.go (L590-L604)
)(determined in the parser) to determine whether to print parenthesis

Due to differences in implementation details, we are unable to record certain information like `esbuild` does in its parser. But fortunately, The `ParenthesisExpression` AST is actually like what `esbuild` stored states.
2024-10-13 08:03:37 +00:00
camc314
2ade16ece5 fix(codegen): invalid codegen when in inside bin expr in or loop (#6431)
https://github.com/oxc-project/monitor-oxc/actions/runs/11278829870 ??
2024-10-13 06:47:10 +00:00
camc314
6896efc00c fix(codegen): fix in in sequence expr in for loops (#6428)
not sure if this is right, but it doesn't break any existing tests so hopefully?
2024-10-13 06:47:09 +00:00
Boshen
7645e5c34b refactor(codegen)!: remove CommentOptions API (#6451) 2024-10-11 13:53:28 +00:00
Boshen
520096030a refactor(oxc)!: remove passing Trivias around (#6446)
part of #6426
2024-10-11 06:09:25 +00:00