forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1diff --git a/deno_doc_wasm.generated.js b/deno_doc_wasm.generated.js
2index 12add85709ae8a235058c751c397893693f52a6a..da235f2e0ce35b9fc012a51495a15c84d024e434 100755
3--- a/deno_doc_wasm.generated.js
4+++ b/deno_doc_wasm.generated.js
5@@ -1012,13 +1012,18 @@ class WasmBuildLoader {
6
7 // make file urls work in Node via dnt
8 const isNode = globalThis.process?.versions?.node != null;
9- if (isFile && typeof Deno !== "object") {
10- throw new Error(
11- "Loading local files are not supported in this environment",
12+ if (isNode && isFile) {
13+ // Use Node.js fs module to read the file (patched for Node.js support)
14+ const { readFileSync } = await import("node:fs");
15+ const { fileURLToPath } = await import("node:url");
16+ const wasmCode = readFileSync(fileURLToPath(url));
17+ return WebAssembly.instantiate(
18+ decompress ? decompress(wasmCode) : wasmCode,
19+ imports,
20 );
21 }
22- if (isNode && isFile) {
23- // the deno global will be shimmed by dnt
24+ if (isFile && typeof Deno === "object") {
25+ // Deno environment
26 const wasmCode = await Deno.readFile(url);
27 return WebAssembly.instantiate(
28 decompress ? decompress(wasmCode) : wasmCode,
29diff --git a/mod.js b/mod.js
30index f9d9de1349c2bb575b29138a5fc54654e92c4a47..025ecdb580b52160f709b32bb5db9ecf481e70ce 100755
31--- a/mod.js
32+++ b/mod.js
33@@ -1,8 +1,8 @@
34 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
35 import { instantiate } from "./deno_doc_wasm.generated.js";
36 import { createCache } from "@jsr/deno__cache-dir";
37-export * from "./types.d.ts";
38-export * from "./html_types.d.ts";
39+// Removed: export * from "./types.d.ts"; (incompatible with Node.js/Rollup)
40+// Removed: export * from "./html_types.d.ts"; (incompatible with Node.js/Rollup)
41 const encoder = new TextEncoder();
42 /**
43 * Generate asynchronously an array of documentation nodes for the supplied