fix(workers): replaced file-URL import pattern with compiled-binary-aware spawn

- Replaced `with { type: "file" }` worker imports with `isCompiledBinary()` hybrid: literal string for `--compile` static analysis, `new URL(import.meta.url)` for dev portability.
- Added worker entrypoints as explicit `--compile` args in `build-binary.ts` so Bun emits them into bunfs.
- Added `smokeTestSyncWorker` and `omp --smoke-test` to catch silent worker-load failures in compiled binaries (fixes #1011, #1027).
- Added `isCompiledBinary()` utility to `@oh-my-pi/pi-utils` detecting bunfs path markers.
This commit is contained in:
can1357
2026-05-12 16:39:42 +02:00
parent ab4416f5bb
commit 1cb451a071
11 changed files with 179 additions and 41 deletions
+7
View File
@@ -21,6 +21,13 @@ smoke_cli() {
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --version
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --help >/dev/null
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" stats --summary >/dev/null
# Spawns the stats sync worker via `new Worker(...)` and waits for a pong.
# Regression probe for #1011 (browser tab worker) and #1027 (stats sync
# worker) — both broke silently in compiled binaries because the `with
# { type: "file" }` import pattern only copies the worker as a raw asset
# without bundling its imports. `stats --summary` doesn't catch this on a
# fresh install (no session files = no Worker spawn).
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --smoke-test
}
find_tarball() {