primate 0.22.0 → 0.22.1
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/hooks/handle.js +3 -3
- package/src/hooks/publish.js +2 -2
package/package.json
CHANGED
package/src/hooks/handle.js
CHANGED
|
@@ -9,7 +9,7 @@ const {NoFileForPath} = _errors;
|
|
|
9
9
|
const guardError = Symbol("guardError");
|
|
10
10
|
|
|
11
11
|
export default app => {
|
|
12
|
-
const {config: {http: {static: {root}}
|
|
12
|
+
const {config: {http: {static: {root}}, location}} = app;
|
|
13
13
|
|
|
14
14
|
const as_route = async request => {
|
|
15
15
|
const {pathname} = request.url;
|
|
@@ -64,13 +64,13 @@ export default app => {
|
|
|
64
64
|
},
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
const client = app.runpath(
|
|
67
|
+
const client = app.runpath(location.client);
|
|
68
68
|
const handle = async request => {
|
|
69
69
|
const {pathname} = request.url;
|
|
70
70
|
if (pathname.startsWith(root)) {
|
|
71
71
|
const debased = pathname.replace(root, _ => "");
|
|
72
72
|
// try static first
|
|
73
|
-
const asset =
|
|
73
|
+
const asset = client.join(location.static, debased);
|
|
74
74
|
if (await asset.isFile) {
|
|
75
75
|
return as_asset(asset.file);
|
|
76
76
|
}
|
package/src/hooks/publish.js
CHANGED
|
@@ -33,7 +33,7 @@ const post = async app => {
|
|
|
33
33
|
|
|
34
34
|
if (await path.static.exists) {
|
|
35
35
|
// copy static files to build/static
|
|
36
|
-
await app.stage(path.static, location.static);
|
|
36
|
+
await app.stage(path.static, new Path(location.client, location.static));
|
|
37
37
|
|
|
38
38
|
// publish JavaScript and CSS files
|
|
39
39
|
const imports = await Path.collect(path.static, /\.(?:js|css)$/u);
|
|
@@ -44,7 +44,7 @@ const post = async app => {
|
|
|
44
44
|
// already copied in `app.stage`
|
|
45
45
|
await app.publish({src, code, type, copy: false});
|
|
46
46
|
type === "style" && app.export({type,
|
|
47
|
-
code: `import "../${location.static}${src}";`});
|
|
47
|
+
code: `import "../${location.client}/${location.static}${src}";`});
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
50
|
|