@marktiderman/genesis-cli 1.8.0 → 1.9.0
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/README.md +26 -4
- package/dist/cli.js +933 -319
- package/dist/cli.js.map +1 -1
- package/dist/{config-CrZbM3jD.d.ts → config-QC_Ewwwp.d.ts} +27 -3
- package/dist/doctor.d.ts +68 -4
- package/dist/doctor.js +654 -87
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +2 -2
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +14 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +666 -101
- package/dist/index.js.map +1 -1
- package/dist/starter/__tests__/check-in-photos.test.ts +1 -1
- package/dist/starter/__tests__/components/messages.test.tsx +33 -0
- package/dist/starter/src/app/(app)/(home)/check-in.tsx +4 -38
- package/dist/starter/src/app/(app)/messages/[id].tsx +14 -5
- package/dist/starter/src/app/(app)/messages/check-in.tsx +9 -0
- package/dist/starter/src/app/(app)/messages/search.tsx +13 -1
- package/dist/starter/src/copy.ts +2 -0
- package/dist/starter/src/lib/chat.tsx +31 -8
- package/dist/starter/src/lib/check-in-screen.tsx +43 -0
- package/dist/starter/supabase/migrations/20261025000060_genesis_chat_search_threads.sql +85 -0
- package/dist/starter/supabase/tests/database/genesis_chat_coaching.test.sql +7 -3
- package/dist/starter/supabase/tests/database/genesis_chat_search_threads.test.sql +50 -0
- package/dist/vite.js +651 -86
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
package/dist/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path3 from 'path';
|
|
2
2
|
import { spawnSync } from 'child_process';
|
|
3
|
-
import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, statSync, realpathSync } from 'fs';
|
|
4
4
|
import { createRequire } from 'module';
|
|
5
5
|
import { pathToFileURL } from 'url';
|
|
6
6
|
|
|
@@ -99,7 +99,7 @@ var PRIVACY_PURPOSES = {
|
|
|
99
99
|
"third-party advertising": "NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising",
|
|
100
100
|
other: "NSPrivacyCollectedDataTypePurposeOther"
|
|
101
101
|
};
|
|
102
|
-
var STRING_LISTS = ["src", "extensions", "ignore", "tokenFiles", "ignoreTokenPrefixes", "localPrimitiveDirs", "build"];
|
|
102
|
+
var STRING_LISTS = ["src", "extensions", "ignore", "tokenFiles", "ignoreTokenPrefixes", "localPrimitiveDirs", "build", "componentPackages"];
|
|
103
103
|
var STRINGS = ["uiPackage", "rulesDoc"];
|
|
104
104
|
var KNOWN = /* @__PURE__ */ new Set([
|
|
105
105
|
...STRING_LISTS,
|
|
@@ -114,10 +114,11 @@ var KNOWN = /* @__PURE__ */ new Set([
|
|
|
114
114
|
"packs",
|
|
115
115
|
"native",
|
|
116
116
|
"supabase",
|
|
117
|
+
"routesDir",
|
|
117
118
|
"$schema",
|
|
118
119
|
"$comment"
|
|
119
120
|
]);
|
|
120
|
-
var LEVELS = /* @__PURE__ */ new Set(["error", "warn", "off"]);
|
|
121
|
+
var LEVELS = /* @__PURE__ */ new Set(["error", "warn", "info", "off"]);
|
|
121
122
|
var PATTERN_KEYS = /* @__PURE__ */ new Set(["id", "level", "files", "exclude", "forbid", "require", "path", "message"]);
|
|
122
123
|
var PACKS = /* @__PURE__ */ new Set(["native", "supabase"]);
|
|
123
124
|
var PACK_KEYS = {
|
|
@@ -176,7 +177,7 @@ function validatePrivacy(raw, source = "config") {
|
|
|
176
177
|
};
|
|
177
178
|
if (!isObject(raw)) fail(`"privacy" must be an object`);
|
|
178
179
|
const c = raw;
|
|
179
|
-
for (const
|
|
180
|
+
for (const key2 of Object.keys(c)) if (!PRIVACY_KEYS.has(key2)) fail(`privacy: unknown setting "${key2}"`);
|
|
180
181
|
const out = {};
|
|
181
182
|
if (c.blocks !== void 0) {
|
|
182
183
|
if (!isStringList(c.blocks)) fail(`privacy.blocks must be a list of block ids`);
|
|
@@ -191,7 +192,7 @@ function validatePrivacy(raw, source = "config") {
|
|
|
191
192
|
out.collects = c.collects.map((entry, i) => {
|
|
192
193
|
const where = `privacy.collects[${i}]`;
|
|
193
194
|
if (!isObject(entry)) return fail(`${where} must be an object`);
|
|
194
|
-
for (const
|
|
195
|
+
for (const key2 of Object.keys(entry)) if (!DATA_USE_KEYS.has(key2)) fail(`${where}: unknown setting "${key2}"`);
|
|
195
196
|
if (typeof entry.type !== "string" || !privacyDataType(entry.type)) {
|
|
196
197
|
fail(`${where}.type "${String(entry.type)}" is not one of ${Object.keys(PRIVACY_DATA_TYPES).join(", ")}`);
|
|
197
198
|
}
|
|
@@ -214,7 +215,7 @@ function validateLinks(raw, source = "config") {
|
|
|
214
215
|
};
|
|
215
216
|
if (!isObject(raw)) fail(`"links" must be an object`);
|
|
216
217
|
const c = raw;
|
|
217
|
-
for (const
|
|
218
|
+
for (const key2 of Object.keys(c)) if (!LINK_KEYS.has(key2)) fail(`links: unknown setting "${key2}"`);
|
|
218
219
|
if (!isStringList(c.hosts) || c.hosts.length === 0) fail(`links.hosts must be a non-empty list of host names`);
|
|
219
220
|
for (const host of c.hosts) {
|
|
220
221
|
if (!HOST.test(host)) {
|
|
@@ -241,15 +242,16 @@ function validateConfig(raw, source = "config") {
|
|
|
241
242
|
};
|
|
242
243
|
if (!isObject(raw)) fail("the doctor settings must be an object");
|
|
243
244
|
const c = raw;
|
|
244
|
-
for (const
|
|
245
|
+
for (const key2 of Object.keys(c)) if (!KNOWN.has(key2)) fail(`unknown setting "${key2}"`);
|
|
245
246
|
if (typeof c.themeCss === "string") c.themeCss = [c.themeCss];
|
|
246
247
|
if (c.themeCss !== void 0 && !isStringList(c.themeCss)) fail(`"themeCss" must be a path or a list of paths`);
|
|
247
|
-
for (const
|
|
248
|
-
if (c[
|
|
248
|
+
for (const key2 of STRING_LISTS) {
|
|
249
|
+
if (c[key2] !== void 0 && !isStringList(c[key2])) fail(`"${key2}" must be a list of strings`);
|
|
249
250
|
}
|
|
250
|
-
for (const
|
|
251
|
-
if (c[
|
|
251
|
+
for (const key2 of STRINGS) {
|
|
252
|
+
if (c[key2] !== void 0 && typeof c[key2] !== "string") fail(`"${key2}" must be a string`);
|
|
252
253
|
}
|
|
254
|
+
if (c.routesDir !== void 0) c.routesDir = appPath(c.routesDir, `"routesDir"`, fail);
|
|
253
255
|
if (c.rawTags !== void 0) {
|
|
254
256
|
if (!isObject(c.rawTags)) fail(`"rawTags" must be an object`);
|
|
255
257
|
for (const [tag, v] of Object.entries(c.rawTags)) {
|
|
@@ -267,7 +269,7 @@ function validateConfig(raw, source = "config") {
|
|
|
267
269
|
if (c.rules !== void 0) {
|
|
268
270
|
if (!isObject(c.rules)) fail(`"rules" must be an object of rule \u2192 level`);
|
|
269
271
|
for (const [rule, level] of Object.entries(c.rules)) {
|
|
270
|
-
if (!LEVELS.has(level)) fail(`rules.${rule} must be "error", "warn" or "off"`);
|
|
272
|
+
if (!LEVELS.has(level)) fail(`rules.${rule} must be "error", "warn", "info" or "off"`);
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
if (c.allow !== void 0) {
|
|
@@ -360,11 +362,12 @@ function globToRegExp(glob) {
|
|
|
360
362
|
}
|
|
361
363
|
function globMatcher(globs) {
|
|
362
364
|
const res = (globs ?? []).filter((g) => g.trim()).map(globToRegExp);
|
|
363
|
-
return (
|
|
365
|
+
return (path16) => res.some((re) => re.test(path16));
|
|
364
366
|
}
|
|
365
367
|
var DEFAULT_UI_PACKAGE = "@marktiderman/genesis-ui";
|
|
366
368
|
var NATIVE_UI_PACKAGE = "@marktiderman/genesis-ui-native";
|
|
367
369
|
var DESIGN_SYSTEM_PACKAGE = "@marktiderman/genesis-design-system";
|
|
370
|
+
var DEFAULT_COMPONENT_PACKAGES = ["@marktiderman/genesis-forms-studio"];
|
|
368
371
|
var TAGS = ["button", "input", "textarea", "select", "label", "table", "dialog", "progress", "details", "summary"];
|
|
369
372
|
var TAG_ALIASES = { hr: "Separator" };
|
|
370
373
|
var NON_COMPONENT_SUFFIX = /(Props|Variant|Variants|Type|Types|Config|Context|Options|Status)$/;
|
|
@@ -435,9 +438,23 @@ function loadGenesis(root, config) {
|
|
|
435
438
|
components,
|
|
436
439
|
tokens,
|
|
437
440
|
rawTags,
|
|
438
|
-
palette: loadPalette(root)
|
|
441
|
+
palette: loadPalette(root),
|
|
442
|
+
companions: loadCompanions(root, config, uiPackage)
|
|
439
443
|
};
|
|
440
444
|
}
|
|
445
|
+
function loadCompanions(root, config, uiPackage) {
|
|
446
|
+
const out = [];
|
|
447
|
+
for (const name of config.componentPackages ?? DEFAULT_COMPONENT_PACKAGES) {
|
|
448
|
+
if (name === uiPackage) continue;
|
|
449
|
+
try {
|
|
450
|
+
const pkg = readPackageExports(root, name);
|
|
451
|
+
if (pkg) out.push({ package: name, version: pkg.version, components: pkg.components });
|
|
452
|
+
} catch (err) {
|
|
453
|
+
if (!(err instanceof DoctorConfigError)) throw err;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return out;
|
|
457
|
+
}
|
|
441
458
|
function readPackageExports(root, uiPackage) {
|
|
442
459
|
const uiDir = findPackageDir(root, uiPackage);
|
|
443
460
|
if (!uiDir) return null;
|
|
@@ -507,8 +524,8 @@ function exportTypes(target) {
|
|
|
507
524
|
if (!target || typeof target !== "object") return void 0;
|
|
508
525
|
const t = target;
|
|
509
526
|
if (typeof t.types === "string") return t.types;
|
|
510
|
-
for (const
|
|
511
|
-
const nested = exportTypes(t[
|
|
527
|
+
for (const key2 of ["import", "default", "require"]) {
|
|
528
|
+
const nested = exportTypes(t[key2]);
|
|
512
529
|
if (nested) return nested;
|
|
513
530
|
}
|
|
514
531
|
return void 0;
|
|
@@ -564,8 +581,8 @@ function loadPalette(root) {
|
|
|
564
581
|
try {
|
|
565
582
|
const req = createRequire(path3.join(root, "package.json"));
|
|
566
583
|
const colors = req("tailwindcss/colors");
|
|
567
|
-
for (const
|
|
568
|
-
if (/^[a-z]+$/.test(
|
|
584
|
+
for (const key2 of Object.keys(colors?.default ?? colors ?? {})) {
|
|
585
|
+
if (/^[a-z]+$/.test(key2) && !["inherit", "current", "transparent"].includes(key2)) names.add(key2);
|
|
569
586
|
}
|
|
570
587
|
} catch {
|
|
571
588
|
}
|
|
@@ -803,11 +820,11 @@ function parseRulesMarkdown(markdown) {
|
|
|
803
820
|
}
|
|
804
821
|
const kv = current && line.match(/^-\s+(level|files|exclude|forbid|require|path|message):\s*(.*)$/);
|
|
805
822
|
if (!current || !kv) continue;
|
|
806
|
-
const [,
|
|
823
|
+
const [, key2, raw] = kv;
|
|
807
824
|
const value = raw.trim();
|
|
808
|
-
if (
|
|
809
|
-
else if (
|
|
810
|
-
else current[
|
|
825
|
+
if (key2 === "files" || key2 === "exclude") current[key2] = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
826
|
+
else if (key2 === "level") current.level = value;
|
|
827
|
+
else current[key2] = value;
|
|
811
828
|
}
|
|
812
829
|
return rules;
|
|
813
830
|
}
|
|
@@ -822,8 +839,8 @@ function compilePatternRules(rules, source) {
|
|
|
822
839
|
if (ids.has(rule.id)) throw new DoctorConfigError(`${source}: rule "${rule.id}" is defined twice`);
|
|
823
840
|
ids.add(rule.id);
|
|
824
841
|
const level = rule.level ?? "error";
|
|
825
|
-
if (!["error", "warn", "guide"].includes(level)) {
|
|
826
|
-
throw new DoctorConfigError(`${source}: rule "${rule.id}" has level "${level}" (use error, warn or guide)`);
|
|
842
|
+
if (!["error", "warn", "info", "guide"].includes(level)) {
|
|
843
|
+
throw new DoctorConfigError(`${source}: rule "${rule.id}" has level "${level}" (use error, warn, info or guide)`);
|
|
827
844
|
}
|
|
828
845
|
if (level === "guide") continue;
|
|
829
846
|
if (!rule.files?.length) throw new DoctorConfigError(`${source}: rule "${rule.id}" needs "files" (or level: guide)`);
|
|
@@ -929,6 +946,15 @@ var BUILTIN_RULES = [
|
|
|
929
946
|
"undefined-token",
|
|
930
947
|
"shadowed-export",
|
|
931
948
|
"version-skew",
|
|
949
|
+
"duplicate-genesis-package",
|
|
950
|
+
"peer-range-mismatch",
|
|
951
|
+
// structure
|
|
952
|
+
"hand-rolled-sub-nav",
|
|
953
|
+
"local-genesis-copy",
|
|
954
|
+
"resource-workspace",
|
|
955
|
+
"page-layout",
|
|
956
|
+
// dates
|
|
957
|
+
"iso-date-slice",
|
|
932
958
|
// native pack
|
|
933
959
|
"native-raw-primitive",
|
|
934
960
|
"native-literal-color",
|
|
@@ -939,7 +965,8 @@ var BUILTIN_RULES = [
|
|
|
939
965
|
"migration-grants",
|
|
940
966
|
"migration-rls",
|
|
941
967
|
"migration-definer-search-path",
|
|
942
|
-
"migration-edited"
|
|
968
|
+
"migration-edited",
|
|
969
|
+
"migration-testing-kit"
|
|
943
970
|
];
|
|
944
971
|
var DEFAULT_LOCAL_PRIMITIVE_DIRS = ["src/components/ui"];
|
|
945
972
|
var STARTER_LEFTOVERS = ["components.json", "src/lib/utils.ts"];
|
|
@@ -1155,11 +1182,105 @@ var appFunctionality = (type, ...more) => ({
|
|
|
1155
1182
|
function privacyApisFor(dependencies2) {
|
|
1156
1183
|
return Object.keys(PRIVACY_APIS).filter((pkg) => pkg in dependencies2).flatMap((pkg) => PRIVACY_APIS[pkg]);
|
|
1157
1184
|
}
|
|
1158
|
-
|
|
1159
|
-
// src/doctor/native.ts
|
|
1160
1185
|
var SCRIPT_EXTS2 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
1161
1186
|
var JSX_EXTS2 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
|
|
1162
1187
|
var RESOLVE_EXTS = [".tsx", ".ts", ".jsx", ".js"];
|
|
1188
|
+
function localImports(root, file) {
|
|
1189
|
+
const out = [];
|
|
1190
|
+
for (const m of file.code.matchAll(/\bfrom\s*["']((?:\.{1,2}|[@~])\/[^"']+)["']/g)) {
|
|
1191
|
+
const spec = m[1];
|
|
1192
|
+
const bases = spec.startsWith(".") ? [path3.resolve(path3.dirname(file.absolutePath), spec)] : [path3.join(root, spec.slice(2)), path3.join(root, "src", spec.slice(2))];
|
|
1193
|
+
for (const base of bases) {
|
|
1194
|
+
const hit = [base, ...RESOLVE_EXTS.map((e) => base + e), ...RESOLVE_EXTS.map((e) => path3.join(base, `index${e}`))].find(
|
|
1195
|
+
(p) => SCRIPT_EXTS2.has(path3.extname(p)) && existsSync(p)
|
|
1196
|
+
);
|
|
1197
|
+
if (hit) {
|
|
1198
|
+
out.push(hit);
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
return out;
|
|
1204
|
+
}
|
|
1205
|
+
function readSource(abs) {
|
|
1206
|
+
try {
|
|
1207
|
+
return { absolutePath: abs, code: readFileSync(abs, "utf8") };
|
|
1208
|
+
} catch {
|
|
1209
|
+
return null;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
function viaOneImport(root, files, file, test2) {
|
|
1213
|
+
if (test2(file.code)) return true;
|
|
1214
|
+
const byPath = new Map(files.map((f) => [f.absolutePath, f]));
|
|
1215
|
+
return localImports(root, file).some((abs) => {
|
|
1216
|
+
const target = byPath.get(abs) ?? readSource(abs);
|
|
1217
|
+
return target !== null && test2(target.code);
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
function tagEnd(code, start) {
|
|
1221
|
+
let depth = 0;
|
|
1222
|
+
let quote = null;
|
|
1223
|
+
for (let i = start + 1; i < code.length; i++) {
|
|
1224
|
+
const ch = code[i];
|
|
1225
|
+
if (quote) {
|
|
1226
|
+
if (ch === "\\") i++;
|
|
1227
|
+
else if (ch === quote) quote = null;
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
if (ch === '"' || ch === "'" || ch === "`") quote = ch;
|
|
1231
|
+
else if (ch === "{") depth++;
|
|
1232
|
+
else if (ch === "}") depth--;
|
|
1233
|
+
else if (ch === ">" && depth === 0) {
|
|
1234
|
+
let j = i - 1;
|
|
1235
|
+
while (j > start && /\s/.test(code[j])) j--;
|
|
1236
|
+
return { end: i + 1, selfClosing: code[j] === "/" };
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
return { end: code.length, selfClosing: false };
|
|
1240
|
+
}
|
|
1241
|
+
function openElementsAt(code, index, track) {
|
|
1242
|
+
const open = [];
|
|
1243
|
+
const re = /<(\/?)([A-Z][\w.]*)(?=[\s>/])/g;
|
|
1244
|
+
for (let m = re.exec(code); m && m.index < index; m = re.exec(code)) {
|
|
1245
|
+
const name = m[2];
|
|
1246
|
+
if (!track(name)) continue;
|
|
1247
|
+
if (!m[1] && /[\w$.]$/.test(code.slice(Math.max(0, m.index - 1), m.index))) continue;
|
|
1248
|
+
if (m[1]) {
|
|
1249
|
+
const at = open.lastIndexOf(name);
|
|
1250
|
+
if (at !== -1) open.splice(at, 1);
|
|
1251
|
+
continue;
|
|
1252
|
+
}
|
|
1253
|
+
const { end, selfClosing } = tagEnd(code, m.index);
|
|
1254
|
+
if (end > index) break;
|
|
1255
|
+
if (!selfClosing) open.push(name);
|
|
1256
|
+
}
|
|
1257
|
+
return open;
|
|
1258
|
+
}
|
|
1259
|
+
function renderedElements(code) {
|
|
1260
|
+
const out = [];
|
|
1261
|
+
for (const m of code.matchAll(/(?<![\w$.])<([A-Z][\w.]*)(?=[\s>/])/g)) out.push(m[1]);
|
|
1262
|
+
return out;
|
|
1263
|
+
}
|
|
1264
|
+
function rendersJsx(code) {
|
|
1265
|
+
return renderedElements(code).length > 0 || /(?<![\w$.])<(?:[a-z][\w-]*(?=[\s>/])|>)/.test(code);
|
|
1266
|
+
}
|
|
1267
|
+
function namedImportsFrom(code, pkg) {
|
|
1268
|
+
const out = [];
|
|
1269
|
+
for (const m of code.matchAll(/\bimport\s+(?:type\s+)?(?:[\w$]+\s*,\s*)?\{([^}]*)\}\s*from\s*["']([^"']+)["']/g)) {
|
|
1270
|
+
if (!pkg.test(m[2])) continue;
|
|
1271
|
+
for (const part of m[1].split(",")) {
|
|
1272
|
+
const p = part.trim();
|
|
1273
|
+
if (!p || p.startsWith("type ")) continue;
|
|
1274
|
+
const local = p.split(/\s+as\s+/).pop()?.trim();
|
|
1275
|
+
if (local) out.push(local);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return out;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
// src/doctor/native.ts
|
|
1282
|
+
var SCRIPT_EXTS3 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
1283
|
+
var JSX_EXTS3 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
|
|
1163
1284
|
var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$/;
|
|
1164
1285
|
var NON_SCREEN_ROUTE = /(?:^|\/)(?:_layout|\+html|\+native-intent|\+middleware)\.[jt]sx?$|\+api\.[jt]sx?$/;
|
|
1165
1286
|
var PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
|
|
@@ -1194,7 +1315,7 @@ function checkRawPrimitives(ctx, pkg) {
|
|
|
1194
1315
|
];
|
|
1195
1316
|
const member = new RegExp(String.raw`\brequire\(\s*${RN}\s*\)\.(${wrapped.join("|")})\b`, "g");
|
|
1196
1317
|
for (const file of ctx.files) {
|
|
1197
|
-
if (!
|
|
1318
|
+
if (!SCRIPT_EXTS3.has(file.ext)) continue;
|
|
1198
1319
|
const code = file.code;
|
|
1199
1320
|
const report = (name, at) => {
|
|
1200
1321
|
const use = NATIVE_WRAPPED_PRIMITIVES[name].filter((c) => pkg.values.has(c));
|
|
@@ -1240,7 +1361,7 @@ function checkCustomHeaders(ctx, pkg) {
|
|
|
1240
1361
|
const reported = /* @__PURE__ */ new Set();
|
|
1241
1362
|
const hidingLayouts = /* @__PURE__ */ new Map();
|
|
1242
1363
|
for (const file of ctx.files) {
|
|
1243
|
-
if (!
|
|
1364
|
+
if (!JSX_EXTS3.has(file.ext)) continue;
|
|
1244
1365
|
const code = file.code;
|
|
1245
1366
|
const hidden = HIDES_HEADER.exec(code);
|
|
1246
1367
|
if (hidden && /(?:^|\/)_layout\.[jt]sx$/.test(file.path)) hidingLayouts.set(path3.posix.dirname(file.path), file.path);
|
|
@@ -1270,7 +1391,7 @@ function checkCustomHeaders(ctx, pkg) {
|
|
|
1270
1391
|
}
|
|
1271
1392
|
}
|
|
1272
1393
|
for (const file of ctx.files) {
|
|
1273
|
-
if (!
|
|
1394
|
+
if (!JSX_EXTS3.has(file.ext) || reported.has(file.path) || !file.path.startsWith(`${rootDir}/`) || NON_SCREEN_ROUTE.test(file.path)) continue;
|
|
1274
1395
|
const layout = hidingLayouts.get(path3.posix.dirname(file.path));
|
|
1275
1396
|
const own = layout ? ownHeader(file.code, pkg) : null;
|
|
1276
1397
|
if (!layout || !own) continue;
|
|
@@ -1309,7 +1430,7 @@ function checkScreenLayouts(ctx, pkg) {
|
|
|
1309
1430
|
const renders = new RegExp(`<(?:${layouts.join("|")}|Redirect)\\b`);
|
|
1310
1431
|
const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
|
|
1311
1432
|
for (const file of routes) {
|
|
1312
|
-
if (!
|
|
1433
|
+
if (!JSX_EXTS3.has(file.ext) || NON_SCREEN_ROUTE.test(file.path)) continue;
|
|
1313
1434
|
if (!/\bexport\s+default\b/.test(file.code) || !/<[A-Za-z]/.test(file.code)) continue;
|
|
1314
1435
|
if (renders.test(file.code)) continue;
|
|
1315
1436
|
const viaImport = localImports(ctx.root, file).some((abs) => {
|
|
@@ -1325,30 +1446,6 @@ function checkScreenLayouts(ctx, pkg) {
|
|
|
1325
1446
|
});
|
|
1326
1447
|
}
|
|
1327
1448
|
}
|
|
1328
|
-
function localImports(root, file) {
|
|
1329
|
-
const out = [];
|
|
1330
|
-
for (const m of file.code.matchAll(/\bfrom\s*["']((?:\.{1,2}|[@~])\/[^"']+)["']/g)) {
|
|
1331
|
-
const spec = m[1];
|
|
1332
|
-
const bases = spec.startsWith(".") ? [path3.resolve(path3.dirname(file.absolutePath), spec)] : [path3.join(root, spec.slice(2)), path3.join(root, "src", spec.slice(2))];
|
|
1333
|
-
for (const base of bases) {
|
|
1334
|
-
const hit = [base, ...RESOLVE_EXTS.map((e) => base + e), ...RESOLVE_EXTS.map((e) => path3.join(base, `index${e}`))].find(
|
|
1335
|
-
(p) => SCRIPT_EXTS2.has(path3.extname(p)) && existsSync(p)
|
|
1336
|
-
);
|
|
1337
|
-
if (hit) {
|
|
1338
|
-
out.push(hit);
|
|
1339
|
-
break;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
return out;
|
|
1344
|
-
}
|
|
1345
|
-
function readSource(abs) {
|
|
1346
|
-
try {
|
|
1347
|
-
return { code: readFileSync(abs, "utf8") };
|
|
1348
|
-
} catch {
|
|
1349
|
-
return null;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
1449
|
var PERMISSIONS = [
|
|
1353
1450
|
{ module: "expo-camera", key: "NSCameraUsageDescription", option: "cameraPermission" },
|
|
1354
1451
|
{ module: "expo-image-picker", key: "NSPhotoLibraryUsageDescription", option: "photosPermission" },
|
|
@@ -1471,14 +1568,14 @@ function checkStoreReadiness(ctx) {
|
|
|
1471
1568
|
});
|
|
1472
1569
|
if (!set) generic.set(p.key, [...generic.get(p.key) ?? [], `${p.module}${p.maybe ? `, if the app ${p.maybe}` : ""}`]);
|
|
1473
1570
|
}
|
|
1474
|
-
for (const [
|
|
1475
|
-
const opt = PERMISSIONS.find((p) => p.key ===
|
|
1571
|
+
for (const [key2, modules] of generic) {
|
|
1572
|
+
const opt = PERMISSIONS.find((p) => p.key === key2).option;
|
|
1476
1573
|
ctx.report({
|
|
1477
1574
|
rule: "store-readiness",
|
|
1478
1575
|
level: "warn",
|
|
1479
1576
|
file,
|
|
1480
|
-
subject:
|
|
1481
|
-
message: `leaves ${
|
|
1577
|
+
subject: key2,
|
|
1578
|
+
message: `leaves ${key2} to Expo's generic default string (${modules.join("; ")}), and App Review rejects generic purpose strings; set the plugin's ${opt} (or ios.infoPlist.${key2}) to a sentence saying why the app needs it, or ${opt}: false if it doesn't`
|
|
1482
1579
|
});
|
|
1483
1580
|
}
|
|
1484
1581
|
const pluginManifest = genesisPluginDoes("privacyManifest") && privacyApisFor(runtimeDependencies(ctx.root)).length > 0;
|
|
@@ -1707,6 +1804,20 @@ function checkSupabasePack(ctx) {
|
|
|
1707
1804
|
}
|
|
1708
1805
|
checkRls(ctx, migrations, exposed);
|
|
1709
1806
|
checkDefinerSearchPath(ctx, migrations);
|
|
1807
|
+
checkTestingKit(ctx, migrations);
|
|
1808
|
+
}
|
|
1809
|
+
function checkTestingKit(ctx, migrations) {
|
|
1810
|
+
for (const { file, statements } of migrations) {
|
|
1811
|
+
const hit = statements.find(({ sql }) => /\bgenesis_testing\b/.test(sql));
|
|
1812
|
+
if (!hit) continue;
|
|
1813
|
+
ctx.report({
|
|
1814
|
+
rule: "migration-testing-kit",
|
|
1815
|
+
file,
|
|
1816
|
+
line: hit.line,
|
|
1817
|
+
subject: "genesis_testing",
|
|
1818
|
+
message: "a migration uses genesis_testing, the pgTAP kit for test databases only; move it to supabase/tests/database/000_genesis_testing.test.sql"
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1710
1821
|
}
|
|
1711
1822
|
function granteesOf(s) {
|
|
1712
1823
|
return s.replace(/\s+granted by .*$/, "").replace(/\s+with grant option$/, "").split(/\s*,\s*/).map((r) => r.replace(/^group\s+/, "").trim()).filter(Boolean);
|
|
@@ -1835,8 +1946,8 @@ function checkDefinerSearchPath(ctx, migrations) {
|
|
|
1835
1946
|
for (const { sql, line } of statements) {
|
|
1836
1947
|
const create = /^create (?:or replace )?(?:function|procedure) ([\w$.]+)\s*/.exec(sql);
|
|
1837
1948
|
if (create) {
|
|
1838
|
-
const [
|
|
1839
|
-
fns.set(
|
|
1949
|
+
const [key2] = keysFor(sql, create[0].length, qualify(create[1]));
|
|
1950
|
+
fns.set(key2, { definer: /\bsecurity definer\b/.test(sql), searchPath: /\bset search_path\b/.test(sql), file, line });
|
|
1840
1951
|
continue;
|
|
1841
1952
|
}
|
|
1842
1953
|
const alter = /^alter (?:function|procedure|routine) ([\w$.]+)\s*/.exec(sql);
|
|
@@ -1845,13 +1956,13 @@ function checkDefinerSearchPath(ctx, migrations) {
|
|
|
1845
1956
|
const keys = keysFor(sql, alter[0].length, fnName);
|
|
1846
1957
|
const rename = / rename to ([\w$]+)$/.exec(sql);
|
|
1847
1958
|
const move = / set schema ([\w$]+)$/.exec(sql);
|
|
1848
|
-
for (const
|
|
1849
|
-
const state = fns.get(
|
|
1959
|
+
for (const key2 of keys) {
|
|
1960
|
+
const state = fns.get(key2);
|
|
1850
1961
|
if (rename || move) {
|
|
1851
1962
|
if (!state) continue;
|
|
1852
|
-
fns.delete(
|
|
1963
|
+
fns.delete(key2);
|
|
1853
1964
|
const newName = rename ? `${schemaOf(fnName)}.${rename[1]}` : `${move[1]}.${fnName.split(".")[1]}`;
|
|
1854
|
-
fns.set(newName +
|
|
1965
|
+
fns.set(newName + key2.slice(fnName.length), state);
|
|
1855
1966
|
continue;
|
|
1856
1967
|
}
|
|
1857
1968
|
const next = state ?? { definer: false, searchPath: false, file, line };
|
|
@@ -1859,7 +1970,7 @@ function checkDefinerSearchPath(ctx, migrations) {
|
|
|
1859
1970
|
if (/\bsecurity invoker\b/.test(sql)) next.definer = false;
|
|
1860
1971
|
if (/\bset search_path\b/.test(sql)) next.searchPath = true;
|
|
1861
1972
|
if (/\breset (?:search_path|all)\b/.test(sql)) Object.assign(next, { searchPath: false, file, line });
|
|
1862
|
-
fns.set(
|
|
1973
|
+
fns.set(key2, next);
|
|
1863
1974
|
}
|
|
1864
1975
|
continue;
|
|
1865
1976
|
}
|
|
@@ -1867,19 +1978,19 @@ function checkDefinerSearchPath(ctx, migrations) {
|
|
|
1867
1978
|
if (drop) {
|
|
1868
1979
|
for (const part of splitTop(drop[1])) {
|
|
1869
1980
|
const m = /^([\w$.]+)\s*/.exec(part);
|
|
1870
|
-
if (m) for (const
|
|
1981
|
+
if (m) for (const key2 of keysFor(part, m[0].length, qualify(m[1]))) fns.delete(key2);
|
|
1871
1982
|
}
|
|
1872
1983
|
}
|
|
1873
1984
|
}
|
|
1874
1985
|
}
|
|
1875
|
-
for (const [
|
|
1986
|
+
for (const [key2, at] of fns) {
|
|
1876
1987
|
if (!at.definer || at.searchPath) continue;
|
|
1877
1988
|
ctx.report({
|
|
1878
1989
|
rule: "migration-definer-search-path",
|
|
1879
1990
|
file: at.file,
|
|
1880
1991
|
line: at.line,
|
|
1881
|
-
subject:
|
|
1882
|
-
message: `${
|
|
1992
|
+
subject: key2,
|
|
1993
|
+
message: `${key2} is security definer without "set search_path"; add set search_path = '' and schema-qualify the names in its body, so a caller's objects can't stand in for yours`
|
|
1883
1994
|
});
|
|
1884
1995
|
}
|
|
1885
1996
|
}
|
|
@@ -1908,6 +2019,445 @@ function checkVersionSkew(ctx) {
|
|
|
1908
2019
|
}
|
|
1909
2020
|
}
|
|
1910
2021
|
|
|
2022
|
+
// src/doctor/semver.ts
|
|
2023
|
+
var VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
2024
|
+
function parseVersion(v) {
|
|
2025
|
+
const m = VERSION.exec(v.trim());
|
|
2026
|
+
return m ? { major: +m[1], minor: +m[2], patch: +m[3], pre: m[4] ? m[4].split(".") : [] } : null;
|
|
2027
|
+
}
|
|
2028
|
+
function compareVersions(a, b) {
|
|
2029
|
+
for (const k of ["major", "minor", "patch"]) if (a[k] !== b[k]) return a[k] < b[k] ? -1 : 1;
|
|
2030
|
+
if (!a.pre.length || !b.pre.length) return a.pre.length ? -1 : b.pre.length ? 1 : 0;
|
|
2031
|
+
for (let i = 0; i < Math.max(a.pre.length, b.pre.length); i++) {
|
|
2032
|
+
const x = a.pre[i];
|
|
2033
|
+
const y = b.pre[i];
|
|
2034
|
+
if (x === void 0) return -1;
|
|
2035
|
+
if (y === void 0) return 1;
|
|
2036
|
+
if (x === y) continue;
|
|
2037
|
+
const nx = /^\d+$/.test(x);
|
|
2038
|
+
const ny = /^\d+$/.test(y);
|
|
2039
|
+
if (nx && ny) return +x < +y ? -1 : 1;
|
|
2040
|
+
if (nx !== ny) return nx ? -1 : 1;
|
|
2041
|
+
return x < y ? -1 : 1;
|
|
2042
|
+
}
|
|
2043
|
+
return 0;
|
|
2044
|
+
}
|
|
2045
|
+
function partial(s) {
|
|
2046
|
+
const m = /^v?(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(s);
|
|
2047
|
+
if (!m) return null;
|
|
2048
|
+
const nums = [];
|
|
2049
|
+
let wild = false;
|
|
2050
|
+
for (const part of [m[1], m[2], m[3]]) {
|
|
2051
|
+
if (wild || part === void 0 || /^[xX*]$/.test(part)) {
|
|
2052
|
+
wild = true;
|
|
2053
|
+
nums.push(null);
|
|
2054
|
+
} else nums.push(+part);
|
|
2055
|
+
}
|
|
2056
|
+
return { nums, pre: m[4] && !wild ? m[4].split(".") : [] };
|
|
2057
|
+
}
|
|
2058
|
+
var ver = (major, minor, patch, pre = []) => ({ major, minor, patch, pre });
|
|
2059
|
+
function comparators(token) {
|
|
2060
|
+
const m = /^(\^|~>?|>=|<=|>|<|=)?\s*(.+)$/.exec(token);
|
|
2061
|
+
if (!m) return null;
|
|
2062
|
+
const op = m[1] ?? "";
|
|
2063
|
+
const p = partial(m[2]);
|
|
2064
|
+
if (!p) return null;
|
|
2065
|
+
const [major, mi, pa] = p.nums;
|
|
2066
|
+
if (major === null) return op === "<" || op === ">" ? [{ op: "<", v: ver(0, 0, 0, ["0"]) }] : [];
|
|
2067
|
+
const M = major;
|
|
2068
|
+
const lo = ver(M, mi ?? 0, pa ?? 0, p.pre);
|
|
2069
|
+
const next = (kind) => kind === "major" ? ver(M + 1, 0, 0, ["0"]) : kind === "minor" ? ver(M, (mi ?? 0) + 1, 0, ["0"]) : ver(M, mi ?? 0, (pa ?? 0) + 1, ["0"]);
|
|
2070
|
+
const upper = mi === null ? next("major") : pa === null ? next("minor") : null;
|
|
2071
|
+
const out = switchOp();
|
|
2072
|
+
if (p.pre.length) {
|
|
2073
|
+
for (const c of out) if (c.v === lo) c.pre = true;
|
|
2074
|
+
}
|
|
2075
|
+
return out;
|
|
2076
|
+
function switchOp() {
|
|
2077
|
+
switch (op) {
|
|
2078
|
+
case "^": {
|
|
2079
|
+
const bound = M > 0 || mi === null ? next("major") : (mi ?? 0) > 0 || pa === null ? next("minor") : next("patch");
|
|
2080
|
+
return [
|
|
2081
|
+
{ op: ">=", v: lo },
|
|
2082
|
+
{ op: "<", v: bound }
|
|
2083
|
+
];
|
|
2084
|
+
}
|
|
2085
|
+
case "~":
|
|
2086
|
+
case "~>":
|
|
2087
|
+
return [
|
|
2088
|
+
{ op: ">=", v: lo },
|
|
2089
|
+
{ op: "<", v: mi === null ? next("major") : next("minor") }
|
|
2090
|
+
];
|
|
2091
|
+
case ">":
|
|
2092
|
+
return upper ? [{ op: ">=", v: upper }] : [{ op: ">", v: lo }];
|
|
2093
|
+
case ">=":
|
|
2094
|
+
return [{ op: ">=", v: lo }];
|
|
2095
|
+
case "<":
|
|
2096
|
+
return [{ op: "<", v: lo.pre.length ? lo : ver(M, mi ?? 0, pa ?? 0, ["0"]) }];
|
|
2097
|
+
case "<=":
|
|
2098
|
+
return upper ? [{ op: "<", v: upper }] : [{ op: "<=", v: lo }];
|
|
2099
|
+
default:
|
|
2100
|
+
return upper ? [
|
|
2101
|
+
{ op: ">=", v: lo },
|
|
2102
|
+
{ op: "<", v: upper }
|
|
2103
|
+
] : [{ op: "=", v: lo }];
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
function test(c, v) {
|
|
2108
|
+
const d = compareVersions(v, c.v);
|
|
2109
|
+
return c.op === ">=" ? d >= 0 : c.op === "<=" ? d <= 0 : c.op === ">" ? d > 0 : c.op === "<" ? d < 0 : d === 0;
|
|
2110
|
+
}
|
|
2111
|
+
function parseRange(range) {
|
|
2112
|
+
const alts = [];
|
|
2113
|
+
for (const raw of range.trim().split("||")) {
|
|
2114
|
+
const alt = raw.trim();
|
|
2115
|
+
const hyphen = /^(\S+)\s+-\s+(\S+)$/.exec(alt);
|
|
2116
|
+
if (hyphen) {
|
|
2117
|
+
const from = comparators(`>=${hyphen[1]}`);
|
|
2118
|
+
const to = comparators(`<=${hyphen[2]}`);
|
|
2119
|
+
if (!from || !to) return null;
|
|
2120
|
+
alts.push([...from, ...to]);
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
const set = [];
|
|
2124
|
+
for (const token of alt.replace(/(\^|~>?|>=|<=|>|<|=)\s+/g, "$1").split(/\s+/).filter(Boolean)) {
|
|
2125
|
+
const cs = comparators(token);
|
|
2126
|
+
if (!cs) return null;
|
|
2127
|
+
set.push(...cs);
|
|
2128
|
+
}
|
|
2129
|
+
alts.push(set);
|
|
2130
|
+
}
|
|
2131
|
+
return alts;
|
|
2132
|
+
}
|
|
2133
|
+
function satisfies(version, range) {
|
|
2134
|
+
const v = parseVersion(version);
|
|
2135
|
+
const alts = parseRange(range);
|
|
2136
|
+
if (!v || !alts) return null;
|
|
2137
|
+
return alts.some(
|
|
2138
|
+
(set) => set.every((c) => test(c, v)) && (!v.pre.length || set.some((c) => c.pre && c.v.major === v.major && c.v.minor === v.minor && c.v.patch === v.patch))
|
|
2139
|
+
);
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
// src/doctor/installs.ts
|
|
2143
|
+
var GENESIS = /^@marktiderman\/genesis(?:-[\w.-]+)?$/;
|
|
2144
|
+
var readManifest = (dir) => {
|
|
2145
|
+
try {
|
|
2146
|
+
return JSON.parse(readFileSync(path3.join(dir, "package.json"), "utf8"));
|
|
2147
|
+
} catch {
|
|
2148
|
+
return null;
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2151
|
+
var real = (p) => {
|
|
2152
|
+
try {
|
|
2153
|
+
return realpathSync(p);
|
|
2154
|
+
} catch {
|
|
2155
|
+
return p;
|
|
2156
|
+
}
|
|
2157
|
+
};
|
|
2158
|
+
function packagesIn(nodeModules) {
|
|
2159
|
+
if (!existsSync(nodeModules)) return [];
|
|
2160
|
+
const out = [];
|
|
2161
|
+
for (const entry of readdirSync(nodeModules)) {
|
|
2162
|
+
if (entry.startsWith(".")) continue;
|
|
2163
|
+
const p = path3.join(nodeModules, entry);
|
|
2164
|
+
if (entry.startsWith("@")) {
|
|
2165
|
+
try {
|
|
2166
|
+
for (const sub of readdirSync(p)) out.push(path3.join(p, sub));
|
|
2167
|
+
} catch {
|
|
2168
|
+
}
|
|
2169
|
+
} else {
|
|
2170
|
+
out.push(p);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
return out;
|
|
2174
|
+
}
|
|
2175
|
+
function genesisInstalls(root) {
|
|
2176
|
+
const copies = /* @__PURE__ */ new Map();
|
|
2177
|
+
const realRoot = real(root);
|
|
2178
|
+
const rel = (abs) => path3.relative(realRoot, abs).split(path3.sep).join("/") || ".";
|
|
2179
|
+
const record = (real2, manifest, by, range) => {
|
|
2180
|
+
let copy = copies.get(real2);
|
|
2181
|
+
if (!copy) {
|
|
2182
|
+
copy = { name: manifest.name, version: String(manifest.version ?? "unknown"), dir: rel(real2), absolutePath: real2, requiredBy: [] };
|
|
2183
|
+
copies.set(real2, copy);
|
|
2184
|
+
}
|
|
2185
|
+
if (!copy.requiredBy.some((r) => r.by === by)) copy.requiredBy.push({ by, ...range ? { range } : {} });
|
|
2186
|
+
};
|
|
2187
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
2188
|
+
const queue = [];
|
|
2189
|
+
const visit = (dir, by, range) => {
|
|
2190
|
+
const manifest = readManifest(dir);
|
|
2191
|
+
if (!manifest?.name) return;
|
|
2192
|
+
const realDir = real(dir);
|
|
2193
|
+
if (GENESIS.test(manifest.name)) record(realDir, manifest, by, range);
|
|
2194
|
+
if (expanded.has(realDir)) return;
|
|
2195
|
+
expanded.add(realDir);
|
|
2196
|
+
queue.push({ real: realDir, manifest, label: `${manifest.name}@${manifest.version ?? "?"}` });
|
|
2197
|
+
};
|
|
2198
|
+
const app = readManifest(root);
|
|
2199
|
+
const appDeps = { ...app?.devDependencies, ...app?.peerDependencies, ...app?.optionalDependencies, ...app?.dependencies };
|
|
2200
|
+
for (const name of Object.keys(appDeps)) {
|
|
2201
|
+
const dir = findPackageDir(root, name);
|
|
2202
|
+
if (dir) visit(dir, "the app", appDeps[name]);
|
|
2203
|
+
}
|
|
2204
|
+
const top = path3.join(root, "node_modules");
|
|
2205
|
+
for (const dir of packagesIn(top)) {
|
|
2206
|
+
const name = path3.relative(top, dir).split(path3.sep).join("/");
|
|
2207
|
+
if (!(name in appDeps)) visit(dir, "hoisted, not a direct dependency", void 0);
|
|
2208
|
+
}
|
|
2209
|
+
while (queue.length) {
|
|
2210
|
+
const { real: from, manifest, label } = queue.shift();
|
|
2211
|
+
const deps = { ...manifest.peerDependencies, ...manifest.optionalDependencies, ...manifest.dependencies };
|
|
2212
|
+
for (const [name, range] of Object.entries(deps)) {
|
|
2213
|
+
const dir = findPackageDir(from, name);
|
|
2214
|
+
if (dir) visit(dir, label, range);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
const byName = /* @__PURE__ */ new Map();
|
|
2218
|
+
for (const copy of copies.values()) byName.set(copy.name, [...byName.get(copy.name) ?? [], copy]);
|
|
2219
|
+
for (const list of byName.values()) list.sort((a, b) => a.dir.split("/").length - b.dir.split("/").length || a.dir.localeCompare(b.dir));
|
|
2220
|
+
return byName;
|
|
2221
|
+
}
|
|
2222
|
+
function checkDuplicatePackages(ctx) {
|
|
2223
|
+
for (const [name, copies] of genesisInstalls(ctx.root)) {
|
|
2224
|
+
if (copies.length < 2) continue;
|
|
2225
|
+
const where = copies.map((c) => `${c.version} at ${c.dir} (${c.requiredBy.map((r) => `${r.by}${r.range ? ` wants ${r.range}` : ""}`).join("; ")})`).join(", ");
|
|
2226
|
+
ctx.report({
|
|
2227
|
+
rule: "duplicate-genesis-package",
|
|
2228
|
+
level: "warn",
|
|
2229
|
+
file: "package.json",
|
|
2230
|
+
subject: name,
|
|
2231
|
+
message: `${name} is installed ${copies.length} times: ${where}. Each copy is its own module, so a provider from one (DataProvider, the shell's contexts) is invisible to hooks from another. Align the ranges so one copy satisfies them all, or add an override/resolution`
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
function checkPeerRanges(ctx) {
|
|
2236
|
+
const rel = (abs) => path3.relative(ctx.root, abs).split(path3.sep).join("/");
|
|
2237
|
+
for (const copies of genesisInstalls(ctx.root).values()) {
|
|
2238
|
+
for (const copy of copies) {
|
|
2239
|
+
const dir = copy.absolutePath;
|
|
2240
|
+
const peers = readManifest(dir)?.peerDependencies ?? {};
|
|
2241
|
+
for (const [peer, range] of Object.entries(peers)) {
|
|
2242
|
+
if (!GENESIS.test(peer)) continue;
|
|
2243
|
+
const peerDir = findPackageDir(dir, peer);
|
|
2244
|
+
const installed = peerDir && readManifest(peerDir)?.version;
|
|
2245
|
+
if (!peerDir || !installed) continue;
|
|
2246
|
+
if (satisfies(installed, range) !== false) continue;
|
|
2247
|
+
ctx.report({
|
|
2248
|
+
rule: "peer-range-mismatch",
|
|
2249
|
+
level: "warn",
|
|
2250
|
+
file: "package.json",
|
|
2251
|
+
subject: `${copy.name}>${peer}`,
|
|
2252
|
+
message: `${copy.name}@${copy.version} (${copy.dir}) wants ${peer} ${range}, but ${installed} is installed (${rel(peerDir)}). Install a ${peer} in that range, or a ${copy.name} release built against ${installed}`
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
var ROUTES_DIR_CANDIDATES = ["src/routes", "src/app", "app", "src/pages", "pages"];
|
|
2259
|
+
var LAYOUT_STEMS = /* @__PURE__ */ new Set(["route", "layout", "_layout", "__root", "_app"]);
|
|
2260
|
+
var INDEX_STEMS = /* @__PURE__ */ new Set(["index", "page"]);
|
|
2261
|
+
var NON_PAGE_ELEMENTS = /* @__PURE__ */ new Set(["Navigate", "Redirect", "Outlet", "Fragment", "React.Fragment"]);
|
|
2262
|
+
var HTML_ELEMENT = /(?<![\w$.])<(?:[a-z][\w-]*(?=[\s>/])|>)/;
|
|
2263
|
+
function routesDir(ctx) {
|
|
2264
|
+
if (ctx.config.routesDir) return ctx.config.routesDir;
|
|
2265
|
+
return ROUTES_DIR_CANDIDATES.find((d) => existsSync(path3.join(ctx.root, d))) ?? null;
|
|
2266
|
+
}
|
|
2267
|
+
var key = (segments) => segments.map((s) => s.replace(/_$/, "")).join("/");
|
|
2268
|
+
function webRoutes(ctx) {
|
|
2269
|
+
const dir = routesDir(ctx);
|
|
2270
|
+
if (!dir) return [];
|
|
2271
|
+
const routes = [];
|
|
2272
|
+
for (const file of ctx.files) {
|
|
2273
|
+
if (!JSX_EXTS2.has(file.ext) || !file.path.startsWith(`${dir}/`)) continue;
|
|
2274
|
+
const rel = file.path.slice(dir.length + 1).replace(/\.[^.]+$/, "");
|
|
2275
|
+
const parts = rel.split("/");
|
|
2276
|
+
if (parts.some((p) => p.startsWith("-"))) continue;
|
|
2277
|
+
const stem = parts.pop();
|
|
2278
|
+
const segments = [...parts, ...LAYOUT_STEMS.has(stem) || INDEX_STEMS.has(stem) ? [] : stem.split(".")];
|
|
2279
|
+
let index = INDEX_STEMS.has(stem);
|
|
2280
|
+
if (!index && !LAYOUT_STEMS.has(stem) && INDEX_STEMS.has(segments.at(-1) ?? "")) {
|
|
2281
|
+
segments.pop();
|
|
2282
|
+
index = true;
|
|
2283
|
+
}
|
|
2284
|
+
const elements = renderedElements(file.code);
|
|
2285
|
+
const layout = LAYOUT_STEMS.has(stem) || elements.includes("Outlet");
|
|
2286
|
+
routes.push({
|
|
2287
|
+
file,
|
|
2288
|
+
segments,
|
|
2289
|
+
index,
|
|
2290
|
+
layout,
|
|
2291
|
+
detail: !index && !layout && /^(?:\$|\[)/.test(segments.at(-1) ?? ""),
|
|
2292
|
+
redirectOnly: elements.every((e) => NON_PAGE_ELEMENTS.has(e)) && !HTML_ELEMENT.test(file.code),
|
|
2293
|
+
parents: []
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
for (const r of routes) {
|
|
2297
|
+
const own = r.segments;
|
|
2298
|
+
for (const p of routes) {
|
|
2299
|
+
if (p === r || !p.layout) continue;
|
|
2300
|
+
const n = p.segments.length;
|
|
2301
|
+
if (n > own.length || n === own.length && !(r.index && !r.layout)) continue;
|
|
2302
|
+
if (key(own.slice(0, n)) !== key(p.segments)) continue;
|
|
2303
|
+
if (n > 0 && own[n - 1].endsWith("_") && !p.segments[n - 1].endsWith("_")) continue;
|
|
2304
|
+
r.parents.push(p);
|
|
2305
|
+
}
|
|
2306
|
+
r.parents.sort((a, b) => b.segments.length - a.segments.length);
|
|
2307
|
+
}
|
|
2308
|
+
return routes;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// src/doctor/structure.ts
|
|
2312
|
+
var SUB_NAV_DOCS = "https://github.com/marktiderman/genesis/blob/main/packages/ui/SKILL.md (Sub-navigation)";
|
|
2313
|
+
var CONTAINER = /(?:Card|CardContent|Dialog|DialogContent|Sheet|SheetContent|Drawer|DrawerContent|Popover|PopoverContent|Modal|Accordion|AccordionContent|AccordionItem|Collapsible|CollapsibleContent|Tooltip|Menu|MenuContent|Panel|Table|TabsContent)$/;
|
|
2314
|
+
var SWITCHER = /<(TabsList|SubNavTabs)(?=[\s>/])/g;
|
|
2315
|
+
var SHELL = /<AppShell(?=[\s>/])/;
|
|
2316
|
+
var GENESIS_PACKAGE = /^@marktiderman\/genesis(?:-[\w-]+)?(?:\/|$)/;
|
|
2317
|
+
var PAGE_LAYOUT = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)$/;
|
|
2318
|
+
var PACKAGE_SCREEN = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell|Screen|Workspace)$/;
|
|
2319
|
+
var isNative = (ctx) => ctx.config.packs?.includes("native") ?? false;
|
|
2320
|
+
var rendersRe = (names) => {
|
|
2321
|
+
const list = [...names];
|
|
2322
|
+
return list.length ? new RegExp(`<(?:${list.map((n) => n.replace(/[.$]/g, "\\$&")).join("|")})(?=[\\s>/])`) : null;
|
|
2323
|
+
};
|
|
2324
|
+
function insideShell(ctx, routes) {
|
|
2325
|
+
const shell = new Set(routes.filter((r) => viaOneImport(ctx.root, ctx.files, r.file, (code) => SHELL.test(code))));
|
|
2326
|
+
const anyShell = shell.size === 0 && ctx.files.some((f) => SHELL.test(f.code));
|
|
2327
|
+
return (r) => !shell.has(r) && (anyShell || r.parents.some((p) => shell.has(p)));
|
|
2328
|
+
}
|
|
2329
|
+
function checkHandRolledSubNav(ctx) {
|
|
2330
|
+
if (isNative(ctx) || !ctx.genesis.values.has("useAppShellSubNav")) return;
|
|
2331
|
+
const routes = webRoutes(ctx);
|
|
2332
|
+
if (routes.length === 0) return;
|
|
2333
|
+
const inShell = insideShell(ctx, routes);
|
|
2334
|
+
const ui = ctx.genesis.uiPackage;
|
|
2335
|
+
for (const r of routes) {
|
|
2336
|
+
if (!inShell(r)) continue;
|
|
2337
|
+
const code = r.file.code;
|
|
2338
|
+
if (/\buseAppShellSubNav\s*\(/.test(code)) continue;
|
|
2339
|
+
for (const m of code.matchAll(SWITCHER)) {
|
|
2340
|
+
if (openElementsAt(code, m.index, (n) => CONTAINER.test(n)).length > 0) continue;
|
|
2341
|
+
ctx.report({
|
|
2342
|
+
rule: "hand-rolled-sub-nav",
|
|
2343
|
+
level: "warn",
|
|
2344
|
+
file: r.file.path,
|
|
2345
|
+
line: lineAt(code, m.index),
|
|
2346
|
+
subject: m[1],
|
|
2347
|
+
message: `switches the page's sections with its own <${m[1]}>; hand them to the shell with useAppShellSubNav(items, { mode: "tabs" }) and put the header in AppShellPageHeader (chips in AppShellSubNavEnd), from ${ui}/layout, so the sections are the shell's tab row and the phone's bottom bar. See ${SUB_NAV_DOCS}`
|
|
2348
|
+
});
|
|
2349
|
+
break;
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
function checkLocalGenesisCopies(ctx) {
|
|
2354
|
+
const owner = /* @__PURE__ */ new Map();
|
|
2355
|
+
for (const c of ctx.genesis.companions) for (const name of c.components) owner.set(name, c.package);
|
|
2356
|
+
for (const name of ctx.genesis.components) owner.set(name, ctx.genesis.uiPackage);
|
|
2357
|
+
if (owner.size === 0) return;
|
|
2358
|
+
const decl = /\b(export\s+(?:default\s+)?)?(?:declare\s+)?(?:async\s+)?(?:function\*?|const|let|var|class)\s+([A-Z][\w$]*)\b/g;
|
|
2359
|
+
const routes = routesDir(ctx);
|
|
2360
|
+
for (const file of ctx.files) {
|
|
2361
|
+
if (!JSX_EXTS2.has(file.ext)) continue;
|
|
2362
|
+
const imported = new Set(namedImportsFrom(file.code, GENESIS_PACKAGE));
|
|
2363
|
+
const inRoutes = routes !== null && file.path.startsWith(`${routes}/`);
|
|
2364
|
+
const routeComponents = new Set([...file.code.matchAll(/\b\w*[cC]omponent\s*:\s*([A-Z][\w$]*)\b/g)].map((r) => r[1]));
|
|
2365
|
+
const decls = [...file.code.matchAll(decl)];
|
|
2366
|
+
decls.forEach((m, i) => {
|
|
2367
|
+
const [, exported, name] = m;
|
|
2368
|
+
const pkg = owner.get(name);
|
|
2369
|
+
if (!pkg || imported.has(name) || routeComponents.has(name)) return;
|
|
2370
|
+
if (inRoutes && !exported && !new RegExp(`\\bexport\\s*(?:default\\s+${name}\\b|\\{[^}]*\\b${name}\\b)`).test(file.code)) return;
|
|
2371
|
+
const body = file.code.slice(m.index + m[0].length, decls[i + 1]?.index ?? file.code.length);
|
|
2372
|
+
if (!rendersJsx(body)) return;
|
|
2373
|
+
if (exported && pkg === ctx.genesis.uiPackage && ctx.genesis.values.has(name)) return;
|
|
2374
|
+
const init = file.code.slice(m.index + m[0].length, m.index + m[0].length + 400).split(";")[0];
|
|
2375
|
+
if (/["']@marktiderman\/genesis/.test(init)) return;
|
|
2376
|
+
ctx.report({
|
|
2377
|
+
rule: "local-genesis-copy",
|
|
2378
|
+
level: "warn",
|
|
2379
|
+
file: file.path,
|
|
2380
|
+
line: lineAt(file.code, m.index),
|
|
2381
|
+
subject: name,
|
|
2382
|
+
message: `defines its own ${name}; Genesis already has ${name} (${pkg}). Use it, or extend it upstream`
|
|
2383
|
+
});
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
function checkResourceWorkspaces(ctx) {
|
|
2388
|
+
if (isNative(ctx) || !ctx.genesis.values.has("AppShellPageHeader")) return;
|
|
2389
|
+
const header = /<AppShellPageHeader(?=[\s>/])/;
|
|
2390
|
+
const byFolder = /* @__PURE__ */ new Map();
|
|
2391
|
+
for (const r of webRoutes(ctx)) {
|
|
2392
|
+
if (!r.detail || r.redirectOnly) continue;
|
|
2393
|
+
const dir = r.file.path.slice(0, r.file.path.lastIndexOf("/"));
|
|
2394
|
+
byFolder.set(dir, [...byFolder.get(dir) ?? [], r]);
|
|
2395
|
+
}
|
|
2396
|
+
for (const [dir, routes] of byFolder) {
|
|
2397
|
+
const has = routes.filter((r) => viaOneImport(ctx.root, ctx.files, r.file, (code) => header.test(code)));
|
|
2398
|
+
if (has.length === 0) continue;
|
|
2399
|
+
const ref = has.map((r) => r.file.path.slice(dir.length + 1)).join(", ");
|
|
2400
|
+
for (const r of routes) {
|
|
2401
|
+
if (has.includes(r)) continue;
|
|
2402
|
+
ctx.report({
|
|
2403
|
+
rule: "resource-workspace",
|
|
2404
|
+
level: "info",
|
|
2405
|
+
file: r.file.path,
|
|
2406
|
+
message: `is a detail page without AppShellPageHeader, unlike ${ref} beside it; put its header in AppShellPageHeader and its sections in useAppShellSubNav so every workspace in ${dir} has the same header, tabs and phone bar`
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
function checkPageLayouts(ctx) {
|
|
2412
|
+
if (isNative(ctx)) return;
|
|
2413
|
+
const layouts = new Set(ctx.genesis.components.filter((n) => PAGE_LAYOUT.test(n)));
|
|
2414
|
+
for (const c of ctx.genesis.companions) for (const n of c.components) if (PAGE_LAYOUT.test(n)) layouts.add(n);
|
|
2415
|
+
if (layouts.size === 0) return;
|
|
2416
|
+
const routes = webRoutes(ctx);
|
|
2417
|
+
const inShell = insideShell(ctx, routes);
|
|
2418
|
+
const rendersLayout = (code) => {
|
|
2419
|
+
const names = new Set(layouts);
|
|
2420
|
+
for (const n of namedImportsFrom(code, GENESIS_PACKAGE)) if (PACKAGE_SCREEN.test(n)) names.add(n);
|
|
2421
|
+
return rendersRe(names)?.test(code) ?? false;
|
|
2422
|
+
};
|
|
2423
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2424
|
+
const provides = (r) => {
|
|
2425
|
+
if (!cache.has(r)) cache.set(r, viaOneImport(ctx.root, ctx.files, r.file, rendersLayout));
|
|
2426
|
+
return cache.get(r);
|
|
2427
|
+
};
|
|
2428
|
+
const list = [...layouts].sort();
|
|
2429
|
+
const named = list.length > 4 ? `${list.slice(0, 4).join(", ")}, \u2026` : list.join(", ");
|
|
2430
|
+
for (const r of routes) {
|
|
2431
|
+
if (r.layout || r.redirectOnly || !inShell(r)) continue;
|
|
2432
|
+
if (provides(r) || r.parents.some(provides)) continue;
|
|
2433
|
+
ctx.report({
|
|
2434
|
+
rule: "page-layout",
|
|
2435
|
+
level: "warn",
|
|
2436
|
+
file: r.file.path,
|
|
2437
|
+
message: `renders no Genesis page layout (${named}) itself, through one local import, or from a layout route around it; wrap it in one so the header, width and spacing match every other page`
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
// src/doctor/dates.ts
|
|
2443
|
+
var SCRIPT_EXTS4 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
2444
|
+
var ISO_DAY_CUT = /\.toISOString\(\)\s*\.\s*(?:slice\(\s*0\s*,\s*10\s*\)|substring\(\s*0\s*,\s*10\s*\)|substr\(\s*0\s*,\s*10\s*\)|split\(\s*(["'`])T\1\s*\)\s*\[\s*0\s*\]|split\(\s*(["'`])T\2\s*\)\s*\.\s*at\(\s*0\s*\))/g;
|
|
2445
|
+
function checkIsoDateSlices(ctx) {
|
|
2446
|
+
for (const file of ctx.files) {
|
|
2447
|
+
if (!SCRIPT_EXTS4.has(file.ext) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(file.path)) continue;
|
|
2448
|
+
for (const m of file.code.matchAll(ISO_DAY_CUT)) {
|
|
2449
|
+
ctx.report({
|
|
2450
|
+
rule: "iso-date-slice",
|
|
2451
|
+
level: "warn",
|
|
2452
|
+
file: file.path,
|
|
2453
|
+
line: lineAt(file.code, m.index ?? 0),
|
|
2454
|
+
subject: "toISOString",
|
|
2455
|
+
message: "cuts a day from an ISO timestamp, which is the day in UTC, not the person's; use personDay(person) or dayIn(zone) from @marktiderman/genesis-core/dates (allow it with a reason where UTC is meant)"
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
|
|
1911
2461
|
// src/doctor/index.ts
|
|
1912
2462
|
async function runDoctor(options = {}) {
|
|
1913
2463
|
const root = path3.resolve(options.root ?? process.cwd());
|
|
@@ -1923,18 +2473,7 @@ async function runDoctor(options = {}) {
|
|
|
1923
2473
|
}
|
|
1924
2474
|
const raw = [];
|
|
1925
2475
|
const ctx = { root, files, genesis, config, report: (f) => raw.push(f) };
|
|
1926
|
-
const
|
|
1927
|
-
{ name: "layout", check: checkProjectLayout },
|
|
1928
|
-
{ name: "imports", check: checkImports },
|
|
1929
|
-
{ name: "raw-tags", check: checkRawTags },
|
|
1930
|
-
{ name: "colors", check: checkColors },
|
|
1931
|
-
{ name: "tokens", check: checkTokens },
|
|
1932
|
-
{ name: "shadowed-exports", check: checkShadowedExports },
|
|
1933
|
-
{ name: "version-skew", check: checkVersionSkew },
|
|
1934
|
-
...config.packs?.includes("native") ? [{ name: "native", check: checkNativePack }] : [],
|
|
1935
|
-
...config.packs?.includes("supabase") ? [{ name: "supabase", check: checkSupabasePack }] : []
|
|
1936
|
-
];
|
|
1937
|
-
for (const plugin of [...builtins, ...patterns ? [patterns.plugin] : [], ...plugins]) {
|
|
2476
|
+
for (const plugin of [...builtinChecks(config), ...patterns ? [patterns.plugin] : [], ...plugins]) {
|
|
1938
2477
|
try {
|
|
1939
2478
|
await plugin.check(ctx);
|
|
1940
2479
|
} catch (err) {
|
|
@@ -1948,7 +2487,8 @@ async function runDoctor(options = {}) {
|
|
|
1948
2487
|
}
|
|
1949
2488
|
const findings = applyConfig(raw, config);
|
|
1950
2489
|
const errors = findings.filter((f) => f.level === "error").length;
|
|
1951
|
-
const warnings = findings.
|
|
2490
|
+
const warnings = findings.filter((f) => f.level === "warn").length;
|
|
2491
|
+
const infos = findings.length - errors - warnings;
|
|
1952
2492
|
return {
|
|
1953
2493
|
ok: errors === 0 && !(options.strict && warnings > 0),
|
|
1954
2494
|
root,
|
|
@@ -1957,8 +2497,32 @@ async function runDoctor(options = {}) {
|
|
|
1957
2497
|
unused: unusedComponents(ctx),
|
|
1958
2498
|
ruleCount: (patterns?.count ?? 0) + plugins.length,
|
|
1959
2499
|
errors,
|
|
1960
|
-
warnings
|
|
2500
|
+
warnings,
|
|
2501
|
+
infos
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
function builtinChecks(config) {
|
|
2505
|
+
const packs = {
|
|
2506
|
+
native: { name: "native", check: checkNativePack },
|
|
2507
|
+
supabase: { name: "supabase", check: checkSupabasePack }
|
|
1961
2508
|
};
|
|
2509
|
+
return [
|
|
2510
|
+
{ name: "layout", check: checkProjectLayout },
|
|
2511
|
+
{ name: "imports", check: checkImports },
|
|
2512
|
+
{ name: "raw-tags", check: checkRawTags },
|
|
2513
|
+
{ name: "colors", check: checkColors },
|
|
2514
|
+
{ name: "tokens", check: checkTokens },
|
|
2515
|
+
{ name: "shadowed-exports", check: checkShadowedExports },
|
|
2516
|
+
{ name: "version-skew", check: checkVersionSkew },
|
|
2517
|
+
{ name: "duplicate-packages", check: checkDuplicatePackages },
|
|
2518
|
+
{ name: "peer-ranges", check: checkPeerRanges },
|
|
2519
|
+
{ name: "hand-rolled-sub-nav", check: checkHandRolledSubNav },
|
|
2520
|
+
{ name: "local-genesis-copies", check: checkLocalGenesisCopies },
|
|
2521
|
+
{ name: "resource-workspaces", check: checkResourceWorkspaces },
|
|
2522
|
+
{ name: "page-layouts", check: checkPageLayouts },
|
|
2523
|
+
{ name: "iso-date-slices", check: checkIsoDateSlices },
|
|
2524
|
+
...(config.packs ?? []).map((p) => packs[p])
|
|
2525
|
+
];
|
|
1962
2526
|
}
|
|
1963
2527
|
function applyConfig(raw, config) {
|
|
1964
2528
|
const allow = (config.allow ?? []).map((entry) => ({ entry, file: entry.file ? globToRegExp(entry.file) : null, used: false }));
|
|
@@ -2006,7 +2570,8 @@ function formatReport(result) {
|
|
|
2006
2570
|
lines.push(`${f.level.toUpperCase().padEnd(5)} ${f.file}${f.line ? `:${f.line}` : ""} [${f.rule}] ${f.message}`);
|
|
2007
2571
|
}
|
|
2008
2572
|
lines.push(`Available but unused (${result.unused.length}): ${result.unused.join(", ") || "none"}`);
|
|
2009
|
-
|
|
2573
|
+
const info = result.infos ? `, ${result.infos} info` : "";
|
|
2574
|
+
lines.push(result.ok ? `PASS (${result.warnings} warnings${info})` : `FAIL (${result.errors} errors, ${result.warnings} warnings${info})`);
|
|
2010
2575
|
return lines.join("\n");
|
|
2011
2576
|
}
|
|
2012
2577
|
function toJson(result) {
|
|
@@ -2015,6 +2580,7 @@ function toJson(result) {
|
|
|
2015
2580
|
genesis: `${result.genesis.uiPackage}@${result.genesis.uiVersion}`,
|
|
2016
2581
|
errors: result.errors,
|
|
2017
2582
|
warnings: result.warnings,
|
|
2583
|
+
infos: result.infos,
|
|
2018
2584
|
findings: result.findings,
|
|
2019
2585
|
unused: result.unused
|
|
2020
2586
|
};
|
|
@@ -2025,10 +2591,11 @@ function genesisSummary(g) {
|
|
|
2025
2591
|
components: g.components,
|
|
2026
2592
|
tokens: [...g.tokens].sort(),
|
|
2027
2593
|
rawTags: Object.fromEntries(g.rawTags),
|
|
2028
|
-
palette: g.palette
|
|
2594
|
+
palette: g.palette,
|
|
2595
|
+
companions: Object.fromEntries(g.companions.map((c) => [`${c.package}@${c.version}`, c.components]))
|
|
2029
2596
|
};
|
|
2030
2597
|
}
|
|
2031
2598
|
|
|
2032
|
-
export { BUILTIN_RULES, DoctorConfigError, GenesisConfigError, defineDoctorPlugin, findPackageDir, formatReport, genesisSummary, globToRegExp, loadConfig, loadGenesis, nativeLayouts, parseExportNames, parseRulesMarkdown, readGenesisConfig, readPackageExports, readReleaseManifest, runDoctor, sqlStatements, toJson, validateConfig, validateLinks };
|
|
2599
|
+
export { BUILTIN_RULES, DoctorConfigError, GenesisConfigError, builtinChecks, defineDoctorPlugin, findPackageDir, formatReport, genesisInstalls, genesisSummary, globToRegExp, loadConfig, loadGenesis, nativeLayouts, parseExportNames, parseRulesMarkdown, readGenesisConfig, readPackageExports, readReleaseManifest, routesDir, runDoctor, satisfies, sqlStatements, toJson, validateConfig, validateLinks, webRoutes };
|
|
2033
2600
|
//# sourceMappingURL=doctor.js.map
|
|
2034
2601
|
//# sourceMappingURL=doctor.js.map
|