@bettercms-ai/preview-runtime 0.2.0 → 0.4.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/README.md CHANGED
@@ -42,12 +42,33 @@ A component does not have to be a standalone file with its fields as props. A se
42
42
  `npx @bettercms-ai/convert --componentize` extracted from a page (a file starting
43
43
  `// @bettercms-ai/convert section v…`) is recognised by that marker and rendered with its section contract:
44
44
  `<Section blockId="bcms-preview" overrides={props} page={{}} />`, so the live props arrive as the instance's
45
- own copy. Record those sources with the MCP tool `submit_componentize_receipt`, or `set_component_source`
46
- with `kind: "section"` for a section written by hand to the same contract.
45
+ own copy.
46
+
47
+ ## Components with no file
48
+
49
+ A component placed on a page, or used in the project Layout (navigation, footer), needs no recorded file.
50
+ The manifest lists it as `kind: "page"`; the preview renders that real route of your app — its loops, child
51
+ components, collections and page styles exactly as deployed — keeps only the component's own element
52
+ (`data-bcms-block`, else the element holding its fields, else the layout's `<header>`/`<footer>`), and writes
53
+ the live props onto it through the same `data-bcms-field` / `data-bcms-layout-field` / `data-bcms-props`
54
+ attributes the site already declares. A recorded file still wins when there is one.
55
+
56
+ v1 limits: scripts inside the kept element do not run, so a client island renders its server HTML without
57
+ hydrating (validation is unaffected). The Next.js page path (`render` → `render-page`) is untested against a
58
+ real Next app yet; Astro is verified.
47
59
 
48
60
  A failed validation reports what broke — the app server's own error lines first — and the dashboard shows
49
61
  it under "Runtime + console".
50
62
 
63
+ ## Batch validation
64
+
65
+ One run can validate several components against a single build. When the dispatch carries a `batch`
66
+ (`BCMS_BATCH`, a JSON array of `{ requestId, componentId, familyKey, nativeViewports }`), the validator builds and
67
+ uploads the runtime once, starts one browser, and validates each component in turn — a component that cannot be
68
+ validated is reported for that component and the rest carry on. Without `BCMS_BATCH` it validates the single
69
+ component named by `BCMS_REQUEST_ID` / `BCMS_COMPONENT_ID` / `BCMS_FAMILY_KEY` / `BCMS_NATIVE_VIEWPORTS`, as
70
+ before. The step fails when any component could not be validated.
71
+
51
72
  ## How a preview renders
52
73
 
53
74
  - **Astro**: built with `output: "server"` and `@astrojs/node`, so `.astro` components render on the