primate 0.29.5 → 0.29.6
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/app.js +2 -2
- package/src/hooks/publish.js +1 -1
- package/src/loaders/routes.js +7 -3
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -238,8 +238,8 @@ export default async (log, root, config) => {
|
|
|
238
238
|
const dependency = File.resolve().join(...path);
|
|
239
239
|
const target = File.join(this.runpath(client), this.library, ...parts);
|
|
240
240
|
await dependency.copy(target);
|
|
241
|
-
this.importmaps = {
|
|
242
|
-
|
|
241
|
+
this.importmaps = { ...valmap(exports, value =>
|
|
242
|
+
File.join(root, this.library, value).normalize()),
|
|
243
243
|
...this.importmaps };
|
|
244
244
|
},
|
|
245
245
|
};
|
package/src/hooks/publish.js
CHANGED
|
@@ -16,7 +16,7 @@ const post = async app => {
|
|
|
16
16
|
type: "module",
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
const imports = { ...app.importmaps, app: src.
|
|
19
|
+
const imports = { ...app.importmaps, app: src.normalize() };
|
|
20
20
|
const type = "importmap";
|
|
21
21
|
await app.publish({ inline: true, code: stringify({ imports }), type });
|
|
22
22
|
}
|
package/src/loaders/routes.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { tryreturn } from "rcompat/sync";
|
|
2
2
|
import { from } from "rcompat/object";
|
|
3
|
+
import { File } from "rcompat/fs";
|
|
3
4
|
import { default as fs, doubled } from "./common.js";
|
|
4
5
|
import * as get from "./routes/exports.js";
|
|
5
6
|
import errors from "../errors.js";
|
|
6
7
|
|
|
8
|
+
const { separator } = File;
|
|
9
|
+
|
|
7
10
|
const make = path => {
|
|
8
|
-
const double = doubled(path.split(
|
|
11
|
+
const double = doubled(path.split(separator)
|
|
9
12
|
.filter(part => part.startsWith("{") && part.endsWith("}"))
|
|
10
13
|
.map(part => part.slice(1, part.indexOf("="))));
|
|
11
14
|
double && errors.DoublePathParameter.throw(double, path);
|
|
@@ -17,7 +20,8 @@ const make = path => {
|
|
|
17
20
|
return `(?<${param}>[^/]{1,}?)`;
|
|
18
21
|
}).orelse(_ => errors.InvalidPathParameter.throw(named, path)));
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
// normalize to unix
|
|
24
|
+
return new RegExp(`^/${route.replaceAll(separator, "/")}$`, "u");
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export default async (app, load = fs) => {
|
|
@@ -38,7 +42,7 @@ export default async (app, load = fs) => {
|
|
|
38
42
|
return Object.entries(route).map(([method, handler]) => ({
|
|
39
43
|
method,
|
|
40
44
|
handler,
|
|
41
|
-
pathname: make(path.endsWith(
|
|
45
|
+
pathname: make(path.endsWith(separator) ? path.slice(0, -1) : path),
|
|
42
46
|
guards: routes.guards.filter(filtered).map(([, guard]) => guard.default),
|
|
43
47
|
errors: routes.errors.filter(filtered).map(([, error]) => error.default),
|
|
44
48
|
layouts: routes.layouts.filter(filtered).map(([, layout]) => layout),
|