mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #2563 from Microsoft/exposeConfigFileHelpers
Expose readConfigFile and parseConfigFile
This commit is contained in:
1
Jakefile
1
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",
|
||||
];
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/// <reference path="scanner.ts"/>
|
||||
|
||||
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[] = [];
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4838,6 +4838,27 @@ declare module "typescript" {
|
||||
>TypeReference : TypeReference
|
||||
|
||||
instantiations: Map<TypeReference>;
|
||||
|
||||
>instantiations : Map<TypeReference>
|
||||
>Map : Map<T>
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface TupleType extends ObjectType {
|
||||
|
||||
>TupleType : TupleType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
elementTypes: Type[];
|
||||
|
||||
>elementTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
baseArrayType: TypeReference;
|
||||
|
||||
>baseArrayType : TypeReference
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface UnionType extends Type {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4984,6 +4984,27 @@ declare module "typescript" {
|
||||
>TypeReference : TypeReference
|
||||
|
||||
instantiations: Map<TypeReference>;
|
||||
|
||||
>instantiations : Map<TypeReference>
|
||||
>Map : Map<T>
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface TupleType extends ObjectType {
|
||||
|
||||
>TupleType : TupleType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
elementTypes: Type[];
|
||||
|
||||
>elementTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
baseArrayType: TypeReference;
|
||||
|
||||
>baseArrayType : TypeReference
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface UnionType extends Type {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4934,6 +4934,27 @@ declare module "typescript" {
|
||||
>TypeReference : TypeReference
|
||||
|
||||
instantiations: Map<TypeReference>;
|
||||
|
||||
>instantiations : Map<TypeReference>
|
||||
>Map : Map<T>
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface TupleType extends ObjectType {
|
||||
|
||||
>TupleType : TupleType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
elementTypes: Type[];
|
||||
|
||||
>elementTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
baseArrayType: TypeReference;
|
||||
|
||||
>baseArrayType : TypeReference
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface UnionType extends Type {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5107,6 +5107,27 @@ declare module "typescript" {
|
||||
>TypeReference : TypeReference
|
||||
|
||||
instantiations: Map<TypeReference>;
|
||||
|
||||
>instantiations : Map<TypeReference>
|
||||
>Map : Map<T>
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface TupleType extends ObjectType {
|
||||
|
||||
>TupleType : TupleType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
elementTypes: Type[];
|
||||
|
||||
>elementTypes : Type[]
|
||||
>Type : Type
|
||||
|
||||
baseArrayType: TypeReference;
|
||||
|
||||
>baseArrayType : TypeReference
|
||||
>TypeReference : TypeReference
|
||||
}
|
||||
|
||||
interface UnionType extends Type {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user