Skip to content

refactor(rust): rename comments to legal_comments#4442

Merged
hyf0 merged 1 commit intomainfrom
05-08-refactor_rust_rename_comments_to_legal_comments_
May 8, 2025
Merged

refactor(rust): rename comments to legal_comments#4442
hyf0 merged 1 commit intomainfrom
05-08-refactor_rust_rename_comments_to_legal_comments_

Conversation

@hyf0
Copy link
Copy Markdown
Member

@hyf0 hyf0 commented May 8, 2025

Description

This is the start of porting the same functionality legalComments from esbuild.

@hyf0 hyf0 marked this pull request as ready for review May 8, 2025 08:07
Copilot AI review requested due to automatic review settings May 8, 2025 08:07
Copy link
Copy Markdown
Member Author

hyf0 commented May 8, 2025

@netlify
Copy link
Copy Markdown

netlify bot commented May 8, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 00ed588
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/681c6bf36b3e99000804afdc

Copy link
Copy Markdown
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

This PR refactors the codebase to rename the "comments" option to "legal_comments" throughout the JSON schema, Rust modules, and test configurations.

  • Updated JSON schema definitions and enum references from "comments" to "legalComments".
  • Modified Rust modules and normalization functions to use the LegalComments enum instead of Comments.
  • Adjusted test snapshots and configuration files to reflect the name change.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rolldown_testing/_config.schema.json Renamed JSON property "comments" to "legalComments" and updated its definition.
crates/rolldown_common/src/module/normal_module.rs Updated match expressions to use LegalComments variants while retaining variable names.
crates/rolldown_common/src/lib.rs Changed import from Comments to LegalComments.
crates/rolldown_common/src/inner_bundler_options/types/normalized_bundler_options.rs Updated the type from Comments to LegalComments (field name remains unchanged).
crates/rolldown_common/src/inner_bundler_options/types/comments.rs Renamed the enum from Comments to LegalComments and updated its Display impl.
crates/rolldown_common/src/inner_bundler_options/mod.rs Updated BundlerOptions to use legal_comments instead of comments.
crates/rolldown_binding/src/utils/normalize_binding_options.rs Renamed the option field to legal_comments and updated the mapping for LegalComments.
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap Adjusted test snapshot keys from comments to legalComments.
Relevant test config files Updated configuration keys from "comments" to "legalComments".
crates/rolldown/src/utils/normalize_options.rs Modified normalization to extract legal_comments instead of comments.
Comments suppressed due to low confidence (2)

crates/rolldown_common/src/module/normal_module.rs:222

  • [nitpick] The local variable name 'comments' may be misleading now that the enum is LegalComments; consider renaming it to 'legal_comments' for clarity and consistency.
let comments = match options.comments {

crates/rolldown_common/src/inner_bundler_options/types/normalized_bundler_options.rs:88

  • [nitpick] For consistency with the renamed raw option (legal_comments), consider renaming this field to 'legal_comments' in the NormalizedBundlerOptions struct.
pub comments: LegalComments,

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 8, 2025

Benchmarks Rust

  • target: main(7e5b6d5)
  • pr: 05-08-refactor_rust_rename_comments_to_legal_comments_(00ed588)
group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.11     83.5±3.55ms        ? ?/sec    1.00     75.1±0.81ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.02     98.9±1.51ms        ? ?/sec    1.00     96.5±0.86ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.01    111.8±1.02ms        ? ?/sec    1.00    111.0±1.30ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.04     88.6±4.47ms        ? ?/sec    1.00     85.4±1.35ms        ? ?/sec
bundle/bundle@rome-ts                                               1.05    125.3±4.38ms        ? ?/sec    1.00    119.0±1.04ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.10   211.8±11.84ms        ? ?/sec    1.00    192.2±1.80ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.05   239.6±10.48ms        ? ?/sec    1.00    227.2±3.45ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.06    140.1±3.43ms        ? ?/sec    1.00    132.3±1.26ms        ? ?/sec
bundle/bundle@threejs                                               1.02     41.8±1.29ms        ? ?/sec    1.00     40.9±2.11ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.02     84.9±3.42ms        ? ?/sec    1.00     83.4±0.40ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.08    106.3±6.87ms        ? ?/sec    1.00     98.6±0.97ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.04     49.3±1.56ms        ? ?/sec    1.00     47.4±0.38ms        ? ?/sec
bundle/bundle@threejs10x                                            1.03    438.3±9.29ms        ? ?/sec    1.00    425.4±1.89ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.01  1075.1±14.19ms        ? ?/sec    1.00   1068.4±7.31ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.01  1262.6±14.48ms        ? ?/sec    1.00   1245.8±6.68ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.01    505.2±7.53ms        ? ?/sec    1.00    501.9±6.41ms        ? ?/sec
remapping/remapping                                                 1.00     26.1±1.35ms        ? ?/sec    1.01     26.5±0.74ms        ? ?/sec
remapping/render-chunk-remapping                                    1.00     64.2±1.44ms        ? ?/sec    1.00     64.2±0.45ms        ? ?/sec
scan/scan@rome-ts                                                   1.00     97.1±1.64ms        ? ?/sec    1.02     99.0±1.91ms        ? ?/sec
scan/scan@threejs                                                   1.00     31.3±1.17ms        ? ?/sec    1.01     31.7±0.48ms        ? ?/sec
scan/scan@threejs10x                                                1.00    321.2±3.03ms        ? ?/sec    1.01    324.0±4.50ms        ? ?/sec

@hyf0 hyf0 force-pushed the 05-08-refactor_rust_rename_comments_to_legal_comments_ branch from 410e5fa to 3e70b4b Compare May 8, 2025 08:28
@hyf0 hyf0 force-pushed the 05-08-refactor_rust_rename_comments_to_legal_comments_ branch from 7543ca3 to 3e70b4b Compare May 8, 2025 08:30
@hyf0 hyf0 force-pushed the 05-08-refactor_rust_rename_comments_to_legal_comments_ branch from 3e70b4b to 00ed588 Compare May 8, 2025 08:31
@hyf0 hyf0 requested a review from shulaoda May 8, 2025 10:03
@hyf0 hyf0 added this pull request to the merge queue May 8, 2025
Merged via the queue into main with commit dedce11 May 8, 2025
29 checks passed
@hyf0 hyf0 deleted the 05-08-refactor_rust_rename_comments_to_legal_comments_ branch May 8, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants