@awesomeness-js/server 1.1.3 → 1.1.5

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/NOTICE CHANGED
@@ -9,7 +9,6 @@ This product includes software developed by third parties.
9
9
 
10
10
  - busboy (MIT License)
11
11
  - koa (MIT License)
12
- - koa-compress (MIT License)
12
+ - koa-compress (MIT Licendse)d
13
13
  - koa-send (MIT License)
14
14
  - ws (MIT License)
15
- - zlib (zlib License)
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.5",
4
4
  "description": "Awesomeness Multi-Site Server",
5
5
  "author": "Scott Forte",
6
6
  "type": "module",
@@ -26,8 +26,7 @@
26
26
  "koa": "^3.0.1",
27
27
  "koa-compress": "^5.1.1",
28
28
  "koa-send": "^5.0.1",
29
- "ws": "^8.18.3",
30
- "zlib": "^1.0.5"
29
+ "ws": "^8.18.3"
31
30
  },
32
31
  "license": "none",
33
32
  "devDependencies": {
@@ -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
  }
@@ -72,10 +82,11 @@ export default function componentDependencies(allComponents, {
72
82
 
73
83
  });
74
84
 
75
- console.log({
76
- component,
77
- candidateRoots
78
- });
85
+ // console.log({
86
+ // "import.meta.url =": import.meta.url,
87
+ // component,
88
+ // candidateRoots
89
+ // });
79
90
 
80
91
  let allFiles;
81
92
  let chosenRoot;