@uniweb/build 0.7.5 → 0.8.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/package.json +1 -1
- package/src/foundation/config.js +5 -5
- package/src/generate-entry.js +4 -4
- package/src/schema.js +26 -27
- package/src/theme/css-generator.js +86 -55
- package/src/theme/processor.js +39 -3
- package/src/vite-foundation-plugin.js +8 -8
package/package.json
CHANGED
package/src/foundation/config.js
CHANGED
|
@@ -48,9 +48,9 @@ const DEFAULT_EXTERNALS = [
|
|
|
48
48
|
* @param {Object} [options={}] - Configuration options
|
|
49
49
|
* @param {string} [options.entry] - Entry point path (default: 'src/_entry.generated.js')
|
|
50
50
|
* @param {string} [options.fileName] - Output file name (default: 'foundation')
|
|
51
|
-
* @param {string[]} [options.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* @param {string[]} [options.sections] - Paths to scan for section types (relative to src/).
|
|
52
|
+
* Default: ['sections']
|
|
53
|
+
* Example: ['sections', 'sections/marketing']
|
|
54
54
|
* @param {string[]} [options.externals] - Additional packages to externalize
|
|
55
55
|
* @param {boolean} [options.includeDefaultExternals] - Include default externals (default: true)
|
|
56
56
|
* @param {Array} [options.plugins] - Additional Vite plugins
|
|
@@ -63,7 +63,7 @@ export async function defineFoundationConfig(options = {}) {
|
|
|
63
63
|
const {
|
|
64
64
|
entry = 'src/_entry.generated.js',
|
|
65
65
|
fileName = 'foundation',
|
|
66
|
-
|
|
66
|
+
sections: sectionPaths,
|
|
67
67
|
externals: additionalExternals = [],
|
|
68
68
|
includeDefaultExternals = true,
|
|
69
69
|
plugins: extraPlugins = [],
|
|
@@ -108,7 +108,7 @@ export async function defineFoundationConfig(options = {}) {
|
|
|
108
108
|
// Build the plugins array
|
|
109
109
|
// foundationPlugin handles entry generation and schema building
|
|
110
110
|
const plugins = [
|
|
111
|
-
foundationPlugin({ srcDir: 'src',
|
|
111
|
+
foundationPlugin({ srcDir: 'src', sections: sectionPaths }),
|
|
112
112
|
tailwind && tailwindcss(),
|
|
113
113
|
react(),
|
|
114
114
|
svgr(),
|
package/src/generate-entry.js
CHANGED
|
@@ -189,13 +189,13 @@ function detectComponentEntry(srcDir, componentPath, componentName) {
|
|
|
189
189
|
* @param {string} srcDir - Source directory
|
|
190
190
|
* @param {string} [outputPath] - Output file path (default: srcDir/_entry.generated.js)
|
|
191
191
|
* @param {Object} [options] - Options
|
|
192
|
-
* @param {string[]} [options.
|
|
192
|
+
* @param {string[]} [options.sectionPaths] - Paths to scan for section types (relative to srcDir)
|
|
193
193
|
*/
|
|
194
194
|
export async function generateEntryPoint(srcDir, outputPath = null, options = {}) {
|
|
195
|
-
const {
|
|
195
|
+
const { sectionPaths } = options
|
|
196
196
|
|
|
197
|
-
// Discover
|
|
198
|
-
const components = await discoverComponents(srcDir,
|
|
197
|
+
// Discover section types (includes meta from meta.js files)
|
|
198
|
+
const components = await discoverComponents(srcDir, sectionPaths)
|
|
199
199
|
const componentNames = Object.keys(components).sort()
|
|
200
200
|
|
|
201
201
|
if (componentNames.length === 0) {
|
package/src/schema.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Schema Discovery and Loading Utilities
|
|
3
3
|
*
|
|
4
|
-
* Discovers
|
|
4
|
+
* Discovers section type meta files and loads them for schema.json generation.
|
|
5
5
|
* Schema data is for editor-time only, not runtime.
|
|
6
6
|
*
|
|
7
7
|
* Discovery rules:
|
|
8
8
|
* - sections/ root: bare files and folders are addressable by default (implicit empty meta)
|
|
9
9
|
* - sections/ nested: meta.js required for addressability
|
|
10
|
-
* -
|
|
10
|
+
* - Additional paths (via config): meta.js required for addressability
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { readdir, readFile } from 'node:fs/promises'
|
|
@@ -22,9 +22,8 @@ const META_FILE_NAME = 'meta.js'
|
|
|
22
22
|
// Foundation config file name
|
|
23
23
|
const FOUNDATION_FILE_NAME = 'foundation.js'
|
|
24
24
|
|
|
25
|
-
// Default paths to scan for
|
|
26
|
-
|
|
27
|
-
const DEFAULT_COMPONENT_PATHS = ['sections', 'components']
|
|
25
|
+
// Default paths to scan for section types (relative to srcDir)
|
|
26
|
+
const DEFAULT_SECTION_PATHS = ['sections']
|
|
28
27
|
|
|
29
28
|
// Extensions recognized as component entry files
|
|
30
29
|
const COMPONENT_EXTENSIONS = new Set(['.jsx', '.tsx', '.js', '.ts'])
|
|
@@ -383,13 +382,13 @@ async function discoverNestedSections(srcDir, parentFullPath, parentRelPath, com
|
|
|
383
382
|
}
|
|
384
383
|
|
|
385
384
|
/**
|
|
386
|
-
* Discover
|
|
385
|
+
* Discover section types in a non-sections path (meta.js required)
|
|
387
386
|
*
|
|
388
387
|
* @param {string} srcDir - Source directory (e.g., 'src')
|
|
389
|
-
* @param {string} relativePath - Path relative to srcDir
|
|
390
|
-
* @returns {Object} Map of
|
|
388
|
+
* @param {string} relativePath - Path relative to srcDir
|
|
389
|
+
* @returns {Object} Map of sectionTypeName -> { name, path, ...meta }
|
|
391
390
|
*/
|
|
392
|
-
async function
|
|
391
|
+
async function discoverExplicitSectionsInPath(srcDir, relativePath) {
|
|
393
392
|
const fullPath = join(srcDir, relativePath)
|
|
394
393
|
|
|
395
394
|
if (!existsSync(fullPath)) {
|
|
@@ -426,30 +425,30 @@ async function discoverExplicitComponentsInPath(srcDir, relativePath) {
|
|
|
426
425
|
* For other paths: strict discovery (meta.js required).
|
|
427
426
|
*
|
|
428
427
|
* @param {string} srcDir - Source directory (e.g., 'src')
|
|
429
|
-
* @param {string[]} [
|
|
430
|
-
*
|
|
428
|
+
* @param {string[]} [sectionPaths] - Paths to scan for section types (relative to srcDir).
|
|
429
|
+
* Default: ['sections']
|
|
431
430
|
* @returns {Object} Map of sectionTypeName -> { name, path, ...meta }
|
|
432
431
|
*/
|
|
433
|
-
export async function discoverComponents(srcDir,
|
|
434
|
-
const
|
|
432
|
+
export async function discoverComponents(srcDir, sectionPaths = DEFAULT_SECTION_PATHS) {
|
|
433
|
+
const sections = {}
|
|
435
434
|
|
|
436
|
-
for (const relativePath of
|
|
435
|
+
for (const relativePath of sectionPaths) {
|
|
437
436
|
// Use relaxed discovery for the primary sections path
|
|
438
437
|
const found = relativePath === SECTIONS_PATH
|
|
439
438
|
? await discoverSectionsInPath(srcDir, relativePath)
|
|
440
|
-
: await
|
|
439
|
+
: await discoverExplicitSectionsInPath(srcDir, relativePath)
|
|
441
440
|
|
|
442
441
|
for (const [name, meta] of Object.entries(found)) {
|
|
443
|
-
if (
|
|
444
|
-
//
|
|
445
|
-
console.warn(`Warning:
|
|
442
|
+
if (sections[name]) {
|
|
443
|
+
// Section type already found in an earlier path — skip (first wins)
|
|
444
|
+
console.warn(`Warning: Section type "${name}" found in multiple paths. Using ${sections[name].path}, ignoring ${meta.path}`)
|
|
446
445
|
continue
|
|
447
446
|
}
|
|
448
|
-
|
|
447
|
+
sections[name] = meta
|
|
449
448
|
}
|
|
450
449
|
}
|
|
451
450
|
|
|
452
|
-
return
|
|
451
|
+
return sections
|
|
453
452
|
}
|
|
454
453
|
|
|
455
454
|
/**
|
|
@@ -461,17 +460,17 @@ export async function discoverComponents(srcDir, componentPaths = DEFAULT_COMPON
|
|
|
461
460
|
* - Configuration from foundation.js (vars, Layout, etc.)
|
|
462
461
|
*
|
|
463
462
|
* @param {string} srcDir - Source directory
|
|
464
|
-
* @param {string[]} [
|
|
463
|
+
* @param {string[]} [sectionPaths] - Paths to scan for section types
|
|
465
464
|
*/
|
|
466
|
-
export async function buildSchema(srcDir,
|
|
465
|
+
export async function buildSchema(srcDir, sectionPaths) {
|
|
467
466
|
// Load identity from package.json
|
|
468
467
|
const identity = await loadPackageJson(srcDir)
|
|
469
468
|
|
|
470
469
|
// Load configuration from foundation.js
|
|
471
470
|
const foundationConfig = await loadFoundationConfig(srcDir)
|
|
472
471
|
|
|
473
|
-
// Discover
|
|
474
|
-
const components = await discoverComponents(srcDir,
|
|
472
|
+
// Discover section types
|
|
473
|
+
const components = await discoverComponents(srcDir, sectionPaths)
|
|
475
474
|
|
|
476
475
|
// Discover layouts from src/layouts/
|
|
477
476
|
const layouts = await discoverLayoutsInPath(srcDir)
|
|
@@ -512,9 +511,9 @@ export async function buildSchema(srcDir, componentPaths) {
|
|
|
512
511
|
* Get list of section type names
|
|
513
512
|
*
|
|
514
513
|
* @param {string} srcDir - Source directory
|
|
515
|
-
* @param {string[]} [
|
|
514
|
+
* @param {string[]} [sectionPaths] - Paths to scan for section types
|
|
516
515
|
*/
|
|
517
|
-
export async function getExposedComponents(srcDir,
|
|
518
|
-
const components = await discoverComponents(srcDir,
|
|
516
|
+
export async function getExposedComponents(srcDir, sectionPaths) {
|
|
517
|
+
const components = await discoverComponents(srcDir, sectionPaths)
|
|
519
518
|
return Object.keys(components)
|
|
520
519
|
}
|
|
@@ -16,64 +16,82 @@ import { generatePalettes, formatOklch } from './shade-generator.js'
|
|
|
16
16
|
// These map abstract concepts to specific palette values
|
|
17
17
|
const DEFAULT_CONTEXT_TOKENS = {
|
|
18
18
|
light: {
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'text-muted': 'var(--neutral-600)',
|
|
24
|
-
'text-subtle': 'var(--neutral-500)',
|
|
19
|
+
'section': 'var(--neutral-50)',
|
|
20
|
+
'card': 'var(--neutral-100)',
|
|
21
|
+
'muted': 'var(--neutral-200)',
|
|
22
|
+
'body': 'var(--neutral-950)',
|
|
25
23
|
'heading': 'var(--neutral-900)',
|
|
26
|
-
'
|
|
27
|
-
'link-hover': 'var(--primary-700)',
|
|
24
|
+
'subtle': 'var(--neutral-600)',
|
|
28
25
|
'border': 'var(--neutral-200)',
|
|
29
|
-
'border-muted': 'var(--neutral-100)',
|
|
30
26
|
'ring': 'var(--primary-500)',
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
27
|
+
'link': 'var(--primary-600)',
|
|
28
|
+
'link-hover': 'var(--primary-700)',
|
|
29
|
+
'primary': 'var(--primary-600)',
|
|
30
|
+
'primary-foreground': 'white',
|
|
31
|
+
'primary-hover': 'var(--primary-700)',
|
|
32
|
+
'secondary': 'var(--neutral-100)',
|
|
33
|
+
'secondary-foreground': 'var(--neutral-900)',
|
|
34
|
+
'secondary-hover': 'var(--neutral-200)',
|
|
35
|
+
'success': '#16a34a',
|
|
36
|
+
'success-subtle': '#f0fdf4',
|
|
37
|
+
'warning': '#d97706',
|
|
38
|
+
'warning-subtle': '#fffbeb',
|
|
39
|
+
'error': '#dc2626',
|
|
40
|
+
'error-subtle': '#fef2f2',
|
|
41
|
+
'info': '#2563eb',
|
|
42
|
+
'info-subtle': '#eff6ff',
|
|
37
43
|
},
|
|
38
44
|
medium: {
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'text-muted': 'var(--neutral-700)',
|
|
44
|
-
'text-subtle': 'var(--neutral-600)',
|
|
45
|
+
'section': 'var(--neutral-100)',
|
|
46
|
+
'card': 'var(--neutral-200)',
|
|
47
|
+
'muted': 'var(--neutral-300)',
|
|
48
|
+
'body': 'var(--neutral-950)',
|
|
45
49
|
'heading': 'var(--neutral-900)',
|
|
46
|
-
'
|
|
47
|
-
'link-hover': 'var(--primary-700)',
|
|
50
|
+
'subtle': 'var(--neutral-700)',
|
|
48
51
|
'border': 'var(--neutral-300)',
|
|
49
|
-
'border-muted': 'var(--neutral-200)',
|
|
50
52
|
'ring': 'var(--primary-500)',
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
53
|
+
'link': 'var(--primary-600)',
|
|
54
|
+
'link-hover': 'var(--primary-700)',
|
|
55
|
+
'primary': 'var(--primary-600)',
|
|
56
|
+
'primary-foreground': 'white',
|
|
57
|
+
'primary-hover': 'var(--primary-700)',
|
|
58
|
+
'secondary': 'var(--neutral-200)',
|
|
59
|
+
'secondary-foreground': 'var(--neutral-900)',
|
|
60
|
+
'secondary-hover': 'var(--neutral-300)',
|
|
61
|
+
'success': '#16a34a',
|
|
62
|
+
'success-subtle': '#f0fdf4',
|
|
63
|
+
'warning': '#d97706',
|
|
64
|
+
'warning-subtle': '#fffbeb',
|
|
65
|
+
'error': '#dc2626',
|
|
66
|
+
'error-subtle': '#fef2f2',
|
|
67
|
+
'info': '#2563eb',
|
|
68
|
+
'info-subtle': '#eff6ff',
|
|
57
69
|
},
|
|
58
70
|
dark: {
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'text-muted': 'var(--neutral-300)',
|
|
64
|
-
'text-subtle': 'var(--neutral-400)',
|
|
71
|
+
'section': 'var(--neutral-900)',
|
|
72
|
+
'card': 'var(--neutral-800)',
|
|
73
|
+
'muted': 'var(--neutral-700)',
|
|
74
|
+
'body': 'var(--neutral-50)',
|
|
65
75
|
'heading': 'white',
|
|
66
|
-
'
|
|
67
|
-
'link-hover': 'var(--primary-300)',
|
|
76
|
+
'subtle': 'var(--neutral-400)',
|
|
68
77
|
'border': 'var(--neutral-700)',
|
|
69
|
-
'border-muted': 'var(--neutral-800)',
|
|
70
78
|
'ring': 'var(--primary-500)',
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
79
|
+
'link': 'var(--primary-400)',
|
|
80
|
+
'link-hover': 'var(--primary-300)',
|
|
81
|
+
'primary': 'var(--primary-500)',
|
|
82
|
+
'primary-foreground': 'white',
|
|
83
|
+
'primary-hover': 'var(--primary-400)',
|
|
84
|
+
'secondary': 'var(--neutral-800)',
|
|
85
|
+
'secondary-foreground': 'var(--neutral-100)',
|
|
86
|
+
'secondary-hover': 'var(--neutral-700)',
|
|
87
|
+
'success': '#4ade80',
|
|
88
|
+
'success-subtle': '#052e16',
|
|
89
|
+
'warning': '#fbbf24',
|
|
90
|
+
'warning-subtle': '#451a03',
|
|
91
|
+
'error': '#f87171',
|
|
92
|
+
'error-subtle': '#450a0a',
|
|
93
|
+
'info': '#60a5fa',
|
|
94
|
+
'info-subtle': '#172554',
|
|
77
95
|
},
|
|
78
96
|
}
|
|
79
97
|
|
|
@@ -82,7 +100,7 @@ const DEFAULT_COLORS = {
|
|
|
82
100
|
primary: '#3b82f6', // Blue
|
|
83
101
|
secondary: '#64748b', // Slate
|
|
84
102
|
accent: '#8b5cf6', // Purple
|
|
85
|
-
neutral: '#
|
|
103
|
+
neutral: '#78716c', // Stone
|
|
86
104
|
}
|
|
87
105
|
|
|
88
106
|
// Shade levels for CSS variable generation
|
|
@@ -134,7 +152,7 @@ function generateContextCSS(context, tokens = {}) {
|
|
|
134
152
|
|
|
135
153
|
const vars = generateVarDeclarations(mergedTokens)
|
|
136
154
|
|
|
137
|
-
return `.context-${context} {\n${vars}\n background-color: var(--
|
|
155
|
+
return `.context-${context} {\n${vars}\n background-color: var(--section);\n}`
|
|
138
156
|
}
|
|
139
157
|
|
|
140
158
|
/**
|
|
@@ -148,17 +166,30 @@ function generateDarkSchemeCSS(config = {}) {
|
|
|
148
166
|
|
|
149
167
|
// Dark scheme tokens - similar to dark context but at root level
|
|
150
168
|
const darkTokens = {
|
|
151
|
-
'
|
|
152
|
-
'
|
|
153
|
-
'
|
|
154
|
-
'
|
|
155
|
-
'text-muted': 'var(--neutral-300)',
|
|
156
|
-
'text-subtle': 'var(--neutral-400)',
|
|
169
|
+
'section': 'var(--neutral-950)',
|
|
170
|
+
'card': 'var(--neutral-900)',
|
|
171
|
+
'muted': 'var(--neutral-800)',
|
|
172
|
+
'body': 'var(--neutral-50)',
|
|
157
173
|
'heading': 'white',
|
|
174
|
+
'subtle': 'var(--neutral-400)',
|
|
175
|
+
'border': 'var(--neutral-800)',
|
|
176
|
+
'ring': 'var(--primary-500)',
|
|
158
177
|
'link': 'var(--primary-400)',
|
|
159
178
|
'link-hover': 'var(--primary-300)',
|
|
160
|
-
'
|
|
161
|
-
'
|
|
179
|
+
'primary': 'var(--primary-500)',
|
|
180
|
+
'primary-foreground': 'white',
|
|
181
|
+
'primary-hover': 'var(--primary-400)',
|
|
182
|
+
'secondary': 'var(--neutral-800)',
|
|
183
|
+
'secondary-foreground': 'var(--neutral-100)',
|
|
184
|
+
'secondary-hover': 'var(--neutral-700)',
|
|
185
|
+
'success': '#4ade80',
|
|
186
|
+
'success-subtle': '#052e16',
|
|
187
|
+
'warning': '#fbbf24',
|
|
188
|
+
'warning-subtle': '#451a03',
|
|
189
|
+
'error': '#f87171',
|
|
190
|
+
'error-subtle': '#450a0a',
|
|
191
|
+
'info': '#60a5fa',
|
|
192
|
+
'info-subtle': '#172554',
|
|
162
193
|
}
|
|
163
194
|
|
|
164
195
|
const vars = generateVarDeclarations(darkTokens)
|
package/src/theme/processor.js
CHANGED
|
@@ -11,6 +11,31 @@
|
|
|
11
11
|
import { isValidColor, generatePalettes } from './shade-generator.js'
|
|
12
12
|
import { getDefaultColors, getDefaultContextTokens } from './css-generator.js'
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Named neutral presets mapping to Tailwind gray families
|
|
16
|
+
*/
|
|
17
|
+
const NEUTRAL_PRESETS = {
|
|
18
|
+
stone: '#78716c',
|
|
19
|
+
zinc: '#71717a',
|
|
20
|
+
gray: '#6b7280',
|
|
21
|
+
slate: '#64748b',
|
|
22
|
+
neutral: '#737373',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Default inline text styles (content-author markdown: [text]{emphasis})
|
|
27
|
+
* These reference semantic tokens so they adapt to context automatically
|
|
28
|
+
*/
|
|
29
|
+
const DEFAULT_INLINE = {
|
|
30
|
+
emphasis: {
|
|
31
|
+
color: 'var(--link)',
|
|
32
|
+
'font-weight': '600',
|
|
33
|
+
},
|
|
34
|
+
muted: {
|
|
35
|
+
color: 'var(--subtle)',
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
14
39
|
/**
|
|
15
40
|
* Default appearance configuration
|
|
16
41
|
*/
|
|
@@ -84,6 +109,11 @@ function validateColors(colors) {
|
|
|
84
109
|
continue
|
|
85
110
|
}
|
|
86
111
|
|
|
112
|
+
// Accept neutral preset names (stone, zinc, gray, slate, neutral)
|
|
113
|
+
if (name === 'neutral' && NEUTRAL_PRESETS[value]) {
|
|
114
|
+
continue
|
|
115
|
+
}
|
|
116
|
+
|
|
87
117
|
if (!isValidColor(value)) {
|
|
88
118
|
errors.push(`Color "${name}" has invalid value: ${value}`)
|
|
89
119
|
}
|
|
@@ -357,7 +387,12 @@ export function processTheme(rawConfig = {}, options = {}) {
|
|
|
357
387
|
|
|
358
388
|
// Process colors
|
|
359
389
|
const defaultColors = getDefaultColors()
|
|
360
|
-
const rawColors = rawConfig.colors || {}
|
|
390
|
+
const rawColors = { ...(rawConfig.colors || {}) }
|
|
391
|
+
|
|
392
|
+
// Resolve named neutral presets to hex values
|
|
393
|
+
if (typeof rawColors.neutral === 'string' && NEUTRAL_PRESETS[rawColors.neutral]) {
|
|
394
|
+
rawColors.neutral = NEUTRAL_PRESETS[rawColors.neutral]
|
|
395
|
+
}
|
|
361
396
|
|
|
362
397
|
// Filter to only valid colors (skip invalid ones in non-strict mode)
|
|
363
398
|
const validColors = {}
|
|
@@ -382,7 +417,7 @@ export function processTheme(rawConfig = {}, options = {}) {
|
|
|
382
417
|
warnings.push('No primary color specified, using default blue (#3b82f6)')
|
|
383
418
|
}
|
|
384
419
|
if (!rawConfig.colors?.neutral) {
|
|
385
|
-
warnings.push('No neutral color specified, using default
|
|
420
|
+
warnings.push('No neutral color specified, using default stone (#78716c)')
|
|
386
421
|
}
|
|
387
422
|
|
|
388
423
|
// Process contexts
|
|
@@ -426,7 +461,8 @@ export function processTheme(rawConfig = {}, options = {}) {
|
|
|
426
461
|
const background = rawConfig.background || null
|
|
427
462
|
|
|
428
463
|
// Inline text styles (semantic names → CSS declarations)
|
|
429
|
-
|
|
464
|
+
// Merge framework defaults with user overrides (user values win)
|
|
465
|
+
const inline = { ...DEFAULT_INLINE, ...(rawConfig.inline || {}) }
|
|
430
466
|
|
|
431
467
|
const config = {
|
|
432
468
|
colors, // Raw colors for CSS generator
|
|
@@ -16,8 +16,8 @@ import { processAllPreviews } from './images.js'
|
|
|
16
16
|
/**
|
|
17
17
|
* Build schema.json with preview image references
|
|
18
18
|
*/
|
|
19
|
-
async function buildSchemaWithPreviews(srcDir, outDir, isProduction,
|
|
20
|
-
const schema = await buildSchema(srcDir,
|
|
19
|
+
async function buildSchemaWithPreviews(srcDir, outDir, isProduction, sectionPaths) {
|
|
20
|
+
const schema = await buildSchema(srcDir, sectionPaths)
|
|
21
21
|
|
|
22
22
|
// Process preview images
|
|
23
23
|
const { schema: schemaWithImages, totalImages } = await processAllPreviews(
|
|
@@ -42,7 +42,7 @@ export function foundationBuildPlugin(options = {}) {
|
|
|
42
42
|
srcDir = 'src',
|
|
43
43
|
generateEntry = true,
|
|
44
44
|
entryFileName = '_entry.generated.js',
|
|
45
|
-
|
|
45
|
+
sections: sectionPaths,
|
|
46
46
|
} = options
|
|
47
47
|
|
|
48
48
|
let resolvedSrcDir
|
|
@@ -59,7 +59,7 @@ export function foundationBuildPlugin(options = {}) {
|
|
|
59
59
|
const root = config.root || process.cwd()
|
|
60
60
|
const srcPath = resolve(root, srcDir)
|
|
61
61
|
const entryPath = join(srcPath, entryFileName)
|
|
62
|
-
await generateEntryPoint(srcPath, entryPath, {
|
|
62
|
+
await generateEntryPoint(srcPath, entryPath, { sectionPaths })
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
async configResolved(config) {
|
|
@@ -80,7 +80,7 @@ export function foundationBuildPlugin(options = {}) {
|
|
|
80
80
|
resolvedSrcDir,
|
|
81
81
|
outDir,
|
|
82
82
|
isProduction,
|
|
83
|
-
|
|
83
|
+
sectionPaths
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
const schemaPath = join(metaDir, 'schema.json')
|
|
@@ -99,7 +99,7 @@ export function foundationDevPlugin(options = {}) {
|
|
|
99
99
|
const {
|
|
100
100
|
srcDir = 'src',
|
|
101
101
|
entryFileName = '_entry.generated.js',
|
|
102
|
-
|
|
102
|
+
sections: sectionPaths,
|
|
103
103
|
} = options
|
|
104
104
|
|
|
105
105
|
let resolvedSrcDir
|
|
@@ -112,7 +112,7 @@ export function foundationDevPlugin(options = {}) {
|
|
|
112
112
|
const root = config.root || process.cwd()
|
|
113
113
|
const srcPath = resolve(root, srcDir)
|
|
114
114
|
const entryPath = join(srcPath, entryFileName)
|
|
115
|
-
await generateEntryPoint(srcPath, entryPath, {
|
|
115
|
+
await generateEntryPoint(srcPath, entryPath, { sectionPaths })
|
|
116
116
|
},
|
|
117
117
|
|
|
118
118
|
configResolved(config) {
|
|
@@ -124,7 +124,7 @@ export function foundationDevPlugin(options = {}) {
|
|
|
124
124
|
if (reason) {
|
|
125
125
|
console.log(`[foundation] ${reason}, regenerating entry...`)
|
|
126
126
|
const entryPath = join(resolvedSrcDir, entryFileName)
|
|
127
|
-
await generateEntryPoint(resolvedSrcDir, entryPath, {
|
|
127
|
+
await generateEntryPoint(resolvedSrcDir, entryPath, { sectionPaths })
|
|
128
128
|
server.ws.send({ type: 'full-reload' })
|
|
129
129
|
}
|
|
130
130
|
},
|