woodstone 0.1.12 → 0.1.13
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/package.json +1 -1
- package/src/initialise.js +4 -1
package/package.json
CHANGED
package/src/initialise.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import envPaths from "env-paths";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { readFile, mkdir } from "fs/promises";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
4
5
|
// Import WoodStone Engine (WASM)
|
|
5
6
|
import "../libs/wasm_exec.js";
|
|
6
7
|
export default async function initialise(c) {
|
|
@@ -15,9 +16,11 @@ export default async function initialise(c) {
|
|
|
15
16
|
const main_paths = envPaths("WoodStone", { suffix: '' });
|
|
16
17
|
await mkdir(path.join(main_paths.data, id), { recursive: true });
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = path.dirname(__filename);
|
|
18
21
|
const wasm = globalThis;
|
|
19
22
|
const go = new wasm.Go();
|
|
20
|
-
const wasm_file = await readFile("../libs/woodstone-engine.wasm");
|
|
23
|
+
const wasm_file = await readFile(path.join(__dirname, "../libs/woodstone-engine.wasm"));
|
|
21
24
|
const wasm_engine = await WebAssembly.instantiate(wasm_file, go.importObject);
|
|
22
25
|
go.run(wasm_engine.instance);
|
|
23
26
|
const index_file = wasm.getIndexFile();
|