okgeometry-api 0.5.7 → 0.5.8
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/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -58
- package/dist/engine.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/package.json +7 -3
- package/src/engine.ts +25 -82
- package/src/wasm-base64.ts +1 -1
- package/wasm/okgeometrycore.d.ts +21 -2
- package/wasm/okgeometrycore.js +46 -2
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/okgeometrycore_bg.wasm.d.ts +1 -0
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAcA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAU1C;AAED,wBAAgB,UAAU,IAAI,IAAI,CAIjC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC"}
|
package/dist/engine.js
CHANGED
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
import { WASM_B64 } from "./wasm-base64.js";
|
|
2
|
+
import coreWasmInit from "../wasm/okgeometrycore.js";
|
|
2
3
|
import * as bg from "../wasm/okgeometrycore_bg.js";
|
|
3
4
|
let initialized = false;
|
|
4
|
-
let wasmExports = null;
|
|
5
5
|
const engineGlobal = globalThis;
|
|
6
6
|
if (typeof engineGlobal.__okgeometry_boolean_should_cancel !== "function") {
|
|
7
7
|
engineGlobal.__okgeometry_boolean_should_cancel = () => false;
|
|
8
8
|
}
|
|
9
|
-
function buildWasmImports(requiredNames = []) {
|
|
10
|
-
const bgAny = bg;
|
|
11
|
-
const importModule = { ...bgAny };
|
|
12
|
-
const cancelKey = Object.keys(importModule).find(k => k.startsWith("__wbg___okgeometry_boolean_should_cancel_"));
|
|
13
|
-
const cancelFn = () => {
|
|
14
|
-
try {
|
|
15
|
-
return !!engineGlobal.__okgeometry_boolean_should_cancel?.();
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
if (cancelKey) {
|
|
22
|
-
importModule[cancelKey] = cancelFn;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// Fallback to current known symbol in generated bindings.
|
|
26
|
-
importModule.__wbg___okgeometry_boolean_should_cancel_3e76652b5286d323 = cancelFn;
|
|
27
|
-
}
|
|
28
|
-
// Fill hash-suffixed imports that may not be exported by generated glue in this runtime.
|
|
29
|
-
for (const name of requiredNames) {
|
|
30
|
-
const existing = importModule[name];
|
|
31
|
-
if (typeof existing === "function") {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (name.startsWith("__wbg___okgeometry_boolean_should_cancel_")) {
|
|
35
|
-
importModule[name] = cancelFn;
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (name.startsWith("__wbg_now_")) {
|
|
39
|
-
importModule[name] = () => Date.now();
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (name.startsWith("__wbg___wbindgen_throw_")) {
|
|
43
|
-
importModule[name] = () => {
|
|
44
|
-
throw new Error("WASM trap: __wbindgen_throw");
|
|
45
|
-
};
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (name === "__wbindgen_init_externref_table") {
|
|
49
|
-
importModule[name] = () => { };
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return importModule;
|
|
54
|
-
}
|
|
55
9
|
export async function init() {
|
|
56
10
|
if (initialized)
|
|
57
11
|
return;
|
|
@@ -59,17 +13,8 @@ export async function init() {
|
|
|
59
13
|
const bytes = new Uint8Array(raw.length);
|
|
60
14
|
for (let i = 0; i < raw.length; i++)
|
|
61
15
|
bytes[i] = raw.charCodeAt(i);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
.filter((imp) => imp.module === "./okgeometrycore_bg.js")
|
|
65
|
-
.map((imp) => imp.name);
|
|
66
|
-
const importModule = buildWasmImports(requiredNames);
|
|
67
|
-
const instance = await WebAssembly.instantiate(wasmModule, {
|
|
68
|
-
"./okgeometrycore_bg.js": importModule,
|
|
69
|
-
});
|
|
70
|
-
wasmExports = instance.exports;
|
|
71
|
-
bg.__wbg_set_wasm(instance.exports);
|
|
72
|
-
instance.exports.__wbindgen_start();
|
|
16
|
+
const exports = await coreWasmInit({ module_or_path: bytes });
|
|
17
|
+
bg.__wbg_set_wasm(exports);
|
|
73
18
|
initialized = true;
|
|
74
19
|
}
|
|
75
20
|
export function ensureInit() {
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEnD,IAAI,WAAW,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEnD,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,UAEpB,CAAC;AAEF,IAAI,OAAO,YAAY,CAAC,kCAAkC,KAAK,UAAU,EAAE,CAAC;IAC1E,YAAY,CAAC,kCAAkC,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;AAChE,CAAC;AAED,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