mono-jsx 0.10.0-beta.7 → 0.10.0-beta.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.
package/jsx-runtime.mjs CHANGED
@@ -16,7 +16,7 @@ var $setup = /* @__PURE__ */ Symbol.for("mono.setup");
16
16
  var $rpc = /* @__PURE__ */ Symbol.for("mono.rpc");
17
17
 
18
18
  // version.ts
19
- var VERSION = "0.10.0-beta.7";
19
+ var VERSION = "0.10.0-beta.9";
20
20
 
21
21
  // runtime/index.ts
22
22
  var EVENT = 1;
@@ -380,8 +380,8 @@ function renderToWebStream(root, options) {
380
380
  }
381
381
  controller.enqueue(encoder.encode(buf + "]"));
382
382
  } catch (err) {
383
- controller.enqueue(encoder.encode(stringify({ error: errorStringify(err) })));
384
383
  console.error(err);
384
+ controller.enqueue(encoder.encode(stringify({ error: errorStringify(err) })));
385
385
  } finally {
386
386
  controller.close();
387
387
  }
@@ -410,6 +410,9 @@ function renderToWebStream(root, options) {
410
410
  }
411
411
  }
412
412
  }
413
+ } catch (err) {
414
+ console.error(err);
415
+ write("<script>console.error(" + stringify(errorStringify(err)) + ")<\/script>");
413
416
  } finally {
414
417
  controller.close();
415
418
  }
@@ -846,10 +849,12 @@ async function renderNode(rc, node, stripSlotProp) {
846
849
  }
847
850
  let buf = '<meta charset="utf-8">';
848
851
  for (const [key, value] of Object.entries(Object.assign(defaultMetadata, rc.metadata, metadata))) {
849
- if (key === "title") {
850
- buf += "<title>" + escapeHTML(value) + "</title>";
851
- } else {
852
- buf += "<meta " + (key.startsWith("og:") ? "property" : "name") + "=" + toAttrStringLit(key) + " content=" + toAttrStringLit(value) + ">";
852
+ if (value) {
853
+ if (key === "title") {
854
+ buf += "<title>" + escapeHTML(value) + "</title>";
855
+ } else {
856
+ buf += "<meta " + (key.startsWith("og:") ? "property" : "name") + "=" + toAttrStringLit(key) + " content=" + toAttrStringLit(value) + ">";
857
+ }
853
858
  }
854
859
  }
855
860
  write(buf);
@@ -1100,7 +1105,7 @@ async function renderFC(rc, fcFn, props, eager) {
1100
1105
  });
1101
1106
  } else {
1102
1107
  console.error(err);
1103
- write("<script>console.error(" + stringify(err) + ")<\/script>");
1108
+ write("<script>console.error(" + stringify(errorStringify(err)) + ")<\/script>");
1104
1109
  }
1105
1110
  }
1106
1111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mono-jsx",
3
- "version": "0.10.0-beta.7",
3
+ "version": "0.10.0-beta.9",
4
4
  "description": "`<html>` as a `Response` (Yet another JSX runtime for server-side rendering).",
5
5
  "type": "module",
6
6
  "module": "./index.mjs",
package/types/jsx.d.ts CHANGED
@@ -57,6 +57,7 @@ export type VNode = readonly [
57
57
  ];
58
58
 
59
59
  export type Metadata = {
60
+ viewport?: "width=device-width, initial-scale=1.0" | (string & {});
60
61
  title?: string;
61
62
  description?: string;
62
63
  keywords?: string;
package/types/render.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./htmx.d.ts" />
2
2
 
3
- import type { ComponentType, MaybeModule } from "./jsx.d.ts";
3
+ import type { ComponentType, MaybeModule, Metadata } from "./jsx.d.ts";
4
4
 
5
5
  /**
6
6
  * Htmx extensions.
@@ -89,7 +89,7 @@ export interface RenderOptions extends Partial<HtmxExts> {
89
89
  /**
90
90
  * Global metadata.
91
91
  */
92
- metadata?: Record<string, string>;
92
+ metadata?: Metadata;
93
93
  /**
94
94
  * Current `Request` object to be passed to components.
95
95
  */