Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codegen): print vite / webpack special comments #6021

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Sep 24, 2024

Related: #1046 (comment)
Close: #6024

Copy link

graphite-app bot commented Sep 24, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the A-codegen Area - Code Generation label Sep 24, 2024
Copy link
Member Author

Dunqing commented Sep 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Dunqing and the rest of your teammates on Graphite Graphite

Copy link

codspeed-hq bot commented Sep 24, 2024

CodSpeed Performance Report

Merging #6021 will not alter performance

Comparing 09-24-refactor_codegen_print_inner_comments (cca433f) with main (efabfc8)

Summary

✅ 29 untouched benchmarks

@Dunqing Dunqing changed the title refactor(codegen) print inner comments refactor(codegen): print inner comments Sep 24, 2024
@Dunqing Dunqing changed the title refactor(codegen): print inner comments feat(codegen): print inner comments Sep 24, 2024
@Dunqing Dunqing marked this pull request as draft September 24, 2024 09:38
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from c64a88d to c54bd53 Compare September 25, 2024 01:58
@Dunqing Dunqing changed the base branch from main to 09-24-refactor_codegen_simplify_printing_annotation_comments September 25, 2024 01:58
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_simplify_printing_annotation_comments branch from 3474b45 to 138ccc9 Compare September 25, 2024 02:13
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from c54bd53 to c7a7586 Compare September 25, 2024 02:13
@Dunqing Dunqing changed the base branch from 09-24-refactor_codegen_simplify_printing_annotation_comments to graphite-base/6021 September 25, 2024 06:27
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from c7a7586 to bc55004 Compare September 25, 2024 06:31
@Dunqing Dunqing changed the base branch from graphite-base/6021 to main September 25, 2024 06:32
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from bc55004 to e9cca9b Compare September 25, 2024 06:32
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from e9cca9b to 2ee73ba Compare September 26, 2024 02:03
@Dunqing Dunqing changed the title feat(codegen): print inner comments feat(codegen): print vite / webpack special comments Sep 26, 2024
@Dunqing
Copy link
Member Author

Dunqing commented Sep 26, 2024

A lot of minifier cases failed, it looks like the compressor caused some cases to assign an incorrect span

EDIT: Fixed in #6065

@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from 49f34f5 to c96027a Compare September 26, 2024 05:41
@github-actions github-actions bot added A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler labels Sep 26, 2024
Boshen pushed a commit that referenced this pull request Sep 26, 2024
unblock #6021

Keep the original expression's `span` to insert comments correctly. Have tested in #6021 and it worked
@Dunqing Dunqing force-pushed the 09-24-refactor_codegen_print_inner_comments branch from c96027a to 3f8db9b Compare September 26, 2024 06:18
@Dunqing Dunqing marked this pull request as ready for review September 26, 2024 06:25
@Dunqing Dunqing requested a review from Boshen September 26, 2024 06:25
Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some integration tests for vite special comments, including tests that don't match these webpack / vite patterns?

You may add them to crates/oxc_codegen/tests/integration/unit.rs or merge them in pure_comments.rs

@Dunqing
Copy link
Member Author

Dunqing commented Sep 26, 2024

Can we add some integration tests for vite special comments, including tests that don't match these webpack / vite patterns?

You may add them to crates/oxc_codegen/tests/integration/unit.rs or merge them in pure_comments.rs

I added tests for vite special comments in crates/oxc_codegen/tests/integration/unit.rs and non-special comments tests which copy from esbuild in esbuild

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Sep 26, 2024
Copy link

graphite-app bot commented Sep 26, 2024

Merge activity

  • Sep 26, 11:17 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 26, 11:19 AM EDT: Boshen added this pull request to the Graphite merge queue.
  • Sep 26, 11:23 AM EDT: Boshen merged this pull request with the Graphite merge queue.

@Boshen Boshen force-pushed the 09-24-refactor_codegen_print_inner_comments branch from 15f265a to cca433f Compare September 26, 2024 15:19
@graphite-app graphite-app bot merged commit cca433f into main Sep 26, 2024
24 checks passed
@graphite-app graphite-app bot deleted the 09-24-refactor_codegen_print_inner_comments branch September 26, 2024 15:23
Boshen added a commit that referenced this pull request Sep 27, 2024
## [0.30.2] - 2024-09-27

### Features

- 60c52ba ast: Allow passing span to `void_0` method (#6065) (Dunqing)
- cca433f codegen: Print `vite` / `webpack` special comments (#6021)
(Dunqing)
- 8d026e1 regular_expression: Implement `GetSpan` for RegExp AST nodes
(#6056) (camchenry)
- 7764793 regular_expression: Implement visitor pattern trait for regex
AST (#6055) (camchenry)
- f866781 semantic: Check for type annotations on left side of `for..in`
and `for..of` iterators (#6043) (DonIsaac)
- 8b2e9aa semantic: Check for JSDoc types in TS type annotations (#6042)
(DonIsaac)
- 28da771 transformer: Do not transform `**` with bigint literals
(#6023) (Boshen)

### Bug Fixes

- a88504c diagnostics: Check for terminal when displaying links (#6018)
(Boshen)
- 418ae25 isolated-declarations: Report uninferrable types in arrays
(#6084) (michaelm)
- e0a8959 minifier: Compute `void number` as `undefined` (#6028)
(Boshen)
- 0658576 paresr: Do not report missing initializer error in ambient
context (#6020) (Boshen)
- b1af73d semantic: Do not create a `global` symbol for `declare global
{}` (#6040) (DonIsaac)
- c8682e9 semantic,codegen,transformer: Handle definite `!` operator in
variable declarator (#6019) (Boshen)

### Performance

- 6b7d3ed isolated-declarations: Should clone transformed AST rather
than original AST (#6078) (Dunqing)
- 85aff19 transformer: Introduce `Stack` (#6093) (overlookmotel)
- ad4ef31 transformer: Introduce `NonEmptyStack` (#6092) (overlookmotel)

### Documentation

- 3099709 allocator: Document `oxc_allocator` crate (#6037) (DonIsaac)
- d60ceb4 oxc: Add README.md and crate-level docs (#6035) (DonIsaac)
- efabfc8 semantic: Improve doc comments on `Reference` methods (#6076)
(overlookmotel)

### Refactor

- 1fc80d1 ast: Move all ts ast related impl methods to `ast_impl`
(#6015) (Dunqing)
- fe696f0 codegen: Simplify printing annotation comments (#6027)
(Dunqing)
- e60ce50 transformer: Add `SparseStack::with_capacity` method (#6094)
(overlookmotel)
- 1399d2c transformer: Move `SparseStack` definition into folder (#6091)
(overlookmotel)
- 6bd29dd transformer: Add more debug assertions (#6090) (overlookmotel)
- c90b9bf transformer: Rename `SparseStack` methods (#6089)
(overlookmotel)
- 2b380c8 transformer: Remove unsued `self.ctx` (#6022) (Boshen)

### Testing

- 93575cd semantic: Add comprehensive regression test suite (#5976)
(DonIsaac)
- a4cec75 transformer: Enable tests (#6032) (overlookmotel)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-ast Area - AST A-codegen Area - Code Generation A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

codegen: print webpack / vite special comments
2 participants