@typescript/vfs 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +89 -85
- package/dist/vfs.cjs.development.js +71 -57
- package/dist/vfs.cjs.development.js.map +1 -1
- package/dist/vfs.cjs.production.min.js +1 -1
- package/dist/vfs.cjs.production.min.js.map +1 -1
- package/dist/vfs.esm.js +71 -57
- package/dist/vfs.esm.js.map +1 -1
- package/dist/vfs.globals.js +71 -57
- package/package.json +13 -2
- package/CHANGELOG.md +0 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface VirtualTypeScriptEnvironment {
|
|
9
|
-
sys: System;
|
|
10
|
-
languageService: import("typescript").LanguageService;
|
|
11
|
-
getSourceFile: (fileName: string) => import("typescript").SourceFile | undefined;
|
|
12
|
-
createFile: (fileName: string, content: string) => void;
|
|
13
|
-
updateFile: (fileName: string, content: string, replaceTextSpan?: import("typescript").TextSpan) => void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
|
|
17
|
-
* @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
|
|
18
|
-
*
|
|
19
|
-
* @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
|
|
20
|
-
* @param rootFiles a list of files which are considered inside the project
|
|
21
|
-
* @param ts a copy pf the TypeScript module
|
|
22
|
-
* @param compilerOptions the options for this compiler run
|
|
23
|
-
* @param customTransformers custom transformers for this compiler run
|
|
24
|
-
*/
|
|
25
|
-
export declare function createVirtualTypeScriptEnvironment(sys: System, rootFiles: string[], ts: TS, compilerOptions?: CompilerOptions, customTransformers?: CustomTransformers): VirtualTypeScriptEnvironment;
|
|
26
|
-
/**
|
|
27
|
-
* Grab the list of lib files for a particular target, will return a bit more than necessary (by including
|
|
28
|
-
* the dom) but that's OK
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @param
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export declare const
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
export {
|
|
1
|
+
type System = import("typescript").System;
|
|
2
|
+
type CompilerOptions = import("typescript").CompilerOptions;
|
|
3
|
+
type CustomTransformers = import("typescript").CustomTransformers;
|
|
4
|
+
type LanguageServiceHost = import("typescript").LanguageServiceHost;
|
|
5
|
+
type CompilerHost = import("typescript").CompilerHost;
|
|
6
|
+
type SourceFile = import("typescript").SourceFile;
|
|
7
|
+
type TS = typeof import("typescript");
|
|
8
|
+
export interface VirtualTypeScriptEnvironment {
|
|
9
|
+
sys: System;
|
|
10
|
+
languageService: import("typescript").LanguageService;
|
|
11
|
+
getSourceFile: (fileName: string) => import("typescript").SourceFile | undefined;
|
|
12
|
+
createFile: (fileName: string, content: string) => void;
|
|
13
|
+
updateFile: (fileName: string, content: string, replaceTextSpan?: import("typescript").TextSpan) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
|
|
17
|
+
* @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
|
|
18
|
+
*
|
|
19
|
+
* @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
|
|
20
|
+
* @param rootFiles a list of files which are considered inside the project
|
|
21
|
+
* @param ts a copy pf the TypeScript module
|
|
22
|
+
* @param compilerOptions the options for this compiler run
|
|
23
|
+
* @param customTransformers custom transformers for this compiler run
|
|
24
|
+
*/
|
|
25
|
+
export declare function createVirtualTypeScriptEnvironment(sys: System, rootFiles: string[], ts: TS, compilerOptions?: CompilerOptions, customTransformers?: CustomTransformers): VirtualTypeScriptEnvironment;
|
|
26
|
+
/**
|
|
27
|
+
* Grab the list of lib files for a particular target, will return a bit more than necessary (by including
|
|
28
|
+
* the dom) but that's OK, we're really working with the constraint that you can't get a list of files
|
|
29
|
+
* when running in a browser.
|
|
30
|
+
*
|
|
31
|
+
* @param target The compiler settings target baseline
|
|
32
|
+
* @param ts A copy of the TypeScript module
|
|
33
|
+
*/
|
|
34
|
+
export declare const knownLibFilesForCompilerOptions: (compilerOptions: CompilerOptions, ts: TS) => string[];
|
|
35
|
+
/**
|
|
36
|
+
* Sets up a Map with lib contents by grabbing the necessary files from
|
|
37
|
+
* the local copy of typescript via the file system.
|
|
38
|
+
*
|
|
39
|
+
* The first two args are un-used, but kept around so as to not cause a
|
|
40
|
+
* semver major bump for no gain to module users.
|
|
41
|
+
*/
|
|
42
|
+
export declare const createDefaultMapFromNodeModules: (_compilerOptions: CompilerOptions, _ts?: typeof import("typescript"), tsLibDirectory?: string) => Map<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* Adds recursively files from the FS into the map based on the folder
|
|
45
|
+
*/
|
|
46
|
+
export declare const addAllFilesFromFolder: (map: Map<string, string>, workingDir: string) => void;
|
|
47
|
+
/** Adds all files from node_modules/@types into the FS Map */
|
|
48
|
+
export declare const addFilesForTypesIntoFolder: (map: Map<string, string>) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Create a virtual FS Map with the lib files from a particular TypeScript
|
|
51
|
+
* version based on the target, Always includes dom ATM.
|
|
52
|
+
*
|
|
53
|
+
* @param options The compiler target, which dictates the libs to set up
|
|
54
|
+
* @param version the versions of TypeScript which are supported
|
|
55
|
+
* @param cache should the values be stored in local storage
|
|
56
|
+
* @param ts a copy of the typescript import
|
|
57
|
+
* @param lzstring an optional copy of the lz-string import
|
|
58
|
+
* @param fetcher an optional replacement for the global fetch function (tests mainly)
|
|
59
|
+
* @param storer an optional replacement for the localStorage global (tests mainly)
|
|
60
|
+
*/
|
|
61
|
+
export declare const createDefaultMapFromCDN: (options: CompilerOptions, version: string, cache: boolean, ts: TS, lzstring?: typeof import("lz-string"), fetcher?: typeof fetch, storer?: typeof localStorage) => Promise<Map<string, string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
64
|
+
* is what provides read/write aspects of the virtual fs
|
|
65
|
+
*/
|
|
66
|
+
export declare function createSystem(files: Map<string, string>): System;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a file-system backed System object which can be used in a TypeScript program, you provide
|
|
69
|
+
* a set of virtual files which are prioritised over the FS versions, then a path to the root of your
|
|
70
|
+
* project (basically the folder your node_modules lives)
|
|
71
|
+
*/
|
|
72
|
+
export declare function createFSBackedSystem(files: Map<string, string>, _projectRoot: string, ts: TS, tsLibDirectory?: string): System;
|
|
73
|
+
/**
|
|
74
|
+
* Creates an in-memory CompilerHost -which is essentially an extra wrapper to System
|
|
75
|
+
* which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile
|
|
76
|
+
* instances to the in-memory file system.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createVirtualCompilerHost(sys: System, compilerOptions: CompilerOptions, ts: TS): {
|
|
79
|
+
compilerHost: CompilerHost;
|
|
80
|
+
updateFile: (sourceFile: SourceFile) => boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Creates an object which can host a language service against the virtual file-system
|
|
84
|
+
*/
|
|
85
|
+
export declare function createVirtualLanguageServiceHost(sys: System, rootFiles: string[], compilerOptions: CompilerOptions, ts: TS, customTransformers?: CustomTransformers): {
|
|
86
|
+
languageServiceHost: LanguageServiceHost;
|
|
87
|
+
updateFile: (sourceFile: import("typescript").SourceFile) => void;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
@@ -31,15 +31,15 @@ var shouldDebug = hasLocalStorage && /*#__PURE__*/localStorage.getItem("DEBUG")
|
|
|
31
31
|
var debugLog = shouldDebug ? console.log : function (_message) {
|
|
32
32
|
return "";
|
|
33
33
|
};
|
|
34
|
-
/**
|
|
35
|
-
* Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
|
|
36
|
-
* @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
|
|
37
|
-
*
|
|
38
|
-
* @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
|
|
39
|
-
* @param rootFiles a list of files which are considered inside the project
|
|
40
|
-
* @param ts a copy pf the TypeScript module
|
|
41
|
-
* @param compilerOptions the options for this compiler run
|
|
42
|
-
* @param customTransformers custom transformers for this compiler run
|
|
34
|
+
/**
|
|
35
|
+
* Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
|
|
36
|
+
* @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
|
|
37
|
+
*
|
|
38
|
+
* @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
|
|
39
|
+
* @param rootFiles a list of files which are considered inside the project
|
|
40
|
+
* @param ts a copy pf the TypeScript module
|
|
41
|
+
* @param compilerOptions the options for this compiler run
|
|
42
|
+
* @param customTransformers custom transformers for this compiler run
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
function createVirtualTypeScriptEnvironment(sys, rootFiles, ts, compilerOptions, customTransformers) {
|
|
@@ -93,19 +93,25 @@ function createVirtualTypeScriptEnvironment(sys, rootFiles, ts, compilerOptions,
|
|
|
93
93
|
_updateFile(newSourceFile);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
96
|
+
} // TODO: This could be replaced by grabbing: https://github.com/microsoft/TypeScript/blob/main/src/lib/libs.json
|
|
97
|
+
// and then using that to generate the list of files from the server, but it is not included in the npm package
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Grab the list of lib files for a particular target, will return a bit more than necessary (by including
|
|
101
|
+
* the dom) but that's OK, we're really working with the constraint that you can't get a list of files
|
|
102
|
+
* when running in a browser.
|
|
103
|
+
*
|
|
104
|
+
* @param target The compiler settings target baseline
|
|
105
|
+
* @param ts A copy of the TypeScript module
|
|
103
106
|
*/
|
|
104
107
|
|
|
105
108
|
var knownLibFilesForCompilerOptions = function knownLibFilesForCompilerOptions(compilerOptions, ts) {
|
|
106
109
|
var target = compilerOptions.target || ts.ScriptTarget.ES5;
|
|
107
|
-
var lib = compilerOptions.lib || [];
|
|
108
|
-
|
|
110
|
+
var lib = compilerOptions.lib || []; // Note that this will include files which can't be found for particular versions of TS
|
|
111
|
+
// TODO: Replace this with some sort of API call if https://github.com/microsoft/TypeScript/pull/54011
|
|
112
|
+
// or similar is merged.
|
|
113
|
+
|
|
114
|
+
var files = ["lib.d.ts", "lib.decorators.d.ts", "lib.decorators.legacy.d.ts", "lib.dom.d.ts", "lib.dom.iterable.d.ts", "lib.webworker.d.ts", "lib.webworker.importscripts.d.ts", "lib.webworker.iterable.d.ts", "lib.scripthost.d.ts", "lib.es5.d.ts", "lib.es6.d.ts", "lib.es2015.collection.d.ts", "lib.es2015.core.d.ts", "lib.es2015.d.ts", "lib.es2015.generator.d.ts", "lib.es2015.iterable.d.ts", "lib.es2015.promise.d.ts", "lib.es2015.proxy.d.ts", "lib.es2015.reflect.d.ts", "lib.es2015.symbol.d.ts", "lib.es2015.symbol.wellknown.d.ts", "lib.es2016.array.include.d.ts", "lib.es2016.d.ts", "lib.es2016.full.d.ts", "lib.es2017.d.ts", "lib.es2017.date.d.ts", "lib.es2017.full.d.ts", "lib.es2017.intl.d.ts", "lib.es2017.object.d.ts", "lib.es2017.sharedmemory.d.ts", "lib.es2017.string.d.ts", "lib.es2017.typedarrays.d.ts", "lib.es2018.asyncgenerator.d.ts", "lib.es2018.asynciterable.d.ts", "lib.es2018.d.ts", "lib.es2018.full.d.ts", "lib.es2018.intl.d.ts", "lib.es2018.promise.d.ts", "lib.es2018.regexp.d.ts", "lib.es2019.array.d.ts", "lib.es2019.d.ts", "lib.es2019.full.d.ts", "lib.es2019.intl.d.ts", "lib.es2019.object.d.ts", "lib.es2019.string.d.ts", "lib.es2019.symbol.d.ts", "lib.es2020.bigint.d.ts", "lib.es2020.d.ts", "lib.es2020.date.d.ts", "lib.es2020.full.d.ts", "lib.es2020.intl.d.ts", "lib.es2020.number.d.ts", "lib.es2020.promise.d.ts", "lib.es2020.sharedmemory.d.ts", "lib.es2020.string.d.ts", "lib.es2020.symbol.wellknown.d.ts", "lib.es2021.d.ts", "lib.es2021.full.d.ts", "lib.es2021.intl.d.ts", "lib.es2021.promise.d.ts", "lib.es2021.string.d.ts", "lib.es2021.weakref.d.ts", "lib.es2022.array.d.ts", "lib.es2022.d.ts", "lib.es2022.error.d.ts", "lib.es2022.full.d.ts", "lib.es2022.intl.d.ts", "lib.es2022.object.d.ts", "lib.es2022.regexp.d.ts", "lib.es2022.sharedmemory.d.ts", "lib.es2022.string.d.ts", "lib.es2023.array.d.ts", "lib.es2023.collection.d.ts", "lib.es2023.d.ts", "lib.es2023.full.d.ts", "lib.esnext.array.d.ts", "lib.esnext.asynciterable.d.ts", "lib.esnext.bigint.d.ts", "lib.esnext.d.ts", "lib.esnext.decorators.d.ts", "lib.esnext.disposable.d.ts", "lib.esnext.full.d.ts", "lib.esnext.intl.d.ts", "lib.esnext.promise.d.ts", "lib.esnext.string.d.ts", "lib.esnext.symbol.d.ts", "lib.esnext.weakref.d.ts"];
|
|
109
115
|
var targetToCut = ts.ScriptTarget[target];
|
|
110
116
|
var matches = files.filter(function (f) {
|
|
111
117
|
return f.startsWith("lib." + targetToCut.toLowerCase());
|
|
@@ -131,14 +137,15 @@ var knownLibFilesForCompilerOptions = function knownLibFilesForCompilerOptions(c
|
|
|
131
137
|
var finalCutIndex = Math.max(targetCutIndex, libCutIndex);
|
|
132
138
|
return files.slice(0, finalCutIndex + 1);
|
|
133
139
|
};
|
|
134
|
-
/**
|
|
135
|
-
* Sets up a Map with lib contents by grabbing the necessary files from
|
|
136
|
-
* the local copy of typescript via the file system.
|
|
140
|
+
/**
|
|
141
|
+
* Sets up a Map with lib contents by grabbing the necessary files from
|
|
142
|
+
* the local copy of typescript via the file system.
|
|
143
|
+
*
|
|
144
|
+
* The first two args are un-used, but kept around so as to not cause a
|
|
145
|
+
* semver major bump for no gain to module users.
|
|
137
146
|
*/
|
|
138
147
|
|
|
139
|
-
var createDefaultMapFromNodeModules = function createDefaultMapFromNodeModules(
|
|
140
|
-
var tsModule = ts || require("typescript");
|
|
141
|
-
|
|
148
|
+
var createDefaultMapFromNodeModules = function createDefaultMapFromNodeModules(_compilerOptions, _ts, tsLibDirectory) {
|
|
142
149
|
var path = requirePath();
|
|
143
150
|
var fs = requireFS();
|
|
144
151
|
|
|
@@ -147,15 +154,18 @@ var createDefaultMapFromNodeModules = function createDefaultMapFromNodeModules(c
|
|
|
147
154
|
return fs.readFileSync(path.join(lib, name), "utf8");
|
|
148
155
|
};
|
|
149
156
|
|
|
150
|
-
var
|
|
157
|
+
var libFiles = fs.readdirSync(tsLibDirectory || path.dirname(require.resolve("typescript")));
|
|
158
|
+
var knownLibFiles = libFiles.filter(function (f) {
|
|
159
|
+
return f.startsWith("lib.") && f.endsWith(".d.ts");
|
|
160
|
+
});
|
|
151
161
|
var fsMap = new Map();
|
|
152
|
-
|
|
162
|
+
knownLibFiles.forEach(function (lib) {
|
|
153
163
|
fsMap.set("/" + lib, getLib(lib));
|
|
154
164
|
});
|
|
155
165
|
return fsMap;
|
|
156
166
|
};
|
|
157
|
-
/**
|
|
158
|
-
* Adds recursively files from the FS into the map based on the folder
|
|
167
|
+
/**
|
|
168
|
+
* Adds recursively files from the FS into the map based on the folder
|
|
159
169
|
*/
|
|
160
170
|
|
|
161
171
|
var addAllFilesFromFolder = function addAllFilesFromFolder(map, workingDir) {
|
|
@@ -196,17 +206,17 @@ var addAllFilesFromFolder = function addAllFilesFromFolder(map, workingDir) {
|
|
|
196
206
|
var addFilesForTypesIntoFolder = function addFilesForTypesIntoFolder(map) {
|
|
197
207
|
return addAllFilesFromFolder(map, "node_modules/@types");
|
|
198
208
|
};
|
|
199
|
-
/**
|
|
200
|
-
* Create a virtual FS Map with the lib files from a particular TypeScript
|
|
201
|
-
* version based on the target, Always includes dom ATM.
|
|
202
|
-
*
|
|
203
|
-
* @param options The compiler target, which dictates the libs to set up
|
|
204
|
-
* @param version the versions of TypeScript which are supported
|
|
205
|
-
* @param cache should the values be stored in local storage
|
|
206
|
-
* @param ts a copy of the typescript import
|
|
207
|
-
* @param lzstring an optional copy of the lz-string import
|
|
208
|
-
* @param fetcher an optional replacement for the global fetch function (tests mainly)
|
|
209
|
-
* @param storer an optional replacement for the localStorage global (tests mainly)
|
|
209
|
+
/**
|
|
210
|
+
* Create a virtual FS Map with the lib files from a particular TypeScript
|
|
211
|
+
* version based on the target, Always includes dom ATM.
|
|
212
|
+
*
|
|
213
|
+
* @param options The compiler target, which dictates the libs to set up
|
|
214
|
+
* @param version the versions of TypeScript which are supported
|
|
215
|
+
* @param cache should the values be stored in local storage
|
|
216
|
+
* @param ts a copy of the typescript import
|
|
217
|
+
* @param lzstring an optional copy of the lz-string import
|
|
218
|
+
* @param fetcher an optional replacement for the global fetch function (tests mainly)
|
|
219
|
+
* @param storer an optional replacement for the localStorage global (tests mainly)
|
|
210
220
|
*/
|
|
211
221
|
|
|
212
222
|
var createDefaultMapFromCDN = function createDefaultMapFromCDN(options, version, cache, ts, lzstring, fetcher, storer) {
|
|
@@ -233,13 +243,14 @@ var createDefaultMapFromCDN = function createDefaultMapFromCDN(options, version,
|
|
|
233
243
|
contents.forEach(function (text, index) {
|
|
234
244
|
return fsMap.set("/" + files[index], text);
|
|
235
245
|
});
|
|
236
|
-
})
|
|
246
|
+
}) // Return a NOOP for .d.ts files which aren't in the current build of TypeScript
|
|
247
|
+
["catch"](function () {});
|
|
237
248
|
} // A localstorage and lzzip aware version of the lib files
|
|
238
249
|
|
|
239
250
|
|
|
240
251
|
function cached() {
|
|
241
252
|
var storelike = storer || localStorage;
|
|
242
|
-
var keys = Object.keys(
|
|
253
|
+
var keys = Object.keys(storelike);
|
|
243
254
|
keys.forEach(function (key) {
|
|
244
255
|
// Remove anything which isn't from this version
|
|
245
256
|
if (key.startsWith("ts-lib-") && !key.startsWith("ts-lib-" + version)) {
|
|
@@ -257,14 +268,17 @@ var createDefaultMapFromCDN = function createDefaultMapFromCDN(options, version,
|
|
|
257
268
|
}).then(function (t) {
|
|
258
269
|
storelike.setItem(cacheKey, zip(t));
|
|
259
270
|
return t;
|
|
260
|
-
})
|
|
271
|
+
}) // Return a NOOP for .d.ts files which aren't in the current build of TypeScript
|
|
272
|
+
["catch"](function () {});
|
|
261
273
|
} else {
|
|
262
274
|
return Promise.resolve(unzip(content));
|
|
263
275
|
}
|
|
264
276
|
})).then(function (contents) {
|
|
265
277
|
contents.forEach(function (text, index) {
|
|
266
|
-
|
|
267
|
-
|
|
278
|
+
if (text) {
|
|
279
|
+
var name = "/" + files[index];
|
|
280
|
+
fsMap.set(name, text);
|
|
281
|
+
}
|
|
268
282
|
});
|
|
269
283
|
});
|
|
270
284
|
}
|
|
@@ -312,9 +326,9 @@ var defaultCompilerOptions = function defaultCompilerOptions(ts) {
|
|
|
312
326
|
var libize = function libize(path) {
|
|
313
327
|
return path.replace("/", "/lib.").toLowerCase();
|
|
314
328
|
};
|
|
315
|
-
/**
|
|
316
|
-
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
317
|
-
* is what provides read/write aspects of the virtual fs
|
|
329
|
+
/**
|
|
330
|
+
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
331
|
+
* is what provides read/write aspects of the virtual fs
|
|
318
332
|
*/
|
|
319
333
|
|
|
320
334
|
|
|
@@ -364,10 +378,10 @@ function createSystem(files) {
|
|
|
364
378
|
}
|
|
365
379
|
};
|
|
366
380
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Creates a file-system backed System object which can be used in a TypeScript program, you provide
|
|
369
|
-
* a set of virtual files which are prioritised over the FS versions, then a path to the root of your
|
|
370
|
-
* project (basically the folder your node_modules lives)
|
|
381
|
+
/**
|
|
382
|
+
* Creates a file-system backed System object which can be used in a TypeScript program, you provide
|
|
383
|
+
* a set of virtual files which are prioritised over the FS versions, then a path to the root of your
|
|
384
|
+
* project (basically the folder your node_modules lives)
|
|
371
385
|
*/
|
|
372
386
|
|
|
373
387
|
function createFSBackedSystem(files, _projectRoot, ts, tsLibDirectory) {
|
|
@@ -450,10 +464,10 @@ function createFSBackedSystem(files, _projectRoot, ts, tsLibDirectory) {
|
|
|
450
464
|
}
|
|
451
465
|
};
|
|
452
466
|
}
|
|
453
|
-
/**
|
|
454
|
-
* Creates an in-memory CompilerHost -which is essentially an extra wrapper to System
|
|
455
|
-
* which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile
|
|
456
|
-
* instances to the in-memory file system.
|
|
467
|
+
/**
|
|
468
|
+
* Creates an in-memory CompilerHost -which is essentially an extra wrapper to System
|
|
469
|
+
* which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile
|
|
470
|
+
* instances to the in-memory file system.
|
|
457
471
|
*/
|
|
458
472
|
|
|
459
473
|
function createVirtualCompilerHost(sys, compilerOptions, ts) {
|
|
@@ -495,8 +509,8 @@ function createVirtualCompilerHost(sys, compilerOptions, ts) {
|
|
|
495
509
|
};
|
|
496
510
|
return vHost;
|
|
497
511
|
}
|
|
498
|
-
/**
|
|
499
|
-
* Creates an object which can host a language service against the virtual file-system
|
|
512
|
+
/**
|
|
513
|
+
* Creates an object which can host a language service against the virtual file-system
|
|
500
514
|
*/
|
|
501
515
|
|
|
502
516
|
function createVirtualLanguageServiceHost(sys, rootFiles, compilerOptions, ts, customTransformers) {
|