@ifc-lite/geometry 7.7.0 → 7.8.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.
Files changed (70) hide show
  1. package/README.md +54 -0
  2. package/dist/geometry-parallel-options.d.ts +15 -0
  3. package/dist/geometry-parallel-options.d.ts.map +1 -1
  4. package/dist/geometry-parallel.d.ts +2 -47
  5. package/dist/geometry-parallel.d.ts.map +1 -1
  6. package/dist/geometry-parallel.js +50 -146
  7. package/dist/geometry-parallel.js.map +1 -1
  8. package/dist/geometry-worker-pool.d.ts +72 -0
  9. package/dist/geometry-worker-pool.d.ts.map +1 -0
  10. package/dist/geometry-worker-pool.js +176 -0
  11. package/dist/geometry-worker-pool.js.map +1 -0
  12. package/dist/geometry.worker.d.ts.map +1 -1
  13. package/dist/geometry.worker.js +19 -25
  14. package/dist/geometry.worker.js.map +1 -1
  15. package/dist/hung-job-recovery.d.ts +26 -2
  16. package/dist/hung-job-recovery.d.ts.map +1 -1
  17. package/dist/hung-job-recovery.js +42 -7
  18. package/dist/hung-job-recovery.js.map +1 -1
  19. package/dist/ifc-lite-bridge.d.ts.map +1 -1
  20. package/dist/ifc-lite-bridge.js +11 -23
  21. package/dist/ifc-lite-bridge.js.map +1 -1
  22. package/dist/in-call-heartbeat.d.ts +20 -0
  23. package/dist/in-call-heartbeat.d.ts.map +1 -0
  24. package/dist/in-call-heartbeat.js +39 -0
  25. package/dist/in-call-heartbeat.js.map +1 -0
  26. package/dist/index.d.ts +7 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +11 -16
  29. package/dist/index.js.map +1 -1
  30. package/dist/main-engine-init.d.ts +5 -0
  31. package/dist/main-engine-init.d.ts.map +1 -0
  32. package/dist/main-engine-init.js +42 -0
  33. package/dist/main-engine-init.js.map +1 -0
  34. package/dist/perf-flags.d.ts +55 -0
  35. package/dist/perf-flags.d.ts.map +1 -0
  36. package/dist/perf-flags.js +66 -0
  37. package/dist/perf-flags.js.map +1 -0
  38. package/dist/prepass-routing.d.ts +53 -0
  39. package/dist/prepass-routing.d.ts.map +1 -0
  40. package/dist/prepass-routing.js +100 -0
  41. package/dist/prepass-routing.js.map +1 -0
  42. package/dist/scan-proposals.d.ts +132 -0
  43. package/dist/scan-proposals.d.ts.map +1 -0
  44. package/dist/scan-proposals.js +12 -0
  45. package/dist/scan-proposals.js.map +1 -0
  46. package/dist/scan-segmentation.d.ts +205 -0
  47. package/dist/scan-segmentation.d.ts.map +1 -0
  48. package/dist/scan-segmentation.js +17 -0
  49. package/dist/scan-segmentation.js.map +1 -0
  50. package/dist/warm-pool.d.ts +27 -0
  51. package/dist/warm-pool.d.ts.map +1 -0
  52. package/dist/warm-pool.js +48 -0
  53. package/dist/warm-pool.js.map +1 -0
  54. package/dist/wasm-shared-module.d.ts +17 -19
  55. package/dist/wasm-shared-module.d.ts.map +1 -1
  56. package/dist/wasm-shared-module.js +90 -77
  57. package/dist/wasm-shared-module.js.map +1 -1
  58. package/dist/wasm-streaming-guard.d.ts +2 -0
  59. package/dist/wasm-streaming-guard.d.ts.map +1 -0
  60. package/dist/wasm-streaming-guard.js +22 -0
  61. package/dist/wasm-streaming-guard.js.map +1 -0
  62. package/dist/worker-count.d.ts +10 -0
  63. package/dist/worker-count.d.ts.map +1 -1
  64. package/dist/worker-count.js +19 -0
  65. package/dist/worker-count.js.map +1 -1
  66. package/dist/worker-trace.d.ts +16 -0
  67. package/dist/worker-trace.d.ts.map +1 -0
  68. package/dist/worker-trace.js +39 -0
  69. package/dist/worker-trace.js.map +1 -0
  70. package/package.json +17 -6
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-shared-module.d.ts","sourceRoot":"","sources":["../src/wasm-shared-module.ts"],"names":[],"mappings":"AAoDA;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAgDpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAK3C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAM9D"}
1
+ {"version":3,"file":"wasm-shared-module.d.ts","sourceRoot":"","sources":["../src/wasm-shared-module.ts"],"names":[],"mappings":"AA6GA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAIhG;AAED,0EAA0E;AAC1E,KAAK,qBAAqB,GAAG;IAC3B,cAAc,EAAE,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,GAAE,MAAM,GAAG,GAAG,GAAG,IAAuB,EACnD,SAAS,GAAE,MAAwB,GAClC,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAa5C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS1E"}
@@ -17,8 +17,9 @@
17
17
  *
