@weborigami/origami 0.0.71 → 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.
@@ -4,7 +4,7 @@ import {
4
4
  map,
5
5
  toString,
6
6
  } from "@weborigami/async-tree";
7
- import fileTypeOrigami from "../src/builtins/ori_handler.js";
7
+ import fileTypeOrigami from "../src/builtins/ori.handler.js";
8
8
  import { transformObject } from "../src/common/utilities.js";
9
9
  import PathTransform from "./PathTransform.js";
10
10
 
@@ -105,22 +105,22 @@ export { default as version } from "../src/builtins/@version.js";
105
105
  export { default as watch } from "../src/builtins/@watch.js";
106
106
  export { default as yaml } from "../src/builtins/@yaml.js";
107
107
  export { default as yamlParse } from "../src/builtins/@yamlParse.js";
108
- export { default as cssHandler } from "../src/builtins/css_handler.js";
109
- export { default as htmHandler } from "../src/builtins/htm_handler.js";
110
- export { default as htmlHandler } from "../src/builtins/html_handler.js";
111
- export { default as jpegHandler } from "../src/builtins/jpeg_handler.js";
112
- export { default as jpgHandler } from "../src/builtins/jpg_handler.js";
113
- export { default as jsHandler } from "../src/builtins/js_handler.js";
114
- export { default as jsonHandler } from "../src/builtins/json_handler.js";
115
- export { default as mdHandler } from "../src/builtins/md_handler.js";
116
- export { default as mjsHandler } from "../src/builtins/mjs_handler.js";
117
- export { default as oriDocumentHandler } from "../src/builtins/ori_document_handler.js";
118
- export { default as oriHandler } from "../src/builtins/ori_handler.js";
119
- export { default as txtHandler } from "../src/builtins/txt_handler.js";
120
- export { default as wasmHandler } from "../src/builtins/wasm_handler.js";
121
- export { default as xhtmlHandler } from "../src/builtins/xhtml_handler.js";
122
- export { default as yamlHandler } from "../src/builtins/yaml_handler.js";
123
- export { default as ymlHandler } from "../src/builtins/yml_handler.js";
108
+ export { default as cssHandler } from "../src/builtins/css.handler.js";
109
+ export { default as htmHandler } from "../src/builtins/htm.handler.js";
110
+ export { default as htmlHandler } from "../src/builtins/html.handler.js";
111
+ export { default as jpegHandler } from "../src/builtins/jpeg.handler.js";
112
+ export { default as jpgHandler } from "../src/builtins/jpg.handler.js";
113
+ export { default as jsHandler } from "../src/builtins/js.handler.js";
114
+ export { default as jsonHandler } from "../src/builtins/json.handler.js";
115
+ export { default as mdHandler } from "../src/builtins/md.handler.js";
116
+ export { default as mjsHandler } from "../src/builtins/mjs.handler.js";
117
+ export { default as oriHandler } from "../src/builtins/ori.handler.js";
118
+ export { default as oridocumentHandler } from "../src/builtins/oridocument.handler.js";
119
+ export { default as txtHandler } from "../src/builtins/txt.handler.js";
120
+ export { default as wasmHandler } from "../src/builtins/wasm.handler.js";
121
+ export { default as xhtmlHandler } from "../src/builtins/xhtml.handler.js";
122
+ export { default as yamlHandler } from "../src/builtins/yaml.handler.js";
123
+ export { default as ymlHandler } from "../src/builtins/yml.handler.js";
124
124
  export { default as defaultModuleExport } from "../src/cli/defaultModuleExport.js";
125
125
  export { default as showUsage } from "../src/cli/showUsage.js";
126
126
  export { default as arrowsMapFn } from "../src/common/arrowsMapFn.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weborigami/origami",
3
- "version": "0.0.71",
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.71",
21
- "@weborigami/language": "0.0.71",
22
- "@weborigami/types": "0.0.71",
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",
@@ -3,7 +3,7 @@ import { compile } from "@weborigami/language";
3
3
  import documentObject from "../common/documentObject.js";
4
4
  import { toString } from "../common/utilities.js";
5
5
  import assertTreeIsDefined from "../misc/assertTreeIsDefined.js";
6
- import fileTypeOrigami from "./ori_handler.js";
6
+ import fileTypeOrigami from "./ori.handler.js";
7
7
 
