deno
10fc2c7e - fix(ext/node): propagate nextLoad(newUrl) redirect to default loader (#35027)

Commit
164 days ago
fix(ext/node): propagate nextLoad(newUrl) redirect to default loader (#35027) When a `module.registerHooks()` load hook calls `nextLoad(newUrl)` with a URL different from the one passed in, the chain fell through to Rust's default loader using the original URL, producing "Unsupported scheme" or "Loading unprepared module" errors. This tracks the URL the hook chain ultimately delegated to, sends it back through `op_module_hooks_respond_load`, and has the Rust default loader fetch source from that URL while keeping the original specifier as the module's identity in the graph. The redirect target is also prepared on demand so it is present in the graph. The same propagation is applied to the compiled-binary loader used by `deno compile`. Adds a spec test covering the redirect: a load hook delegates source loading for one module to a different real file via `nextLoad(newUrl)` and falls through, asserting the loaded source comes from the redirect target while the module keeps its original specifier as its identity. Part of the #34390 split.
Author
Parents
Loading