Commit graph

26 commits

Author SHA1 Message Date
Boshen
c523ccb7ef feat(codegen): better whitespace minification for import / export statements (#7650)
part of #7638
2024-12-04 19:24:03 +00:00
Boshen
1282221e36 fix(codegen): print comments when block is empty (#7236)
part of #7190
2024-11-11 11:20:25 +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
Dunqing
702b574afb refactor(codegen): only print necessary parentheses in TSAsExpression (#6429)
Part of fixing #6385
2024-10-11 02:04:27 +00:00
Dunqing
585cdd5bcd chore(codegen): add more tests for comments from esbuild (#6357)
Copy from https://github.com/rolldown-rs/rolldown/blob/main/crates/rolldown/tests/esbuild/dce/remove_unused_pure_comment_calls/entry.js
2024-10-08 05:42:43 +00:00
Dunqing
84b2d072e8 fix(codegen): converts line comment to block comment if it is a PURE comment (#6356)
The last part of fixing https://github.com/rolldown/rolldown/pull/2375/files#r1789011257

In the following case, the pure comment was written by `//`
```ts
const Component = // #__PURE__
React.forwardRef((props, ref) => {});
```

The printed code looks like this
```ts
const Component =
// #__PURE__ React.forwardRef((props, ref) => {});
```

As you can see, it is broken because the code also commented, so we need to replace `//` with `/* */`
2024-10-08 05:42:42 +00:00
Dunqing
8582ae3e91 fix(codegen): missing parentheses if there is a pure comment before a NewExpression as a ComputedMemberExpression's callee (#6105)
refer to 332727499e/internal/js_printer/js_printer.go (L2544)
2024-09-27 07:12:31 +00:00
Dunqing
cca433f84a feat(codegen): print vite / webpack special comments (#6021)
Related: https://github.com/oxc-project/oxc/issues/1046#issuecomment-2347345319
Close: #6024
2024-09-26 15:19:31 +00:00
Dunqing
fe696f0dec refactor(codegen): simplify printing annotation comments (#6027)
Simplify printing annotation comments, reusing the architecture of printing JSDoc.
2024-09-25 06:27:18 +00:00
Boshen
9ca202a01e fix(codegen): preserve newlines between comments (#6014)
fixes #6010
2024-09-24 05:14:02 +00:00
camc314
4a99372c14 fix(codegen): print jsdoc comments for TSEnumMembers (#6007)
closes #6006

Boshen/Dunqing please feel free to take over this PR. it's a bit outside what i normally work on. 🙂
2024-09-24 01:12:57 +00:00
Boshen
9f6696a6aa feat(codegen): add new lines to TSTypeParameterDeclaration (#5853) 2024-09-18 11:44:24 +00:00
Boshen
bcdbba3981 feat(codegen): print jsdoc comments that are attached to statements and class elements (#5845)
I am unable to print all comments correctly. Comments have way too much semantic meaning in JavaScript.

This PR reduces the scope to only print jsdoc comments that are attached to statements and class elements, in order to get isolated declarations shipped.
2024-09-18 07:58:22 +00:00
Boshen
5901d2a0f1 fix(codegen): various spacing issues (#5820) 2024-09-17 09:03:28 +00:00
Boshen
bb95306efd refactor(codegen): change annotation comment tests to snapshot (#5800) 2024-09-16 05:03:43 +00:00
Boshen
d62defb42d fix(codegen): do not print trailing commas for ArrayExpression (#5551)
closes #5532
2024-09-06 16:35:10 +00:00
Dunqing
c78291600e feat(codegen): print type_parameters in TaggedTemplateExpression (#5438) 2024-09-04 11:24:04 +00:00
Boshen
5c4c00123d fix(codegen): print export @decorator declare abstract class Foo correctly (#5303) 2024-08-28 15:30:39 +00:00
Boshen
f210cf7873 fix(codegen): print TSSatisfiesExpression and TSInstantiationExpression (#4936)
I can't figure out the precedence so printing extra parentheses instead ...
2024-08-16 09:53:17 +00:00
Boshen
a2269625cc fix(codegen): print TSNonNullExpression (#4869) 2024-08-13 08:47:07 +00:00
Boshen
9a094e861e
chore(codegen): add ts snapshot test 2024-07-14 20:46:22 +08:00