@cspell/url 10.3.6 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +26 -26
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @param url
|
|
5
5
|
* @returns the base name of a URL, including the trailing `/` if present.
|
|
6
6
|
*/
|
|
7
|
-
declare function urlBasename(url: string | URL): string;
|
|
8
|
-
declare function isDataURL(url: string | URL): boolean;
|
|
7
|
+
export declare function urlBasename(url: string | URL): string;
|
|
8
|
+
export declare function isDataURL(url: string | URL): boolean;
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/defaultFileUrlBuilder.d.mts
|
|
11
|
-
declare function encodePathChars(filepath: string): string;
|
|
11
|
+
export declare function encodePathChars(filepath: string): string;
|
|
12
12
|
/**
|
|
13
13
|
* Normalize a file path for use in a URL.
|
|
14
14
|
* ```js
|
|
@@ -18,7 +18,7 @@ declare function encodePathChars(filepath: string): string;
|
|
|
18
18
|
* @param filePath
|
|
19
19
|
* @returns a normalized file path for use as a relative path in a URL.
|
|
20
20
|
*/
|
|
21
|
-
declare function normalizeFilePathForUrl(filePath: string): string;
|
|
21
|
+
export declare function normalizeFilePathForUrl(filePath: string): string;
|
|
22
22
|
/**
|
|
23
23
|
* Try to make a file URL.
|
|
24
24
|
* - if filenameOrUrl is already a URL, it is returned as is.
|
|
@@ -27,26 +27,26 @@ declare function normalizeFilePathForUrl(filePath: string): string;
|
|
|
27
27
|
* @param relativeTo - optional URL, if given, filenameOrUrl will be parsed as relative.
|
|
28
28
|
* @returns a URL
|
|
29
29
|
*/
|
|
30
|
-
declare function toFileURL(filenameOrUrl: string | URL, relativeTo?: string | URL): URL;
|
|
30
|
+
export declare function toFileURL(filenameOrUrl: string | URL, relativeTo?: string | URL): URL;
|
|
31
31
|
/**
|
|
32
32
|
* Converts a file path to a URL and adds a trailing slash.
|
|
33
33
|
* @param dir - url to a directory
|
|
34
34
|
* @returns a URL
|
|
35
35
|
*/
|
|
36
|
-
declare function toFileDirURL(dir: string | URL): URL;
|
|
36
|
+
export declare function toFileDirURL(dir: string | URL): URL;
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/fileUrl.d.mts
|
|
39
39
|
/**
|
|
40
40
|
* @param url - URL or string to check if it is a file URL.
|
|
41
41
|
* @returns true if the URL is a file URL.
|
|
42
42
|
*/
|
|
43
|
-
declare function isFileURL(url: URL | string): boolean;
|
|
43
|
+
export declare function isFileURL(url: URL | string): boolean;
|
|
44
44
|
/**
|
|
45
45
|
* Convert a URL into a string. If it is a file URL, convert it to a path.
|
|
46
46
|
* @param url - URL
|
|
47
47
|
* @returns path or href
|
|
48
48
|
*/
|
|
49
|
-
declare function toFilePathOrHref(url: URL | string): string;
|
|
49
|
+
export declare function toFilePathOrHref(url: URL | string): string;
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/FileUrlBuilder.d.mts
|
|
52
52
|
interface ParsedPath {
|
|
@@ -84,7 +84,7 @@ interface BuilderOptions {
|
|
|
84
84
|
path?: PathInterface | undefined;
|
|
85
85
|
cwd?: URL | undefined;
|
|
86
86
|
}
|
|
87
|
-
declare class FileUrlBuilder {
|
|
87
|
+
export declare class FileUrlBuilder {
|
|
88
88
|
#private;
|
|
89
89
|
private windows;
|
|
90
90
|
readonly path: PathInterface;
|
|
@@ -156,14 +156,14 @@ declare class FileUrlBuilder {
|
|
|
156
156
|
* @param relativeTo - optional URL, if given, url will be parsed as relative.
|
|
157
157
|
* @returns a URL
|
|
158
158
|
*/
|
|
159
|
-
declare function toURL(url: string | URL, relativeTo?: string | URL): URL;
|
|
159
|
+
export declare function toURL(url: string | URL, relativeTo?: string | URL): URL;
|
|
160
160
|
/**
|
|
161
161
|
* Try to determine the parent directory URL of the uri.
|
|
162
162
|
* If it is not a hierarchical URL, then it will return the URL.
|
|
163
163
|
* @param url - url to extract the dirname from.
|
|
164
164
|
* @returns a URL
|
|
165
165
|
*/
|
|
166
|
-
declare function urlParent(url: string | URL): URL;
|
|
166
|
+
export declare function urlParent(url: string | URL): URL;
|
|
167
167
|
/**
|
|
168
168
|
* Alias of {@link urlParent}
|
|
169
169
|
* Try to determine the parent directory URL of the uri.
|
|
@@ -171,49 +171,49 @@ declare function urlParent(url: string | URL): URL;
|
|
|
171
171
|
* @param url - url to extract the dirname from.
|
|
172
172
|
* @returns a URL
|
|
173
173
|
*/
|
|
174
|
-
declare const urlDirname: typeof urlParent;
|
|
174
|
+
export declare const urlDirname: typeof urlParent;
|
|
175
175
|
/**
|
|
176
176
|
* return the basename (last portion of the URL pathname) of a path. It does NOT remove the trailing slash.
|
|
177
177
|
* @param path - URL pathname to extract the basename from.
|
|
178
178
|
*/
|
|
179
|
-
declare function basenameOfUrlPathname(path: string): string;
|
|
179
|
+
export declare function basenameOfUrlPathname(path: string): string;
|
|
180
180
|
/**
|
|
181
181
|
* @param filename - filename to check if it is a string containing a URL.
|
|
182
182
|
*/
|
|
183
|
-
declare function isUrlLike(filename: string): boolean;
|
|
184
|
-
declare function isUrlLike(filename: URL): true;
|
|
183
|
+
export declare function isUrlLike(filename: string): boolean;
|
|
184
|
+
export declare function isUrlLike(filename: URL): true;
|
|
185
185
|
/**
|
|
186
186
|
* @param filename - filename to check if it is a string containing a URL or a URL object.
|
|
187
187
|
*/
|
|
188
|
-
declare function isUrlLike(filename: string | URL): boolean;
|
|
188
|
+
export declare function isUrlLike(filename: string | URL): boolean;
|
|
189
189
|
/**
|
|
190
190
|
* @param filename - filename to check if it is a string containing a URL.
|
|
191
191
|
*/
|
|
192
|
-
declare function isNotUrlLike(filename: string): boolean;
|
|
193
|
-
declare function isNotUrlLike(filename: URL): false;
|
|
192
|
+
export declare function isNotUrlLike(filename: string): boolean;
|
|
193
|
+
export declare function isNotUrlLike(filename: URL): false;
|
|
194
194
|
/**
|
|
195
195
|
* @param filename - filename to check if it is a string containing a URL or a URL object.
|
|
196
196
|
*/
|
|
197
|
-
declare function isNotUrlLike(filename: string | URL): filename is string;
|
|
197
|
+
export declare function isNotUrlLike(filename: string | URL): filename is string;
|
|
198
198
|
/**
|
|
199
199
|
* Check if `url` is a URL instance.
|
|
200
200
|
* @returns
|
|
201
201
|
*/
|
|
202
|
-
declare function isURL(url: unknown): url is URL;
|
|
202
|
+
export declare function isURL(url: unknown): url is URL;
|
|
203
203
|
/**
|
|
204
204
|
*
|
|
205
205
|
* @param url - url to check
|
|
206
206
|
* @param protocol - protocol to check against - e.g. 'file:', 'http:', 'https:'
|
|
207
207
|
* @returns
|
|
208
208
|
*/
|
|
209
|
-
declare function hasProtocol(url: string | URL, protocol: string): boolean;
|
|
209
|
+
export declare function hasProtocol(url: string | URL, protocol: string): boolean;
|
|
210
210
|
/**
|
|
211
211
|
* Attempts to add a trailing slash to the URL pathname if it does not already have one.
|
|
212
212
|
* Some If the pathname doesn't start with a `/`, a trailing slash is not added.
|
|
213
213
|
* @param url - a URL
|
|
214
214
|
* @returns
|
|
215
215
|
*/
|
|
216
|
-
declare function addTrailingSlash(url: URL): URL;
|
|
216
|
+
export declare function addTrailingSlash(url: URL): URL;
|
|
217
217
|
/**
|
|
218
218
|
* Calculate the relative path to go from `urlFrom` to `urlTo`.
|
|
219
219
|
* The protocol is not evaluated. Only the `url.pathname` is used.
|
|
@@ -221,20 +221,20 @@ declare function addTrailingSlash(url: URL): URL;
|
|
|
221
221
|
* @param urlTo
|
|
222
222
|
* @returns the relative path
|
|
223
223
|
*/
|
|
224
|
-
declare function urlRelative(urlFrom: string | URL, urlTo: string | URL): string;
|
|
224
|
+
export declare function urlRelative(urlFrom: string | URL, urlTo: string | URL): string;
|
|
225
225
|
/**
|
|
226
226
|
* Ensure that a windows file url is correctly formatted with a capitol letter for the drive.
|
|
227
227
|
*
|
|
228
228
|
* @param url - URL to check.
|
|
229
229
|
* @returns a new URL if modified or converted from a string.
|
|
230
230
|
*/
|
|
231
|
-
declare function normalizeWindowsUrl(url: URL | string): URL;
|
|
231
|
+
export declare function normalizeWindowsUrl(url: URL | string): URL;
|
|
232
232
|
/**
|
|
233
233
|
* There is a bug is NodeJS that sometimes causes UNC paths converted to a URL to be prefixed with `file:////`.
|
|
234
234
|
* @param url - URL to check.
|
|
235
235
|
* @returns fixed URL if needed.
|
|
236
236
|
*/
|
|
237
|
-
declare function fixUncUrl(url: URL): URL;
|
|
237
|
+
export declare function fixUncUrl(url: URL): URL;
|
|
238
238
|
//#endregion
|
|
239
|
-
export {
|
|
239
|
+
export type { BuilderOptions, PathInterface };
|
|
240
240
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cspell/url",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "URL parsing and manipulation utilities for cspell",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=22.18.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "7e2bbb5e866c827ac5d2cf6b84bf3e1a016d0823"
|
|
61
61
|
}
|