@voltro/web 0.54.0 → 0.56.0

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/dist/mount.d.ts CHANGED
@@ -56,6 +56,11 @@ export declare interface MountOptions {
56
56
  * PascalCase because it is a React component reference rendered
57
57
  * as <Devtools/>. */
58
58
  readonly Devtools?: ComponentType;
59
+ /** When each api connects — `'eager'` (default) or `'lazy'` (on the first
60
+ * hook that asks for it). Set from `app.config.ts`'s `web.api.connect` by
61
+ * the generated entry; see `VoltroRuntimeProvider`'s `connect` for the
62
+ * measurements behind it. */
63
+ readonly connect?: 'eager' | 'lazy';
59
64
  }
60
65
 
61
66
  export declare const noticeIslandsShipTheFullBundle: (isDev: boolean) => void;
package/dist/mount.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./frameworkBoot-CnE9vzLQ.js";
1
+ import { t as e } from "./frameworkBoot-BfJpdpZp.js";
2
2
  import { hydrateIslandsOnPage as t } from "./islands.js";
3
3
  import { o as n, r, t as i } from "./routerState-Cr6fTbka.js";
4
4
  import { StrictMode as a } from "react";
@@ -29,7 +29,8 @@ var d = () => !1, f = "__voltroIslandsBundleNoticeShown", p = (e) => {
29
29
  let S = /* @__PURE__ */ u(a, { children: /* @__PURE__ */ u(e, {
30
30
  App: f,
31
31
  apis: _,
32
- ...h.Devtools ? { Devtools: h.Devtools } : {}
32
+ ...h.Devtools ? { Devtools: h.Devtools } : {},
33
+ ...h.connect ? { connect: h.connect } : {}
33
34
  }) });
34
35
  b ? s(g, S) : o(g).render(S);
35
36
  };
package/dist/ssr.d.ts CHANGED
@@ -465,6 +465,19 @@ export declare interface PreparedLoaderData {
465
465
  readonly deferredIds: Readonly<Record<string, string>> | undefined;
466
466
  }
467
467
 
