fix(ui-parser): emit dist as CJS so the sandboxed worker can load it

tsc emitted ESM `export` syntax that the UI's `new Function(...)` sandbox
can't evaluate, so parseStdoutLine never registered and the run window
fell back to dumping raw stream-json. Add an esbuild step that overwrites
dist/ui-parser.js with a CJS bundle assigning to module.exports.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 06:51:18 -04:00
parent c326d2571e
commit 0e43811304
3 changed files with 608 additions and 143 deletions
+3 -1
View File
@@ -25,7 +25,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",
@@ -43,6 +44,7 @@
"@paperclipai/adapter-utils": "2026.415.0-canary.7",
"@types/node": "^24.6.0",
"@vitest/coverage-v8": "^4.1.4",
"esbuild": "^0.24.0",
"typescript": "^5.7.3",
"vitest": "^4.1.4"
}