@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/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
- let available = [];
504
- try {
505
- const dir = resolvedOptions.layoutsDir;
506
- if (dir) {
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
- available = fs.readdirSync(abs).filter((f) => f.endsWith(".stx")).map((f) => f.replace(/\.stx$/, "")).sort();
508
+ return fs.readdirSync(abs).filter((f) => f.endsWith(".stx")).map((f) => f.replace(/\.stx$/, ""));
509
+ } catch {
510
+ return [];
509
511
  }
510
- } catch {}
511
- const 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
+ }, 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)