wao 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/waosm-node.js +3 -1
- package/esm/waosm-node.js +7 -3
- package/package.json +1 -1
package/cjs/waosm-node.js
CHANGED
|
@@ -20,7 +20,9 @@ var _fs = require("fs");
|
|
|
20
20
|
var _path = require("path");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
-
var
|
|
23
|
+
var dirPath;
|
|
24
|
+
if (typeof __filename !== "undefined" && typeof __dirname !== "undefined") dirPath = __dirname;else dirPath = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
var wasm = (0, _fs.readFileSync)((0, _path.resolve)(dirPath, "./waosm-node/waosm_bg.wasm"));
|
|
24
26
|
var wasmModule = new WebAssembly.Module(wasm);
|
|
25
27
|
var wasmInstance = new WebAssembly.Instance(wasmModule, {
|
|
26
28
|
"./waosm_bg.js": wasmBindings
|
package/esm/waosm-node.js
CHANGED
|
@@ -3,9 +3,13 @@ import * as wasmBindings from "./waosm-node/waosm_bg.js"
|
|
|
3
3
|
import { __wbg_set_wasm } from "./waosm-node/waosm_bg.js"
|
|
4
4
|
import { readFileSync } from "fs"
|
|
5
5
|
import { resolve } from "path"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
6
|
+
|
|
7
|
+
let dirPath
|
|
8
|
+
if (typeof __filename !== "undefined" && typeof __dirname !== "undefined")
|
|
9
|
+
dirPath = __dirname
|
|
10
|
+
else dirPath = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
|
|
12
|
+
const wasm = readFileSync(resolve(dirPath, "./waosm-node/waosm_bg.wasm"))
|
|
9
13
|
const wasmModule = new WebAssembly.Module(wasm)
|
|
10
14
|
const wasmInstance = new WebAssembly.Instance(wasmModule, {
|
|
11
15
|
"./waosm_bg.js": wasmBindings,
|