Files
fusion/.gitignore
gsxdsm ad9a72176c FN-7669: pre-bundle @fusion/core gate-safe barrel to cut engine-core gate import-phase cost
Prototype and land a rebuilt-every-run esbuild bundle of the @fusion/core gate-safe barrel closure, collapsing the engine-core gate's per-fork Vite SSR import-phase cost (18 forks x ~430-file closure re-resolved from scratch) into a single file load per fork.

- Add scripts/build-engine-core-gate-bundle.mjs: esbuild-bundles packages/core/src/index.gate.ts (220 first-party files, packages:"external" so third-party/node: imports stay external, treeShaking:false to preserve side effects) into packages/core/.gate-bundle/core.mjs + core.meta.json
- Wire the builder into packages/engine/vitest.config.ts's engine-core project globalSetup (alongside the existing vitest-teardown hook) so the bundle is rebuilt fresh before every gate invocation, and repoint the @fusion/core resolve.alias at the bundled output instead of index.gate.ts source
- Place the bundle output at packages/core/.gate-bundle/ as a sibling of packages/core/node_modules/ (not nested inside it) to avoid Vite SSR's external-dep heuristic, which would otherwise silently defeat vi.mock interception for imports nested in the bundle
- Gitignore packages/core/.gate-bundle/ and add a matching ESLint ignore entry so the generated bundle text is never linted or committed
- Add esbuild ^0.25.12 as a root devDependency (pnpm-lock.yaml updated accordingly)
- Document the pre-bundling rationale, placement constraints, and measured A/B wall-time results in docs/testing.md

Verified: pnpm test:gate passes (335/335 engine-core tests, 63/63 CLI ci-shape tests), engine package typecheck clean, eslint clean on touched files.

Files changed:
 .gitignore                                |  11 ++
 docs/testing.md                           |   3 +
 eslint.config.mjs                         |  10 ++
 package.json                              |   1 +
 packages/engine/vitest.config.ts          |  50 ++++++++-
 pnpm-lock.yaml                            |   3 +
 scripts/build-engine-core-gate-bundle.mjs | 174 ++++++++++++++++++++++++++++++
 7 files changed, 247 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-7669

Fusion-Task-Lineage: 62b06b2a-4ac6-45ae-ac79-9771132bc303

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-08 04:24:30 -07:00

118 lines
3.1 KiB
Plaintext

# Environment files (may contain secrets — FUSION_DAEMON_TOKEN, etc.)
.env
.env.local
.env.*.local
# Dependencies
node_modules/
# Build output
dist/
dist-electron/
*.tsbuildinfo
# Generated i18n catalogs synced into the dashboard tree from @fusion/i18n
# (authored source-of-truth lives in packages/i18n/locales/)
packages/dashboard/app/locales/
# Desktop packaging artifacts
*.dmg
*.dmg.blockmap
*.zip
*.zip.blockmap
*.AppImage
*.exe
*.nupkg
*.tgz
*.tar.gz
*.pkg
*.msi
*.deb
*.rpm
*.snap
*.blockmap
latest*.yml
builder-debug.yml
builder-effective-config.yaml
# Coverage reports
coverage/
# hai runtime (local board state — don't commit)
.fusion/
.hai/
.worktrees/
.factory/
kb.db/
# Stray worktrees accidentally created at the repo root by the executor
# or by manual `git worktree add` invocations. Without this, any such
# directory gets captured as a 160000 gitlink by `git add -A` during
# merger amend, producing broken submodule entries in HEAD (see FN-2152).
.tmp-fn-*
.tmp-kb-*
# Pi
.pi/
# VS Code Local History (editor auto-saved snapshots)
.history/
# Sibling clone of the Homebrew tap (runfusion/homebrew-fusion); not part of this repo
homebrew-tap/
# Ad-hoc task completion notes left by agents after a run; per-session scratch,
# never meant to be committed.
.DONE
improvements.md
# FNXC:RepoHygiene 2026-06-17-00:38: Published Markdown docs embed `docs/screenshots/*.png`; keep that directory trackable so GitHub, npm-rendered docs, and fresh clones do not show broken images.
.claude/
# Local kb state and backups
.kb/
.fusion-backup/
.fusion-backup-*/
# FNXC:RepoHygiene 2026-06-14-13:34: `paseo.json` is local config generated by the external Paseo git-worktree manager.
# It can reappear whenever a developer provisions this repo with Paseo, so it must stay untracked repo-root noise.
paseo.json
# Stray runtime databases
fusion.db
fusion.db-wal
fusion.db-shm
# Capacitor mobile platform directories (generated by `cap add`)
packages/dashboard/ios/
packages/dashboard/android/
packages/mobile/ios/
packages/mobile/android/
# Per-shard vitest JSON timing reporter outputs (raw; merged into
# scripts/test-timings.json via `ci-test-shard.mjs --write-timings`).
.timings/
# Plugin hot-reload scratch artifacts
**/.index.reload-*.ts
# Dolt database files
.dolt/
*.db
# MCP server config (contains API keys)
.mcp.json
# Desktop packaging: staged flat prod closure produced by `@fusion/desktop build` (pnpm deploy)
packages/desktop/deploy/
# FNXC:EngineTests 2026-07-08-04:10:
# FN-7669 prototype: rebuilt-every-run esbuild bundle of the @fusion/core
# gate-safe barrel closure, emitted by scripts/build-engine-core-gate-bundle.mjs
# from the engine-core vitest project's globalSetup. Never committed — it is
# regenerated fresh before every gate run (no drift surface). Lives as a
# SIBLING of packages/core/node_modules/ (not nested inside it) — nesting
# inside node_modules triggers Vite's SSR external-dep heuristic and defeats
# vi.mock interception for imports nested inside the bundle; see the script
# comment (scripts/build-engine-core-gate-bundle.mjs) for the full repro.
packages/core/.gate-bundle/