@stacksjs/stx 0.2.190 → 0.2.191
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/dist/cli.js +66 -66
- package/dist/craft.js +99 -99
- package/dist/process.js +11 -7
- package/dist/pwa.js +75 -75
- package/dist/ssg.js +54 -54
- package/dist/types/config-types.d.ts +11 -0
- package/dist/utils.js +14 -1
- package/package.json +5 -5
package/dist/process.js
CHANGED
|
@@ -500,15 +500,19 @@ ${joined}` : joined;
|
|
|
500
500
|
throw new StxRuntimeError(`Failed to resolve layout path: ${layoutPath}`, filePath, void 0, void 0, `Layout referenced from ${filePath}`);
|
|
501
501
|
});
|
|
502
502
|
if (!layoutFullPath) {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
const layoutsIn = (dir) => {
|
|
504
|
+
if (!dir)
|
|
505
|
+
return [];
|
|
506
|
+
try {
|
|
507
507
|
const abs = path.isAbsolute(dir) ? dir : path.resolve(process.cwd(), dir);
|
|
508
|
-
|
|
508
|
+
return fs.readdirSync(abs).filter((f) => f.endsWith(".stx")).map((f) => f.replace(/\.stx$/, ""));
|
|
509
|
+
} catch {
|
|
510
|
+
return [];
|
|
509
511
|
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
+
}, available = [
|
|
513
|
+
...layoutsIn(resolvedOptions.layoutsDir),
|
|
514
|
+
...layoutsIn(resolvedOptions.fallbackLayoutsDir)
|
|
515
|
+
].filter((name, index, all) => all.indexOf(name) === index).sort(), warning = `Layout not found: ${layoutPath} (referenced from ${filePath})` + (available.length > 0 ? `. Available layouts: ${available.join(", ")}` : resolvedOptions.layoutsDir ? `. No .stx layouts found in ${resolvedOptions.layoutsDir}` : "");
|
|
512
516
|
errorLogger.log(Error(warning), { layoutPath, filePath, available }, "error");
|
|
513
517
|
console.error(`[stx] ${warning}`);
|
|
514
518
|
if (resolvedOptions.debug)
|