@uniweb/build 0.8.7 → 0.8.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -52,7 +52,7 @@
52
52
  "optionalDependencies": {
53
53
  "@uniweb/content-reader": "1.1.4",
54
54
  "@uniweb/schemas": "0.2.1",
55
- "@uniweb/runtime": "0.6.5"
55
+ "@uniweb/runtime": "0.6.6"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
package/src/prerender.js CHANGED
@@ -483,7 +483,7 @@ function renderBackground(background) {
483
483
  * Mirrors BlockRenderer.jsx but without hooks (no runtime data fetching in SSR).
484
484
  * block.dataLoading is always false at prerender time — runtime fetches only happen client-side.
485
485
  */
486
- function renderBlock(block) {
486
+ function renderBlock(block, { pure = false } = {}) {
487
487
  const Component = block.initComponent()
488
488
 
489
489
  if (!Component) {
@@ -518,6 +518,13 @@ function renderBlock(block) {
518
518
  }
519
519
  }
520
520
 
521
+ const componentProps = { content, params, block }
522
+
523
+ // Pure mode: render component without section wrapper (used by ChildBlocks)
524
+ if (pure) {
525
+ return React.createElement(Component, componentProps)
526
+ }
527
+
521
528
  // Background handling (mirrors BlockRenderer.jsx)
522
529
  const { background, ...wrapperProps } = getWrapperProps(block)
523
530
 
@@ -537,8 +544,6 @@ function renderBlock(block) {
537
544
  // Use Component.as as the wrapper tag (default: 'section')
538
545
  const wrapperTag = Component.as || 'section'
539
546
 
540
- const componentProps = { content, params, block }
541
-
542
547
  if (hasBackground) {
543
548
  return React.createElement(wrapperTag, wrapperProps,
544
549
  renderBackground(background),
@@ -795,6 +800,17 @@ export async function prerenderSite(siteDir, options = {}) {
795
800
  uniweb.foundationConfig.layoutMeta = foundation.default.layoutMeta
796
801
  }
797
802
 
803
+ // Set childBlockRenderer so foundation components using ChildBlocks/Visual
804
+ // can render child blocks and insets during prerender (inline, no hooks)
805
+ uniweb.childBlockRenderer = function InlineChildBlocks({ blocks, from, pure = false }) {
806
+ const blockList = blocks || from?.childBlocks || []
807
+ return blockList.map((childBlock, index) =>
808
+ React.createElement(React.Fragment, { key: childBlock.id || index },
809
+ renderBlock(childBlock, { pure })
810
+ )
811
+ )
812
+ }
813
+
798
814
  // Pre-fetch icons for SSR embedding
799
815
  await prefetchIcons(siteContent, uniweb, onProgress)
800
816
 
package/src/schema.js CHANGED
@@ -243,22 +243,26 @@ async function discoverSectionsInPath(srcDir, sectionsRelPath) {
243
243
  // Discover directories at root
244
244
  for (const entry of entries) {
245
245
  if (!entry.isDirectory()) continue
246
- if (!isComponentFileName(entry.name)) continue
247
246
 
248
247
  const dirPath = join(fullPath, entry.name)
249
248
  const relativePath = join(sectionsRelPath, entry.name)
250
- const result = await loadComponentMeta(dirPath)
251
249
 
252
- if (result && result.meta) {
253
- // Has meta.js — use explicit meta
254
- if (result.meta.hidden) continue
255
- components[entry.name] = buildComponentEntry(entry.name, relativePath, result.meta)
256
- } else if (hasEntryFile(dirPath, entry.name)) {
257
- // No meta.js but has entry file implicit section type at root
258
- components[entry.name] = buildComponentEntry(entry.name, relativePath, createImplicitMeta(entry.name))
250
+ // PascalCase directories are addressable section types at root
251
+ if (isComponentFileName(entry.name)) {
252
+ const result = await loadComponentMeta(dirPath)
253
+
254
+ if (result && result.meta) {
255
+ // Has meta.js — use explicit meta
256
+ if (result.meta.hidden) continue
257
+ components[entry.name] = buildComponentEntry(entry.name, relativePath, result.meta)
258
+ } else if (hasEntryFile(dirPath, entry.name)) {
259
+ // No meta.js but has entry file — implicit section type at root
260
+ components[entry.name] = buildComponentEntry(entry.name, relativePath, createImplicitMeta(entry.name))
261
+ }
259
262
  }
260
263
 
261
- // Recurse into subdirectories for nested section types (meta.js required)
264
+ // Always recurse lowercase directories (e.g. insets/) may contain
265
+ // nested section types with meta.js
262
266
  await discoverNestedSections(srcDir, dirPath, relativePath, components)
263
267
  }
264
268