primate 0.26.2 → 0.26.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 +2 -2
- package/src/app.js +6 -4
- package/src/handlers/view.js +1 -1
- package/src/hooks/register.js +1 -4
- package/src/hooks/stage.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primate",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"description": "Expressive, minimal and extensible web framework",
|
|
5
5
|
"homepage": "https://primatejs.com",
|
|
6
6
|
"bugs": "https://github.com/primatejs/primate/issues",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"directory": "packages/primate"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"rcompat": "^0.
|
|
21
|
+
"rcompat": "^0.4.1"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=18"
|
package/src/app.js
CHANGED
|
@@ -104,11 +104,13 @@ export default async (log, root, config) => {
|
|
|
104
104
|
if (compile === undefined) {
|
|
105
105
|
const debased = `${component.path}`.replace(source, "");
|
|
106
106
|
|
|
107
|
-
const server_target = this.runpath(server, components);
|
|
108
|
-
await
|
|
107
|
+
const server_target = this.runpath(server, components, debased);
|
|
108
|
+
await server_target.directory.create();
|
|
109
|
+
await component.copy(server_target);
|
|
109
110
|
|
|
110
|
-
const client_target = this.runpath(client, components);
|
|
111
|
-
await
|
|
111
|
+
const client_target = this.runpath(client, components, debased);
|
|
112
|
+
await client_target.directory.create();
|
|
113
|
+
await component.copy(client_target);
|
|
112
114
|
} else {
|
|
113
115
|
// compile server components
|
|
114
116
|
await compile.server(component);
|
package/src/handlers/view.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import errors from "../errors.js";
|
|
2
2
|
|
|
3
3
|
export default (name, props, options) => async (app, ...rest) => {
|
|
4
|
-
const extension = name.slice(name.lastIndexOf(".")
|
|
4
|
+
const extension = name.slice(name.lastIndexOf("."));
|
|
5
5
|
return app.handlers[extension]?.(name, props, options)(app, ...rest)
|
|
6
6
|
?? errors.NoHandlerForExtension.throw(extension, name);
|
|
7
7
|
};
|
package/src/hooks/register.js
CHANGED
|
@@ -9,9 +9,6 @@ const defaults = cwd(import.meta, 2).join("defaults");
|
|
|
9
9
|
const pre = async app => {
|
|
10
10
|
const { config: { location: { pages, client, components } }, path } = app;
|
|
11
11
|
|
|
12
|
-
await Promise.all(["server", "client", "pages"]
|
|
13
|
-
.map(directory => app.runpath(directory).create()));
|
|
14
|
-
|
|
15
12
|
// copy framework pages
|
|
16
13
|
await app.stage(defaults, pages, html);
|
|
17
14
|
// overwrite transformed pages to build
|
|
@@ -42,7 +39,7 @@ const post = async app => {
|
|
|
42
39
|
await Promise.all(imports.map(async file => {
|
|
43
40
|
const code = await file.text();
|
|
44
41
|
const src = file.debase(path.static);
|
|
45
|
-
const type = file.extension === "css" ? "style" : "module";
|
|
42
|
+
const type = file.extension === ".css" ? "style" : "module";
|
|
46
43
|
// already copied in `app.stage`
|
|
47
44
|
await app.publish({ src, code, type, copy: false });
|
|
48
45
|
type === "style" && app.export({ type,
|
package/src/hooks/stage.js
CHANGED
|
@@ -7,6 +7,9 @@ import errors from "../errors.js";
|
|
|
7
7
|
const pre = async app => {
|
|
8
8
|
// remove build directory in case exists
|
|
9
9
|
await app.path.build.remove();
|
|
10
|
+
await app.path.build.create();
|
|
11
|
+
await Promise.all(["server", "client", "pages", "components"]
|
|
12
|
+
.map(directory => app.runpath(directory).create()));
|
|
10
13
|
|
|
11
14
|
return { ...app };
|
|
12
15
|
};
|
|
@@ -18,7 +21,7 @@ const post = async app => {
|
|
|
18
21
|
await app.runpath(location.routes).create();
|
|
19
22
|
const double = doubled((await app.path.routes.collect())
|
|
20
23
|
.map(path => path.debase(app.path.routes))
|
|
21
|
-
.map(path => `${path}`.slice(1, -path.extension.length
|
|
24
|
+
.map(path => `${path}`.slice(1, -path.extension.length)));
|
|
22
25
|
double && errors.DoubleRoute.throw(double);
|
|
23
26
|
|
|
24
27
|
await app.stage(app.path.routes, location.routes);
|