Skip to content

Commit c05923b

Browse files
committedMay 4, 2018
add libMap and libs exports
1 parent b5540a5 commit c05923b

File tree

2 files changed

+50
-37
lines changed

2 files changed

+50
-37
lines changed
 

‎src/compiler/commandLineParser.ts

+49-37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
11
namespace ts {
22
/* @internal */
33
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" };
4+
5+
const commandLineLibMap = createMapFromTemplate({
6+
// JavaScript only
7+
"es5": "lib.es5.d.ts",
8+
"es6": "lib.es2015.d.ts",
9+
"es2015": "lib.es2015.d.ts",
10+
"es7": "lib.es2016.d.ts",
11+
"es2016": "lib.es2016.d.ts",
12+
"es2017": "lib.es2017.d.ts",
13+
"es2018": "lib.es2018.d.ts",
14+
"esnext": "lib.esnext.d.ts",
15+
// Host only
16+
"dom": "lib.dom.d.ts",
17+
"dom.iterable": "lib.dom.iterable.d.ts",
18+
"webworker": "lib.webworker.d.ts",
19+
"scripthost": "lib.scripthost.d.ts",
20+
// ES2015 Or ESNext By-feature options
21+
"es2015.core": "lib.es2015.core.d.ts",
22+
"es2015.collection": "lib.es2015.collection.d.ts",
23+
"es2015.generator": "lib.es2015.generator.d.ts",
24+
"es2015.iterable": "lib.es2015.iterable.d.ts",
25+
"es2015.promise": "lib.es2015.promise.d.ts",
26+
"es2015.proxy": "lib.es2015.proxy.d.ts",
27+
"es2015.reflect": "lib.es2015.reflect.d.ts",
28+
"es2015.symbol": "lib.es2015.symbol.d.ts",
29+
"es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
30+
"es2016.array.include": "lib.es2016.array.include.d.ts",
31+
"es2017.object": "lib.es2017.object.d.ts",
32+
"es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
33+
"es2017.string": "lib.es2017.string.d.ts",
34+
"es2017.intl": "lib.es2017.intl.d.ts",
35+
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
36+
"es2018.intl": "lib.es2018.intl.d.ts",
37+
"es2018.promise": "lib.es2018.promise.d.ts",
38+
"es2018.regexp": "lib.es2018.regexp.d.ts",
39+
"esnext.array": "lib.esnext.array.d.ts",
40+
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
41+
});
42+
43+
// Internally we add some additional lib references that we only support when used as part of a
44+
// "lib" reference directive. They are not available on the command line or in tsconfig.json.
45+
/* @internal */
46+
export const libMap = cloneMap(commandLineLibMap)
47+
.set("webworker.importscripts", "lib.webworker.importscripts.d.ts");
48+
49+
/* @internal */
50+
export const libs = arrayFrom(commandLineLibMap.keys());
51+
452
/* @internal */
553
export const optionDeclarations: CommandLineOption[] = [
654
// CommandLine only options
@@ -114,43 +162,7 @@ namespace ts {
114162
type: "list",
115163
element: {
116164
name: "lib",
117-
type: createMapFromTemplate({
118-
// JavaScript only
119-
"es5": "lib.es5.d.ts",
120-
"es6": "lib.es2015.d.ts",
121-
"es2015": "lib.es2015.d.ts",
122-
"es7": "lib.es2016.d.ts",
123-
"es2016": "lib.es2016.d.ts",
124-
"es2017": "lib.es2017.d.ts",
125-
"es2018": "lib.es2018.d.ts",
126-
"esnext": "lib.esnext.d.ts",
127-
// Host only
128-
"dom": "lib.dom.d.ts",
129-
"dom.iterable": "lib.dom.iterable.d.ts",
130-
"webworker": "lib.webworker.d.ts",
131-
"scripthost": "lib.scripthost.d.ts",
132-
// ES2015 Or ESNext By-feature options
133-
"es2015.core": "lib.es2015.core.d.ts",
134-
"es2015.collection": "lib.es2015.collection.d.ts",
135-
"es2015.generator": "lib.es2015.generator.d.ts",
136-
"es2015.iterable": "lib.es2015.iterable.d.ts",
137-
"es2015.promise": "lib.es2015.promise.d.ts",
138-
"es2015.proxy": "lib.es2015.proxy.d.ts",
139-
"es2015.reflect": "lib.es2015.reflect.d.ts",
140-
"es2015.symbol": "lib.es2015.symbol.d.ts",
141-
"es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
142-
"es2016.array.include": "lib.es2016.array.include.d.ts",
143-
"es2017.object": "lib.es2017.object.d.ts",
144-
"es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
145-
"es2017.string": "lib.es2017.string.d.ts",
146-
"es2017.intl": "lib.es2017.intl.d.ts",
147-
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
148-
"es2018.intl": "lib.es2018.intl.d.ts",
149-
"es2018.promise": "lib.es2018.promise.d.ts",
150-
"es2018.regexp": "lib.es2018.regexp.d.ts",
151-
"esnext.array": "lib.esnext.array.d.ts",
152-
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
153-
}),
165+
type: commandLineLibMap
154166
},
155167
showInSimplifiedHelpView: true,
156168
category: Diagnostics.Basic_Options,

‎src/lib/libs.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dom.generated",
1212
"dom.iterable",
1313
"webworker.generated",
14+
"webworker.importscripts",
1415
"scripthost",
1516
// By-feature options
1617
"es2015.core",

0 commit comments

Comments
 (0)
Please sign in to comment.