@cspell/url 10.4.0 → 10.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -10
- package/dist/index.js +5 -10
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/dataUrl.d.mts
|
|
2
1
|
/**
|
|
3
2
|
* Try to determine the base name of a URL.
|
|
4
3
|
* @param url
|
|
@@ -6,8 +5,6 @@
|
|
|
6
5
|
*/
|
|
7
6
|
export declare function urlBasename(url: string | URL): string;
|
|
8
7
|
export declare function isDataURL(url: string | URL): boolean;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/defaultFileUrlBuilder.d.mts
|
|
11
8
|
export declare function encodePathChars(filepath: string): string;
|
|
12
9
|
/**
|
|
13
10
|
* Normalize a file path for use in a URL.
|
|
@@ -34,8 +31,6 @@ export declare function toFileURL(filenameOrUrl: string | URL, relativeTo?: stri
|
|
|
34
31
|
* @returns a URL
|
|
35
32
|
*/
|
|
36
33
|
export declare function toFileDirURL(dir: string | URL): URL;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/fileUrl.d.mts
|
|
39
34
|
/**
|
|
40
35
|
* @param url - URL or string to check if it is a file URL.
|
|
41
36
|
* @returns true if the URL is a file URL.
|
|
@@ -47,8 +42,6 @@ export declare function isFileURL(url: URL | string): boolean;
|
|
|
47
42
|
* @returns path or href
|
|
48
43
|
*/
|
|
49
44
|
export declare function toFilePathOrHref(url: URL | string): string;
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/FileUrlBuilder.d.mts
|
|
52
45
|
interface ParsedPath {
|
|
53
46
|
/**
|
|
54
47
|
* The root of the path such as '/' or 'c:\'
|
|
@@ -148,8 +141,6 @@ export declare class FileUrlBuilder {
|
|
|
148
141
|
isAbsolute(filePath: string): boolean;
|
|
149
142
|
isUrlLike(url: string | URL): boolean;
|
|
150
143
|
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/url.d.mts
|
|
153
144
|
/**
|
|
154
145
|
* Try to make a URL.
|
|
155
146
|
* @param url
|
|
@@ -235,6 +226,5 @@ export declare function normalizeWindowsUrl(url: URL | string): URL;
|
|
|
235
226
|
* @returns fixed URL if needed.
|
|
236
227
|
*/
|
|
237
228
|
export declare function fixUncUrl(url: URL): URL;
|
|
238
|
-
//#endregion
|
|
239
229
|
export type { BuilderOptions, PathInterface };
|
|
240
230
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
2
|
import Path from "node:path";
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
-
|
|
4
|
+
// src/url.mts
|
|
5
5
|
const isURLRegEx = /^(\w[\w-]{1,63}:\/|data:|stdin:)/i;
|
|
6
6
|
/**
|
|
7
7
|
* Try to make a URL.
|
|
@@ -145,8 +145,7 @@ function fixUncUrl(url) {
|
|
|
145
145
|
if (url.href.startsWith("file:////")) return new URL(url.href.replace(/^file:\/{4}/, "file://"));
|
|
146
146
|
return url;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
//#region src/dataUrl.mts
|
|
148
|
+
// src/dataUrl.mts
|
|
150
149
|
const regMatchFilename = /filename=([^;,]*)/;
|
|
151
150
|
/**
|
|
152
151
|
* Try to determine the base name of a URL.
|
|
@@ -166,8 +165,7 @@ function urlBasename(url) {
|
|
|
166
165
|
function isDataURL(url) {
|
|
167
166
|
return hasProtocol(url, "data:");
|
|
168
167
|
}
|
|
169
|
-
|
|
170
|
-
//#region src/fileUrl.mts
|
|
168
|
+
// src/fileUrl.mts
|
|
171
169
|
const isWindows = process.platform === "win32";
|
|
172
170
|
const windowsUrlPathRegExp = /^\/[a-zA-Z]:\//;
|
|
173
171
|
function isWindowsPathnameWithDriveLatter(pathname) {
|
|
@@ -234,8 +232,7 @@ function fixLongPathPrefix(path) {
|
|
|
234
232
|
if (!hasLongPathPrefixAlt(path)) return path;
|
|
235
233
|
return uncLongPathPrefix + path.slice(4);
|
|
236
234
|
}
|
|
237
|
-
|
|
238
|
-
//#region src/FileUrlBuilder.mts
|
|
235
|
+
// src/FileUrlBuilder.mts
|
|
239
236
|
const isWindowsPathRegEx = regExpWindowsPathDriveLetter;
|
|
240
237
|
const isWindowsPathname = regExpWindowsPath;
|
|
241
238
|
const percentRegEx = /%/g;
|
|
@@ -410,8 +407,7 @@ var FileUrlBuilder = class {
|
|
|
410
407
|
return isUrlLike(url);
|
|
411
408
|
}
|
|
412
409
|
};
|
|
413
|
-
|
|
414
|
-
//#region src/defaultFileUrlBuilder.mts
|
|
410
|
+
// src/defaultFileUrlBuilder.mts
|
|
415
411
|
const fileUrlBuilder = new FileUrlBuilder();
|
|
416
412
|
function encodePathChars(filepath) {
|
|
417
413
|
return fileUrlBuilder.encodePathChars(filepath);
|
|
@@ -447,7 +443,6 @@ function toFileURL(filenameOrUrl, relativeTo) {
|
|
|
447
443
|
function toFileDirURL(dir) {
|
|
448
444
|
return fileUrlBuilder.toFileDirURL(dir);
|
|
449
445
|
}
|
|
450
|
-
//#endregion
|
|
451
446
|
export { FileUrlBuilder, addTrailingSlash, basenameOfUrlPathname, encodePathChars, fixUncUrl, hasProtocol, isDataURL, isFileURL, isNotUrlLike, isURL, isUrlLike, normalizeFilePathForUrl, normalizeWindowsUrl, toFileDirURL, toFilePathOrHref, toFileURL, toURL, urlBasename, urlDirname, urlParent, urlRelative };
|
|
452
447
|
|
|
453
448
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cspell/url",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.1",
|
|
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": "ddb1699a4bfc2766675c2c97412a813d775772eb"
|
|
61
61
|
}
|