@ifc-lite/geometry 4.3.0 → 6.0.0
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/canonical-mesh-metadata.d.ts +6 -0
- package/dist/canonical-mesh-metadata.d.ts.map +1 -0
- package/dist/canonical-mesh-metadata.js +19 -0
- package/dist/canonical-mesh-metadata.js.map +1 -0
- package/dist/geometry-coordinate.d.ts +0 -7
- package/dist/geometry-coordinate.d.ts.map +1 -1
- package/dist/geometry-coordinate.js +9 -11
- package/dist/geometry-coordinate.js.map +1 -1
- package/dist/geometry.worker.d.ts.map +1 -1
- package/dist/geometry.worker.js +2 -11
- package/dist/geometry.worker.js.map +1 -1
- package/dist/huge-file-error.d.ts +0 -10
- package/dist/huge-file-error.d.ts.map +1 -1
- package/dist/huge-file-error.js +3 -0
- package/dist/huge-file-error.js.map +1 -1
- package/dist/ifc-lite-bridge.d.ts +7 -7
- package/dist/ifc-lite-bridge.d.ts.map +1 -1
- package/dist/ifc-lite-bridge.js +7 -7
- package/dist/ifc-lite-bridge.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wasm-init-retry.d.ts +6 -42
- package/dist/wasm-init-retry.d.ts.map +1 -1
- package/dist/wasm-init-retry.js +6 -99
- package/dist/wasm-init-retry.js.map +1 -1
- package/dist/wasm-panic-forward.d.ts +7 -63
- package/dist/wasm-panic-forward.d.ts.map +1 -1
- package/dist/wasm-panic-forward.js +7 -100
- package/dist/wasm-panic-forward.js.map +1 -1
- package/package.json +4 -3
|
@@ -2,106 +2,13 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* (#
|
|
5
|
+
* Re-export of the shared worker-to-main-thread wasm panic-location forwarder
|
|
6
|
+
* (issue #4247).
|
|
7
7
|
*
|
|
8
|
-
* The
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (`apps/viewer/src/lib/analytics-scrub.ts`'s `attachWasmPanicLocation`), but
|
|
13
|
-
* a worker-realm trap leaves that stash stranded in the worker's global,
|
|
14
|
-
* which the main thread can never see across the realm boundary.
|
|
15
|
-
*
|
|
16
|
-
* `takeWasmPanicStash` reads + consumes the stash worker-side so it can ride
|
|
17
|
-
* the worker's own `{type:'error'}` message; `restashWasmPanicLocation`
|
|
18
|
-
* re-plants it on the main thread's global so the EXISTING #2527 gate (same
|
|
19
|
-
* key, same TTL, same consume-once semantics) picks it up unmodified.
|
|
20
|
-
*
|
|
21
|
-
* Location only, never the panic's message — the message can embed
|
|
22
|
-
* model-derived text (see `utils.rs`'s privacy contract); the location alone
|
|
23
|
-
* travels on the error message and through this module.
|
|
24
|
-
*
|
|
25
|
-
* NOTE: this file is intentionally byte-identical to
|
|
26
|
-
* `packages/parser/src/wasm-panic-forward.ts` — both `@ifc-lite/geometry`
|
|
27
|
-
* and `@ifc-lite/parser` need the exact same realm-forwarding contract, and
|
|
28
|
-
* neither package depends on the other (nor is `@ifc-lite/wasm`, the one
|
|
29
|
-
* package both DO depend on, a safe home: it ships only the wasm-pack build
|
|
30
|
-
* output, with no TypeScript build step of its own, and `test`/`typecheck`
|
|
31
|
-
* for either consumer already runs its build via turbo's `^build` — adding a
|
|
32
|
-
* hand-written TS module there would make every geometry/parser test run
|
|
33
|
-
* gate on a full Rust→wasm rebuild). Keep any change to one copy in lockstep
|
|
34
|
-
* with the other; `wasm-panic-forward.test.ts` is duplicated the same way.
|
|
35
|
-
*/
|
|
36
|
-
/** Kept in lockstep with `PANIC_STASH_KEY` in `rust/wasm-bindings/src/utils.rs`,
|
|
37
|
-
* `WASM_PANIC_STASH_KEY` in `apps/viewer/src/lib/analytics-scrub.ts`, and this
|
|
38
|
-
* module's twin at `packages/parser/src/wasm-panic-forward.ts`. */
|
|
39
|
-
export const WASM_PANIC_STASH_KEY = '__ifclite_wasm_panic';
|
|
40
|
-
/**
|
|
41
|
-
* Trap-shape text match, kept in lockstep with `WASM_TRAP_TEXT` in
|
|
42
|
-
* `apps/viewer/src/lib/analytics-scrub.ts` and this module's twin at
|
|
43
|
-
* `packages/parser/src/wasm-panic-forward.ts`. Deliberately excludes bare
|
|
44
|
-
* "unreachable" inside network-failure phrasing ("network is unreachable",
|
|
45
|
-
* "host unreachable") — those are not wasm traps.
|
|
46
|
-
*/
|
|
47
|
-
const WASM_TRAP_TEXT = /(?<!network is |host |destination |address )\bunreachable\b|\bRuntimeError\b|memory access out of bounds|index out of bounds|indirect call to null|integer (?:overflow|divide by zero)|call stack exhausted/i;
|
|
48
|
-
function looksLikeWasmTrap(message) {
|
|
49
|
-
return WASM_TRAP_TEXT.test(message);
|
|
50
|
-
}
|
|
51
|
-
/** Validate + narrow an unknown stash value read off a realm global. */
|
|
52
|
-
function readStashShape(value) {
|
|
53
|
-
if (typeof value !== 'object' || value === null)
|
|
54
|
-
return undefined;
|
|
55
|
-
const { location, at } = value;
|
|
56
|
-
if (typeof location !== 'string' || location === '')
|
|
57
|
-
return undefined;
|
|
58
|
-
// Reject non-finite (`NaN`/`Infinity`) and future timestamps — both pass
|
|
59
|
-
// the analytics TTL gate's `Date.now() - at <= TTL` check trivially
|
|
60
|
-
// (`Infinity` makes the delta `-Infinity`; a future `at` makes it
|
|
61
|
-
// negative), which would let a malformed stash label a later trap.
|
|
62
|
-
if (typeof at !== 'number' || !Number.isFinite(at) || at > Date.now())
|
|
63
|
-
return undefined;
|
|
64
|
-
return { location, at };
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Worker-side: read and CONSUME this realm's panic stash so it can be
|
|
68
|
-
* forwarded on the worker's own error message. Consume-once regardless of
|
|
69
|
-
* shape validity — an unconsumed malformed stash must not linger to
|
|
70
|
-
* mislabel a later trap, mirroring the main-thread gate's own rule.
|
|
71
|
-
*/
|
|
72
|
-
export function takeWasmPanicStash(realm) {
|
|
73
|
-
const g = realm;
|
|
74
|
-
const raw = g[WASM_PANIC_STASH_KEY];
|
|
75
|
-
delete g[WASM_PANIC_STASH_KEY];
|
|
76
|
-
return readStashShape(raw);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Main-side: re-plant a worker-forwarded stash on this realm's global so the
|
|
80
|
-
* existing #2527 `attachWasmPanicLocation` gate consumes it unmodified.
|
|
81
|
-
*
|
|
82
|
-
* Gated on `errorMessage` looking like a wasm trap: the worker forwards
|
|
83
|
-
* `wasmPanicLocation`/`wasmPanicAt` on ANY `{type:'error'}` message (a stale
|
|
84
|
-
* stash from an earlier suppressed panic can ride out on an ordinary,
|
|
85
|
-
* non-trap worker error), and re-planting unconditionally would let that
|
|
86
|
-
* stale location sit on `globalThis` until an unrelated trap-shaped
|
|
87
|
-
* exception consumed it — mislabeling that trap. Only a message that itself
|
|
88
|
-
* looks like a wasm trap is allowed to re-plant.
|
|
89
|
-
*
|
|
90
|
-
* Never clobbers an existing, unconsumed stash — a genuine main-thread trap
|
|
91
|
-
* that hasn't been captured yet must win over a worker trap that merely
|
|
92
|
-
* arrived first (the older-looking stash, if stale, is simply dropped later
|
|
93
|
-
* by the TTL check at attach time; this function never overwrites either
|
|
94
|
-
* way).
|
|
8
|
+
* The real implementation lives in `@ifc-lite/wasm-lifecycle` so
|
|
9
|
+
* `@ifc-lite/geometry` and `@ifc-lite/parser` share exactly one copy of the
|
|
10
|
+
* #2527 realm-forwarding contract instead of maintaining two
|
|
11
|
+
* independently-editable "twin" files.
|
|
95
12
|
*/
|
|
96
|
-
export
|
|
97
|
-
const stash = readStashShape({ location, at });
|
|
98
|
-
if (!stash)
|
|
99
|
-
return;
|
|
100
|
-
if (!looksLikeWasmTrap(errorMessage))
|
|
101
|
-
return;
|
|
102
|
-
const g = realm;
|
|
103
|
-
if (g[WASM_PANIC_STASH_KEY] !== undefined)
|
|
104
|
-
return;
|
|
105
|
-
g[WASM_PANIC_STASH_KEY] = stash;
|
|
106
|
-
}
|
|
13
|
+
export { WASM_PANIC_STASH_KEY, takeWasmPanicStash, restashWasmPanicLocation, } from '@ifc-lite/wasm-lifecycle';
|
|
107
14
|
//# sourceMappingURL=wasm-panic-forward.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-panic-forward.js","sourceRoot":"","sources":["../src/wasm-panic-forward.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D
|
|
1
|
+
{"version":3,"file":"wasm-panic-forward.js","sourceRoot":"","sources":["../src/wasm-panic-forward.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;GAQG;AACH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/geometry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Geometry processing bridge for IFC-Lite - exact-arithmetic CSG, streamed across workers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ifc-lite/data": "^4.
|
|
22
|
-
"@ifc-lite/wasm": "^
|
|
21
|
+
"@ifc-lite/data": "^4.2.1",
|
|
22
|
+
"@ifc-lite/wasm": "^8.0.1",
|
|
23
|
+
"@ifc-lite/wasm-lifecycle": "^0.2.0"
|
|
23
24
|
},
|
|
24
25
|
"optionalDependencies": {
|
|
25
26
|
"@tauri-apps/api": "^2.11.1"
|