@weborigami/origami 0.3.4-jse.7 → 0.3.4-jse.8
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/main.js +4 -1
- package/package.json +4 -4
- package/src/builtinsJse.js +15 -5
- package/src/builtinsProgram.js +81 -0
- package/src/builtinsShell.js +41 -30
- package/src/cli/cli.js +1 -1
- package/src/common/documentObject.js +14 -3
- package/src/common/utilities.js +1 -1
- package/src/{tree → dev}/copy.js +2 -2
- package/src/dev/dev.js +6 -0
- package/src/dev/explore.js +2 -2
- package/src/{help → dev}/help.js +5 -5
- package/src/{help → dev}/help.yaml +80 -170
- package/src/dev/serve.js +1 -1
- package/src/{origami → dev}/version.js +2 -2
- package/src/dev/watch.js +1 -1
- package/src/handlers/ori.handler.js +2 -2
- package/src/handlers/oridocument.handler.js +2 -2
- package/src/handlers/txt.handler.js +15 -3
- package/src/handlers/xhtml.handler.js +1 -1
- package/src/handlers/yml.handler.js +1 -1
- package/src/image/format.js +1 -1
- package/src/image/resize.js +1 -1
- package/src/origami/csv.js +1 -1
- package/src/origami/json.js +1 -1
- package/src/origami/once.js +1 -1
- package/src/origami/ori.js +1 -1
- package/src/origami/origami.js +1 -3
- package/src/origami/pack.js +1 -1
- package/src/origami/project.js +1 -1
- package/src/origami/regexMatch.js +7 -4
- package/src/origami/string.js +1 -1
- package/src/origami/unpack.js +1 -1
- package/src/origami/yaml.js +1 -1
- package/src/protocols/explore.js +1 -1
- package/src/protocols/files.js +1 -1
- package/src/protocols/http.js +1 -1
- package/src/protocols/https.js +1 -1
- package/src/protocols/httpstree.js +1 -1
- package/src/protocols/httptree.js +1 -1
- package/src/protocols/inherited.js +7 -2
- package/src/protocols/js.js +10 -0
- package/src/protocols/new.js +7 -2
- package/src/protocols/scope.js +6 -1
- package/src/site/rss.js +1 -1
- package/src/site/sitemap.js +1 -1
- package/src/text/document.js +1 -1
- package/src/text/inline.js +1 -1
- package/src/text/mdHtml.js +1 -1
- package/src/tree/cache.js +1 -1
- package/src/tree/concat.js +1 -1
- package/src/tree/deepMerge.js +1 -1
- package/src/tree/filter.js +1 -1
- package/src/tree/fromFn.js +1 -1
- package/src/tree/globKeys.js +1 -1
- package/src/tree/mask.js +1 -1
- package/src/tree/match.js +1 -1
- package/src/tree/merge.js +1 -1
- package/src/tree/regExpKeys.js +1 -1
- package/src/tree/tree.js +0 -1
- package/src/BuiltinsTree.js +0 -18
- /package/src/{origami → dev}/stdin.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Dev:
|
|
2
2
|
description: Develop and debug Origami projects
|
|
3
3
|
commands:
|
|
4
4
|
audit:
|
|
@@ -10,151 +10,78 @@ dev:
|
|
|
10
10
|
changes:
|
|
11
11
|
args: (old, new)
|
|
12
12
|
description: Return a tree of changes
|
|
13
|
+
clear:
|
|
14
|
+
args: (tree)
|
|
15
|
+
description: Remove all values from the tree (alias of Tree.clear)
|
|
13
16
|
crawl:
|
|
14
17
|
args: (tree, base)
|
|
15
18
|
description: A tree of a site's discoverable resources
|
|
19
|
+
copy:
|
|
20
|
+
args: (source, target)
|
|
21
|
+
description: Copy the source tree to the target
|
|
16
22
|
debug:
|
|
17
23
|
args: (tree)
|
|
18
24
|
description: Add debug features to the tree
|
|
19
25
|
explore:
|
|
20
26
|
args: ()
|
|
21
27
|
description: Explore the current scope [when run in browser]
|
|
28
|
+
help:
|
|
29
|
+
args: (namespace|command)
|
|
30
|
+
description: Get help on builtin namespaces and commands
|
|
31
|
+
keys:
|
|
32
|
+
args: (tree)
|
|
33
|
+
description: The keys of the tree (alias of Tree.keys)
|
|
22
34
|
log:
|
|
23
35
|
args: (a, message)
|
|
24
36
|
description: Log message to the console and return a
|
|
25
37
|
serve:
|
|
26
38
|
args: (tree, port)
|
|
27
39
|
description: Start a web server for the tree
|
|
40
|
+
stdin:
|
|
41
|
+
description: Returns the content of the standard input stream
|
|
28
42
|
svg:
|
|
29
43
|
args: (tree, options)
|
|
30
44
|
description: Render a tree visually in SVG format
|
|
45
|
+
version:
|
|
46
|
+
args: ()
|
|
47
|
+
description: Return the version number of the Origami language
|
|
31
48
|
watch:
|
|
32
49
|
args: (tree, fn)
|
|
33
50
|
description: Reevaluate fn when tree changes
|
|
34
51
|
|
|
35
|
-
|
|
36
|
-
description:
|
|
37
|
-
|
|
38
|
-
files:
|
|
39
|
-
description: URL protocol for file system folders and files
|
|
40
|
-
|
|
41
|
-
help:
|
|
42
|
-
description: Get help on builtin namespaces and commands
|
|
43
|
-
|
|
44
|
-
http:
|
|
45
|
-
description: URL protocol for web resources via HTTP
|
|
46
|
-
|
|
47
|
-
https:
|
|
48
|
-
description: URL protocol for web resources via HTTPS
|
|
49
|
-
|
|
50
|
-
httpstree:
|
|
51
|
-
description: URL protocol for a website tree via HTTPS
|
|
52
|
-
|
|
53
|
-
httptree:
|
|
54
|
-
description: URL protocol for a website tree via HTTP
|
|
55
|
-
|
|
56
|
-
image:
|
|
57
|
-
description: Format and resize images
|
|
58
|
-
commands:
|
|
59
|
-
format:
|
|
60
|
-
args: (image, format, options)
|
|
61
|
-
description: Return the image in a different format
|
|
62
|
-
resize:
|
|
63
|
-
args: (image, options)
|
|
64
|
-
description: Resize the image
|
|
65
|
-
|
|
66
|
-
inherited:
|
|
67
|
-
description: URL protocol to get an inherited value instead of a local one
|
|
68
|
-
|
|
69
|
-
js:
|
|
70
|
-
description: JavaScript classes and functions
|
|
71
|
-
collection: true
|
|
72
|
-
commands:
|
|
73
|
-
Array:
|
|
74
|
-
description: JavaScript Array class
|
|
75
|
-
BigInt:
|
|
76
|
-
description: JavaScript BigInt class
|
|
77
|
-
Boolean:
|
|
78
|
-
description: JavaScript Boolean class
|
|
79
|
-
Date:
|
|
80
|
-
description: JavaScript Date class
|
|
81
|
-
Error:
|
|
82
|
-
description: JavaScript Error class
|
|
83
|
-
Infinity:
|
|
84
|
-
description: JavaScript Infinity constant
|
|
85
|
-
Intl:
|
|
86
|
-
description: JavaScript Intl object
|
|
87
|
-
JSON:
|
|
88
|
-
description: JavaScript JSON object
|
|
89
|
-
Map:
|
|
90
|
-
description: JavaScript Map class
|
|
91
|
-
Math:
|
|
92
|
-
description: JavaScript Math object
|
|
93
|
-
NaN:
|
|
94
|
-
description: JavaScript NaN constant
|
|
95
|
-
Number:
|
|
96
|
-
description: JavaScript Number class
|
|
97
|
-
Object:
|
|
98
|
-
description: JavaScript Object class
|
|
99
|
-
RegExp:
|
|
100
|
-
description: JavaScript RegExp class
|
|
101
|
-
Set:
|
|
102
|
-
description: JavaScript Set class
|
|
103
|
-
String:
|
|
104
|
-
description: JavaScript String class
|
|
105
|
-
Symbol:
|
|
106
|
-
description: JavaScript Symbol class
|
|
107
|
-
decodeURI:
|
|
108
|
-
description: JavaScript decodeURI function
|
|
109
|
-
decodeURIComponent:
|
|
110
|
-
description: JavaScript decodeURIComponent function
|
|
111
|
-
encodeURI:
|
|
112
|
-
description: JavaScript encodeURI function
|
|
113
|
-
encodeURIComponent:
|
|
114
|
-
description: JavaScript encodeURIComponent function
|
|
115
|
-
"false":
|
|
116
|
-
description: JavaScript false constant
|
|
117
|
-
fetch:
|
|
118
|
-
description: JavaScript fetch function
|
|
119
|
-
isFinite:
|
|
120
|
-
description: JavaScript isFinite function
|
|
121
|
-
isNaN:
|
|
122
|
-
description: JavaScript isNaN function
|
|
123
|
-
"null":
|
|
124
|
-
description: JavaScript null constant
|
|
125
|
-
parseFloat:
|
|
126
|
-
description: JavaScript parseFloat function
|
|
127
|
-
parseInt:
|
|
128
|
-
description: JavaScript parseInt function
|
|
129
|
-
"true":
|
|
130
|
-
description: JavaScript true constant
|
|
131
|
-
undefined:
|
|
132
|
-
description: JavaScript undefined constant
|
|
133
|
-
|
|
134
|
-
new:
|
|
135
|
-
description: Create instances of JavaScript classes
|
|
136
|
-
|
|
137
|
-
node:
|
|
138
|
-
description: Node.js modules
|
|
139
|
-
|
|
140
|
-
origami:
|
|
141
|
-
description: Perform general Origami language functions
|
|
52
|
+
Origami:
|
|
53
|
+
description: Create sites and other digital artifacts
|
|
142
54
|
commands:
|
|
143
55
|
basename:
|
|
144
56
|
args: (key)
|
|
145
57
|
description: Removes an extension from the key if present
|
|
146
|
-
builtins:
|
|
147
|
-
description: The set of installed builtin functions
|
|
148
58
|
config:
|
|
149
59
|
description: The current project's configuration
|
|
60
|
+
csv:
|
|
61
|
+
args: (tree)
|
|
62
|
+
description: Render the tree as a CSV file
|
|
63
|
+
document:
|
|
64
|
+
args: (text, [data])
|
|
65
|
+
description: Create a document object with the text and data
|
|
150
66
|
extension:
|
|
151
67
|
description: Helpers for working with file extensions
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
68
|
+
image:
|
|
69
|
+
description: Collection of functions for working with images
|
|
70
|
+
indexPage:
|
|
71
|
+
args: (tree)
|
|
72
|
+
description: A default index.html page for the tree
|
|
73
|
+
inline:
|
|
74
|
+
args: (text)
|
|
75
|
+
description: Inline Origami expressions found in the text
|
|
76
|
+
jsonKeys:
|
|
77
|
+
args: (tree)
|
|
78
|
+
description: Add .keys.json files to a tree
|
|
155
79
|
jsonParse:
|
|
156
80
|
args: (text)
|
|
157
81
|
description: Parse text as JSON
|
|
82
|
+
mdHtml:
|
|
83
|
+
args: (markdown)
|
|
84
|
+
description: Render the markdown as HTML
|
|
158
85
|
naturalOrder:
|
|
159
86
|
description: A comparison function for natural sort order
|
|
160
87
|
once:
|
|
@@ -168,19 +95,29 @@ origami:
|
|
|
168
95
|
description: POST the given data to the URL
|
|
169
96
|
project:
|
|
170
97
|
description: The root folder for the current Origami project
|
|
171
|
-
|
|
172
|
-
args: (
|
|
173
|
-
description:
|
|
98
|
+
redirect:
|
|
99
|
+
args: (url, options)
|
|
100
|
+
description: Redirect to the given URL
|
|
174
101
|
repeat:
|
|
175
102
|
args: (n, obj)
|
|
176
103
|
description: An array of n copies of the object
|
|
104
|
+
rss:
|
|
105
|
+
args: (feed)
|
|
106
|
+
description: Transforms a JSON Feed tree to RSS XML
|
|
177
107
|
shell:
|
|
178
108
|
args: (text)
|
|
179
109
|
description: Run the text as a shell command, return the output
|
|
110
|
+
sitemap:
|
|
111
|
+
args: (tree)
|
|
112
|
+
description: Generate a sitemap for the tree
|
|
180
113
|
slash:
|
|
181
114
|
description: Helpers for working with trailing slashes
|
|
182
|
-
|
|
183
|
-
|
|
115
|
+
slug:
|
|
116
|
+
args: (text)
|
|
117
|
+
description: A version of the text suitable for use in URLs
|
|
118
|
+
static:
|
|
119
|
+
args: (tree)
|
|
120
|
+
description: Define common static files for the tree
|
|
184
121
|
string:
|
|
185
122
|
args: (obj)
|
|
186
123
|
description: Coerce a buffer or document to a string
|
|
@@ -190,9 +127,6 @@ origami:
|
|
|
190
127
|
unpack:
|
|
191
128
|
args: (buffer)
|
|
192
129
|
description: Unpack the buffer into a usable form
|
|
193
|
-
version:
|
|
194
|
-
args: ()
|
|
195
|
-
description: Return the version number of the Origami language
|
|
196
130
|
yaml:
|
|
197
131
|
args: (obj)
|
|
198
132
|
description: Render the object in YAML format
|
|
@@ -200,54 +134,28 @@ origami:
|
|
|
200
134
|
args: (text)
|
|
201
135
|
description: Parse text as YAML
|
|
202
136
|
|
|
203
|
-
|
|
204
|
-
description:
|
|
205
|
-
|
|
206
|
-
scope:
|
|
207
|
-
description: URL protocol to explicitly reference a key in scope
|
|
208
|
-
|
|
209
|
-
site:
|
|
210
|
-
description: Add common website features
|
|
211
|
-
commands:
|
|
212
|
-
index:
|
|
213
|
-
args: (tree)
|
|
214
|
-
description: A default index.html page for the tree
|
|
215
|
-
jsonKeys:
|
|
216
|
-
args: (tree)
|
|
217
|
-
description: Add .keys.json files to a tree
|
|
218
|
-
redirect:
|
|
219
|
-
args: (url, options)
|
|
220
|
-
description: Redirect to the given URL
|
|
221
|
-
rss:
|
|
222
|
-
args: (feed)
|
|
223
|
-
description: Transforms a JSON Feed tree to RSS XML
|
|
224
|
-
sitemap:
|
|
225
|
-
args: (tree)
|
|
226
|
-
description: Generate a sitemap for the tree
|
|
227
|
-
slug:
|
|
228
|
-
args: (text)
|
|
229
|
-
description: A version of the text suitable for use in URLs
|
|
230
|
-
static:
|
|
231
|
-
args: (tree)
|
|
232
|
-
description: Define common static files for the tree
|
|
233
|
-
|
|
234
|
-
text:
|
|
235
|
-
description: Manipulate text
|
|
137
|
+
Protocol:
|
|
138
|
+
description: Retrieve resources via URL protocols
|
|
236
139
|
commands:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
description:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
140
|
+
explore:
|
|
141
|
+
description: Treat a website with JSON keys as a tree
|
|
142
|
+
files:
|
|
143
|
+
description: File system folders and files
|
|
144
|
+
http:
|
|
145
|
+
description: Web resources via HTTP
|
|
146
|
+
https:
|
|
147
|
+
description: Web resources via HTTPS
|
|
148
|
+
httptree:
|
|
149
|
+
description: Website tree via HTTP
|
|
150
|
+
httpstree:
|
|
151
|
+
description: Website tree via HTTPS
|
|
152
|
+
node:
|
|
153
|
+
description: Installed Node.js modules
|
|
154
|
+
package:
|
|
155
|
+
description: Packages installed in node_modules
|
|
248
156
|
|
|
249
|
-
|
|
250
|
-
description: Work with trees
|
|
157
|
+
Tree:
|
|
158
|
+
description: Work with trees of files and data
|
|
251
159
|
commands:
|
|
252
160
|
addNextPrevious:
|
|
253
161
|
args: (tree)
|
|
@@ -267,9 +175,6 @@ tree:
|
|
|
267
175
|
constant:
|
|
268
176
|
args: (value)
|
|
269
177
|
description: Return a deep tree with a single constant value
|
|
270
|
-
copy:
|
|
271
|
-
args: (source, target)
|
|
272
|
-
description: Copy the source tree to the target
|
|
273
178
|
deepMap:
|
|
274
179
|
args: (tree, options)
|
|
275
180
|
description: Map the keys and values of a deep tree
|
|
@@ -315,6 +220,8 @@ tree:
|
|
|
315
220
|
has:
|
|
316
221
|
args: (tree, key)
|
|
317
222
|
description: True if key exists in tree
|
|
223
|
+
indent:
|
|
224
|
+
description: Tagged template literal for normalizing indentation
|
|
318
225
|
inners:
|
|
319
226
|
args: (tree)
|
|
320
227
|
description: The tree's interior nodes
|
|
@@ -330,6 +237,9 @@ tree:
|
|
|
330
237
|
isTreelike:
|
|
331
238
|
args: (object)
|
|
332
239
|
description: True if object can be coerced to a tree
|
|
240
|
+
json:
|
|
241
|
+
args: (obj)
|
|
242
|
+
description: Render the object in JSON format
|
|
333
243
|
keys:
|
|
334
244
|
args: (tree)
|
|
335
245
|
description: The keys of the tree
|
package/src/dev/serve.js
CHANGED
|
@@ -22,7 +22,7 @@ const defaultPort = 5000;
|
|
|
22
22
|
* @this {AsyncTree|null}
|
|
23
23
|
*/
|
|
24
24
|
export default async function serve(treelike, port) {
|
|
25
|
-
assertTreeIsDefined(this, "
|
|
25
|
+
assertTreeIsDefined(this, "serve");
|
|
26
26
|
let tree;
|
|
27
27
|
if (treelike) {
|
|
28
28
|
tree = Tree.from(treelike, { parent: this });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// When this is no longer experimental in Node:
|
|
2
2
|
// import packageJson from "../../package.json" with { type: "json" };
|
|
3
3
|
|
|
4
|
-
import fs from "node:fs
|
|
4
|
+
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
8
8
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
const packageJsonPath = path.resolve(dirname, "../../package.json");
|
|
10
|
-
const buffer =
|
|
10
|
+
const buffer = fs.readFileSync(packageJsonPath);
|
|
11
11
|
const data = JSON.parse(String(buffer));
|
|
12
12
|
|
|
13
13
|
export default data.version;
|
package/src/dev/watch.js
CHANGED
|
@@ -63,7 +63,7 @@ async function evaluateTree(parent, fn) {
|
|
|
63
63
|
return tree;
|
|
64
64
|
}
|
|
65
65
|
if (!message) {
|
|
66
|
-
message = `
|
|
66
|
+
message = `Warning: watch expression did not return a tree`;
|
|
67
67
|
}
|
|
68
68
|
console.warn(message);
|
|
69
69
|
tree = new ConstantTree(message);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compile } from "@weborigami/language";
|
|
2
|
-
import
|
|
2
|
+
import builtinsProgram from "../builtinsProgram.js";
|
|
3
3
|
import getConfig from "../cli/getConfig.js";
|
|
4
4
|
import * as utilities from "../common/utilities.js";
|
|
5
5
|
import getParent from "./getParent.js";
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
|
|
40
40
|
const config = getConfig(parent) ?? {};
|
|
41
41
|
const globals = {
|
|
42
|
-
...(options.globals ??
|
|
42
|
+
...(options.globals ?? builtinsProgram()),
|
|
43
43
|
...config,
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extension, trailingSlash } from "@weborigami/async-tree";
|
|
2
2
|
import { compile } from "@weborigami/language";
|
|
3
|
-
import
|
|
3
|
+
import builtinsProgram from "../builtinsProgram.js";
|
|
4
4
|
import { toString } from "../common/utilities.js";
|
|
5
5
|
import getParent from "./getParent.js";
|
|
6
6
|
import processUnpackedContent from "./processUnpackedContent.js";
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
if (options.globals) {
|
|
42
42
|
globals = options.globals;
|
|
43
43
|
} else {
|
|
44
|
-
globals =
|
|
44
|
+
globals = builtinsProgram();
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const defineFn = compile.templateDocument(source, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isPacked, symbols } from "@weborigami/async-tree";
|
|
2
|
-
import { compile } from "@weborigami/language";
|
|
2
|
+
import { attachWarning, compile } from "@weborigami/language";
|
|
3
3
|
import { parseYaml, toYaml } from "../common/serialize.js";
|
|
4
4
|
import { toString } from "../common/utilities.js";
|
|
5
5
|
import parseFrontMatter from "./parseFrontMatter.js";
|
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
|
|
45
45
|
/** @type {any} */
|
|
46
46
|
const dataWithoutText = Object.assign({}, object);
|
|
47
|
+
delete dataWithoutText._body;
|
|
47
48
|
delete dataWithoutText["@text"];
|
|
48
49
|
if (Object.keys(dataWithoutText).length > 0) {
|
|
49
50
|
const frontMatter = (await toYaml(dataWithoutText)).trimEnd();
|
|
@@ -74,11 +75,21 @@ export default {
|
|
|
74
75
|
frontData = parseYaml(frontText);
|
|
75
76
|
}
|
|
76
77
|
// TODO: Deprecate @text
|
|
77
|
-
unpacked =
|
|
78
|
+
unpacked = { ...frontData };
|
|
79
|
+
Object.defineProperty(unpacked, "@text", {
|
|
80
|
+
configurable: true,
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get() {
|
|
83
|
+
return attachWarning(
|
|
84
|
+
body,
|
|
85
|
+
"The @text property is deprecated. Use _body instead."
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
78
89
|
Object.defineProperty(unpacked, "_body", {
|
|
79
90
|
configurable: true,
|
|
91
|
+
enumerable: true,
|
|
80
92
|
value: body,
|
|
81
|
-
enumerable: false, // TODO: Make enumerable
|
|
82
93
|
writable: true,
|
|
83
94
|
});
|
|
84
95
|
} else {
|
|
@@ -87,6 +98,7 @@ export default {
|
|
|
87
98
|
}
|
|
88
99
|
|
|
89
100
|
unpacked[symbols.parent] = parent;
|
|
101
|
+
|
|
90
102
|
return unpacked;
|
|
91
103
|
},
|
|
92
104
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// .xhtml is a synonynm for .html
|
|
2
|
-
export { default } from "./
|
|
2
|
+
export { htmlHandler as default } from "./handlers.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// .yml is a synonym for .yaml
|
|
2
|
-
export { default } from "./
|
|
2
|
+
export { yamlHandler as default } from "./handlers.js";
|
package/src/image/format.js
CHANGED
|
@@ -13,6 +13,6 @@ import imageFormatFn from "./formatFn.js";
|
|
|
13
13
|
* @param {any} options
|
|
14
14
|
*/
|
|
15
15
|
export default async function imageFormat(input, format, options) {
|
|
16
|
-
assertTreeIsDefined(this, "
|
|
16
|
+
assertTreeIsDefined(this, "format");
|
|
17
17
|
return imageFormatFn.call(this, format, options)(input);
|
|
18
18
|
}
|
package/src/image/resize.js
CHANGED
|
@@ -9,7 +9,7 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
|
9
9
|
* @param {import("sharp").ResizeOptions} options
|
|
10
10
|
*/
|
|
11
11
|
export default async function resize(input, options) {
|
|
12
|
-
assertTreeIsDefined(this, "
|
|
12
|
+
assertTreeIsDefined(this, "resize");
|
|
13
13
|
return input instanceof Uint8Array || input instanceof ArrayBuffer
|
|
14
14
|
? sharp(input).rotate().resize(options).toBuffer()
|
|
15
15
|
: undefined;
|
package/src/origami/csv.js
CHANGED
|
@@ -11,7 +11,7 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
|
11
11
|
* @param {any} [object]
|
|
12
12
|
*/
|
|
13
13
|
export default async function csv(object) {
|
|
14
|
-
assertTreeIsDefined(this, "
|
|
14
|
+
assertTreeIsDefined(this, "csv");
|
|
15
15
|
object = object ?? this;
|
|
16
16
|
if (object === undefined) {
|
|
17
17
|
return undefined;
|
package/src/origami/json.js
CHANGED
|
@@ -9,7 +9,7 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
|
9
9
|
* @param {any} [obj]
|
|
10
10
|
*/
|
|
11
11
|
export default async function json(obj) {
|
|
12
|
-
assertTreeIsDefined(this, "
|
|
12
|
+
assertTreeIsDefined(this, "json");
|
|
13
13
|
// A fragment of the logic from getTreeArgument.js
|
|
14
14
|
if (arguments.length > 0 && obj === undefined) {
|
|
15
15
|
throw new Error(
|
package/src/origami/once.js
CHANGED
package/src/origami/ori.js
CHANGED
|
@@ -24,7 +24,7 @@ export default async function ori(
|
|
|
24
24
|
expression,
|
|
25
25
|
options = { formatResult: true }
|
|
26
26
|
) {
|
|
27
|
-
assertTreeIsDefined(this, "
|
|
27
|
+
assertTreeIsDefined(this, "ori");
|
|
28
28
|
|
|
29
29
|
// In case expression has come from a file, cast it to a string.
|
|
30
30
|
expression = toString(expression);
|
package/src/origami/origami.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { extension } from "@weborigami/async-tree";
|
|
2
2
|
export { toFunction } from "../common/utilities.js";
|
|
3
3
|
|
|
4
|
-
export { default as help } from "../
|
|
4
|
+
export { default as help } from "../dev/help.js"; // Alias
|
|
5
5
|
export { default as basename } from "./basename.js";
|
|
6
6
|
export { default as config } from "./config.js";
|
|
7
7
|
export { default as csv } from "./csv.js";
|
|
@@ -17,9 +17,7 @@ export { default as regexMatch } from "./regexMatch.js";
|
|
|
17
17
|
export { default as repeat } from "./repeat.js";
|
|
18
18
|
export { default as shell } from "./shell.js";
|
|
19
19
|
export { default as slash } from "./slash.js";
|
|
20
|
-
export { default as stdin } from "./stdin.js";
|
|
21
20
|
export { default as string } from "./string.js";
|
|
22
21
|
export { default as unpack } from "./unpack.js";
|
|
23
|
-
export { default as version } from "./version.js";
|
|
24
22
|
export { default as yaml } from "./yaml.js";
|
|
25
23
|
export { default as yamlParse } from "./yamlParse.js";
|
package/src/origami/pack.js
CHANGED
package/src/origami/project.js
CHANGED
|
@@ -24,7 +24,7 @@ const configFileName = "config.ori";
|
|
|
24
24
|
* @this {AsyncTree|null}
|
|
25
25
|
*/
|
|
26
26
|
export default async function project() {
|
|
27
|
-
assertTreeIsDefined(this, "
|
|
27
|
+
assertTreeIsDefined(this, "project");
|
|
28
28
|
|
|
29
29
|
const dirname = process.cwd();
|
|
30
30
|
const currentTree = new OrigamiFiles(dirname);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { attachWarning } from "@weborigami/language";
|
|
2
|
+
|
|
1
3
|
const parsers = {};
|
|
2
4
|
|
|
3
5
|
// TODO: Remove this deprecated function
|
|
4
6
|
export default function regexMatch(text, regex) {
|
|
5
|
-
console.warn(
|
|
6
|
-
"warning: regexMatch is deprecated, use a JavaScript regular expression instead."
|
|
7
|
-
);
|
|
8
7
|
if (!parsers[regex]) {
|
|
9
8
|
const regexp = new RegExp(regex);
|
|
10
9
|
parsers[regex] = (input) => input.match(regexp)?.groups;
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
const match = parsers[regex](text);
|
|
12
|
+
return attachWarning(
|
|
13
|
+
match,
|
|
14
|
+
"The regexMatch function is deprecated. Use a JavaScript regular expression instead."
|
|
15
|
+
);
|
|
13
16
|
}
|
package/src/origami/string.js
CHANGED
package/src/origami/unpack.js
CHANGED
package/src/origami/yaml.js
CHANGED
|
@@ -10,7 +10,7 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
|
10
10
|
* @param {any} [obj]
|
|
11
11
|
*/
|
|
12
12
|
export default async function toYaml(obj) {
|
|
13
|
-
assertTreeIsDefined(this, "
|
|
13
|
+
assertTreeIsDefined(this, "yaml");
|
|
14
14
|
// A fragment of the logic from getTreeArgument.js
|
|
15
15
|
if (arguments.length > 0 && obj === undefined) {
|
|
16
16
|
throw new Error(
|
package/src/protocols/explore.js
CHANGED
|
@@ -14,6 +14,6 @@ import constructSiteTree from "../common/constructSiteTree.js";
|
|
|
14
14
|
* @param {...string} keys
|
|
15
15
|
*/
|
|
16
16
|
export default function explore(host, ...keys) {
|
|
17
|
-
assertTreeIsDefined(this, "explore
|
|
17
|
+
assertTreeIsDefined(this, "explore");
|
|
18
18
|
return constructSiteTree("https:", ExplorableSiteTree, this, host, ...keys);
|
|
19
19
|
}
|
package/src/protocols/files.js
CHANGED
|
@@ -11,7 +11,7 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
|
11
11
|
* @param {string[]} keys
|
|
12
12
|
*/
|
|
13
13
|
export default async function files(...keys) {
|
|
14
|
-
assertTreeIsDefined(this, "files
|
|
14
|
+
assertTreeIsDefined(this, "files");
|
|
15
15
|
|
|
16
16
|
// If path begins with `~`, treat it relative to the home directory.
|
|
17
17
|
// Otherwise, treat it relative to the current working directory.
|
package/src/protocols/http.js
CHANGED
|
@@ -12,7 +12,7 @@ import fetchAndHandleExtension from "../common/fetchAndHandleExtension.js";
|
|
|
12
12
|
* @param {...string} keys
|
|
13
13
|
*/
|
|
14
14
|
export default async function http(host, ...keys) {
|
|
15
|
-
assertTreeIsDefined(this, "http
|
|
15
|
+
assertTreeIsDefined(this, "http");
|
|
16
16
|
const href = constructHref("http:", host, ...keys);
|
|
17
17
|
return fetchAndHandleExtension.call(this, href);
|
|
18
18
|
}
|
package/src/protocols/https.js
CHANGED
|
@@ -12,7 +12,7 @@ import fetchAndHandleExtension from "../common/fetchAndHandleExtension.js";
|
|
|
12
12
|
* @param {...string} keys
|
|
13
13
|
*/
|
|
14
14
|
export default async function https(host, ...keys) {
|
|
15
|
-
assertTreeIsDefined(this, "https
|
|
15
|
+
assertTreeIsDefined(this, "https");
|
|
16
16
|
const href = constructHref("https:", host, ...keys);
|
|
17
17
|
return fetchAndHandleExtension.call(this, href);
|
|
18
18
|
}
|
|
@@ -14,6 +14,6 @@ import constructSiteTree from "../common/constructSiteTree.js";
|
|
|
14
14
|
* @param {...string} keys
|
|
15
15
|
*/
|
|
16
16
|
export default function httpstree(host, ...keys) {
|
|
17
|
-
assertTreeIsDefined(this, "treehttps
|
|
17
|
+
assertTreeIsDefined(this, "treehttps");
|
|
18
18
|
return constructSiteTree("https:", SiteTree, this, host, ...keys);
|
|
19
19
|
}
|