!911 split for preview and pipe with check

Merge pull request !911 from 卡哥/cherry-pick-1659599232
This commit is contained in:
openharmony_ci
2022-08-04 10:49:30 +00:00
committed by Gitee
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ function init(port) {
}
rootFileNames.push(previewCacheFilePath);
ts.createWatchProgram(
createWatchCompilerHost(rootFileNames, resolveDiagnostic, delayPrintLogCount));
createWatchCompilerHost(rootFileNames, resolveDiagnostic, delayPrintLogCount, true));
const wss = new WebSocketServer({port: port});
wss.on('connection', function(ws) {
pluginSocket = ws;
+4 -2
View File
@@ -163,7 +163,7 @@ function resolveModuleNames(moduleNames: string[], containingFile: string): ts.R
}
export function createWatchCompilerHost(rootFileNames: string[],
reportDiagnostic: ts.DiagnosticReporter, delayPrintLogCount: Function
reportDiagnostic: ts.DiagnosticReporter, delayPrintLogCount: Function, isPipe: boolean = false
): ts.WatchCompilerHostOfFilesAndCompilerOptions<ts.BuilderProgram> {
setCompilerOptions();
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
@@ -173,7 +173,9 @@ export function createWatchCompilerHost(rootFileNames: string[],
(diagnostic: ts.Diagnostic) => {
// End of compilation in watch mode flag.
if ([6193, 6194].includes(diagnostic.code)) {
process.env.watchTs = 'end';
if (!isPipe) {
process.env.watchTs = 'end';
}
delayPrintLogCount();
}
});