@awesomeness-js/server 1.1.2 → 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 +1 -1
- package/src/componentDependencies.js +26 -1
package/package.json
CHANGED
|
@@ -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,7 +12,25 @@ function urlToFsPath(u) {
|
|
|
11
12
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
// If it’s a real file URL, use fileURLToPath
|
|
16
|
+
if (u.protocol === "file:") {
|
|
17
|
+
|
|
18
|
+
let p = fileURLToPath(u);
|
|
19
|
+
|
|
20
|
+
// Guard against malformed file URLs on POSIX producing "usr/..." instead of "/usr/..."
|
|
21
|
+
if (path.sep === "/" && !p.startsWith("/")) p = "/" + p;
|
|
22
|
+
|
|
23
|
+
return p;
|
|
24
|
+
|
|
25
|
+
}
|
|
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
|
+
|
|
33
|
+
return p;
|
|
15
34
|
|
|
16
35
|
}
|
|
17
36
|
|
|
@@ -63,6 +82,12 @@ export default function componentDependencies(allComponents, {
|
|
|
63
82
|
|
|
64
83
|
});
|
|
65
84
|
|
|
85
|
+
console.log({
|
|
86
|
+
"import.meta.url =": import.meta.url,
|
|
87
|
+
component,
|
|
88
|
+
candidateRoots
|
|
89
|
+
});
|
|
90
|
+
|
|
66
91
|
let allFiles;
|
|
67
92
|
let chosenRoot;
|
|
68
93
|
let lastErr;
|