MCPcopy Create free account
hub / github.com/vercel/vercel / importWasmModule

Function importWasmModule

packages/python-analysis/src/wasm/load.ts:36–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36export async function importWasmModule(): Promise<RootType> {
37 if (wasmInstance) {
38 return wasmInstance;
39 }
40 if (!wasmLoadPromise) {
41 wasmLoadPromise = (async () => {
42 // Use dynamic import() to load ESM modules
43 // This works in Node.js and Jest (with --experimental-vm-modules)
44 const wasiShimModule: any = await import(WASI_SHIM_PATH);
45 const WASIShim = wasiShimModule.WASIShim;
46 const wasmModule: ModuleType = await import(WASM_MODULE_PATH);
47 const imports = {
48 ...new WASIShim().getImportObject(),
49 'vercel:python-analysis/host-utils': createHostUtils(),
50 };
51 const instance = await wasmModule.instantiate(getCoreModule, imports);
52 wasmInstance = instance;
53 return instance;
54 })();
55 }
56 return wasmLoadPromise;
57}

Callers 8

findAppOrHandlerFunction · 0.90
containsTopLevelCallableFunction · 0.90
getStringConstantFunction · 0.90
parseWithWasmFunction · 0.90
isWheelCompatibleFunction · 0.90
evaluateMarkerFunction · 0.90
parsePep508Function · 0.90
scanDistributionsFunction · 0.90

Calls 1

createHostUtilsFunction · 0.85

Tested by

no test coverage detected