Repository navigation
feat(rolldown_plugin_vite_import_glob): follow file creation and deletion via hotUpdate - #10550
Conversation
c8e34c4 to
34e3e53
Compare
c27791c to
3e4542c
Compare
aa1cf94 to
927d441
Compare
28f7168 to
30dc48c
Compare
30dc48c to
b0a23fc
Compare
b0a23fc to
142fee5
Compare
4a795d2 to
b1f932f
Compare
b1f932f to
7497d3e
Compare
7497d3e to
94cd3a2
Compare
94cd3a2 to
43a3be7
Compare
0a3d418 to
fb8971b
Compare
It works the same way as Vite's implementation. The only difference is that ours needs to call |
3c645e2 to
c4abb66
Compare
Isn't that for "hotUpdates"? I'm talking about the "rebuilds" (the one corresponding to reloads in unbundled mode). |
Merging this PR will not alter performance
Comparing Footnotes
|
If you're asking whether the When |
Wouldn't that cause many false-positives for a glob like |
Oh, you're right. I took a closer look, and it turns out I'm calling And that association isn't actually needed here: all we need is for file changes in the We just need to do what Vite's import glob plugin does: store a |
|
I'll merge it first and fix any issues that come up afterward. |
That said, it can also lead to some unnecessary file events being propagated, which is essentially the same problem we have with watching the root. At this point, I'm starting to think that watching the root might actually be the better option. |
c4abb66 to
c0985f3
Compare
…tion via hotUpdate Add the modules whose glob result changes to the affected set: - for a created file, if the walk would match it and it is not part of the result yet - for a deleted path, if it is a file of the result or a directory above one The hook is off by default (`dev.hotUpdate`), so this takes effect once the option is on.
…h globstar like vite Build one matcher per glob call from its absolute globs, the way vite does with picomatch, and ask it for every created or deleted file. The result of the last walk is no longer kept.
c0985f3 to
5cc9db6
Compare
## [1.2.13] - 2026-10-07 ### 🚀 Features - rolldown_plugin_vite_import_glob: follow file creation and deletion via hotUpdate (#10550) by @shulaoda - inline-common-chunks: deduplicate shared code along known loading paths (#11093) by @hyfdev - rolldown_plugin_vite_import_glob: record a matcher per glob call in dev (#10592) by @shulaoda - rolldown_plugin_vite_import_glob: watch the directory each glob reads (#10549) by @shulaoda - watch: hand watch.exclude to notify as its ignore filter (#11008) by @shulaoda - dev: add `experimental.devMode.hotUpdate` option (#11123) by @h-a-n-a ### 🐛 Bug Fixes - renamer: check the printed name of namespace-alias imports for captures (#11129) by @IWANABETHATGUY - devtools: honor `devtools.sessionId` by @Brooooooklyn - renamer: keep a renamed nested binding off its module's top-level bindings (#11128) by @IWANABETHATGUY - dev: keep `this` undefined when calling an imported function in HMR patches and lazy chunks (#11126) by @h-a-n-a - dev: read string-named imports correctly in HMR patches and lazy chunks (#11127) by @h-a-n-a - sanitize preserveModules chunk names after resolving the relative path (#11087) by @waltuov - keep the `with` clause on bare external imports (#11100) by @IWANABETHATGUY - generator: filter DISABLE_JS_HOOK bits from generated HookUsage (#10346) by @Brooooooklyn - dev: make the module factory async for top-level await (#11118) by @h-a-n-a - node: give each renderChunk call its own meta object (#11115) by @Brooooooklyn - honor `externalLiveBindings` for imported exports (#11048) by @camc314 - dev: keep a late payload from replacing newer module code (#11030) by @h-a-n-a - binding: use-after-free in async `transform` with a `TsconfigCache` (#11080) by @shulaoda - fail on chunk syntax errors and escape export names once (#11051) by @hyfdev - dev: ship newly imported modules the client never received (#11029) by @h-a-n-a - code-splitting: avoid cycles from redundant re-export initialization (#11073) by @hyfdev - link: treat re-exports of the same external binding as one export (#11069) by @IWANABETHATGUY - escape namespace properties in IIFE and UMD output (#11085) by @hyfdev - escape dependency paths in CJS and UMD output (#11084) by @hyfdev - use computed access for arbitrary import names (#11083) by @hyfdev - generate valid bindings for shimmed exports (#11082) by @hyfdev - dev: reload the page when an HMR update fails after merging its edit (#11031) by @h-a-n-a - dev/lazy: ship the deps of a module that a patch shipped but never ran (#11028) by @h-a-n-a - code-splitting: don't move init calls in front of unwrapped JSON modules (#11062) by @IWANABETHATGUY - escape export names in `defineProperty` calls (#11047) by @camc314 ### 📚 Documentation - say the CLI bundles multiple configs one after another (#11111) by @Brooooooklyn - add `renderChunk` hook filter docs (#11065) by @sapphi-red ### ⚡ Performance - use `concat_string!` instead of `format!` for plain string joins (#11139) by @IWANABETHATGUY - utils: evaluate each `concat_string!` argument once (#11105) by @IWANABETHATGUY - json: escape `JSON.parse` string with `json-escape-simd` (#11104) by @IWANABETHATGUY - unwrap JSON modules with a non-object root (#11066) by @IWANABETHATGUY ### 🧪 Testing - inline-common-chunks: fix flaky inlineCommonChunks concurrent imports (#11088) by @hyfdev ### ⚙️ Miscellaneous Tasks - deps: upgrade oxc to 0.153.0 (#11109) by @camc314 - update pnpm to v12 (#10876) by @btea - deps: update pnpm to v11.28.0 (#11049) by @renovate[bot] - deps: update rollup submodule for tests to v4.64.0 (#11116) by @rolldown-guard[bot] - deps: update napi (#11137) by @renovate[bot] - scripts: spawn the rolldown CLI without a shell in setup-vite (#10875) by @Brooooooklyn - deps: bump `@napi-rs/wasm-runtime` to `~1.2.5` (#11117) by @shulaoda - deps: update napi (#11108) by @renovate[bot] - deps: update taiki-e/install-action action to v2.87.22 (#11096) by @renovate[bot] - deps: update npm packages (#11095) by @renovate[bot] - deps: update rust crates (#11097) by @renovate[bot] - deps: update napi (#11063) by @renovate[bot] - deps: update dependency rust to v1.99.0 (#11071) by @renovate[bot] - deps: update dependency vite-plus to v1 (#11056) by @renovate[bot] Co-authored-by: shulaoda <[email protected]>
I thought incremental build won't run the rebuild unless the relationship is setup by |
I don't see your point 🤔 What I'm pointing out is unnecessary rebuilds in |
|
I found that when incremental build is enabled, it doesn't trigger rebuilds, but it seems to produce extra modules. The changed files are treated as new modules and added to the module graph. 😅 |
…reation and deletion (#10551) Part of #10059 ## Problem Nothing covers end to end that a glob follows files appearing and disappearing. ## What this PR does Adds the `hmr-import-glob` playground. It covers a new file, a deleted file, a file that does not match, a new nested directory, and a glob root that is missing at boot, with and without its parent. The playground configures no plugin. Vite installs the native one for the bundled environment, so the test goes through the real Vite path. ## Note The `hotUpdate` hook is off by default, so the playground turns it on with `experimental.devMode.hotUpdate`. It passes locally on macOS. There is no case for a directory that is moved away. The hook of #10550 does not follow it. Co-authored-by: Hana <[email protected]>
Part of #10059 ## Problem The matcher and the hook of #10550 are only covered end to end, by the playground of #10551. It cannot reach cases like `exhaustive`, case folding, or a path with glob syntax in it. ## What this PR does - Adds unit tests for the matcher: single level and `**` patterns, several patterns, negated patterns, dot entries and `node_modules`, `exhaustive`, case folding, a glob that does not compile, and the escaping of the literal part of a path. - Adds unit tests for the hook: the order of the modules it adds, and what it declines. - Removes `test = false` from the crate, so the tests run. - Adds `futures` as a dev dependency, to call the async hook.
Part of #10059
Problem
Vite's JS plugin keeps the result of a glob fresh from a
hotUpdatehook. Under bundled dev the native plugin replaces it, and the native plugin only implementedtransform.#10549 makes the file events arrive, but nothing maps them to the module that owns the glob.
What this PR does
Implements
hotUpdatein the native plugin, the way Vite's plugin does it.import.meta.globcall gets one matcher in dev mode. It is built with globstar from the absolute globs of the call, with the options Vite passes to picomatch.dotfollowsexhaustive, case folding followscaseSensitive, and**/node_modules/**is excluded unlessexhaustiveis set.globSafeResolvedPath.The walk in
transformis not changed. It still matches withfast_glob.Note
The
hotUpdatehook is off by default (dev.hotUpdate, #10837), and Vite does not pass the option yet (vitejs/vite#22956). This PR takes effect once the option is on.The hook is as simple as Vite's, so it inherits what the watcher and the engine do differently from Vite: