fork-ts-checker-webpack-plugin 7.0.0-alpha.1 → 7.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -83
- package/lib/ForkTsCheckerWebpackPlugin.d.ts +15 -11
- package/lib/ForkTsCheckerWebpackPlugin.js +30 -38
- package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +6 -8
- package/lib/ForkTsCheckerWebpackPluginConfiguration.js +3 -4
- package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +4 -6
- package/lib/ForkTsCheckerWebpackPluginOptions.json +73 -111
- package/lib/ForkTsCheckerWebpackPluginState.d.ts +8 -7
- package/lib/ForkTsCheckerWebpackPluginState.js +3 -1
- package/lib/error/OperationCanceledError.js +1 -0
- package/lib/formatter/BasicFormatter.d.ts +1 -1
- package/lib/formatter/BasicFormatter.js +1 -0
- package/lib/formatter/CodeFrameFormatter.d.ts +1 -1
- package/lib/formatter/CodeFrameFormatter.js +2 -1
- package/lib/formatter/Formatter.d.ts +1 -1
- package/lib/formatter/FormatterConfiguration.d.ts +3 -3
- package/lib/formatter/FormatterConfiguration.js +21 -2
- package/lib/formatter/FormatterOptions.d.ts +11 -6
- package/lib/formatter/WebpackFormatter.d.ts +1 -1
- package/lib/formatter/WebpackFormatter.js +6 -6
- package/lib/formatter/index.d.ts +0 -1
- package/lib/formatter/index.js +16 -8
- package/lib/formatter/types/babel__code-frame.js +1 -1
- package/lib/hooks/interceptDoneToGetWebpackDevServerTap.d.ts +3 -3
- package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +1 -0
- package/lib/hooks/pluginHooks.d.ts +13 -13
- package/lib/hooks/pluginHooks.js +1 -0
- package/lib/hooks/pluginPools.d.ts +4 -0
- package/lib/hooks/pluginPools.js +28 -0
- package/lib/hooks/tapAfterCompileToAddDependencies.d.ts +3 -3
- package/lib/hooks/tapAfterCompileToAddDependencies.js +1 -0
- package/lib/hooks/tapAfterCompileToGetIssues.d.ts +3 -3
- package/lib/hooks/tapAfterCompileToGetIssues.js +2 -1
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.d.ts +2 -2
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +4 -1
- package/lib/hooks/tapDoneToAsyncGetIssues.d.ts +3 -3
- package/lib/hooks/tapDoneToAsyncGetIssues.js +6 -5
- package/lib/hooks/tapErrorToLogMessage.d.ts +2 -2
- package/lib/hooks/tapErrorToLogMessage.js +4 -3
- package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +5 -5
- package/lib/hooks/tapStartToConnectAndRunReporter.js +47 -22
- package/lib/hooks/tapStopToDisconnectReporter.d.ts +4 -4
- package/lib/hooks/tapStopToDisconnectReporter.js +7 -4
- package/lib/issue/Issue.d.ts +2 -3
- package/lib/issue/Issue.js +2 -3
- package/lib/issue/IssueConfiguration.d.ts +3 -3
- package/lib/issue/IssueConfiguration.js +1 -0
- package/lib/issue/IssueLocation.d.ts +2 -2
- package/lib/issue/IssueLocation.js +17 -2
- package/lib/issue/IssueMatch.d.ts +3 -3
- package/lib/issue/IssueMatch.js +3 -3
- package/lib/issue/IssueOptions.d.ts +2 -2
- package/lib/issue/IssuePosition.js +1 -0
- package/lib/issue/IssuePredicate.d.ts +1 -1
- package/lib/issue/IssuePredicate.js +1 -0
- package/lib/issue/IssueSeverity.js +1 -0
- package/lib/issue/IssueWebpackError.d.ts +3 -3
- package/lib/issue/IssueWebpackError.js +7 -5
- package/lib/issue/index.js +13 -6
- package/lib/logger/LoggerConfiguration.d.ts +3 -3
- package/lib/logger/LoggerConfiguration.js +2 -1
- package/lib/logger/LoggerFactory.d.ts +2 -2
- package/lib/logger/LoggerFactory.js +2 -1
- package/lib/logger/LoggerOptions.d.ts +2 -2
- package/lib/logger/PartialLogger.d.ts +1 -1
- package/lib/logger/PartialLogger.js +1 -0
- package/lib/logger/WebpackInfrastructureLogger.d.ts +2 -2
- package/lib/logger/WebpackInfrastructureLogger.js +1 -0
- package/lib/profile/Performance.js +1 -0
- package/lib/reporter/AggregatedReporter.d.ts +1 -1
- package/lib/reporter/AggregatedReporter.js +2 -1
- package/lib/reporter/FilesChange.d.ts +1 -1
- package/lib/reporter/FilesChange.js +2 -1
- package/lib/reporter/FilesMatch.d.ts +7 -0
- package/lib/{eslint-reporter/EsLintReporterOptions.js → reporter/FilesMatch.js} +0 -0
- package/lib/reporter/Report.d.ts +3 -3
- package/lib/reporter/Reporter.d.ts +2 -2
- package/lib/reporter/index.d.ts +1 -1
- package/lib/reporter/index.js +17 -7
- package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +2 -2
- package/lib/reporter/reporter-rpc/ReporterRpcClient.js +17 -4
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +5 -5
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +3 -0
- package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +2 -2
- package/lib/reporter/reporter-rpc/ReporterRpcService.js +3 -0
- package/lib/rpc/RpcClient.d.ts +2 -2
- package/lib/rpc/RpcClient.js +2 -1
- package/lib/rpc/RpcMessage.d.ts +1 -1
- package/lib/rpc/RpcMessage.js +3 -0
- package/lib/rpc/RpcMessageChannel.d.ts +1 -1
- package/lib/rpc/RpcMessageChannel.js +1 -0
- package/lib/rpc/RpcService.d.ts +2 -2
- package/lib/rpc/RpcService.js +1 -0
- package/lib/rpc/error/RpcMessagePortClosedError.js +1 -0
- package/lib/rpc/error/RpcRemoteError.js +1 -0
- package/lib/rpc/index.js +17 -7
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +1 -1
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +1 -0
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +2 -2
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +1 -0
- package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +1 -0
- package/lib/rpc/rpc-ipc/index.js +12 -5
- package/lib/typescript-reporter/TypeScriptConfigurationOverwrite.d.ts +1 -1
- package/lib/typescript-reporter/TypeScriptReporterConfiguration.d.ts +5 -5
- package/lib/typescript-reporter/TypeScriptReporterConfiguration.js +2 -0
- package/lib/typescript-reporter/TypeScriptReporterOptions.d.ts +4 -5
- package/lib/typescript-reporter/TypeScriptSupport.d.ts +1 -1
- package/lib/typescript-reporter/TypeScriptSupport.js +26 -11
- package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.d.ts +1 -1
- package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.js +2 -1
- package/lib/typescript-reporter/extension/TypeScriptExtension.d.ts +4 -4
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.d.ts +2 -2
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.js +2 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +1 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.js +1 -0
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.d.ts +1 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.js +1 -0
- package/lib/typescript-reporter/file-system/FileSystem.d.ts +1 -1
- package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +8 -0
- package/lib/typescript-reporter/file-system/MemFileSystem.js +83 -0
- package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +3 -3
- package/lib/typescript-reporter/file-system/PassiveFileSystem.js +11 -72
- package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +1 -1
- package/lib/typescript-reporter/file-system/RealFileSystem.js +2 -0
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +2 -2
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +17 -5
- package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +2 -2
- package/lib/typescript-reporter/profile/TypeScriptPerformance.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts +3 -1
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +50 -15
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +2 -9
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +7 -5
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +114 -19
- package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +2 -2
- package/lib/typescript-reporter/reporter/TypeScriptReporter.js +24 -16
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +2 -2
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +1 -0
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +2 -2
- package/lib/utils/async/pool.d.ts +1 -0
- package/lib/utils/async/pool.js +10 -0
- package/lib/utils/path/relativeToContext.d.ts +2 -0
- package/lib/utils/path/relativeToContext.js +16 -0
- package/lib/watch/InclusiveNodeWatchFileSystem.d.ts +5 -5
- package/lib/watch/InclusiveNodeWatchFileSystem.js +111 -90
- package/lib/watch/WatchFileSystem.d.ts +5 -22
- package/package.json +52 -54
- package/CHANGELOG.md +0 -318
- package/changelog.config.js +0 -36
- package/lib/eslint-reporter/EsLintReporterConfiguration.d.ts +0 -11
- package/lib/eslint-reporter/EsLintReporterConfiguration.js +0 -26
- package/lib/eslint-reporter/EsLintReporterOptions.d.ts +0 -8
- package/lib/eslint-reporter/assertEsLintSupport.d.ts +0 -3
- package/lib/eslint-reporter/assertEsLintSupport.js +0 -30
- package/lib/eslint-reporter/issue/EsLintIssueFactory.d.ts +0 -4
- package/lib/eslint-reporter/issue/EsLintIssueFactory.js +0 -32
- package/lib/eslint-reporter/reporter/EsLintReporter.d.ts +0 -4
- package/lib/eslint-reporter/reporter/EsLintReporter.js +0 -85
- package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.d.ts +0 -4
- package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.js +0 -13
- package/lib/eslint-reporter/reporter/EsLintReporterRpcService.d.ts +0 -1
- package/lib/eslint-reporter/reporter/EsLintReporterRpcService.js +0 -11
- package/lib/eslint-reporter/types/eslint.d.ts +0 -31
- package/lib/eslint-reporter/types/eslint.js +0 -2
- package/lib/formatter/FormatterFactory.d.ts +0 -13
- package/lib/formatter/FormatterFactory.js +0 -17
- package/lib/reporter/Dependencies.d.ts +0 -6
- package/lib/reporter/Dependencies.js +0 -2
- package/lib/watch/CompilerWithWatchFileSystem.d.ts +0 -6
- package/lib/watch/CompilerWithWatchFileSystem.js +0 -2
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createRealFileSystem = void 0;
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
8
10
|
/**
|
|
9
11
|
* It's an implementation of the FileSystem interface which reads and writes directly to the real file system.
|
|
10
12
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { Issue } from '../../issue';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { Issue } from '../../issue';
|
|
3
3
|
declare function createIssuesFromTsDiagnostics(typescript: typeof ts, diagnostics: ts.Diagnostic[]): Issue[];
|
|
4
4
|
export { createIssuesFromTsDiagnostics };
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
2
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
15
|
if (mod && mod.__esModule) return mod;
|
|
4
16
|
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result
|
|
6
|
-
result
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
7
19
|
return result;
|
|
8
20
|
};
|
|
9
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.createIssuesFromTsDiagnostics = void 0;
|
|
10
23
|
const os = __importStar(require("os"));
|
|
11
24
|
const issue_1 = require("../../issue");
|
|
12
25
|
function createIssueFromTsDiagnostic(typescript, diagnostic) {
|
|
@@ -15,8 +28,8 @@ function createIssueFromTsDiagnostic(typescript, diagnostic) {
|
|
|
15
28
|
if (diagnostic.file) {
|
|
16
29
|
file = diagnostic.file.fileName;
|
|
17
30
|
if (diagnostic.start && diagnostic.length) {
|
|
18
|
-
const { line: startLine, character: startCharacter
|
|
19
|
-
const { line: endLine, character: endCharacter
|
|
31
|
+
const { line: startLine, character: startCharacter } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
32
|
+
const { line: endLine, character: endCharacter } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start + diagnostic.length);
|
|
20
33
|
location = {
|
|
21
34
|
start: {
|
|
22
35
|
line: startLine + 1,
|
|
@@ -30,7 +43,6 @@ function createIssueFromTsDiagnostic(typescript, diagnostic) {
|
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
45
|
return {
|
|
33
|
-
origin: 'typescript',
|
|
34
46
|
code: 'TS' + String(diagnostic.code),
|
|
35
47
|
// we don't handle Suggestion and Message diagnostics
|
|
36
48
|
severity: diagnostic.category === 0 ? 'warning' : 'error',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { Performance } from '../../profile/Performance';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { Performance } from '../../profile/Performance';
|
|
3
3
|
interface TypeScriptPerformance {
|
|
4
4
|
enable(): void;
|
|
5
5
|
disable(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectTypeScriptPerformance = void 0;
|
|
3
4
|
function getTypeScriptPerformance(typescript) {
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
return typescript.performance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
-
import { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
+
import type { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
4
4
|
declare function createControlledCompilerHost(typescript: typeof ts, parsedCommandLine: ts.ParsedCommandLine, system: ControlledTypeScriptSystem, hostExtensions?: TypeScriptHostExtension[]): ts.CompilerHost;
|
|
5
5
|
export { createControlledCompilerHost };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createControlledCompilerHost = void 0;
|
|
3
4
|
function createControlledCompilerHost(typescript, parsedCommandLine, system, hostExtensions = []) {
|
|
4
5
|
const baseCompilerHost = typescript.createCompilerHost(parsedCommandLine.options);
|
|
5
6
|
let controlledCompilerHost = Object.assign(Object.assign({}, baseCompilerHost), { fileExists: system.fileExists, readFile: system.readFile, directoryExists: system.directoryExists, getDirectories: system.getDirectories, realpath: system.realpath });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { FilesMatch } from '../../reporter';
|
|
2
3
|
interface ControlledTypeScriptSystem extends ts.System {
|
|
3
4
|
invokeFileCreated(path: string): void;
|
|
4
5
|
invokeFileChanged(path: string): void;
|
|
@@ -13,6 +14,7 @@ interface ControlledTypeScriptSystem extends ts.System {
|
|
|
13
14
|
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
|
|
14
15
|
clearTimeout(timeoutId: any): void;
|
|
15
16
|
waitForQueued(): Promise<void>;
|
|
17
|
+
setArtifacts(artifacts: FilesMatch): void;
|
|
16
18
|
}
|
|
17
19
|
declare type FileSystemMode = 'readonly' | 'write-tsbuildinfo' | 'write-references';
|
|
18
20
|
declare function createControlledTypeScriptSystem(typescript: typeof ts, mode?: FileSystemMode): ControlledTypeScriptSystem;
|
|
@@ -12,11 +12,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createControlledTypeScriptSystem = void 0;
|
|
15
16
|
const path_1 = require("path");
|
|
16
|
-
const PassiveFileSystem_1 = require("../file-system/PassiveFileSystem");
|
|
17
17
|
const forwardSlash_1 = __importDefault(require("../../utils/path/forwardSlash"));
|
|
18
|
+
const MemFileSystem_1 = require("../file-system/MemFileSystem");
|
|
19
|
+
const PassiveFileSystem_1 = require("../file-system/PassiveFileSystem");
|
|
18
20
|
const RealFileSystem_1 = require("../file-system/RealFileSystem");
|
|
19
21
|
function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
22
|
+
let artifacts = {
|
|
23
|
+
files: [],
|
|
24
|
+
dirs: [],
|
|
25
|
+
excluded: [],
|
|
26
|
+
extensions: [],
|
|
27
|
+
};
|
|
28
|
+
let isInitialRun = true;
|
|
20
29
|
// watchers
|
|
21
30
|
const fileWatcherCallbacksMap = new Map();
|
|
22
31
|
const directoryWatcherCallbacksMap = new Map();
|
|
@@ -28,7 +37,8 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
28
37
|
// third-party libraries, like fsevents
|
|
29
38
|
const caseSensitive = true;
|
|
30
39
|
const realFileSystem = RealFileSystem_1.createRealFileSystem(caseSensitive);
|
|
31
|
-
const
|
|
40
|
+
const memFileSystem = MemFileSystem_1.createMemFileSystem(realFileSystem);
|
|
41
|
+
const passiveFileSystem = PassiveFileSystem_1.createPassiveFileSystem(memFileSystem, realFileSystem);
|
|
32
42
|
// based on the ts.ignorePaths
|
|
33
43
|
const ignoredPaths = ['/node_modules/.', '/.git', '/.#'];
|
|
34
44
|
function createWatcher(watchersMap, path, callback) {
|
|
@@ -51,6 +61,11 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
51
61
|
}
|
|
52
62
|
function invokeFileWatchers(path, event) {
|
|
53
63
|
const normalizedPath = realFileSystem.normalizePath(path);
|
|
64
|
+
if (normalizedPath.endsWith('.js')) {
|
|
65
|
+
// trigger relevant .d.ts file watcher - handles the case, when we have webpack watcher
|
|
66
|
+
// that points to a symlinked package
|
|
67
|
+
invokeFileWatchers(normalizedPath.slice(0, -3) + '.d.ts', event);
|
|
68
|
+
}
|
|
54
69
|
const fileWatcherCallbacks = fileWatcherCallbacksMap.get(normalizedPath);
|
|
55
70
|
if (fileWatcherCallbacks) {
|
|
56
71
|
// typescript expects normalized paths with posix forward slash
|
|
@@ -75,23 +90,35 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
75
90
|
}
|
|
76
91
|
});
|
|
77
92
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
function isArtifact(path) {
|
|
94
|
+
return ((artifacts.dirs.some((dir) => path.includes(dir)) ||
|
|
95
|
+
artifacts.files.some((file) => path === file)) &&
|
|
96
|
+
artifacts.extensions.some((extension) => path.endsWith(extension)));
|
|
97
|
+
}
|
|
98
|
+
function getReadFileSystem(path) {
|
|
99
|
+
if (!isInitialRun &&
|
|
100
|
+
(mode === 'readonly' || mode === 'write-tsbuildinfo') &&
|
|
101
|
+
isArtifact(path)) {
|
|
102
|
+
return memFileSystem;
|
|
81
103
|
}
|
|
82
|
-
|
|
104
|
+
return passiveFileSystem;
|
|
105
|
+
}
|
|
106
|
+
function getWriteFileSystem(path) {
|
|
107
|
+
if (mode === 'write-references' ||
|
|
108
|
+
(mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) {
|
|
83
109
|
return realFileSystem;
|
|
84
110
|
}
|
|
111
|
+
return passiveFileSystem;
|
|
85
112
|
}
|
|
86
113
|
const controlledSystem = Object.assign(Object.assign({}, typescript.sys), { useCaseSensitiveFileNames: caseSensitive, fileExists(path) {
|
|
87
|
-
const stats =
|
|
114
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
88
115
|
return !!stats && stats.isFile();
|
|
89
116
|
},
|
|
90
117
|
readFile(path, encoding) {
|
|
91
|
-
return
|
|
118
|
+
return getReadFileSystem(path).readFile(path, encoding);
|
|
92
119
|
},
|
|
93
120
|
getFileSize(path) {
|
|
94
|
-
const stats =
|
|
121
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
95
122
|
return stats ? stats.size : 0;
|
|
96
123
|
},
|
|
97
124
|
writeFile(path, data) {
|
|
@@ -103,19 +130,22 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
103
130
|
controlledSystem.invokeFileDeleted(path);
|
|
104
131
|
},
|
|
105
132
|
directoryExists(path) {
|
|
106
|
-
|
|
107
|
-
return
|
|
133
|
+
var _a;
|
|
134
|
+
return Boolean((_a = getReadFileSystem(path).readStats(path)) === null || _a === void 0 ? void 0 : _a.isDirectory());
|
|
108
135
|
},
|
|
109
136
|
createDirectory(path) {
|
|
110
137
|
getWriteFileSystem(path).createDir(path);
|
|
111
138
|
invokeDirectoryWatchers(path);
|
|
112
139
|
},
|
|
113
140
|
getDirectories(path) {
|
|
114
|
-
const dirents =
|
|
115
|
-
return dirents
|
|
141
|
+
const dirents = getReadFileSystem(path).readDir(path);
|
|
142
|
+
return dirents
|
|
143
|
+
.filter((dirent) => dirent.isDirectory() ||
|
|
144
|
+
(dirent.isSymbolicLink() && controlledSystem.directoryExists(path_1.join(path, dirent.name))))
|
|
145
|
+
.map((dirent) => dirent.name);
|
|
116
146
|
},
|
|
117
147
|
getModifiedTime(path) {
|
|
118
|
-
const stats =
|
|
148
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
119
149
|
if (stats) {
|
|
120
150
|
return stats.mtime;
|
|
121
151
|
}
|
|
@@ -147,6 +177,7 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
147
177
|
while (timeoutCallbacks.size > 0) {
|
|
148
178
|
yield new Promise((resolve) => setImmediate(resolve));
|
|
149
179
|
}
|
|
180
|
+
isInitialRun = false;
|
|
150
181
|
});
|
|
151
182
|
},
|
|
152
183
|
invokeFileCreated(path) {
|
|
@@ -175,8 +206,12 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
175
206
|
}
|
|
176
207
|
},
|
|
177
208
|
clearCache() {
|
|
178
|
-
passiveFileSystem.clearCache();
|
|
179
209
|
realFileSystem.clearCache();
|
|
210
|
+
memFileSystem.clearCache();
|
|
211
|
+
passiveFileSystem.clearCache();
|
|
212
|
+
},
|
|
213
|
+
setArtifacts(nextArtifacts) {
|
|
214
|
+
artifacts = nextArtifacts;
|
|
180
215
|
} });
|
|
181
216
|
return controlledSystem;
|
|
182
217
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
-
import { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
+
import type { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
4
4
|
declare function createControlledWatchCompilerHost<TProgram extends ts.BuilderProgram>(typescript: typeof ts, parsedCommandLine: ts.ParsedCommandLine, system: ControlledTypeScriptSystem, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, afterProgramCreate?: (program: TProgram) => void, hostExtensions?: TypeScriptHostExtension[]): ts.WatchCompilerHostOfFilesAndCompilerOptions<TProgram>;
|
|
5
5
|
export { createControlledWatchCompilerHost };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createControlledWatchCompilerHost = void 0;
|
|
3
4
|
function createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions = []) {
|
|
4
5
|
const baseWatchCompilerHost = typescript.createWatchCompilerHost(parsedCommandLine.fileNames, parsedCommandLine.options, system, createProgram, reportDiagnostic, reportWatchStatus, parsedCommandLine.projectReferences);
|
|
5
6
|
let controlledWatchCompilerHost = Object.assign(Object.assign({}, baseWatchCompilerHost), { createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
-
import { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
|
+
import type { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
4
4
|
declare function createControlledWatchSolutionBuilderHost<TProgram extends ts.BuilderProgram>(typescript: typeof ts, parsedCommandLine: ts.ParsedCommandLine, system: ControlledTypeScriptSystem, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, reportSolutionBuilderStatus?: (diagnostic: ts.Diagnostic) => void, afterProgramCreate?: (program: TProgram) => void, afterProgramEmitAndDiagnostics?: (program: TProgram) => void, hostExtensions?: TypeScriptHostExtension[]): ts.SolutionBuilderWithWatchHost<TProgram>;
|
|
5
5
|
export { createControlledWatchSolutionBuilderHost };
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
-
if (mod && mod.__esModule) return mod;
|
|
4
|
-
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
-
result["default"] = mod;
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
|
|
3
|
+
exports.createControlledWatchSolutionBuilderHost = void 0;
|
|
11
4
|
const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
|
|
12
5
|
function createControlledWatchSolutionBuilderHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics, hostExtensions = []) {
|
|
13
6
|
const controlledWatchCompilerHost = ControlledWatchCompilerHost_1.createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions);
|
|
@@ -42,7 +35,7 @@ function createControlledWatchSolutionBuilderHost(typescript, parsedCommandLine,
|
|
|
42
35
|
system.deleteFile(fileName);
|
|
43
36
|
},
|
|
44
37
|
getParsedCommandLine(fileName) {
|
|
45
|
-
return
|
|
38
|
+
return typescript.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
46
39
|
if (reportDiagnostic) {
|
|
47
40
|
reportDiagnostic(diagnostic);
|
|
48
41
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import type { FilesMatch } from '../../reporter';
|
|
3
|
+
import type { TypeScriptConfigurationOverwrite } from '../TypeScriptConfigurationOverwrite';
|
|
4
4
|
declare function parseTypeScriptConfiguration(typescript: typeof ts, configFileName: string, configFileContext: string, configOverwriteJSON: TypeScriptConfigurationOverwrite, parseConfigFileHost: ts.ParseConfigFileHost): ts.ParsedCommandLine;
|
|
5
|
-
declare function getDependenciesFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]):
|
|
6
|
-
export
|
|
5
|
+
declare function getDependenciesFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
|
|
6
|
+
export declare function isIncrementalCompilation(options: ts.CompilerOptions): boolean;
|
|
7
|
+
declare function getArtifactsFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
|
|
8
|
+
export { parseTypeScriptConfiguration, getDependenciesFromTypeScriptConfiguration, getArtifactsFromTypeScriptConfiguration, };
|
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getArtifactsFromTypeScriptConfiguration = exports.getDependenciesFromTypeScriptConfiguration = exports.parseTypeScriptConfiguration = exports.isIncrementalCompilation = void 0;
|
|
3
7
|
const path_1 = require("path");
|
|
8
|
+
const forwardSlash_1 = __importDefault(require("../../utils/path/forwardSlash"));
|
|
4
9
|
function parseTypeScriptConfiguration(typescript, configFileName, configFileContext, configOverwriteJSON, parseConfigFileHost) {
|
|
5
|
-
const
|
|
10
|
+
const configFilePath = forwardSlash_1.default(configFileName);
|
|
11
|
+
const parsedConfigFileJSON = typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
|
|
6
12
|
const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), configOverwriteJSON), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (configOverwriteJSON.compilerOptions || {})) });
|
|
7
13
|
const parsedConfigFile = typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, configFileContext);
|
|
8
|
-
return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath:
|
|
14
|
+
return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: parsedConfigFileJSON.error ? [parsedConfigFileJSON.error] : parsedConfigFile.errors });
|
|
9
15
|
}
|
|
10
16
|
exports.parseTypeScriptConfiguration = parseTypeScriptConfiguration;
|
|
11
17
|
function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
|
|
18
|
+
var _a;
|
|
12
19
|
const files = new Set(parsedConfiguration.fileNames);
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
const configFilePath = parsedConfiguration.options.configFilePath;
|
|
21
|
+
if (typeof configFilePath === 'string') {
|
|
22
|
+
files.add(configFilePath);
|
|
15
23
|
}
|
|
16
24
|
const dirs = new Set(Object.keys(parsedConfiguration.wildcardDirectories || {}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
const excluded = new Set((((_a = parsedConfiguration.raw) === null || _a === void 0 ? void 0 : _a.exclude) || []).map((path) => path_1.resolve(configFileContext, path)));
|
|
26
|
+
for (const projectReference of parsedConfiguration.projectReferences || []) {
|
|
27
|
+
const childConfigFilePath = typescript.resolveProjectReferencePath(projectReference);
|
|
28
|
+
const childConfigContext = path_1.dirname(childConfigFilePath);
|
|
29
|
+
if (processedConfigFiles.includes(childConfigFilePath)) {
|
|
30
|
+
// handle circular dependencies
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const childParsedConfiguration = parseTypeScriptConfiguration(typescript, childConfigFilePath, childConfigContext, {}, parseConfigFileHost);
|
|
34
|
+
const childDependencies = getDependenciesFromTypeScriptConfiguration(typescript, childParsedConfiguration, childConfigContext, parseConfigFileHost, [...processedConfigFiles, childConfigFilePath]);
|
|
35
|
+
childDependencies.files.forEach((file) => {
|
|
36
|
+
files.add(file);
|
|
37
|
+
});
|
|
38
|
+
childDependencies.dirs.forEach((dir) => {
|
|
39
|
+
dirs.add(dir);
|
|
32
40
|
});
|
|
33
41
|
}
|
|
34
42
|
const extensions = [
|
|
@@ -41,7 +49,94 @@ function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfigurat
|
|
|
41
49
|
return {
|
|
42
50
|
files: Array.from(files).map((file) => path_1.normalize(file)),
|
|
43
51
|
dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
|
|
52
|
+
excluded: Array.from(excluded).map((path) => path_1.normalize(path)),
|
|
44
53
|
extensions: extensions,
|
|
45
54
|
};
|
|
46
55
|
}
|
|
47
56
|
exports.getDependenciesFromTypeScriptConfiguration = getDependenciesFromTypeScriptConfiguration;
|
|
57
|
+
function isIncrementalCompilation(options) {
|
|
58
|
+
return Boolean((options.incremental || options.composite) && !options.outFile);
|
|
59
|
+
}
|
|
60
|
+
exports.isIncrementalCompilation = isIncrementalCompilation;
|
|
61
|
+
function removeJsonExtension(path) {
|
|
62
|
+
if (path.endsWith('.json')) {
|
|
63
|
+
return path.slice(0, -'.json'.length);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return path;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function getTsBuildInfoEmitOutputFilePath(typescript, options) {
|
|
70
|
+
if (typeof typescript.getTsBuildInfoEmitOutputFilePath === 'function') {
|
|
71
|
+
// old TypeScript version doesn't provides this method
|
|
72
|
+
return typescript.getTsBuildInfoEmitOutputFilePath(options);
|
|
73
|
+
}
|
|
74
|
+
// based on the implementation from typescript
|
|
75
|
+
const configFile = options.configFilePath;
|
|
76
|
+
if (!isIncrementalCompilation(options)) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
if (options.tsBuildInfoFile) {
|
|
80
|
+
return options.tsBuildInfoFile;
|
|
81
|
+
}
|
|
82
|
+
const outPath = options.outFile || options.out;
|
|
83
|
+
let buildInfoExtensionLess;
|
|
84
|
+
if (outPath) {
|
|
85
|
+
buildInfoExtensionLess = removeJsonExtension(outPath);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
if (!configFile) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const configFileExtensionLess = removeJsonExtension(configFile);
|
|
92
|
+
buildInfoExtensionLess = options.outDir
|
|
93
|
+
? options.rootDir
|
|
94
|
+
? path_1.resolve(options.outDir, path_1.relative(options.rootDir, configFileExtensionLess))
|
|
95
|
+
: path_1.resolve(options.outDir, path_1.basename(configFileExtensionLess))
|
|
96
|
+
: configFileExtensionLess;
|
|
97
|
+
}
|
|
98
|
+
return buildInfoExtensionLess + '.tsbuildinfo';
|
|
99
|
+
}
|
|
100
|
+
function getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
|
|
101
|
+
const files = new Set();
|
|
102
|
+
const dirs = new Set();
|
|
103
|
+
if (parsedConfiguration.fileNames.length > 0) {
|
|
104
|
+
if (parsedConfiguration.options.outFile) {
|
|
105
|
+
files.add(path_1.resolve(configFileContext, parsedConfiguration.options.outFile));
|
|
106
|
+
}
|
|
107
|
+
const tsBuildInfoPath = getTsBuildInfoEmitOutputFilePath(typescript, parsedConfiguration.options);
|
|
108
|
+
if (tsBuildInfoPath) {
|
|
109
|
+
files.add(path_1.resolve(configFileContext, tsBuildInfoPath));
|
|
110
|
+
}
|
|
111
|
+
if (parsedConfiguration.options.outDir) {
|
|
112
|
+
dirs.add(path_1.resolve(configFileContext, parsedConfiguration.options.outDir));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const projectReference of parsedConfiguration.projectReferences || []) {
|
|
116
|
+
const configFile = typescript.resolveProjectReferencePath(projectReference);
|
|
117
|
+
if (processedConfigFiles.includes(configFile)) {
|
|
118
|
+
// handle circular dependencies
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const parsedConfiguration = parseTypeScriptConfiguration(typescript, configFile, path_1.dirname(configFile), {}, parseConfigFileHost);
|
|
122
|
+
const childArtifacts = getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, [...processedConfigFiles, configFile]);
|
|
123
|
+
childArtifacts.files.forEach((file) => {
|
|
124
|
+
files.add(file);
|
|
125
|
+
});
|
|
126
|
+
childArtifacts.dirs.forEach((dir) => {
|
|
127
|
+
dirs.add(dir);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const extensions = [
|
|
131
|
+
typescript.Extension.Dts,
|
|
132
|
+
typescript.Extension.Js,
|
|
133
|
+
typescript.Extension.TsBuildInfo,
|
|
134
|
+
];
|
|
135
|
+
return {
|
|
136
|
+
files: Array.from(files).map((file) => path_1.normalize(file)),
|
|
137
|
+
dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
|
|
138
|
+
excluded: [],
|
|
139
|
+
extensions,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
exports.getArtifactsFromTypeScriptConfiguration = getArtifactsFromTypeScriptConfiguration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Reporter } from '../../reporter';
|
|
2
|
-
import { TypeScriptReporterConfiguration } from '../TypeScriptReporterConfiguration';
|
|
1
|
+
import type { Reporter } from '../../reporter';
|
|
2
|
+
import type { TypeScriptReporterConfiguration } from '../TypeScriptReporterConfiguration';
|
|
3
3
|
declare function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration): Reporter;
|
|
4
4
|
export { createTypeScriptReporter };
|
|
@@ -8,32 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12
|
-
if (mod && mod.__esModule) return mod;
|
|
13
|
-
var result = {};
|
|
14
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
15
|
-
result["default"] = mod;
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
13
|
};
|
|
21
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
|
|
15
|
+
exports.createTypeScriptReporter = void 0;
|
|
23
16
|
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const Performance_1 = require("../../profile/Performance");
|
|
18
|
+
const TypeScriptVueExtension_1 = require("../extension/vue/TypeScriptVueExtension");
|
|
24
19
|
const TypeScriptIssueFactory_1 = require("../issue/TypeScriptIssueFactory");
|
|
20
|
+
const TypeScriptPerformance_1 = require("../profile/TypeScriptPerformance");
|
|
21
|
+
const ControlledCompilerHost_1 = require("./ControlledCompilerHost");
|
|
22
|
+
const ControlledTypeScriptSystem_1 = require("./ControlledTypeScriptSystem");
|
|
25
23
|
const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
|
|
26
|
-
const TypeScriptVueExtension_1 = require("../extension/vue/TypeScriptVueExtension");
|
|
27
24
|
const ControlledWatchSolutionBuilderHost_1 = require("./ControlledWatchSolutionBuilderHost");
|
|
28
|
-
const ControlledTypeScriptSystem_1 = require("./ControlledTypeScriptSystem");
|
|
29
25
|
const TypeScriptConfigurationParser_1 = require("./TypeScriptConfigurationParser");
|
|
30
|
-
const Performance_1 = require("../../profile/Performance");
|
|
31
|
-
const TypeScriptPerformance_1 = require("../profile/TypeScriptPerformance");
|
|
32
|
-
const ControlledCompilerHost_1 = require("./ControlledCompilerHost");
|
|
33
26
|
function createTypeScriptReporter(configuration) {
|
|
34
27
|
let parsedConfiguration;
|
|
35
28
|
let parseConfigurationDiagnostics = [];
|
|
36
29
|
let dependencies;
|
|
30
|
+
let artifacts;
|
|
37
31
|
let configurationChanged = false;
|
|
38
32
|
let compilerHost;
|
|
39
33
|
let watchCompilerHost;
|
|
@@ -88,7 +82,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
88
82
|
function emitTsBuildInfoFileForBuilderProgram(builderProgram) {
|
|
89
83
|
if (configuration.mode !== 'readonly' &&
|
|
90
84
|
parsedConfiguration &&
|
|
91
|
-
parsedConfiguration.options
|
|
85
|
+
TypeScriptConfigurationParser_1.isIncrementalCompilation(parsedConfiguration.options)) {
|
|
92
86
|
const program = builderProgram.getProgram();
|
|
93
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
88
|
if (typeof program.emitBuildInfo === 'function') {
|
|
@@ -134,6 +128,17 @@ function createTypeScriptReporter(configuration) {
|
|
|
134
128
|
}
|
|
135
129
|
return dependencies;
|
|
136
130
|
}
|
|
131
|
+
function getArtifacts() {
|
|
132
|
+
parsedConfiguration = parseConfigurationIfNeeded();
|
|
133
|
+
const [parseConfigFileHost] = getParseConfigFileHost();
|
|
134
|
+
return TypeScriptConfigurationParser_1.getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configuration.context, parseConfigFileHost);
|
|
135
|
+
}
|
|
136
|
+
function getArtifactsIfNeeded() {
|
|
137
|
+
if (!artifacts) {
|
|
138
|
+
artifacts = getArtifacts();
|
|
139
|
+
}
|
|
140
|
+
return artifacts;
|
|
141
|
+
}
|
|
137
142
|
function startProfilingIfNeeded() {
|
|
138
143
|
if (configuration.profile) {
|
|
139
144
|
performance.enable();
|
|
@@ -175,6 +180,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
175
180
|
// we need to re-create programs
|
|
176
181
|
parsedConfiguration = undefined;
|
|
177
182
|
dependencies = undefined;
|
|
183
|
+
artifacts = undefined;
|
|
178
184
|
compilerHost = undefined;
|
|
179
185
|
watchCompilerHost = undefined;
|
|
180
186
|
watchSolutionBuilderHost = undefined;
|
|
@@ -190,12 +196,14 @@ function createTypeScriptReporter(configuration) {
|
|
|
190
196
|
if (previousParsedConfiguration &&
|
|
191
197
|
JSON.stringify(previousParsedConfiguration.fileNames) !==
|
|
192
198
|
JSON.stringify(parsedConfiguration.fileNames)) {
|
|
193
|
-
// root files changed - we need to recompute dependencies
|
|
199
|
+
// root files changed - we need to recompute dependencies and artifacts
|
|
194
200
|
dependencies = getDependencies();
|
|
201
|
+
artifacts = getArtifacts();
|
|
195
202
|
shouldUpdateRootFiles = true;
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
205
|
parsedConfiguration = parseConfigurationIfNeeded();
|
|
206
|
+
system.setArtifacts(getArtifactsIfNeeded());
|
|
199
207
|
if (configurationChanged) {
|
|
200
208
|
configurationChanged = false;
|
|
201
209
|
// try to remove outdated .tsbuildinfo file for incremental mode
|
|
@@ -314,7 +322,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
314
322
|
compilerHost = ControlledCompilerHost_1.createControlledCompilerHost(typescript, parsedConfiguration, system, extensions);
|
|
315
323
|
}
|
|
316
324
|
if (!program) {
|
|
317
|
-
program =
|
|
325
|
+
program = typescript.createProgram({
|
|
318
326
|
rootNames: parsedConfiguration.fileNames,
|
|
319
327
|
options: parsedConfiguration.options,
|
|
320
328
|
projectReferences: parsedConfiguration.projectReferences,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReporterRpcClient } from '../../reporter';
|
|
2
|
+
import type { TypeScriptReporterConfiguration } from '../TypeScriptReporterConfiguration';
|
|
3
3
|
declare function createTypeScriptReporterRpcClient(configuration: TypeScriptReporterConfiguration): ReporterRpcClient;
|
|
4
4
|
export { createTypeScriptReporterRpcClient };
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createTypeScriptReporterRpcClient = void 0;
|
|
6
7
|
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const reporter_1 = require("../../reporter");
|
|
8
9
|
const rpc_ipc_1 = require("../../rpc/rpc-ipc");
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const process_1 = __importDefault(require("process"));
|
|
7
|
-
const TypeScriptReporter_1 = require("./TypeScriptReporter");
|
|
8
|
-
const rpc_ipc_1 = require("../../rpc/rpc-ipc");
|
|
9
7
|
const reporter_1 = require("../../reporter");
|
|
8
|
+
const rpc_ipc_1 = require("../../rpc/rpc-ipc");
|
|
9
|
+
const TypeScriptReporter_1 = require("./TypeScriptReporter");
|
|
10
10
|
const service = reporter_1.registerReporterRpcService(rpc_ipc_1.createRpcIpcMessagePort(process_1.default), TypeScriptReporter_1.createTypeScriptReporter);
|
|
11
11
|
service.open();
|