@veryfront/ext-content-mdx 0.1.1180 → 0.1.1182
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/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-conversion.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/url-conversion.ts"],"names":[],"mappings":"AA6BA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"url-conversion.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/url-conversion.ts"],"names":[],"mappings":"AA6BA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAwBrD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAS3C"}
|
|
@@ -21,25 +21,33 @@ function getFileURLToPath() {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
export function fromFileUrl(url) {
|
|
24
|
+
const parsedUrl = typeof url === "string" ? new URL(url) : url;
|
|
25
|
+
if (parsedUrl.protocol !== "file:") {
|
|
26
|
+
throw new TypeError("Must be a file URL");
|
|
27
|
+
}
|
|
24
28
|
const fileURLToPath = getFileURLToPath();
|
|
25
29
|
if (fileURLToPath)
|
|
26
|
-
return fileURLToPath(
|
|
27
|
-
const urlString = typeof url === "string" ? url : url.toString();
|
|
30
|
+
return fileURLToPath(parsedUrl);
|
|
28
31
|
if (isDeno) {
|
|
29
32
|
const g = dntShim.dntGlobalThis;
|
|
30
33
|
const hasCwd = Boolean(g.Deno?.cwd);
|
|
31
34
|
const isWindows = g.Deno?.build?.os === "windows";
|
|
32
35
|
if (hasCwd && isWindows) {
|
|
33
|
-
return decodeURIComponent(
|
|
36
|
+
return decodeURIComponent(parsedUrl.pathname)
|
|
37
|
+
.replace(/^\/([A-Za-z]:)/, "$1")
|
|
38
|
+
.replace(/\//g, "\\");
|
|
34
39
|
}
|
|
35
|
-
return decodeURIComponent(
|
|
36
|
-
}
|
|
37
|
-
if (!urlString.startsWith("file://")) {
|
|
38
|
-
throw new TypeError("Must be a file URL");
|
|
40
|
+
return decodeURIComponent(parsedUrl.pathname);
|
|
39
41
|
}
|
|
40
|
-
return decodeURIComponent(
|
|
42
|
+
return decodeURIComponent(parsedUrl.pathname);
|
|
41
43
|
}
|
|
42
44
|
export function toFileUrl(path) {
|
|
43
45
|
const absolute = hasNodePath ? path : isAbsolute(path) ? path : resolve(path);
|
|
44
|
-
|
|
46
|
+
// Preserve filesystem characters that URL parsing would otherwise decode or
|
|
47
|
+
// interpret as fragment/query delimiters.
|
|
48
|
+
const encodedPath = absolute
|
|
49
|
+
.replaceAll("%", "%25")
|
|
50
|
+
.replaceAll("#", "%23")
|
|
51
|
+
.replaceAll("?", "%3F");
|
|
52
|
+
return new URL(`file://${encodedPath}`);
|
|
45
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1182",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1182"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|