@typescript/vfs 1.4.0 → 1.5.1
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 +92 -138
- 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 +92 -138
- package/dist/vfs.esm.js.map +1 -1
- package/dist/vfs.globals.js +92 -138
- package/package.json +27 -14
- 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 {};
|