-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: switched to esbuild for the build to speed up building a bit.
chore: fixed type errors and removed svd tests as this functionality no longer works.
- Loading branch information
Showing
8 changed files
with
9,224 additions
and
8,737 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const esbuild = require('esbuild'); | ||
const fs = require('fs'); | ||
|
||
const production = process.argv.includes('--production'); | ||
const watch = process.argv.includes('--watch'); | ||
const analysis = process.argv.includes('--stats'); | ||
|
||
async function main() { | ||
const options = { | ||
entryPoints: ['src/extension.ts'], | ||
bundle: true, | ||
format: 'cjs', | ||
minify: production, | ||
sourcemap: !production, | ||
sourcesContent: false, | ||
metafile: !watch, | ||
platform: 'node', | ||
outfile: 'dist/extension.js', | ||
external: ['vscode'], | ||
logLevel: 'silent', | ||
} | ||
const ctx = await esbuild.context({ | ||
...options, | ||
plugins: [ | ||
/* add to the end of plugins array */ | ||
esbuildProblemMatcherPlugin | ||
] | ||
}); | ||
if (watch) { | ||
await ctx.watch(); | ||
} else { | ||
await ctx.rebuild(); | ||
await ctx.dispose(); | ||
} | ||
if(analysis) { | ||
const res = await esbuild.build(options); | ||
const metafileAnalysis = await esbuild.analyzeMetafile(res.metafile, { | ||
}); | ||
console.log(metafileAnalysis); | ||
fs.writeFileSync('dist/meta.json', JSON.stringify(res.metafile)); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @type {import('esbuild').Plugin} | ||
*/ | ||
const esbuildProblemMatcherPlugin = { | ||
name: 'esbuild-problem-matcher', | ||
|
||
setup(build) { | ||
build.onStart(() => { | ||
console.log('[watch] build started'); | ||
}); | ||
build.onEnd(result => { | ||
result.errors.forEach(({ text, location }) => { | ||
console.error(`✘ [ERROR] ${text}`); | ||
console.error(` ${location.file}:${location.line}:${location.column}:`); | ||
}); | ||
console.log('[watch] build finished'); | ||
}); | ||
} | ||
}; | ||
|
||
main().catch(e => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.