Skip to content

refactor: consolidate namespace call analysis into import analyzer#7657

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-25-perf_7636
Dec 30, 2025
Merged

refactor: consolidate namespace call analysis into import analyzer#7657
graphite-app[bot] merged 1 commit intomainfrom
12-25-perf_7636

Conversation

@IWANABETHATGUY
Copy link
Member

No description provided.

Copy link
Member Author


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 Dec 25, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit d35756b
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/694d39081c62340007fc67fc

@netlify
Copy link

netlify bot commented Dec 25, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 32581e1
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6953d6aefb547a00080609a0

@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-25-perf_7636 branch 2 times, most recently from 7ec8b11 to 34dfdd7 Compare December 26, 2025 14:14
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review December 26, 2025 14:14
Copilot AI review requested due to automatic review settings December 26, 2025 14:14
@IWANABETHATGUY IWANABETHATGUY changed the title perf: 7636 refactor: consolidate namespace call analysis into import analyzer Dec 26, 2025
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

This PR refactors the namespace call analysis by consolidating it into the import_analyzer.rs module, improving code organization and potentially performance. The main change moves the namespace call detection from dedicated visitor methods to inline checks within the existing import assignment checker.

Key changes:

  • Removed the standalone namespace_call_analyzer.rs module
  • Integrated namespace call checking into check_import_assign function in import_analyzer.rs
  • Changed detection approach to check parent AST nodes when visiting identifier references
  • Added test case for namespace as function argument (should not warn)

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rolldown/src/ast_scanner/namespace_call_analyzer.rs Removed - functionality moved to import_analyzer.rs
crates/rolldown/src/ast_scanner/import_analyzer.rs Added namespace call detection logic using parent node inspection and address comparison
crates/rolldown/src/ast_scanner/mod.rs Updated module declarations to reflect consolidation
crates/rolldown/src/ast_scanner/impl_visit.rs Removed dedicated visitor methods for call and tagged template expressions
crates/rolldown/tests/esbuild/default/call_import_namespace_warning/js.js Added test case for namespace used as function argument
crates/rolldown/tests/esbuild/default/call_import_namespace_warning/artifacts.snap Updated snapshot with refined diagnostic spans and new test output
crates/rolldown/tests/rolldown/warnings/cannot_call_namespace/artifacts.snap Updated snapshot with refined diagnostic spans
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap Updated hash due to code changes
Comments suppressed due to low confidence (1)

crates/rolldown/src/ast_scanner/import_analyzer.rs:48

  • Consider extracting the namespace call detection logic (lines 26-48) into a separate helper method for better code organization and maintainability. This would make the function's flow clearer and separate the two distinct concerns: namespace call detection and import assignment checking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 26, 2025

Benchmarks Rust

group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     63.0±1.33ms        ? ?/sec    1.01     63.5±1.98ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     69.6±1.48ms        ? ?/sec    1.03     71.7±2.40ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    107.3±3.72ms        ? ?/sec    1.00    107.6±3.29ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    118.9±1.93ms        ? ?/sec    1.00    118.4±4.55ms        ? ?/sec
bundle/bundle@threejs                                        1.00     39.2±0.83ms        ? ?/sec    1.02     40.1±2.00ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     42.8±0.71ms        ? ?/sec    1.02     43.6±0.97ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    394.3±6.13ms        ? ?/sec    1.00    395.6±5.73ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    455.2±4.61ms        ? ?/sec    1.01    461.5±6.27ms        ? ?/sec
scan/scan@rome_ts                                            1.00     86.0±2.04ms        ? ?/sec    1.00     85.8±1.38ms        ? ?/sec
scan/scan@threejs                                            1.00     29.6±1.55ms        ? ?/sec    1.00     29.6±1.67ms        ? ?/sec
scan/scan@threejs10x                                         1.00    297.8±5.07ms        ? ?/sec    1.00    298.4±4.86ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-25-perf_7636 branch 2 times, most recently from 78ec87d to 1c16e42 Compare December 30, 2025 07:58
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 30, 2025

Merge activity

Copilot AI review requested due to automatic review settings December 30, 2025 13:42
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 32581e1 into main Dec 30, 2025
33 checks passed
@graphite-app graphite-app bot deleted the 12-25-perf_7636 branch December 30, 2025 13:52
This was referenced Dec 31, 2025
shulaoda added a commit that referenced this pull request Dec 31, 2025
## [1.0.0-beta.58] - 2025-12-31

