@marktiderman/genesis-cli 1.11.0 → 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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "packages": {
3
3
  "@marktiderman/genesis-chat": {
4
- "version": "0.2.2",
4
+ "version": "0.3.0",
5
5
  "blocks": {
6
6
  "chat": {
7
7
  "feature": {
@@ -62,10 +62,10 @@
62
62
  "version": "1.5.0"
63
63
  },
64
64
  "@marktiderman/genesis-extension": {
65
- "version": "0.1.1"
65
+ "version": "0.2.0"
66
66
  },
67
67
  "@marktiderman/genesis-features": {
68
- "version": "0.4.0"
68
+ "version": "0.4.1"
69
69
  },
70
70
  "@marktiderman/genesis-forms": {
71
71
  "version": "0.9.2"
@@ -89,13 +89,13 @@
89
89
  "version": "0.6.3"
90
90
  },
91
91
  "@marktiderman/genesis": {
92
- "version": "0.9.8"
92
+ "version": "0.9.10"
93
93
  },
94
94
  "@marktiderman/genesis-cli": {
95
- "version": "1.11.0"
95
+ "version": "1.11.2"
96
96
  },
97
97
  "@marktiderman/genesis-native": {
98
- "version": "0.4.1",
98
+ "version": "0.4.2",
99
99
  "blocks": {
100
100
  "push": {
101
101
  "feature": {
@@ -273,7 +273,7 @@
273
273
  }
274
274
  },
275
275
  "@marktiderman/genesis-notifications": {
276
- "version": "0.1.2",
276
+ "version": "0.2.0",
277
277
  "blocks": {
278
278
  "notifications": {
279
279
  "feature": {
@@ -379,7 +379,7 @@
379
379
  "version": "0.3.1"
380
380
  },
381
381
  "@marktiderman/genesis-supabase": {
382
- "version": "0.5.0",
382
+ "version": "0.6.0",
383
383
  "blocks": {
384
384
  "account": {
385
385
  "feature": {
@@ -701,10 +701,10 @@
701
701
  }
702
702
  },
703
703
  "@marktiderman/genesis-ui": {
704
- "version": "2.16.0"
704
+ "version": "2.17.0"
705
705
  },
706
706
  "@marktiderman/genesis-ui-native": {
707
- "version": "2.4.1"
707
+ "version": "2.5.0"
708
708
  }
709
709
  }
710
710
  }
package/dist/index.js CHANGED
@@ -2082,7 +2082,7 @@ function unusedComponents(ctx) {
2082
2082
  // ../../scripts/lib/native-primitives.mjs
2083
2083
  var NATIVE_WRAPPED_PRIMITIVES = Object.freeze({
2084
2084
  Modal: Object.freeze(["NativeDialog", "NativeSheet", "NativeDrawer"]),
2085
- ActivityIndicator: Object.freeze(["NativeSkeleton", "NativeProgress"])
2085
+ ActivityIndicator: Object.freeze(["NativeLoadingState", "NativeSkeleton", "NativeProgress"])
2086
2086
  });
2087
2087
  function wrappedPrimitivesIn(namedImports) {
2088
2088
  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));
@@ -2350,6 +2350,13 @@ function checkCustomHeaders(ctx, pkg) {
2350
2350
  });
2351
2351
  }
2352
2352
  }
2353
+ var LOADING_ROUTE_COMPANIONS = /* @__PURE__ */ new Set(["NativeLoadingState", "Stack.Screen", "Fragment", "React.Fragment"]);
2354
+ function isLoadingOnlyRoute(code) {
2355
+ const loading = [...code.matchAll(/<NativeLoadingState\b([^>]*)>/g)];
2356
+ if (loading.length === 0 || loading.some((m) => /\bfullScreen\s*=\s*\{\s*false\s*\}/.test(m[1] ?? ""))) return false;
2357
+ const tags = [...code.matchAll(/<([A-Z][\w.]*)/g)].map((m) => m[1] ?? "");
2358
+ return tags.every((t) => LOADING_ROUTE_COMPANIONS.has(t));
2359
+ }
2353
2360
  function routerRoot(ctx) {
2354
2361
  if (ctx.config.native?.routerRoot) return ctx.config.native.routerRoot.replace(/\/+$/, "");
2355
2362
  return existsSync(path14.join(ctx.root, "src", "app")) ? "src/app" : "app";
@@ -2372,12 +2379,13 @@ function checkScreenLayouts(ctx, pkg) {
2372
2379
  });
2373
2380
  return;
2374
2381
  }
2375
- const renders2 = new RegExp(`<(?:${layouts.join("|")}|Redirect)\\b`);
2382
+ const renders2 = new RegExp(`<(?:${[...layouts, "Redirect"].join("|")})\\b`);
2383
+ const loadingOnly = pkg.values.has("NativeLoadingState") ? isLoadingOnlyRoute : () => false;
2376
2384
  const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
2377
2385
  for (const file of routes) {
2378
2386
  if (!JSX_EXTS3.has(file.ext) || NON_SCREEN_ROUTE.test(file.path)) continue;
2379
2387
  if (!/\bexport\s+default\b/.test(file.code) || !/<[A-Za-z]/.test(file.code)) continue;
2380
- if (renders2.test(file.code)) continue;
2388
+ if (renders2.test(file.code) || loadingOnly(file.code)) continue;
2381
2389
  const viaImport = localImports(ctx.root, file).some((abs) => {
2382
2390
  const target = byPath.get(abs) ?? readSource(abs);
2383
2391
  return target !== null && renders2.test(target.code);
@@ -3147,6 +3155,11 @@ var real = (p) => {
3147
3155
  return p;
3148
3156
  }
3149
3157
  };
3158
+ var LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml"];
3159
+ function nodeModulesOf(dir) {
3160
+ const parent = path14.dirname(dir);
3161
+ return path14.basename(parent).startsWith("@") ? path14.dirname(parent) : parent;
3162
+ }
3150
3163
  function packagesIn(nodeModules) {
3151
3164
  if (!existsSync(nodeModules)) return [];
3152
3165
  const out = [];
@@ -3195,18 +3208,33 @@ function genesisInstalls(root) {
3195
3208
  for (const r of roots) visit(r.dir, r.by, r.range);
3196
3209
  while (queue.length) {
3197
3210
  const { real: from, manifest, label } = queue.shift();
3198
- const deps = { ...manifest.peerDependencies, ...manifest.optionalDependencies, ...manifest.dependencies };
3211
+ const deps = { ...manifest.optionalDependencies, ...manifest.dependencies };
3199
3212
  for (const [name, range] of Object.entries(deps)) {
3200
3213
  const dir = findPackageDir(from, name);
3201
3214
  if (dir) visit(dir, label, range);
3202
3215
  }
3216
+ for (const [name, range] of Object.entries(manifest.peerDependencies ?? {})) {
3217
+ if (name in deps) continue;
3218
+ const dir = peerOf(from, name);
3219
+ if (dir) visit(dir, label, range);
3220
+ }
3203
3221
  }
3204
3222
  };
3223
+ const peerOf = (from, name) => {
3224
+ const dir = findPackageDir(from, name);
3225
+ if (!dir) return null;
3226
+ if (!ownInstall || name in declared) return dir;
3227
+ const realDir = real(dir);
3228
+ if (realDir.startsWith(realRoot + path14.sep)) return dir;
3229
+ return nodeModulesOf(realDir) === nodeModulesOf(from) ? dir : null;
3230
+ };
3205
3231
  const rootsOf = (deps, by) => Object.entries(deps).flatMap(([name, range]) => {
3206
3232
  const dir = findPackageDir(root, name);
3207
3233
  return dir ? [{ dir, by, ...range ? { range } : {} }] : [];
3208
3234
  });
3209
3235
  const app = readManifest(root);
3236
+ const ownInstall = LOCKFILES.some((f) => existsSync(path14.join(root, f)));
3237
+ const declared = { ...app?.devDependencies, ...app?.peerDependencies, ...app?.optionalDependencies, ...app?.dependencies };
3210
3238
  const declaredDev = Object.entries(app?.devDependencies ?? {});
3211
3239
  const runtimeDeps = {
3212
3240
  ...Object.fromEntries(declaredDev.filter(([n]) => !NON_SHIPPING.test(n))),
@@ -3225,7 +3253,7 @@ function genesisInstalls(root) {
3225
3253
  }).map((dir) => ({ dir, by: "hoisted, not a direct dependency" }))
3226
3254
  );
3227
3255
  const devRoots = { ...devDeps };
3228
- for (const tool of DEV_TOOLS) if (!(tool in devRoots)) devRoots[tool] = runtimeDeps[tool];
3256
+ for (const tool of DEV_TOOLS) if (!(tool in devRoots) && tool in runtimeDeps) devRoots[tool] = runtimeDeps[tool];
3229
3257
  walk("dev", rootsOf(devRoots, "the app (dev)"));
3230
3258
  for (const [key2, copy] of copies) {
3231
3259
  const kinds = via.get(key2);