Skip to content

Commit 47f311a

Browse files
authored
Merge pull request #27062 from Microsoft/tsbuildWatchImprovements
Multiple improvements to watching with --build option
2 parents b563978 + b8f33f6 commit 47f311a

File tree

12 files changed

+734
-523
lines changed

12 files changed

+734
-523
lines changed

src/compiler/commandLineParser.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,8 @@ namespace ts {
18251825
const options = extend(existingOptions, parsedConfig.options || {});
18261826
options.configFilePath = configFileName && normalizeSlashes(configFileName);
18271827
setConfigFileInOptions(options, sourceFile);
1828-
const { fileNames, wildcardDirectories, spec, projectReferences } = getFileNames();
1828+
let projectReferences: ProjectReference[] | undefined;
1829+
const { fileNames, wildcardDirectories, spec } = getFileNames();
18291830
return {
18301831
options,
18311832
fileNames,
@@ -1904,21 +1905,19 @@ namespace ts {
19041905

19051906
if (hasProperty(raw, "references") && !isNullOrUndefined(raw.references)) {
19061907
if (isArray(raw.references)) {
1907-
const references: ProjectReference[] = [];
19081908
for (const ref of raw.references) {
19091909
if (typeof ref.path !== "string") {
19101910
createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string");
19111911
}
19121912
else {
1913-
references.push({
1913+
(projectReferences || (projectReferences = [])).push({
19141914
path: getNormalizedAbsolutePath(ref.path, basePath),
19151915
originalPath: ref.path,
19161916
prepend: ref.prepend,
19171917
circular: ref.circular
19181918
});
19191919
}
19201920
}
1921-
result.projectReferences = references;
19221921
}
19231922
else {
19241923
createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "references", "Array");
@@ -2407,7 +2406,7 @@ namespace ts {
24072406
// new entries in these paths.
24082407
const wildcardDirectories = getWildcardDirectories(validatedIncludeSpecs, validatedExcludeSpecs, basePath, host.useCaseSensitiveFileNames);
24092408

2410-
const spec: ConfigFileSpecs = { filesSpecs, referencesSpecs: undefined, includeSpecs, excludeSpecs, validatedIncludeSpecs, validatedExcludeSpecs, wildcardDirectories };
2409+
const spec: ConfigFileSpecs = { filesSpecs, includeSpecs, excludeSpecs, validatedIncludeSpecs, validatedExcludeSpecs, wildcardDirectories };
24112410
return getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions);
24122411
}
24132412

@@ -2478,16 +2477,9 @@ namespace ts {
24782477

24792478
const literalFiles = arrayFrom(literalFileMap.values());
24802479
const wildcardFiles = arrayFrom(wildcardFileMap.values());
2481-
const projectReferences = spec.referencesSpecs && spec.referencesSpecs.map((r): ProjectReference => {
2482-
return {
2483-
...r,
2484-
path: getNormalizedAbsolutePath(r.path, basePath)
2485-
};
2486-
});
24872480

24882481
return {
24892482
fileNames: literalFiles.concat(wildcardFiles),
2490-
projectReferences,
24912483
wildcardDirectories,
24922484
spec
24932485
};

src/compiler/diagnosticMessages.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,10 +3874,6 @@
38743874
"category": "Error",
38753875
"code": 6370
38763876
},
3877-
"Skipping clean because not all projects could be located": {
3878-
"category": "Error",
3879-
"code": 6371
3880-
},
38813877

38823878
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
38833879
"category": "Message",

src/compiler/program.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ namespace ts {
23412341

23422342
function parseProjectReferenceConfigFile(ref: ProjectReference): { commandLine: ParsedCommandLine, sourceFile: SourceFile } | undefined {
23432343
// The actual filename (i.e. add "/tsconfig.json" if necessary)
2344-
const refPath = resolveProjectReferencePath(host, ref);
2344+
const refPath = resolveProjectReferencePath(ref);
23452345
// An absolute path pointing to the containing directory of the config file
23462346
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
23472347
const sourceFile = host.getSourceFile(refPath, ScriptTarget.JSON) as JsonSourceFile | undefined;
@@ -2820,18 +2820,13 @@ namespace ts {
28202820
};
28212821
}
28222822

2823-
export interface ResolveProjectReferencePathHost {
2824-
fileExists(fileName: string): boolean;
2825-
}
28262823
/**
28272824
* Returns the target config filename of a project reference.
28282825
* Note: The file might not exist.
28292826
*/
2830-
export function resolveProjectReferencePath(host: ResolveProjectReferencePathHost, ref: ProjectReference): ResolvedConfigFileName {
2831-
if (!host.fileExists(ref.path)) {
2832-
return combinePaths(ref.path, "tsconfig.json") as ResolvedConfigFileName;
2833-
}
2834-
return ref.path as ResolvedConfigFileName;
2827+
// TODO: Does this need to be exposed
2828+
export function resolveProjectReferencePath(ref: ProjectReference): ResolvedConfigFileName {
2829+
return resolveConfigFileProjectName(ref.path);
28352830
}
28362831

28372832
/* @internal */

0 commit comments

Comments
 (0)