@weborigami/origami 0.7.0-beta.2 → 0.7.0-beta.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": "@weborigami/origami",
3
- "version": "0.7.0-beta.2",
3
+ "version": "0.7.0-beta.3",
4
4
  "description": "Web Origami language, CLI, framework, and server",
5
5
  "type": "module",
6
6
  "repository": {
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@hpcc-js/wasm-graphviz": "1.21.7",
21
- "@weborigami/async-tree": "0.7.0-beta.2",
21
+ "@weborigami/async-tree": "0.7.0-beta.3",
22
22
  "@weborigami/json-feed-to-rss": "1.0.1",
23
- "@weborigami/language": "0.7.0-beta.2",
23
+ "@weborigami/language": "0.7.0-beta.3",
24
24
  "css-tree": "3.2.1",
25
25
  "highlight.js": "11.11.1",
26
26
  "jsdom": "29.1.1",
@@ -68,9 +68,11 @@ export default function ExplorableSiteTransform(Base) {
68
68
  }
69
69
 
70
70
  // If this value is given to the server, the server will call this pack()
71
- // method. We respond with the index page.
71
+ // method. If the source defines pack(), we use that, otherwise we return
72
+ // undefined. The server will redirect to the URL with a trailing slash,
73
+ // which will call `get("index.html")` (above) to get the index page.
72
74
  async pack() {
73
- return this.get("index.html");
75
+ return super.pack ? await super.pack() : undefined;
74
76
  }
75
77
  };
76
78
  }
@@ -82,10 +82,11 @@ export default function debugTransform(input) {
82
82
  },
83
83
 
84
84
  // If this value is given to the server, the server will call this pack()
85
- // method. We respond with the index page.
85
+ // method. If the source defines pack(), we use that, otherwise we return
86
+ // undefined. The server will redirect to the URL with a trailing slash,
87
+ // which will call `get("index.html")` (above) to get the index page.
86
88
  async pack() {
87
- // @ts-ignore
88
- return source.pack?.() ?? this.get("index.html");
89
+ return /** @type {any} */ (source)?.pack?.();
89
90
  },
90
91
 
91
92
  // @ts-ignore
package/src/dev/dev.js CHANGED
@@ -19,5 +19,6 @@ export { default as serve } from "./serve.js";
19
19
  export { default as stdin } from "./stdin.js";
20
20
  export { default as svg } from "./svg.js";
21
21
  export { default as syscache } from "./syscache.js";
22
+ export { default as syscount } from "./syscount.js";
22
23
  export { default as version } from "./version.js";
23
24
  export { default as watch } from "./watch.js";
@@ -15,9 +15,11 @@ export default function syscache() {
15
15
  const result = {};
16
16
  if (entry.downstreams) {
17
17
  result.downstreams = preferRelativePaths(projectRoot, entry.downstreams);
18
+ result.downstreams.sort((a, b) => a.localeCompare(b));
18
19
  }
19
20
  if (entry.upstreams) {
20
21
  result.upstreams = preferRelativePaths(projectRoot, entry.upstreams);
22
+ result.upstreams.sort((a, b) => a.localeCompare(b));
21
23
  }
22
24
  return [preferRelativePath(projectRoot, path), result];
23
25
  });
@@ -0,0 +1,5 @@
1
+ import { counters } from "@weborigami/language";
2
+
3
+ export default function syscount() {
4
+ return counters;
5
+ }
@@ -22,12 +22,16 @@ export default async function constructResponse(request, resource) {
22
22
  const url = new URL(request?.url ?? "", `https://${request?.headers.host}`);
23
23
 
24
24
  if (!isPacked(resource) && typeof resource.pack === "function") {
25
- resource = await resource.pack();
26
- if (typeof resource === "function") {
27
- resource = await resource();
28
- }
29
- if (resource instanceof Response) {
30
- return resource;
25
+ let packed = await resource.pack();
26
+ if (packed) {
27
+ if (typeof packed === "function") {
28
+ packed = await packed();
29
+ }
30
+ if (packed instanceof Response) {
31
+ // Already a Response
32
+ return packed;
33
+ }
34
+ resource = packed;
31
35
  }
32
36
  }
33
37