SIGN IN SIGN UP
denoland / deno UNCLAIMED

A modern runtime for JavaScript and TypeScript.

0 0 2 Rust

feat(ext/node): ESM import() support for module.registerHooks() (#33763)

Extends `module.registerHooks()` to intercept ESM `import()` calls,
not just CJS `require()`. This builds on #32432 (async module resolve)
and complements #33733 (CJS-only registerHooks).

- New `LoaderHookRegistry` + 5 ops connect the Rust
  `CliModuleLoader` to JS hook chains via async oneshot channels
- `CliModuleLoader::resolve()` returns
  `ModuleResolveResponse::Async` when hooks are active, delegating
  to JS; fallthrough to `inner_resolve()` when hooks don't intercept
- `CliModuleLoader::load()` delegates to JS hooks before default
  loading; hook-provided source is returned as `ModuleSource`
- `prepare_load` skipped when hooks active so virtual (non-disk)
  modules work
- Hook chaining in LIFO order, `nextResolve`/`nextLoad` for
  passthrough, `shortCircuit` validation

Towards #31045, #31665, #29350, #23201
B
Bartek Iwańczuk committed
d340bbcda0da05022fedd5f50a9df955bbc44ace
Parent: c2366ea
Committed by GitHub <noreply@github.com> on 5/5/2026, 8:07:09 AM