primate 0.22.1 → 0.22.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primate",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
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
- "runtime-compat": "^0.25.7"
21
+ "runtime-compat": "^0.25.8"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=18.16"
package/src/app.js CHANGED
@@ -88,10 +88,11 @@ export default async (log, root, config) => {
88
88
  const target = this.runpath(directory);
89
89
 
90
90
  await Promise.all((await source.collect(filter)).map(async path => {
91
+ const debased = path.debase(this.root).path.slice(1);
91
92
  const filename = new Path(directory).join(path.debase(source));
92
93
  const to = await target.join(filename.debase(directory));
93
94
  await to.directory.file.create();
94
- if (regexs.some(regex => regex.test(filename))) {
95
+ if (regexs.some(regex => regex.test(debased))) {
95
96
  const contents = mapper(await path.text());
96
97
  await to.file.write(contents);
97
98
  } else {
@@ -1,5 +1,6 @@
1
1
  import {Path} from "runtime-compat/fs";
2
2
  import {cascade} from "runtime-compat/async";
3
+ import {stringify} from "runtime-compat/object";
3
4
  import copy_includes from "./copy_includes.js";
4
5
 
5
6
  const post = async app => {
@@ -17,34 +18,32 @@ const post = async app => {
17
18
  });
18
19
 
19
20
  if (await path.components.exists) {
20
- // copy .js files from components to build/client, since frontend
21
- // frameworks handle non-js files
21
+ // copy .js files from components to build/client/components, since
22
+ // frontend frameworks handle non-js files
22
23
  const to = Path.join(location.client, location.components);
23
24
  await app.stage(path.components, to, /^.*.js$/u);
24
25
  }
25
26
 
26
27
  const imports = {...app.importmaps, app: src.path};
27
- await app.publish({
28
- inline: true,
29
- code: JSON.stringify({imports}, null, 2),
30
- type: "importmap",
31
- });
28
+ const inline = true;
29
+ const type = "importmap";
30
+ await app.publish({inline, code: stringify({imports}), type});
32
31
  }
33
32
 
34
33
  if (await path.static.exists) {
35
- // copy static files to build/static
34
+ // copy static files to build/client/static
36
35
  await app.stage(path.static, new Path(location.client, location.static));
37
36
 
38
37
  // publish JavaScript and CSS files
39
38
  const imports = await Path.collect(path.static, /\.(?:js|css)$/u);
40
39
  await Promise.all(imports.map(async file => {
41
40
  const code = await file.text();
42
- const src = `/${file.name}`;
41
+ const src = file.debase(path.static);
43
42
  const type = file.extension === ".css" ? "style" : "module";
44
43
  // already copied in `app.stage`
45
44
  await app.publish({src, code, type, copy: false});
46
45
  type === "style" && app.export({type,
47
- code: `import "../${location.client}/${location.static}${src}";`});
46
+ code: `import "./${location.static}${src}";`});
48
47
  }));
49
48
  }
50
49