@marktiderman/genesis-cli 1.11.1 → 1.11.2

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/doctor.js CHANGED
@@ -1130,7 +1130,7 @@ function unusedComponents(ctx) {
1130
1130
  // ../../scripts/lib/native-primitives.mjs
1131
1131
  var NATIVE_WRAPPED_PRIMITIVES = Object.freeze({
1132
1132
  Modal: Object.freeze(["NativeDialog", "NativeSheet", "NativeDrawer"]),
1133
- ActivityIndicator: Object.freeze(["NativeSkeleton", "NativeProgress"])
1133
+ ActivityIndicator: Object.freeze(["NativeLoadingState", "NativeSkeleton", "NativeProgress"])
1134
1134
  });
1135
1135
  function wrappedPrimitivesIn(namedImports) {
1136
1136
  return namedImports.split(",").map((n) => n.trim()).filter((n) => n && !/^type\s/.test(n)).map((n) => n.split(/\s+as\s+/)[0].trim()).filter((n) => n && Object.hasOwn(NATIVE_WRAPPED_PRIMITIVES, n));
@@ -1398,6 +1398,13 @@ function checkCustomHeaders(ctx, pkg) {
1398
1398
  });
1399
1399
  }
1400
1400
  }
1401
+ var LOADING_ROUTE_COMPANIONS = /* @__PURE__ */ new Set(["NativeLoadingState", "Stack.Screen", "Fragment", "React.Fragment"]);
1402
+ function isLoadingOnlyRoute(code) {
1403
+ const loading = [...code.matchAll(/<NativeLoadingState\b([^>]*)>/g)];
1404
+ if (loading.length === 0 || loading.some((m) => /\bfullScreen\s*=\s*\{\s*false\s*\}/.test(m[1] ?? ""))) return false;
1405
+ const tags = [...code.matchAll(/<([A-Z][\w.]*)/g)].map((m) => m[1] ?? "");
1406
+ return tags.every((t) => LOADING_ROUTE_COMPANIONS.has(t));
1407
+ }
1401
1408
  function routerRoot(ctx) {
1402
1409
  if (ctx.config.native?.routerRoot) return ctx.config.native.routerRoot.replace(/\/+$/, "");
1403
1410
  return existsSync(path14.join(ctx.root, "src", "app")) ? "src/app" : "app";
@@ -1420,12 +1427,13 @@ function checkScreenLayouts(ctx, pkg) {
1420
1427
  });
1421
1428
  return;
1422
1429
  }
1423
- const renders2 = new RegExp(`<(?:${layouts.join("|")}|Redirect)\\b`);
1430
+ const renders2 = new RegExp(`<(?:${[...layouts, "Redirect"].join("|")})\\b`);
1431
+ const loadingOnly = pkg.values.has("NativeLoadingState") ? isLoadingOnlyRoute : () => false;
1424
1432
  const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
1425
1433
  for (const file of routes) {
1426
1434
  if (!JSX_EXTS3.has(file.ext) || NON_SCREEN_ROUTE.test(file.path)) continue;
1427
1435
  if (!/\bexport\s+default\b/.test(file.code) || !/<[A-Za-z]/.test(file.code)) continue;
1428
- if (renders2.test(file.code)) continue;
1436
+ if (renders2.test(file.code) || loadingOnly(file.code)) continue;
1429
1437
  const viaImport = localImports(ctx.root, file).some((abs) => {
1430
1438
  const target = byPath.get(abs) ?? readSource(abs);
1431
1439
  return target !== null && renders2.test(target.code);