@uniweb/build 0.14.21 → 0.14.22
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 +6 -6
- package/src/site/content-collector.js +33 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.22",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"js-yaml": "^4.1.0",
|
|
60
60
|
"sharp": "^0.33.2",
|
|
61
61
|
"yaml": "^2.5.0",
|
|
62
|
-
"@uniweb/
|
|
63
|
-
"@uniweb/
|
|
62
|
+
"@uniweb/theming": "0.1.4",
|
|
63
|
+
"@uniweb/content-writer": "0.2.6"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
|
-
"@uniweb/runtime": "0.8.20",
|
|
67
66
|
"@uniweb/content-reader": "1.1.12",
|
|
68
|
-
"@uniweb/schemas": "0.2.4"
|
|
67
|
+
"@uniweb/schemas": "0.2.4",
|
|
68
|
+
"@uniweb/runtime": "0.8.21"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@tailwindcss/vite": "^4.0.0",
|
|
75
75
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
76
76
|
"vite-plugin-svgr": "^4.0.0",
|
|
77
|
-
"@uniweb/core": "0.7.
|
|
77
|
+
"@uniweb/core": "0.7.15"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"vite": {
|
|
@@ -1823,29 +1823,49 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
|
|
|
1823
1823
|
* @param {string} foundationPath - Path to foundation directory
|
|
1824
1824
|
* @returns {Promise<{ vars: Object, layoutNames: Set<string> }>}
|
|
1825
1825
|
*/
|
|
1826
|
-
async function loadFoundationInfo(foundationPath) {
|
|
1826
|
+
export async function loadFoundationInfo(foundationPath) {
|
|
1827
1827
|
if (!foundationPath) return { vars: {}, layoutNames: new Set() }
|
|
1828
1828
|
|
|
1829
1829
|
// Try dist/meta/schema.json first (built foundation), then root schema.json
|
|
1830
1830
|
const distSchemaPath = join(foundationPath, 'dist', 'meta', 'schema.json')
|
|
1831
1831
|
const rootSchemaPath = join(foundationPath, 'schema.json')
|
|
1832
1832
|
|
|
1833
|
-
const schemaPath = existsSync(distSchemaPath)
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1833
|
+
const schemaPath = existsSync(distSchemaPath)
|
|
1834
|
+
? distSchemaPath
|
|
1835
|
+
: existsSync(rootSchemaPath)
|
|
1836
|
+
? rootSchemaPath
|
|
1837
|
+
: null
|
|
1838
|
+
|
|
1839
|
+
if (schemaPath) {
|
|
1840
|
+
try {
|
|
1841
|
+
const schemaContent = await readFile(schemaPath, 'utf8')
|
|
1842
|
+
const schema = JSON.parse(schemaContent)
|
|
1843
|
+
// Foundation config is in _self, support both 'vars' (new) and 'themeVars' (legacy)
|
|
1844
|
+
const vars = schema._self?.vars || schema._self?.themeVars || schema.themeVars || {}
|
|
1845
|
+
// Layout names from _layouts (keys are layout component names)
|
|
1846
|
+
const layoutNames = new Set(schema._layouts ? Object.keys(schema._layouts) : [])
|
|
1847
|
+
return { vars, layoutNames }
|
|
1848
|
+
} catch (err) {
|
|
1849
|
+
console.warn('[content-collector] Failed to load foundation schema:', err.message)
|
|
1850
|
+
// Fall through to the source-config fallback below.
|
|
1851
|
+
}
|
|
1837
1852
|
}
|
|
1838
1853
|
|
|
1854
|
+
// No built schema.json — the normal state for `uniweb dev` on a bundled-mode
|
|
1855
|
+
// site that was never built (dev doesn't build the foundation to dist/). Read
|
|
1856
|
+
// the foundation's declared vars straight from its source config
|
|
1857
|
+
// (main.js / foundation.js) so theme tokens like --section-padding-y are
|
|
1858
|
+
// defined; without them, components using py-[var(--section-padding-y)] render
|
|
1859
|
+
// with collapsed section spacing. Layouts aren't resolved from source (they
|
|
1860
|
+
// need component discovery), but they aren't needed to build the theme CSS.
|
|
1839
1861
|
try {
|
|
1840
|
-
const
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1845
|
-
const layoutNames = new Set(schema._layouts ? Object.keys(schema._layouts) : [])
|
|
1846
|
-
return { vars, layoutNames }
|
|
1862
|
+
const { resolveFoundationSrcPath } = await import('../utils/foundation-source-root.js')
|
|
1863
|
+
const { loadFoundationConfig } = await import('../schema.js')
|
|
1864
|
+
const srcDir = resolveFoundationSrcPath(foundationPath)
|
|
1865
|
+
const config = await loadFoundationConfig(srcDir)
|
|
1866
|
+
return { vars: config?.vars || {}, layoutNames: new Set() }
|
|
1847
1867
|
} catch (err) {
|
|
1848
|
-
console.warn('[content-collector] Failed to load foundation
|
|
1868
|
+
console.warn('[content-collector] Failed to load foundation source config:', err.message)
|
|
1849
1869
|
return { vars: {}, layoutNames: new Set() }
|
|
1850
1870
|
}
|
|
1851
1871
|
}
|