Deno upstream tracking items #1810
thescientist13
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Overview
As part of adding Deno runtime support, a couple work arounds were needed
WebAssembly / Node Bindings
When a synchronous
registerHooks()load hook is present, Deno can attempt to compile Rollup’s native.nodebinding as JavaScript:Greenwood redirects
rollupto@rollup/wasm-nodeunder Deno as a workaround.Module.registerHooks({ load })makes CJSrequire()compile.nodenative addons as JavaScript denoland/deno#36240Had to document / setup installation of @rollup/wasm-node while we wait for this issue to be resolved - denoland/deno#36243. when this is resolved we can
CommonJS JSON imports receive an undefined format
For JSON loaded through
require(), Deno’s loader-hook context and the defaultnextLoad()result can both leaveformatundefined. The JSON source is then compiled as JavaScript instead of being handled by the JSON extension handler.Greenwood explicitly returns
format: "json"for CommonJS JSON loads.Tracking:
Module.registerHooksnever populatesformat, so hooks cannot tell CommonJS from ESM denoland/deno#36841(UNTRACKED) Preload modules do not propagate to
node:worker_threadsModules loaded using
--importor--preloadin the main process are not automatically evaluated in workers created throughnode:worker_threads. Greenwood publishes its registration module through worker environment data and explicitly imports it in route workers.(UNTRACKED) Bare CSS package imports are validated before Greenwood’s load hook
Deno can reject a bare package CSS import before Greenwood’s load hook has an opportunity to transform it:
Greenwood resolves bare specifiers early and marks URLs handled by its resource loader so CSS can be transformed before Deno’s validation.
Early
node:worker_threadsmessages can be droppedIf the parent posts a message before the worker attaches its
parentPortlistener, Deno can drop the message instead of queuing it. Greenwood starts its worker messaging protocol synchronously while loader initialization continues separately.All reactions