@primate/core 0.1.6 → 0.1.7
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": "@primate/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Primate core",
|
|
5
5
|
"homepage": "https://primatejs.com",
|
|
6
6
|
"bugs": "https://github.com/primatejs/primate/issues",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"@rcompat/build": "^0.4.0",
|
|
22
22
|
"@rcompat/cli": "^0.5.1",
|
|
23
23
|
"@rcompat/crypto": "^0.5.0",
|
|
24
|
-
"@rcompat/fs": "^0.5.
|
|
24
|
+
"@rcompat/fs": "^0.5.1",
|
|
25
25
|
"@rcompat/function": "^0.4.0",
|
|
26
26
|
"@rcompat/http": "^0.5.3",
|
|
27
27
|
"@rcompat/invariant": "^0.5.0",
|
|
28
28
|
"@rcompat/object": "^0.5.0",
|
|
29
29
|
"@rcompat/package": "^0.7.0",
|
|
30
|
-
"@rcompat/
|
|
30
|
+
"@rcompat/runtime": "^0.1.0",
|
|
31
31
|
"@rcompat/stdio": "^0.5.0",
|
|
32
32
|
"@rcompat/sync": "^0.3.0"
|
|
33
33
|
},
|
package/src/build/hook/build.js
CHANGED
|
@@ -38,7 +38,7 @@ const pre = async (app, mode, target) => {
|
|
|
38
38
|
await app.path.build.remove();
|
|
39
39
|
await app.path.build.create();
|
|
40
40
|
|
|
41
|
-
await Promise.all(["server", "client", "
|
|
41
|
+
await Promise.all(["server", "client", "components"]
|
|
42
42
|
.map(directory => app.runpath(directory).create()));
|
|
43
43
|
|
|
44
44
|
const router = await $router(app.path.routes);
|
|
@@ -50,14 +50,15 @@ const pre = async (app, mode, target) => {
|
|
|
50
50
|
|
|
51
51
|
const js_re = /^.*.js$/u;
|
|
52
52
|
const write_directories = async (build_directory, app) => {
|
|
53
|
+
const location = app.get("location");
|
|
53
54
|
for (const name of app.server_build) {
|
|
54
|
-
const d = app.runpath(name);
|
|
55
|
+
const d = app.runpath(location.server, name);
|
|
55
56
|
const e = await Promise.all((await collect(d, js_re, { recursive: true }))
|
|
56
57
|
.map(async path => `${path}`.replace(d, _ => "")));
|
|
57
58
|
const files_js = `
|
|
58
59
|
const ${name} = [];
|
|
59
60
|
${e.map((path, i) =>
|
|
60
|
-
`import * as ${name}${i} from "${webpath(
|
|
61
|
+
`import * as ${name}${i} from "${webpath(`../server/${name}${path}`)}";
|
|
61
62
|
${name}.push(["${webpath(path.slice(1, -".js".length))}", ${name}${i}]);`,
|
|
62
63
|
).join("\n")}
|
|
63
64
|
export default ${name};`;
|
|
@@ -113,10 +114,10 @@ const post = async (app, mode, target) => {
|
|
|
113
114
|
const defaults = join(import.meta.dirname, "../defaults");
|
|
114
115
|
|
|
115
116
|
// stage routes
|
|
116
|
-
await app.stage(app.path.routes, location.routes);
|
|
117
|
+
await app.stage(app.path.routes, join(location.server, location.routes));
|
|
117
118
|
|
|
118
119
|
// stage types
|
|
119
|
-
await app.stage(app.path.types, location.types);
|
|
120
|
+
await app.stage(app.path.types, join(location.server, location.types));
|
|
120
121
|
|
|
121
122
|
// stage components, transforming defines
|
|
122
123
|
await app.stage(app.path.components, location.components, true);
|
|
@@ -127,9 +128,9 @@ const post = async (app, mode, target) => {
|
|
|
127
128
|
?.(directory, path.debase(`${directory}/`));
|
|
128
129
|
}
|
|
129
130
|
// copy framework pages
|
|
130
|
-
await app.stage(defaults, location.pages);
|
|
131
|
+
await app.stage(defaults, join(location.server, location.pages));
|
|
131
132
|
// overwrite transformed pages to build
|
|
132
|
-
await app.stage(app.path.pages, location.pages);
|
|
133
|
+
await app.stage(app.path.pages, join(location.server, location.pages));
|
|
133
134
|
|
|
134
135
|
// copy static files to build/server/static
|
|
135
136
|
await app.stage(app.path.static, join(location.server, location.static));
|
package/src/build/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import tryreturn from "@rcompat/async/tryreturn";
|
|
|
7
7
|
import empty from "@rcompat/object/empty";
|
|
8
8
|
import override from "@rcompat/object/override";
|
|
9
9
|
import root from "@rcompat/package/root";
|
|
10
|
-
import
|
|
10
|
+
import runtime from "@rcompat/runtime";
|
|
11
11
|
import app from "./app.js";
|
|
12
12
|
import { build, init } from "./hook/exports.js";
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ const get_config = async project_root => {
|
|
|
25
25
|
return imported;
|
|
26
26
|
} catch (error) {
|
|
27
27
|
if (error.level === undefined) {
|
|
28
|
-
error_in_config_file(error.message, `${
|
|
28
|
+
error_in_config_file(error.message, `${runtime} ${local_config}`);
|
|
29
29
|
} else {
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
package/src/build/targets/web.js
CHANGED
|
@@ -20,12 +20,12 @@ export default async app => {
|
|
|
20
20
|
type,
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
|
-
const d = app.runpath(location.pages);
|
|
23
|
+
const d = app.runpath(location.server, location.pages);
|
|
24
24
|
const pages = await Promise.all((await collect(d, html, { recursive: true }))
|
|
25
25
|
.map(async file => `${file.debase(d)}`.slice(1)));
|
|
26
26
|
const pages_str = pages.map(page =>
|
|
27
27
|
`"${page}": await load_text(import.meta.url,
|
|
28
|
-
"${webpath(`../${location.pages}/${page}`)}"),`).join("\n");
|
|
28
|
+
"${webpath(`../${location.server}/${location.pages}/${page}`)}"),`).join("\n");
|
|
29
29
|
|
|
30
30
|
const assets_scripts = `
|
|
31
31
|
import loader from "primate/loader";
|