Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Bundle the extension with esbuild. `out/extension.js` is now a single ~64 KB minified file replacing the per-file `tsc` emit. `npm run compile` and `npm run watch` fan out into parallel typecheck (`tsc --noEmit`) + bundle (`node esbuild.mjs`) processes via `npm-run-all2`, matching the official VS Code extension sample so editor type errors and bundle errors surface side-by-side. `npm run package` runs the production esbuild step before `vsce package`. The published `.vsix` shrinks to 7 files / 35 KB (from a multi-file `out/` emit) and no longer ships uncompiled source. Lays groundwork for adding `fast-xml-parser` as a runtime dep in the upcoming SOAP-mostly migration without breaking the zero-shipped-runtime-deps posture.

## [0.4.2]

### Fixed
Expand Down
57 changes: 57 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as esbuild from 'esbuild';

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

/**
* Plugin that emits build start/end markers and TS-style diagnostics so VS
* Code's task runner can pick up errors during watch builds. Mirrors the
* pattern in the official vscode-extension-samples esbuild template.
*/
const problemMatcherPlugin = {
name: 'esbuild-problem-matcher',
setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd(result => {
for (const { text, location } of result.errors) {
console.error(`✘ [ERROR] ${text}`);
if (location) {
console.error(` ${location.file}:${location.line}:${location.column}:`);
}
}
console.log('[watch] build finished');
});
},
};

async function main() {
const ctx = await esbuild.context({
entryPoints: ['src/extension.ts'],
bundle: true,
format: 'cjs',
platform: 'node',
target: 'node18',
outfile: 'out/extension.js',
external: ['vscode'],
minify: production,
// No sourcemap in prod — keeps the .vsix lean; .vscodeignore excludes
// .map files anyway, so a linked map would be a dead reference.
sourcemap: !production,
sourcesContent: !production,
logLevel: 'silent',
plugins: [problemMatcherPlugin],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

main().catch(err => {
console.error(err);
process.exit(1);
});
Loading