Skip to content

feat(codegen)!: introduce CommentOptions#12114

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-07-feat_codegen_introduce_commentoptions_
Jul 7, 2025
Merged

feat(codegen)!: introduce CommentOptions#12114
graphite-app[bot] merged 1 commit intomainfrom
07-07-feat_codegen_introduce_commentoptions_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jul 7, 2025

Control printing of comments more precisely via more options:

The logic change here is that jsdoc is no longer part of annotation
comments.

pub struct CommentOptions {
    /// Print normal comments that do not have special meanings.
    ///
    /// At present only statement level comments are printed.
    ///
    /// Default is `true`.
    pub normal: bool,

    /// Print jsdoc comments.
    ///
    /// * jsdoc: `/** jsdoc */`
    ///
    /// Default is `true`.
    pub jsdoc: bool,

    /// Print annotation comments.
    ///
    /// * pure: `/* #__PURE__ */` and `/* #__NO_SIDE_EFFECTS__ */`
    /// * webpack: `/* webpackChunkName */`
    /// * vite: `/* @vite-ignore */`
    /// * coverage: `v8 ignore`, `c8 ignore`, `node:coverage`, `istanbul ignore`
    ///
    /// Default is `true`.
    pub annotation: bool,

    /// Print legal comments.
    ///
    /// * starts with `//!` or `/*!`.
    /// * contains `/* @license */` or `/* @preserve */`
    ///
    /// Default is [LegalComment::Inline].
    pub legal: LegalComment,
}

closes #12030
related rolldown/tsdown#357

@github-actions github-actions bot added A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations C-enhancement Category - New feature or request labels Jul 7, 2025
Copy link
Member Author

Boshen commented Jul 7, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 7, 2025

CodSpeed Instrumentation Performance Report

Merging #12114 will degrade performances by 3.15%

Comparing 07-07-feat_codegen_introduce_commentoptions_ (8b30a5b) with main (9736a7f)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[RadixUIAdoptionSection.jsx] 14.4 µs 14.8 µs -3.15%

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jul 7, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 7, 2025

Merge activity

Control printing of comments more precisely via more options:

The logic change here is that jsdoc is no longer part of annotation
comments.

```rust
pub struct CommentOptions {
    /// Print normal comments that do not have special meanings.
    ///
    /// At present only statement level comments are printed.
    ///
    /// Default is `true`.
    pub normal: bool,

    /// Print jsdoc comments.
    ///
    /// * jsdoc: `/** jsdoc */`
    ///
    /// Default is `true`.
    pub jsdoc: bool,

    /// Print annotation comments.
    ///
    /// * pure: `/* #__PURE__ */` and `/* #__NO_SIDE_EFFECTS__ */`
    /// * webpack: `/* webpackChunkName */`
    /// * vite: `/* @vite-ignore */`
    /// * coverage: `v8 ignore`, `c8 ignore`, `node:coverage`, `istanbul ignore`
    ///
    /// Default is `true`.
    pub annotation: bool,

    /// Print legal comments.
    ///
    /// * starts with `//!` or `/*!`.
    /// * contains `/* @license */` or `/* @preserve */`
    ///
    /// Default is [LegalComment::Inline].
    pub legal: LegalComment,
}
```

closes #12030
related rolldown/tsdown#357
@graphite-app graphite-app bot force-pushed the 07-07-feat_codegen_introduce_commentoptions_ branch from 50e4b00 to 8b30a5b Compare July 7, 2025 08:58
@graphite-app graphite-app bot merged commit 8b30a5b into main Jul 7, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-07-feat_codegen_introduce_commentoptions_ branch July 7, 2025 09:05
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegen: precise control of printing comments

1 participant