468
+ /**
469
+ * Hand an api's client descriptors to the SERVER render.
470
+ *
471
+ * Re-exported here because the CLI cannot import `@voltro/client` directly —
472
+ * it is a Node process and that package's entry is React/JSX — while this
473
+ * module is already on the web side of the boundary and is what every SSR
474
+ * path loads. See `registerSsrDescriptors` for what breaks without it: a
475
+ * binding-derived prop (a form's fields, labels, required marks) differs
476
+ * between the server render and the first client render, and React discards
477
+ * the subtree.
478
+ */
479
+ export declare const registerSsrApiDescriptors: (apiName: string, descriptors: Readonly<Record<string, never>>) => void;
480
+
468
481
  /**
469
482
  * How a page's HTML is produced.
470
483
  *
package/dist/ssr.js CHANGED
@@ -2,30 +2,30 @@ import { s as e } from "./defaultFallbacks-SQ45vAhz.js";
2
2
  import { _ as t, a as n, f as r, h as i, m as a, n as o, s, t as c, u as l, v as u } from "./routerState-Cr6fTbka.js";
3
3
  import { C as d, a as f, c as p, o as m, t as h, x as g } from "./serverContext-BwzZ6Q7d.js";
4
4
  import { createElement as _ } from "react";
5
- import { ServerRequestContext as v, makePreloadSeedBag as y, makeStoreSeedBag as b, seedPreloadedSubscription as x, seedPreloadedSubscriptionFailure as S, setPreloadSeedResolver as C, setStoreSeedResolver as w } from "@voltro/client";
6
- import { renderToPipeableStream as T, renderToString as E } from "react-dom/server";
7
- import { AsyncLocalStorage as D } from "node:async_hooks";
5
+ import { ServerRequestContext as v, makePreloadSeedBag as y, makeStoreSeedBag as b, registerSsrDescriptors as x, seedPreloadedSubscription as S, seedPreloadedSubscriptionFailure as C, setPreloadSeedResolver as w, setStoreSeedResolver as T } from "@voltro/client";
6
+ import { renderToPipeableStream as E, renderToString as D } from "react-dom/server";
7
+ import { AsyncLocalStorage as O } from "node:async_hooks";
8
8
  //#region src/storeSeedScope.ts
9
- var O = new D();
10
- w(() => O.getStore()?.store ?? null), C(() => O.getStore()?.preload ?? null);
11
- var k = async (e) => {
9
+ var k = new O();
10
+ T(() => k.getStore()?.store ?? null), w(() => k.getStore()?.preload ?? null);
11
+ var A = async (e) => {
12
12
  let t = {
13
13
  store: b(),
14
14
  preload: y()
15
15
  };
16
16
  return {
17
- result: await O.run(t, e),
17
+ result: await k.run(t, e),
18
18
  storeSeeds: t.store.seeds,
19
19
  preloadSeeds: t.preload.seeds
20
20
  };
21
- }, A = () => {
21
+ }, j = () => {
22
22
  let e = {
23
23
  store: b(),
24
24
  preload: y()
25
25
  };
26
- return O.enterWith(e), e.store;
27
- }, j = () => O.getStore()?.store.seeds ?? null, M = () => O.getStore()?.preload.seeds ?? null, N = (e) => {
28
- let t = j(), r = M(), i = e.storeSeeds !== void 0 || t === null || t.length === 0 ? e : {
26
+ return k.enterWith(e), e.store;
27
+ }, M = () => k.getStore()?.store.seeds ?? null, N = () => k.getStore()?.preload.seeds ?? null, P = (e) => {
28
+ let t = M(), r = N(), i = e.storeSeeds !== void 0 || t === null || t.length === 0 ? e : {
29
29
  ...e,
30
30
  storeSeeds: t
31
31
  };
@@ -33,7 +33,7 @@ var k = async (e) => {
33
33
  ...i,
34
34
  preloadSeeds: r
35
35
  });
36
- }, P = (e, t, n, r, i) => {
36
+ }, F = (e, t, n, r, i) => {
37
37
  let a = _(f.Provider, { value: i ? n : m }, _(e));
38
38
  if (!t) return a;
39
39
  for (let e = t.length - 1; e >= 0; e--) {
@@ -44,7 +44,7 @@ var k = async (e) => {
44
44
  }
45
45
  }
46
46
  return a;
47
- }, F = (t) => {
47
+ }, I = (t) => {
48
48
  let { descriptor: n, params: r, pathname: i, search: a, loaderData: o, segmentLoaderData: s, requestContext: c, outerWrap: l, locale: u, pageSlot: f } = t, m = d(n.meta, r, o, u), h = {
49
49
  pathname: i,
50
50
  search: a ?? "",
@@ -58,7 +58,7 @@ var k = async (e) => {
58
58
  blocked: null
59
59
  }, y = f ? p : n.Component;
60
60
  if (!y) throw Error(`SSR received a descriptor with no Component for "${i}". Lazy page routes are a client-only optimization and must not be used on the server.`);
61
- let b = g(h, P(y, n.chain, f ? void 0 : o, (e) => s?.[e], !f && n.loader !== void 0));
61
+ let b = g(h, F(y, n.chain, f ? void 0 : o, (e) => s?.[e], !f && n.loader !== void 0));
62
62
  return b = _(e, {
63
63
  chrome: null,
64
64
  children: b
@@ -66,16 +66,16 @@ var k = async (e) => {
66
66
  tree: b,
67
67
  meta: m
68
68
  };
69
- }, I = (e) => {
70
- let { tree: t, meta: n } = F(e);
69
+ }, L = (e) => {
70
+ let { tree: t, meta: n } = I(e);
71
71
  return {
72
- html: E(t),
72
+ html: D(t),
73
73
  meta: n
74
74
  };
75
- }, L = (e) => {
76
- let { tree: t, meta: n } = F(e);
75
+ }, R = (e) => {
76
+ let { tree: t, meta: n } = I(e);
77
77
  return {
78
- stream: T(t, {
78
+ stream: E(t, {
79
79
  ...e.bootstrapModules ? { bootstrapModules: [...e.bootstrapModules] } : {},
80
80
  ...e.nonce === void 0 ? {} : { nonce: e.nonce },
81
81
  ...e.onShellReady ? { onShellReady: e.onShellReady } : {},
@@ -84,20 +84,20 @@ var k = async (e) => {
84
84
  }),
85
85
  meta: n
86
86
  };
87
- }, R = (e) => {
87
+ }, z = (e) => {
88
88
  if (!e) return "";
89
89
  let t = [];
90
- if (typeof e.title == "string" && t.push(`<title>${z(e.title)}</title>`), e.description && t.push(`<meta name="description" content="${B(e.description)}" />`), e.noIndex && t.push("<meta name=\"robots\" content=\"noindex, nofollow\" />"), e.canonical && t.push(`<link rel="canonical" href="${B(e.canonical)}" />`), e.tags) for (let n of e.tags) {
91
- let e = n.name ? `name="${B(n.name)}"` : n.property ? `property="${B(n.property)}"` : "";
92
- e && t.push(`<meta ${e} content="${B(n.content)}" />`);
90
+ if (typeof e.title == "string" && t.push(`<title>${B(e.title)}</title>`), e.description && t.push(`<meta name="description" content="${V(e.description)}" />`), e.noIndex && t.push("<meta name=\"robots\" content=\"noindex, nofollow\" />"), e.canonical && t.push(`<link rel="canonical" href="${V(e.canonical)}" />`), e.tags) for (let n of e.tags) {
91
+ let e = n.name ? `name="${V(n.name)}"` : n.property ? `property="${V(n.property)}"` : "";
92
+ e && t.push(`<meta ${e} content="${V(n.content)}" />`);
93
93
  }
94
94
  if (e.links) for (let n of e.links) {
95
95
  let e = [
96
- `rel="${B(n.rel)}"`,
97
- `href="${B(n.href)}"`,
98
- n.hreflang ? `hreflang="${B(n.hreflang)}"` : "",
99
- n.type ? `type="${B(n.type)}"` : "",
100
- n.title ? `title="${B(n.title)}"` : ""
96
+ `rel="${V(n.rel)}"`,
97
+ `href="${V(n.href)}"`,
98
+ n.hreflang ? `hreflang="${V(n.hreflang)}"` : "",
99
+ n.type ? `type="${V(n.type)}"` : "",
100
+ n.title ? `title="${V(n.title)}"` : ""
101
101
  ].filter(Boolean).join(" ");
102
102
  t.push(`<link ${e} />`);
103
103
  }
@@ -106,6 +106,6 @@ var k = async (e) => {
106
106
  t.push(`<script type="application/ld+json" data-voltro-page-jsonld>${e}<\/script>`);
107
107
  }
108
108
  return t.join("\n ");
109
- }, z = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), B = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
109
+ }, B = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), V = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), H = (e, t) => x(e, t);
110
110
  //#endregion
111
- export { c as ROUTER_STATE_SCRIPT_ID, s as assertDeferralSupported, A as beginStoreSeeds, M as currentPreloadSeeds, j as currentStoreSeeds, l as deferredId, r as deferredSettleScript, o as encodeRouterState, a as isDeferredLoaderResult, h as parseCookieHeader, i as prepareDeferredLoaderData, t as renderDeferredRegistryScript, R as renderMetaToHtml, I as renderPageToHtml, L as renderPageToStream, N as renderRouterStateScript, x as seedPreloadedSubscription, S as seedPreloadedSubscriptionFailure, u as serialiseStateForInlining, k as withStoreSeeds };
111
+ export { c as ROUTER_STATE_SCRIPT_ID, s as assertDeferralSupported, j as beginStoreSeeds, N as currentPreloadSeeds, M as currentStoreSeeds, l as deferredId, r as deferredSettleScript, o as encodeRouterState, a as isDeferredLoaderResult, h as parseCookieHeader, i as prepareDeferredLoaderData, H as registerSsrApiDescriptors, t as renderDeferredRegistryScript, z as renderMetaToHtml, L as renderPageToHtml, R as renderPageToStream, P as renderRouterStateScript, S as seedPreloadedSubscription, C as seedPreloadedSubscriptionFailure, u as serialiseStateForInlining, A as withStoreSeeds };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/web",
3
- "version": "0.54.0",
3
+ "version": "0.56.0",
4
4
  "description": "The Voltro web framework — file-based routing, render modes (SSR / SSG / islands), the page-export contract, data hooks, and the browser mount.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -63,8 +63,8 @@
63
63
  "node": ">=24.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@voltro/client": "0.54.0",
67
- "@voltro/ui": "0.54.0"
66
+ "@voltro/client": "0.56.0",
67
+ "@voltro/ui": "0.56.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@effect/platform": "^0.97.0",