@ifc-lite/parser 5.2.0 → 6.1.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.
Files changed (151) hide show
  1. package/dist/columnar-entity-preparation.d.ts +3 -0
  2. package/dist/columnar-entity-preparation.d.ts.map +1 -1
  3. package/dist/columnar-entity-preparation.js +101 -11
  4. package/dist/columnar-entity-preparation.js.map +1 -1
  5. package/dist/columnar-parser-indexes.d.ts +17 -1
  6. package/dist/columnar-parser-indexes.d.ts.map +1 -1
  7. package/dist/columnar-parser-indexes.js +31 -21
  8. package/dist/columnar-parser-indexes.js.map +1 -1
  9. package/dist/columnar-parser.d.ts +10 -1
  10. package/dist/columnar-parser.d.ts.map +1 -1
  11. package/dist/columnar-parser.js +14 -2
  12. package/dist/columnar-parser.js.map +1 -1
  13. package/dist/cost-extractor.d.ts +10 -0
  14. package/dist/cost-extractor.d.ts.map +1 -0
  15. package/dist/cost-extractor.js +369 -0
  16. package/dist/cost-extractor.js.map +1 -0
  17. package/dist/cost-schedule-2x3.d.ts +31 -0
  18. package/dist/cost-schedule-2x3.d.ts.map +1 -0
  19. package/dist/cost-schedule-2x3.js +75 -0
  20. package/dist/cost-schedule-2x3.js.map +1 -0
  21. package/dist/cost-types.d.ts +105 -0
  22. package/dist/cost-types.d.ts.map +1 -0
  23. package/dist/cost-types.js +5 -0
  24. package/dist/cost-types.js.map +1 -0
  25. package/dist/data-store-transport.d.ts +1 -0
  26. package/dist/data-store-transport.d.ts.map +1 -1
  27. package/dist/data-store-transport.js +5 -29
  28. package/dist/data-store-transport.js.map +1 -1
  29. package/dist/drop-census.d.ts +136 -0
  30. package/dist/drop-census.d.ts.map +1 -0
  31. package/dist/drop-census.js +53 -0
  32. package/dist/drop-census.js.map +1 -0
  33. package/dist/entity-scanner.d.ts.map +1 -1
  34. package/dist/entity-scanner.js +10 -5
  35. package/dist/entity-scanner.js.map +1 -1
  36. package/dist/generated/ifc2x3/schema-registry.d.ts +50 -0
  37. package/dist/generated/ifc2x3/schema-registry.d.ts.map +1 -0
  38. package/dist/generated/ifc2x3/schema-registry.js +50052 -0
  39. package/dist/generated/ifc2x3/schema-registry.js.map +1 -0
  40. package/dist/generated/ifc4x3/schema-registry.d.ts +50 -0
  41. package/dist/generated/ifc4x3/schema-registry.d.ts.map +1 -0
  42. package/dist/generated/ifc4x3/schema-registry.js +71299 -0
  43. package/dist/generated/ifc4x3/schema-registry.js.map +1 -0
  44. package/dist/generated/schema-registry-by-version.d.ts +61 -0
  45. package/dist/generated/schema-registry-by-version.d.ts.map +1 -0
  46. package/dist/generated/schema-registry-by-version.js +86 -0
  47. package/dist/generated/schema-registry-by-version.js.map +1 -0
  48. package/dist/group-assignment-factor.d.ts +13 -0
  49. package/dist/group-assignment-factor.d.ts.map +1 -0
  50. package/dist/group-assignment-factor.js +30 -0
  51. package/dist/group-assignment-factor.js.map +1 -0
  52. package/dist/ifczip.d.ts +6 -0
  53. package/dist/ifczip.d.ts.map +1 -1
  54. package/dist/ifczip.js +20 -11
  55. package/dist/ifczip.js.map +1 -1
  56. package/dist/index.d.ts +7 -2
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +13 -2
  59. package/dist/index.js.map +1 -1
  60. package/dist/on-demand-extractors.d.ts +1 -0
  61. package/dist/on-demand-extractors.d.ts.map +1 -1
  62. package/dist/on-demand-extractors.js +2 -1
  63. package/dist/on-demand-extractors.js.map +1 -1
  64. package/dist/property-value-parser.d.ts +10 -0
  65. package/dist/property-value-parser.d.ts.map +1 -1
  66. package/dist/property-value-parser.js +40 -1
  67. package/dist/property-value-parser.js.map +1 -1
  68. package/dist/scan-entities-balanced.d.ts.map +1 -1
  69. package/dist/scan-entities-balanced.js +8 -6
  70. package/dist/scan-entities-balanced.js.map +1 -1
  71. package/dist/scan-worker-lexing.d.ts +14 -0
  72. package/dist/scan-worker-lexing.d.ts.map +1 -0
  73. package/dist/scan-worker-lexing.js +101 -0
  74. package/dist/scan-worker-lexing.js.map +1 -0
  75. package/dist/scan-worker-source.d.ts +1 -1
  76. package/dist/scan-worker-source.d.ts.map +1 -1
  77. package/dist/scan-worker-source.js +61 -59
  78. package/dist/scan-worker-source.js.map +1 -1
  79. package/dist/schedule-extractor.d.ts +2 -80
  80. package/dist/schedule-extractor.d.ts.map +1 -1
  81. package/dist/schedule-extractor.js +100 -225
  82. package/dist/schedule-extractor.js.map +1 -1
  83. package/dist/schedule-serializer-builders.d.ts +28 -0
  84. package/dist/schedule-serializer-builders.d.ts.map +1 -0
  85. package/dist/schedule-serializer-builders.js +163 -0
  86. package/dist/schedule-serializer-builders.js.map +1 -0
  87. package/dist/schedule-serializer.d.ts +6 -0
  88. package/dist/schedule-serializer.d.ts.map +1 -1
  89. package/dist/schedule-serializer.js +26 -165
  90. package/dist/schedule-serializer.js.map +1 -1
  91. package/dist/schedule-types.d.ts +211 -0
  92. package/dist/schedule-types.d.ts.map +1 -0
  93. package/dist/schedule-types.js +221 -0
  94. package/dist/schedule-types.js.map +1 -0
  95. package/dist/spatial-hierarchy-ambiguity.d.ts +39 -0
  96. package/dist/spatial-hierarchy-ambiguity.d.ts.map +1 -0
  97. package/dist/spatial-hierarchy-ambiguity.js +25 -0
  98. package/dist/spatial-hierarchy-ambiguity.js.map +1 -0
  99. package/dist/spatial-hierarchy-attributes.d.ts +54 -0
  100. package/dist/spatial-hierarchy-attributes.d.ts.map +1 -0
  101. package/dist/spatial-hierarchy-attributes.js +145 -0
  102. package/dist/spatial-hierarchy-attributes.js.map +1 -0
  103. package/dist/spatial-hierarchy-builder.d.ts +0 -30
  104. package/dist/spatial-hierarchy-builder.d.ts.map +1 -1
  105. package/dist/spatial-hierarchy-builder.js +45 -167
  106. package/dist/spatial-hierarchy-builder.js.map +1 -1
  107. package/dist/spatial-hierarchy-canonical-parent.d.ts +52 -2
  108. package/dist/spatial-hierarchy-canonical-parent.d.ts.map +1 -1
  109. package/dist/spatial-hierarchy-canonical-parent.js +153 -4
  110. package/dist/spatial-hierarchy-canonical-parent.js.map +1 -1
  111. package/dist/step-lexing.d.ts +1 -1
  112. package/dist/step-lexing.d.ts.map +1 -1
  113. package/dist/step-lexing.js +1 -56
  114. package/dist/step-lexing.js.map +1 -1
  115. package/dist/step-record-boundary.d.ts +28 -0
  116. package/dist/step-record-boundary.d.ts.map +1 -0
  117. package/dist/step-record-boundary.js +108 -0
  118. package/dist/step-record-boundary.js.map +1 -0
  119. package/dist/step-record-boundary.vectors.d.ts +58 -0
  120. package/dist/step-record-boundary.vectors.d.ts.map +1 -0
  121. package/dist/step-record-boundary.vectors.js +80 -0
  122. package/dist/step-record-boundary.vectors.js.map +1 -0
  123. package/dist/structural-extractor.d.ts +9 -0
  124. package/dist/structural-extractor.d.ts.map +1 -0
  125. package/dist/structural-extractor.js +310 -0
  126. package/dist/structural-extractor.js.map +1 -0
  127. package/dist/structural-load-extractor.d.ts +147 -0
  128. package/dist/structural-load-extractor.d.ts.map +1 -0
  129. package/dist/structural-load-extractor.js +178 -0
  130. package/dist/structural-load-extractor.js.map +1 -0
  131. package/dist/structural-step-values.d.ts +51 -0
  132. package/dist/structural-step-values.d.ts.map +1 -0
  133. package/dist/structural-step-values.js +109 -0
  134. package/dist/structural-step-values.js.map +1 -0
  135. package/dist/structural-types.d.ts +145 -0
  136. package/dist/structural-types.d.ts.map +1 -0
  137. package/dist/structural-types.js +5 -0
  138. package/dist/structural-types.js.map +1 -0
  139. package/dist/tokenizer.d.ts +11 -5
  140. package/dist/tokenizer.d.ts.map +1 -1
  141. package/dist/tokenizer.js +75 -21
  142. package/dist/tokenizer.js.map +1 -1
  143. package/dist/wasm-init-retry.d.ts +6 -42
  144. package/dist/wasm-init-retry.d.ts.map +1 -1
  145. package/dist/wasm-init-retry.js +6 -99
  146. package/dist/wasm-init-retry.js.map +1 -1
  147. package/dist/wasm-panic-forward.d.ts +7 -63
  148. package/dist/wasm-panic-forward.d.ts.map +1 -1
  149. package/dist/wasm-panic-forward.js +7 -100
  150. package/dist/wasm-panic-forward.js.map +1 -1
  151. package/package.json +5 -4
