(_spec, bytes, ctx)
| 100 | |
| 101 | /* Try custom loaders first; built-in Path A is the implicit fallback. */ |
| 102 | export async function loadNativeModule(_spec, bytes, ctx) { |
| 103 | const module = await WebAssembly.compile(bytes); |
| 104 | |
| 105 | for (const loader of ctx.loaders) { |
| 106 | if (loader.match(module)) { |
| 107 | const result = await loader.load(module, ctx); |
| 108 | // Tag each fn with its dispatch kind so host_call_native picks the right path. |
| 109 | for (const fn of result.fns) fn.__edge_kind = result.kind; |
| 110 | annotateNames(result); |
| 111 | return result; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | const result = await builtinWasmPdkLoader(module, ctx); |
| 116 | annotateNames(result); |
| 117 | return result; |
| 118 | } |
| 119 | |
| 120 | /* Pair each fn with its declared name so deferred dispatch can route by name on the main thread. */ |
| 121 | function annotateNames({ names, fns }) { |
no test coverage detected