// The Node entry (the "node" export condition): loads the engines from disk, and checks // UTF-8 with node:buffer's native scans. import { readFileSync } from "node:fs"; import { readFile } from "node:fs/promises"; import { isAscii, isUtf8 } from "node:buffer"; import { bind, defaultUrl } from "./core.js"; // TYPESTRIP_ERASE_WASM and TYPESTRIP_DOWNLEVEL_WASM each override their own slot only, // so pointing one at another build leaves the other mode loading its own binary. const env = [process.env.TYPESTRIP_ERASE_WASM, process.env.TYPESTRIP_DOWNLEVEL_WASM]; export const { transform, transformSync, engine } = bind({ url: (slot) => env[slot] ?? defaultUrl(slot), compileSync: (url) => new WebAssembly.Module(readFileSync(url)), compile: (url) => readFile(url).then((bytes) => WebAssembly.compile(bytes)), isUtf8, isAscii, }); export { UnsupportedSyntaxError } from "./core.js";