@weborigami/origami 0.3.4-jse.7 → 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.
Files changed (63) hide show
  1. package/main.js +4 -1
  2. package/package.json +4 -4
  3. package/src/builtinsJse.js +15 -5
  4. package/src/builtinsProgram.js +87 -0
  5. package/src/builtinsShell.js +41 -30
  6. package/src/cli/cli.js +1 -1
  7. package/src/cli/getConfig.js +1 -0
  8. package/src/common/documentObject.js +14 -3
  9. package/src/common/utilities.js +1 -1
  10. package/src/{tree → dev}/copy.js +2 -2
  11. package/src/dev/dev.js +6 -0
  12. package/src/dev/explore.js +2 -2
  13. package/src/{help → dev}/help.js +5 -5
  14. package/src/{help → dev}/help.yaml +80 -170
  15. package/src/dev/serve.js +1 -1
  16. package/src/{origami → dev}/version.js +2 -2
  17. package/src/dev/watch.js +1 -1
  18. package/src/handlers/ori.handler.js +2 -2
  19. package/src/handlers/oridocument.handler.js +2 -2
  20. package/src/handlers/txt.handler.js +15 -3
  21. package/src/handlers/xhtml.handler.js +1 -1
  22. package/src/handlers/yml.handler.js +1 -1
  23. package/src/image/format.js +1 -1
  24. package/src/image/resize.js +1 -1
  25. package/src/origami/csv.js +1 -1
  26. package/src/origami/json.js +1 -1
  27. package/src/origami/once.js +1 -1
  28. package/src/origami/ori.js +1 -1
  29. package/src/origami/origami.js +1 -3
  30. package/src/origami/pack.js +1 -1
  31. package/src/origami/project.js +1 -1
  32. package/src/origami/regexMatch.js +7 -4
  33. package/src/origami/string.js +1 -1
  34. package/src/origami/unpack.js +1 -1
  35. package/src/origami/yaml.js +1 -1
  36. package/src/protocols/explore.js +1 -1
  37. package/src/protocols/files.js +2 -2
  38. package/src/protocols/http.js +1 -1
  39. package/src/protocols/https.js +1 -1
  40. package/src/protocols/httpstree.js +1 -1
  41. package/src/protocols/httptree.js +1 -1
  42. package/src/protocols/inherited.js +7 -2
  43. package/src/protocols/js.js +13 -0
  44. package/src/protocols/new.js +7 -2
  45. package/src/protocols/scope.js +8 -1
  46. package/src/site/rss.js +1 -1
  47. package/src/site/sitemap.js +1 -1
  48. package/src/text/document.js +1 -1
  49. package/src/text/inline.js +2 -2
  50. package/src/text/mdHtml.js +1 -1
  51. package/src/tree/cache.js +1 -1
  52. package/src/tree/concat.js +1 -1
  53. package/src/tree/deepMerge.js +1 -1
  54. package/src/tree/filter.js +1 -1
  55. package/src/tree/fromFn.js +1 -1
  56. package/src/tree/globKeys.js +1 -1
  57. package/src/tree/mask.js +1 -1
  58. package/src/tree/match.js +1 -1
  59. package/src/tree/merge.js +1 -1
  60. package/src/tree/regExpKeys.js +1 -1
  61. package/src/tree/tree.js +0 -1
  62. package/src/BuiltinsTree.js +0 -18
  63. /package/src/{origami → dev}/stdin.js +0 -0
@@ -1,4 +1,4 @@
1
- dev:
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
- explore:
36
- description: URL protocol to treat a website with JSON keys as a tree
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
- json:
153
- args: (obj)
154
- description: Render the object in JSON format
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
- regexMatch:
172
- args: (text, regex)
173
- description: Return matches of the regex in the text
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
- stdin:
183
- description: Returns the content of the standard input stream
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
- package:
204
- description: URL protocol for packages installed in node_modules
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
- document:
238
- args: (text, [data])
239
- description: Create a document object with the text and data
240
- indent:
241
- description: Tagged template literal for normalizing indentation
242
- inline:
243
- args: (text)
244
- description: Inline Origami expressions found in the text
245
- mdHtml:
246
- args: (markdown)
247
- description: Render the markdown as HTML
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
- tree:
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, "dev:serve");
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/promises";
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 = await fs.readFile(packageJsonPath);
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 = `warning: watch expression did not return a tree`;
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 builtinsShell from "../builtinsShell.js";
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 ?? builtinsShell()),
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 builtinsShell from "../builtinsShell.js";
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 = builtinsShell();
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 = Object.assign({}, frontData, { "@text": body });
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 "./html.handler.js";
2
+ export { htmlHandler as default } from "./handlers.js";
@@ -1,2 +1,2 @@
1
1
  // .yml is a synonym for .yaml
2
- export { default } from "./yaml.handler.js";
2
+ export { yamlHandler as default } from "./handlers.js";
@@ -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, "image:format");
16
+ assertTreeIsDefined(this, "format");
17
17
  return imageFormatFn.call(this, format, options)(input);
18
18
  }
@@ -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, "image:resize");
12
+ assertTreeIsDefined(this, "resize");
13
13
  return input instanceof Uint8Array || input instanceof ArrayBuffer
14
14
  ? sharp(input).rotate().resize(options).toBuffer()
15
15
  : undefined;
@@ -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, "origami:csv");
14
+ assertTreeIsDefined(this, "csv");
15
15
  object = object ?? this;
16
16
  if (object === undefined) {
17
17
  return undefined;
@@ -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, "origami:json");
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(
@@ -11,7 +11,7 @@ const codePromiseMap = new Map();
11
11
  * @param {Function} fn
12
12
  */
13
13
  export default async function once(fn) {
14
- assertTreeIsDefined(this, "origami:once");
14
+ assertTreeIsDefined(this, "once");
15
15
 
16
16
  const code = /** @type {any} */ (fn).code;
17
17
  if (code) {
@@ -24,7 +24,7 @@ export default async function ori(
24
24
  expression,
25
25
  options = { formatResult: true }
26
26
  ) {
27
- assertTreeIsDefined(this, "origami:ori");
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);
@@ -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 "../help/help.js"; // Alias
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";
@@ -8,6 +8,6 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
8
8
  * @returns
9
9
  */
10
10
  export default function pack(obj) {
11
- assertTreeIsDefined(this, "origami:pack");
11
+ assertTreeIsDefined(this, "pack");
12
12
  return obj?.pack?.();
13
13
  }
@@ -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, "origami:project");
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
- return parsers[regex](text);
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
  }
@@ -9,6 +9,6 @@ import { toString } from "../common/utilities.js";
9
9
  * @param {any} object
10
10
  */
11
11
  export default function stringBuiltin(object) {
12
- assertTreeIsDefined(this, "origami:string");
12
+ assertTreeIsDefined(this, "string");
13
13
  return toString(object);
14
14
  }
@@ -9,6 +9,6 @@ import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
9
9
  * @param {any} obj
10
10
  */
11
11
  export default function unpack(obj) {
12
- assertTreeIsDefined(this, "origami:unpack");
12
+ assertTreeIsDefined(this, "unpack");
13
13
  return obj?.unpack?.() ?? obj;
14
14
  }
@@ -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, "origami:yaml");
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(
@@ -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
  }
@@ -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.
@@ -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
  }
@@ -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
  }
@@ -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
  }