Repository navigation
Conversation
Add a Glob Imports section to the vpx script RFC. The loader expands each import.meta.glob call before the oxc-node transform, keeps every original line and column, and reports matched files and patterns to the watcher so vpx --watch restarts when matches change. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use tinyglobby for the map and picomatch for watch restarts, with the options of Vite's unbundled import-glob plugin. Expand oxc-node's output in place, put eager imports first, and restart only when a matching file is created or deleted, as Vite's hotUpdate does. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the glob expansion into a pass of oxc-node's Rust transform, with Vite's code shape and the source map from oxc's code generator. The binding records each expansion for the watcher, and its GlobMatcher tests new files with the code that listed the map. Vite+ forwards the new functions and turns the pass on in the vpx loader. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
oxc-node now matches glob imports with the globstar crate, as Rolldown's dev-mode matcher does, and rewrites the picomatch forms that globstar lacks: (a|b) groups, ranges of two characters, and POSIX classes. Dot names follow picomatch's rule, so that difference from Vite is gone. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record that oxc-node#937 implements the oxc-node part, and describe what it does now: the rewrite of picomatch forms, the walk that asks match_dir(), the shape of the watch entry, and the loop guard keyed on the file's state. Add the interface, the two Vite messages that were missing, real projects that use glob imports on the server, and the open question about /-rooted patterns. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow oxc-node#937: generated specifiers percent-encode URL characters while the keys keep the file names, eager import names avoid names that the source spells with a \u escape, and --exclude holds for the files that a glob report lists. Refs #3525 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watcher now enters the folders that GlobMatcher.mayEnter() allows,
so the dot-folder limit and its difference row are gone, and
globMatcher returns { matches, mayEnter }. oxc-node reads
OXC_IMPORT_GLOB in the binding for every entry point, with
setImportGlob() as an override.
Refs #3525
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3525
Note
This draft holds the design only. The implementation follows in this PR, after the oxc-node change lands and the pin moves.
vpx ./src/server.tsfails today when the script callsimport.meta.glob, because no layer of the script loader expands the call and Node.js has noimport.meta.glob:This PR adds a Glob Imports section to
rfcs/vpx-script-execution.mdand a short note torfcs/script-import-loader.md.Design
pirates, in-thread and off-thread ESM hooks) go through that transform. The generated code has Vite's shape (Object.assign({...})in place, eager imports first), and oxc's code generator makes the source map.vpxloader turns it on withsetImportGlob(true), so every script thatvpxorvite-plus/registerruns has glob imports. A file without a glob call keeps its cost.globstarcrate, which Rolldown's glob plugin uses for its dev-mode matcher, plus a walk with Vite's rules. Thepicomatchforms thatglobstarlacks are rewritten first:(a|b)groups, ranges of two characters, and POSIX classes. Dot names followpicomatch's rule,node_modulesis skipped unlessexhaustive, the importer is removed, and keys are sorted. The RFC lists the differences from Vite's unbundledtinyglobby/picomatchpath.!patterns,eager,import, relativebase,exhaustive,caseSensitive,Object.keys()andObject.values()./-rooted patterns, aliases,query/as, and non-literal option values fail with a code frame, becausevpxloads no Vite config.watch:globreport.vpx --watchrestarts when a matching file is created or deleted, as Vite'shotUpdatedoes. The watcher tests new files with the binding'sGlobMatcher, the code that listed the map. An edit restarts the script only when the script loaded the file.vpxand the project-localvpxbehave the same.🤖 Generated with Claude Code