Unified · Split
| @@ -1,4 +1,5 @@ | |||
| 1 | import { readFile } from "node:fs/promises"; | 1 | import { readFile } from "node:fs/promises"; |
| 2 | import { fileURLToPath } from "node:url"; | ||
| 2 | 3 | ||
| 3 | import initWasmExtractor, { | 4 | import initWasmExtractor, { |
| 4 | extract_manifest_json_wasm, | 5 | extract_manifest_json_wasm, |
| @@ -8,9 +9,11 @@ let initPromise: Promise<void> | undefined; · 3 unmodified lines | |||
| 8 | 9 | ||
| 9 | const ensureWasmReady = (): Promise<void> => { | 10 | const ensureWasmReady = (): Promise<void> => { |
| 10 | if (!initPromise) { | 11 | if (!initPromise) { |
| 11 | initPromise = readFile( | 12 | const wasmPath = fileURLToPath( |
| 12 | new URL("./openapi-extractor-wasm/openapi_extractor_bg.wasm", import.meta.url), | 13 | new URL("./openapi-extractor-wasm/openapi_extractor_bg.wasm", import.meta.url).toString(), |
| 13 | ).then((wasmBytes) => | 14 | ); |
| 15 | |||
| 16 | initPromise = readFile(wasmPath).then((wasmBytes) => | ||
| 14 | initWasmExtractor({ module_or_path: wasmBytes }).then(() => undefined) | 17 | initWasmExtractor({ module_or_path: wasmBytes }).then(() => undefined) |
| 15 | ); | 18 | ); |
| 16 | } | 19 | } |