[chore]: simplify build for browser-side scripts

Merged
SE
7mo ago
+225-353

why

what changed

test plan


Summary by cubic

Unifies the build for browser-injected DOM scripts by replacing four generators with a single builder. Simplifies the pipeline and removes redundant file copying, with no runtime changes expected.

  • Refactors

    • Added scripts/build-dom-scripts.ts to build all DOM-injected assets: IIFE strings for piercer.entry.ts and rerenderMissingShadows.entry.ts; bootstrap + per-function sources for locator (__stagehandLocatorScripts) and a11y (__stagehandA11yScripts); sources-only for screenshot scripts.
    • Removed genDomScripts.ts, genLocatorScripts.ts, genScreenshotScripts.ts, genA11yScripts.ts.
    • Updated packages/core/package.json to a single build-dom-scripts command and simplified turbo.json to one task with lib/v3/dom/build/** outputs.
    • Removed JS copy steps from scripts/build-cjs.ts and scripts/build-esm.ts; generated TS emits compile with the rest of the package.
    • Updated tsconfig.json to include generated files (removed old gen*.ts exclude).
  • Migration

    • Use pnpm run build-dom-scripts; the old build-dom-scripts:* scripts are removed.