@uniweb/build 0.7.0 → 0.7.1
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 +3 -3
- package/src/schema.js +17 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
53
|
"@uniweb/content-reader": "1.1.2",
|
|
54
|
-
"@uniweb/
|
|
55
|
-
"@uniweb/
|
|
54
|
+
"@uniweb/schemas": "0.2.1",
|
|
55
|
+
"@uniweb/runtime": "0.6.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
package/src/schema.js
CHANGED
|
@@ -136,6 +136,16 @@ function isComponentFileName(name) {
|
|
|
136
136
|
return /^[A-Z]/.test(name)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Check if a name is a valid layout identifier.
|
|
141
|
+
* Layout names are lowercase identifiers (e.g., 'docs', 'marketing')
|
|
142
|
+
* but PascalCase is also accepted for backward compatibility.
|
|
143
|
+
* Skips private names (leading _ or .).
|
|
144
|
+
*/
|
|
145
|
+
function isLayoutName(name) {
|
|
146
|
+
return /^[a-zA-Z]/.test(name)
|
|
147
|
+
}
|
|
148
|
+
|
|
139
149
|
/**
|
|
140
150
|
* Check if a directory has a valid entry file (Name.ext or index.ext)
|
|
141
151
|
*/
|
|
@@ -284,15 +294,17 @@ export async function discoverLayoutsInPath(srcDir, layoutsRelPath = LAYOUTS_PAT
|
|
|
284
294
|
const ext = extname(entry.name)
|
|
285
295
|
if (entry.isFile() && COMPONENT_EXTENSIONS.has(ext)) {
|
|
286
296
|
const name = basename(entry.name, ext)
|
|
287
|
-
if (
|
|
297
|
+
if (isLayoutName(name)) {
|
|
288
298
|
fileNames.add(name)
|
|
289
299
|
}
|
|
290
300
|
} else if (entry.isDirectory()) {
|
|
291
|
-
|
|
301
|
+
if (isLayoutName(entry.name)) {
|
|
302
|
+
dirNames.add(entry.name)
|
|
303
|
+
}
|
|
292
304
|
}
|
|
293
305
|
}
|
|
294
306
|
|
|
295
|
-
// Check for name collisions (e.g.,
|
|
307
|
+
// Check for name collisions (e.g., docs.jsx AND docs/)
|
|
296
308
|
for (const name of fileNames) {
|
|
297
309
|
if (dirNames.has(name)) {
|
|
298
310
|
throw new Error(
|
|
@@ -308,7 +320,7 @@ export async function discoverLayoutsInPath(srcDir, layoutsRelPath = LAYOUTS_PAT
|
|
|
308
320
|
const ext = extname(entry.name)
|
|
309
321
|
if (!COMPONENT_EXTENSIONS.has(ext)) continue
|
|
310
322
|
const name = basename(entry.name, ext)
|
|
311
|
-
if (!
|
|
323
|
+
if (!isLayoutName(name)) continue
|
|
312
324
|
|
|
313
325
|
const meta = createImplicitMeta(name)
|
|
314
326
|
layouts[name] = {
|
|
@@ -320,7 +332,7 @@ export async function discoverLayoutsInPath(srcDir, layoutsRelPath = LAYOUTS_PAT
|
|
|
320
332
|
// Discover directories at root (no recursion for layouts)
|
|
321
333
|
for (const entry of entries) {
|
|
322
334
|
if (!entry.isDirectory()) continue
|
|
323
|
-
if (!
|
|
335
|
+
if (!isLayoutName(entry.name)) continue
|
|
324
336
|
|
|
325
337
|
const dirPath = join(fullPath, entry.name)
|
|
326
338
|
const relativePath = join(layoutsRelPath, entry.name)
|