@weborigami/origami 0.3.4-jse.8 → 0.3.4-jse.9

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.3.4-jse.8",
3
+ "version": "0.3.4-jse.9",
4
4
  "description": "Web Origami language, CLI, framework, and server",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,10 +17,10 @@
17
17
  "typescript": "5.8.2"
18
18
  },
19
19
  "dependencies": {
20
- "@weborigami/async-tree": "0.3.4-jse.8",
20
+ "@weborigami/async-tree": "0.3.4-jse.9",
21
21
  "@weborigami/json-feed-to-rss": "1.0.0",
22
- "@weborigami/language": "0.3.4-jse.8",
23
- "@weborigami/types": "0.3.4-jse.8",
22
+ "@weborigami/language": "0.3.4-jse.9",
23
+ "@weborigami/types": "0.3.4-jse.9",
24
24
  "css-tree": "3.1.0",
25
25
  "exif-parser": "0.1.12",
26
26
  "graphviz-wasm": "3.0.2",
@@ -51,19 +51,25 @@ export default function builtinsProgram() {
51
51
 
52
52
  function deprecateFunctions(fns, oldPrefix, newPrefix) {
53
53
  const wrappedEntries = Object.entries(fns).map(([key, value]) => {
54
- const wrappedFn = async function (...args) {
55
- const oldKey = key === "indent" ? key : `${oldPrefix}${key}()`;
56
- const newKey =
57
- key === "indent" ? `${newPrefix}${key}` : `${newPrefix}${key}()`;
58
- const result =
59
- value instanceof Function
60
- ? await value.apply(this, args)
61
- : await Tree.traverseOrThrow.call(this, value, ...args);
62
- return attachWarning(
63
- result,
64
- `${oldKey} is deprecated, use ${newKey} instead.`
65
- );
66
- };
54
+ const wrappedFn =
55
+ /** @this {import("@weborigami/types").AsyncTree} */
56
+ async function (...args) {
57
+ const oldKey = key === "indent" ? key : `${oldPrefix}${key}()`;
58
+ const newKey =
59
+ key === "indent"
60
+ ? `Tree.indent`
61
+ : key === "json"
62
+ ? `Tree.json`
63
+ : `${newPrefix}${key}()`;
64
+ const result =
65
+ value instanceof Function
66
+ ? await value.apply(this, args)
67
+ : await Tree.traverseOrThrow.call(this, value, ...args);
68
+ return attachWarning(
69
+ result,
70
+ `${oldKey} is deprecated, use ${newKey} instead.`
71
+ );
72
+ };
67
73
  Object.assign(wrappedFn, value);
68
74
  return [key, wrappedFn];
69
75
  });
@@ -5,6 +5,7 @@ export default function getConfig(tree) {
5
5
  if (!tree) {
6
6
  return null;
7
7
  }
8
+ /** @type {any} */
8
9
  const root = Tree.root(tree);
9
10
  return root.config;
10
11
  }
@@ -26,6 +26,6 @@ export default async function files(...keys) {
26
26
  const resolved = path.resolve(basePath, relativePath);
27
27
 
28
28
  const result = new OrigamiFiles(resolved);
29
- result.handlers = getHandlers(this);
29
+ /** @type {any} */ (result).handlers = getHandlers(this);
30
30
  return result;
31
31
  }
@@ -1,6 +1,9 @@
1
1
  import { Tree } from "@weborigami/async-tree";
2
2
  import { attachWarning, jsGlobals } from "@weborigami/language";
3
3
 
4
+ /**
5
+ * @this {import("@weborigami/types").AsyncTree}
6
+ */
4
7
  export default async function js(...keys) {
5
8
  const result = await Tree.traverseOrThrow.call(this, jsGlobals, ...keys);
6
9
  return attachWarning(
@@ -1,5 +1,6 @@
1
1
  import { Tree, scope as scopeFn } from "@weborigami/async-tree";
2
2
  import { attachWarning } from "@weborigami/language";
3
+ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
3
4
 
4
5
  /**
5
6
  * @typedef {import("@weborigami/types").AsyncTree} AsyncTree
@@ -8,6 +9,7 @@ import { attachWarning } from "@weborigami/language";
8
9
  * @param {string[]} keys
9
10
  */
10
11
  export default async function scope(...keys) {
12
+ assertTreeIsDefined(this, "scope");
11
13
  const key = keys.shift();
12
14
  let value;
13
15
  try {
@@ -11,7 +11,7 @@ import { jsedocumentHandler } from "../handlers/handlers.js";
11
11
  * @typedef {import("@weborigami/async-tree").StringLike} StringLike
12
12
  *
13
13
  * @this {AsyncTree|null}
14
- * @param {StringLike} input
14
+ * @param {StringLike & {_body?: StringLike}} input
15
15
  */
16
16
  export default async function inline(input) {
17
17
  assertTreeIsDefined(this, "inline");