@volar/language-server 1.0.0-alpha.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/out/browser.d.ts +3 -0
  3. package/out/browser.js +47 -0
  4. package/out/features/customFeatures.d.ts +4 -0
  5. package/out/features/customFeatures.js +83 -0
  6. package/out/features/documentFeatures.d.ts +4 -0
  7. package/out/features/documentFeatures.js +73 -0
  8. package/out/features/languageFeatures.d.ts +4 -0
  9. package/out/features/languageFeatures.js +274 -0
  10. package/out/index.d.ts +3 -0
  11. package/out/index.js +19 -0
  12. package/out/node.d.ts +3 -0
  13. package/out/node.js +88 -0
  14. package/out/registers/registerDocumentFeatures.d.ts +3 -0
  15. package/out/registers/registerDocumentFeatures.js +30 -0
  16. package/out/registers/registerlanguageFeatures.d.ts +3 -0
  17. package/out/registers/registerlanguageFeatures.js +144 -0
  18. package/out/requests.d.ts +81 -0
  19. package/out/requests.js +65 -0
  20. package/out/schemaRequestHandlers/file.d.ts +2 -0
  21. package/out/schemaRequestHandlers/file.js +12 -0
  22. package/out/schemaRequestHandlers/http.d.ts +1 -0
  23. package/out/schemaRequestHandlers/http.js +12 -0
  24. package/out/server.d.ts +3 -0
  25. package/out/server.js +99 -0
  26. package/out/types.d.ts +112 -0
  27. package/out/types.js +2 -0
  28. package/out/utils/config.d.ts +2 -0
  29. package/out/utils/config.js +17 -0
  30. package/out/utils/configurationHost.d.ts +5 -0
  31. package/out/utils/configurationHost.js +38 -0
  32. package/out/utils/documentServiceHost.d.ts +30 -0
  33. package/out/utils/documentServiceHost.js +51 -0
  34. package/out/utils/inferredCompilerOptions.d.ts +3 -0
  35. package/out/utils/inferredCompilerOptions.js +71 -0
  36. package/out/utils/iterableWeakSet.d.ts +7 -0
  37. package/out/utils/iterableWeakSet.js +40 -0
  38. package/out/utils/nodeFileSystemHost.d.ts +3 -0
  39. package/out/utils/nodeFileSystemHost.js +95 -0
  40. package/out/utils/project.d.ts +99 -0
  41. package/out/utils/project.js +273 -0
  42. package/out/utils/snapshots.d.ts +45 -0
  43. package/out/utils/snapshots.js +201 -0
  44. package/out/utils/ts/core.d.ts +83 -0
  45. package/out/utils/ts/core.js +319 -0
  46. package/out/utils/ts/corePublic.d.ts +91 -0
  47. package/out/utils/ts/corePublic.js +50 -0
  48. package/out/utils/ts/path.d.ts +112 -0
  49. package/out/utils/ts/path.js +416 -0
  50. package/out/utils/ts/types.d.ts +129 -0
  51. package/out/utils/ts/types.js +2 -0
  52. package/out/utils/ts/utilities.d.ts +7 -0
  53. package/out/utils/ts/utilities.js +249 -0
  54. package/out/utils/webFileSystemHost.d.ts +2 -0
  55. package/out/utils/webFileSystemHost.js +265 -0
  56. package/out/utils/workspaceProjects.d.ts +120 -0
  57. package/out/utils/workspaceProjects.js +226 -0
  58. package/out/utils/workspaces.d.ts +309 -0
  59. package/out/utils/workspaces.js +154 -0
  60. package/package.json +27 -0