package/dist/tokenizer.js CHANGED
@@ -7,7 +7,10 @@
7
7
  */
8
8
  import { isIndexableExpressId } from './express-id.js';
9
9
  import { BalancedEntityScan } from './scan-entities-balanced.js';
10
- import { countNewlines, opensComment, opensLiteralOrComment, skipComment, skipLexical, skipTrivia, } from './step-lexing.js';
10
+ import { countNewlines, isSpaceByte, opensComment, opensLiteralOrComment, skipComment, skipLexical, skipTrivia, } from './step-lexing.js';
11
+ import { recordCloseOffset, semicolonClosesRecord, UNBALANCED_RECORD, } from './step-record-boundary.js';
12
+ /** `recordClose` before anything has computed it (both real failures are negative). */
13
+ const NOT_COMPUTED = -3;
11
14
  export class StepTokenizer {
12
15
  buffer;
13
16
  oversizedIds = 0;
@@ -18,11 +21,17 @@ export class StepTokenizer {
18
21
  /** Records the last scan refused for an out-of-contract express id
19
22
  * (express-id.ts, #3395). Reset per scan; the caller reports it. */
20
23
  get oversizedIdCount() { return this.oversizedIds; }
21
- /** 0 or 1: whether the last `scanEntitiesFast`/`scanEntities` run stopped
22
- * early on an unclosed `'` string, an unclosed block comment, or a
23
- * declaration cut off before its own '(' -- never a count of how many,
24
- * since the scan has no reliable way to resume past the first one it
25
- * hits. Reset at the start of every scan; the caller reports it. */
24
+ /** 0 or 1: whether the last run DROPPED a record for having no terminator
25
+ * of its own. Never a count of how many: the first is reported and later
26
+ * ones are not accumulated. Nor does it say the scan STOPPED.
27
+ *
28
+ * The two scans DISAGREE about which records exist, and this is where that
29
+ * shows. `scanEntitiesFast` applies the #4179 record-boundary rules, so
30
+ * `#1=IFCA(1);\n#2=IFCB(2)\n#3=IFCC(3);` gives ids [1, 3] and a count of
31
+ * 1: it drops the unterminated #2 and recovers. `scanEntities`
32
+ * (BalancedEntityScan) closes every record on the ')' balancing its '(' and
33
+ * never looks at the ';' at all, so the same input gives [1, 2, 3] and a
34
+ * count of 0. Reset at the start of every scan; the caller reports it. */
26
35
  get malformedRecordCount() { return this.malformedRecords; }
27
36
  /**
28
37
  * Scan for all entity declarations (#EXPRESS_ID = TYPE(...))
@@ -56,6 +65,7 @@ export class StepTokenizer {
56
65
  const HASH = 0x23; // '#'
57
66
  const EQUALS = 0x3D; // '='
58
67
  const LPAREN = 0x28; // '('
68
+ const RPAREN = 0x29; // ')'
59
69
  const SEMICOLON = 0x3B; // ';'
60
70
  const QUOTE = 0x27; // '\''
61
71
  const NEWLINE = 0x0A; // '\n'
@@ -264,9 +274,21 @@ export class StepTokenizer {
264
274
  continue;
265
275
  }
266
276
  declOpen = false; // Header complete: '(' found.
267
- // FAST: Skip to semicolon (handling strings)
277
+ // FAST: Skip to semicolon (handling strings), bounded to THIS
278
+ // record's own body so one missing its ';' cannot latch onto a later
279
+ // one and swallow what lies between (#4179). close_step_record in
280
+ // rust/core/src/parser/lexical.rs argues both rules and the
281
+ // recovery; step-record-boundary.ts is this file's TS half of them.
282
+ // Only the hot part is inline here, because it must be:
283
+ // '=' is one more test on a branch chain this loop already walks, and
284
+ // the ')' rule is settled ONCE per record, at the ';'.
285
+ const parenPos = pos;
268
286
  let inString = false;
269
287
  let foundTerminator = false;
288
+ // Memoised across the two places that need the record's own close: the
289
+ // exact ';' check and the recovery below would otherwise balance the
290
+ // same record twice.
291
+ let recordClose = NOT_COMPUTED;
270
292
  while (pos < len) {
271
293
  const c = buf[pos];
272
294
  if (c === QUOTE) {
@@ -282,18 +304,23 @@ export class StepTokenizer {
282
304
  // quotes and parens inside it text, the other half of the rule the
283
305
  // literal skip above provides in the opposite direction.
284
306
  const end = skipComment(buf, pos, len);
285
- if (end < 0) {
286
- // Unterminated: this record has no terminator, and neither has
287
- // anything after it. Drop it and stop, which is the None Rust's
288
- // find_entity_end returns on the same input.
289
- pos = len;
290
- break;
291
- }
307
+ if (end < 0)
308
+ break; // Unterminated: recovery below finds no ')'.
292
309
  line += countNewlines(buf, pos, end);
293
310
  pos = end;
294
311
  continue;
295
312
  }
296
313
  else if (c === SEMICOLON && !inString) {
314
+ // ')' modulo whitespace settles it for every record a real file
315
+ // holds; anything else defers to the cold, exact check.
316
+ let i = pos;
317
+ while (i > parenPos && isSpaceByte(buf[i - 1]))
318
+ i--;
319
+ if (buf[i - 1] !== RPAREN) {
320
+ recordClose = recordCloseOffset(buf, parenPos, startOffset);
321
+ if (!semicolonClosesRecord(buf, recordClose, pos))
322
+ break;
323
+ }
297
324
  // Found end of entity
298
325
  const entityLength = pos - startOffset + 1; // Include semicolon
299
326
  yield { expressId, type, offset: startOffset, length: entityLength, line: startLine };
@@ -301,19 +328,46 @@ export class StepTokenizer {
301
328
  foundTerminator = true;
302
329
  break;
303
330
  }
331
+ else if (c === EQUALS && !inString) {
332
+ // The next declaration started before this record was terminated.
333
+ break;
334
+ }
304
335
  else if (c === NEWLINE) {
305
336
  line++;
306
337
  }
307
338
  pos++;
308
339
  }
309
- // Ran off the end without an unquoted ';' usually an unescaped `'`
310
- // left open, or the unterminated-comment break above; `pos` is
311
- // already `len`, ending the scan here. Not resynced: with no known
312
- // terminator, guessing a resume point risks fabricating entities from
313
- // misaligned bytes. Recorded in `stopped`, not incremented here --
314
- // see the post-loop check below.
315
- if (!foundTerminator)
340
+ // No ';' of this record's own -- it ran off the end (an unescaped `'`
341
+ // left open, an unterminated comment), or one of the two #4179
342
+ // boundary rules refused the ';' it found. EVERY such exit lands here,
343
+ // so the recovery lives here once rather than at each `break`.
344
+ //
345
+ // Resume at the ')' balancing this record's own '(' when there is one,
346
+ // dropping just this record; otherwise run to `len`, ending the scan
347
+ // un-resynced rather than guessing a resume point from misaligned
348
+ // bytes. The pre-existing exits reach the second case, which is the
349
+ // `pos = len` they used to set for themselves.
350
+ if (!foundTerminator) {
316
351
  stopped = true;
352
+ if (recordClose === NOT_COMPUTED) {
353
+ recordClose = recordCloseOffset(buf, parenPos, startOffset);
354
+ }
355
+ if (recordClose > 0) {
356
+ pos = recordClose;
357
+ line = startLine + countNewlines(buf, startOffset, pos);
358
+ }
359
+ else if (recordClose === UNBALANCED_RECORD) {
360
+ // No balancing ')', but the bytes after are readable: re-hunt from
361
+ // past this record's '#' so the NEXT declaration is still found.
362
+ pos = startOffset + 1;
363
+ line = startLine;
364
+ }
365
+ else {
366
+ // UNREADABLE_RECORD: a literal or comment swallowed the rest of
367
+ // the input, so there is nothing to resume from (#3695).
368
+ pos = len;
369
+ }
370
+ }
317
371
  }
318
372
  else if (char === NEWLINE) {
319
373
  line++;
@@ -1 +1 @@
1
- {"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../src/tokenizer.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAyB,MAAM,6BAA6B,CAAC;AACxF,OAAO,EACL,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,MAAM,OAAO,aAAa;IAChB,MAAM,CAAa;IACnB,YAAY,GAAW,CAAC,CAAC;IACzB,gBAAgB,GAAW,CAAC,CAAC;IAErC,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;yEACqE;IACrE,IAAI,gBAAgB,KAAa,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAE5D;;;;yEAIqE;IACrE,IAAI,oBAAoB,KAAa,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEpE;;;;;;;;OAQG;IACH,CAAC,YAAY;QACX,MAAM,IAAI,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC;YACH,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;gBAAS,CAAC;YACT,IAAI,C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,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;gBAChD,mEAAmE;gBACnE,mEAAmE;gBACnE,sDAAsD;gBACtD,kEAAkE;gBAClE,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;gBACxC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;gBACnB,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;gBAChB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAAC,OAAO,GAAG,IAAI,CAAC;oBAAC,MAAM;gBAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,GAAG,EAAE,CAAC;YACR,CAAC;QACH,CAAC;QAED,sEAAsE;QACtE,oEAAoE;QACpE,uEAAuE;QACvE,qEAAqE;QACrE,wDAAwD;QACxD,IAAI,OAAO,IAAI,QAAQ;YAAE,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IACrD,CAAC;CACF"}
@@ -1,46 +1,10 @@
1
1
  /**
2
- * Resilient one-shot retry around wasm-bindgen's `init()`.
2
+ * Re-export of the shared WASM load-retry classification (issue #4247).
3
3
  *
4
- * wasm-bindgen's streaming loader rethrows on a non-OK HTTP status or a failed
5
- * fetch of `ifc-lite_bg.wasm` (it only falls back to `arrayBuffer`+`instantiate`
6
- * for the wrong-MIME case), surfacing as `TypeError: Failed to execute
7
- * 'compile' on 'WebAssembly': HTTP status code is not ok`. A transient blip — a
8
- * cold CDN edge, a mid-deploy race, a flaky proxy/antivirus — can produce a
9
- * one-off failure that a second attempt recovers.
10
- *
11
- * Extracted from the worker so it is unit-testable without a real wasm bundle.
12
- */
13
- /**
14
- * True when `message` looks like a transient transport/download failure of the
15
- * engine binary (worth one retry) rather than a genuine corrupt-module or
16
- * validation error (which must propagate immediately so real bugs aren't
17
- * masked).
18
- *
19
- * Per the WebAssembly Web API, the streaming loader validates the HTTP response
20
- * (status, MIME, CORS) and rejects with a `TypeError` BEFORE compiling, so only
21
- * those transport failures are retry-worthy. Invalid bytes (corrupt module,
22
- * wrong magic header) reject with a `CompileError` — retrying just refetches
23
- * the same bad bytes, so those fail fast.
24
- */
25
- export declare function isTransientWasmLoadError(message: string): boolean;
26
- export interface InitWasmRetryOptions {
27
- /** Delay before the single retry. Default 300ms; pass 0 in tests. */
28
- retryDelayMs?: number;
29
- /** Injected sleep (tests pass an instant resolver). */
30
- sleep?: (ms: number) => Promise<void>;
31
- /** Injected logger (defaults to `console.warn`). */
32
- warn?: (message: string) => void;
33
- /** Context label for the log line. */
34
- label?: string;
35
- }
36
- /**
37
- * Run `init` once; on a transient-looking failure, wait and retry exactly once.
38
- * Non-transient failures propagate without a retry. The second failure (if any)
39
- * propagates to the caller — attributed to the engine binary when the browser's
40
- * own wording identifies nothing (see {@link attributeEngineLoadFailure}).
41
- *
42
- * @param init Thunk that performs the actual `init(...)` call (so callers can
43
- * bind their own wasm URL / arguments).
4
+ * The real implementation lives in `@ifc-lite/wasm-lifecycle` so
5
+ * `@ifc-lite/geometry` and `@ifc-lite/parser` share exactly one copy of the
6
+ * transient-vs-fatal WASM load-failure logic instead of maintaining two
7
+ * independently-editable "twin" files.
44
8
  */
45
- export declare function initWasmWithRetry(init: () => Promise<unknown>, options?: InitWasmRetryOptions): Promise<void>;
9
+ export { initWasmWithRetry, isTransientWasmLoadError, type InitWasmRetryOptions, } from '@ifc-lite/wasm-lifecycle';
46
10
  //# sourceMappingURL=wasm-init-retry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-init-retry.d.ts","sourceRoot":"","sources":["../src/wasm-init-retry.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOjE;AA6CD,MAAM,WAAW,oBAAoB;IACnC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,oDAAoD;IACpD,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
1
+ {"version":3,"file":"wasm-init-retry.d.ts","sourceRoot":"","sources":["../src/wasm-init-retry.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC"}
@@ -2,105 +2,12 @@
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
- * Resilient one-shot retry around wasm-bindgen's `init()`.
5
+ * Re-export of the shared WASM load-retry classification (issue #4247).
6
6
  *
7
- * wasm-bindgen's streaming loader rethrows on a non-OK HTTP status or a failed
8
- * fetch of `ifc-lite_bg.wasm` (it only falls back to `arrayBuffer`+`instantiate`
9
- * for the wrong-MIME case), surfacing as `TypeError: Failed to execute
10
- * 'compile' on 'WebAssembly': HTTP status code is not ok`. A transient blip — a
11
- * cold CDN edge, a mid-deploy race, a flaky proxy/antivirus — can produce a
12
- * one-off failure that a second attempt recovers.
13
- *
14
- * Extracted from the worker so it is unit-testable without a real wasm bundle.
15
- */
16
- /**
17
- * True when `message` looks like a transient transport/download failure of the
18
- * engine binary (worth one retry) rather than a genuine corrupt-module or
19
- * validation error (which must propagate immediately so real bugs aren't
20
- * masked).
21
- *
22
- * Per the WebAssembly Web API, the streaming loader validates the HTTP response
23
- * (status, MIME, CORS) and rejects with a `TypeError` BEFORE compiling, so only
24
- * those transport failures are retry-worthy. Invalid bytes (corrupt module,
25
- * wrong magic header) reject with a `CompileError` — retrying just refetches
26
- * the same bad bytes, so those fail fast.
27
- */
28
- export function isTransientWasmLoadError(message) {
29
- // Fail fast on genuine module-validation errors even if a transport-ish word
30
- // somehow appears in the message.
31
- if (/compileerror|validation error|magic (?:word|number)|invalid (?:wasm|module)/i.test(message)) {
32
- return false;
33
- }
34
- return /HTTP status code is not ok|failed to fetch|network ?error|load failed/i.test(message);
35
- }
36
- /**
37
- * A message that already names the thing that failed to load, so re-throwing it
38
- * with an attribution prefix would only add noise. Deliberately includes
39
- * `WebAssembly` (the `'compile' on 'WebAssembly'` phrasings) — those are exactly
40
- * the signatures `isWasmAssetUnavailableError` (wasm-asset-error.ts) matches to
41
- * drive the #1363 stale-deploy reload, and they must reach it byte-for-byte.
42
- */
43
- const SELF_IDENTIFYING = /wasm|webassembly/i;
44
- /**
45
- * A failed *module* load already carries its own specifier. Prefixing one with
46
- * `ifc-lite_bg.wasm` would make it look to that same #1363 matcher like a
47
- * rotated ENGINE BINARY (`/\.wasm/` + "dynamically imported module") and
48
- * trigger a spurious page reload, so those are passed through untouched.
49
- */
50
- const MODULE_LOAD_FAILURE = /dynamically imported module|module script/i;
51
- /**
52
- * Name the engine binary in a transport failure that names nothing (issue #1903).
53
- *
54
- * wasm-bindgen's generated loader `await`s the `fetch()` it starts, so a
55
- * network-level rejection propagates RAW: WebKit words it `TypeError: Load
56
- * failed`, Chromium `TypeError: Failed to fetch`, and because the rejection
57
- * originates inside the fetch rather than in our frames it carries an EMPTY
58
- * stack. Two words and no frames is unattributable by construction — the toast,
59
- * `classifyLoadError` in the viewer, and error tracking all see a bare
60
- * `TypeError` that could have come from anywhere in the load.
61
- *
62
- * So when the final failure identifies nothing, re-throw it naming the binary
63
- * and the call site, preserving the original as `.cause`. Anything that already
64
- * identifies itself is returned unchanged.
65
- */
66
- function attributeEngineLoadFailure(error, label) {
67
- if (!(error instanceof Error))
68
- return error;
69
- const msg = error.message;
70
- if (!isTransientWasmLoadError(msg))
71
- return error;
72
- if (SELF_IDENTIFYING.test(msg) || MODULE_LOAD_FAILURE.test(msg))
73
- return error;
74
- return new Error(`Failed to load the WASM engine binary (ifc-lite_bg.wasm) in ${label}: ${msg}`, { cause: error });
75
- }
76
- const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
77
- /**
78
- * Run `init` once; on a transient-looking failure, wait and retry exactly once.
79
- * Non-transient failures propagate without a retry. The second failure (if any)
80
- * propagates to the caller — attributed to the engine binary when the browser's
81
- * own wording identifies nothing (see {@link attributeEngineLoadFailure}).
82
- *
83
- * @param init Thunk that performs the actual `init(...)` call (so callers can
84
- * bind their own wasm URL / arguments).
7
+ * The real implementation lives in `@ifc-lite/wasm-lifecycle` so
8
+ * `@ifc-lite/geometry` and `@ifc-lite/parser` share exactly one copy of the
9
+ * transient-vs-fatal WASM load-failure logic instead of maintaining two
10
+ * independently-editable "twin" files.
85
11
  */
86
- export async function initWasmWithRetry(init, options = {}) {
87
- const { retryDelayMs = 300, sleep = defaultSleep, warn = console.warn, label = 'wasm' } = options;
88
- try {
89
- await init();
90
- return;
91
- }
92
- catch (err) {
93
- const msg = err instanceof Error ? err.message : String(err);
94
- if (!isTransientWasmLoadError(msg))
95
- throw err;
96
- warn(`[${label}] WASM engine load failed (${msg}); retrying once`);
97
- await sleep(retryDelayMs);
98
- try {
99
- await init();
100
- }
101
- catch (retryErr) {
102
- throw attributeEngineLoadFailure(retryErr, label);
103
- }
104
- }
105
- }
12
+ export { initWasmWithRetry, isTransientWasmLoadError, } from '@ifc-lite/wasm-lifecycle';
106
13
  //# sourceMappingURL=wasm-init-retry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-init-retry.js","sourceRoot":"","sources":["../src/wasm-init-retry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;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GAAG,OAAO,CAAC;IAClG,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC;YAAE,MAAM,GAAG,CAAC;QAC9C,IAAI,CAAC,IAAI,KAAK,8BAA8B,GAAG,kBAAkB,CAAC,CAAC;QACnE,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,IAAI,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,QAAQ,EAAE,CAAC;YAClB,MAAM,0BAA0B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"wasm-init-retry.js","sourceRoot":"","sources":["../src/wasm-init-retry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AACH,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC"}
@@ -1,67 +1,11 @@
1
1
  /**
2
- * Forward a worker realm's wasm panic-location stash to the main thread
3
- * (#2527 follow-up).
2
+ * Re-export of the shared worker-to-main-thread wasm panic-location forwarder
3
+ * (issue #4247).
4
4
  *
5
- * The Rust panic hook (`rust/wasm-bindings/src/utils.rs`) stashes
6
- * `{ location, at }` on whichever realm's JS global it runs in — `self` in a
7
- * worker, `window` on the main thread. #2527 taught the main thread to read
8
- * its OWN global's stash and attach it to a trap's exception event
9
- * (`apps/viewer/src/lib/analytics-scrub.ts`'s `attachWasmPanicLocation`), but
10
- * a worker-realm trap leaves that stash stranded in the worker's global,
11
- * which the main thread can never see across the realm boundary.
12
- *
13
- * `takeWasmPanicStash` reads + consumes the stash worker-side so it can ride
14
- * the worker's own `{type:'error'}` message; `restashWasmPanicLocation`
15
- * re-plants it on the main thread's global so the EXISTING #2527 gate (same
16
- * key, same TTL, same consume-once semantics) picks it up unmodified.
17
- *
18
- * Location only, never the panic's message — the message can embed
19
- * model-derived text (see `utils.rs`'s privacy contract); the location alone
20
- * travels on the error message and through this module.
21
- *
22
- * NOTE: this file is intentionally byte-identical to
23
- * `packages/geometry/src/wasm-panic-forward.ts` — both `@ifc-lite/geometry`
24
- * and `@ifc-lite/parser` need the exact same realm-forwarding contract, and
25
- * neither package depends on the other (nor is `@ifc-lite/wasm`, the one
26
- * package both DO depend on, a safe home: it ships only the wasm-pack build
27
- * output, with no TypeScript build step of its own, and `test`/`typecheck`
28
- * for either consumer already runs its build via turbo's `^build` — adding a
29
- * hand-written TS module there would make every geometry/parser test run
30
- * gate on a full Rust→wasm rebuild). Keep any change to one copy in lockstep
31
- * with the other; `wasm-panic-forward.test.ts` is duplicated the same way.
32
- */
33
- /** Kept in lockstep with `PANIC_STASH_KEY` in `rust/wasm-bindings/src/utils.rs`,
34
- * `WASM_PANIC_STASH_KEY` in `apps/viewer/src/lib/analytics-scrub.ts`, and this
35
- * module's twin at `packages/geometry/src/wasm-panic-forward.ts`. */
36
- export declare const WASM_PANIC_STASH_KEY = "__ifclite_wasm_panic";
37
- export interface WasmPanicStash {
38
- location: string;
39
- at: number;
40
- }
41
- /**
42
- * Worker-side: read and CONSUME this realm's panic stash so it can be
43
- * forwarded on the worker's own error message. Consume-once regardless of
44
- * shape validity — an unconsumed malformed stash must not linger to
45
- * mislabel a later trap, mirroring the main-thread gate's own rule.
46
- */
47
- export declare function takeWasmPanicStash(realm: object): WasmPanicStash | undefined;
48
- /**
49
- * Main-side: re-plant a worker-forwarded stash on this realm's global so the
50
- * existing #2527 `attachWasmPanicLocation` gate consumes it unmodified.
51
- *
52
- * Gated on `errorMessage` looking like a wasm trap: the worker forwards
53
- * `wasmPanicLocation`/`wasmPanicAt` on ANY `{type:'error'}` message (a stale
54
- * stash from an earlier suppressed panic can ride out on an ordinary,
55
- * non-trap worker error), and re-planting unconditionally would let that
56
- * stale location sit on `globalThis` until an unrelated trap-shaped
57
- * exception consumed it — mislabeling that trap. Only a message that itself
58
- * looks like a wasm trap is allowed to re-plant.
59
- *
60
- * Never clobbers an existing, unconsumed stash — a genuine main-thread trap
61
- * that hasn't been captured yet must win over a worker trap that merely
62
- * arrived first (the older-looking stash, if stale, is simply dropped later
63
- * by the TTL check at attach time; this function never overwrites either
64
- * way).
5
+ * The real implementation lives in `@ifc-lite/wasm-lifecycle` so
6
+ * `@ifc-lite/geometry` and `@ifc-lite/parser` share exactly one copy of the
7
+ * #2527 realm-forwarding contract instead of maintaining two
8
+ * independently-editable "twin" files.
65
9
  */
66
- export declare function restashWasmPanicLocation(realm: object, location: unknown, at: unknown, errorMessage: string): void;
10
+ export { WASM_PANIC_STASH_KEY, takeWasmPanicStash, restashWasmPanicLocation, type WasmPanicStash, } from '@ifc-lite/wasm-lifecycle';
67
11
  //# sourceMappingURL=wasm-panic-forward.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-panic-forward.d.ts","sourceRoot":"","sources":["../src/wasm-panic-forward.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;sEAEsE;AACtE,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAgB3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAeD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAK5E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,EAAE,EAAE,OAAO,EACX,YAAY,EAAE,MAAM,GACnB,IAAI,CAON"}
1
+ {"version":3,"file":"wasm-panic-forward.d.ts","sourceRoot":"","sources":["../src/wasm-panic-forward.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,cAAc,GACpB,MAAM,0BAA0B,CAAC"}
@@ -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
- * Forward a worker realm's wasm panic-location stash to the main thread
6
- * (#2527 follow-up).
5
+ * Re-export of the shared worker-to-main-thread wasm panic-location forwarder
6
+ * (issue #4247).
7
7
  *
8
- * The Rust panic hook (`rust/wasm-bindings/src/utils.rs`) stashes
9
- * `{ location, at }` on whichever realm's JS global it runs in — `self` in a
10
- * worker, `window` on the main thread. #2527 taught the main thread to read
11
- * its OWN global's stash and attach it to a trap's exception event
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/geometry/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/geometry/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/geometry/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 function restashWasmPanicLocation(realm, location, at, errorMessage) {
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;;;;;;;;;;;;;;;;;;;;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C;IAC/C,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC;QAAE,OAAO;IAC7C,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,IAAI,CAAC,CAAC,oBAAoB,CAAC,KAAK,SAAS;QAAE,OAAO;IAClD,CAAC,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC"}
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/parser",
3
- "version": "5.2.0",
3
+ "version": "6.1.0",
4
4
  "description": "IFC/STEP parser for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,10 +19,11 @@
19
19
  "dependencies": {
20
20
  "fflate": "^0.8.3",
21
21
  "jszip": "^3.10.0",
22
- "@ifc-lite/data": "^4.0.0",
22
+ "@ifc-lite/data": "^4.2.0",
23
23
  "@ifc-lite/encoding": "^2.2.0",
24
- "@ifc-lite/ifcx": "^4.0.0",
25
- "@ifc-lite/wasm": "^6.4.0"
24
+ "@ifc-lite/wasm": "^7.0.0",
25
+ "@ifc-lite/wasm-lifecycle": "^0.2.0",
26
+ "@ifc-lite/ifcx": "^4.1.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "typescript": "^6.0.3",