Ludwig J. Marx

IFC toolkit: WebGPU rendering, columnar store, exact-arithmetic geometry kernel.

fix(parser): point the published worker URL at the file the package ships

pull request
LTplus-AG/ifc-lite#4900
language
TypeScript · MPL-2.0
diff
9 files, +699 -1
status
merged 2026-09-17

GitHub API, read 2026-09-21 09:10 UTC, at render

Problem

  • dist/worker-parser.js carried new URL('./parser.worker.ts', import.meta.url) verbatim from source, while the tarball ships only dist/parser.worker.js.
  • new WorkerParser() rejected through worker.onerror for every npm consumer, and a bundler that resolves the literal at build time failed outright.
Against the published package, not inferred from the tree. 7.0.0 is latest; 6.5.0 answers identically.
$ curl -s https://cdn.jsdelivr.net/npm/@ifc-lite/parser@7.0.0/dist/worker-parser.js | grep -n "parser.worker.ts"
57:   : new Worker(new URL('./parser.worker.ts', import.meta.url), { type: 'module' });

$ curl -s -o /dev/null -w "%{http_code}\n" .../dist/parser.worker.ts
404
$ curl -s -o /dev/null -w "%{http_code}\n" .../dist/parser.worker.js
200

Change

  • The build rewrites the emitted specifiers to the .js file tsc produced.
  • A second step re-derives from the emitted files alone whether every new URL('./…', import.meta.url) resolves to something dist holds, and fails the build when one does not.

Two steps, because the second is the half that was missing

  • @ifc-lite/geometry has rewritten its worker URLs since #633 and shipped the same defect again in #637, when the rewrite named the dist files to touch and missed one.
  • Nothing looked at the output, and a rewrite that quietly does nothing produces the same green build as one that works.
  • Neither step here carries a list of files. The rewrite walks all 120 emitted files and touches only a specifier whose .js sibling tsc actually emitted; one without a sibling is left in place and reported, since rewriting it would swap one missing file for another and hide it from the verifier.
The verifier against the unfixed build: tsc alone, rewrite step not run
$ pnpm exec tsc && node ./scripts/verify-dist-worker-urls.mjs
verify-dist-worker-urls: 1 specifier(s) point at a file this package does not ship:
  dist/worker-parser.js: ./parser.worker.ts
-> exit 1
After the full build
$ pnpm --filter @ifc-lite/parser build
rewrite-worker-urls: scanned 120 emitted file(s), rewrote 1.
  worker-parser.js: ./parser.worker.ts -> ./parser.worker.js
verify-dist-worker-urls: 1 URL specifier(s) in 120 emitted file(s) all resolve.

Deliberately not in this diff

left outwhy
repo-wide pack-level gateChanges geometry and pointcloud, two further published packages. Own issue, not a wider diff.
the optional exports additionChanges the public surface, which a patch release should not.