Skip to content

feat: unify comments and legalComments into a single granular comments option#8229

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-07-feat_5849
Feb 9, 2026
Merged

feat: unify comments and legalComments into a single granular comments option#8229
graphite-app[bot] merged 1 commit intomainfrom
02-07-feat_5849

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Feb 7, 2026

closed #5849

Copy link
Member Author

IWANABETHATGUY commented Feb 7, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

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

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 18c40ed
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6989afea2b01d3000838c33d
😎 Deploy Preview https://deploy-preview-8229--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@IWANABETHATGUY IWANABETHATGUY changed the title feat: 5849 feat: add comments option to control JSDoc and annotation comments Feb 7, 2026
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review February 7, 2026 11:55
Copilot AI review requested due to automatic review settings February 7, 2026 11:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new output.comments option to control preservation of non-legal comments (JSDoc / annotations) in generated JS output, addressing issue #5849 and enabling smaller production bundles when comments are duplicated elsewhere (e.g., .d.ts output).

Changes:

  • Introduces output.comments: 'all' | 'none' across TS option types/validation, CLI help, and JS↔Rust bindings.
  • Wires the option into Rust bundler normalization and ECMAScript codegen/minify pipelines.
  • Adds integration tests/snapshots for comments: "none" and interaction with legalComments: "inline".

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/rolldown/tests/cli/snapshots/cli-e2e.test.ts.snap Updates CLI help snapshot to include --comments.
packages/rolldown/src/utils/validator.ts Adds schema validation + help text for output.comments.
packages/rolldown/src/utils/bindingify-output-options.ts Passes comments through to binding output options.
packages/rolldown/src/options/output-options.ts Documents and types the new comments output option.
packages/rolldown/src/options/normalized-output-options.ts Adds comments to normalized output options interface/impl.
packages/rolldown/src/binding.d.cts Updates generated TS binding types to include comments.
crates/rolldown_testing/_config.schema.json Extends test config JSON schema to support comments.
crates/rolldown_ecmascript/src/ecma_compiler.rs Threads a new print flag into oxc codegen comment options.
crates/rolldown_common/src/module/normal_module.rs Uses options.comments to decide whether to print JSDoc/annotations.
crates/rolldown_common/src/lib.rs Re-exports the new Comments option type.
crates/rolldown_common/src/inner_bundler_options/types/normalized_bundler_options.rs Adds comments to normalized bundler options + default.
crates/rolldown_common/src/inner_bundler_options/types/mod.rs Registers the new comments module.
crates/rolldown_common/src/inner_bundler_options/types/comments.rs Defines the Comments enum (None/All).
crates/rolldown_common/src/inner_bundler_options/mod.rs Adds optional comments to raw bundler options.
crates/rolldown_binding/src/utils/normalize_binding_options.rs Parses comments from JS binding into Rust Comments.
crates/rolldown_binding/src/types/binding_normalized_options.rs Exposes normalized comments back to JS.
crates/rolldown_binding/src/options/binding_output_options/mod.rs Adds comments to binding output options struct.
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap Adds snapshot entries for new comments tests.
crates/rolldown/tests/rolldown/function/comments/none/main.js New fixture for stripping JSDoc/annotations.
crates/rolldown/tests/rolldown/function/comments/none/artifacts.snap Snapshot verifying comments are stripped.
crates/rolldown/tests/rolldown/function/comments/none/_config.json Test config enabling comments: "none".
crates/rolldown/tests/rolldown/function/comments/none_with_legal_inline/main.js New fixture covering legal + non-legal interaction.
crates/rolldown/tests/rolldown/function/comments/none_with_legal_inline/artifacts.snap Snapshot verifying legal comments preserved while others stripped.
crates/rolldown/tests/rolldown/function/comments/none_with_legal_inline/_config.json Test config enabling comments: "none" + legalComments: "inline".
crates/rolldown/src/utils/prepare_build_context.rs Applies default comments: All during build context preparation.
crates/rolldown/src/stages/generate_stage/minify_chunks.rs Applies comments option during minified codegen.
crates/rolldown/src/hmr/hmr_stage.rs Threads comments into HMR printing options.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmarks Rust

group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     69.8±2.05ms        ? ?/sec    1.00     70.2±2.64ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     75.7±2.21ms        ? ?/sec    1.02     77.4±2.26ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    100.4±2.04ms        ? ?/sec    1.01    101.3±2.14ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    112.9±2.05ms        ? ?/sec    1.00    112.5±1.94ms        ? ?/sec
bundle/bundle@threejs                                        1.00     35.9±1.08ms        ? ?/sec    1.00     36.0±2.09ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     40.1±1.21ms        ? ?/sec    1.02     41.0±0.92ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    363.1±3.12ms        ? ?/sec    1.01    365.2±6.69ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    420.9±3.42ms        ? ?/sec    1.00    420.0±6.92ms        ? ?/sec
scan/scan@rome_ts                                            1.00     79.9±2.61ms        ? ?/sec    1.01     81.1±2.22ms        ? ?/sec
scan/scan@threejs                                            1.00     27.4±0.49ms        ? ?/sec    1.02     28.0±1.63ms        ? ?/sec
scan/scan@threejs10x                                         1.00    281.2±4.25ms        ? ?/sec    1.01    283.9±4.19ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY marked this pull request as draft February 9, 2026 05:36
@IWANABETHATGUY IWANABETHATGUY force-pushed the 02-07-feat_5849 branch 5 times, most recently from f43c6b5 to 3c914e7 Compare February 9, 2026 07:55
@IWANABETHATGUY IWANABETHATGUY force-pushed the 02-07-feat_5849 branch 2 times, most recently from aff3e19 to 435668d Compare February 9, 2026 08:07
@IWANABETHATGUY IWANABETHATGUY changed the title feat: add comments option to control JSDoc and annotation comments feat: unify comments and legalComments into a single granular comments option Feb 9, 2026
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review February 9, 2026 08:37
Copilot AI review requested due to automatic review settings February 9, 2026 08:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 9, 2026