@@ -0,0 +1,319 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.startsWith = exports.createGetCanonicalFileName = exports.stringContains = exports.endsWith = exports.getStringComparer = exports.compareStringsCaseSensitive = exports.equateStringsCaseSensitive = exports.equateStringsCaseInsensitive = exports.last = exports.lastOrUndefined = exports.sort = exports.some = exports.flatMap = exports.flatten = exports.map = exports.indexOfAnyCharCode = exports.findIndex = exports.every = void 0;
3
+ const emptyArray = [];
4
+ /**
5
+ * Iterates through `array` by index and performs the callback on each element of array until the callback
6
+ * returns a falsey value, then returns false.
7
+ * If no such value is found, the callback is applied to each element of array and `true` is returned.
8
+ */
9
+ function every(array, callback) {
10
+ if (array) {
11
+ for (let i = 0; i < array.length; i++) {
12
+ if (!callback(array[i], i)) {
13
+ return false;
14
+ }
15
+ }
16
+ }
17
+ return true;
18
+ }
19
+ exports.every = every;
20
+ /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */
21
+ function findIndex(array, predicate, startIndex) {
22
+ if (array === undefined)
23
+ return -1;
24
+ for (let i = startIndex !== null && startIndex !== void 0 ? startIndex : 0; i < array.length; i++) {
25
+ if (predicate(array[i], i)) {
26
+ return i;
27
+ }
28
+ }
29
+ return -1;
30
+ }
31
+ exports.findIndex = findIndex;
32
+ function contains(array, value, equalityComparer = equateValues) {
33
+ if (array) {
34
+ for (const v of array) {
35
+ if (equalityComparer(v, value)) {
36
+ return true;
37
+ }
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ function indexOfAnyCharCode(text, charCodes, start) {
43
+ for (let i = start || 0; i < text.length; i++) {
44
+ if (contains(charCodes, text.charCodeAt(i))) {
45
+ return i;
46
+ }
47
+ }
48
+ return -1;
49
+ }
50
+ exports.indexOfAnyCharCode = indexOfAnyCharCode;
51
+ function map(array, f) {
52
+ let result;
53
+ if (array) {
54
+ result = [];
55
+ for (let i = 0; i < array.length; i++) {
56
+ result.push(f(array[i], i));
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ exports.map = map;
62
+ /**
63
+ * Flattens an array containing a mix of array or non-array elements.
64
+ *
65
+ * @param array The array to flatten.
66
+ */
67
+ function flatten(array) {
68
+ const result = [];
69
+ for (const v of array) {
70
+ if (v) {
71
+ if (isArray(v)) {
72
+ addRange(result, v);
73
+ }
74
+ else {
75
+ result.push(v);
76
+ }
77
+ }
78
+ }
79
+ return result;
80
+ }
81
+ exports.flatten = flatten;
82
+ /**
83
+ * Maps an array. If the mapped value is an array, it is spread into the result.
84
+ *
85
+ * @param array The array to map.
86
+ * @param mapfn The callback used to map the result into one or more values.
87
+ */
88
+ function flatMap(array, mapfn) {
89
+ let result;
90
+ if (array) {
91
+ for (let i = 0; i < array.length; i++) {
92
+ const v = mapfn(array[i], i);
93
+ if (v) {
94
+ if (isArray(v)) {
95
+ result = addRange(result, v);
96
+ }
97
+ else {
98
+ result = append(result, v);
99
+ }
100
+ }
101
+ }
102
+ }
103
+ return result || emptyArray;
104
+ }
105
+ exports.flatMap = flatMap;
106
+ function some(array, predicate) {
107
+ if (array) {
108
+ if (predicate) {
109
+ for (const v of array) {
110
+ if (predicate(v)) {
111
+ return true;
112
+ }
113
+ }
114
+ }
115
+ else {
116
+ return array.length > 0;
117
+ }
118
+ }
119
+ return false;
120
+ }
121
+ exports.some = some;
122
+ // function append<T>(to: T[] | undefined, value: T): T[];
123
+ // function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
124
+ // function append<T>(to: Push<T>, value: T | undefined): void;
125
+ function append(to, value) {
126
+ if (value === undefined)
127
+ return to;
128
+ if (to === undefined)
129
+ return [value];
130
+ to.push(value);
131
+ return to;
132
+ }
133
+ /**
134
+ * Gets the actual offset into an array for a relative offset. Negative offsets indicate a
135
+ * position offset from the end of the array.
136
+ */
137
+ function toOffset(array, offset) {
138
+ return offset < 0 ? array.length + offset : offset;
139
+ }
140
+ function addRange(to, from, start, end) {
141
+ if (from === undefined || from.length === 0)
142
+ return to;
143
+ if (to === undefined)
144
+ return from.slice(start, end);
145
+ start = start === undefined ? 0 : toOffset(from, start);
146
+ end = end === undefined ? from.length : toOffset(from, end);
147
+ for (let i = start; i < end && i < from.length; i++) {
148
+ if (from[i] !== undefined) {
149
+ to.push(from[i]);
150
+ }
151
+ }
152
+ return to;
153
+ }
154
+ /**
155
+ * Returns a new sorted array.
156
+ */
157
+ function sort(array, comparer) {
158
+ return (array.length === 0 ? array : array.slice().sort(comparer));
159
+ }
160
+ exports.sort = sort;
161
+ /**
162
+ * Returns the last element of an array if non-empty, `undefined` otherwise.
163
+ */
164
+ function lastOrUndefined(array) {
165
+ return array === undefined || array.length === 0 ? undefined : array[array.length - 1];
166
+ }
167
+ exports.lastOrUndefined = lastOrUndefined;
168
+ function last(array) {
169
+ // Debug.assert(array.length !== 0);
170
+ return array[array.length - 1];
171
+ }
172
+ exports.last = last;
173
+ /**
174
+ * Tests whether a value is an array.
175
+ */
176
+ function isArray(value) {
177
+ return Array.isArray ? Array.isArray(value) : value instanceof Array;
178
+ }
179
+ /** Returns its argument. */
180
+ function identity(x) {
181
+ return x;
182
+ }
183
+ /** Returns lower case string */
184
+ function toLowerCase(x) {
185
+ return x.toLowerCase();
186
+ }
187
+ // We convert the file names to lower case as key for file name on case insensitive file system
188
+ // While doing so we need to handle special characters (eg \u0130) to ensure that we dont convert
189
+ // it to lower case, fileName with its lowercase form can exist along side it.
190
+ // Handle special characters and make those case sensitive instead
191
+ //
192
+ // |-#--|-Unicode--|-Char code-|-Desc-------------------------------------------------------------------|
193
+ // | 1. | i | 105 | Ascii i |
194
+ // | 2. | I | 73 | Ascii I |
195
+ // |-------- Special characters ------------------------------------------------------------------------|
196
+ // | 3. | \u0130 | 304 | Upper case I with dot above |
197
+ // | 4. | i,\u0307 | 105,775 | i, followed by 775: Lower case of (3rd item) |
198
+ // | 5. | I,\u0307 | 73,775 | I, followed by 775: Upper case of (4th item), lower case is (4th item) |
199
+ // | 6. | \u0131 | 305 | Lower case i without dot, upper case is I (2nd item) |
200
+ // | 7. | \u00DF | 223 | Lower case sharp s |
201
+ //
202
+ // Because item 3 is special where in its lowercase character has its own
203
+ // upper case form we cant convert its case.
204
+ // Rest special characters are either already in lower case format or
205
+ // they have corresponding upper case character so they dont need special handling
206
+ //
207
+ // But to avoid having to do string building for most common cases, also ignore
208
+ // a-z, 0-9, \u0131, \u00DF, \, /, ., : and space
209
+ const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
210
+ /**
211
+ * Case insensitive file systems have descripencies in how they handle some characters (eg. turkish Upper case I with dot on top - \u0130)
212
+ * This function is used in places where we want to make file name as a key on these systems
213
+ * It is possible on mac to be able to refer to file name with I with dot on top as a fileName with its lower case form
214
+ * But on windows we cannot. Windows can have fileName with I with dot on top next to its lower case and they can not each be referred with the lowercase forms
215
+ * Technically we would want this function to be platform sepcific as well but
216
+ * our api has till now only taken caseSensitive as the only input and just for some characters we dont want to update API and ensure all customers use those api
217
+ * We could use upper case and we would still need to deal with the descripencies but
218
+ * we want to continue using lower case since in most cases filenames are lowercasewe and wont need any case changes and avoid having to store another string for the key
219
+ * So for this function purpose, we go ahead and assume character I with dot on top it as case sensitive since its very unlikely to use lower case form of that special character
220
+ */
221
+ function toFileNameLowerCase(x) {
222
+ return fileNameLowerCaseRegExp.test(x) ?
223
+ x.replace(fileNameLowerCaseRegExp, toLowerCase) :
224
+ x;
225
+ }
226
+ function equateValues(a, b) {
227
+ return a === b;
228
+ }
229
+ /**
230
+ * Compare the equality of two strings using a case-sensitive ordinal comparison.
231
+ *
232
+ * Case-sensitive comparisons compare both strings one code-point at a time using the integer
233
+ * value of each code-point after applying `toUpperCase` to each string. We always map both
234
+ * strings to their upper-case form as some unicode characters do not properly round-trip to
235
+ * lowercase (such as `ẞ` (German sharp capital s)).
236
+ */
237
+ function equateStringsCaseInsensitive(a, b) {
238
+ return a === b
239
+ || a !== undefined
240
+ && b !== undefined
241
+ && a.toUpperCase() === b.toUpperCase();
242
+ }
243
+ exports.equateStringsCaseInsensitive = equateStringsCaseInsensitive;
244
+ /**
245
+ * Compare the equality of two strings using a case-sensitive ordinal comparison.
246
+ *
247
+ * Case-sensitive comparisons compare both strings one code-point at a time using the
248
+ * integer value of each code-point.
249
+ */
250
+ function equateStringsCaseSensitive(a, b) {
251
+ return equateValues(a, b);
252
+ }
253
+ exports.equateStringsCaseSensitive = equateStringsCaseSensitive;
254
+ function compareComparableValues(a, b) {
255
+ return a === b ? 0 /* Comparison.EqualTo */ :
256
+ a === undefined ? -1 /* Comparison.LessThan */ :
257
+ b === undefined ? 1 /* Comparison.GreaterThan */ :
258
+ a < b ? -1 /* Comparison.LessThan */ :
259
+ 1 /* Comparison.GreaterThan */;
260
+ }
261
+ /**
262
+ * Compare two strings using a case-insensitive ordinal comparison.
263
+ *
264
+ * Ordinal comparisons are based on the difference between the unicode code points of both
265
+ * strings. Characters with multiple unicode representations are considered unequal. Ordinal
266
+ * comparisons provide predictable ordering, but place "a" after "B".
267
+ *
268
+ * Case-insensitive comparisons compare both strings one code-point at a time using the integer
269
+ * value of each code-point after applying `toUpperCase` to each string. We always map both
270
+ * strings to their upper-case form as some unicode characters do not properly round-trip to
271
+ * lowercase (such as `ẞ` (German sharp capital s)).
272
+ */
273
+ function compareStringsCaseInsensitive(a, b) {
274
+ if (a === b)
275
+ return 0 /* Comparison.EqualTo */;
276
+ if (a === undefined)
277
+ return -1 /* Comparison.LessThan */;
278
+ if (b === undefined)
279
+ return 1 /* Comparison.GreaterThan */;
280
+ a = a.toUpperCase();
281
+ b = b.toUpperCase();
282
+ return a < b ? -1 /* Comparison.LessThan */ : a > b ? 1 /* Comparison.GreaterThan */ : 0 /* Comparison.EqualTo */;
283
+ }
284
+ /**
285
+ * Compare two strings using a case-sensitive ordinal comparison.
286
+ *
287
+ * Ordinal comparisons are based on the difference between the unicode code points of both
288
+ * strings. Characters with multiple unicode representations are considered unequal. Ordinal
289
+ * comparisons provide predictable ordering, but place "a" after "B".
290
+ *
291
+ * Case-sensitive comparisons compare both strings one code-point at a time using the integer
292
+ * value of each code-point.
293
+ */
294
+ function compareStringsCaseSensitive(a, b) {
295
+ return compareComparableValues(a, b);
296
+ }
297
+ exports.compareStringsCaseSensitive = compareStringsCaseSensitive;
298
+ function getStringComparer(ignoreCase) {
299
+ return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
300
+ }
301
+ exports.getStringComparer = getStringComparer;
302
+ function endsWith(str, suffix) {
303
+ const expectedPos = str.length - suffix.length;
304
+ return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
305
+ }
306
+ exports.endsWith = endsWith;
307
+ function stringContains(str, substring) {
308
+ return str.indexOf(substring) !== -1;
309
+ }
310
+ exports.stringContains = stringContains;
311
+ function createGetCanonicalFileName(useCaseSensitiveFileNames) {
312
+ return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
313
+ }
314
+ exports.createGetCanonicalFileName = createGetCanonicalFileName;
315
+ function startsWith(str, prefix) {
316
+ return str.lastIndexOf(prefix, 0) === 0;
317
+ }
318
+ exports.startsWith = startsWith;
319
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1,91 @@
1
+ export declare const versionMajorMinor = "4.9";
2
+ /** The version of the TypeScript compiler release */
3
+ export declare const version: string;
4
+ /**
5
+ * Type of objects whose values are all of the same type.
6
+ * The `in` and `for-in` operators can *not* be safely used,
7
+ * since `Object.prototype` may be modified by outside code.
8
+ */
9
+ export interface MapLike<T> {
10
+ [index: string]: T;
11
+ }
12
+ export interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
13
+ " __sortedArrayBrand": any;
14
+ }
15
+ export interface SortedArray<T> extends Array<T> {
16
+ " __sortedArrayBrand": any;
17
+ }
18
+ /** Common read methods for ES6 Map/Set. */
19
+ export interface ReadonlyCollection<K> {
20
+ readonly size: number;
21
+ has(key: K): boolean;
22
+ keys(): Iterator<K>;
23
+ }
24
+ /** Common write methods for ES6 Map/Set. */
25
+ export interface Collection<K> extends ReadonlyCollection<K> {
26
+ delete(key: K): boolean;
27
+ clear(): void;
28
+ }
29
+ /** ES6 Map interface, only read methods included. */
30
+ export interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
31
+ get(key: K): V | undefined;
32
+ values(): Iterator<V>;
33
+ entries(): Iterator<[K, V]>;
34
+ forEach(action: (value: V, key: K) => void): void;
35
+ }
36
+ /**
37
+ * ES6 Map interface, only read methods included.
38
+ */
39
+ export interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
40
+ }
41
+ /** ES6 Map interface. */
42
+ export interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
43
+ set(key: K, value: V): this;
44
+ }
45
+ /**
46
+ * ES6 Map interface.
47
+ */
48
+ export interface Map<T> extends ESMap<string, T> {
49
+ }
50
+ export interface MapConstructor {
51
+ new <K, V>(iterable?: readonly (readonly [K, V])[] | ReadonlyESMap<K, V>): ESMap<K, V>;
52
+ }
53
+ /** ES6 Set interface, only read methods included. */
54
+ export interface ReadonlySet<T> extends ReadonlyCollection<T> {
55
+ has(value: T): boolean;
56
+ values(): Iterator<T>;
57
+ entries(): Iterator<[T, T]>;
58
+ forEach(action: (value: T, key: T) => void): void;
59
+ }
60
+ /** ES6 Set interface. */
61
+ export interface Set<T> extends ReadonlySet<T>, Collection<T> {
62
+ add(value: T): this;
63
+ delete(value: T): boolean;
64
+ }
65
+ export interface SetConstructor {
66
+ new <T>(iterable?: readonly T[] | ReadonlySet<T>): Set<T>;
67
+ }
68
+ /** ES6 Iterator type. */
69
+ export interface Iterator<T> {
70
+ next(): {
71
+ value: T;
72
+ done?: false;
73
+ } | {
74
+ value: void;
75
+ done: true;
76
+ };
77
+ }
78
+ /** Array that is only intended to be pushed to, never read. */
79
+ export interface Push<T> {
80
+ push(...values: T[]): void;
81
+ readonly length: number;
82
+ }
83
+ export declare type EqualityComparer<T> = (a: T, b: T) => boolean;
84
+ export declare type Comparer<T> = (a: T, b: T) => Comparison;
85
+ export declare const enum Comparison {
86
+ LessThan = -1,
87
+ EqualTo = 0,
88
+ GreaterThan = 1
89
+ }
90
+ export declare const Map: MapConstructor;
91
+ export declare const Set: SetConstructor;
@@ -0,0 +1,50 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.Set = exports.Map = exports.version = exports.versionMajorMinor = void 0;
3
+ // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
4
+ // If changing the text in this section, be sure to test `configurePrerelease` too.
5
+ exports.versionMajorMinor = "4.9";
6
+ // The following is baselined as a literal template type without intervention
7
+ /** The version of the TypeScript compiler release */
8
+ // eslint-disable-next-line @typescript-eslint/no-inferrable-types
9
+ exports.version = `${exports.versionMajorMinor}.0-dev`;
10
+ /* @internal */
11
+ var NativeCollections;
12
+ (function (NativeCollections) {
13
+ const globals = typeof globalThis !== "undefined" ? globalThis :
14
+ typeof global !== "undefined" ? global :
15
+ typeof self !== "undefined" ? self :
16
+ undefined;
17
+ /**
18
+ * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
19
+ */
20
+ function tryGetNativeMap() {
21
+ // Internet Explorer's Map doesn't support iteration, so don't use it.
22
+ const gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
23
+ // eslint-disable-next-line local/no-in-operator
24
+ const constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
25
+ if (!constructor) {
26
+ throw new Error("No compatible Map implementation found.");
27
+ }
28
+ return constructor;
29
+ }
30
+ NativeCollections.tryGetNativeMap = tryGetNativeMap;
31
+ /**
32
+ * Returns the native Set implementation if it is available and compatible (i.e. supports iteration).
33
+ */
34
+ function tryGetNativeSet() {
35
+ // Internet Explorer's Set doesn't support iteration, so don't use it.
36
+ const gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
37
+ // eslint-disable-next-line local/no-in-operator
38
+ const constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
39
+ if (!constructor) {
40
+ throw new Error("No compatible Set implementation found.");
41
+ }
42
+ return constructor;
43
+ }
44
+ NativeCollections.tryGetNativeSet = tryGetNativeSet;
45
+ })(NativeCollections || (NativeCollections = {}));
46
+ /* @internal */
47
+ exports.Map = NativeCollections.tryGetNativeMap();
48
+ /* @internal */
49
+ exports.Set = NativeCollections.tryGetNativeSet();
50
+ //# sourceMappingURL=corePublic.js.map
@@ -0,0 +1,112 @@
1
+ import { Path } from "./types";
2
+ /**
3
+ * Internally, we represent paths as strings with '/' as the directory separator.
4
+ * When we make system calls (eg: LanguageServiceHost.getDirectory()),
5
+ * we expect the host to correctly handle paths in our specified format.
6
+ */
7
+ export declare const directorySeparator = "/";
8
+ /**
9
+ * Determines whether a path is an absolute disk path (e.g. starts with `/`, or a dos path
10
+ * like `c:`, `c:\` or `c:/`).
11
+ */
12
+ export declare function isRootedDiskPath(path: string): boolean;
13
+ export declare function hasExtension(fileName: string): boolean;
14
+ export declare function fileExtensionIsOneOf(path: string, extensions: readonly string[]): boolean;
15
+ /**
16
+ * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname`
17
+ * except that we support URLs as well.
18
+ *
19
+ * ```ts
20
+ * // POSIX
21
+ * getDirectoryPath("/path/to/file.ext") === "/path/to"
22
+ * getDirectoryPath("/path/to/") === "/path"
23
+ * getDirectoryPath("/") === "/"
24
+ * // DOS
25
+ * getDirectoryPath("c:/path/to/file.ext") === "c:/path/to"
26
+ * getDirectoryPath("c:/path/to/") === "c:/path"
27
+ * getDirectoryPath("c:/") === "c:/"
28
+ * getDirectoryPath("c:") === "c:"
29
+ * // URL
30
+ * getDirectoryPath("http://typescriptlang.org/path/to/file.ext") === "http://typescriptlang.org/path/to"
31
+ * getDirectoryPath("http://typescriptlang.org/path/to") === "http://typescriptlang.org/path"
32
+ * getDirectoryPath("http://typescriptlang.org/") === "http://typescriptlang.org/"
33
+ * getDirectoryPath("http://typescriptlang.org") === "http://typescriptlang.org"
34
+ * ```
35
+ */
36
+ export declare function getDirectoryPath(path: Path): Path;
37
+ /**
38
+ * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname`
39
+ * except that we support URLs as well.
40
+ *
41
+ * ```ts
42
+ * // POSIX
43
+ * getDirectoryPath("/path/to/file.ext") === "/path/to"
44
+ * getDirectoryPath("/path/to/") === "/path"
45
+ * getDirectoryPath("/") === "/"
46
+ * // DOS
47
+ * getDirectoryPath("c:/path/to/file.ext") === "c:/path/to"
48
+ * getDirectoryPath("c:/path/to/") === "c:/path"
49
+ * getDirectoryPath("c:/") === "c:/"
50
+ * getDirectoryPath("c:") === "c:"
51
+ * // URL
52
+ * getDirectoryPath("http://typescriptlang.org/path/to/file.ext") === "http://typescriptlang.org/path/to"
53
+ * getDirectoryPath("http://typescriptlang.org/path/to") === "http://typescriptlang.org/path"
54
+ * getDirectoryPath("http://typescriptlang.org/") === "http://typescriptlang.org/"
55
+ * getDirectoryPath("http://typescriptlang.org") === "http://typescriptlang.org"
56
+ * getDirectoryPath("file://server/path/to/file.ext") === "file://server/path/to"
57
+ * getDirectoryPath("file://server/path/to") === "file://server/path"
58
+ * getDirectoryPath("file://server/") === "file://server/"
59
+ * getDirectoryPath("file://server") === "file://server"
60
+ * getDirectoryPath("file:///path/to/file.ext") === "file:///path/to"
61
+ * getDirectoryPath("file:///path/to") === "file:///path"
62
+ * getDirectoryPath("file:///") === "file:///"
63
+ * getDirectoryPath("file://") === "file://"
64
+ * ```
65
+ */
66
+ export declare function getDirectoryPath(path: string): string;
67
+ /**
68
+ * Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
69
+ *
70
+ * ```ts
71
+ * // Non-rooted
72
+ * combinePaths("path", "to", "file.ext") === "path/to/file.ext"
73
+ * combinePaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext"
74
+ * // POSIX
75
+ * combinePaths("/path", "to", "file.ext") === "/path/to/file.ext"
76
+ * combinePaths("/path", "/to", "file.ext") === "/to/file.ext"
77
+ * // DOS
78
+ * combinePaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext"
79
+ * combinePaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext"
80
+ * // URL
81
+ * combinePaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext"
82
+ * combinePaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext"
83
+ * ```
84
+ */
85
+ export declare function combinePaths(path: string, ...paths: (string | undefined)[]): string;
86
+ /**
87
+ * Parse a path into an array containing a root component (at index 0) and zero or more path
88
+ * components (at indices > 0). The result is normalized.
89
+ * If the path is relative, the root component is `""`.
90
+ * If the path is absolute, the root component includes the first path separator (`/`).
91
+ *
92
+ * ```ts
93
+ * getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"]
94
+ * ```
95
+ */
96
+ export declare function getNormalizedPathComponents(path: string, currentDirectory: string | undefined): string[];
97
+ export declare function normalizePath(path: string): string;
98
+ /**
99
+ * Removes a trailing directory separator from a path, if it does not already have one.
100
+ *
101
+ * ```ts
102
+ * removeTrailingDirectorySeparator("/path/to/file.ext") === "/path/to/file.ext"
103
+ * removeTrailingDirectorySeparator("/path/to/file.ext/") === "/path/to/file.ext"
104
+ * ```
105
+ */
106
+ export declare function removeTrailingDirectorySeparator(path: Path): Path;
107
+ export declare function removeTrailingDirectorySeparator(path: string): string;
108
+ /**
109
+ * Determines whether a `parent` path contains a `child` path using the provide case sensitivity.
110
+ */
111
+ export declare function containsPath(parent: string, child: string, ignoreCase?: boolean): boolean;
112
+ export declare function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;