Skip to content

Comments

feat: support ImporterId hook filter#7540

Merged
IWANABETHATGUY merged 1 commit intomainfrom
12-17-feat_support_importerid_hook_filter
Dec 18, 2025
Merged

feat: support ImporterId hook filter#7540
IWANABETHATGUY merged 1 commit intomainfrom
12-17-feat_support_importerid_hook_filter

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Dec 17, 2025

closed #7529

Completing composable hook filter of ImporterId

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite: merge 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 17, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 716e69e
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69423a0a1d2eea000845eb42
😎 Deploy Preview https://deploy-preview-7540--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.

@netlify
Copy link

netlify bot commented Dec 17, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit f052fb8
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/694389ca18d0d300081c0e89
😎 Deploy Preview https://deploy-preview-7540--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 force-pushed the 12-17-feat_support_importerid_hook_filter branch from 96ba1fb to 18091b6 Compare December 17, 2025 05:07
@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

Benchmarks Rust

  • target: main(a9747f0)
  • pr: 12-17-feat_support_importerid_hook_filter(f052fb8)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     70.5±2.25ms        ? ?/sec    1.00     70.5±3.93ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     77.2±2.00ms        ? ?/sec    1.00     77.2±1.92ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    111.2±3.07ms        ? ?/sec    1.01    112.6±1.92ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    122.5±1.72ms        ? ?/sec    1.02    125.1±1.56ms        ? ?/sec
bundle/bundle@threejs                                        1.01     42.0±2.16ms        ? ?/sec    1.00     41.6±1.25ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     45.1±0.68ms        ? ?/sec    1.01     45.4±0.62ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    412.2±5.25ms        ? ?/sec    1.00    414.0±4.83ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    474.3±5.89ms        ? ?/sec    1.01    477.0±5.43ms        ? ?/sec
scan/scan@rome_ts                                            1.00     87.2±1.59ms        ? ?/sec    1.04     91.0±1.80ms        ? ?/sec
scan/scan@threejs                                            1.00     29.8±1.71ms        ? ?/sec    1.03     30.7±1.68ms        ? ?/sec
scan/scan@threejs10x                                         1.00    304.4±5.02ms        ? ?/sec    1.03    313.8±5.68ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-17-feat_support_importerid_hook_filter branch 5 times, most recently from 3bed6d2 to 997c675 Compare December 17, 2025 09:23
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review December 17, 2025 09:25
Copilot AI review requested due to automatic review settings December 17, 2025 09:25
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 adds support for an importerId hook filter that allows plugins to filter resolveId hook calls based on the importing module's ID. This enables plugins to selectively handle resolution based on which module is performing the import, rather than just what is being imported.

Key changes:

  • Adds ImporterId filter expression type to both TypeScript and Rust filter systems
  • Implements validation to restrict importerId filter usage to only the resolveId hook
  • Entry files (where importer is None) naturally don't match importerId filters

Reviewed changes

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

