|
1 | 1 | import { gray, red } from "ansi-colors"; |
2 | | -import { dest, watch } from "gulp"; |
3 | | -import { init, write } from "gulp-sourcemaps"; |
4 | | -import * as ts from "gulp-typescript"; |
5 | | -import * as del from "del"; |
| 2 | +import { dest, src, watch } from "gulp"; |
| 3 | +import esbuild from "gulp-esbuild"; |
| 4 | +import ts from "gulp-typescript"; |
| 5 | +import del from "del"; |
6 | 6 |
|
7 | 7 | function goodReporter(): ts.reporter.Reporter { |
8 | 8 | return { |
@@ -35,20 +35,35 @@ export function cleanOutput() { |
35 | 35 | : Promise.resolve(); |
36 | 36 | } |
37 | 37 |
|
38 | | -export function compileTypeScript() { |
39 | | - return tsProject |
40 | | - .src() |
41 | | - .pipe(init()) |
42 | | - .pipe(tsProject(goodReporter())) |
| 38 | +export function compileEsbuild() { |
| 39 | + return src("./src/extension.ts") |
43 | 40 | .pipe( |
44 | | - write(".", { |
45 | | - includeContent: false, |
46 | | - sourceRoot: ".", |
| 41 | + esbuild({ |
| 42 | + outfile: "extension.js", |
| 43 | + bundle: true, |
| 44 | + external: ["vscode", "fsevents"], |
| 45 | + format: "cjs", |
| 46 | + platform: "node", |
| 47 | + target: "es2020", |
| 48 | + sourcemap: "linked", |
| 49 | + loader: { |
| 50 | + ".node": "copy", |
| 51 | + }, |
47 | 52 | }), |
48 | 53 | ) |
49 | 54 | .pipe(dest("out")); |
50 | 55 | } |
51 | 56 |
|
52 | | -export function watchTypeScript() { |
53 | | - watch("src/**/*.ts", compileTypeScript); |
| 57 | +export function watchEsbuild() { |
| 58 | + watch("src/**/*.ts", compileEsbuild); |
| 59 | +} |
| 60 | + |
| 61 | +export function checkTypeScript() { |
| 62 | + // This doesn't actually output the TypeScript files, it just |
| 63 | + // runs the TypeScript compiler and reports any errors. |
| 64 | + return tsProject.src().pipe(tsProject(goodReporter())); |
| 65 | +} |
| 66 | + |
| 67 | +export function watchCheckTypeScript() { |
| 68 | + watch("src/**/*.ts", checkTypeScript); |
54 | 69 | } |
0 commit comments