@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,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1180",
3
+ "version": "0.1.1182",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -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,CAuBrD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAG3C"}
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(url);
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(urlString.slice(8).replace(/\//g, "\\"));
36
+ return decodeURIComponent(parsedUrl.pathname)
37
+ .replace(/^\/([A-Za-z]:)/, "$1")
38
+ .replace(/\//g, "\\");
34
39
  }
35
- return decodeURIComponent(urlString.slice(7));
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(urlString.slice(7));
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
- return new URL(`file://${absolute}`);
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
  }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1180";
2
+ export declare const VERSION = "0.1.1182";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1180";
4
+ export const VERSION = "0.1.1182";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-content-mdx",
3
- "version": "0.1.1180",
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.1180"
70
+ "veryfront": "^0.1.1182"
71
71
  },
72
72
  "type": "module",
73
73
  "types": "./esm/extensions/ext-content-mdx/src/index.d.ts",