@weborigami/origami 0.0.72 → 0.0.73
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 +4 -4
- package/src/builtins/@ori.js +4 -2
- package/src/builtins/@project.js +13 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/origami",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
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.6.2"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@weborigami/async-tree": "0.0.
|
|
21
|
-
"@weborigami/language": "0.0.
|
|
22
|
-
"@weborigami/types": "0.0.
|
|
20
|
+
"@weborigami/async-tree": "0.0.73",
|
|
21
|
+
"@weborigami/language": "0.0.73",
|
|
22
|
+
"@weborigami/types": "0.0.73",
|
|
23
23
|
"exif-parser": "0.1.12",
|
|
24
24
|
"graphviz-wasm": "3.0.2",
|
|
25
25
|
"highlight.js": "11.10.0",
|
package/src/builtins/@ori.js
CHANGED
|
@@ -31,8 +31,10 @@ export default async function ori(
|
|
|
31
31
|
// Run in the context of `this` if defined, otherwise use the builtins.
|
|
32
32
|
const tree = this ?? builtins;
|
|
33
33
|
|
|
34
|
-
//
|
|
35
|
-
|
|
34
|
+
// Compile the expression. Avoid caching scope references so that, e.g.,
|
|
35
|
+
// passing a function to the `watch` builtin will always look the current
|
|
36
|
+
// value of things in scope.
|
|
37
|
+
const fn = compile.expression(expression, { scopeCaching: false });
|
|
36
38
|
|
|
37
39
|
// Execute
|
|
38
40
|
let result = await fn.call(tree);
|
package/src/builtins/@project.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @typedef {import("@weborigami/types").AsyncTree} AsyncTree */
|
|
2
|
-
import {
|
|
2
|
+
import { Tree } from "@weborigami/async-tree";
|
|
3
3
|
import { OrigamiFiles } from "@weborigami/language";
|
|
4
4
|
import assertTreeIsDefined from "../misc/assertTreeIsDefined.js";
|
|
5
5
|
import builtins from "./@builtins.js";
|
|
@@ -47,20 +47,26 @@ export default async function project(key) {
|
|
|
47
47
|
projectRoot = configContainer;
|
|
48
48
|
} else {
|
|
49
49
|
// Load Origami configuration file
|
|
50
|
-
const
|
|
50
|
+
const config = await fileTypeOrigami.unpack(buffer, {
|
|
51
51
|
key: configFileName,
|
|
52
52
|
parent: configContainer,
|
|
53
53
|
});
|
|
54
|
-
if (!
|
|
54
|
+
if (!config) {
|
|
55
55
|
const configPath = /** @type {any} */ (configContainer).path;
|
|
56
56
|
throw new Error(
|
|
57
57
|
`Couldn't load the Origami configuration in ${configPath}/${configFileName}`
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
projectRoot
|
|
60
|
+
|
|
61
|
+
// The config tree may refer to the container tree *and vice versa*. To
|
|
62
|
+
// support this, we put the container in the tree twice. The chain will
|
|
63
|
+
// be: projectRoot -> configTree -> configContainer -> builtins, where
|
|
64
|
+
// the projectRoot and configContainer are the same folder.
|
|
65
|
+
const configTree = Tree.from(config);
|
|
66
|
+
projectRoot = new OrigamiFiles(configContainer.path);
|
|
67
|
+
projectRoot.parent = configTree;
|
|
68
|
+
configTree.parent = configContainer;
|
|
69
|
+
configContainer.parent = builtins;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
|