@takazudo/zfb 0.1.0-next.2

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 (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +207 -0
  4. package/bin/zfb.mjs +61 -0
  5. package/dist/config.d.ts +542 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +24 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/content.d.ts +231 -0
  10. package/dist/content.d.ts.map +1 -0
  11. package/dist/content.js +449 -0
  12. package/dist/content.js.map +1 -0
  13. package/dist/frontmatter.d.ts +23 -0
  14. package/dist/frontmatter.d.ts.map +1 -0
  15. package/dist/frontmatter.js +142 -0
  16. package/dist/frontmatter.js.map +1 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +21 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/island.d.ts +121 -0
  22. package/dist/island.d.ts.map +1 -0
  23. package/dist/island.js +273 -0
  24. package/dist/island.js.map +1 -0
  25. package/dist/jsx-types.d.ts +37 -0
  26. package/dist/jsx-types.d.ts.map +1 -0
  27. package/dist/jsx-types.js +12 -0
  28. package/dist/jsx-types.js.map +1 -0
  29. package/dist/paginate.d.ts +43 -0
  30. package/dist/paginate.d.ts.map +1 -0
  31. package/dist/paginate.js +44 -0
  32. package/dist/paginate.js.map +1 -0
  33. package/dist/plugins.d.ts +259 -0
  34. package/dist/plugins.d.ts.map +1 -0
  35. package/dist/plugins.js +42 -0
  36. package/dist/plugins.js.map +1 -0
  37. package/dist/runtime.d.ts +101 -0
  38. package/dist/runtime.d.ts.map +1 -0
  39. package/dist/runtime.js +454 -0
  40. package/dist/runtime.js.map +1 -0
  41. package/dist/types.d.ts +27 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/types.js +33 -0
  44. package/dist/types.js.map +1 -0
  45. package/package.json +98 -0
@@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AC,CAAC;AAC1C,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,aAAa,CAAC,KAA4B;IACxD,OAAO,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,iBAAiB,CAAC,KAA4B;IAC5D,OAAO,oBAAoB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,KAA4B;IACpD,OAAO,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,KAA4B;IACpD,OAAO,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,KAA4B;IACvD,OAAO,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,KAA4B;IACtD,OAAO,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,CAAC,EAAE,gBAAgB;IACnB,CAAC,EAAE,WAAW;IACd,MAAM,EAAE,aAAa;IACrB,UAAU,EAAE,iBAAiB;IAC7B,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;CACT,CAAC"}
@@ -0,0 +1,23 @@
1
+ /** Public shape returned by [`parseFrontmatter`]. */
2
+ export type ParsedFrontmatter = {
3
+ data: Record<string, unknown>;
4
+ body: string;
5
+ };
6
+ /**
7
+ * Parse a leading YAML-ish frontmatter block off a markdown document.
8
+ *
9
+ * **Public SDK surface.** Re-exported from `zfb/content` so consumers can
10
+ * write their own custom content loaders without re-implementing the
11
+ * (deliberately minimal) v0 frontmatter parser. The accepted grammar is
12
+ * documented at the top of this module.
13
+ *
14
+ * Handles:
15
+ * - empty frontmatter (`---\n---\nbody`) → `{ data: {}, body: "body" }`
16
+ * - file ending exactly with `---` (no trailing newline) → frontmatter
17
+ * parsed, body is empty.
18
+ *
19
+ * Returns `{ data: {}, body: <input> }` unchanged when no frontmatter
20
+ * fence is present, or when the opening fence has no matching closer.
21
+ */
22
+ export declare function parseFrontmatter(raw: string): ParsedFrontmatter;
23
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AA4BA,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CA2C/D"}
@@ -0,0 +1,142 @@
1
+ // `zfb/frontmatter` — public subpath for the frontmatter parser.
2
+ //
3
+ // BCI-3: `parseFrontmatter` lives in this dedicated subpath so consumers
4
+ // that only need frontmatter parsing can import it without pulling in
5
+ // `zfb/content`'s Node `fs` transitive dependency chain. Workers / edge
6
+ // bundlers reading user content from a CMS or KV store can therefore
7
+ // use this parser without bringing `node:fs/promises` into their bundle.
8
+ //
9
+ // The implementation lives directly in this module — `zfb/content`
10
+ // imports from here, not the other way around. Tests pin the absence of
11
+ // transitive `node:fs*` imports so a regression that re-introduces the
12
+ // fs dependency surfaces immediately.
13
+ //
14
+ // ---------------------------------------------------------------------------
15
+ // Minimal frontmatter parser. Intentionally NOT a full YAML implementation —
16
+ // the v0 surface accepts the subset documented below. This avoids pulling
17
+ // in `gray-matter` or `js-yaml` for what is, in v0, three field types:
18
+ //
19
+ // - `key: value` scalar (quoted strings unwrapped, ISO dates kept as strings)
20
+ // - `key:` followed by a block list of `- item` lines
21
+ // - blank lines and `#` comment lines are ignored
22
+ //
23
+ // Returns `{ data: {}, body: <input> }` unchanged when no frontmatter
24
+ // fence is present, or when the opening fence has no matching closer.
25
+ // ---------------------------------------------------------------------------
26
+ const FRONTMATTER_DELIM = "---";
27
+ /**
28
+ * Parse a leading YAML-ish frontmatter block off a markdown document.
29
+ *
30
+ * **Public SDK surface.** Re-exported from `zfb/content` so consumers can
31
+ * write their own custom content loaders without re-implementing the
32
+ * (deliberately minimal) v0 frontmatter parser. The accepted grammar is
33
+ * documented at the top of this module.
34
+ *
35
+ * Handles:
36
+ * - empty frontmatter (`---\n---\nbody`) → `{ data: {}, body: "body" }`
37
+ * - file ending exactly with `---` (no trailing newline) → frontmatter
38
+ * parsed, body is empty.
39
+ *
40
+ * Returns `{ data: {}, body: <input> }` unchanged when no frontmatter
41
+ * fence is present, or when the opening fence has no matching closer.
42
+ */
43
+ export function parseFrontmatter(raw) {
44
+ // Strip a leading BOM and normalise line endings before splitting.
45
+ const text = raw.replace(/^/, "").replace(/\r\n/g, "\n");
46
+ if (!text.startsWith(`${FRONTMATTER_DELIM}\n`)) {
47
+ return { data: {}, body: text };
48
+ }
49
+ const headerStart = FRONTMATTER_DELIM.length + 1; // after first "---\n"
50
+ // Search for the closing fence. Accept either `\n---\n` (frontmatter
51
+ // followed by body) or `\n---` at the very end of the document
52
+ // (frontmatter with no trailing newline). Start the search at
53
+ // `headerStart - 1` so the empty-frontmatter case `---\n---\n...`
54
+ // is detected (the `\n---` at index 3 immediately follows the opener).
55
+ const searchFrom = headerStart - 1;
56
+ let closeIdx = -1;
57
+ let bodyStart = -1;
58
+ let i = searchFrom;
59
+ while (i <= text.length - `\n${FRONTMATTER_DELIM}`.length) {
60
+ const candidate = text.indexOf(`\n${FRONTMATTER_DELIM}`, i);
61
+ if (candidate === -1)
62
+ break;
63
+ const afterFence = candidate + `\n${FRONTMATTER_DELIM}`.length;
64
+ if (afterFence === text.length) {
65
+ // `\n---` at end-of-string — frontmatter ends here, body is empty.
66
+ closeIdx = candidate;
67
+ bodyStart = afterFence;
68
+ break;
69
+ }
70
+ if (text.charAt(afterFence) === "\n") {
71
+ // `\n---\n` — body starts after the trailing newline.
72
+ closeIdx = candidate;
73
+ bodyStart = afterFence + 1;
74
+ break;
75
+ }
76
+ // `\n---` followed by more `-` (e.g. `\n----`) — keep searching.
77
+ i = candidate + 1;
78
+ }
79
+ if (closeIdx === -1 || bodyStart === -1) {
80
+ // Malformed frontmatter (no closing delimiter): treat as plain body.
81
+ return { data: {}, body: text };
82
+ }
83
+ const header = text.slice(headerStart, closeIdx);
84
+ const body = text.slice(bodyStart);
85
+ return { data: parseFrontmatterHeader(header), body };
86
+ }
87
+ function parseFrontmatterHeader(header) {
88
+ const out = {};
89
+ const lines = header.split("\n");
90
+ let i = 0;
91
+ while (i < lines.length) {
92
+ const line = lines[i] ?? "";
93
+ if (line.trim() === "" || line.trimStart().startsWith("#")) {
94
+ i++;
95
+ continue;
96
+ }
97
+ // Top-level keys are unindented `key: value` or `key:` (then list).
98
+ const m = /^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(line);
99
+ if (!m) {
100
+ i++;
101
+ continue;
102
+ }
103
+ const key = m[1];
104
+ const inlineValue = (m[2] ?? "").trim();
105
+ if (inlineValue === "") {
106
+ // Possible block list.
107
+ const list = [];
108
+ let j = i + 1;
109
+ while (j < lines.length) {
110
+ const next = lines[j] ?? "";
111
+ const itemMatch = /^\s*-\s+(.*)$/.exec(next);
112
+ if (!itemMatch)
113
+ break;
114
+ list.push(unwrapScalar((itemMatch[1] ?? "").trim()));
115
+ j++;
116
+ }
117
+ if (list.length > 0) {
118
+ out[key] = list;
119
+ i = j;
120
+ continue;
121
+ }
122
+ // Empty value with no list — record empty string for completeness.
123
+ out[key] = "";
124
+ i++;
125
+ continue;
126
+ }
127
+ out[key] = unwrapScalar(inlineValue);
128
+ i++;
129
+ }
130
+ return out;
131
+ }
132
+ function unwrapScalar(value) {
133
+ if (value.length >= 2) {
134
+ const first = value.charAt(0);
135
+ const last = value.charAt(value.length - 1);
136
+ if ((first === '"' && last === '"') || (first === "'" && last === "'")) {
137
+ return value.slice(1, -1);
138
+ }
139
+ }
140
+ return value;
141
+ }
142
+ //# sourceMappingURL=frontmatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,yEAAyE;AACzE,EAAE;AACF,mEAAmE;AACnE,wEAAwE;AACxE,uEAAuE;AACvE,sCAAsC;AACtC,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,8EAA8E;AAC9E,sDAAsD;AACtD,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAQhC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,mEAAmE;IACnE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,iBAAiB,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClC,CAAC;IACD,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAA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ATTR, resolveWhen, type IslandElement, type IslandProps, } from "./island.js";
2
+ export { scheduleHydrate, mountIslands, mountNewIslands, cancelPendingIslands, unmountIslands, } from "./runtime.js";
3
+ export type { IslandManifest, IslandManifestValue } from "./runtime.js";
4
+ export { DEFAULT_WHEN, isWhen, WHEN_VALUES, type When } from "./types.js";
5
+ export { definePlugin, type ZfbBuildHookContext, type ZfbDevMiddlewareContext, type ZfbDevMiddlewareHandler, type ZfbDevMiddlewareRequest, type ZfbDevMiddlewareResponse, type ZfbPlugin, type ZfbPluginLogger, } from "./plugins.js";
6
+ export { ContentBlockquote, ContentCode, ContentH2, ContentH3, ContentH4, ContentLink, ContentOl, ContentParagraph, ContentStrong, ContentTable, ContentUl, defaultComponents, type ContentComponentElement, type ContentComponentProps, } from "./content.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAW1E,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // Public entry point for the "@takazudo/zfb" package.
2
+ //
3
+ // User TSX pages reach this module via `import { Island } from "@takazudo/zfb"`.
4
+ // The hydration runtime (Sub 3) reaches the helper via
5
+ // `import { scheduleHydrate } from "@takazudo/zfb/runtime"` (or by inlining the
6
+ // same logic; coordinated separately).
7
+ export { ANONYMOUS_COMPONENT_NAME, HYDRATE_MARKER_ATTR, Island, SKIP_SSR_MARKER_ATTR, resolveWhen, } from "./island.js";
8
+ export { scheduleHydrate, mountIslands, mountNewIslands, cancelPendingIslands, unmountIslands, } from "./runtime.js";
9
+ export { DEFAULT_WHEN, isWhen, WHEN_VALUES } from "./types.js";
10
+ // `defaultComponents` (htmlOverrides convention) is re-exported from the
11
+ // root entry point so `import { defaultComponents } from "@takazudo/zfb"` is the
12
+ // canonical access path. Each named override is also re-exported so
13
+ // consumers can tree-shake-import a single one (`import { ContentLink } from "@takazudo/zfb"`)
14
+ // without dragging in the whole map.
15
+ // Plugin lifecycle types + `definePlugin` identity helper. Plugin
16
+ // authors typically import these from "@takazudo/zfb/plugins" but the
17
+ // root entry re-exports them so simple plugins can pull everything from
18
+ // one path.
19
+ export { definePlugin, } from "./plugins.js";
20
+ export { ContentBlockquote, ContentCode, ContentH2, ContentH3, ContentH4, ContentLink, ContentOl, ContentParagraph, ContentStrong, ContentTable, ContentUl, defaultComponents, } from "./content.js";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,iFAAiF;AACjF,uDAAuD;AACvD,gFAAgF;AAChF,uCAAuC;AAEvC,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,WAAW,GAGZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AAE1E,yEAAyE;AACzE,iFAAiF;AACjF,oEAAoE;AACpE,+FAA+F;AAC/F,qCAAqC;AACrC,kEAAkE;AAClE,sEAAsE;AACtE,wEAAwE;AACxE,YAAY;AACZ,OAAO,EACL,YAAY,GAQb,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,iBAAiB,GAGlB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,121 @@
1
+ import type { VNode } from "./jsx-types.js";
2
+ import { type When } from "./types.js";
3
+ export { resolveWhen } from "./types.js";
4
+ /**
5
+ * Marker attribute the SSR wrapper writes when the child component should
6
+ * be hydrated client-side. The hydration runtime queries
7
+ * `[data-${HYDRATE_MARKER_ATTR}]` to find islands.
8
+ */
9
+ export declare const HYDRATE_MARKER_ATTR = "data-zfb-island";
10
+ /**
11
+ * Marker attribute the SSR wrapper writes when SSR is being skipped (the
12
+ * client:only-equivalent path). The hydration runtime queries
13
+ * `[data-${SKIP_SSR_MARKER_ATTR}]` to find these placeholders and renders
14
+ * the real component into them on hydration — there is no server output
15
+ * to patch up.
16
+ */
17
+ export declare const SKIP_SSR_MARKER_ATTR = "data-zfb-island-skip-ssr";
18
+ /** Fallback name surfaced when child identity cannot be determined. */
19
+ export declare const ANONYMOUS_COMPONENT_NAME = "Anonymous";
20
+ /**
21
+ * Attribute the SSR wrapper writes to ferry the wrapped component's props
22
+ * across the SSR → hydrate boundary. The hydration runtime parses this
23
+ * with `JSON.parse` and forwards the result to the per-island `mount()`
24
+ * call so the hydrated component sees the same props the SSR pass did.
25
+ *
26
+ * Omitted entirely when the wrapped child has no own data props (other
27
+ * than `children`) — `readProps` already falls back to `{}` when the
28
+ * attribute is missing, and emitting `data-props=""` would just bloat
29
+ * the SSR markup.
30
+ */
31
+ export declare const PROPS_DATA_ATTR = "data-props";
32
+ /** Props for `<Island>`. */
33
+ export interface IslandProps {
34
+ /** Hydration scheduling strategy. Defaults to `"load"`. */
35
+ when?: When;
36
+ /**
37
+ * If supplied, switches the island into SSR-skip mode (Astro's
38
+ * `client:only` equivalent). The wrapper emits the
39
+ * `data-zfb-island-skip-ssr` marker, the heavy `children` are **not**
40
+ * evaluated server-side, and `ssrFallback` is rendered in their place.
41
+ * On hydration the client runtime swaps in the real component.
42
+ */
43
+ ssrFallback?: VNode;
44
+ /**
45
+ * Server-rendered children, hydrated client-side once `when` fires.
46
+ *
47
+ * Typed as `VNode` (structural union) rather than `ReactNode` so
48
+ * non-React frameworks can implement `IslandProps` without a React
49
+ * type dependency (BCI-4).
50
+ */
51
+ children?: VNode;
52
+ }
53
+ /**
54
+ * Public JSX-element shape returned by [`Island`]. Intentionally widened
55
+ * to a structural type so consumers don't infer through the internal
56
+ * `{ type, props, key }` VNode shape of either Preact or React. Both
57
+ * jsx-runtimes accept this object on either side of the boundary.
58
+ */
59
+ export type IslandElement = {
60
+ readonly type: string;
61
+ readonly props: Readonly<Record<string, unknown>>;
62
+ readonly key: unknown;
63
+ };
64
+ /**
65
+ * `<Island>` JSX wrapper.
66
+ *
67
+ * Returns a JSX element shape compatible with both Preact and React. The
68
+ * runtime tag is `"div"`. In the default (hydrate) mode the wrapper emits
69
+ * `data-zfb-island="ComponentName"` and `data-when="<resolved-when>"`. In
70
+ * SSR-skip mode (when `ssrFallback` is provided) it emits
71
+ * `data-zfb-island-skip-ssr="ComponentName"` instead and renders the
72
+ * fallback rather than the heavy child.
73
+ *
74
+ * The component-name string is derived from the child JSX element's type
75
+ * identity (`type.displayName ?? type.name`). For string-typed children
76
+ * (host elements) the tag name is used. If no usable identity can be
77
+ * recovered, [`ANONYMOUS_COMPONENT_NAME`] is used so the marker still
78
+ * lines up with the hydration shim's manifest lookup.
79
+ *
80
+ * The return type is the public [`IslandElement`] shape — the internal
81
+ * VNode structure is deliberately not leaked so consumers never type-infer
82
+ * through it.
83
+ */
84
+ export declare function Island(props: IslandProps): IslandElement;
85
+ /**
86
+ * Pull a component-name string out of a JSX child.
87
+ *
88
+ * Both Preact and React store rendered VNodes as plain objects whose
89
+ * `.type` field is either:
90
+ * - the component function (look at `displayName ?? name`),
91
+ * - or the host element tag name as a string.
92
+ *
93
+ * If `children` is an array (multiple children), the first child with a
94
+ * usable identity wins. This is intentional: the typical island shape is
95
+ * `<Island><Foo /></Island>` (single child); when the caller wraps a
96
+ * fragment-like list we still want a deterministic, debuggable name.
97
+ *
98
+ * Exported for tests; not re-exported from `index.ts`.
99
+ */
100
+ export declare function captureComponentName(children: unknown): string;
101
+ /**
102
+ * Serialize the wrapped child's data props as a JSON string the runtime
103
+ * can parse out of the `data-props` attribute on the Island marker div.
104
+ *
105
+ * Mirrors [`captureComponentName`]'s array handling: when `children` is
106
+ * an array (multiple JSX siblings), the first child whose own props
107
+ * yield a non-empty serialization wins. This keeps the "first
108
+ * identifiable child" contract consistent across both attributes —
109
+ * whatever the marker name points at is what the data-props payload
110
+ * describes.
111
+ *
112
+ * Returns `undefined` (not `"{}"` and not `""`) when no usable props
113
+ * exist. The runtime's `readProps` already maps a missing attribute to
114
+ * `{}`, so omitting the attribute keeps the SSR markup smaller and
115
+ * preserves the invariant that the attribute, when present, always
116
+ * parses to a non-empty record.
117
+ *
118
+ * Exported for tests; not re-exported from `index.ts`.
119
+ */
120
+ export declare function captureSerializableProps(children: unknown): string | undefined;
121
+ //# sourceMappingURL=island.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"island.d.ts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Island when="...">` JSX wrapper.
2
+ //
3
+ // The wrapper is intentionally JSX-runtime-agnostic: it does not import
4
+ // preact or react and never calls h() / createElement directly. Instead it
5
+ // returns a plain object with a fixed shape that both Preact's and React's
6
+ // jsx-runtime accept when the JSX transform turns the call site into a
7
+ // jsx(Island, props) invocation.
8
+ //
9
+ // At build time, running through the SSR renderer (embedded V8 host):
10
+ //
11
+ // <Island when="visible"><Counter /></Island>
12
+ //
13
+ // renders as:
14
+ //
15
+ // <div data-zfb-island="Counter" data-when="visible">
16
+ // <Counter />
17
+ // </div>
18
+ //
19
+ // The component-name attribute (`data-zfb-island="ComponentName"`) is filled
20
+ // in *here* by reading the child's JSX type identity (`displayName` first,
21
+ // then `name`). Sub 3's hydration shim then `querySelectorAll`s these
22
+ // markers and looks each one up in the islands manifest produced by the
23
+ // scanner (see `crates/zfb-islands/src/manifest.rs` for the contract).
24
+ //
25
+ // SSR-skip mode: when the caller passes `ssrFallback`, the heavy child is
26
+ // **not** evaluated at SSR time. Instead the wrapper emits a different
27
+ // marker:
28
+ //
29
+ // <Island ssrFallback={<div>Loading…</div>}><HeavyClientOnly /></Island>
30
+ // →
31
+ // <div data-zfb-island-skip-ssr="HeavyClientOnly">
32
+ // <div>Loading…</div>
33
+ // </div>
34
+ //
35
+ // On the client the hydration runtime distinguishes hydrate vs. render by
36
+ // which marker attribute is present. This is the equivalent of Astro's
37
+ // `client:only="preact"`.
38
+ //
39
+ // When validation: in development we console.warn for unknown `when`
40
+ // values and fall back to the default. In production we silently fall
41
+ // back to keep the bundle path small.
42
+ import { resolveWhen } from "./types.js";
43
+ // Re-export `resolveWhen` for back-compat: tests and downstream consumers
44
+ // historically imported it from `./island.js`. The implementation lives in
45
+ // `./types.js` so the runtime scheduler can pull it in without dragging
46
+ // the JSX wrapper along for the ride.
47
+ export { resolveWhen } from "./types.js";
48
+ /**
49
+ * Marker attribute the SSR wrapper writes when the child component should
50
+ * be hydrated client-side. The hydration runtime queries
51
+ * `[data-${HYDRATE_MARKER_ATTR}]` to find islands.
52
+ */
53
+ export const HYDRATE_MARKER_ATTR = "data-zfb-island";
54
+ /**
55
+ * Marker attribute the SSR wrapper writes when SSR is being skipped (the
56
+ * client:only-equivalent path). The hydration runtime queries
57
+ * `[data-${SKIP_SSR_MARKER_ATTR}]` to find these placeholders and renders
58
+ * the real component into them on hydration — there is no server output
59
+ * to patch up.
60
+ */
61
+ export const SKIP_SSR_MARKER_ATTR = "data-zfb-island-skip-ssr";
62
+ /** Fallback name surfaced when child identity cannot be determined. */
63
+ export const ANONYMOUS_COMPONENT_NAME = "Anonymous";
64
+ /**
65
+ * Attribute the SSR wrapper writes to ferry the wrapped component's props
66
+ * across the SSR → hydrate boundary. The hydration runtime parses this
67
+ * with `JSON.parse` and forwards the result to the per-island `mount()`
68
+ * call so the hydrated component sees the same props the SSR pass did.
69
+ *
70
+ * Omitted entirely when the wrapped child has no own data props (other
71
+ * than `children`) — `readProps` already falls back to `{}` when the
72
+ * attribute is missing, and emitting `data-props=""` would just bloat
73
+ * the SSR markup.
74
+ */
75
+ export const PROPS_DATA_ATTR = "data-props";
76
+ /**
77
+ * `<Island>` JSX wrapper.
78
+ *
79
+ * Returns a JSX element shape compatible with both Preact and React. The
80
+ * runtime tag is `"div"`. In the default (hydrate) mode the wrapper emits
81
+ * `data-zfb-island="ComponentName"` and `data-when="<resolved-when>"`. In
82
+ * SSR-skip mode (when `ssrFallback` is provided) it emits
83
+ * `data-zfb-island-skip-ssr="ComponentName"` instead and renders the
84
+ * fallback rather than the heavy child.
85
+ *
86
+ * The component-name string is derived from the child JSX element's type
87
+ * identity (`type.displayName ?? type.name`). For string-typed children
88
+ * (host elements) the tag name is used. If no usable identity can be
89
+ * recovered, [`ANONYMOUS_COMPONENT_NAME`] is used so the marker still
90
+ * lines up with the hydration shim's manifest lookup.
91
+ *
92
+ * The return type is the public [`IslandElement`] shape — the internal
93
+ * VNode structure is deliberately not leaked so consumers never type-infer
94
+ * through it.
95
+ */
96
+ export function Island(props) {
97
+ const when = resolveWhen(props.when);
98
+ const componentName = captureComponentName(props.children);
99
+ const isSkipSsr = props.ssrFallback !== undefined;
100
+ // Always source props from `props.children` (the heavy component VNode),
101
+ // never from `ssrFallback` — the fallback is just SSR placeholder markup;
102
+ // the hydrated component is the child, so its props are what `mount()`
103
+ // needs at hydrate time. (Same rationale as `captureComponentName`.)
104
+ const dataProps = captureSerializableProps(props.children);
105
+ if (isSkipSsr) {
106
+ const skipSsrProps = {
107
+ [SKIP_SSR_MARKER_ATTR]: componentName,
108
+ "data-when": when,
109
+ children: props.ssrFallback ?? null,
110
+ };
111
+ if (dataProps !== undefined)
112
+ skipSsrProps[PROPS_DATA_ATTR] = dataProps;
113
+ return makeVNode({
114
+ type: "div",
115
+ props: skipSsrProps,
116
+ key: null,
117
+ });
118
+ }
119
+ const hydrateProps = {
120
+ [HYDRATE_MARKER_ATTR]: componentName,
121
+ "data-when": when,
122
+ children: props.children,
123
+ };
124
+ if (dataProps !== undefined)
125
+ hydrateProps[PROPS_DATA_ATTR] = dataProps;
126
+ return makeVNode({
127
+ type: "div",
128
+ props: hydrateProps,
129
+ key: null,
130
+ });
131
+ }
132
+ /**
133
+ * Construct the structural JSX-element shape with `constructor` set to
134
+ * `undefined`.
135
+ *
136
+ * Why: `preact-render-to-string` (and Preact's diff path) recognise a
137
+ * VNode by checking `vnode.constructor === undefined`. A plain object
138
+ * literal `{ type, props, key }` inherits `Object` for `.constructor`,
139
+ * so the renderer treats it as foreign data and emits no markup —
140
+ * which would silently strip every `<Island>` from SSG output. Marking
141
+ * `constructor: undefined` is the documented sentinel that both
142
+ * Preact's and React's renderers treat as a structural VNode.
143
+ *
144
+ * The cast back to `IslandElement` keeps the public type tight; the
145
+ * extra runtime field is JS-only and is invisible to type consumers.
146
+ */
147
+ function makeVNode(shape) {
148
+ const v = shape;
149
+ v.constructor = undefined;
150
+ return shape;
151
+ }
152
+ /**
153
+ * Pull a component-name string out of a JSX child.
154
+ *
155
+ * Both Preact and React store rendered VNodes as plain objects whose
156
+ * `.type` field is either:
157
+ * - the component function (look at `displayName ?? name`),
158
+ * - or the host element tag name as a string.
159
+ *
160
+ * If `children` is an array (multiple children), the first child with a
161
+ * usable identity wins. This is intentional: the typical island shape is
162
+ * `<Island><Foo /></Island>` (single child); when the caller wraps a
163
+ * fragment-like list we still want a deterministic, debuggable name.
164
+ *
165
+ * Exported for tests; not re-exported from `index.ts`.
166
+ */
167
+ export function captureComponentName(children) {
168
+ if (Array.isArray(children)) {
169
+ for (const child of children) {
170
+ const name = nameFromSingle(child);
171
+ if (name)
172
+ return name;
173
+ }
174
+ return ANONYMOUS_COMPONENT_NAME;
175
+ }
176
+ return nameFromSingle(children) || ANONYMOUS_COMPONENT_NAME;
177
+ }
178
+ function nameFromSingle(child) {
179
+ if (!child || typeof child !== "object")
180
+ return "";
181
+ const c = child;
182
+ const t = c.type;
183
+ if (typeof t === "function") {
184
+ const fn = t;
185
+ if (typeof fn.displayName === "string" && fn.displayName)
186
+ return fn.displayName;
187
+ if (typeof fn.name === "string" && fn.name)
188
+ return fn.name;
189
+ return "";
190
+ }
191
+ if (typeof t === "string" && t)
192
+ return t;
193
+ return "";
194
+ }
195
+ /**
196
+ * Serialize the wrapped child's data props as a JSON string the runtime
197
+ * can parse out of the `data-props` attribute on the Island marker div.
198
+ *
199
+ * Mirrors [`captureComponentName`]'s array handling: when `children` is
200
+ * an array (multiple JSX siblings), the first child whose own props
201
+ * yield a non-empty serialization wins. This keeps the "first
202
+ * identifiable child" contract consistent across both attributes —
203
+ * whatever the marker name points at is what the data-props payload
204
+ * describes.
205
+ *
206
+ * Returns `undefined` (not `"{}"` and not `""`) when no usable props
207
+ * exist. The runtime's `readProps` already maps a missing attribute to
208
+ * `{}`, so omitting the attribute keeps the SSR markup smaller and
209
+ * preserves the invariant that the attribute, when present, always
210
+ * parses to a non-empty record.
211
+ *
212
+ * Exported for tests; not re-exported from `index.ts`.
213
+ */
214
+ export function captureSerializableProps(children) {
215
+ if (Array.isArray(children)) {
216
+ for (const child of children) {
217
+ const json = propsFromSingle(child);
218
+ if (json !== undefined)
219
+ return json;
220
+ }
221
+ return undefined;
222
+ }
223
+ return propsFromSingle(children);
224
+ }
225
+ function propsFromSingle(child) {
226
+ if (!child || typeof child !== "object")
227
+ return undefined;
228
+ const c = child;
229
+ const raw = c.props;
230
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
231
+ return undefined;
232
+ // Exclude `children` from the serialized payload: the SSR pass already
233
+ // emitted the rendered children into the DOM (the hydration target),
234
+ // and JSX child nodes are typically VNode trees with non-serializable
235
+ // shapes (functions, circular refs) that would either bloat the
236
+ // payload or throw inside JSON.stringify. The hydration runtime
237
+ // re-renders into the existing DOM, so it does not need the JSX
238
+ // children replayed through props.
239
+ //
240
+ // Note: JSON.stringify already silently drops function / symbol /
241
+ // undefined values from the output, so those don't need explicit
242
+ // pre-filtering here.
243
+ const propsRecord = raw;
244
+ let hasOwn = false;
245
+ const filtered = {};
246
+ for (const key of Object.keys(propsRecord)) {
247
+ if (key === "children")
248
+ continue;
249
+ filtered[key] = propsRecord[key];
250
+ hasOwn = true;
251
+ }
252
+ if (!hasOwn)
253
+ return undefined;
254
+ let json;
255
+ try {
256
+ json = JSON.stringify(filtered);
257
+ }
258
+ catch {
259
+ // Circular references, BigInt, or any other non-serializable input
260
+ // — silently fall through (no `data-props`) rather than ship a
261
+ // partial payload. The runtime already handles the missing-attribute
262
+ // case by returning `{}` from `readProps`.
263
+ return undefined;
264
+ }
265
+ // JSON.stringify can also return `undefined` (when the top-level value
266
+ // serializes to nothing) or `"{}"` (when every key was a function /
267
+ // symbol / undefined and got dropped). Treat both as "nothing useful
268
+ // to ship" so the marker stays clean.
269
+ if (json === undefined || json === "{}")
270
+ return undefined;
271
+ return json;
272
+ }
273
+ //# sourceMappingURL=island.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"island.js","sourceRoot":"","sources":["../src/island.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;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