Shakespeare's esbuild-wasm pipeline now handles the Vite/webpack-compatible
patterns for module workers and static asset URLs, so projects using
new Worker(new URL('./w.ts', import.meta.url), { type: 'module' })
new SharedWorker(new URL('./w.ts', import.meta.url), { type: 'module' })
new URL('./logo.svg', import.meta.url)
build correctly under Shakespeare instead of emitting a 404'ing URL
that pointed at the source-file path inside the main bundle.
Mechanics:
- A new detection pass (src/lib/build/workerPlugin.ts) is invoked from
the fs plugin's onLoad for .ts/.tsx/.js/.jsx/.mjs files. It cheaply
regex-prefilters on 'new URL(' so 99% of files pay zero overhead,
then strips TS/JSX via esbuild.transform and parses with acorn +
acorn-jsx for the handful of files that actually match. The string
literal spec inside each matched new URL() call is replaced with a
unique placeholder token, preserving the enclosing new URL(...,
import.meta.url) shape so runtime resolution against the main
bundle URL still works.
- bundle() now runs a per-worker sub-build (esbuild.build) with the
same plugin stack, producing a hashed ESM chunk alongside the main
output. The queue drains recursively so nested workers / assets
discovered during a sub-build are handled in the same bundle call.
- Non-source assets are copied into the output with content-hashed
filenames (SHA-256 when SubtleCrypto is available, FNV-1a fallback
for test environments).
- After all sub-builds finish, placeholder tokens are string-replaced
in every JS output with the corresponding './<emitted-filename>'.
- updateCSPForEsmSh gains an emittedWorkers option; when set it
additionally ensures worker-src and child-src exist and extends
them with the ESM CDN so module workers can import from esm.sh.
Errors (with file:line context) are raised for classic (non-module)
workers, dynamic specifiers, and unresolvable worker specs. Plain
new URL() pointing at a source file emits a console warning and is
left untransformed.
Tests: 16 new workerPlugin unit tests cover detection, errors,
dedup, and quote-style handling; 4 new CSP tests cover the
emittedWorkers path.
- Implement useGitFetch hook with 60-second polling
- Add toast notifications for remote changes detection
- Update GitDialog to show fetch status and manual refresh
- Add comprehensive tests for useGitFetch
- Update AGENTS.md documentation
- abstract simple time ago data function