@weborigami/origami 0.6.12 → 0.6.13
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 +3 -3
- package/src/dev/crawler/audit.js +23 -3
- package/src/dev/help.yaml +9 -3
- package/src/origami/yaml.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/origami",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "Web Origami language, CLI, framework, and server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@hpcc-js/wasm-graphviz": "^1.21.0",
|
|
21
|
-
"@weborigami/async-tree": "0.6.
|
|
21
|
+
"@weborigami/async-tree": "0.6.13",
|
|
22
22
|
"@weborigami/json-feed-to-rss": "1.0.1",
|
|
23
|
-
"@weborigami/language": "0.6.
|
|
23
|
+
"@weborigami/language": "0.6.13",
|
|
24
24
|
"css-tree": "3.1.0",
|
|
25
25
|
"highlight.js": "11.11.1",
|
|
26
26
|
"jsdom": "28.1.0",
|
package/src/dev/crawler/audit.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { pathFromKeys, symbols, Tree } from "@weborigami/async-tree";
|
|
2
|
+
import * as YAMLModule from "yaml";
|
|
2
3
|
import crawlResources from "./crawlResources.js";
|
|
3
4
|
import getSiteArgument from "./getSiteArgument.js";
|
|
4
5
|
import { getBaseUrl } from "./utilities.js";
|
|
5
6
|
|
|
7
|
+
// The "yaml" package doesn't seem to provide a default export that the browser can
|
|
8
|
+
// recognize, so we have to handle two ways to accommodate Node and the browser.
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const YAML = YAMLModule.default ?? YAMLModule.YAML;
|
|
11
|
+
|
|
6
12
|
/**
|
|
7
13
|
* Crawl the indicated tree and return an audit of any broken links to internal
|
|
8
14
|
* pages or other resources.
|
|
@@ -43,10 +49,10 @@ export default async function audit(maplike, baseHref) {
|
|
|
43
49
|
// Start request, don't wait for it to complete yet
|
|
44
50
|
resourcePromises[resourcePath] ??= Tree.traversePath(
|
|
45
51
|
tree,
|
|
46
|
-
resourcePath
|
|
52
|
+
resourcePath,
|
|
47
53
|
).then(
|
|
48
54
|
// Just return true or false to indicate if value is defined
|
|
49
|
-
(value) => value !== undefined
|
|
55
|
+
(value) => value !== undefined,
|
|
50
56
|
);
|
|
51
57
|
}
|
|
52
58
|
}
|
|
@@ -54,7 +60,7 @@ export default async function audit(maplike, baseHref) {
|
|
|
54
60
|
|
|
55
61
|
// Add any references to missing resources to the errors
|
|
56
62
|
for (const [refererPath, resourcePaths] of Object.entries(
|
|
57
|
-
resourceReferences
|
|
63
|
+
resourceReferences,
|
|
58
64
|
)) {
|
|
59
65
|
for (const resourcePath of resourcePaths) {
|
|
60
66
|
const found = await resourcePromises[resourcePath];
|
|
@@ -76,5 +82,19 @@ export default async function audit(maplike, baseHref) {
|
|
|
76
82
|
value: true,
|
|
77
83
|
});
|
|
78
84
|
|
|
85
|
+
// Attach a string method to include an explanatory comment. This will be used
|
|
86
|
+
// if the result is rendered in the console.
|
|
87
|
+
Object.defineProperty(errors, "toString", {
|
|
88
|
+
enumerable: false,
|
|
89
|
+
value: () => {
|
|
90
|
+
const yamlText = YAML.stringify(errors);
|
|
91
|
+
const message = `
|
|
92
|
+
# Pages with broken internal links, with the missing destinations indented:
|
|
93
|
+
|
|
94
|
+
`;
|
|
95
|
+
return `${message}${yamlText}`;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
79
99
|
return errors;
|
|
80
100
|
}
|
package/src/dev/help.yaml
CHANGED
|
@@ -45,9 +45,6 @@ Dev:
|
|
|
45
45
|
version:
|
|
46
46
|
args: ()
|
|
47
47
|
description: Return the version number of the Origami language
|
|
48
|
-
visit:
|
|
49
|
-
args: (tree)
|
|
50
|
-
description: Force reading of all values from the tree
|
|
51
48
|
watch:
|
|
52
49
|
args: (tree, fn)
|
|
53
50
|
description: Reevaluate fn when tree changes
|
|
@@ -190,6 +187,9 @@ Tree:
|
|
|
190
187
|
clear:
|
|
191
188
|
args: (map)
|
|
192
189
|
description: Remove all values from the map
|
|
190
|
+
concat:
|
|
191
|
+
args: (...trees)
|
|
192
|
+
description: Merge trees, renumbering numeric keys
|
|
193
193
|
constant:
|
|
194
194
|
args: (value)
|
|
195
195
|
description: Return a deep tree with a single constant value
|
|
@@ -223,6 +223,9 @@ Tree:
|
|
|
223
223
|
first:
|
|
224
224
|
args: (map)
|
|
225
225
|
description: The first value in the map
|
|
226
|
+
flat:
|
|
227
|
+
args: (tree, [depth])
|
|
228
|
+
description: Flatten the tree to the indicated depth
|
|
226
229
|
forEach:
|
|
227
230
|
args: (map, fn)
|
|
228
231
|
description: Apply fn to each (value, key)
|
|
@@ -343,6 +346,9 @@ Tree:
|
|
|
343
346
|
values:
|
|
344
347
|
args: (map)
|
|
345
348
|
description: The map's values
|
|
349
|
+
visit:
|
|
350
|
+
args: (tree)
|
|
351
|
+
description: Force reading of all values from the tree
|
|
346
352
|
withKeys:
|
|
347
353
|
args: (map, keys)
|
|
348
354
|
description: Use the given keys for the map
|
package/src/origami/yaml.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isUnpackable
|
|
2
|
-
import
|
|
1
|
+
import { isUnpackable } from "@weborigami/async-tree";
|
|
2
|
+
import { toYaml } from "../common/serialize.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Render the object as text in YAML format.
|
|
@@ -13,6 +13,5 @@ export default async function yamlBuiltin(obj) {
|
|
|
13
13
|
if (isUnpackable(obj)) {
|
|
14
14
|
obj = await obj.unpack();
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return YAML.stringify(value);
|
|
16
|
+
return toYaml(obj);
|
|
18
17
|
}
|