Description
Follow-up for #3328
wasm import currently does double compilation: the first compilation happens here:
Line 753 in 4902a1c
and the second time happens here:
deno/cli/compilers/wasm_wrap.js
Line 15 in 4902a1c
The first compilation is to enable us to get imports/exports info such that we are able to build a dynamic script with static imports and named exports. The second one is for the later actual instantiation.
Ideally we should be able to just compile once, and in the module evaluation script we can somehow get a handle to the old compiled object. However currently these 2 compilations happens in 2 different isolates (first in some compiler isolate, second in the main isolate), thus making storing and transferring the compiled object difficult.
I'm not so sure if SyntheticModule APIs could be useful, since handling imports in its evaluation steps would be painful while doing exports is easy. Also we still need to create some js/.d.ts code for the module to placate TS compiler for named exports (especially under de-structuring)
Activity