Skip to content

build: unify extension & web build with esbuild - #21

Merged
bughht merged 1 commit into
mainfrom
feature/unified-esbuild-build
Jul 20, 2026
Merged

build: unify extension & web build with esbuild#21
bughht merged 1 commit into
mainfrom
feature/unified-esbuild-build

Conversation

@bughht

@bughht bughht commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces tsc with esbuild for the VS Code extension build, and consolidates the duplicated webview assets (JS, CSS) into shared bundles used by ALL platforms (VS Code, web, Python, MATLAB).

Problem

  • VS Code extension: built with tsc → CommonJS output with individual files
  • Web / Python / MATLAB: built with esbuild → IIFE bundle (pulseq-bundle.js)
  • Webview rendering code was duplicated across:
    • src/editor/webview/assets/*.js (5 files, read by extension)
    • web/index.html inline script (full copy)
    • web/derived-series.js (exact copy of one asset file)
    • python/src/seqeyes/resources/viewer.html (full copy)
  • CSS was duplicated between styles.css and inline <style> in web/index.html

This caused "tiny differences" between platforms that were hard to track down.

Changes

New build scripts (both use esbuild)

Script Purpose
scripts/build-extension.mjs Bundles src/extension.tsout/extension.js (CJS, supports --watch)
scripts/build-webview.mjs Concatenates 5 webview JS assets → web/webview-bundle.js + copies CSS/HTML

Unified assets

Before After
5 separate JS assets + web/derived-series.js duplicate Single webview-bundle.js shared by all platforms
CSS duplicated in styles.css + web/index.html inline Single web/styles.css referenced via <link>
tsc for extension, esbuild for web esbuild for everything

Updated files

  • src/editor/webviewContent.ts — reads webview-bundle.js (with corrected path for esbuild bundle layout)
  • web/index.html — external CSS via <link>, loads webview-bundle.js
  • package.jsoncompile/watch/build:web now use esbuild; typecheck uses tsc --noEmit
  • matlab/seqeyes.m & matlab/pack_toolbox.m — updated asset references
  • test/vscode/package-smoke.cjs — updated to check for bundled structure
  • .vscode/launch.json — added for F5 debugging
  • web/derived-series.jsdeleted (now part of webview-bundle.js)

Build pipeline (after)

src/pulseq/*.ts        → esbuild → web/pulseq-bundle.js    (IIFE, global Pulseq)
src/extension.ts       → esbuild → out/extension.js         (CJS, external vscode)
webview/assets/*.js    → concat  → web/webview-bundle.js    (shared by all)
webview/assets/styles.css → copy → web/styles.css           (shared by all)

Testing

  • npm run compile succeeds (esbuild)
  • npm run build:web succeeds
  • npm run typecheck succeeds (tsc --noEmit)
  • F5 launches Extension Development Host with SeqEyes active
  • Opening .seq/.bseq files renders the viewer correctly
  • vitest: 107/110 tests pass (3 pre-existing failures unrelated to this PR)

Replace tsc with esbuild for the VS Code extension build, and consolidate
the duplicated webview assets into a single shared bundle.

- Add scripts/build-extension.mjs (esbuild, CJS, --watch support)
- Add scripts/build-webview.mjs (concatenates 5 webview JS assets + CSS)
- Update webviewContent.ts to read webview-bundle.js instead of 5 files
- Externalize CSS in web/index.html — reference shared styles.css
- Replace web/derived-series.js with web/webview-bundle.js
- Update MATLAB pack_toolbox.m and seqeyes.m for new asset names
- Update package smoke test for bundled output structure
- Add .vscode/launch.json for F5 extension debugging
- Update package.json scripts: compile→esbuild, add typecheck, watch→esbuild watch
@bughht
bughht requested a review from Copilot July 20, 2026 23:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bughht
bughht merged commit df5db9d into main Jul 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants