@homepages/template-kit 0.7.0 → 0.8.0-dev-20260717154644

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @homepages/template-kit
2
2
 
3
+ ## 0.8.0-dev-20260717154644
4
+
5
+ ### Minor Changes
6
+
7
+ - 3f9d98e: `renderSectionHtml` now emits hydration-ready markup (`renderToString`) instead of
8
+ static markup. Sections carrying a `"use client"` island could not hydrate in
9
+ `template-kit dev`, because static markup strips the markers the island runtime
10
+ needs. Rendered HTML gains React's `<!-- -->` text separators, so any test
11
+ asserting exact HTML from `@homepages/template-kit/ssr` — or from `template-kit
12
+ check` — needs its expectation updated.
13
+
3
14
  ## 0.7.0
4
15
 
5
16
  ### Minor Changes
@@ -1,14 +1,10 @@
1
1
  import { FixtureModuleShape, buildInvariantFixtures } from "../../../schema/fixture-schema.js";
2
2
  import { loadSection } from "../loader.js";
3
3
  import { flattenLayout } from "../../../schema/rows.js";
4
+ import { renderSectionHtml } from "../../../ssr.js";
4
5
  import { checkRenderInvariants } from "../render-invariants.js";
5
- import { createElement } from "react";
6
- import { renderToStaticMarkup } from "react-dom/server";
7
6
 
8
7
  //#region src/cli/check/stages/render.ts
9
- function renderSectionHtml(renderer, props) {
10
- return renderToStaticMarkup(createElement(renderer, props));
11
- }
12
8
  const SLOT_ID_RE = /data-slot-id="([^"]*)"/g;
13
9
  function renderSlotOrder(html) {
14
10
  const seen = /* @__PURE__ */ new Set();
@@ -98,4 +94,4 @@ async function renderStage(workspaceRoot, template) {
98
94
  }
99
95
 
100
96
  //#endregion
101
- export { checkSidebarOrder, renderSectionHtml, renderStage };
97
+ export { checkSidebarOrder, renderStage };
@@ -1,13 +1,12 @@
1
1
  import { FixtureModuleShape, buildFixtureSet } from "../../../../schema/fixture-schema.js";
2
2
  import { TemplateManifest } from "../../../../schema/manifest.js";
3
3
  import { loadSection } from "../../loader.js";
4
+ import { renderSectionHtml } from "../../../../ssr.js";
4
5
  import { resolveSectionRef } from "../../../../schema/resolve-section-ref.js";
5
6
  import { materializeSection } from "./orchestrator.js";
6
7
  import { resolveAnchorMap } from "../../../../schema/section-nav.js";
7
- import { createElement } from "react";
8
8
  import { join } from "node:path";
9
9
  import { readFile } from "node:fs/promises";
10
- import { renderToStaticMarkup } from "react-dom/server";
11
10
 
12
11
  //#region src/cli/check/stages/validate/nav-contract.ts
13
12
  const ALLOWED_EXTERNAL_ANCHORS = ["#privacy-policy"];
@@ -75,7 +74,7 @@ async function assertNavContract(workspaceRoot, template) {
75
74
  selfAnchor: anchor
76
75
  }).find((f) => f.id === "typical");
77
76
  if (!base) throw new Error(`Template "${template.key}": section "${section.name}" has no "typical" base fixture.`);
78
- html += renderToStaticMarkup(createElement(rendererByName.get(section.name), {
77
+ html += renderSectionHtml(rendererByName.get(section.name), {
79
78
  slots: base.props.slots,
80
79
  options: base.props.options,
81
80
  nav: {
@@ -83,7 +82,7 @@ async function assertNavContract(workspaceRoot, template) {
83
82
  anchors
84
83
  },
85
84
  variants: base.props.variants
86
- }));
85
+ });
87
86
  }
88
87
  const violations = collectNavViolations(html, ALLOWED_EXTERNAL_ANCHORS);
89
88
  if (violations.length > 0) throw new Error(`Template "${template.key}": nav link(s) resolve to no composed section id: ${violations.join(", ")}.`);
@@ -30,6 +30,7 @@ function decode(s) {
30
30
  return s.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#39;/g, "'");
31
31
  }
32
32
  function parseHtml(html) {
33
+ html = html.replace(/<!--[\s\S]*?-->/g, "");
33
34
  const root = {
34
35
  tag: "#root",
35
36
  classes: [],
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.7.0";
2
+ var version = "0.8.0-dev-20260717154644";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/ssr.d.ts CHANGED
@@ -25,7 +25,10 @@ declare const nativeSectionLoader: SectionModuleLoader;
25
25
  * contract files; it defaults to native dynamic import.
26
26
  */
27
27
  declare function loadSectionBundle(dir: string, load?: SectionModuleLoader): Promise<LoadedSection>;
28
- /** Render a resolved fixture's props to static markup — the byte-for-byte page render. */
28
+ /**
29
+ * Render a resolved fixture's props to hydration-ready HTML — the byte-for-byte
30
+ * page render.
31
+ */
29
32
  declare function renderSectionHtml(renderer: ComponentType<Record<string, unknown>>, props: Record<string, unknown>): string;
30
33
  //#endregion
31
34
  export { LoadedSection, SectionModuleLoader, findSectionIslands, hasClientDirective, isClientComponentFile, islandKey, islandTransformEsbuildPlugin, loadSectionBundle, nativeSectionLoader, renderSectionHtml, wrapClientModuleSource };
package/dist/ssr.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { FixtureModuleShape, buildFixtureSet, buildInvariantFixtures } from "./schema/fixture-schema.js";
2
2
  import { hasClientDirective } from "./eslint/is-client-file.js";
3
3
  import { isClientComponentFile, islandKey } from "./islands/detect.js";
4
- import { findSectionIslands } from "./islands/discover.js";
5
4
  import { wrapClientModuleSource } from "./islands/wrap.js";
5
+ import { findSectionIslands } from "./islands/discover.js";
6
6
  import { islandTransformEsbuildPlugin } from "./islands/esbuild-plugin.js";
7
7
  import { createElement } from "react";
8
8
  import { basename, join } from "node:path";
9
9
  import { pathToFileURL } from "node:url";
10
- import { renderToStaticMarkup } from "react-dom/server";
10
+ import { renderToString } from "react-dom/server";
11
11
 
12
12
  //#region src/ssr/index.ts
13
13
  const nativeSectionLoader = (dir, file) => import(pathToFileURL(join(dir, file)).href);
@@ -37,9 +37,12 @@ async function loadSectionBundle(dir, load = nativeSectionLoader) {
37
37
  schemaSlots: schemaMod.schema.slots
38
38
  };
39
39
  }
40
- /** Render a resolved fixture's props to static markup — the byte-for-byte page render. */
40
+ /**
41
+ * Render a resolved fixture's props to hydration-ready HTML — the byte-for-byte
42
+ * page render.
43
+ */
41
44
  function renderSectionHtml(renderer, props) {
42
- return renderToStaticMarkup(createElement(renderer, props));
45
+ return renderToString(createElement(renderer, props));
43
46
  }
44
47
 
45
48
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homepages/template-kit",
3
- "version": "0.7.0",
3
+ "version": "0.8.0-dev-20260717154644",
4
4
  "description": "Authoring kit for HomePages marketing-section templates: schema system, contract primitives, theme tokens, and the template-kit CLI.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",