Commit graph

22 commits

Author SHA1 Message Date
Boshen
d942a8d41a
chore: Rust v1.83.0 changes (#7535)
This PR does not upgrade rustc. Only changes are applied.

We cannot upgrade to the lastet Rust version yet due to wasm-bindgen
breaking some generated types.

THere's also some elided lifetimes in `**/generated/**`, which requires
modification to ast tools.
2024-11-29 11:59:45 +08: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
dd79c1bfb3
refactor(codegen): replace daachorse with string match for annotation comment (#7064) 2024-11-02 14:16:10 +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
overlookmotel
77f3a1a9dd perf(codegen): check last char with byte methods (#6509)
When checking what last char in buffer is, avoid calculating a `char` when only comparing to an ASCII char (byte) anyway.
2024-10-14 01:09:02 +00:00
DonIsaac
204bf5533e refactor(codegen): add CodeBuffer to fix soundness hole (#6148)
# What This PR Does

Adds `CodeBuffer`, a simple wrapper over a `Vec<u8>` with a protective and reduced API for upholding UTF-8 validity guarantees. Closes #6147.

Note that this struct is actually quite small. Most of the added lines are doc comments.
2024-10-13 09:14:48 +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
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
DonIsaac
ab187d1e22 refactor(codegen): restrict visibility of internal methods (#6145)
add `pub(crate)` to `Codegen` methods that should only be used within `oxc_codegen`
2024-09-28 14:33:42 +00:00
Dunqing
05852a04ed perf(codegen): do not check whether there are annotation comments or not if we don't preserve annotation comments (#6107) 2024-09-27 11:18:42 +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
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