import "./wasm_exec.js";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { unzipSync } from "node:zlib";
const wasmPath = join(dirname(fileURLToPath(import.meta.url)), "lib.wasm.gz");
export async function getData(specContents) {
    console.log("Parsing OpenAPI spec (ignore lock file errors printed below)");
    const gzippedBuffer = await readFile(wasmPath);
    const wasmBuffer = unzipSync(gzippedBuffer);
    const go = new Go();
    const result = await WebAssembly.instantiate(wasmBuffer, go.importObject);
    void go.run(result.instance);
    const serializedDocsData = await SerializeDocsData(specContents);
    const docsData = JSON.parse(serializedDocsData).map((chunk) => JSON.parse(chunk));
    return new Map(docsData.map((chunk) => [chunk.id, chunk]));
}
//# sourceMappingURL=getDocsData.js.map