@awesomeness-js/server 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomeness-js/server",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Awesomeness Multi-Site Server",
5
5
  "author": "Scott Forte",
6
6
  "type": "module",
@@ -3,6 +3,7 @@ import { fileURLToPath } from "url";
3
3
  import { each, getAllFiles } from "@awesomeness-js/utils";
4
4
  import { readFileSync } from "fs";
5
5
 
6
+
6
7
  function urlToFsPath(u) {
7
8
 
8
9
  if (!(u instanceof URL)) {
@@ -11,15 +12,24 @@ function urlToFsPath(u) {
11
12
 
12
13
  }
13
14
 
14
- let p = fileURLToPath(u);
15
+ // If it’s a real file URL, use fileURLToPath
16
+ if (u.protocol === "file:") {
17
+
18
+ let p = fileURLToPath(u);
15
19
 
16
- // Guard against malformed file URLs on Linux producing "usr/..." instead of "/usr/..."
17
- if (path.sep === "/" && !p.startsWith("/")) {
20
+ // Guard against malformed file URLs on POSIX producing "usr/..." instead of "/usr/..."
21
+ if (path.sep === "/" && !p.startsWith("/")) p = "/" + p;
18
22
 
19
- p = "/" + p;
23
+ return p;
20
24
 
21
25
  }
22
26
 
27
+ // Otherwise, treat it as a path-like URL and use pathname
28
+ // (common with some runtimes/bundlers)
29
+ let p = decodeURIComponent(u.pathname || "");
30
+
31
+ if (path.sep === "/" && p && !p.startsWith("/")) p = "/" + p;
32
+
23
33
  return p;
24
34
 
25
35
  }
@@ -73,6 +83,7 @@ export default function componentDependencies(allComponents, {
73
83
  });
74
84
 
75
85
  console.log({
86
+ "import.meta.url =": import.meta.url,
76
87
  component,
77
88
  candidateRoots
78
89
  });