@weborigami/origami 0.6.10 → 0.6.11

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.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "Web Origami language, CLI, framework, and server",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,9 +17,9 @@
17
17
  "typescript": "5.9.3"
18
18
  },
19
19
  "dependencies": {
20
- "@weborigami/async-tree": "0.6.10",
20
+ "@weborigami/async-tree": "0.6.11",
21
21
  "@weborigami/json-feed-to-rss": "1.0.1",
22
- "@weborigami/language": "0.6.10",
22
+ "@weborigami/language": "0.6.11",
23
23
  "css-tree": "3.1.0",
24
24
  "graphviz-wasm": "3.0.2",
25
25
  "highlight.js": "11.11.1",
@@ -1,4 +1,10 @@
1
- import { args, trailingSlash, Tree } from "@weborigami/async-tree";
1
+ import {
2
+ args,
3
+ isStringlike,
4
+ toString,
5
+ trailingSlash,
6
+ Tree,
7
+ } from "@weborigami/async-tree";
2
8
 
3
9
  /**
4
10
  * Given an old tree and a new tree, return a tree of changes indicated
@@ -44,9 +50,9 @@ export default async function changes(oldMaplike, newMaplike) {
44
50
  result ??= {};
45
51
  result[oldKey] = treeChanges;
46
52
  }
47
- } else if (oldValue?.toString && newValue?.toString) {
48
- const oldText = oldValue.toString();
49
- const newText = newValue.toString();
53
+ } else if (isStringlike(oldValue) && isStringlike(newValue)) {
54
+ const oldText = toString(oldValue);
55
+ const newText = toString(newValue);
50
56
  if (oldText !== newText) {
51
57
  result ??= {};
52
58
  result[oldKey] = "changed";
@@ -17,6 +17,6 @@ export default async function fetchBuiltin(resource, options, state) {
17
17
  const url = new URL(resource);
18
18
  const key = url.pathname;
19
19
 
20
- return handleExtension(value, key, state.container);
20
+ return handleExtension(value, key, state?.parent);
21
21
  }
22
22
  fetchBuiltin.needsState = true;
@@ -54,6 +54,14 @@ async function format(result) {
54
54
  return result;
55
55
  }
56
56
 
57
+ if (result instanceof Response) {
58
+ if (!result.ok) {
59
+ console.warn(`Response not OK: ${result.status} ${result.statusText}`);
60
+ return undefined;
61
+ }
62
+ return await result.arrayBuffer();
63
+ }
64
+
57
65
  /** @type {string|String|undefined} */
58
66
  let text;
59
67
 
@@ -1,10 +1,10 @@
1
1
  export { extension } from "@weborigami/async-tree";
2
2
  export { default as help } from "../dev/help.js"; // Alias
3
- export { default as document } from "./document.js";
4
- // export { default as htmlDom } from "./htmlDom.js";
5
3
  export { default as basename } from "./basename.js";
6
4
  export { default as csv } from "./csv.js";
5
+ export { default as document } from "./document.js";
7
6
  export { default as fetch } from "./fetch.js";
7
+ export { default as htmlDom } from "./htmlDom.js";
8
8
  export { default as htmlEscape } from "./htmlEscape.js";
9
9
  export { default as format } from "./image/format.js";
10
10
  export * as image from "./image/image.js";