mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
Fix task watching
This commit is contained in:
@@ -13,7 +13,6 @@ import { compileExtensionMediaTask, compileExtensionsTask, watchExtensionsTask }
|
||||
import * as compilation from './lib/compilation.ts';
|
||||
import * as task from './lib/task.ts';
|
||||
import * as util from './lib/util.ts';
|
||||
import { useEsbuildTranspile } from './buildConfig.ts';
|
||||
|
||||
// Extension point names
|
||||
gulp.task(compilation.compileExtensionPointNamesTask);
|
||||
@@ -36,9 +35,7 @@ gulp.task(transpileClientTask);
|
||||
const compileClientTask = task.define('compile-client', task.series(util.rimraf('out'), compilation.copyCodiconsTask, compilation.compileApiProposalNamesTask, compilation.compileExtensionPointNamesTask, compilation.compileTask('src', 'out', false)));
|
||||
gulp.task(compileClientTask);
|
||||
|
||||
const watchClientTask = useEsbuildTranspile
|
||||
? task.define('watch-client', task.parallel(compilation.watchTypeCheckTask('src'), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask))
|
||||
: task.define('watch-client', task.series(util.rimraf('out'), task.parallel(compilation.watchTask('out', false), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask)));
|
||||
const watchClientTask = task.define('watch-client', task.parallel(compilation.watchTypeCheckTask('src'), compilation.watchApiProposalNamesTask, compilation.watchExtensionPointNamesTask, compilation.watchCodiconsTask));
|
||||
gulp.task(watchClientTask);
|
||||
|
||||
// All
|
||||
|
||||
@@ -171,28 +171,8 @@ export function compileTask(src: string, out: string, build: boolean, options: {
|
||||
return task;
|
||||
}
|
||||
|
||||
export function watchTask(out: string, build: boolean, srcPath: string = 'src', options?: { noEmit?: boolean }): task.StreamTask {
|
||||
|
||||
const task = () => {
|
||||
const compile = createCompile(srcPath, { build, emitError: false, transpileOnly: false, preserveEnglish: false, noEmit: options?.noEmit });
|
||||
|
||||
const src = gulp.src(`${srcPath}/**`, { base: srcPath });
|
||||
const watchSrc = watch(`${srcPath}/**`, { base: srcPath, readDelay: 200 });
|
||||
|
||||
const generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
|
||||
return watchSrc
|
||||
.pipe(generator.stream)
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
task.taskName = `watch-${path.basename(out)}`;
|
||||
return task;
|
||||
}
|
||||
|
||||
export function watchTypeCheckTask(src: string): task.StreamTask {
|
||||
const theTask = () => {
|
||||
export function watchTypeCheckTask(src: string): task.Task {
|
||||
return task.define(`watch-typecheck-${path.basename(src)}`, () => {
|
||||
const projectPath = path.join(import.meta.dirname, '../../', src, 'tsconfig.json');
|
||||
const generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
@@ -200,17 +180,18 @@ export function watchTypeCheckTask(src: string): task.StreamTask {
|
||||
const tsgoStream = watchInput.pipe(generator.stream).pipe(util.debounce(() => {
|
||||
const stream = createTsgoStream(projectPath, { taskName: 'watch-client-noEmit', noEmit: true });
|
||||
const result = es.through();
|
||||
stream.on('end', () => result.emit('end'));
|
||||
stream.on('error', err => {
|
||||
fancyLog.error(ansiColors.red('[tsgo] watch-client-noEmit failed'), err);
|
||||
stream.on('end', () => {
|
||||
result.emit('end');
|
||||
});
|
||||
return result;
|
||||
stream.on('error', err => {
|
||||
reporter(err);
|
||||
fancyLog.error(ansiColors.red('[tsgo] watch-client-noEmit failed'));
|
||||
result.emit('end');
|
||||
});
|
||||
return result.pipe(reporter.end(false));
|
||||
}));
|
||||
return tsgoStream;
|
||||
};
|
||||
theTask.taskName = `watch-typecheck-${path.basename(src)}`;
|
||||
return theTask;
|
||||
});
|
||||
}
|
||||
|
||||
const REPO_SRC_FOLDER = path.join(import.meta.dirname, '../../src');
|
||||
|
||||
Reference in New Issue
Block a user