ducjs 4.0.2 → 4.0.4
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/ducjs_wasi.wasm +0 -0
- package/dist/ducjs_wasm.d.ts +226 -213
- package/dist/ducjs_wasm.js +1249 -1271
- package/dist/ducjs_wasm_bg.wasm +0 -0
- package/dist/ducjs_wasm_bg.wasm.d.ts +4 -4
- package/dist/utils/state/index.js +1 -1
- package/dist/wasi.js +38 -25
- package/package.json +5 -5
package/dist/ducjs_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -56,14 +56,14 @@ export const rust_sqlite_wasm_localtime: (a: number) => number;
|
|
|
56
56
|
export const rust_sqlite_wasm_realloc: (a: number, b: number) => number;
|
|
57
57
|
export const sqlite3_os_end: () => number;
|
|
58
58
|
export const sqlite3_os_init: () => number;
|
|
59
|
+
export const wasm_bindgen_cbbfe5fbe5ccf11c___convert__closures_____invoke___wasm_bindgen_cbbfe5fbe5ccf11c___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_cbbfe5fbe5ccf11c___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
60
|
+
export const wasm_bindgen_cbbfe5fbe5ccf11c___convert__closures_____invoke___js_sys_15501fc5a3580944___Function_fn_wasm_bindgen_cbbfe5fbe5ccf11c___JsValue_____wasm_bindgen_cbbfe5fbe5ccf11c___sys__Undefined___js_sys_15501fc5a3580944___Function_fn_wasm_bindgen_cbbfe5fbe5ccf11c___JsValue_____wasm_bindgen_cbbfe5fbe5ccf11c___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
59
61
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
60
62
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
61
63
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
62
64
|
export const __externref_table_alloc: () => number;
|
|
63
|
-
export const
|
|
65
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
66
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
64
67
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
65
|
-
export const __wbindgen_export_6: WebAssembly.Table;
|
|
66
68
|
export const __externref_table_dealloc: (a: number) => void;
|
|
67
|
-
export const closure101_externref_shim: (a: number, b: number, c: any) => void;
|
|
68
|
-
export const closure82_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
69
69
|
export const __wbindgen_start: () => void;
|
|
@@ -22,7 +22,7 @@ export const getZoom = (value, mainScope, scopeExponentThreshold) => {
|
|
|
22
22
|
};
|
|
23
23
|
export const getDefaultGlobalState = () => {
|
|
24
24
|
return {
|
|
25
|
-
viewBackgroundColor:
|
|
25
|
+
viewBackgroundColor: COLOR_PALETTE.white,
|
|
26
26
|
scopeExponentThreshold: 3,
|
|
27
27
|
mainScope: NEUTRAL_SCOPE,
|
|
28
28
|
};
|
package/dist/wasi.js
CHANGED
|
@@ -39,32 +39,45 @@ const isSuccessfulWasiExit = (error) => {
|
|
|
39
39
|
|| (candidate === null || candidate === void 0 ? void 0 : candidate.exitCode) === 0
|
|
40
40
|
|| (candidate === null || candidate === void 0 ? void 0 : candidate.message) === "Exited with status 0";
|
|
41
41
|
};
|
|
42
|
+
let wasiBinaryReady = null;
|
|
42
43
|
/**
|
|
43
|
-
*
|
|
44
|
-
* In development, it's in the ducjs dist directory.
|
|
45
|
-
* In production, it should be bundled or downloaded.
|
|
44
|
+
* Load the WASI binary from a local package/path or a remote URL.
|
|
46
45
|
*/
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
function loadWasiBinary() {
|
|
47
|
+
if (wasiBinaryReady)
|
|
48
|
+
return wasiBinaryReady;
|
|
49
|
+
wasiBinaryReady = (() => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const env = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.env;
|
|
52
|
+
if (env === null || env === void 0 ? void 0 : env.DUCJS_WASI_PATH) {
|
|
53
|
+
return readFileSync(env.DUCJS_WASI_PATH);
|
|
54
|
+
}
|
|
55
|
+
if (env === null || env === void 0 ? void 0 : env.DUCJS_WASI_URL) {
|
|
56
|
+
const response = yield fetch(env.DUCJS_WASI_URL);
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
throw new Error(`Failed to download ducjs WASI binary: ${response.status} ${response.statusText}`);
|
|
59
|
+
}
|
|
60
|
+
const binary = new Uint8Array(yield response.arrayBuffer());
|
|
61
|
+
if (binary.byteLength === 0) {
|
|
62
|
+
throw new Error("Downloaded ducjs WASI binary is empty");
|
|
63
|
+
}
|
|
64
|
+
return binary;
|
|
65
|
+
}
|
|
66
|
+
const candidates = [
|
|
67
|
+
resolve(_dirname, "..", "node_modules", "ducjs", "dist", "ducjs_wasi.wasm"),
|
|
68
|
+
resolve(_dirname, "..", "ducjs", "dist", "ducjs_wasi.wasm"),
|
|
69
|
+
resolve(_dirname, "ducjs_wasi.wasm"),
|
|
70
|
+
];
|
|
71
|
+
for (const candidate of candidates) {
|
|
72
|
+
if (existsSync(candidate))
|
|
73
|
+
return readFileSync(candidate);
|
|
74
|
+
}
|
|
75
|
+
throw new Error(`ducjs WASI binary not found. Set DUCJS_WASI_PATH, set DUCJS_WASI_URL, or ensure ducjs/dist/ducjs_wasi.wasm exists. Tried: ${candidates.join(", ")}`);
|
|
76
|
+
}))().catch((error) => {
|
|
77
|
+
wasiBinaryReady = null;
|
|
78
|
+
throw error;
|
|
79
|
+
});
|
|
80
|
+
return wasiBinaryReady;
|
|
68
81
|
}
|
|
69
82
|
/**
|
|
70
83
|
* Stream multiple files into a single .duc file using the WASI binary.
|
|
@@ -182,7 +195,7 @@ const writeExternalFileSidecars = (state, manifestDir) => {
|
|
|
182
195
|
return manifestPath;
|
|
183
196
|
};
|
|
184
197
|
const runWasi = (args, preopens) => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
-
const wasmBinary =
|
|
198
|
+
const wasmBinary = yield loadWasiBinary();
|
|
186
199
|
const wasi = new WASI({
|
|
187
200
|
version: "preview1",
|
|
188
201
|
args,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ducjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "SQLite-backed project-state format for physical-engineering work before execution.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"undici-types": "^6.21.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@braintree/sanitize-url": "
|
|
54
|
-
"browser-fs-access": "0.
|
|
55
|
-
"fflate": "^0.8.
|
|
56
|
-
"nanoid": "5.1.
|
|
53
|
+
"@braintree/sanitize-url": "^7.1.1",
|
|
54
|
+
"browser-fs-access": "^0.38.0",
|
|
55
|
+
"fflate": "^0.8.3",
|
|
56
|
+
"nanoid": "^5.1.6",
|
|
57
57
|
"perfect-freehand": "1.2.2",
|
|
58
58
|
"tinycolor2": "1.6.0"
|
|
59
59
|
},
|