mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
Remove --lib
This commit is contained in:
parent
92bee6a533
commit
f7a55fa5a2
@ -262,39 +262,6 @@ namespace ts {
|
||||
},
|
||||
description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
|
||||
},
|
||||
{
|
||||
name: "lib",
|
||||
type: "list",
|
||||
element: {
|
||||
name: "lib",
|
||||
type: {
|
||||
// JavaScript only
|
||||
"es5": "lib.es5.d.ts",
|
||||
"es6": "lib.es6.d.ts",
|
||||
"es7": "lib.es7.d.ts",
|
||||
// Host only
|
||||
"dom": "lib.dom.d.ts",
|
||||
"webworker": "lib.webworker.d.ts",
|
||||
"scripthost": "lib.scripthost.d.ts",
|
||||
// ES6 Or ESNext By-feature options
|
||||
"es6.array": "lib.es6.array.d.ts",
|
||||
"es6.collection": "lib.es6.collection.d.ts",
|
||||
"es6.function": "lib.es6.function.d.ts",
|
||||
"es6.iterable": "lib.es6.iterable.d.ts",
|
||||
"es6.math": "lib.es6.math.d.ts",
|
||||
"es6.number": "lib.es6.number.d.ts",
|
||||
"es6.object": "lib.es6.object.d.ts",
|
||||
"es6.promise": "lib.es6.promise.d.ts",
|
||||
"es6.proxy": "lib.es6.proxy.d.ts",
|
||||
"es6.reflect": "lib.es6.reflect.d.ts",
|
||||
"es6.regexp": "lib.es6.regexp.d.ts",
|
||||
"es6.symbol": "lib.es6.symbol.d.ts",
|
||||
"es6.symbol.wellknown": "lib.es6.symbol.wellknown.d.ts",
|
||||
"es7.array.include": "lib.es7.array.include.d.ts"
|
||||
},
|
||||
},
|
||||
description: Diagnostics.Specify_library_to_be_included_in_the_compilation_Colon,
|
||||
},
|
||||
{
|
||||
name: "allowUnusedLabels",
|
||||
type: "boolean",
|
||||
@ -385,7 +352,7 @@ namespace ts {
|
||||
name: "exclude",
|
||||
type: "list",
|
||||
element: {
|
||||
name: "include",
|
||||
name: "exclude",
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,52 +31,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
it("Parse single option of library flag ", () => {
|
||||
// --lib es6 0.ts
|
||||
assertParseResult(["--lib", "es6", "0.ts"],
|
||||
{
|
||||
errors: [],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es6.d.ts"]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse multiple options of library flags ", () => {
|
||||
// --lib es5,es6.symbol.wellknown 0.ts
|
||||
assertParseResult(["--lib", "es5,es6.symbol.wellknown", "0.ts"],
|
||||
{
|
||||
errors: [],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse unavailable options of library flags ", () => {
|
||||
// --lib es5,es7 0.ts
|
||||
assertParseResult(["--lib", "es5,es8", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es5.d.ts"]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse empty options of --jsx ", () => {
|
||||
// 0.ts --lib
|
||||
// 0.ts --jsx
|
||||
assertParseResult(["0.ts", "--jsx"],
|
||||
{
|
||||
errors: [{
|
||||
@ -102,7 +58,7 @@ namespace ts {
|
||||
});
|
||||
|
||||
it("Parse empty options of --module ", () => {
|
||||
// 0.ts --lib
|
||||
// 0.ts --
|
||||
assertParseResult(["0.ts", "--module"],
|
||||
{
|
||||
errors: [{
|
||||
@ -128,7 +84,7 @@ namespace ts {
|
||||
});
|
||||
|
||||
it("Parse empty options of --newLine ", () => {
|
||||
// 0.ts --lib
|
||||
// 0.ts --newLine
|
||||
assertParseResult(["0.ts", "--newLine"],
|
||||
{
|
||||
errors: [{
|
||||
@ -154,7 +110,7 @@ namespace ts {
|
||||
});
|
||||
|
||||
it("Parse empty options of --target ", () => {
|
||||
// 0.ts --lib
|
||||
// 0.ts --target
|
||||
assertParseResult(["0.ts", "--target"],
|
||||
{
|
||||
errors: [{
|
||||
@ -180,7 +136,7 @@ namespace ts {
|
||||
});
|
||||
|
||||
it("Parse empty options of --moduleResolution ", () => {
|
||||
// 0.ts --lib
|
||||
// 0.ts --moduleResolution
|
||||
assertParseResult(["0.ts", "--moduleResolution"],
|
||||
{
|
||||
errors: [{
|
||||
@ -205,133 +161,29 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse empty options of --lib ", () => {
|
||||
// 0.ts --lib
|
||||
assertParseResult(["0.ts", "--lib"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Compiler option 'lib' expects an argument.",
|
||||
category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category,
|
||||
code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}, {
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
lib: []
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse --lib option with extra comma ", () => {
|
||||
// --lib es5, es7 0.ts
|
||||
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}],
|
||||
fileNames: ["es7", "0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es5.d.ts"]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse --lib option with trailing white-space ", () => {
|
||||
// --lib es5, es7 0.ts
|
||||
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}],
|
||||
fileNames: ["es7", "0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es5.d.ts"]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse multiple compiler flags with input files at the end", () => {
|
||||
// --lib es5,es6.symbol.wellknown --target es5 0.ts
|
||||
assertParseResult(["--lib", "es5,es6.symbol.wellknown", "--target", "es5", "0.ts"],
|
||||
// --module commonjs --target es5 0.ts
|
||||
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts"],
|
||||
{
|
||||
errors: [],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"],
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
target: ts.ScriptTarget.ES5,
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse multiple compiler flags with input files in the middle", () => {
|
||||
// --module commonjs --target es5 0.ts --lib es5,es6.symbol.wellknown
|
||||
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,es6.symbol.wellknown"],
|
||||
// --module commonjs --target es5 0.ts --noImplicitAny
|
||||
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--noImplicitAny"],
|
||||
{
|
||||
errors: [],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
target: ts.ScriptTarget.ES5,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"],
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse --lib as the last arguments", () => {
|
||||
// --module commonjs --target es5 0.ts --lib es5, es6.symbol.wellknown
|
||||
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,", "es6.symbol.wellknown"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}],
|
||||
fileNames: ["0.ts", "es6.symbol.wellknown"],
|
||||
options: {
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
target: ts.ScriptTarget.ES5,
|
||||
lib: ["lib.es5.d.ts"],
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("Parse multiple library compiler flags ", () => {
|
||||
// --module commonjs --target es5 --lib es5 0.ts --library es6.array,es6.symbol.wellknown
|
||||
assertParseResult(["--module", "commonjs", "--target", "es5", "--lib", "es5", "0.ts", "--lib", "es6.array,es6.symbol.wellknown"],
|
||||
{
|
||||
errors: [],
|
||||
fileNames: ["0.ts"],
|
||||
options: {
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
target: ts.ScriptTarget.ES5,
|
||||
lib: ["lib.es6.array.d.ts", "lib.es6.symbol.wellknown.d.ts"],
|
||||
noImplicitAny: true,
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -31,7 +31,6 @@ namespace ts {
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": ["es5", "es6.array", "es6.symbol"]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
@ -40,7 +39,6 @@ namespace ts {
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.array.d.ts", "lib.es6.symbol.d.ts"]
|
||||
},
|
||||
errors: <Diagnostic[]>[]
|
||||
}
|
||||
@ -56,7 +54,6 @@ namespace ts {
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"allowJs": false,
|
||||
"lib": ["es5", "es6.array", "es6.symbol"]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
@ -66,7 +63,6 @@ namespace ts {
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
allowJs: false,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.array.d.ts", "lib.es6.symbol.d.ts"]
|
||||
},
|
||||
errors: <Diagnostic[]>[]
|
||||
}
|
||||
@ -211,154 +207,6 @@ namespace ts {
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert incorrectly option of libs to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": ["es5", "es6.array", "es8"]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: <CompilerOptions>{
|
||||
module: ModuleKind.CommonJS,
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.array.d.ts"]
|
||||
},
|
||||
errors: [{
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of libs to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": ["es5", ""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: <CompilerOptions>{
|
||||
module: ModuleKind.CommonJS,
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: ["lib.es5.d.ts"]
|
||||
},
|
||||
errors: [{
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of libs to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": [""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: <CompilerOptions>{
|
||||
module: ModuleKind.CommonJS,
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: []
|
||||
},
|
||||
errors: [{
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert trailing-whitespace string option of libs to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": [" "]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: <CompilerOptions>{
|
||||
module: ModuleKind.CommonJS,
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: []
|
||||
},
|
||||
errors: [{
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty option of libs to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": []
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: <CompilerOptions>{
|
||||
module: ModuleKind.CommonJS,
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: []
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert incorrectly format tsconfig.json to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
@ -398,7 +246,6 @@ namespace ts {
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"lib": ["es5", "es6.array", "es6.symbol"]
|
||||
}
|
||||
}, "jsconfig.json",
|
||||
{
|
||||
@ -408,7 +255,6 @@ namespace ts {
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.array.d.ts", "lib.es6.symbol.d.ts"]
|
||||
},
|
||||
errors: <Diagnostic[]>[]
|
||||
}
|
||||
@ -424,7 +270,6 @@ namespace ts {
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"allowJs": false,
|
||||
"lib": ["es5", "es6.array", "es6.symbol"]
|
||||
}
|
||||
}, "jsconfig.json",
|
||||
{
|
||||
@ -434,7 +279,6 @@ namespace ts {
|
||||
target: ScriptTarget.ES5,
|
||||
noImplicitAny: false,
|
||||
sourceMap: false,
|
||||
lib: ["lib.es5.d.ts", "lib.es6.array.d.ts", "lib.es6.symbol.d.ts"]
|
||||
},
|
||||
errors: <Diagnostic[]>[]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user