@weborigami/origami 0.0.36 → 0.0.38

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.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "Web Origami language, CLI, framework, and server",
5
5
  "type": "module",
6
6
  "repository": {
@@ -19,9 +19,9 @@
19
19
  "typescript": "5.2.2"
20
20
  },
21
21
  "dependencies": {
22
- "@weborigami/async-tree": "https://gitpkg.now.sh/WebOrigami/origami/async-tree?main",
23
- "@weborigami/language": "https://gitpkg.now.sh/WebOrigami/origami/language?main",
24
- "@weborigami/types": "0.0.36",
22
+ "@weborigami/async-tree": "*",
23
+ "@weborigami/language": "*",
24
+ "@weborigami/types": "0.0.38",
25
25
  "graphviz-wasm": "3.0.1",
26
26
  "highlight.js": "11.9.0",
27
27
  "marked": "9.1.5",
@@ -50,13 +50,8 @@ function DebugTransform(Base) {
50
50
 
51
51
  // Ensure debug transforms are applied to explorable results.
52
52
  if (Tree.isAsyncTree(value)) {
53
- if (!isTransformApplied(ExplorableSiteTransform, value)) {
54
- value = transformObject(ExplorableSiteTransform, value);
55
- }
56
-
57
- if (!isTransformApplied(DebugTransform, value)) {
58
- value = transformObject(DebugTransform, value);
59
- }
53
+ value = transformObject(ExplorableSiteTransform, value);
54
+ value = transformObject(DebugTransform, value);
60
55
  }
61
56
 
62
57
  if (value?.unpack) {
@@ -70,12 +65,8 @@ function DebugTransform(Base) {
70
65
  }
71
66
  /** @type {any} */
72
67
  let tree = Tree.from(content);
73
- if (!isTransformApplied(ExplorableSiteTransform, tree)) {
74
- tree = transformObject(ExplorableSiteTransform, tree);
75
- }
76
- if (!isTransformApplied(DebugTransform, tree)) {
77
- tree = transformObject(DebugTransform, tree);
78
- }
68
+ tree = transformObject(ExplorableSiteTransform, tree);
69
+ tree = transformObject(DebugTransform, tree);
79
70
  return tree;
80
71
  };
81
72
  }
@@ -14,6 +14,9 @@ export default async function json(obj) {
14
14
  if (obj === undefined) {
15
15
  return undefined;
16
16
  }
17
+ if (typeof obj.unpack === "function") {
18
+ obj = await obj.unpack();
19
+ }
17
20
  const value = await serialize.toJsonValue(obj);
18
21
  return JSON.stringify(value, null, 2);
19
22
  }
@@ -15,6 +15,9 @@ export default async function toYaml(obj) {
15
15
  if (obj === undefined) {
16
16
  return undefined;
17
17
  }
18
+ if (typeof obj.unpack === "function") {
19
+ obj = await obj.unpack();
20
+ }
18
21
  const value = await serialize.toJsonValue(obj);
19
22
  return YAML.stringify(value);
20
23
  }
@@ -1,7 +1,7 @@
1
1
  import { Tree, keysJson } from "@weborigami/async-tree";
2
2
  import { Scope } from "@weborigami/language";
3
3
  import index from "../builtins/@index.js";
4
- import { isTransformApplied, transformObject } from "../common/utilities.js";
4
+ import { transformObject } from "../common/utilities.js";
5
5
 
6
6
  /**
7
7
  * Wraps a tree (typically a SiteTree) to turn a standard site into an
@@ -47,10 +47,7 @@ export default function ExplorableSiteTransform(Base) {
47
47
  // Ensure this transform is applied to any explorable result. This lets
48
48
  // the user browse into data and explorable trees of types other than the
49
49
  // current class.
50
- if (
51
- Tree.isAsyncTree(value) &&
52
- !isTransformApplied(ExplorableSiteTransform, value)
53
- ) {
50
+ if (Tree.isAsyncTree(value)) {
54
51
  value = transformObject(ExplorableSiteTransform, value);
55
52
  }
56
53
 
@@ -65,9 +62,7 @@ export default function ExplorableSiteTransform(Base) {
65
62
  }
66
63
  /** @type {any} */
67
64
  let tree = Tree.from(content);
68
- if (!isTransformApplied(ExplorableSiteTransform, tree)) {
69
- tree = transformObject(ExplorableSiteTransform, tree);
70
- }
65
+ tree = transformObject(ExplorableSiteTransform, tree);
71
66
  return tree;
72
67
  };
73
68
  }
@@ -2,11 +2,7 @@
2
2
  import { ObjectTree, Tree } from "@weborigami/async-tree";
3
3
  import { Scope } from "@weborigami/language";
4
4
  import ori from "../builtins/@ori.js";
5
- import {
6
- isTransformApplied,
7
- keySymbol,
8
- transformObject,
9
- } from "../common/utilities.js";
5
+ import { keySymbol, transformObject } from "../common/utilities.js";
10
6
 
11
7
  /**
12
8
  * Add support for commands prefixed with `!`.
@@ -40,10 +36,7 @@ export default function OriCommandTransform(Base) {
40
36
  value = await ori.call(extendedScope, source);
41
37
 
42
38
  // Ensure this transform is applied to any subtree.
43
- if (
44
- Tree.isAsyncTree(value) &&
45
- !isTransformApplied(OriCommandTransform, value)
46
- ) {
39
+ if (Tree.isAsyncTree(value)) {
47
40
  value = transformObject(OriCommandTransform, value);
48
41
  }
49
42
  }