Show a summary per file
File Description
packages/pluginutils/src/composable-filters.ts Adds ImporterId class and integrates it into filter expression types and interpreter logic
packages/pluginutils/src/composable-filters.test.ts Adds comprehensive test coverage for importerId filter with various patterns and edge cases
packages/rolldown/src/plugin/bindingify-hook-filter.ts Implements importerId token binding and validation to prevent misuse in non-resolveId hooks
packages/rolldown/src/binding.d.cts Adds ImporterId to the FilterTokenKind union type
packages/rolldown/tests/fixtures/plugin/resolve-id/filter-importer-id/* Adds integration test showing importerId filter correctly filters imports from main.js
packages/rolldown/tests/fixtures/plugin/load/filter-importer-id-error/* Adds test verifying error is thrown when importerId is used with load hook
crates/rolldown_utils/src/filter_expression.rs Adds ImporterId variant to FilterExpr enum and implements interpreter logic that returns false for None importers
crates/rolldown_binding/src/options/plugin/types/binding_filter_expression.rs Adds ImporterId token handling in the binding layer
crates/rolldown_binding/src/options/plugin/js_plugin.rs Threads importer parameter through filter_exprs_interpreter calls in resolveId hook, passes None for other hooks

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

Copilot AI review requested due to automatic review settings December 17, 2025 09:31
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 14 out of 14 changed files in this pull request and generated 1 comment.


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

Copilot AI review requested due to automatic review settings December 17, 2025 09:38
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 14 out of 14 changed files in this pull request and generated no new comments.


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

@sapphi-red
Copy link
Member

sapphi-red commented Dec 18, 2025

@IWANABETHATGUY Would you update the PR description?

@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-17-feat_support_importerid_hook_filter branch from 445b4d9 to f79bc82 Compare December 18, 2025 04:26
Copilot AI review requested due to automatic review settings December 18, 2025 04:37
@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-17-feat_support_importerid_hook_filter branch from f79bc82 to 6728a41 Compare December 18, 2025 04:37
@IWANABETHATGUY
Copy link
Member Author

@IWANABETHATGUY Would you update the PR description?

Updated

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 14 out of 14 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

packages/rolldown/tests/fixtures/plugin/resolve-id/filter-importer-id/_config.ts:6

  • Unused variable calledArgs.
let calledArgs = [];

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

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 18, 2025

Merge activity

  • Dec 18, 4:57 AM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Dec 18, 5:09 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'node-test (ubuntu-latest) / Node Test', 'node-test (macos-latest) / Node Test', 'node-test (windows-latest) / Node Test').

closed #7529

Completing composable hook filter of `ImporterId`
@graphite-app graphite-app bot force-pushed the 12-17-feat_support_importerid_hook_filter branch from 6728a41 to f052fb8 Compare December 18, 2025 04:57
@IWANABETHATGUY IWANABETHATGUY merged commit 663ce80 into main Dec 18, 2025
25 of 28 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 12-17-feat_support_importerid_hook_filter branch December 18, 2025 05:57
shulaoda added a commit that referenced this pull request Dec 22, 2025
## [1.0.0-beta.56] - 2025-12-22

### 💥 BREAKING CHANGES

- rename `MIXED_EXPORT` error to `MIXED_EXPORTS` (#7565) by @sapphi-red

### 🚀 Features

- rename `id` property to `exporter` in CIRCULAR_REEXPORT error (#7592) by @sapphi-red
- add `ids` property to `CIRCULAR_DEPENDENCY` error (#7591) by @sapphi-red
- node/dev: expose `devMode.lazy` (#7549) by @hyf0
- set log and pos properties for `parseAst` function errors (#7568) by @sapphi-red
- set log and pos properties for logs (#7567) by @sapphi-red
- test-dev-sever: support to manually configure port, run tests in concurrent (#7576) by @hyf0
- add `exporter` property to `MISSING_EXPORT` error (#7564) by @sapphi-red
- add `id` property to `PARSE_ERROR` error (#7563) by @sapphi-red
- support ImporterId hook filter (#7540) by @IWANABETHATGUY

### 🐛 Bug Fixes

- types: better "go to definition" experience for interface `OutputPlugin` (#7610) by @KazariEX
- `postBanner` content should be placed after shebang (#7583) by @btea
- use sanitized filename for preserve modules chunk name (#7603) by @IWANABETHATGUY
- correct filter out unused cjs namespace  (#7602) by @IWANABETHATGUY
- watch: property respect `notify.pollInternal` and `notify.compareContents` (#7595) by @sapphi-red
- make `cleanDir` work with default output directory (#7579) by @shulaoda
- merge `MISSING_NAME_OPTION_FOR_UMD_EXPORT` error to `MISSING_NAME_OPTION_FOR_IIFE_EXPORT` error (#7566) by @sapphi-red
- dev/hmr: ensure cjs modules with no exports reference correct `module` identifier (#7544) by @leegeunhyeok

### 🚜 Refactor

- remove `stable_id` field from `PARSE_ERROR` error (#7593) by @sapphi-red
- make include_runtime_symbol reuseable after linking stage (#7580) by @IWANABETHATGUY
- rust/dev: construct the bundler within itself (#7553) by @hyf0
- rust/watcher: polish API of `Watcher` struct (#7551) by @hyf0
- use `LinkingMetadata::stmt_info_included` to check if a stmt_info is included (#7572) by @IWANABETHATGUY
- use `LinkingMetadata::is_included` to check if a module is included (#7571) by @IWANABETHATGUY
- store module and stmt_info is included info to module meta (#7570) by @IWANABETHATGUY
- make include_* method reunsable after linking stage (#7552) by @IWANABETHATGUY
- rust/watcher: construct the bundler within watcher itself (#7550) by @hyf0
- extract make include_runtime_symbol reusable (#7546) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- renovate: add `kill-port` in `ignoreDeps` in renovate.json (#7619) by @sapphi-red
- deps: update rust crates (#7617) by @renovate[bot]
- deps: update npm packages (#7616) by @renovate[bot]
- deps: update github-actions (#7615) by @renovate[bot]
- ci: skip benchmark workflows on draft PRs (#7611) by @Copilot
- deps: update dependency rolldown-plugin-dts to ^0.19.0 (#7607) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.10.0 (#7601) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.18.4 (#7599) by @renovate[bot]
- deps: update notify (#7594) by @sapphi-red
- test-dev-server: add retry mechanism to hmr-full-bundle-mode tests (#7588) by @Copilot
- deps: update napi to v3.7.1 (#7590) by @renovate[bot]
- add JSDoc documentation for memfs type (#7587) by @Copilot
- deps: update dependency oxlint to v1.34.0 (#7589) by @renovate[bot]
- move some tests in ignored-by-unsupported-features that are passing (#7569) by @sapphi-red
- deps: update dependency oxlint-tsgolint to v0.9.2 (#7582) by @renovate[bot]
- deps: update oxc resolver to v11.16.0 (#7574) by @renovate[bot]
- test/dev-server: don't run `pnpm install` during tests (#7560) by @hyf0
- test/dev-server: use `kill-port@1` to improve performance (#7575) by @hyf0
- normalize error object to make some Rollup tests pass (#7562) by @sapphi-red
- ci: separate dev-server(hmr) tests and normal tests (#7558) by @hyf0
- ci: make native rolldown build reusable (#7557) by @hyf0
- resolve some TODOs (#7561) by @sapphi-red

### ❤️ New Contributors

* @KazariEX made their first contribution in [#7610](#7610)
* @leegeunhyeok made their first contribution in [#7544](#7544)

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.

Support plugin hook filters based on importer

2 participants