deno
becbb4c3 - feat(bundle): JS plugin API for Deno.bundle() (resolve/load/transform)

Commit
56 days ago
feat(bundle): JS plugin API for Deno.bundle() (resolve/load/transform) Adds an esbuild-style plugin API to the unstable Deno.bundle() runtime API. Plugins register onResolve/onLoad/onTransform callbacks with a RegExp filter; they run before Deno's own resolution and loading, so they can resolve virtual modules, load non-JS assets, and rewrite source. This targets common agent workflows, not full Vite/esbuild plugin parity. Mechanism: the bundler runs on its own thread and forwards each hook over an mpsc channel; the JS runtime pumps requests (op_bundle_plugin_next), runs the user's plugin chain, and answers (op_bundle_plugin_respond). Plugin hook errors are recorded and surface as structured result.errors with the real message instead of rolldown's generic wrapper. Also makes Deno.bundle() return hard bundler errors as a structured { success: false, errors } result rather than throwing, and applies the require-shim rewrite on the in-memory (write:false) path. Claude-Session: https://claude.ai/code/session_01QXBexiVeaPBqGPgAxcTLNQ
Author
Parents
Loading