You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose the oxnode watch watcher as an entry an embedder can run with its own loader #871
Vite+ vendors oxc-node and runs scripts with vpx <script> through its own loader: a --require preload and an --import, built on the binding's createResolve and load. We would like vpx watch to run the watcher from #861 instead of writing another, by bundling packages/cli/src/watch. Two things stop that today.
runWatch(argv) hardcodes oxc-node's loader and name.
registerURL = import.meta.resolve("@oxc-node/core/register") is the child's loader (--enable-source-maps --import registerURL …) and the directory left out of the watch.
"oxnode watch" is in the errors, the usage line, and the help.
An options argument would cover it, for example runWatch(argv, { loaderArgs, ignoreDirs, name }), exported from an entry that does not start the oxnode CLI (such as @oxc-node/cli/watch), so a bundler can take the watcher alone.
The child's side lives in @oxc-node/core.register.mjs and esm.mjs call installSignalAck() for OXNODE_SIGNAL_ACK, and watchSink(), withFlush(), and enableWatchReport() for WATCH_REPORT_DEPENDENCIES. An embedder with its own hooks needs the same. watch-report.mjs imports takeWatchDependencies from @oxc-node/core's own binding, while an embedder forwards it from its binding. Either of these would let it reuse them:
Export signal-ack.mjs and watch-report.mjs as public entries that take the binding's functions as arguments.
Document the watch:import message and the ack socket as a stable protocol, so an embedder can implement its side.
With both, vpx watch and oxnode watch would share the watcher, and fixes to it would reach both.
Activity
docs(vpx): bring the RFC up to date