-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuildTsPlugin.mjs
More file actions
33 lines (31 loc) · 929 Bytes
/
buildTsPlugin.mjs
File metadata and controls
33 lines (31 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//@ts-check
import buildTsPlugin from '@zardoy/vscode-utils/build/buildTypescriptPlugin.js'
import fs from 'fs'
const enableWatch = process.argv.includes('--watch')
const result = await buildTsPlugin('typescript', undefined, undefined, {
minify: !enableWatch,
metafile: true,
define: {
'import.meta': '{}',
},
banner: {
js: 'let ts, tsFull;',
},
external: ['perf_hooks'],
plugins: [
{
name: 'watch-notifier',
setup(build) {
const writeStatus = (/** @type {number} */ signal) => {
fs.writeFileSync('./out/build_plugin_result', signal.toString())
}
build.onStart(() => {
writeStatus(0)
})
build.onEnd(({ errors }) => {
writeStatus(errors.length ? 2 : 1)
})
},
},
],
})