@weborigami/origami 0.6.6 → 0.6.7

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/index.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  /**
2
- * Tree Origami is a JavaScript project, but we use TypeScript as an internal
3
- * tool to confirm our code is type safe.
2
+ * Origami is a JavaScript project, but we use TypeScript as an internal tool to
3
+ * confirm our code is type safe.
4
4
  */
5
5
 
6
+ // Re-export all exports from main.js
7
+ export * from "./main.js";
8
+
6
9
  /**
7
10
  * A class constructor is an object with a `new` method that returns an
8
11
  * instance of the indicated type.
package/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as documentObject } from "./src/common/documentObject.js";
2
+ export * from "./src/common/serialize.js";
2
3
  export * as Dev from "./src/dev/dev.js";
3
4
  export { default as initializeBuiltins } from "./src/initializeBuiltins.js";
4
5
  export * as Origami from "./src/origami/origami.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weborigami/origami",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
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.9.3"
18
18
  },
19
19
  "dependencies": {
20
- "@weborigami/async-tree": "0.6.6",
20
+ "@weborigami/async-tree": "0.6.7",
21
21
  "@weborigami/json-feed-to-rss": "1.0.1",
22
- "@weborigami/language": "0.6.6",
22
+ "@weborigami/language": "0.6.7",
23
23
  "css-tree": "3.1.0",
24
24
  "graphviz-wasm": "3.0.2",
25
25
  "highlight.js": "11.11.1",
@@ -9,7 +9,13 @@ import sharp from "sharp";
9
9
  * @param {any} options
10
10
  */
11
11
  export default async function imageFormat(input, format, options) {
12
- return input instanceof Uint8Array || input instanceof ArrayBuffer
13
- ? sharp(input).toFormat(format, options).toBuffer()
14
- : undefined;
12
+ if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) {
13
+ return undefined;
14
+ }
15
+
16
+ const data = await sharp(input).toFormat(format, options).toBuffer();
17
+
18
+ // Sharp WASM library returns what appears to be a SharedArrayBuffer, which is
19
+ // not accepted in some contexts, so we convert it to a regular Uint8Array.
20
+ return new Uint8Array(data);
15
21
  }
@@ -7,7 +7,13 @@ import sharp from "sharp";
7
7
  * @param {import("sharp").ResizeOptions} options
8
8
  */
9
9
  export default async function resize(input, options) {
10
- return input instanceof Uint8Array || input instanceof ArrayBuffer
11
- ? sharp(input).rotate().resize(options).toBuffer()
12
- : undefined;
10
+ if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) {
11
+ return undefined;
12
+ }
13
+
14
+ const data = await sharp(input).rotate().resize(options).toBuffer();
15
+
16
+ // Sharp WASM library returns what appears to be a SharedArrayBuffer, which is
17
+ // not accepted in some contexts, so we convert it to a regular Uint8Array.
18
+ return new Uint8Array(data);
13
19
  }
@@ -1,16 +1,7 @@
1
1
  export { extension } from "@weborigami/async-tree";
2
2
  export { default as help } from "../dev/help.js"; // Alias
3
- export { default as document } from "../origami/document.js";
4
- // export { default as htmlDom } from "../origami/htmlDom.js";
5
- export { default as indexPage } from "../origami/indexPage.js";
6
- export { default as inline } from "../origami/inline.js";
7
- export { default as jsonKeys } from "../origami/jsonKeys.js";
8
- export { default as mdHtml } from "../origami/mdHtml.js";
9
- export { default as redirect } from "../origami/redirect.js";
10
- export { default as rss } from "../origami/rss.js";
11
- export { default as sitemap } from "../origami/sitemap.js";
12
- export { default as slug } from "../origami/slug.js";
13
- export { default as static } from "../origami/static.js";
3
+ export { default as document } from "./document.js";
4
+ // export { default as htmlDom } from "./htmlDom.js";
14
5
  export { default as basename } from "./basename.js";
15
6
  export { default as csv } from "./csv.js";
16
7
  export { default as fetch } from "./fetch.js";
@@ -18,8 +9,12 @@ export { default as htmlEscape } from "./htmlEscape.js";
18
9
  export { default as format } from "./image/format.js";
19
10
  export * as image from "./image/image.js";
20
11
  export { default as resize } from "./image/resize.js";
12
+ export { default as indexPage } from "./indexPage.js";
13
+ export { default as inline } from "./inline.js";
21
14
  export { default as json } from "./json.js";
15
+ export { default as jsonKeys } from "./jsonKeys.js";
22
16
  export { default as jsonParse } from "./jsonParse.js";
17
+ export { default as mdHtml } from "./mdHtml.js";
23
18
  export { default as mdOutline } from "./mdOutline.js";
24
19
  export { default as naturalOrder } from "./naturalOrder.js";
25
20
  export { default as once } from "./once.js";
@@ -28,9 +23,14 @@ export { default as pack } from "./pack.js";
28
23
  export { default as post } from "./post.js";
29
24
  export { default as project } from "./project.js";
30
25
  export { default as projectRoot } from "./projectRoot.js";
26
+ export { default as redirect } from "./redirect.js";
31
27
  export { default as repeat } from "./repeat.js";
28
+ export { default as rss } from "./rss.js";
32
29
  export { default as shell } from "./shell.js";
30
+ export { default as sitemap } from "./sitemap.js";
33
31
  export { default as slash } from "./slash.js";
32
+ export { default as slug } from "./slug.js";
33
+ export { default as static } from "./static.js";
34
34
  export { default as string } from "./string.js";
35
35
  export { default as tsv } from "./tsv.js";
36
36
  export { default as unpack } from "./unpack.js";
@@ -122,6 +122,9 @@ function maybeHtml(text) {
122
122
  if (text.startsWith("<!DOCTYPE html>")) {
123
123
  return true;
124
124
  }
125
+ if (text.startsWith("<!--")) {
126
+ return true;
127
+ }
125
128
  // Check if the text starts with an HTML tag.
126
129
  // - start with possible whitespace
127
130
  // - followed by '<'