Skip to content

Commit 18d8fed

Browse files
committed
Expose readConfigFile and parseConfigFile
1 parent e13dc1d commit 18d8fed

File tree

10 files changed

+154
-1
lines changed

10 files changed

+154
-1
lines changed

Jakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ var definitionsRoots = [
111111
"compiler/parser.d.ts",
112112
"compiler/checker.d.ts",
113113
"compiler/program.d.ts",
114+
"compiler/commandLineParser.d.ts",
114115
"services/services.d.ts",
115116
];
116117

src/compiler/commandLineParser.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// <reference path="scanner.ts"/>
55

66
module ts {
7+
/* @internal */
78
export var optionDeclarations: CommandLineOption[] = [
89
{
910
name: "charset",
@@ -153,7 +154,8 @@ module ts {
153154
description: Diagnostics.Watch_input_files,
154155
}
155156
];
156-
157+
158+
/* @internal */
157159
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
158160
var options: CompilerOptions = {};
159161
var fileNames: string[] = [];
@@ -263,6 +265,10 @@ module ts {
263265
}
264266
}
265267

268+
/**
269+
* Read tsconfig.json file
270+
* @param fileName The path to the config file
271+
*/
266272
export function readConfigFile(fileName: string): any {
267273
try {
268274
var text = sys.readFile(fileName);
@@ -272,6 +278,12 @@ module ts {
272278
}
273279
}
274280

281+
/**
282+
* Parse the contents of a config file (tsconfig.json).
283+
* @param json The contents of the config file to parse
284+
* @param basePath A root directory to resolve relative path entries in the config
285+
* file to. e.g. outDir
286+
*/
275287
export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine {
276288
var errors: Diagnostic[] = [];
277289

tests/baselines/reference/APISample_compile.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,20 @@ declare module "typescript" {
14891489
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
14901490
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
14911491
}
1492+
declare module "typescript" {
1493+
/**
1494+
* Read tsconfig.json file
1495+
* @param fileName The path to the config file
1496+
*/
1497+
function readConfigFile(fileName: string): any;
1498+
/**
1499+
* Parse the contents of a config file (tsconfig.json).
1500+
* @param json The contents of the config file to parse
1501+
* @param basePath A root directory to resolve relative path entries in the config
1502+
* file to. e.g. outDir
1503+
*/
1504+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
1505+
}
14921506
declare module "typescript" {
14931507
/** The version of the language service API */
14941508
let servicesVersion: string;

tests/baselines/reference/APISample_compile.types

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4796,6 +4796,27 @@ declare module "typescript" {
47964796
>CompilerHost : CompilerHost
47974797
>Program : Program
47984798
}
4799+
declare module "typescript" {
4800+
/**
4801+
* Read tsconfig.json file
4802+
* @param fileName The path to the config file
4803+
*/
4804+
function readConfigFile(fileName: string): any;
4805+
>readConfigFile : (fileName: string) => any
4806+
>fileName : string
4807+
4808+
/**
4809+
* Parse the contents of a config file (tsconfig.json).
4810+
* @param json The contents of the config file to parse
4811+
* @param basePath A root directory to resolve relative path entries in the config
4812+
* file to. e.g. outDir
4813+
*/
4814+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
4815+
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
4816+
>json : any
4817+
>basePath : string
4818+
>ParsedCommandLine : ParsedCommandLine
4819+
}
47994820
declare module "typescript" {
48004821
/** The version of the language service API */
48014822
let servicesVersion: string;

tests/baselines/reference/APISample_linter.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,20 @@ declare module "typescript" {
15201520
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
15211521
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
15221522
}
1523+
declare module "typescript" {
1524+
/**
1525+
* Read tsconfig.json file
1526+
* @param fileName The path to the config file
1527+
*/
1528+
function readConfigFile(fileName: string): any;
1529+
/**
1530+
* Parse the contents of a config file (tsconfig.json).
1531+
* @param json The contents of the config file to parse
1532+
* @param basePath A root directory to resolve relative path entries in the config
1533+
* file to. e.g. outDir
1534+
*/
1535+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
1536+
}
15231537
declare module "typescript" {
15241538
/** The version of the language service API */
15251539
let servicesVersion: string;

tests/baselines/reference/APISample_linter.types

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4942,6 +4942,27 @@ declare module "typescript" {
49424942
>CompilerHost : CompilerHost
49434943
>Program : Program
49444944
}
4945+
declare module "typescript" {
4946+
/**
4947+
* Read tsconfig.json file
4948+
* @param fileName The path to the config file
4949+
*/
4950+
function readConfigFile(fileName: string): any;
4951+
>readConfigFile : (fileName: string) => any
4952+
>fileName : string
4953+
4954+
/**
4955+
* Parse the contents of a config file (tsconfig.json).
4956+
* @param json The contents of the config file to parse
4957+
* @param basePath A root directory to resolve relative path entries in the config
4958+
* file to. e.g. outDir
4959+
*/
4960+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
4961+
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
4962+
>json : any
4963+
>basePath : string
4964+
>ParsedCommandLine : ParsedCommandLine
4965+
}
49454966
declare module "typescript" {
49464967
/** The version of the language service API */
49474968
let servicesVersion: string;

tests/baselines/reference/APISample_transform.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,20 @@ declare module "typescript" {
15211521
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
15221522
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
15231523
}
1524+
declare module "typescript" {
1525+
/**
1526+
* Read tsconfig.json file
1527+
* @param fileName The path to the config file
1528+
*/
1529+
function readConfigFile(fileName: string): any;
1530+
/**
1531+
* Parse the contents of a config file (tsconfig.json).
1532+
* @param json The contents of the config file to parse
1533+
* @param basePath A root directory to resolve relative path entries in the config
1534+
* file to. e.g. outDir
1535+
*/
1536+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
1537+
}
15241538
declare module "typescript" {
15251539
/** The version of the language service API */
15261540
let servicesVersion: string;

tests/baselines/reference/APISample_transform.types

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4892,6 +4892,27 @@ declare module "typescript" {
48924892
>CompilerHost : CompilerHost
48934893
>Program : Program
48944894
}
4895+
declare module "typescript" {
4896+
/**
4897+
* Read tsconfig.json file
4898+
* @param fileName The path to the config file
4899+
*/
4900+
function readConfigFile(fileName: string): any;
4901+
>readConfigFile : (fileName: string) => any
4902+
>fileName : string
4903+
4904+
/**
4905+
* Parse the contents of a config file (tsconfig.json).
4906+
* @param json The contents of the config file to parse
4907+
* @param basePath A root directory to resolve relative path entries in the config
4908+
* file to. e.g. outDir
4909+
*/
4910+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
4911+
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
4912+
>json : any
4913+
>basePath : string
4914+
>ParsedCommandLine : ParsedCommandLine
4915+
}
48954916
declare module "typescript" {
48964917
/** The version of the language service API */
48974918
let servicesVersion: string;

tests/baselines/reference/APISample_watcher.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,20 @@ declare module "typescript" {
15581558
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
15591559
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
15601560
}
1561+
declare module "typescript" {
1562+
/**
1563+
* Read tsconfig.json file
1564+
* @param fileName The path to the config file
1565+
*/
1566+
function readConfigFile(fileName: string): any;
1567+
/**
1568+
* Parse the contents of a config file (tsconfig.json).
1569+
* @param json The contents of the config file to parse
1570+
* @param basePath A root directory to resolve relative path entries in the config
1571+
* file to. e.g. outDir
1572+
*/
1573+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
1574+
}
15611575
declare module "typescript" {
15621576
/** The version of the language service API */
15631577
let servicesVersion: string;

tests/baselines/reference/APISample_watcher.types

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,6 +5065,27 @@ declare module "typescript" {
50655065
>CompilerHost : CompilerHost
50665066
>Program : Program
50675067
}
5068+
declare module "typescript" {
5069+
/**
5070+
* Read tsconfig.json file
5071+
* @param fileName The path to the config file
5072+
*/
5073+
function readConfigFile(fileName: string): any;
5074+
>readConfigFile : (fileName: string) => any
5075+
>fileName : string
5076+
5077+
/**
5078+
* Parse the contents of a config file (tsconfig.json).
5079+
* @param json The contents of the config file to parse
5080+
* @param basePath A root directory to resolve relative path entries in the config
5081+
* file to. e.g. outDir
5082+
*/
5083+
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
5084+
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
5085+
>json : any
5086+
>basePath : string
5087+
>ParsedCommandLine : ParsedCommandLine
5088+
}
50685089
declare module "typescript" {
50695090
/** The version of the language service API */
50705091
let servicesVersion: string;

0 commit comments

Comments
 (0)