fix(ui-parser): bundle as CJS so the sandboxed worker can load it
The Paperclip UI loads each adapter's ui-parser.js inside a sandboxed Web Worker via `new Function(...)` to render the run transcript. The worker can only evaluate CJS — ESM `export` syntax silently fails to register `parseStdoutLine`, and the run window falls back to dumping raw JSONL. tsc was emitting ESM `export function parseStdoutLine`, so every published version since the parser was added has shipped a parser the UI can't load. Add the same esbuild step the claude-k8s adapter uses (0.2.4) to overwrite dist/ui-parser.js with a CJS bundle that assigns to module.exports. Also bump @paperclipai/adapter-utils from a stale 2026.415.0-canary.7 pin to ^2026.428.0 (current stable). All 406 tests pass against the new types; no API drift in the imported surface. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -17,7 +17,8 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "tsc && npm run build:ui-parser",
|
||||
"build:ui-parser": "esbuild src/ui-parser.ts --bundle --format=cjs --target=es2020 --outfile=dist/ui-parser.js --log-level=warning",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run",
|
||||
@@ -28,12 +29,13 @@
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@paperclipai/adapter-utils": ">=2026.415.0-canary.7"
|
||||
"@paperclipai/adapter-utils": ">=2026.428.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@paperclipai/adapter-utils": "2026.415.0-canary.7",
|
||||
"@paperclipai/adapter-utils": "^2026.428.0",
|
||||
"@types/node": "^24.6.0",
|
||||
"@vitest/coverage-v8": "^4.1.5",
|
||||
"esbuild": "^0.24.0",
|
||||
"typescript": "^5.7.3",
|
||||
"vitest": "^4.1.4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user