diff --git a/Jakefile b/Jakefile index 2eb87494f2f..2cef554cc75 100644 --- a/Jakefile +++ b/Jakefile @@ -111,6 +111,7 @@ var definitionsRoots = [ "compiler/parser.d.ts", "compiler/checker.d.ts", "compiler/program.d.ts", + "compiler/commandLineParser.d.ts", "services/services.d.ts", ]; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 29c2c6452db..2f3b15f3777 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -4,6 +4,7 @@ /// module ts { + /* @internal */ export var optionDeclarations: CommandLineOption[] = [ { name: "charset", @@ -157,7 +158,8 @@ module ts { description: Diagnostics.Watch_input_files, } ]; - + + /* @internal */ export function parseCommandLine(commandLine: string[]): ParsedCommandLine { var options: CompilerOptions = {}; var fileNames: string[] = []; @@ -267,6 +269,10 @@ module ts { } } + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ export function readConfigFile(fileName: string): any { try { var text = sys.readFile(fileName); @@ -276,6 +282,12 @@ module ts { } } + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine { var errors: Diagnostic[] = []; diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 38601f06e0c..854f1414165 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1504,6 +1504,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 29819954554..b89a0c02bd3 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4838,6 +4838,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 1d80469cbf0..d7a1d02262a 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1535,6 +1535,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 71a3e4b4a31..991af4841ca 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4984,6 +4984,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 9707daa1bc9..63777b515a7 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1536,6 +1536,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 710c5b4f440..4a9810e779f 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4934,6 +4934,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 55a4674ad23..9b6dcdde162 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1573,6 +1573,20 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index d0e76c4ad51..71c617a5c4e 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5107,6 +5107,27 @@ declare module "typescript" { >CompilerHost : CompilerHost >Program : Program } +declare module "typescript" { + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string): any; +>readConfigFile : (fileName: string) => any +>fileName : string + + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; +>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine +>json : any +>basePath : string +>ParsedCommandLine : ParsedCommandLine +} declare module "typescript" { /** The version of the language service API */ let servicesVersion: string;