### 💥 BREAKING CHANGES

- experimental/devtools: rename InputOptions#debug to InputOptions#devtools (#7686) by @Copilot

### 🚀 Features

- implement target feature check in `should_transform_js` for raw options (#7697) by @shulaoda
- support `output.dynamicImportInCjs` option (#7677) by @shulaoda
- types: expose `ChecksOptions` type (#7653) by @sapphi-red

### 🐛 Bug Fixes

- export runtime helpers for cross-chunk access (#7658) by @shulaoda
- cjs namespace merging regression (#7665) by @IWANABETHATGUY
- replace panic with proper error handling for hash placeholder generation (#7661) by @shulaoda
- remove the blank line between shebang and postBanner (#7643) by @btea
- rolldown_plugin_vite_reporter: apply padding before ANSI coloring for proper size column alignment (#7649) by @shulaoda

### 🚜 Refactor

- rust: use `StableModuleId` as the map key if possible (#7718) by @hyf0
- rust: return `StableModuleId` instead of `&str` from `Module#stable_id()` (#7717) by @hyf0
- rust: return correct stable id of external module from `Module#stable_id()` (#7716) by @hyf0
- rust: introduce `StableModuleId` type (#7715) by @hyf0
- rust: reduce unnecessary `id.as_arc_str().clone().into()` (#7714) by @hyf0
- rust: remove `ModuleId#resource_id` and use `as_arc_str` directly (#7710) by @hyf0
- rust: remove unused `Module#id_clone` (#7709) by @hyf0
- rust: remove `Module#id_as_str` and use `Module#id` directly (#7708) by @hyf0
- consolidate namespace call analysis into import analyzer (#7657) by @IWANABETHATGUY
- rust: make `ExternalModule#id` have the type `ModuleId` (#7707) by @hyf0
- rust: rename `Module#id` to `Module#id_as_str` (#7706) by @hyf0
- rust: use `ModuleId` instead of raw `ArcStr` for `ScanStageCache` (#7701) by @hyf0
- simplify error propagation in cache merge (#7702) by @shulaoda
- use `ModuleId` as the type of `ResolvedId#id` (#7694) by @hyf0
- types: rename `resolved_request_info.rs` to `resolved_id.rs` and move its contents (#7687) by @hyf0
- devtools: emit data to `<CWD>/node_modules/.rolldown` (#7692) by @hyf0
- use `InvalidOption` for hash placeholder generation errors (#7674) by @shulaoda
- rolldown_error: remove dependency on rolldown_utils (#7672) by @shulaoda
- use nodejs-built-in-modules v1.0.0 directly in callsites (#7667) by @Boshen

### 📚 Documentation

- migrate input options content from options to auto gen docs (#7663) by @mdong1909
- create reference index page (#7659) by @mdong1909
- tweak auto-generated reference output (#7654) by @sapphi-red
- initialize auto-gen docs (#7252) by @mdong1909

### ⚙️ Miscellaneous Tasks

- deps: update napi (#7705) by @renovate[bot]
- pin Node.js version to 24.12.0 LTS in .node-version file (#7713) by @Copilot
- update esbuild test reasons (#7703) by @sapphi-red
- deps: update crate-ci/typos action to v1.40.1 (#7696) by @renovate[bot]
- deps: update oxc to v0.106.0 (#7512) by @renovate[bot]
- js: replace dprint with oxfmt (#7214) by @Boshen
- deps: update dependency oxlint to v1.36.0 (#7691) by @renovate[bot]
- deps: update github-actions (#7679) by @renovate[bot]
- deps: update npm packages (#7680) by @renovate[bot]
- deps: update rust crates (#7678) by @renovate[bot]
- deps: update oxc resolver to v11.16.2 (#7668) by @renovate[bot]
- add API reference files to knip entry points (#7669) by @Copilot
- deps: update notify (#7651) by @sapphi-red
- add `homepage` field to package.json (#7648) by @trivikr
- deps: update oxc resolver to v11.16.1 (#7647) by @renovate[bot]
- deps: update rolldown-plugin-dts to 0.20.0 (#7645) by @shulaoda

Co-authored-by: shulaoda <[email protected]>
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.

2 participants

Comments