18
18
  * Keeping the memo here — rather than private to the worker pool — means the
19
19
  * second path can reuse whatever the first already compiled, so the binary is
20
- * fetched at most once per URL per realm no matter which path runs first. That
21
- * matters most when the two overlap: a prewarm started at page load and a small
20
+ * shared on pool-first and bundled main-init-first loads. Unbundled main init
21
+ * keeps wasm-bindgen's own asset resolution. Sharing matters most when
22
+ * the two overlap: a prewarm started at page load and a small
22
23
  * file opened seconds later would otherwise be two concurrent downloads of the
23
24
  * same 1.3 MB (browsers are not required to coalesce in-flight requests for the
24
25
  * same URL), on exactly the slow connections the prewarm exists to help.
@@ -48,88 +49,97 @@ function resolveWasmUrl(explicitUrl) {
48
49
  return null;
49
50
  }
50
51
  }
51
- /**
52
- * Compile (or join the in-flight compile of) the engine binary for `explicitUrl`
53
- * — or the default resolution when omitted.
54
- *
55
- * Resolves to `null` — the caller then leaves the consumer on its own `init()` —
56
- * when the URL can't be resolved or compilation fails, so non-Vite consumers and
57
- * offline/edge failures degrade to the previous behaviour rather than breaking.
58
- */
59
- export async function compileSharedWasmModule(explicitUrl) {
60
- if (typeof WebAssembly === 'undefined')
61
- return null;
62
- const url = resolveWasmUrl(explicitUrl);
63
- if (!url)
64
- return null;
65
- const cacheKey = url instanceof URL ? url.href : url;
66
- const cached = sharedWasmModulePromises.get(cacheKey);
52
+ // Match wasm-bindgen's public loader: a successful ordinary response with the
53
+ // wrong MIME type may use its bytes; transport/validation failures retain their
54
+ // original rejection. In particular, invalid application/wasm is not retried.
55
+ function permitsMimeFallback(response) {
56
+ return response.ok
57
+ && ['basic', 'cors', 'default'].includes(response.type)
58
+ && response.headers.get('Content-Type') !== 'application/wasm';
59
+ }
60
+ function acquireModule(url) {
61
+ const key = url instanceof URL ? url.href : url;
62
+ const cached = sharedWasmModulePromises.get(key);
67
63
  if (cached)
68
64
  return cached;
69
- const p = (async () => {
70
- try {
71
- if (typeof WebAssembly.compileStreaming === 'function') {
72
- try {
73
- // Compile WHILE the binary downloads (one streaming fetch + compile
74
- // for every consumer).
75
- return await WebAssembly.compileStreaming(fetch(url));
76
- }
77
- catch (err) {
78
- // Some static hosts serve `.wasm` with the wrong MIME type, which
79
- // rejects compileStreaming — fall through to the buffer path.
80
- //
81
- // Worth a line even though the fallback works: the streaming fetch is
82
- // already spent, so the buffer path downloads the ~1.3 MB binary a
83
- // SECOND time, and nothing else reports that. Once per URL per realm
84
- // (this runs inside the single-flight memo).
85
- console.warn('[stream] wasm compileStreaming rejected; refetching for the buffer path:', err);
86
- }
65
+ const promise = (async () => {
66
+ const response = await fetch(url);
67
+ if (typeof WebAssembly.compileStreaming !== 'function') {
68
+ // Preserve the optional helper's HTTP refusal even when its streaming API
69
+ // is absent. Main init must not accept bytes a present public streaming
70
+ // loader would reject. This is stricter than glue with both APIs absent.
71
+ if (!response.ok)
72
+ throw new TypeError('WebAssembly HTTP status code is not ok');
73
+ if (!['basic', 'cors', 'default'].includes(response.type)) {
74
+ throw new TypeError('WebAssembly response type is not supported');
87
75
  }
88
- const resp = await fetch(url);
89
- if (!resp.ok)
90
- return null;
91
- return await WebAssembly.compile(await resp.arrayBuffer());
76
+ return WebAssembly.compile(await response.arrayBuffer());
77
+ }
78
+ // Like generated init, permitted MIME rejection leaves the original body
79
+ // available for arrayBuffer. Do not tee/clone or fetch the binary again.
80
+ try {
81
+ return await WebAssembly.compileStreaming(response);
92
82
  }
93
- catch (err) {
94
- console.warn('[stream] shared wasm compile failed; consumers will self-init:', err);
95
- return null;
83
+ catch (error) {
84
+ if (!permitsMimeFallback(response))
85
+ throw error;
86
+ console.warn('[stream] wasm compileStreaming rejected MIME; using the same response bytes:', error);
87
+ return WebAssembly.compile(await response.arrayBuffer());
96
88
  }
97
- })();
98
- sharedWasmModulePromises.set(cacheKey, p);
99
- const result = await p;
100
- // Don't cache a failure — evict ONLY this URL's entry so the next load retries
101
- // (a transient fetch error shouldn't permanently disable the shared-module fast
102
- // path for the session), while other URLs' successful modules stay cached.
103
- //
104
- // Evict only if THIS promise is still the installed one. A failed compile can
105
- // have several awaiters; the first to resume evicts and a retry may install a
106
- // fresh promise before the rest resume. Without the identity check those late
107
- // awaiters would delete the *replacement*, breaking single-flight and letting
108
- // a second compile of the same binary start.
109
- if (result === null && sharedWasmModulePromises.get(cacheKey) === p) {
110
- sharedWasmModulePromises.delete(cacheKey);
111
- }
112
- return result;
89
+ })().catch((error) => {
90
+ // Evict the owner, not a replacement installed by a later load. All joining
91
+ // callers see the original rejection; the bridge's retry can start anew.
92
+ if (sharedWasmModulePromises.get(key) === promise)
93
+ sharedWasmModulePromises.delete(key);
94
+ throw error;
95
+ });
96
+ sharedWasmModulePromises.set(key, promise);
97
+ return promise;
98
+ }
99
+ const warnedFailures = new WeakSet();
100
+ function optionalModule(promise) {
101
+ return promise.catch((error) => {
102
+ if (!warnedFailures.has(promise)) {
103
+ warnedFailures.add(promise);
104
+ console.warn('[stream] shared wasm compile failed; consumers will self-init:', error);
105
+ }
106
+ return null;
107
+ });
113
108
  }
114
109
  /**
115
- * The compiled module for `explicitUrl` **only if a compile was already started**
116
- * for it — otherwise `null`, without starting one.
117
- *
118
- * This is the "join, don't initiate" accessor for consumers that have their own
119
- * working init path (`IfcLiteBridge.init()`): when a prewarm or a parallel load
120
- * has already fetched the binary, reuse it; when nothing has, do exactly what
121
- * this consumer did before rather than speculatively pulling 1.3 MB on a path
122
- * that may not need it.
123
- *
124
- * Awaits an in-flight compile rather than racing it with a second fetch — the
125
- * bytes are the same and already on the wire.
110
+ * Compile or join the engine binary. The pool's optional contract stays null on
111
+ * failure; the memo itself preserves rejection for the main loader's retry.
126
112
  */
127
- export function getStartedSharedWasmModule(explicitUrl) {
113
+ export function compileSharedWasmModule(explicitUrl) {
114
+ if (typeof WebAssembly === 'undefined')
115
+ return Promise.resolve(null);
128
116
  const url = resolveWasmUrl(explicitUrl);
129
- if (!url)
130
- return null;
131
- const cacheKey = url instanceof URL ? url.href : url;
132
- return sharedWasmModulePromises.get(cacheKey) ?? null;
117
+ return url ? optionalModule(acquireModule(url)) : Promise.resolve(null);
118
+ }
119
+ /**
120
+ * Prepare main init without starting a bundled fetch. Generated public init
121
+ * returns an already initialized engine BEFORE reading module_or_path. A cold
122
+ * loader reads this getter and starts/joins the strict memo inside its retry.
123
+ *
124
+ * Raw sibling URLs do not prove the installed npm asset location. Only join an
125
+ * existing optional memo there, then give the loader concrete options or no
126
+ * options. Promise<undefined> would bypass the loader's default URL selection.
127
+ * The second URL constructor uses a parameter so bundlers leave it untouched.
128
+ */
129
+ export async function prepareSharedWasmInit(resolvedUrl = resolveWasmUrl(), moduleUrl = import.meta.url) {
130
+ if (!resolvedUrl || typeof WebAssembly === 'undefined')
131
+ return undefined;
132
+ const cacheKey = resolvedUrl instanceof URL ? resolvedUrl.href : resolvedUrl;
133
+ const resolved = new URL(cacheKey, moduleUrl);
134
+ const unbundled = new URL('../../wasm/pkg/ifc-lite_bg.wasm', moduleUrl);
135
+ if (resolved.href === unbundled.href || !['http:', 'https:'].includes(resolved.protocol)) {
136
+ const cached = sharedWasmModulePromises.get(cacheKey);
137
+ const module = cached ? await optionalModule(cached) : null;
138
+ return module ? { module_or_path: module } : undefined;
139
+ }
140
+ return {
141
+ get module_or_path() { return acquireModule(cacheKey); },
142
+ };
133
143
  }
134
144
  /**
135
145
  * Start the shared fetch+compile BEFORE a file is opened, so the binary is
@@ -140,7 +150,7 @@ export function getStartedSharedWasmModule(explicitUrl) {
140
150
  * slow link the whole download sits in front of first geometry (measured 2.5 s
141
151
  * on a ~4 Mbit connection, for a 225 KB model).
142
152
  *
143
- * Fire-and-forget by design: a prewarm failure must never surface to the user or
153
+ * Fire-and-forget by design (the returned promise never rejects): a prewarm failure must never surface to the user or
144
154
  * poison the load path. `compileSharedWasmModule` already evicts a failed URL so
145
155
  * the real load retries, and every consumer falls back to its own `init()` when
146
156
  * no shared module is available. Callers decide *when* to call this (idle,
@@ -152,10 +162,13 @@ export function getStartedSharedWasmModule(explicitUrl) {
152
162
  * resolution, which is the intended usage.
153
163
  */
154
164
  export function prewarmSharedWasmModule(wasmUrl) {
155
- void compileSharedWasmModule(wasmUrl).catch((err) => {
165
+ // Resolves whether a module compiled (the viewer's `viewer_boot` field
166
+ // event times it, #6961); callers that only prewarm can ignore it.
167
+ return compileSharedWasmModule(wasmUrl).then((module) => module !== null, (err) => {
156
168
  // Unreachable in practice — compileSharedWasmModule swallows its own
157
169
  // failures and resolves null — but never let a prewarm reject unhandled.
158
170
  console.warn('[stream] wasm prewarm failed; load path will retry:', err);
171
+ return false;
159
172
  });
160
173
  }
161
174
  //# sourceMappingURL=wasm-shared-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-shared-module.js","sourceRoot":"","sources":["../src/wasm-shared-module.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAA8C,CAAC;AAEvF,SAAS,cAAc,CAAC,WAAoB;IAC1C,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IACpC,IAAI,CAAC;QACH,sEAAsE;QACtE,0EAA0E;QAC1E,2EAA2E;QAC3E,uEAAuE;QACvE,wEAAwE;QACxE,oEAAoE;QACpE,EAAE;QACF,iEAAiE;QACjE,wDAAwD;QACxD,wEAAwE;QACxE,OAAO,IAAI,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAoB;IAEpB,IAAI,OAAO,WAAW,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,GAAG,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,QAAQ,GAAG,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IACrD,MAAM,MAAM,GAAG,wBAAwB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,CAAC,GAAG,CAAC,KAAK,IAAwC,EAAE;QACxD,IAAI,CAAC;YACH,IAAI,OAAO,WAAW,CAAC,gB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B,CAAC,OAAgB;IACtD,uEAAuE;IACvE,mEAAmE;IACnE,OAAO,uBAAuB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QAChF,qEAAqE;QACrE,yEAAyE;QACzE,OAAO,CAAC,IAAI,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function acquireWasmStreamingOperation(operation: string): () => void;
2
+ //# sourceMappingURL=wasm-streaming-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-streaming-guard.d.ts","sourceRoot":"","sources":["../src/wasm-streaming-guard.ts"],"names":[],"mappings":"AAWA,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,IAAI,CAa3E"}
@@ -0,0 +1,22 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * One WASM streaming operation at a time per GeometryProcessor module: the
6
+ * streaming entry points share engine state, so a second stream must not start
7
+ * while the first is still running.
8
+ */
9
+ let activeWasmStreamingOperation = null;
10
+ export function acquireWasmStreamingOperation(operation) {
11
+ if (activeWasmStreamingOperation) {
12
+ throw new Error(`GeometryProcessor ${operation} cannot start while ${activeWasmStreamingOperation} is still running. ` +
13
+ 'Wait for the active stream to finish, or cancel it before starting another geometry operation.');
14
+ }
15
+ activeWasmStreamingOperation = operation;
16
+ return () => {
17
+ if (activeWasmStreamingOperation === operation) {
18
+ activeWasmStreamingOperation = null;
19
+ }
20
+ };
21
+ }
22
+ //# sourceMappingURL=wasm-streaming-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-streaming-guard.js","sourceRoot":"","sources":["../src/wasm-streaming-guard.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;GAIG;AACH,IAAI,4BAA4B,GAAkB,IAAI,CAAC;AAEvD,MAAM,UAAU,6BAA6B,CAAC,SAAiB;IAC7D,IAAI,4BAA4B,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,qBAAqB,SAAS,uBAAuB,4BAA4B,qBAAqB;YACtG,gGAAgG,CACjG,CAAC;IACJ,CAAC;IACD,4BAA4B,GAAG,SAAS,CAAC;IACzC,OAAO,GAAG,EAAE;QACV,IAAI,4BAA4B,KAAK,SAAS,EAAE,CAAC;YAC/C,4BAA4B,GAAG,IAAI,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -58,4 +58,14 @@ export declare function computeWorkerCount(inputs: WorkerCountInputs): WorkerCou
58
58
  * Convenience wrapper that returns just the integer count.
59
59
  */
60
60
  export declare function pickWorkerCount(inputs: WorkerCountInputs): number;
61
+ /**
62
+ * The worker count a parallel load of `fileSizeMB` uses on this host: the
63
+ * browser's cores and memory, and a file-size proxy for the job count (the
64
+ * memory cap keeps an over-estimate harmless and still bounds an explicit
65
+ * `workerCountOverride`, so the A/B knob cannot OOM the tab). Shared by the
66
+ * load and by the warm pool's prewarm (#7036) so both plan the same count.
67
+ */
68
+ export declare function planLoadWorkerCount(fileSizeMB: number, workerCountOverride?: number): WorkerCountResult & {
69
+ cores: number;
70
+ };
61
71
  //# sourceMappingURL=worker-count.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-count.d.ts","sourceRoot":"","sources":["../src/worker-count.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,SA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gB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAW3H"}
@@ -163,4 +163,23 @@ export function computeWorkerCount(inputs) {
163
163
  export function pickWorkerCount(inputs) {
164
164
  return computeWorkerCount(inputs).count;
165
165
  }
166
+ /**
167
+ * The worker count a parallel load of `fileSizeMB` uses on this host: the
168
+ * browser's cores and memory, and a file-size proxy for the job count (the
169
+ * memory cap keeps an over-estimate harmless and still bounds an explicit
170
+ * `workerCountOverride`, so the A/B knob cannot OOM the tab). Shared by the
171
+ * load and by the warm pool's prewarm (#7036) so both plan the same count.
172
+ */
173
+ export function planLoadWorkerCount(fileSizeMB, workerCountOverride) {
174
+ const nav = typeof navigator !== 'undefined' ? navigator : undefined;
175
+ const cores = nav?.hardwareConcurrency ?? 2;
176
+ const result = computeWorkerCount({
177
+ fileSizeMB,
178
+ cores,
179
+ deviceMemoryGB: nav?.deviceMemory ?? 8,
180
+ totalJobs: Math.max(1, Math.ceil(fileSizeMB * 100)),
181
+ workerCountOverride,
182
+ });
183
+ return { ...result, cores };
184
+ }
166
185
  //# sourceMappingURL=worker-count.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-count.js","sourceRoot":"","sources":["../src/worker-count.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuD/D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAyB;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,8DAA8D;IAC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AC,CAAC,CAAC,SAAkD,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9G,MAAM,KAAK,GAAG,GAAG,EAAE,mBAAmB,IAAI,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAChC,UAAU;QACV,KAAK;QACL,cAAc,EAAE,GAAG,EAAE,YAAY,IAAI,CAAC;QACtC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;QACnD,mBAAmB;KACpB,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,16 @@
1
+ export { countCopy, meterTypedArrayArgs } from '@ifc-lite/load-trace';
2
+ /**
3
+ * Worker-side load-trace spans (#6956): which geometry-worker requests become
4
+ * a span when the pool enabled tracing (`enableWorkerTrace` in
5
+ * geometry-parallel.ts). Each span is the whole serialised handler, posted back
6
+ * as soon as it settles; untraced loads pass straight through.
7
+ */
8
+ export declare const traceGeometryWorkerMessage: import("@ifc-lite/load-trace").WorkerTraceHost;
9
+ /**
10
+ * Post a pre-pass event. The host terminates the pre-pass worker as soon as it
11
+ * receives the final `complete` event, before this worker's handler returns,
12
+ * so the completed scan span and counters are flushed ahead of that message
13
+ * (#6993). Merely draining finished spans loses the still-running handler.
14
+ */
15
+ export declare function postPrepassEvent(event: unknown): void;
16
+ //# sourceMappingURL=worker-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-trace.d.ts","sourceRoot":"","sources":["../src/worker-trace.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,gDAcrC,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAGrD"}
@@ -0,0 +1,39 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { createWorkerTraceHost } from '@ifc-lite/load-trace';
5
+ // #6957: the worker's counter helpers, re-exported so geometry.worker.ts keeps one load-trace import.
6
+ export { countCopy, meterTypedArrayArgs } from '@ifc-lite/load-trace';
7
+ /**
8
+ * Worker-side load-trace spans (#6956): which geometry-worker requests become
9
+ * a span when the pool enabled tracing (`enableWorkerTrace` in
10
+ * geometry-parallel.ts). Each span is the whole serialised handler, posted back
11
+ * as soon as it settles; untraced loads pass straight through.
12
+ */
13
+ export const traceGeometryWorkerMessage = createWorkerTraceHost({
14
+ spanNames: {
15
+ init: 'worker.init',
16
+ 'scan-shard': 'shard.scan',
17
+ 'prepass-streaming': 'prepass.scan',
18
+ 'prepass-streaming-sharded': 'prepass.scan',
19
+ 'resolve-styles-shard': 'styles.shard',
20
+ 'finalize-styles': 'styles.finalize',
21
+ 'stream-chunk': 'geometry.firstChunk',
22
+ },
23
+ // Only the first chunk: one span per slice would cost a message per batch.
24
+ onceTypes: ['stream-chunk'],
25
+ post: (message) => self.postMessage(message),
26
+ endpoint: () => self,
27
+ });
28
+ /**
29
+ * Post a pre-pass event. The host terminates the pre-pass worker as soon as it
30
+ * receives the final `complete` event, before this worker's handler returns,
31
+ * so the completed scan span and counters are flushed ahead of that message
32
+ * (#6993). Merely draining finished spans loses the still-running handler.
33
+ */
34
+ export function postPrepassEvent(event) {
35
+ if (event?.type === 'complete')
36
+ traceGeometryWorkerMessage.flush('prepass.scan');
37
+ self.postMessage({ type: 'prepass-stream', event });
38
+ }
39
+ //# sourceMappingURL=worker-trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-trace.js","sourceRoot":"","sources":["../src/worker-trace.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,sGAAsG;AACtG,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;IAC9D,SAAS,EAAE;QACT,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,YAAY;QAC1B,mBAAmB,EAAE,cAAc;QACnC,2BAA2B,EAAE,cAAc;QAC3C,sBAAsB,EAAE,cAAc;QACtC,iBAAiB,EAAE,iBAAiB;QACpC,cAAc,EAAE,qBAAqB;KACtC;IACD,2EAA2E;IAC3E,SAAS,EAAE,CAAC,cAAc,CAAC;IAC3B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAE,IAA0B,CAAC,WAAW,CAAC,OAAO,CAAC;IACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAyB;CAC1C,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAK,KAAmC,EAAE,IAAI,KAAK,UAAU;QAAE,0BAA0B,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/G,IAA0B,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/geometry",
3
- "version": "7.7.0",
3
+ "version": "7.8.1",
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",
@@ -26,6 +26,16 @@
26
26
  "import": "./dist/rtc-rebase.js",
27
27
  "default": "./dist/rtc-rebase.js"
28
28
  },
29
+ "./scan-segmentation": {
30
+ "types": "./dist/scan-segmentation.d.ts",
31
+ "import": "./dist/scan-segmentation.js",
32
+ "default": "./dist/scan-segmentation.js"
33
+ },
34
+ "./scan-proposals": {
35
+ "types": "./dist/scan-proposals.d.ts",
36
+ "import": "./dist/scan-proposals.js",
37
+ "default": "./dist/scan-proposals.js"
38
+ },
29
39
  "./remesh": {
30
40
  "types": "./dist/remesh/index.d.ts",
31
41
  "import": "./dist/remesh/index.js",
@@ -33,17 +43,18 @@
33
43
  }
34
44
  },
35
45
  "dependencies": {
36
- "@ifc-lite/data": "^6.1.0",
37
- "@ifc-lite/wasm": "^10.3.0",
46
+ "@ifc-lite/load-trace": "^0.3.0",
47
+ "@ifc-lite/wasm": "^10.4.0",
48
+ "@ifc-lite/data": "^6.2.0",
38
49
  "@ifc-lite/wasm-lifecycle": "^0.2.0"
39
50
  },
40
51
  "optionalDependencies": {
41
- "@tauri-apps/api": "^2.11.1"
52
+ "@tauri-apps/api": "^2.12.2"
42
53
  },
43
54
  "devDependencies": {
44
- "@tauri-apps/api": "^2.11.1",
55
+ "@tauri-apps/api": "^2.12.2",
45
56
  "typescript": "^6.0.3",
46
- "vitest": "^5.0.2"
57
+ "vitest": "^5.0.3"
47
58
  },
48
59
  "license": "MPL-2.0",
49
60
  "author": "Louis True",