build: unify extension & web build with esbuild - #21
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
tscwithesbuildfor 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
tsc→ CommonJS output with individual filesesbuild→ IIFE bundle (pulseq-bundle.js)src/editor/webview/assets/*.js(5 files, read by extension)web/index.htmlinline script (full copy)web/derived-series.js(exact copy of one asset file)python/src/seqeyes/resources/viewer.html(full copy)styles.cssand inline<style>inweb/index.htmlThis caused "tiny differences" between platforms that were hard to track down.
Changes
New build scripts (both use esbuild)
scripts/build-extension.mjssrc/extension.ts→out/extension.js(CJS, supports--watch)scripts/build-webview.mjsweb/webview-bundle.js+ copies CSS/HTMLUnified assets
web/derived-series.jsduplicatewebview-bundle.jsshared by all platformsstyles.css+web/index.htmlinlineweb/styles.cssreferenced via<link>tscfor extension,esbuildfor webUpdated files
src/editor/webviewContent.ts— readswebview-bundle.js(with corrected path for esbuild bundle layout)web/index.html— external CSS via<link>, loadswebview-bundle.jspackage.json—compile/watch/build:webnow use esbuild;typecheckusestsc --noEmitmatlab/seqeyes.m&matlab/pack_toolbox.m— updated asset referencestest/vscode/package-smoke.cjs— updated to check for bundled structure.vscode/launch.json— added for F5 debuggingweb/derived-series.js— deleted (now part ofwebview-bundle.js)Build pipeline (after)
Testing
npm run compilesucceeds (esbuild)npm run build:websucceedsnpm run typechecksucceeds (tsc --noEmit).seq/.bseqfiles renders the viewer correctly