convert inline worker generation to a post-processing step#449
convert inline worker generation to a post-processing step#449Devin T. Currie (DTCurrie) wants to merge 18 commits into
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…labs/motion-tools into make-worker-transform-post-process
…rker-transform-post-process
…rker-transform-post-process
|
|
Claude (@claude) I just updated this PR after it was stale for a while. Review the changes, ensure they are correct, and confirm that no other changes to the codebase since this was written will affect this PR. |
|
Claude finished Devin T. Currie (@DTCurrie)'s task in 3m 35s —— View job PR Review: convert inline worker generation to a post-processing step
SummaryThe approach is sound — post-processing Critical
The README describes the correct flow:
MinorRegex fragility in
Missing
Codebase changes since PR was writtenThe PR has been rebased/merged against main multiple times (most recently at The PR is blocked on the wireit ordering fix — without it, |
Claude (@claude) make these fixes |
|
Claude finished Devin T. Currie (@DTCurrie)'s task in 2s —— View job Applied all review fixes
What was changed (commit
|
- package command now runs svelte-package && node scripts/post-process-workers.js && publint so post-processing happens after dist/ is created, not before - remove build:workers from package, vite-build, and check wireit dependencies - fix build:workers wireit metadata: correct files reference and empty output array - remove pnpm build:workers from prepare and check:watch scripts - use replaceAll in post-process-workers.js to handle duplicate worker patterns - use ./worker.js (relative path) in pcd/index.ts Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
…labs/motion-tools into make-worker-transform-post-process
…rker-transform-post-process
Web workers using
new Worker(new URL('./worker.js', import.meta.url))break when consumed as a library because Vite's dep optimizer moves the package to .vite/deps/ but the worker file doesn't follow.This PR switches from pre-generating inlined worker files in
src/libto post-processingdist/aftersvelte-package.src/lib/loaders/pcd/index.tsreverted to standardnew Worker(new URL(...))syntaxscripts/post-process-workers.jsruns aftersvelte-package, bundles workers withesbuild, and rewritesdist/to useBlobURLsscripts/README.mddocumenting both build scriptsThe previous approach (pre-generating
worker.inline.tsbeforesvelte-package) required running a build step before check, didn't support HMR for worker changes in dev, and left generated files in the source tree. Post-processingdist/solves all three: dev mode works natively with Vite, CI runscheckwithout a pre-build, and the source stays clean.I tested running locally, and the changes were reflected in HMR. By running
pnpm previewandmake upin the environments, I was able to file-drop a PCD and load it.