primate 0.32.1 → 0.32.3
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 +6 -6
- package/src/public/load-text.js +3 -0
- package/src/public/loader.js +26 -0
- package/src/public/serve-asset.js +9 -0
- package/src/public/serve.js +1 -0
- package/src/runtime/file.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primate",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.3",
|
|
4
4
|
"description": "Polymorphic development platform",
|
|
5
5
|
"homepage": "https://primatejs.com",
|
|
6
6
|
"bugs": "https://github.com/primatejs/primate/issues",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@rcompat/args": "^0.3.0",
|
|
21
21
|
"@rcompat/async": "^0.3.0",
|
|
22
22
|
"@rcompat/cli": "^0.5.1",
|
|
23
|
-
"@rcompat/fs": "^0.
|
|
23
|
+
"@rcompat/fs": "^0.5.0",
|
|
24
24
|
"@rcompat/package": "^0.7.0",
|
|
25
|
-
"@primate/core": "^0.1.
|
|
25
|
+
"@primate/core": "^0.1.6"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=18"
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"type": "module",
|
|
31
31
|
"types": "./types/index.d.ts",
|
|
32
32
|
"exports": {
|
|
33
|
-
"./handler/*":
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"./handler/*": "./src/handlers/*.js",
|
|
34
|
+
"./*": "./src/public/*.js",
|
|
35
|
+
"./runtime/*": "./src/runtime/*.js"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import serve_asset from "primate/serve-asset";
|
|
2
|
+
import file from "@rcompat/fs/file";
|
|
3
|
+
|
|
4
|
+
export default ({
|
|
5
|
+
pages_app,
|
|
6
|
+
pages,
|
|
7
|
+
rootfile,
|
|
8
|
+
}) => {
|
|
9
|
+
const buildroot = file(rootfile).join("..");
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
page(name) {
|
|
13
|
+
return pages[name] ?? pages[pages_app];
|
|
14
|
+
},
|
|
15
|
+
async asset(pathname) {
|
|
16
|
+
const root_asset = buildroot.join(`client/${pathname}`);
|
|
17
|
+
if (await root_asset.isFile()) {
|
|
18
|
+
return serve_asset(root_asset);
|
|
19
|
+
}
|
|
20
|
+
const static_asset = buildroot.join(`client/static/${pathname}`);
|
|
21
|
+
if (await static_asset.isFile()) {
|
|
22
|
+
return serve_asset(static_asset);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@primate/core/serve";
|