Merge activity

Copilot AI review requested due to automatic review settings February 9, 2026 09:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@graphite-app graphite-app bot merged commit 18c40ed into main Feb 9, 2026
35 checks passed
@graphite-app graphite-app bot deleted the 02-07-feat_5849 branch February 9, 2026 10:12
@sapphi-red sapphi-red restored the 02-07-feat_5849 branch February 9, 2026 10:21
@sapphi-red sapphi-red deleted the 02-07-feat_5849 branch February 9, 2026 10:21
This was referenced Feb 11, 2026
shulaoda added a commit that referenced this pull request Feb 11, 2026
## [1.0.0-rc.4] - 2026-02-11

💡 Granular `comments` Option
- New `output.comments` option provides fine-grained control over comment preservation
- The `output.legalComments` option is now deprecated and use `comments.legal` instead

### 🚀 Features

- rename error name to `RolldownError` from `RollupError` (#8262) by @sapphi-red
- add hidden `resolve_tsconfig` function for Vite (#8257) by @sapphi-red
- rust: introduce `rolldown_watcher` (#8161) by @hyf0
- unify `comments` and `legalComments` into a single granular `comments` option (#8229) by @IWANABETHATGUY
- add builtin plugin for visualizing chunk graph (#8162) by @IWANABETHATGUY
- show import declaration location in AssignToImport errors (#8222) by @Copilot
- show import declaration span in CannotCallNamespace error (#8223) by @Copilot
- emit error when plugin accidentally removes runtime module symbols (#8203) by @IWANABETHATGUY
- support tsconfig loading & inputMap for `transform` (#8180) by @sapphi-red
- rolldown_plugin_vite_reporter: update warning message to link to Rolldown docs (#8205) by @sapphi-red

### 🐛 Bug Fixes

- avoid panic on untranspiled JSX syntax by reporting a diagnostic error (#8226) by @IWANABETHATGUY
- rolldown_plugin_vite_import_glob: relax absolute path check and improve invalid glob warning (#8219) by @shulaoda
- merge chunks after detect circular reference (#8154) by @IWANABETHATGUY
- rust: detect runtime module side effects based on its content (#8209) by @hyf0

### 🚜 Refactor

- rename `other` to `jsdoc` in comments options (#8256) by @IWANABETHATGUY
- rename chunk-visualize plugin with bundle-analyzer plugin (#8255) by @IWANABETHATGUY
- remove EXPORT_UNDEFINED_VARIABLE error (#8228) by @Copilot
- consolidate missing runtime symbol errors into a single diagnostic (#8220) by @IWANABETHATGUY
- stabilize `parse` and `parseSync` (#8215) by @sapphi-red
- return errors instead of panicking on builtin plugin conversion failure (#8217) by @shulaoda
- expose `parse` / `minify` / `transform` from `rolldown/utils` (#8214) by @sapphi-red
- prepare defer chunk merging (#8153) by @IWANABETHATGUY

### 📚 Documentation

- remove `<script>` escape behavior difference note from `platform` option (#8253) by @sapphi-red
- TypeScript & JSX support by plugins (#8183) by @sapphi-red

### 🧪 Testing

- ensure runtime module is preserved even if it's not used but has side effects (#8213) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: update oxc to v0.113.0 (#8267) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.12.0 (#8272) by @renovate[bot]
- deps: update oxc apps (#8269) by @renovate[bot]
- deps: update test262 submodule for tests (#8261) by @sapphi-red
- deps: update crate-ci/typos action to v1.43.4 (#8260) by @renovate[bot]
- deps: update dependency esbuild to v0.27.3 (#8250) by @renovate[bot]
- deps: update rust crates (#8244) by @renovate[bot]
- deps: update dependency semver to v7.7.4 (#8247) by @renovate[bot]
- deps: update github-actions (#8243) by @renovate[bot]
- deps: update npm packages (#8245) by @renovate[bot]
- deps: update oxc resolver to v11.17.1 (#8240) by @renovate[bot]
- deps: update rust crate oxc_sourcemap to v6.0.2 (#8241) by @renovate[bot]
- rust: handle ignored `RUSTSEC-2025-0141` cargo check error (#8235) by @hyf0
- deps: update dependency oxlint-tsgolint to v0.11.5 (#8233) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.22.0 (#8232) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.3 (#8225) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.21.9 (#8224) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.2 (#8212) by @renovate[bot]
- remove rolldown_plugin_vite_wasm_helper (#8207) by @shulaoda
- build docs for production (#8206) by @sapphi-red

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Allows disabling comments in generated modules

3 participants