@weborigami/origami 0.3.4-jse.8 → 0.4.0
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/builtinsProgram.js +19 -13
- package/src/cli/getConfig.js +1 -0
- package/src/dev/dev.js +2 -0
- package/src/dev/{explore.js.inline → explore.inline.js} +5 -1
- package/src/dev/explore.ori +1 -1
- package/src/handlers/ori.handler.js +1 -1
- package/src/protocols/files.js +1 -1
- package/src/protocols/js.js +3 -0
- package/src/protocols/scope.js +2 -0
- package/src/text/inline.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/origami",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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.
|
|
20
|
+
"@weborigami/async-tree": "0.4.0",
|
|
21
21
|
"@weborigami/json-feed-to-rss": "1.0.0",
|
|
22
|
-
"@weborigami/language": "0.
|
|
23
|
-
"@weborigami/types": "0.
|
|
22
|
+
"@weborigami/language": "0.4.0",
|
|
23
|
+
"@weborigami/types": "0.4.0",
|
|
24
24
|
"css-tree": "3.1.0",
|
|
25
25
|
"exif-parser": "0.1.12",
|
|
26
26
|
"graphviz-wasm": "3.0.2",
|
package/src/builtinsProgram.js
CHANGED
|
@@ -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 =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
key === "indent" ?
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
});
|
package/src/cli/getConfig.js
CHANGED
package/src/dev/dev.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default as yaml } from "../origami/yaml.js";
|
|
2
|
+
export { default as indexPage } from "../site/indexPage.js";
|
|
1
3
|
export { default as clear } from "../tree/clear.js";
|
|
2
4
|
export { default as keys } from "../tree/keys.js";
|
|
3
5
|
export { default as breakpoint } from "./breakpoint.js";
|
|
@@ -38,7 +38,11 @@ function removeDocumentPath(path) {
|
|
|
38
38
|
function selectMode(newMode) {
|
|
39
39
|
const currentMode = getModeFromLocation();
|
|
40
40
|
if (newMode !== currentMode) {
|
|
41
|
-
|
|
41
|
+
const location = frame.contentDocument.location;
|
|
42
|
+
let newPath =
|
|
43
|
+
location.href === "about:blank"
|
|
44
|
+
? ""
|
|
45
|
+
: removeDocumentPath(location.pathname);
|
|
42
46
|
const currentExtension = modes[currentMode];
|
|
43
47
|
if (currentExtension && newPath.endsWith(currentExtension)) {
|
|
44
48
|
// Remove the current extension.
|
package/src/dev/explore.ori
CHANGED
package/src/protocols/files.js
CHANGED
|
@@ -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
|
}
|
package/src/protocols/js.js
CHANGED
|
@@ -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(
|
package/src/protocols/scope.js
CHANGED
|
@@ -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 {
|
package/src/text/inline.js
CHANGED
|
@@ -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");
|