fix: remove hard dependency on wasm
This commit is contained in:
@@ -23,6 +23,9 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"patchedDependencies": {
|
||||||
|
"@takumi-rs/[email protected]": "patches/@takumi-rs%[email protected]",
|
||||||
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@borewit/text-codec": ["@borewit/[email protected]", "", {}, "sha512-k7vvKPbf7J2fZ5klGRD9AeKfUvojuZIQ3BT5u7Jfv+puwXkUBUT5PVyMDfJZpy30CBDXGMgw7fguK/lpOMBvgw=="],
|
"@borewit/text-codec": ["@borewit/[email protected]", "", {}, "sha512-k7vvKPbf7J2fZ5klGRD9AeKfUvojuZIQ3BT5u7Jfv+puwXkUBUT5PVyMDfJZpy30CBDXGMgw7fguK/lpOMBvgw=="],
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@
|
|||||||
"oxlint": "^1.62.0"
|
"oxlint": "^1.62.0"
|
||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@takumi-rs/[email protected]": "patches/@takumi-rs%[email protected]"
|
"@takumi-rs/[email protected]": "patches/@takumi-rs%[email protected]",
|
||||||
|
"@takumi-rs/[email protected]": "patches/@takumi-rs%[email protected]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
diff --git a/index.js b/index.js
|
|
||||||
index 053400fcfd69663e1aa12dd1740a24f806747278..d0326bec5feaed5fa98c558fac44b5ee70581741 100644
|
|
||||||
--- a/index.js
|
|
||||||
+++ b/index.js
|
|
||||||
@@ -3,11 +3,32 @@
|
|
||||||
// @ts-nocheck
|
|
||||||
/* auto-generated by NAPI-RS */
|
|
||||||
|
|
||||||
-import { createRequire } from 'node:module'
|
|
||||||
-const require = createRequire(import.meta.url)
|
|
||||||
+import { createRequire } from 'node:module';
|
|
||||||
+const realRequire = createRequire(import.meta.url)
|
|
||||||
+
|
|
||||||
+import * as path from "node:path";
|
|
||||||
+import * as fs from "node:fs";
|
|
||||||
+import { feature } from 'bun:bundle';
|
|
||||||
+const { readFileSync } = require('node:fs');
|
|
||||||
+
|
|
||||||
+function require(name) {
|
|
||||||
+ if(!feature("FAKE_REQUIRE")) return realRequire(name);
|
|
||||||
+ const exeDir = path.dirname(process.execPath);
|
|
||||||
+ const candidate = path.join(exeDir, name);
|
|
||||||
+
|
|
||||||
+ if (fs.existsSync(candidate)) {
|
|
||||||
+ return realRequire(candidate);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ try {
|
|
||||||
+ return realRequire(name);
|
|
||||||
+ } catch {
|
|
||||||
+ return realRequire(`./${name}`);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
const __dirname = new URL('.', import.meta.url).pathname
|
|
||||||
|
|
||||||
-const { readFileSync } = require('node:fs')
|
|
||||||
let nativeBinding = null
|
|
||||||
const loadErrors = []
|
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
diff --git a/bundlers/next.mjs b/bundlers/next.mjs
|
||||||
|
index 26fe0985b9929763a7b89034fee472867af3c503..322c8e157903ffcc466bc27a4f302a1030fb4276 100644
|
||||||
|
--- a/bundlers/next.mjs
|
||||||
|
+++ b/bundlers/next.mjs
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
-import module from "../pkg/takumi_wasm_bg.wasm?module";
|
||||||
|
+// import module from "../pkg/takumi_wasm_bg.wasm?module";
|
||||||
|
|
||||||
|
-// typeof module says its Module { } but instanceof WebAssembly.Module is false
|
||||||
|
-// Have to force override the prototype to be WebAssembly.Module
|
||||||
|
-Object.setPrototypeOf(module, WebAssembly.Module.prototype);
|
||||||
|
+// // typeof module says its Module { } but instanceof WebAssembly.Module is false
|
||||||
|
+// // Have to force override the prototype to be WebAssembly.Module
|
||||||
|
+// Object.setPrototypeOf(module, WebAssembly.Module.prototype);
|
||||||
|
|
||||||
|
-export default module;
|
||||||
|
+// export default module;
|
||||||
Reference in New Issue
Block a user