fcis 0.1.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/.plans/001-fcis-analyzer.md +832 -0
- package/.plans/002-fcis-analyzer-improvements.md +205 -0
- package/README.md +272 -0
- package/TECHNICAL.md +386 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1836 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +709 -0
- package/dist/index.js +1845 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
- package/pnpm-workspace.yaml +0 -0
- package/src/analyzer.ts +266 -0
- package/src/classification/classifier.ts +156 -0
- package/src/classification/derive-status.ts +171 -0
- package/src/classification/quality-scorer.ts +481 -0
- package/src/cli.ts +286 -0
- package/src/detection/detect-markers.ts +480 -0
- package/src/detection/markers.ts +332 -0
- package/src/extraction/extract-functions.ts +570 -0
- package/src/extraction/extractor.ts +188 -0
- package/src/index.ts +111 -0
- package/src/reporting/report-console.ts +416 -0
- package/src/reporting/report-json.ts +232 -0
- package/src/scoring/scorer.ts +504 -0
- package/src/types.ts +248 -0
- package/tests/classifier.test.ts +480 -0
- package/tests/derive-status.test.ts +464 -0
- package/tests/detect-markers.test.ts +639 -0
- package/tests/extractor.test.ts +155 -0
- package/tests/integration.test.ts +706 -0
- package/tests/quality-scorer.test.ts +650 -0
- package/tests/scorer.test.ts +768 -0
- package/tsconfig.json +34 -0
- package/tsup.config.ts +17 -0
- package/vendor/ts-morph/.editorconfig +10 -0
- package/vendor/ts-morph/.gitattributes +11 -0
- package/vendor/ts-morph/.github/CODE_OF_CONDUCT.md +77 -0
- package/vendor/ts-morph/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/vendor/ts-morph/.github/ISSUE_TEMPLATE/custom.md +4 -0
- package/vendor/ts-morph/.github/ISSUE_TEMPLATE/feature_request.md +18 -0
- package/vendor/ts-morph/.github/workflows/ci.yml +50 -0
- package/vendor/ts-morph/.github/workflows/publish.yml +53 -0
- package/vendor/ts-morph/.vscode/settings.json +10 -0
- package/vendor/ts-morph/CONTRIBUTING.md +23 -0
- package/vendor/ts-morph/DEVELOPMENT.md +32 -0
- package/vendor/ts-morph/LICENSE +21 -0
- package/vendor/ts-morph/deno.json +8 -0
- package/vendor/ts-morph/deno.lock +1233 -0
- package/vendor/ts-morph/docs/CNAME +1 -0
- package/vendor/ts-morph/docs/Gemfile +2 -0
- package/vendor/ts-morph/docs/_config.yml +5 -0
- package/vendor/ts-morph/docs/_layouts/default.html +159 -0
- package/vendor/ts-morph/docs/_script-templates/main.ts +116 -0
- package/vendor/ts-morph/docs/assets/css/style.scss +212 -0
- package/vendor/ts-morph/docs/details/ambient.md +38 -0
- package/vendor/ts-morph/docs/details/async.md +31 -0
- package/vendor/ts-morph/docs/details/classes.md +314 -0
- package/vendor/ts-morph/docs/details/comment-ranges.md +7 -0
- package/vendor/ts-morph/docs/details/comments.md +122 -0
- package/vendor/ts-morph/docs/details/decorators.md +119 -0
- package/vendor/ts-morph/docs/details/documentation.md +73 -0
- package/vendor/ts-morph/docs/details/enums.md +117 -0
- package/vendor/ts-morph/docs/details/exports.md +308 -0
- package/vendor/ts-morph/docs/details/expressions.md +46 -0
- package/vendor/ts-morph/docs/details/functions.md +150 -0
- package/vendor/ts-morph/docs/details/generators.md +27 -0
- package/vendor/ts-morph/docs/details/identifiers.md +79 -0
- package/vendor/ts-morph/docs/details/imports.md +191 -0
- package/vendor/ts-morph/docs/details/index.md +52 -0
- package/vendor/ts-morph/docs/details/initializers.md +40 -0
- package/vendor/ts-morph/docs/details/interfaces.md +218 -0
- package/vendor/ts-morph/docs/details/literals.md +20 -0
- package/vendor/ts-morph/docs/details/modifiers.md +38 -0
- package/vendor/ts-morph/docs/details/modules.md +113 -0
- package/vendor/ts-morph/docs/details/namespaces.md +7 -0
- package/vendor/ts-morph/docs/details/object-literal-expressions.md +106 -0
- package/vendor/ts-morph/docs/details/parameters.md +64 -0
- package/vendor/ts-morph/docs/details/signatures.md +41 -0
- package/vendor/ts-morph/docs/details/source-files.md +292 -0
- package/vendor/ts-morph/docs/details/type-aliases.md +34 -0
- package/vendor/ts-morph/docs/details/type-parameters.md +72 -0
- package/vendor/ts-morph/docs/details/types.md +254 -0
- package/vendor/ts-morph/docs/details/variables.md +110 -0
- package/vendor/ts-morph/docs/emitting.md +151 -0
- package/vendor/ts-morph/docs/index.md +25 -0
- package/vendor/ts-morph/docs/manipulation/code-writer.md +20 -0
- package/vendor/ts-morph/docs/manipulation/formatting.md +76 -0
- package/vendor/ts-morph/docs/manipulation/index.md +136 -0
- package/vendor/ts-morph/docs/manipulation/order.md +14 -0
- package/vendor/ts-morph/docs/manipulation/performance.md +222 -0
- package/vendor/ts-morph/docs/manipulation/removing.md +31 -0
- package/vendor/ts-morph/docs/manipulation/renaming.md +106 -0
- package/vendor/ts-morph/docs/manipulation/settings.md +76 -0
- package/vendor/ts-morph/docs/manipulation/structures.md +117 -0
- package/vendor/ts-morph/docs/manipulation/transforms.md +84 -0
- package/vendor/ts-morph/docs/metrics/performance.json +4 -0
- package/vendor/ts-morph/docs/navigation/ambient-modules.md +22 -0
- package/vendor/ts-morph/docs/navigation/compiler-nodes.md +82 -0
- package/vendor/ts-morph/docs/navigation/directories.md +287 -0
- package/vendor/ts-morph/docs/navigation/example.md +50 -0
- package/vendor/ts-morph/docs/navigation/finding-references.md +53 -0
- package/vendor/ts-morph/docs/navigation/getting-source-files.md +59 -0
- package/vendor/ts-morph/docs/navigation/images/getChildrenVsForEachChild.gif +0 -0
- package/vendor/ts-morph/docs/navigation/index.md +94 -0
- package/vendor/ts-morph/docs/navigation/language-service.md +23 -0
- package/vendor/ts-morph/docs/navigation/program.md +25 -0
- package/vendor/ts-morph/docs/navigation/type-checker.md +33 -0
- package/vendor/ts-morph/docs/setup/adding-source-files.md +145 -0
- package/vendor/ts-morph/docs/setup/ast-viewers.md +46 -0
- package/vendor/ts-morph/docs/setup/diagnostics.md +109 -0
- package/vendor/ts-morph/docs/setup/file-system.md +106 -0
- package/vendor/ts-morph/docs/setup/images/atom-ast.png +0 -0
- package/vendor/ts-morph/docs/setup/images/atom-ast_small.png +0 -0
- package/vendor/ts-morph/docs/setup/images/atom-command-palette.png +0 -0
- package/vendor/ts-morph/docs/setup/images/atom-file.png +0 -0
- package/vendor/ts-morph/docs/setup/images/ts-ast-viewer.png +0 -0
- package/vendor/ts-morph/docs/setup/index.md +94 -0
- package/vendor/ts-morph/docs/utilities.md +55 -0
- package/vendor/ts-morph/dprint.json +23 -0
- package/vendor/ts-morph/package.json +30 -0
- package/vendor/ts-morph/packages/bootstrap/LICENSE +21 -0
- package/vendor/ts-morph/packages/bootstrap/lib/ts-morph-bootstrap.d.ts +397 -0
- package/vendor/ts-morph/packages/bootstrap/package.json +46 -0
- package/vendor/ts-morph/packages/bootstrap/readme.md +200 -0
- package/vendor/ts-morph/packages/common/LICENSE +21 -0
- package/vendor/ts-morph/packages/common/lib/ts-morph-common.d.ts +1082 -0
- package/vendor/ts-morph/packages/common/lib/typescript.d.ts +11439 -0
- package/vendor/ts-morph/packages/common/package.json +65 -0
- package/vendor/ts-morph/packages/common/readme.md +5 -0
- package/vendor/ts-morph/packages/scripts/changeTypeScriptVersion.ts +28 -0
- package/vendor/ts-morph/packages/scripts/createDeclarationProject.ts +47 -0
- package/vendor/ts-morph/packages/scripts/deps.ts +2 -0
- package/vendor/ts-morph/packages/scripts/execScript.ts +31 -0
- package/vendor/ts-morph/packages/scripts/folders.ts +11 -0
- package/vendor/ts-morph/packages/scripts/getDevCompilerVersions.ts +19 -0
- package/vendor/ts-morph/packages/scripts/mod.ts +7 -0
- package/vendor/ts-morph/packages/scripts/utils/Memoize.ts +36 -0
- package/vendor/ts-morph/packages/scripts/utils/forEachTypeText.ts +23 -0
- package/vendor/ts-morph/packages/scripts/utils/makeConstructorsPrivate.ts +26 -0
- package/vendor/ts-morph/packages/scripts/utils/mod.ts +4 -0
- package/vendor/ts-morph/packages/scripts/utils/printDiagnostics.ts +10 -0
- package/vendor/ts-morph/packages/ts-morph/LICENSE +21 -0
- package/vendor/ts-morph/packages/ts-morph/lib/ts-morph.d.ts +11198 -0
- package/vendor/ts-morph/packages/ts-morph/package.json +78 -0
- package/vendor/ts-morph/packages/ts-morph/readme.md +111 -0
- package/vendor/ts-morph/readme.md +14 -0
- package/vendor/ts-morph/rfcs/README.md +13 -0
- package/vendor/ts-morph/rfcs/RFC-0001 - Inserting Into Statements Handling Comments.md +181 -0
- package/vendor/ts-morph/tsconfig.common.json +17 -0
- package/vitest.config.ts +16 -0
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
import { ts } from "./typescript";
|
|
2
|
+
|
|
3
|
+
export interface CompilerOptionsFromTsConfigOptions {
|
|
4
|
+
encoding?: string;
|
|
5
|
+
fileSystem?: FileSystemHost;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CompilerOptionsFromTsConfigResult {
|
|
9
|
+
options: ts.CompilerOptions;
|
|
10
|
+
errors: ts.Diagnostic[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Gets the compiler options from a specified tsconfig.json
|
|
15
|
+
* @param filePath - File path to the tsconfig.json.
|
|
16
|
+
* @param options - Options.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCompilerOptionsFromTsConfig(filePath: string, options?: CompilerOptionsFromTsConfigOptions): CompilerOptionsFromTsConfigResult;
|
|
19
|
+
|
|
20
|
+
export declare class TsConfigResolver {
|
|
21
|
+
#private;
|
|
22
|
+
constructor(fileSystem: TransactionalFileSystem, tsConfigFilePath: StandardizedFilePath, encoding: string);
|
|
23
|
+
getCompilerOptions(): ts.CompilerOptions;
|
|
24
|
+
getErrors(): ts.Diagnostic[];
|
|
25
|
+
getPaths(compilerOptions?: ts.CompilerOptions): {
|
|
26
|
+
filePaths: StandardizedFilePath[];
|
|
27
|
+
directoryPaths: StandardizedFilePath[];
|
|
28
|
+
};
|
|
29
|
+
private _parseJsonConfigFileContent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Helper around a Map.
|
|
34
|
+
* @remarks The use of this class is historical as it served as an abstraction around an ES5 based map and ES6, if available. Eventually
|
|
35
|
+
* this class should be removed in favour of helper functions around a Map.
|
|
36
|
+
*/
|
|
37
|
+
export declare class KeyValueCache<T, U> {
|
|
38
|
+
#private;
|
|
39
|
+
getSize(): number;
|
|
40
|
+
getValues(): MapIterator<U>;
|
|
41
|
+
getValuesAsArray(): U[];
|
|
42
|
+
getKeys(): MapIterator<T>;
|
|
43
|
+
getEntries(): MapIterator<[T, U]>;
|
|
44
|
+
getOrCreate<TCreate extends U = U>(key: T, createFunc: () => TCreate): TCreate;
|
|
45
|
+
has(key: T): boolean;
|
|
46
|
+
get(key: T): U | undefined;
|
|
47
|
+
set(key: T, value: U): void;
|
|
48
|
+
replaceKey(key: T, newKey: T): void;
|
|
49
|
+
removeByKey(key: T): void;
|
|
50
|
+
clear(): void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* An array where the values are sorted by a key of one of the values.
|
|
55
|
+
*/
|
|
56
|
+
export declare class SortedKeyValueArray<TKey, TValue> {
|
|
57
|
+
#private;
|
|
58
|
+
constructor(getKey: (value: TValue) => TKey, comparer: Comparer<TKey>);
|
|
59
|
+
set(value: TValue): void;
|
|
60
|
+
removeByValue(value: TValue): void;
|
|
61
|
+
removeByKey(key: TKey): void;
|
|
62
|
+
getArrayCopy(): TValue[];
|
|
63
|
+
hasItems(): boolean;
|
|
64
|
+
entries(): Generator<TValue, void, unknown>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A wrapper around WeakMap.
|
|
69
|
+
* @remarks The use of this class is historical as it served as an abstraction around an ES5 based weak map and ES6, if available. Eventually
|
|
70
|
+
* this class should be removed in favour of helper functions around a WeakMap.
|
|
71
|
+
*/
|
|
72
|
+
export declare class WeakCache<T extends object, U> {
|
|
73
|
+
#private;
|
|
74
|
+
getOrCreate<TCreate extends U = U>(key: T, createFunc: () => TCreate): TCreate;
|
|
75
|
+
has(key: T): boolean;
|
|
76
|
+
get(key: T): U | undefined;
|
|
77
|
+
set(key: T, value: U): void;
|
|
78
|
+
removeByKey(key: T): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Compares two values specifying the sort order.
|
|
83
|
+
*/
|
|
84
|
+
export interface Comparer<T> {
|
|
85
|
+
/**
|
|
86
|
+
* Checks the two items returning -1 if `a` preceeds, 0 if equal, and 1 if `a` follows.
|
|
87
|
+
* @param a - Item to use.
|
|
88
|
+
* @param b - Item to compare with.
|
|
89
|
+
*/
|
|
90
|
+
compareTo(a: T, b: T): number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Converts a comparer to a stored comparer.
|
|
95
|
+
*/
|
|
96
|
+
export declare class ComparerToStoredComparer<T> implements StoredComparer<T> {
|
|
97
|
+
#private;
|
|
98
|
+
/**
|
|
99
|
+
* Constructor.
|
|
100
|
+
* @param comparer - Comparer to use.
|
|
101
|
+
* @param storedValue - Stored value to use as the value to always compare the input of `compareTo` to.
|
|
102
|
+
*/
|
|
103
|
+
constructor(comparer: Comparer<T>, storedValue: T);
|
|
104
|
+
/** @inheritdoc */
|
|
105
|
+
compareTo(value: T): number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Compares two strings by en-us-u-kf-upper locale.
|
|
110
|
+
*/
|
|
111
|
+
export declare class LocaleStringComparer implements Comparer<string> {
|
|
112
|
+
/** Static instance for reuse. */
|
|
113
|
+
static readonly instance: LocaleStringComparer;
|
|
114
|
+
/** @inheritdoc */
|
|
115
|
+
compareTo(a: string, b: string): 0 | 1 | -1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Compares two values based on one of their properties.
|
|
120
|
+
*/
|
|
121
|
+
export declare class PropertyComparer<TValue, TProperty> implements Comparer<TValue> {
|
|
122
|
+
#private;
|
|
123
|
+
/**
|
|
124
|
+
* Constructor.
|
|
125
|
+
* @param getProperty - Gets the property from the value to use for comparisons.
|
|
126
|
+
* @param comparer - Comparer to compare the properties with.
|
|
127
|
+
*/
|
|
128
|
+
constructor(getProperty: (value: TValue) => TProperty, comparer: Comparer<TProperty>);
|
|
129
|
+
/** @inheritdoc */
|
|
130
|
+
compareTo(a: TValue, b: TValue): number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A stored comparer that compares a property to a stored value.
|
|
135
|
+
*/
|
|
136
|
+
export declare class PropertyStoredComparer<TValue, TProperty> implements StoredComparer<TValue> {
|
|
137
|
+
#private;
|
|
138
|
+
/**
|
|
139
|
+
* Constructor.
|
|
140
|
+
* @param getProperty - Gets the property from the value.
|
|
141
|
+
* @param comparer - Comparer to compare the property with.
|
|
142
|
+
*/
|
|
143
|
+
constructor(getProperty: (value: TValue) => TProperty, comparer: StoredComparer<TProperty>);
|
|
144
|
+
/** @inheritdoc */
|
|
145
|
+
compareTo(value: TValue): number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Compares a value against a stored value.
|
|
150
|
+
*/
|
|
151
|
+
export interface StoredComparer<T> {
|
|
152
|
+
/**
|
|
153
|
+
* Checks the value against a stored value returning -1 if the stored value preceeds, 0 if the value is equal, and 1 if follows.
|
|
154
|
+
* @param value - Value to compare.
|
|
155
|
+
*/
|
|
156
|
+
compareTo(value: T): number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Creates a language service host and compiler host.
|
|
161
|
+
* @param options - Options for creating the hosts.
|
|
162
|
+
*/
|
|
163
|
+
export declare function createHosts(options: CreateHostsOptions): {
|
|
164
|
+
languageServiceHost: ts.LanguageServiceHost;
|
|
165
|
+
compilerHost: ts.CompilerHost;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Options for creating the hosts.
|
|
170
|
+
*/
|
|
171
|
+
export interface CreateHostsOptions {
|
|
172
|
+
/** The transactional file system to use. */
|
|
173
|
+
transactionalFileSystem: TransactionalFileSystem;
|
|
174
|
+
/** Container of source files to use. */
|
|
175
|
+
sourceFileContainer: TsSourceFileContainer;
|
|
176
|
+
/** Compiler options container to use. */
|
|
177
|
+
compilerOptions: CompilerOptionsContainer;
|
|
178
|
+
/** Newline kind to use. */
|
|
179
|
+
getNewLine: () => "\r\n" | "\n";
|
|
180
|
+
/** The resolution host used for resolving modules and type reference directives. */
|
|
181
|
+
resolutionHost: ResolutionHost;
|
|
182
|
+
/** Provides the current project version to be used to tell if source files have
|
|
183
|
+
* changed. Provide this for a performance improvement. */
|
|
184
|
+
getProjectVersion?: () => string;
|
|
185
|
+
isKnownTypesPackageName?: ts.LanguageServiceHost["isKnownTypesPackageName"];
|
|
186
|
+
/**
|
|
187
|
+
* Set this to true to not load the typescript lib files.
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
skipLoadingLibFiles?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Specify this to use a custom folder to load the lib files from.
|
|
193
|
+
* @remarks skipLoadingLibFiles cannot be explicitly false if this is set.
|
|
194
|
+
*/
|
|
195
|
+
libFolderPath?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Creates a module resolution host based on the provided options.
|
|
200
|
+
* @param options - Options for creating the module resolution host.
|
|
201
|
+
*/
|
|
202
|
+
export declare function createModuleResolutionHost(options: CreateModuleResolutionHostOptions): ts.ModuleResolutionHost;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Options for creating a module resolution host.
|
|
206
|
+
*/
|
|
207
|
+
export interface CreateModuleResolutionHostOptions {
|
|
208
|
+
/** The transactional file system to use. */
|
|
209
|
+
transactionalFileSystem: TransactionalFileSystem;
|
|
210
|
+
/** The source file container to use. */
|
|
211
|
+
sourceFileContainer: TsSourceFileContainer;
|
|
212
|
+
/** Gets the encoding to use. */
|
|
213
|
+
getEncoding(): string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* An implementation of a ts.DocumentRegistry that uses a transactional file system.
|
|
218
|
+
*/
|
|
219
|
+
export declare class DocumentRegistry implements ts.DocumentRegistry {
|
|
220
|
+
#private;
|
|
221
|
+
/**
|
|
222
|
+
* Constructor.
|
|
223
|
+
* @param transactionalFileSystem - The transaction file system to use.
|
|
224
|
+
*/
|
|
225
|
+
constructor(transactionalFileSystem: TransactionalFileSystem);
|
|
226
|
+
/**
|
|
227
|
+
* Creates or updates a source file in the document registry.
|
|
228
|
+
* @param fileName - File name to create or update.
|
|
229
|
+
* @param compilationSettings - Compiler options to use.
|
|
230
|
+
* @param scriptSnapshot - Script snapshot (text) of the file.
|
|
231
|
+
* @param scriptKind - Script kind of the file.
|
|
232
|
+
*/
|
|
233
|
+
createOrUpdateSourceFile(fileName: StandardizedFilePath, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
|
|
234
|
+
/**
|
|
235
|
+
* Removes the source file from the document registry.
|
|
236
|
+
* @param fileName - File name to remove.
|
|
237
|
+
*/
|
|
238
|
+
removeSourceFile(fileName: StandardizedFilePath): void;
|
|
239
|
+
/** @inheritdoc */
|
|
240
|
+
acquireDocument(fileName: string, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
|
|
241
|
+
/** @inheritdoc */
|
|
242
|
+
acquireDocumentWithKey(fileName: string, path: ts.Path, compilationSettings: ts.CompilerOptions, key: ts.DocumentRegistryBucketKey, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
|
|
243
|
+
/** @inheritdoc */
|
|
244
|
+
updateDocument(fileName: string, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
|
|
245
|
+
/** @inheritdoc */
|
|
246
|
+
updateDocumentWithKey(fileName: string, path: ts.Path, compilationSettings: ts.CompilerOptions, key: ts.DocumentRegistryBucketKey, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
|
|
247
|
+
/** @inheritdoc */
|
|
248
|
+
getKeyForCompilationSettings(settings: ts.CompilerOptions): ts.DocumentRegistryBucketKey;
|
|
249
|
+
/** @inheritdoc */
|
|
250
|
+
releaseDocument(fileName: string, compilationSettings: ts.CompilerOptions): void;
|
|
251
|
+
/** @inheritdoc */
|
|
252
|
+
releaseDocumentWithKey(path: ts.Path, key: ts.DocumentRegistryBucketKey): void;
|
|
253
|
+
/** @inheritdoc */
|
|
254
|
+
reportStats(): string;
|
|
255
|
+
/** @inheritdoc */
|
|
256
|
+
getSourceFileVersion(sourceFile: ts.SourceFile): string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Host for implementing custom module and/or type reference directive resolution. */
|
|
260
|
+
export interface ResolutionHost {
|
|
261
|
+
resolveModuleNames?: ts.LanguageServiceHost["resolveModuleNames"];
|
|
262
|
+
getResolvedModuleWithFailedLookupLocationsFromCache?: ts.LanguageServiceHost["getResolvedModuleWithFailedLookupLocationsFromCache"];
|
|
263
|
+
resolveTypeReferenceDirectives?: ts.LanguageServiceHost["resolveTypeReferenceDirectives"];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Factory used to create a resolution host.
|
|
268
|
+
* @remarks The compiler options are retrieved via a function in order to get the project's current compiler options.
|
|
269
|
+
*/
|
|
270
|
+
export type ResolutionHostFactory = (moduleResolutionHost: ts.ModuleResolutionHost, getCompilerOptions: () => ts.CompilerOptions) => ResolutionHost;
|
|
271
|
+
|
|
272
|
+
/** Collection of reusable resolution hosts. */
|
|
273
|
+
export declare const ResolutionHosts: {
|
|
274
|
+
deno: ResolutionHostFactory;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* A container of source files.
|
|
279
|
+
*/
|
|
280
|
+
export interface TsSourceFileContainer {
|
|
281
|
+
/**
|
|
282
|
+
* Gets if a source file exists at the specified file path.
|
|
283
|
+
* @param filePath - File path to check.
|
|
284
|
+
*/
|
|
285
|
+
containsSourceFileAtPath(filePath: StandardizedFilePath): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Gets the source file paths of all the source files in the container.
|
|
288
|
+
*/
|
|
289
|
+
getSourceFilePaths(): Iterable<StandardizedFilePath>;
|
|
290
|
+
/**
|
|
291
|
+
* Gets a source file from a file path, but only if it exists in the container's cache.
|
|
292
|
+
* @param filePath - File path to get the source file from.
|
|
293
|
+
*/
|
|
294
|
+
getSourceFileFromCacheFromFilePath(filePath: StandardizedFilePath): ts.SourceFile | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Asynchronously adds or gets a source file from a file path.
|
|
297
|
+
* @param filePath - File path to get.
|
|
298
|
+
* @param opts - Options for adding or getting the file.
|
|
299
|
+
*/
|
|
300
|
+
addOrGetSourceFileFromFilePath(filePath: StandardizedFilePath, opts: {
|
|
301
|
+
markInProject: boolean;
|
|
302
|
+
scriptKind: ts.ScriptKind | undefined;
|
|
303
|
+
}): Promise<ts.SourceFile | undefined>;
|
|
304
|
+
/**
|
|
305
|
+
* Synchronously adds or gets a source file from a file path.
|
|
306
|
+
* @param filePath - File path to get.
|
|
307
|
+
* @param opts - Options for adding or getting the file.
|
|
308
|
+
*/
|
|
309
|
+
addOrGetSourceFileFromFilePathSync(filePath: StandardizedFilePath, opts: {
|
|
310
|
+
markInProject: boolean;
|
|
311
|
+
scriptKind: ts.ScriptKind | undefined;
|
|
312
|
+
}): ts.SourceFile | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* Gets the source file version of the specified source file.
|
|
315
|
+
* @param sourceFile - Source file to inspect.
|
|
316
|
+
*/
|
|
317
|
+
getSourceFileVersion(sourceFile: ts.SourceFile): string;
|
|
318
|
+
/**
|
|
319
|
+
* Gets if the container contains the specified directory.
|
|
320
|
+
* @param dirPath - Path of the directory to check.
|
|
321
|
+
*/
|
|
322
|
+
containsDirectoryAtPath(dirPath: StandardizedFilePath): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Gets the child directories of the specified directory.
|
|
325
|
+
* @param dirPath - Path of the directory to check.
|
|
326
|
+
*/
|
|
327
|
+
getChildDirectoriesOfDirectory(dirPath: StandardizedFilePath): StandardizedFilePath[];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Decorator for memoizing the result of a method or get accessor. */
|
|
331
|
+
export declare function Memoize(target: any, context: any): (this: any, ...args: any[]) => any;
|
|
332
|
+
|
|
333
|
+
/** Collection of helper functions that can be used to throw errors. */
|
|
334
|
+
export declare namespace errors {
|
|
335
|
+
/**
|
|
336
|
+
* Minimal attributes to show a error message with the node source.
|
|
337
|
+
*/
|
|
338
|
+
interface Node {
|
|
339
|
+
getSourceFile(): {
|
|
340
|
+
getFilePath(): StandardizedFilePath;
|
|
341
|
+
getFullText(): string;
|
|
342
|
+
};
|
|
343
|
+
getStart(): number;
|
|
344
|
+
}
|
|
345
|
+
/** Base error class. */
|
|
346
|
+
abstract class BaseError extends Error {
|
|
347
|
+
protected constructor();
|
|
348
|
+
}
|
|
349
|
+
/** Thrown when there is a problem with a provided argument. */
|
|
350
|
+
class ArgumentError extends BaseError {
|
|
351
|
+
constructor(argName: string, message: string, node?: Node);
|
|
352
|
+
}
|
|
353
|
+
/** Thrown when an argument is null or whitespace. */
|
|
354
|
+
class ArgumentNullOrWhitespaceError extends ArgumentError {
|
|
355
|
+
constructor(argName: string, node?: Node);
|
|
356
|
+
}
|
|
357
|
+
/** Thrown when an argument is out of range. */
|
|
358
|
+
class ArgumentOutOfRangeError extends ArgumentError {
|
|
359
|
+
constructor(argName: string, value: number, range: [number, number], node?: Node);
|
|
360
|
+
}
|
|
361
|
+
/** Thrown when an argument does not match an expected type. */
|
|
362
|
+
class ArgumentTypeError extends ArgumentError {
|
|
363
|
+
constructor(argName: string, expectedType: string, actualType: string, node?: Node);
|
|
364
|
+
}
|
|
365
|
+
/** Thrown when a file or directory path was not found. */
|
|
366
|
+
class PathNotFoundError extends BaseError {
|
|
367
|
+
readonly path: StandardizedFilePath;
|
|
368
|
+
constructor(path: StandardizedFilePath, prefix?: string);
|
|
369
|
+
readonly code: "ENOENT";
|
|
370
|
+
}
|
|
371
|
+
/** Thrown when a directory was not found. */
|
|
372
|
+
class DirectoryNotFoundError extends PathNotFoundError {
|
|
373
|
+
constructor(dirPath: StandardizedFilePath);
|
|
374
|
+
}
|
|
375
|
+
/** Thrown when a file was not found. */
|
|
376
|
+
class FileNotFoundError extends PathNotFoundError {
|
|
377
|
+
constructor(filePath: StandardizedFilePath);
|
|
378
|
+
}
|
|
379
|
+
/** Thrown when an action was taken that is not allowed. */
|
|
380
|
+
class InvalidOperationError extends BaseError {
|
|
381
|
+
constructor(message: string, node?: Node);
|
|
382
|
+
}
|
|
383
|
+
/** Thrown when a certain behaviour or feature has not been implemented. */
|
|
384
|
+
class NotImplementedError extends BaseError {
|
|
385
|
+
constructor(message?: string, node?: Node);
|
|
386
|
+
}
|
|
387
|
+
/** Thrown when an operation is not supported. */
|
|
388
|
+
class NotSupportedError extends BaseError {
|
|
389
|
+
constructor(message: string);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Thows if not a type.
|
|
393
|
+
* @param value - Value to check the type of.
|
|
394
|
+
* @param expectedType - Expected type.
|
|
395
|
+
* @param argName - Argument name.
|
|
396
|
+
*/
|
|
397
|
+
function throwIfNotType(value: any, expectedType: string, argName: string): void;
|
|
398
|
+
/**
|
|
399
|
+
* Throws if the value is not a string.
|
|
400
|
+
* @param value - Value to check.
|
|
401
|
+
* @param argName - Arg name.
|
|
402
|
+
*/
|
|
403
|
+
function throwIfNotString(value: string, argName: string): void;
|
|
404
|
+
/**
|
|
405
|
+
* Throws if the value is not a string or is whitespace.
|
|
406
|
+
* @param value - Value to check.
|
|
407
|
+
* @param argName - Arg name.
|
|
408
|
+
*/
|
|
409
|
+
function throwIfWhitespaceOrNotString(value: string, argName: string): void;
|
|
410
|
+
/**
|
|
411
|
+
* Throws an ArgumentOutOfRangeError if an argument's value is out of an inclusive range.
|
|
412
|
+
* @param value - Value.
|
|
413
|
+
* @param range - Range.
|
|
414
|
+
* @param argName - Argument name.
|
|
415
|
+
*/
|
|
416
|
+
function throwIfOutOfRange(value: number, range: [number, number], argName: string): void;
|
|
417
|
+
/**
|
|
418
|
+
* Throws an ArgumentOutOfRangeError if an argument's range value is out of an inclusive range.
|
|
419
|
+
*
|
|
420
|
+
* Also throws when the start of the range is greater than the end.
|
|
421
|
+
* @param actualRange - Range to check.
|
|
422
|
+
* @param range - Range to check against.
|
|
423
|
+
* @param argName - Argument name.
|
|
424
|
+
*/
|
|
425
|
+
function throwIfRangeOutOfRange(actualRange: [number, number], range: [number, number], argName: string): void;
|
|
426
|
+
/**
|
|
427
|
+
* Gets an error saying that a feature is not implemented for a certain syntax kind.
|
|
428
|
+
* @param kind - Syntax kind that isn't implemented.
|
|
429
|
+
*/
|
|
430
|
+
function throwNotImplementedForSyntaxKindError(kind: ts.SyntaxKind, node?: Node): never;
|
|
431
|
+
/**
|
|
432
|
+
* Throws an Argument
|
|
433
|
+
* @param value
|
|
434
|
+
* @param argName
|
|
435
|
+
*/
|
|
436
|
+
function throwIfNegative(value: number, argName: string): void;
|
|
437
|
+
/**
|
|
438
|
+
* Throws when the value is null or undefined.
|
|
439
|
+
* @param value - Value to check.
|
|
440
|
+
* @param errorMessage - Error message to throw when not defined.
|
|
441
|
+
*/
|
|
442
|
+
function throwIfNullOrUndefined<T>(value: T | undefined, errorMessage: string | (() => string), node?: Node): T;
|
|
443
|
+
/**
|
|
444
|
+
* Throw if the value should have been the never type.
|
|
445
|
+
* @param value - Value to check.
|
|
446
|
+
*/
|
|
447
|
+
function throwNotImplementedForNeverValueError(value: never, sourceNode?: Node): never;
|
|
448
|
+
/**
|
|
449
|
+
* Throws an error if the actual value does not equal the expected value.
|
|
450
|
+
* @param actual - Actual value.
|
|
451
|
+
* @param expected - Expected value.
|
|
452
|
+
* @param description - Message to show in the error. Should be a full sentence that doesn't include the actual and expected values.
|
|
453
|
+
*/
|
|
454
|
+
function throwIfNotEqual<T>(actual: T, expected: T, description: string): void;
|
|
455
|
+
/**
|
|
456
|
+
* Throws if true.
|
|
457
|
+
* @param value - Value to check.
|
|
458
|
+
* @param errorMessage - Error message to throw when true.
|
|
459
|
+
*/
|
|
460
|
+
function throwIfTrue(value: boolean | undefined, errorMessage: string): void;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Represents a file system that can be interacted with.
|
|
465
|
+
*/
|
|
466
|
+
export interface FileSystemHost {
|
|
467
|
+
/** Gets if this file system is case sensitive. */
|
|
468
|
+
isCaseSensitive(): boolean;
|
|
469
|
+
/** Asynchronously deletes the specified file or directory. */
|
|
470
|
+
delete(path: string): Promise<void>;
|
|
471
|
+
/** Synchronously deletes the specified file or directory */
|
|
472
|
+
deleteSync(path: string): void;
|
|
473
|
+
/**
|
|
474
|
+
* Reads all the child directories and files.
|
|
475
|
+
* @remarks Implementers should have this return the full file path.
|
|
476
|
+
*/
|
|
477
|
+
readDirSync(dirPath: string): RuntimeDirEntry[];
|
|
478
|
+
/** Asynchronously reads a file at the specified path. */
|
|
479
|
+
readFile(filePath: string, encoding?: string): Promise<string>;
|
|
480
|
+
/** Synchronously reads a file at the specified path. */
|
|
481
|
+
readFileSync(filePath: string, encoding?: string): string;
|
|
482
|
+
/** Asynchronously writes a file to the file system. */
|
|
483
|
+
writeFile(filePath: string, fileText: string): Promise<void>;
|
|
484
|
+
/** Synchronously writes a file to the file system. */
|
|
485
|
+
writeFileSync(filePath: string, fileText: string): void;
|
|
486
|
+
/** Asynchronously creates a directory at the specified path. */
|
|
487
|
+
mkdir(dirPath: string): Promise<void>;
|
|
488
|
+
/** Synchronously creates a directory at the specified path. */
|
|
489
|
+
mkdirSync(dirPath: string): void;
|
|
490
|
+
/** Asynchronously moves a file or directory. */
|
|
491
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
492
|
+
/** Synchronously moves a file or directory. */
|
|
493
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
494
|
+
/** Asynchronously copies a file or directory. */
|
|
495
|
+
copy(srcPath: string, destPath: string): Promise<void>;
|
|
496
|
+
/** Synchronously copies a file or directory. */
|
|
497
|
+
copySync(srcPath: string, destPath: string): void;
|
|
498
|
+
/** Asynchronously checks if a file exists.
|
|
499
|
+
* @remarks Implementers should throw an `errors.FileNotFoundError` when it does not exist.
|
|
500
|
+
*/
|
|
501
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
502
|
+
/** Synchronously checks if a file exists.
|
|
503
|
+
* @remarks Implementers should throw an `errors.FileNotFoundError` when it does not exist.
|
|
504
|
+
*/
|
|
505
|
+
fileExistsSync(filePath: string): boolean;
|
|
506
|
+
/** Asynchronously checks if a directory exists. */
|
|
507
|
+
directoryExists(dirPath: string): Promise<boolean>;
|
|
508
|
+
/** Synchronously checks if a directory exists. */
|
|
509
|
+
directoryExistsSync(dirPath: string): boolean;
|
|
510
|
+
/** See https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options */
|
|
511
|
+
realpathSync(path: string): string;
|
|
512
|
+
/** Gets the current directory of the environment. */
|
|
513
|
+
getCurrentDirectory(): string;
|
|
514
|
+
/** Uses pattern matching to find files or directories. */
|
|
515
|
+
glob(patterns: ReadonlyArray<string>): Promise<string[]>;
|
|
516
|
+
/** Synchronously uses pattern matching to find files or directories. */
|
|
517
|
+
globSync(patterns: ReadonlyArray<string>): string[];
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** Utilities for working with files. */
|
|
521
|
+
export declare class FileUtils {
|
|
522
|
+
#private;
|
|
523
|
+
static readonly ENOENT = "ENOENT";
|
|
524
|
+
private constructor();
|
|
525
|
+
/**
|
|
526
|
+
* Gets if the error is a file not found or directory not found error.
|
|
527
|
+
* @param err - Error to check.
|
|
528
|
+
*/
|
|
529
|
+
static isNotExistsError(err: any): boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Joins the paths.
|
|
532
|
+
* @param paths - Paths to join.
|
|
533
|
+
*/
|
|
534
|
+
static pathJoin<T extends string>(basePath: T, ...paths: string[]): T;
|
|
535
|
+
/**
|
|
536
|
+
* Gets if the path is absolute.
|
|
537
|
+
* @param fileOrDirPath - File or directory path.
|
|
538
|
+
*/
|
|
539
|
+
static pathIsAbsolute(fileOrDirPath: string): boolean;
|
|
540
|
+
/**
|
|
541
|
+
* Gets the standardized absolute path.
|
|
542
|
+
* @param fileSystem - File system.
|
|
543
|
+
* @param fileOrDirPath - Path to standardize.
|
|
544
|
+
* @param relativeBase - Base path to be relative from.
|
|
545
|
+
*/
|
|
546
|
+
static getStandardizedAbsolutePath(fileSystem: FileSystemHost, fileOrDirPath: string, relativeBase?: string): StandardizedFilePath;
|
|
547
|
+
/**
|
|
548
|
+
* Gets the directory path.
|
|
549
|
+
* @param fileOrDirPath - Path to get the directory name from.
|
|
550
|
+
*/
|
|
551
|
+
static getDirPath<T extends string>(fileOrDirPath: T): T;
|
|
552
|
+
/**
|
|
553
|
+
* Gets the last portion of the path.
|
|
554
|
+
* @param fileOrDirPath - Path to get the base name from.
|
|
555
|
+
*/
|
|
556
|
+
static getBaseName(fileOrDirPath: StandardizedFilePath): string;
|
|
557
|
+
/**
|
|
558
|
+
* Gets the extension of the file name.
|
|
559
|
+
* @param fileOrDirPath - Path to get the extension from.
|
|
560
|
+
*/
|
|
561
|
+
static getExtension(fileOrDirPath: StandardizedFilePath): string;
|
|
562
|
+
/**
|
|
563
|
+
* Changes all back slashes to forward slashes.
|
|
564
|
+
* @param fileOrDirPath - Path.
|
|
565
|
+
*/
|
|
566
|
+
static standardizeSlashes<T extends string>(fileOrDirPath: T): T;
|
|
567
|
+
/**
|
|
568
|
+
* Checks if a path ends with a specified search path.
|
|
569
|
+
* @param fileOrDirPath - Path.
|
|
570
|
+
* @param endsWithPath - Ends with path.
|
|
571
|
+
*/
|
|
572
|
+
static pathEndsWith(fileOrDirPath: string | undefined, endsWithPath: string | undefined): boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Checks if a path starts with a specified search path.
|
|
575
|
+
* @param fileOrDirPath - Path.
|
|
576
|
+
* @param startsWithPath - Starts with path.
|
|
577
|
+
*/
|
|
578
|
+
static pathStartsWith(fileOrDirPath: string | undefined, startsWithPath: string | undefined): boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Gets the parent most paths out of the list of paths.
|
|
581
|
+
* @param paths - File or directory paths.
|
|
582
|
+
*/
|
|
583
|
+
static getParentMostPaths(paths: StandardizedFilePath[]): StandardizedFilePath[];
|
|
584
|
+
/**
|
|
585
|
+
* Reads a file or returns false if the file doesn't exist.
|
|
586
|
+
* @param fileSystem - File System.
|
|
587
|
+
* @param filePath - Path to file.
|
|
588
|
+
* @param encoding - File encoding.
|
|
589
|
+
*/
|
|
590
|
+
static readFileOrNotExists(fileSystem: FileSystemHost, filePath: StandardizedFilePath, encoding: string): Promise<string | false>;
|
|
591
|
+
/**
|
|
592
|
+
* Reads a file synchronously or returns false if the file doesn't exist.
|
|
593
|
+
* @param fileSystem - File System.
|
|
594
|
+
* @param filePath - Path to file.
|
|
595
|
+
* @param encoding - File encoding.
|
|
596
|
+
*/
|
|
597
|
+
static readFileOrNotExistsSync(fileSystem: FileSystemHost, filePath: StandardizedFilePath, encoding: string): string | false;
|
|
598
|
+
/**
|
|
599
|
+
* Gets the text with a byte order mark.
|
|
600
|
+
* @param text - Text.
|
|
601
|
+
*/
|
|
602
|
+
static getTextWithByteOrderMark(text: string): string;
|
|
603
|
+
/**
|
|
604
|
+
* Gets the relative path from one absolute path to another.
|
|
605
|
+
* @param absoluteDirPathFrom - Absolute directory path from.
|
|
606
|
+
* @param absolutePathTo - Absolute path to.
|
|
607
|
+
*/
|
|
608
|
+
static getRelativePathTo(absoluteDirPathFrom: StandardizedFilePath, absolutePathTo: StandardizedFilePath): StandardizedFilePath;
|
|
609
|
+
/**
|
|
610
|
+
* Gets if the path is for the root directory.
|
|
611
|
+
* @param path - Path.
|
|
612
|
+
*/
|
|
613
|
+
static isRootDirPath(dirOrFilePath: string): boolean;
|
|
614
|
+
/**
|
|
615
|
+
* Gets the descendant directories of the specified directory.
|
|
616
|
+
* @param dirPath - Directory path.
|
|
617
|
+
*/
|
|
618
|
+
static getDescendantDirectories(fileSystemWrapper: TransactionalFileSystem, dirPath: StandardizedFilePath): IterableIterator<StandardizedFilePath>;
|
|
619
|
+
/**
|
|
620
|
+
* Gets the glob as absolute.
|
|
621
|
+
* @param glob - Glob.
|
|
622
|
+
* @param cwd - Current working directory.
|
|
623
|
+
*/
|
|
624
|
+
static toAbsoluteGlob(glob: string, cwd: string): string;
|
|
625
|
+
/**
|
|
626
|
+
* Gets if the glob is a negated glob.
|
|
627
|
+
* @param glob - Glob.
|
|
628
|
+
*/
|
|
629
|
+
static isNegatedGlob(glob: string): boolean;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** An implementation of a file system that exists in memory only. */
|
|
633
|
+
export declare class InMemoryFileSystemHost implements FileSystemHost {
|
|
634
|
+
#private;
|
|
635
|
+
/**
|
|
636
|
+
* Constructor.
|
|
637
|
+
*/
|
|
638
|
+
constructor();
|
|
639
|
+
/** @inheritdoc */
|
|
640
|
+
isCaseSensitive(): boolean;
|
|
641
|
+
/** @inheritdoc */
|
|
642
|
+
delete(path: string): Promise<void>;
|
|
643
|
+
/** @inheritdoc */
|
|
644
|
+
deleteSync(path: string): void;
|
|
645
|
+
/** @inheritdoc */
|
|
646
|
+
readDirSync(dirPath: string): RuntimeDirEntry[];
|
|
647
|
+
/** @inheritdoc */
|
|
648
|
+
readFile(filePath: string, encoding?: string): Promise<string>;
|
|
649
|
+
/** @inheritdoc */
|
|
650
|
+
readFileSync(filePath: string, encoding?: string): string;
|
|
651
|
+
/** @inheritdoc */
|
|
652
|
+
writeFile(filePath: string, fileText: string): Promise<void>;
|
|
653
|
+
/** @inheritdoc */
|
|
654
|
+
writeFileSync(filePath: string, fileText: string): void;
|
|
655
|
+
/** @inheritdoc */
|
|
656
|
+
mkdir(dirPath: string): Promise<void>;
|
|
657
|
+
/** @inheritdoc */
|
|
658
|
+
mkdirSync(dirPath: string): void;
|
|
659
|
+
/** @inheritdoc */
|
|
660
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
661
|
+
/** @inheritdoc */
|
|
662
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
663
|
+
/** @inheritdoc */
|
|
664
|
+
copy(srcPath: string, destPath: string): Promise<void>;
|
|
665
|
+
/** @inheritdoc */
|
|
666
|
+
copySync(srcPath: string, destPath: string): void;
|
|
667
|
+
/** @inheritdoc */
|
|
668
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
669
|
+
/** @inheritdoc */
|
|
670
|
+
fileExistsSync(filePath: string): boolean;
|
|
671
|
+
/** @inheritdoc */
|
|
672
|
+
directoryExists(dirPath: string): Promise<boolean>;
|
|
673
|
+
/** @inheritdoc */
|
|
674
|
+
directoryExistsSync(dirPath: string): boolean;
|
|
675
|
+
/** @inheritdoc */
|
|
676
|
+
realpathSync(path: string): string;
|
|
677
|
+
/** @inheritdoc */
|
|
678
|
+
getCurrentDirectory(): string;
|
|
679
|
+
/** @inheritdoc */
|
|
680
|
+
glob(patterns: ReadonlyArray<string>): Promise<string[]>;
|
|
681
|
+
/** @inheritdoc */
|
|
682
|
+
globSync(patterns: ReadonlyArray<string>): string[];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** Checks the specified file paths to see if the match any of the specified patterns. */
|
|
686
|
+
export declare function matchGlobs(paths: ReadonlyArray<string>, patterns: string | ReadonlyArray<string>, cwd: string): string[];
|
|
687
|
+
|
|
688
|
+
/** An implementation of a file host that interacts with the actual file system. */
|
|
689
|
+
export declare class RealFileSystemHost implements FileSystemHost {
|
|
690
|
+
#private;
|
|
691
|
+
/** @inheritdoc */
|
|
692
|
+
delete(path: string): Promise<void>;
|
|
693
|
+
/** @inheritdoc */
|
|
694
|
+
deleteSync(path: string): void;
|
|
695
|
+
/** @inheritdoc */
|
|
696
|
+
readDirSync(dirPath: string): RuntimeDirEntry[];
|
|
697
|
+
/** @inheritdoc */
|
|
698
|
+
readFile(filePath: string, encoding?: string): Promise<string>;
|
|
699
|
+
/** @inheritdoc */
|
|
700
|
+
readFileSync(filePath: string, encoding?: string): string;
|
|
701
|
+
/** @inheritdoc */
|
|
702
|
+
writeFile(filePath: string, fileText: string): Promise<void>;
|
|
703
|
+
/** @inheritdoc */
|
|
704
|
+
writeFileSync(filePath: string, fileText: string): void;
|
|
705
|
+
/** @inheritdoc */
|
|
706
|
+
mkdir(dirPath: string): Promise<void>;
|
|
707
|
+
/** @inheritdoc */
|
|
708
|
+
mkdirSync(dirPath: string): void;
|
|
709
|
+
/** @inheritdoc */
|
|
710
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
711
|
+
/** @inheritdoc */
|
|
712
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
713
|
+
/** @inheritdoc */
|
|
714
|
+
copy(srcPath: string, destPath: string): Promise<void>;
|
|
715
|
+
/** @inheritdoc */
|
|
716
|
+
copySync(srcPath: string, destPath: string): void;
|
|
717
|
+
/** @inheritdoc */
|
|
718
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
719
|
+
/** @inheritdoc */
|
|
720
|
+
fileExistsSync(filePath: string): boolean;
|
|
721
|
+
/** @inheritdoc */
|
|
722
|
+
directoryExists(dirPath: string): Promise<boolean>;
|
|
723
|
+
/** @inheritdoc */
|
|
724
|
+
directoryExistsSync(dirPath: string): boolean;
|
|
725
|
+
/** @inheritdoc */
|
|
726
|
+
realpathSync(path: string): string;
|
|
727
|
+
/** @inheritdoc */
|
|
728
|
+
getCurrentDirectory(): string;
|
|
729
|
+
/** @inheritdoc */
|
|
730
|
+
glob(patterns: ReadonlyArray<string>): Promise<string[]>;
|
|
731
|
+
/** @inheritdoc */
|
|
732
|
+
globSync(patterns: ReadonlyArray<string>): string[];
|
|
733
|
+
/** @inheritdoc */
|
|
734
|
+
isCaseSensitive(): boolean;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/** Nominal type to denote a file path that has been standardized. */
|
|
738
|
+
export type StandardizedFilePath = string & {
|
|
739
|
+
_standardizedFilePathBrand: undefined;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
export interface DirEntry {
|
|
743
|
+
path: StandardizedFilePath;
|
|
744
|
+
isFile: boolean;
|
|
745
|
+
isDirectory: boolean;
|
|
746
|
+
isSymlink: boolean;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export interface TransactionalFileSystemOptions {
|
|
750
|
+
fileSystem: FileSystemHost;
|
|
751
|
+
skipLoadingLibFiles: boolean | undefined;
|
|
752
|
+
libFolderPath: string | undefined;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* FileSystemHost wrapper that allows transactionally queuing operations to the file system.
|
|
757
|
+
*/
|
|
758
|
+
export declare class TransactionalFileSystem {
|
|
759
|
+
#private;
|
|
760
|
+
/**
|
|
761
|
+
* Constructor.
|
|
762
|
+
* @param fileSystem - File system host to commit the operations to.
|
|
763
|
+
*/
|
|
764
|
+
constructor(options: TransactionalFileSystemOptions);
|
|
765
|
+
queueFileDelete(filePath: StandardizedFilePath): void;
|
|
766
|
+
removeFileDelete(filePath: StandardizedFilePath): void;
|
|
767
|
+
queueMkdir(dirPath: StandardizedFilePath): void;
|
|
768
|
+
queueDirectoryDelete(dirPath: StandardizedFilePath): void;
|
|
769
|
+
queueMoveDirectory(srcPath: StandardizedFilePath, destPath: StandardizedFilePath): void;
|
|
770
|
+
queueCopyDirectory(srcPath: StandardizedFilePath, destPath: StandardizedFilePath): void;
|
|
771
|
+
flush(): Promise<void>;
|
|
772
|
+
flushSync(): void;
|
|
773
|
+
saveForDirectory(dirPath: StandardizedFilePath): Promise<void>;
|
|
774
|
+
saveForDirectorySync(dirPath: StandardizedFilePath): void;
|
|
775
|
+
moveFileImmediately(oldFilePath: StandardizedFilePath, newFilePath: StandardizedFilePath, fileText: string): Promise<void>;
|
|
776
|
+
moveFileImmediatelySync(oldFilePath: StandardizedFilePath, newFilePath: StandardizedFilePath, fileText: string): void;
|
|
777
|
+
deleteFileImmediately(filePath: StandardizedFilePath): Promise<void>;
|
|
778
|
+
deleteFileImmediatelySync(filePath: StandardizedFilePath): void;
|
|
779
|
+
copyDirectoryImmediately(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): Promise<void>;
|
|
780
|
+
copyDirectoryImmediatelySync(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): void;
|
|
781
|
+
moveDirectoryImmediately(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): Promise<void>;
|
|
782
|
+
moveDirectoryImmediatelySync(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): void;
|
|
783
|
+
deleteDirectoryImmediately(dirPath: StandardizedFilePath): Promise<void>;
|
|
784
|
+
/** Recreates a directory on the underlying file system asynchronously. */
|
|
785
|
+
clearDirectoryImmediately(dirPath: StandardizedFilePath): Promise<void>;
|
|
786
|
+
/** Recreates a directory on the underlying file system synchronously. */
|
|
787
|
+
clearDirectoryImmediatelySync(dirPath: StandardizedFilePath): void;
|
|
788
|
+
deleteDirectoryImmediatelySync(dirPath: StandardizedFilePath): void;
|
|
789
|
+
fileExists(filePath: StandardizedFilePath): boolean | Promise<boolean>;
|
|
790
|
+
fileExistsSync(filePath: StandardizedFilePath): boolean;
|
|
791
|
+
directoryExistsSync(dirPath: StandardizedFilePath): boolean;
|
|
792
|
+
readFileIfExistsSync(filePath: StandardizedFilePath, encoding: string | undefined): string | undefined;
|
|
793
|
+
readFileSync(filePath: StandardizedFilePath, encoding: string | undefined): string;
|
|
794
|
+
readFileIfExists(filePath: StandardizedFilePath, encoding: string | undefined): Promise<string | undefined>;
|
|
795
|
+
readFile(filePath: StandardizedFilePath, encoding: string | undefined): Promise<string>;
|
|
796
|
+
readDirSync(dirPath: StandardizedFilePath): DirEntry[];
|
|
797
|
+
glob(patterns: ReadonlyArray<string>): Promise<StandardizedFilePath[]>;
|
|
798
|
+
globSync(patterns: ReadonlyArray<string>): Generator<StandardizedFilePath, void, unknown>;
|
|
799
|
+
getFileSystem(): FileSystemHost;
|
|
800
|
+
getCurrentDirectory(): StandardizedFilePath;
|
|
801
|
+
getDirectories(dirPath: StandardizedFilePath): StandardizedFilePath[];
|
|
802
|
+
realpathSync(path: StandardizedFilePath): StandardizedFilePath;
|
|
803
|
+
getStandardizedAbsolutePath(fileOrDirPath: string, relativeBase?: string): StandardizedFilePath;
|
|
804
|
+
readFileOrNotExists(filePath: StandardizedFilePath, encoding: string): false | Promise<string | false>;
|
|
805
|
+
readFileOrNotExistsSync(filePath: StandardizedFilePath, encoding: string): string | false;
|
|
806
|
+
writeFile(filePath: StandardizedFilePath, fileText: string): Promise<void>;
|
|
807
|
+
writeFileSync(filePath: StandardizedFilePath, fileText: string): void;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/** Gets the TypeScript lib files (.d.ts files). */
|
|
811
|
+
export declare function getLibFiles(): {
|
|
812
|
+
fileName: string;
|
|
813
|
+
text: string;
|
|
814
|
+
}[];
|
|
815
|
+
|
|
816
|
+
export declare function getLibFolderPath(options: {
|
|
817
|
+
libFolderPath?: string;
|
|
818
|
+
skipLoadingLibFiles?: boolean;
|
|
819
|
+
}): string;
|
|
820
|
+
|
|
821
|
+
/** The folder to use to "store" the in memory lib files. */
|
|
822
|
+
export declare const libFolderInMemoryPath: StandardizedFilePath;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Gets the enum name for the specified syntax kind.
|
|
826
|
+
* @param kind - Syntax kind.
|
|
827
|
+
*/
|
|
828
|
+
export declare function getSyntaxKindName(kind: ts.SyntaxKind): string;
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Holds the compiler options.
|
|
832
|
+
*/
|
|
833
|
+
export declare class CompilerOptionsContainer extends SettingsContainer<ts.CompilerOptions> {
|
|
834
|
+
constructor(defaultSettings?: ts.CompilerOptions);
|
|
835
|
+
/**
|
|
836
|
+
* Sets one or all of the compiler options.
|
|
837
|
+
*
|
|
838
|
+
* WARNING: Setting the compiler options will cause a complete reparse of all the source files.
|
|
839
|
+
* @param settings - Compiler options to set.
|
|
840
|
+
*/
|
|
841
|
+
set(settings: Partial<ts.CompilerOptions>): void;
|
|
842
|
+
/**
|
|
843
|
+
* Gets the encoding from the compiler options or returns utf-8.
|
|
844
|
+
*/
|
|
845
|
+
getEncoding(): string;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export declare abstract class SettingsContainer<T extends object> {
|
|
849
|
+
#private;
|
|
850
|
+
protected _settings: T;
|
|
851
|
+
/**
|
|
852
|
+
* Constructor.
|
|
853
|
+
* @param defaultSettings - The settings to use by default.
|
|
854
|
+
*/
|
|
855
|
+
constructor(defaultSettings: T);
|
|
856
|
+
/**
|
|
857
|
+
* Resets the settings to the default.
|
|
858
|
+
*/
|
|
859
|
+
reset(): void;
|
|
860
|
+
/**
|
|
861
|
+
* Gets a copy of the settings as an object.
|
|
862
|
+
*/
|
|
863
|
+
get(): T;
|
|
864
|
+
/**
|
|
865
|
+
* Sets one or all of the settings.
|
|
866
|
+
* @param settings - Settings to set.
|
|
867
|
+
*/
|
|
868
|
+
set(settings: Partial<T>): void;
|
|
869
|
+
/**
|
|
870
|
+
* Subscribe to modifications in the settings container.
|
|
871
|
+
* @param action - Action to execute when the settings change.
|
|
872
|
+
*/
|
|
873
|
+
onModified(action: () => void): void;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
export declare const runtime: Runtime;
|
|
877
|
+
|
|
878
|
+
export interface Runtime {
|
|
879
|
+
fs: RuntimeFileSystem;
|
|
880
|
+
path: RuntimePath;
|
|
881
|
+
getEnvVar(name: string): string | undefined;
|
|
882
|
+
getEndOfLine(): string;
|
|
883
|
+
getPathMatchesPattern(path: string, pattern: string): boolean;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
export interface RuntimeDirEntry {
|
|
887
|
+
name: string;
|
|
888
|
+
isFile: boolean;
|
|
889
|
+
isDirectory: boolean;
|
|
890
|
+
isSymlink: boolean;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
export interface RuntimeFileInfo {
|
|
894
|
+
isFile(): boolean;
|
|
895
|
+
isDirectory(): boolean;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface RuntimeFileSystem {
|
|
899
|
+
/** Gets if this file system is case sensitive. */
|
|
900
|
+
isCaseSensitive(): boolean;
|
|
901
|
+
/** Asynchronously deletes the specified file or directory. */
|
|
902
|
+
delete(path: string): Promise<void>;
|
|
903
|
+
/** Synchronously deletes the specified file or directory */
|
|
904
|
+
deleteSync(path: string): void;
|
|
905
|
+
/** Reads all the child directories and files. */
|
|
906
|
+
readDirSync(dirPath: string): RuntimeDirEntry[];
|
|
907
|
+
/** Asynchronously reads a file at the specified path. */
|
|
908
|
+
readFile(filePath: string, encoding?: string): Promise<string>;
|
|
909
|
+
/** Synchronously reads a file at the specified path. */
|
|
910
|
+
readFileSync(filePath: string, encoding?: string): string;
|
|
911
|
+
/** Asynchronously writes a file to the file system. */
|
|
912
|
+
writeFile(filePath: string, fileText: string): Promise<void>;
|
|
913
|
+
/** Synchronously writes a file to the file system. */
|
|
914
|
+
writeFileSync(filePath: string, fileText: string): void;
|
|
915
|
+
/** Asynchronously creates a directory at the specified path. */
|
|
916
|
+
mkdir(dirPath: string): Promise<void>;
|
|
917
|
+
/** Synchronously creates a directory at the specified path. */
|
|
918
|
+
mkdirSync(dirPath: string): void;
|
|
919
|
+
/** Asynchronously moves a file or directory. */
|
|
920
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
921
|
+
/** Synchronously moves a file or directory. */
|
|
922
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
923
|
+
/** Asynchronously copies a file or directory. */
|
|
924
|
+
copy(srcPath: string, destPath: string): Promise<void>;
|
|
925
|
+
/** Synchronously copies a file or directory. */
|
|
926
|
+
copySync(srcPath: string, destPath: string): void;
|
|
927
|
+
/** Asynchronously gets the path's stat information. */
|
|
928
|
+
stat(path: string): Promise<RuntimeFileInfo | undefined>;
|
|
929
|
+
/** Synchronously gets the path's stat information. */
|
|
930
|
+
statSync(path: string): RuntimeFileInfo | undefined;
|
|
931
|
+
/** See https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options */
|
|
932
|
+
realpathSync(path: string): string;
|
|
933
|
+
/** Gets the current directory of the environment. */
|
|
934
|
+
getCurrentDirectory(): string;
|
|
935
|
+
/** Uses pattern matching to find files or directories. */
|
|
936
|
+
glob(patterns: ReadonlyArray<string>): Promise<string[]>;
|
|
937
|
+
/** Synchronously uses pattern matching to find files or directories. */
|
|
938
|
+
globSync(patterns: ReadonlyArray<string>): string[];
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
export interface RuntimePath {
|
|
942
|
+
/** Joins the paths. */
|
|
943
|
+
join(...paths: string[]): string;
|
|
944
|
+
/** Normalizes the provided path. */
|
|
945
|
+
normalize(path: string): string;
|
|
946
|
+
/** Returns the relative path from `from` to `to`. */
|
|
947
|
+
relative(from: string, to: string): string;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
export declare function matchFiles(this: any, path: string, extensions: ReadonlyArray<string>, excludes: ReadonlyArray<string>, includes: ReadonlyArray<string>, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string, directoryExists: (path: string) => boolean): string[];
|
|
951
|
+
|
|
952
|
+
export declare function getFileMatcherPatterns(this: any, path: string, excludes: ReadonlyArray<string>, includes: ReadonlyArray<string>, useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns;
|
|
953
|
+
|
|
954
|
+
export declare function getEmitModuleResolutionKind(this: any, compilerOptions: ts.CompilerOptions): any;
|
|
955
|
+
|
|
956
|
+
export interface FileMatcherPatterns {
|
|
957
|
+
/** One pattern for each "include" spec. */
|
|
958
|
+
includeFilePatterns: ReadonlyArray<string>;
|
|
959
|
+
/** One pattern matching one of any of the "include" specs. */
|
|
960
|
+
includeFilePattern: string;
|
|
961
|
+
includeDirectoryPattern: string;
|
|
962
|
+
excludePattern: string;
|
|
963
|
+
basePaths: ReadonlyArray<string>;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export interface FileSystemEntries {
|
|
967
|
+
readonly files: ReadonlyArray<string>;
|
|
968
|
+
readonly directories: ReadonlyArray<string>;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
export declare class ArrayUtils {
|
|
972
|
+
private constructor();
|
|
973
|
+
static isReadonlyArray<T>(a: unknown): a is ReadonlyArray<T>;
|
|
974
|
+
static isNullOrEmpty<T>(a: ReadonlyArray<T> | undefined): a is undefined;
|
|
975
|
+
static getUniqueItems<T>(a: ReadonlyArray<T>): T[];
|
|
976
|
+
static removeFirst<T>(a: T[], item: T): boolean;
|
|
977
|
+
static removeAll<T>(a: T[], isMatch: (item: T) => boolean): T[];
|
|
978
|
+
static toIterator<T>(items: ReadonlyArray<T>): Generator<T, void, unknown>;
|
|
979
|
+
static sortByProperty<T>(items: T[], getProp: (item: T) => string | number): T[];
|
|
980
|
+
static groupBy<T>(items: ReadonlyArray<T>, getGroup: (item: T) => string | number): T[][];
|
|
981
|
+
static binaryInsertWithOverwrite<T>(items: T[], newItem: T, comparer: Comparer<T>): void;
|
|
982
|
+
static binarySearch<T>(items: ReadonlyArray<T>, storedComparer: StoredComparer<T>): number;
|
|
983
|
+
static containsSubArray<T>(items: ReadonlyArray<T>, subArray: ReadonlyArray<T>): boolean;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Deep clones an object not maintaining references.
|
|
988
|
+
* @remarks If this has a circular reference it will go forever so be careful.
|
|
989
|
+
*/
|
|
990
|
+
export declare function deepClone<T extends object>(objToClone: T): T;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Event container subscription type
|
|
994
|
+
*/
|
|
995
|
+
export type EventContainerSubscription<EventArgType> = (arg: EventArgType) => void;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Event container for event subscriptions.
|
|
999
|
+
*/
|
|
1000
|
+
export declare class EventContainer<EventArgType = undefined> {
|
|
1001
|
+
#private;
|
|
1002
|
+
/**
|
|
1003
|
+
* Subscribe to an event being fired.
|
|
1004
|
+
* @param subscription - Subscription.
|
|
1005
|
+
*/
|
|
1006
|
+
subscribe(subscription: EventContainerSubscription<EventArgType>): void;
|
|
1007
|
+
/**
|
|
1008
|
+
* Unsubscribe to an event being fired.
|
|
1009
|
+
* @param subscription - Subscription.
|
|
1010
|
+
*/
|
|
1011
|
+
unsubscribe(subscription: EventContainerSubscription<EventArgType>): void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Fire an event.
|
|
1014
|
+
*/
|
|
1015
|
+
fire(arg: EventArgType): void;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export declare class IterableUtils {
|
|
1019
|
+
static find<T>(items: IterableIterator<T>, condition: (item: T) => boolean): T | undefined;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export declare function nameof<TObject>(obj: TObject, key: keyof TObject): string;
|
|
1023
|
+
|
|
1024
|
+
export declare function nameof<TObject>(key: keyof TObject): string;
|
|
1025
|
+
|
|
1026
|
+
export declare class ObjectUtils {
|
|
1027
|
+
private constructor();
|
|
1028
|
+
static clone<T>(obj: T): T;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export declare class StringUtils {
|
|
1032
|
+
private constructor();
|
|
1033
|
+
static isWhitespaceCharCode(charCode: number | undefined): boolean;
|
|
1034
|
+
static isSpaces(text: string): boolean;
|
|
1035
|
+
static hasBom(text: string): boolean;
|
|
1036
|
+
static stripBom(text: string): string;
|
|
1037
|
+
static stripQuotes(text: string): string;
|
|
1038
|
+
static isQuoted(text: string): boolean;
|
|
1039
|
+
static isNullOrWhitespace(str: string | undefined): str is undefined;
|
|
1040
|
+
static isNullOrEmpty(str: string | undefined): str is undefined;
|
|
1041
|
+
static isWhitespace(text: string | undefined): boolean;
|
|
1042
|
+
static startsWithNewLine(str: string | undefined): boolean;
|
|
1043
|
+
static endsWithNewLine(str: string | undefined): boolean;
|
|
1044
|
+
static insertAtLastNonWhitespace(str: string, insertText: string): string;
|
|
1045
|
+
static getLineNumberAtPos(str: string, pos: number): number;
|
|
1046
|
+
static getLengthFromLineStartAtPos(str: string, pos: number): number;
|
|
1047
|
+
static getLineStartFromPos(str: string, pos: number): number;
|
|
1048
|
+
static getLineEndFromPos(str: string, pos: number): number;
|
|
1049
|
+
static escapeForWithinString(str: string, quoteKind: "\"" | "'"): string;
|
|
1050
|
+
/**
|
|
1051
|
+
* Escapes all the occurrences of the char in the string.
|
|
1052
|
+
*/
|
|
1053
|
+
static escapeChar(str: string, char: string): string;
|
|
1054
|
+
static removeIndentation(str: string, opts: {
|
|
1055
|
+
isInStringAtPos: (pos: number) => boolean;
|
|
1056
|
+
indentSizeInSpaces: number;
|
|
1057
|
+
}): string;
|
|
1058
|
+
static indent(str: string, times: number, options: {
|
|
1059
|
+
indentText: string;
|
|
1060
|
+
indentSizeInSpaces: number;
|
|
1061
|
+
isInStringAtPos: (pos: number) => boolean;
|
|
1062
|
+
}): string;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
export import CompilerOptions = ts.CompilerOptions;
|
|
1066
|
+
export import DiagnosticCategory = ts.DiagnosticCategory;
|
|
1067
|
+
export import EditorSettings = ts.EditorSettings;
|
|
1068
|
+
export import EmitHint = ts.EmitHint;
|
|
1069
|
+
export import ImportPhaseModifierSyntaxKind = ts.ImportPhaseModifierSyntaxKind;
|
|
1070
|
+
export import LanguageVariant = ts.LanguageVariant;
|
|
1071
|
+
export import ModuleKind = ts.ModuleKind;
|
|
1072
|
+
export import ModuleResolutionKind = ts.ModuleResolutionKind;
|
|
1073
|
+
export import NewLineKind = ts.NewLineKind;
|
|
1074
|
+
export import NodeFlags = ts.NodeFlags;
|
|
1075
|
+
export import ObjectFlags = ts.ObjectFlags;
|
|
1076
|
+
export import ScriptKind = ts.ScriptKind;
|
|
1077
|
+
export import ScriptTarget = ts.ScriptTarget;
|
|
1078
|
+
export import SymbolFlags = ts.SymbolFlags;
|
|
1079
|
+
export import SyntaxKind = ts.SyntaxKind;
|
|
1080
|
+
export import TypeFlags = ts.TypeFlags;
|
|
1081
|
+
export import TypeFormatFlags = ts.TypeFormatFlags;
|
|
1082
|
+
export { ts };
|