Skip to content

build: bundle extension with esbuild#55

Merged
tembleking merged 2 commits into
mainfrom
feat/esbuild-bundle
Jul 3, 2026
Merged

build: bundle extension with esbuild#55
tembleking merged 2 commits into
mainfrom
feat/esbuild-bundle

Conversation

@tembleking

Copy link
Copy Markdown
Member

The extension shipped every tsc-emitted file plus the full node_modules tree in the .vsix (198 files, 361KB). Bundling src/extension.ts into a single minified dist/extension.js with esbuild inlines the runtime deps (all pure JS, vscode left external) and drops node_modules from the package entirely:

Before (tsc) After (esbuild)
.vsix (compressed) 361 KB 75 KB (-79%)
Files 198 7

Faster activation too: the host resolves one module instead of ~190.

tsc is kept for type-checking (--noEmit) and for compiling tests to out/, so test coverage is unaffected. Nix (vsix.nix) already derives deps via importNpmLock, so no hash to maintain; vsce package now runs the esbuild-based vscode:prepublish.

Also fixes a pre-existing ordering-dependent flaky test in highlighters (highlightLayer relied on extension.activate() having run in another test file first, leaving vulnTreeDataProvider undefined otherwise) by stubbing it locally in setup.

Note: the pre-commit lint hook also runs npm audit, which fails on a pre-existing serialize-javascript advisory pulled in via @vscode/test-cli → mocha (no fix available, unrelated to this change). esbuild itself has zero dependencies.

The extension shipped every tsc-emitted file plus the full node_modules tree
in the .vsix (198 files, 361KB). Bundling src/extension.ts into a single
minified dist/extension.js with esbuild inlines the runtime deps (all pure JS)
and drops node_modules from the package: 7 files, 75KB (-79%), with faster
activation since the host resolves one module instead of ~190.

tsc stays for type-checking (--noEmit) and for compiling tests to out/.
Also fixes a pre-existing ordering-dependent flaky test in highlighters
(highlightLayer relied on extension.activate() having run in another test
file first) by stubbing vulnTreeDataProvider locally.
@tembleking tembleking requested a review from a team as a code owner June 29, 2026 15:42
Introduce a justfile as a thin facade over the package.json scripts plus
the nix/OS-specific glue (watch, test, lint, vsix, publish-*, update). The
test and release workflows now run inside `nix develop`, so just/node/vsce
are pinned by the flake, and the VSIX is built and published with nix
(verified byte-identical to `vsce package`, so publishing stays compatible).

lint audits dependencies but fails only when a fix is actually available,
so unfixable transitive dev vulns don't block commits.

Fix .vscodeignore to exclude the lowercase `justfile`, the nix `result`
symlink and `*.vsix`, which were leaking into the package.
@tembleking tembleking merged commit 878e2d8 into main Jul 3, 2026
5 checks passed
@tembleking tembleking deleted the feat/esbuild-bundle branch July 3, 2026 10:32
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