Skip to content

Commit d4c2fdc

Browse files
committedApr 26, 2019
Make changes to public API
1 parent 80f1ba4 commit d4c2fdc

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed
 

‎src/compiler/commandLineParser.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ namespace ts {
13451345
configFileName: string,
13461346
optionsToExtend: CompilerOptions,
13471347
host: ParseConfigFileHost,
1348-
/*@internal*/ extendedConfigCache?: Map<ExtendedConfigCacheEntry>
1348+
extendedConfigCache?: Map<ExtendedConfigCacheEntry>
13491349
): ParsedCommandLine | undefined {
13501350
let configFileText: string | undefined;
13511351
try {
@@ -2183,7 +2183,7 @@ namespace ts {
21832183
return existingErrors !== configParseDiagnostics.length;
21842184
}
21852185

2186-
interface ParsedTsconfig {
2186+
export interface ParsedTsconfig {
21872187
raw: any;
21882188
options?: CompilerOptions;
21892189
typeAcquisition?: TypeAcquisition;
@@ -2370,7 +2370,6 @@ namespace ts {
23702370
return undefined;
23712371
}
23722372

2373-
/*@internal*/
23742373
export interface ExtendedConfigCacheEntry {
23752374
extendedResult: TsConfigSourceFile;
23762375
extendedConfig: ParsedTsconfig | undefined;
@@ -2398,7 +2397,6 @@ namespace ts {
23982397
const extendedDirname = getDirectoryPath(extendedConfigPath);
23992398
extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname,
24002399
getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
2401-
24022400

24032401
if (isSuccessfulParsedTsconfig(extendedConfig)) {
24042402
// Update the paths to reflect base path
@@ -2423,7 +2421,7 @@ namespace ts {
24232421
if (sourceFile) {
24242422
sourceFile.extendedSourceFiles = [extendedResult.fileName];
24252423
if (extendedResult.extendedSourceFiles) {
2426-
sourceFile.extendedSourceFiles!.push(...extendedResult.extendedSourceFiles);
2424+
sourceFile.extendedSourceFiles.push(...extendedResult.extendedSourceFiles);
24272425
}
24282426
}
24292427
if (extendedResult.parseDiagnostics.length) {

‎src/compiler/program.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2682,10 +2682,12 @@ namespace ts {
26822682
if (host.getParsedCommandLine) {
26832683
commandLine = host.getParsedCommandLine(refPath);
26842684
if (!commandLine) {
2685+
addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
26852686
projectReferenceRedirects.set(sourceFilePath, false);
26862687
return undefined;
26872688
}
26882689
sourceFile = Debug.assertDefined(commandLine.options.configFile);
2690+
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
26892691
}
26902692
else {
26912693
// An absolute path pointing to the containing directory of the config file

‎src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5130,7 +5130,7 @@ namespace ts {
51305130
/* @internal */ hasInvalidatedResolution?: HasInvalidatedResolution;
51315131
/* @internal */ hasChangedAutomaticTypeDirectiveNames?: boolean;
51325132
createHash?(data: string): string;
5133-
/*@internal*/getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5133+
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
51345134

51355135
// TODO: later handle this in better way in builder host instead once the api for tsbuild finalizes and doesnt use compilerHost as base
51365136
/*@internal*/createDirectory?(directory: string): void;

‎tests/baselines/reference/api/tsserverlibrary.d.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,7 @@ declare namespace ts {
27602760
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
27612761
getEnvironmentVariable?(name: string): string | undefined;
27622762
createHash?(data: string): string;
2763+
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
27632764
}
27642765
interface SourceMapRange extends TextRange {
27652766
source?: SourceMapSource;
@@ -3631,7 +3632,7 @@ declare namespace ts {
36313632
/**
36323633
* Reads the config file, reports errors if any and exits if the config file cannot be found
36333634
*/
3634-
function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined;
3635+
function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
36353636
/**
36363637
* Read tsconfig.json file
36373638
* @param fileName The path to the config file
@@ -3673,7 +3674,20 @@ declare namespace ts {
36733674
* @param basePath A root directory to resolve relative path entries in the config
36743675
* file to. e.g. outDir
36753676
*/
3676-
function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
3677+
function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, /*@internal*/ extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
3678+
interface ParsedTsconfig {
3679+
raw: any;
3680+
options?: CompilerOptions;
3681+
typeAcquisition?: TypeAcquisition;
3682+
/**
3683+
* Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
3684+
*/
3685+
extendedConfigPath?: string;
3686+
}
3687+
interface ExtendedConfigCacheEntry {
3688+
extendedResult: TsConfigSourceFile;
3689+
extendedConfig: ParsedTsconfig | undefined;
3690+
}
36773691
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
36783692
options: CompilerOptions;
36793693
errors: Diagnostic[];

‎tests/baselines/reference/api/typescript.d.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,7 @@ declare namespace ts {
27602760
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
27612761
getEnvironmentVariable?(name: string): string | undefined;
27622762
createHash?(data: string): string;
2763+
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
27632764
}
27642765
interface SourceMapRange extends TextRange {
27652766
source?: SourceMapSource;
@@ -3631,7 +3632,7 @@ declare namespace ts {
36313632
/**
36323633
* Reads the config file, reports errors if any and exits if the config file cannot be found
36333634
*/
3634-
function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined;
3635+
function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
36353636
/**
36363637
* Read tsconfig.json file
36373638
* @param fileName The path to the config file
@@ -3673,7 +3674,20 @@ declare namespace ts {
36733674
* @param basePath A root directory to resolve relative path entries in the config
36743675
* file to. e.g. outDir
36753676
*/
3676-
function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
3677+
function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, /*@internal*/ extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
3678+
interface ParsedTsconfig {
3679+
raw: any;
3680+
options?: CompilerOptions;
3681+
typeAcquisition?: TypeAcquisition;
3682+
/**
3683+
* Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
3684+
*/
3685+
extendedConfigPath?: string;
3686+
}
3687+
interface ExtendedConfigCacheEntry {
3688+
extendedResult: TsConfigSourceFile;
3689+
extendedConfig: ParsedTsconfig | undefined;
3690+
}
36773691
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
36783692
options: CompilerOptions;
36793693
errors: Diagnostic[];

0 commit comments

Comments
 (0)