History

try fix openapi extraction

Rhys Sullivan committed 8 months ago

Commit 46cd2631 parent e3f60e21 file · +6 −3Browse files

Unified · Split

packages/management-api/src/openapi-extractor-wasm.ts+6−3
@@ -1,4 +1,5 @@
11 import { readFile } from "node:fs/promises";
2+import { fileURLToPath } from "node:url";
23
34 import initWasmExtractor, {
45 extract_manifest_json_wasm,
@@ -8,9 +9,11 @@ let initPromise: Promise<void> | undefined; · 3 unmodified lines
89
910 const ensureWasmReady = (): Promise<void> => {
1011 if (!initPromise) {
11− initPromise = readFile(
12− new URL("./openapi-extractor-wasm/openapi_extractor_bg.wasm", import.meta.url),
13− ).then((wasmBytes) =>
12+ const wasmPath = fileURLToPath(
13+ new URL("./openapi-extractor-wasm/openapi_extractor_bg.wasm", import.meta.url).toString(),
14+ );
15+
16+ initPromise = readFile(wasmPath).then((wasmBytes) =>
1417 initWasmExtractor({ module_or_path: wasmBytes }).then(() => undefined)
1518 );
1619 }