8
8
  /**
9
9
  * Inline any Origami expressions found inside ${...} placeholders in the input
@@ -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
- // Parse
35
- const fn = compile.expression(expression);
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);
@@ -1,9 +1,9 @@
1
1
  /** @typedef {import("@weborigami/types").AsyncTree} AsyncTree */
2
- import { merge } from "@weborigami/async-tree";
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";
6
- import fileTypeOrigami from "./ori_handler.js";
6
+ import fileTypeOrigami from "./ori.handler.js";
7
7
 
8
8
  const configFileName = "config.ori";
9
9
 
@@ -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 configTree = await fileTypeOrigami.unpack(buffer, {
50
+ const config = await fileTypeOrigami.unpack(buffer, {
51
51
  key: configFileName,
52
52
  parent: configContainer,
53
53
  });
54
- if (!configTree) {
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
- projectRoot = merge(configTree, configContainer);
61
- // HACK so cli.js can get a path
62
- /** @type {any} */ (projectRoot).path = configContainer.path;
63
- projectRoot.parent = builtins;
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
 
@@ -2,7 +2,7 @@ import { Tree } from "@weborigami/async-tree";
2
2
  import assertTreeIsDefined from "../misc/assertTreeIsDefined.js";
3
3
  import getTreeArgument from "../misc/getTreeArgument.js";
4
4
  import builtins from "./@builtins.js";
5
- import fileTypeOrigami from "./ori_handler.js";
5
+ import fileTypeOrigami from "./ori.handler.js";
6
6
 
7
7
  const templateText = `(urls) => \`<?xml version="1.0" encoding="UTF-8"?>
8
8
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -1,5 +1,5 @@
1
1
  // .css files use the .txt loader
2
- import fileTypeText from "./txt_handler.js";
2
+ import fileTypeText from "./txt.handler.js";
3
3
 
4
4
  export default {
5
5
  ...fileTypeText,
@@ -0,0 +1,2 @@
1
+ // .htm is a synonynm for .html
2
+ export { default } from "./html.handler.js";
@@ -1,5 +1,5 @@
1
1
  // .html files use the .txt loader
2
- import fileTypeText from "./txt_handler.js";
2
+ import fileTypeText from "./txt.handler.js";
3
3
 
4
4
  export default {
5
5
  ...fileTypeText,
@@ -0,0 +1,2 @@
1
+ // .jpg is a synonym for .jpeg
2
+ export { default } from "./jpeg.handler.js";
@@ -1,5 +1,5 @@
1
1
  // .md files use the .txt loader
2
- import fileTypeText from "./txt_handler.js";
2
+ import fileTypeText from "./txt.handler.js";
3
3
 
4
4
  export default {
5
5
  ...fileTypeText,
@@ -0,0 +1,2 @@
1
+ // .mjs is a synonynm for .js
2
+ export { default } from "./js.handler.js";
@@ -0,0 +1,2 @@
1
+ // .xhtml is a synonynm for .html
2
+ export { default } from "./html.handler.js";
@@ -0,0 +1,2 @@
1
+ // .yml is a synonym for .yaml
2
+ export { default } from "./yaml.handler.js";
@@ -1,5 +1,5 @@
1
1
  import { isPlainObject, isUnpackable, toString } from "@weborigami/async-tree";
2
- // import txtHandler from "../builtins/txt_handler.js";
2
+ // import txtHandler from "../builtins/txt.handler.js";
3
3
 
4
4
  /**
5
5
  * In Origami, a text document object is any object with a `@text` property and
@@ -1,2 +0,0 @@
1
- // .htm is a synonynm for .html
2
- export { default } from "./html_handler.js";
@@ -1,2 +0,0 @@
1
- // .jpg is a synonym for .jpeg
2
- export { default } from "./jpeg_handler.js";
@@ -1,2 +0,0 @@
1
- // .mjs is a synonynm for .js
2
- export { default } from "./js_handler.js";
@@ -1,2 +0,0 @@
1
- // .xhtml is a synonynm for .html
2
- export { default } from "./html_handler.js";
@@ -1,2 +0,0 @@
1
- // .yml is a synonym for .yaml
2
- export { default } from "./yaml_handler.js";
File without changes
File without changes
File without changes