@marktiderman/genesis-cli 1.1.1 → 1.3.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 +189 -4
- package/dist/cli.js +1286 -26
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +232 -0
- package/dist/doctor.js +1021 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1004 -9
- package/dist/index.js.map +1 -1
- package/dist/vite.d.ts +15 -0
- package/dist/vite.js +1092 -0
- package/dist/vite.js.map +1 -0
- package/package.json +22 -3
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/doctor/build.ts","../src/doctor/config.ts","../src/doctor/glob.ts","../src/doctor/genesis.ts","../../../scripts/lib/color-literals.mjs","../src/doctor/scan.ts","../src/doctor/patterns.ts","../src/doctor/plugins.ts","../src/doctor/rules.ts","../src/doctor/index.ts","../src/vite.ts"],"names":["path","path2","existsSync","readFileSync","path4","statSync","readdirSync","path5","path6","createRequire","path7","path8","path9"],"mappings":";;;;;;;AASO,IAAM,eAAA,GAAkB,yBAAA;AAGxB,SAAS,aAAA,CAAc,MAAc,MAAA,EAAgC;AAC1E,EAAA,IAAI,MAAA,CAAO,KAAA,EAAO,OAAO,MAAA,CAAO,KAAA;AAChC,EAAA,MAAM,OAAA,GAAeA,KAAA,CAAA,IAAA,CAAK,IAAA,EAAM,cAAc,CAAA;AAC9C,EAAA,MAAM,OAAA,GAAkC,UAAA,CAAW,OAAO,CAAA,GAAI,KAAK,KAAA,CAAM,YAAA,CAAa,OAAA,EAAS,MAAM,CAAC,CAAA,CAAE,OAAA,IAAW,KAAK,EAAC;AACzH,EAAA,MAAM,EAAA,GAAK,eAAe,IAAI,CAAA;AAC9B,EAAA,OAAO,CAAC,WAAA,EAAa,OAAO,EAAE,MAAA,CAAO,CAAC,MAAM,OAAA,CAAQ,CAAC,CAAC,CAAA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QAAA,MAAA,CAAO,OAAA,CAAQ,EAAA,CAAG,QAAA,EAAU,QAAQ,CAAA;AACpC,QAAA,MAAA,CAAO,OAAA,CAAQ,EAAA,CAAG,KAAA,EAAO,QAAQ,CAAA;AACjC,QAAA,MAAA,CAAO,OAAA,CAAQ,EAAA,CAAG,QAAA,EAAU,QAAQ,CAAA;AACpC,QAAA,MAAA,CAAO,EAAA,CAAG,EAAA,CAAG,YAAA,EAAc,MAAM;AAC/B,UAAA,IAAI,WAAW,MAAA,CAAO,EAAA,CAAG,IAAA,CAAK,EAAE,MAAM,OAAA,EAAS,GAAA,EAAK,EAAE,OAAA,EAAS,WAAW,KAAA,EAAO,EAAA,EAAI,MAAA,EAAQ,gBAAA,IAAoB,CAAA;AAAA,QACnH,CAAC,CAAA;AACD,QAAA,MAAA,CAAO,YAAY,IAAA,CAAK,WAAA,EAAa,MAAM,KAAK,OAAO,CAAA;AACvD,QAAA,IAAI,CAAC,MAAA,CAAO,UAAA,EAAY,KAAK,KAAA,EAAM;AAAA,MACrC;AAAA;AACF,GACF;AACF","file":"vite.js","sourcesContent":["/**\n * `genesis doctor --build`: run the app's typecheck and build after the checks.\n */\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { DoctorConfig, FindingInput } from \"./types.js\";\n\n/** Set for build children, so a build that itself runs `genesis doctor --build` doesn't recurse. */\nexport const BUILD_GUARD_ENV = \"GENESIS_DOCTOR_BUILDING\";\n\n/** The commands `--build` runs: config `build`, else the app's `typecheck` and `build` scripts. */\nexport function buildCommands(root: string, config: DoctorConfig): string[] {\n if (config.build) return config.build;\n const pkgFile = path.join(root, \"package.json\");\n const scripts: Record<string, string> = existsSync(pkgFile) ? JSON.parse(readFileSync(pkgFile, \"utf8\")).scripts ?? {} : {};\n const pm = packageManager(root);\n return [\"typecheck\", \"build\"].filter((s) => scripts[s]).map((s) => `${pm} run ${s}`);\n}\n\nexport function packageManager(root: string): string {\n let dir = path.resolve(root);\n for (;;) {\n if (existsSync(path.join(dir, \"pnpm-lock.yaml\"))) return \"pnpm\";\n if (existsSync(path.join(dir, \"bun.lock\")) || existsSync(path.join(dir, \"bun.lockb\"))) return \"bun\";\n if (existsSync(path.join(dir, \"yarn.lock\"))) return \"yarn\";\n if (existsSync(path.join(dir, \"package-lock.json\"))) return \"npm\";\n const parent = path.dirname(dir);\n if (parent === dir) return \"npm\";\n dir = parent;\n }\n}\n\n/** Run each command in order; stop at the first failure and return it as a finding. */\nexport function runBuild(root: string, commands: string[], quiet: boolean): FindingInput | null {\n if (process.env[BUILD_GUARD_ENV]) return null;\n if (commands.length === 0) {\n return { rule: \"build\", level: \"warn\", file: \"package.json\", message: \"--build found nothing to run: add typecheck/build scripts or doctor.build\" };\n }\n for (const command of commands) {\n // Commands come from the app's own config or package.json, so a shell is fine.\n const r = spawnSync(command, {\n cwd: root,\n shell: true,\n stdio: quiet ? \"pipe\" : \"inherit\",\n env: { ...process.env, [BUILD_GUARD_ENV]: \"1\" },\n });\n if (r.status !== 0) {\n const tail = quiet ? `\\n${String(r.stderr ?? \"\").trim().split(\"\\n\").slice(-20).join(\"\\n\")}` : \"\";\n return { rule: \"build\", file: command, message: `\\`${command}\\` failed (exit ${r.status ?? r.signal})${tail}` };\n }\n }\n return null;\n}\n","/**\n * Finds and validates the doctor's config.\n *\n * Lookup order: `--config <path>`, then `genesis.config.json` in the app\n * root, then the `genesis` key of package.json. Either file holds the\n * settings under `doctor`, leaving room for other commands' settings.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { DoctorConfig } from \"./types.js\";\n\nexport class DoctorConfigError extends Error {\n override name = \"DoctorConfigError\";\n}\n\nexport interface LoadedConfig {\n config: DoctorConfig;\n /** The file it came from, or null when no config exists (defaults apply). */\n file: string | null;\n /** Folder that relative plugin paths resolve against. */\n dir: string;\n}\n\nconst STRING_LISTS = [\"src\", \"extensions\", \"ignore\", \"tokenFiles\", \"ignoreTokenPrefixes\", \"localPrimitiveDirs\", \"build\"] as const;\nconst STRINGS = [\"uiPackage\", \"rulesDoc\"] as const;\nconst KNOWN = new Set<string>([\n ...STRING_LISTS,\n ...STRINGS,\n \"themeCss\",\n \"rawTags\",\n \"forbiddenImports\",\n \"rules\",\n \"allow\",\n \"patterns\",\n \"plugins\",\n \"$schema\",\n \"$comment\",\n]);\nconst LEVELS = new Set([\"error\", \"warn\", \"off\"]);\nconst PATTERN_KEYS = new Set([\"id\", \"level\", \"files\", \"exclude\", \"forbid\", \"require\", \"path\", \"message\"]);\n\nexport function loadConfig(root: string, configPath?: string): LoadedConfig {\n if (configPath) {\n const file = path.resolve(root, configPath);\n if (!existsSync(file)) throw new DoctorConfigError(`Config file not found: ${configPath}`);\n const json = readJson(file);\n // An explicit file may hold the block at the top level or under `doctor`\n // (or, for a package.json, under `genesis.doctor`).\n const block = path.basename(file) === \"package.json\" ? json?.genesis?.doctor : json?.doctor ?? json;\n return { config: validateConfig(block ?? {}, file), file, dir: path.dirname(file) };\n }\n const own = path.join(root, \"genesis.config.json\");\n if (existsSync(own)) {\n return { config: validateConfig(readJson(own)?.doctor ?? {}, own), file: own, dir: root };\n }\n const pkg = path.join(root, \"package.json\");\n if (existsSync(pkg)) {\n const block = readJson(pkg)?.genesis?.doctor;\n if (block !== undefined) return { config: validateConfig(block, pkg), file: pkg, dir: root };\n }\n return { config: {}, file: null, dir: root };\n}\n\nfunction readJson(file: string) {\n try {\n return JSON.parse(readFileSync(file, \"utf8\"));\n } catch (err) {\n throw new DoctorConfigError(`${file} is not valid JSON: ${(err as Error).message}`);\n }\n}\n\n/** Check the shape, so a typo fails loudly instead of silently disabling a check. */\nexport function validateConfig(raw: unknown, source = \"config\"): DoctorConfig {\n const fail = (msg: string): never => {\n throw new DoctorConfigError(`${source}: ${msg}`);\n };\n if (!isObject(raw)) fail(\"the doctor settings must be an object\");\n const c = raw as Record<string, unknown>;\n for (const key of Object.keys(c)) if (!KNOWN.has(key)) fail(`unknown setting \"${key}\"`);\n // themeCss takes one stylesheet or several; normalize to a list.\n if (typeof c.themeCss === \"string\") c.themeCss = [c.themeCss];\n if (c.themeCss !== undefined && !isStringList(c.themeCss)) fail(`\"themeCss\" must be a path or a list of paths`);\n for (const key of STRING_LISTS) {\n if (c[key] !== undefined && !isStringList(c[key])) fail(`\"${key}\" must be a list of strings`);\n }\n for (const key of STRINGS) {\n if (c[key] !== undefined && typeof c[key] !== \"string\") fail(`\"${key}\" must be a string`);\n }\n if (c.rawTags !== undefined) {\n if (!isObject(c.rawTags)) fail(`\"rawTags\" must be an object`);\n for (const [tag, v] of Object.entries(c.rawTags as object)) {\n if (!/^[a-z][a-z0-9-]*$/.test(tag)) fail(`rawTags: \"${tag}\" is not an HTML tag name`);\n if (v !== false && typeof v !== \"string\") fail(`rawTags.${tag} must be a component name or false`);\n }\n }\n if (c.forbiddenImports !== undefined) {\n if (!isObject(c.forbiddenImports)) fail(`\"forbiddenImports\" must be an object of pattern → message`);\n for (const [re, msg] of Object.entries(c.forbiddenImports as object)) {\n if (typeof msg !== \"string\") fail(`forbiddenImports[\"${re}\"] must be a message string`);\n checkRegExp(re, `forbiddenImports[\"${re}\"]`, fail);\n }\n }\n if (c.rules !== undefined) {\n if (!isObject(c.rules)) fail(`\"rules\" must be an object of rule → level`);\n for (const [rule, level] of Object.entries(c.rules as object)) {\n if (!LEVELS.has(level as string)) fail(`rules.${rule} must be \"error\", \"warn\" or \"off\"`);\n }\n }\n if (c.allow !== undefined) {\n if (!Array.isArray(c.allow)) fail(`\"allow\" must be a list`);\n (c.allow as unknown[]).forEach((e, i) => {\n if (!isObject(e)) return fail(`allow[${i}] must be an object`);\n const entry = e as Record<string, unknown>;\n if (typeof entry.rule !== \"string\" || !entry.rule) fail(`allow[${i}] needs a \"rule\"`);\n if (typeof entry.reason !== \"string\" || !entry.reason.trim()) fail(`allow[${i}] (${entry.rule}) needs a \"reason\"`);\n for (const k of [\"file\", \"match\"]) {\n if (entry[k] !== undefined && typeof entry[k] !== \"string\") fail(`allow[${i}].${k} must be a string`);\n }\n });\n }\n if (c.patterns !== undefined) {\n if (!Array.isArray(c.patterns)) fail(`\"patterns\" must be a list`);\n (c.patterns as unknown[]).forEach((p, i) => {\n if (!isObject(p)) return fail(`patterns[${i}] must be an object`);\n const rule = p as Record<string, unknown>;\n for (const k of Object.keys(rule)) if (!PATTERN_KEYS.has(k)) fail(`patterns[${i}]: unknown key \"${k}\"`);\n if (typeof rule.id !== \"string\" || !rule.id) fail(`patterns[${i}] needs an \"id\"`);\n for (const k of [\"files\", \"exclude\"]) {\n if (rule[k] !== undefined && !isStringList(rule[k])) fail(`patterns[${i}].${k} must be a list of globs`);\n }\n });\n }\n if (c.plugins !== undefined) {\n const ok =\n Array.isArray(c.plugins) &&\n c.plugins.every((p) => typeof p === \"string\" || (Array.isArray(p) && p.length === 2 && typeof p[0] === \"string\"));\n if (!ok) fail(`\"plugins\" must be a list of module paths or [path, options] pairs`);\n }\n return c as DoctorConfig;\n}\n\nexport function checkRegExp(source: string, where: string, fail: (msg: string) => never): void {\n try {\n new RegExp(source);\n } catch (err) {\n fail(`${where} is not a valid regular expression: ${(err as Error).message}`);\n }\n}\n\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction isStringList(v: unknown): v is string[] {\n return Array.isArray(v) && v.every((x) => typeof x === \"string\");\n}\n","/**\n * Minimal globs for config: `*` matches within a folder, `**` across folders,\n * `?` one character, and a trailing `/` means \"everything under this folder\".\n */\nexport function globToRegExp(glob: string): RegExp {\n let g = glob.trim().replace(/^\\.\\//, \"\");\n if (g.endsWith(\"/\")) g += \"**\";\n let out = \"\";\n for (let i = 0; i < g.length; i++) {\n const ch = g[i];\n if (ch === \"*\") {\n if (g[i + 1] === \"*\") {\n const slash = g[i + 2] === \"/\";\n out += slash ? \"(?:.*/)?\" : \".*\";\n i += slash ? 2 : 1;\n } else {\n out += \"[^/]*\";\n }\n } else if (ch === \"?\") {\n out += \"[^/]\";\n } else {\n out += ch.replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n }\n return new RegExp(`^${out}$`);\n}\n\n/** A matcher for a list of globs; an empty list matches nothing. */\nexport function globMatcher(globs: readonly string[] | undefined): (path: string) => boolean {\n const res = (globs ?? []).filter((g) => g.trim()).map(globToRegExp);\n return (path) => res.some((re) => re.test(path));\n}\n","/**\n * Reads the rules' ground truth from the installed Genesis packages: the\n * component package's type declarations (what it exports, which exports are\n * components), the design system's theme stylesheets (which tokens exist) and\n * Tailwind's palette (which literal colors to flag). No component or token is\n * listed here, so the doctor follows whatever Genesis version the app has.\n */\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport * as path from \"node:path\";\nimport { DoctorConfigError } from \"./config.js\";\nimport type { DoctorConfig, GenesisFacts } from \"./types.js\";\n\nexport const DEFAULT_UI_PACKAGE = \"@marktiderman/genesis-ui\";\nexport const DESIGN_SYSTEM_PACKAGE = \"@marktiderman/genesis-design-system\";\n\n/**\n * Raw tags checked when Genesis ships a same-named component. `form` is left\n * out on purpose: a shadcn-style `Form` is a react-hook-form provider that\n * still wraps a real `<form>`.\n */\nconst TAGS = [\"button\", \"input\", \"textarea\", \"select\", \"label\", \"table\", \"dialog\", \"progress\", \"details\", \"summary\"];\n/** Tags whose Genesis replacement has a different name. Applied only when that component exists. */\nconst TAG_ALIASES: Record<string, string> = { hr: \"Separator\" };\n\n/** Names that look like components but are types or helpers. */\nconst NON_COMPONENT_SUFFIX = /(Props|Variant|Variants|Type|Types|Config|Context|Options|Status)$/;\n\n/** Tailwind's default palette names; merged with the app's installed `tailwindcss/colors` when present. */\nconst TAILWIND_PALETTE = [\n \"black\", \"white\", \"slate\", \"gray\", \"zinc\", \"neutral\", \"stone\", \"red\", \"orange\", \"amber\", \"yellow\", \"lime\",\n \"green\", \"emerald\", \"teal\", \"cyan\", \"sky\", \"blue\", \"indigo\", \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\",\n \"taupe\", \"mauve\", \"mist\", \"olive\",\n];\n\n/** The installed folder of `name`, looking in node_modules from `from` upward (works with hoisting and pnpm). */\nexport function findPackageDir(from: string, name: string): string | null {\n let dir = path.resolve(from);\n for (;;) {\n const candidate = path.join(dir, \"node_modules\", name);\n if (existsSync(path.join(candidate, \"package.json\"))) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\nexport function loadGenesis(root: string, config: DoctorConfig): GenesisFacts {\n const uiPackage = config.uiPackage ?? DEFAULT_UI_PACKAGE;\n const uiDir = findPackageDir(root, uiPackage);\n if (!uiDir) throw new DoctorConfigError(`${uiPackage} is not installed here. Install it, or set doctor.uiPackage.`);\n const uiPkg = JSON.parse(readFileSync(path.join(uiDir, \"package.json\"), \"utf8\"));\n\n // ---- Exports, from every subpath's declarations ----\n const typeEntries = new Set<string>();\n const mainTypes = uiPkg.types ?? uiPkg.typings ?? exportTypes(uiPkg.exports?.[\".\"] ?? uiPkg.exports);\n if (typeof mainTypes === \"string\") typeEntries.add(mainTypes);\n for (const target of Object.values(uiPkg.exports ?? {})) {\n const t = exportTypes(target);\n if (typeof t === \"string\" && !t.includes(\"*\")) typeEntries.add(t);\n }\n const exportNames = new Set<string>();\n const reexportedPackages = new Set<string>();\n let readAny = false;\n for (const entry of typeEntries) {\n const file = path.join(uiDir, entry);\n if (!existsSync(file)) continue;\n readAny = true;\n const dts = readFileSync(file, \"utf8\");\n for (const name of parseExportNames(dts)) exportNames.add(name);\n for (const m of dts.matchAll(/export\\s+(?:type\\s+)?(?:\\{[^}]*\\}|\\*)\\s*from\\s*[\"']([^\"'.][^\"']*)[\"']/g)) {\n reexportedPackages.add(packageName(m[1]));\n }\n }\n if (!readAny) {\n throw new DoctorConfigError(`${uiPackage} has no type declarations to read (is it built?). Looked for: ${[...typeEntries].join(\", \") || \"none\"}`);\n }\n\n // ---- Which exports are types only, from every declaration file it ships ----\n const valueDecls = new Set<string>();\n const typeDecls = new Set<string>();\n const declRoot = typeof mainTypes === \"string\" ? path.dirname(path.join(uiDir, mainTypes)) : uiDir;\n // Names re-exported from other packages (e.g. genesis-core's types) are declared there.\n const declFiles = walkDts(declRoot);\n for (const pkg of reexportedPackages) {\n const dir = findPackageDir(uiDir, pkg);\n if (dir) walkDts(path.join(dir, \"dist\"), declFiles);\n }\n for (const file of declFiles) {\n const text = readFileSync(file, \"utf8\");\n for (const m of text.matchAll(/\\b(?:declare\\s+)?(?:const|let|var|function|class|enum)\\s+([A-Za-z_$][\\w$]*)/g)) valueDecls.add(m[1]);\n for (const m of text.matchAll(/\\b(?:interface|type)\\s+([A-Za-z_$][\\w$]*)/g)) typeDecls.add(m[1]);\n }\n const isTypeOnly = (n: string) => typeDecls.has(n) && !valueDecls.has(n);\n const values = new Set([...exportNames].filter((n) => !isTypeOnly(n)));\n const components = [...values]\n // PascalCase (H1 and P included), but not SCREAMING_CASE constants.\n .filter((n) => /^[A-Z][A-Za-z0-9]*$/.test(n) && !(n.length > 2 && n === n.toUpperCase()) && !NON_COMPONENT_SUFFIX.test(n))\n .sort();\n\n // ---- Tokens, from the theme stylesheets ----\n const tokens = new Set<string>();\n const themeFiles = resolveThemeFiles(root, config, uiDir);\n for (const file of themeFiles) for (const t of declaredTokens(readFileSync(file, \"utf8\"))) tokens.add(t);\n\n // ---- Raw tags ----\n const byLower = new Map(components.map((c) => [c.toLowerCase(), c]));\n const rawTags = new Map<string, string>();\n for (const tag of TAGS) if (byLower.has(tag)) rawTags.set(tag, byLower.get(tag)!);\n for (const [tag, comp] of Object.entries(TAG_ALIASES)) if (values.has(comp)) rawTags.set(tag, comp);\n for (const [tag, comp] of Object.entries(config.rawTags ?? {})) {\n if (comp === false) rawTags.delete(tag);\n else rawTags.set(tag, comp);\n }\n\n return {\n uiPackage,\n uiVersion: String(uiPkg.version ?? \"unknown\"),\n exports: exportNames,\n values,\n components,\n tokens,\n rawTags,\n palette: loadPalette(root),\n };\n}\n\n/** Names exported by a declaration file: `export { a, b as c }` blocks and `export declare …` statements. */\nexport function parseExportNames(dts: string): string[] {\n const names: string[] = [];\n for (const m of dts.matchAll(/export\\s+(?:type\\s+)?\\{([^}]*)\\}/g)) {\n for (const part of m[1].split(\",\")) {\n const name = part.trim().replace(/^type\\s+/, \"\").split(/\\s+as\\s+/).pop()?.trim();\n if (name && name !== \"default\") names.push(name);\n }\n }\n for (const m of dts.matchAll(/export\\s+(?:declare\\s+)?(?:const|let|function|class|enum|interface|type)\\s+([A-Za-z_$][\\w$]*)/g)) {\n names.push(m[1]);\n }\n return names;\n}\n\n/** Custom properties a stylesheet declares (`--name:`). */\nexport function declaredTokens(css: string): string[] {\n return [...css.matchAll(/(--[A-Za-z0-9_-]+)\\s*:/g)].map((m) => m[1]);\n}\n\nfunction packageName(specifier: string): string {\n const parts = specifier.split(\"/\");\n return parts.slice(0, specifier.startsWith(\"@\") ? 2 : 1).join(\"/\");\n}\n\nfunction exportTypes(target: unknown): string | undefined {\n if (!target || typeof target !== \"object\") return undefined;\n const t = target as Record<string, unknown>;\n if (typeof t.types === \"string\") return t.types;\n for (const key of [\"import\", \"default\", \"require\"]) {\n const nested = exportTypes(t[key]);\n if (nested) return nested;\n }\n return undefined;\n}\n\nfunction walkDts(dir: string, out: string[] = []): string[] {\n if (!existsSync(dir)) return out;\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (entry.name === \"node_modules\") continue;\n const p = path.join(dir, entry.name);\n if (entry.isDirectory()) walkDts(p, out);\n else if (/\\.d\\.[cm]?ts$/.test(entry.name)) out.push(p);\n }\n return out;\n}\n\nfunction resolveThemeFiles(root: string, config: DoctorConfig, uiDir: string): string[] {\n if (config.themeCss) {\n const specs = typeof config.themeCss === \"string\" ? [config.themeCss] : config.themeCss;\n return specs.map((spec) => {\n const file = resolveSpec(root, spec);\n if (!file) throw new DoctorConfigError(`doctor.themeCss: cannot find ${spec}`);\n return file;\n });\n }\n const files: string[] = [];\n const ds = findPackageDir(root, DESIGN_SYSTEM_PACKAGE);\n const themes = ds && path.join(ds, \"dist\", \"themes\");\n if (themes && existsSync(themes)) {\n for (const name of readdirSync(themes).sort()) if (name.endsWith(\".css\")) files.push(path.join(themes, name));\n }\n if (files.length === 0) {\n throw new DoctorConfigError(\n `No Genesis theme stylesheet found (${DESIGN_SYSTEM_PACKAGE}/dist/themes/*.css). Install the design system, or set doctor.themeCss.`,\n );\n }\n const uiStyles = path.join(uiDir, \"dist\", \"styles.css\");\n if (existsSync(uiStyles)) files.push(uiStyles);\n return files;\n}\n\n/** An app-relative path, or `package/sub/path` resolved inside that installed package. */\nfunction resolveSpec(root: string, spec: string): string | null {\n const local = path.resolve(root, spec);\n if (spec.startsWith(\".\") || path.isAbsolute(spec)) return existsSync(local) ? local : null;\n const parts = spec.split(\"/\");\n const nameLength = spec.startsWith(\"@\") ? 2 : 1;\n const dir = findPackageDir(root, parts.slice(0, nameLength).join(\"/\"));\n if (dir) {\n const file = path.join(dir, ...parts.slice(nameLength));\n if (existsSync(file) && statSync(file).isFile()) return file;\n }\n return existsSync(local) ? local : null;\n}\n\nfunction loadPalette(root: string): string[] {\n const names = new Set(TAILWIND_PALETTE);\n try {\n const req = createRequire(path.join(root, \"package.json\"));\n const colors = req(\"tailwindcss/colors\");\n for (const key of Object.keys(colors?.default ?? colors ?? {})) {\n if (/^[a-z]+$/.test(key) && ![\"inherit\", \"current\", \"transparent\"].includes(key)) names.add(key);\n }\n } catch {\n // No Tailwind installed (or it is ESM-only): the built-in list stands.\n }\n return [...names].sort();\n}\n","/**\n * color-literals.mjs — the raw-color lexer shared by scripts/check-token-usage.mjs\n * and `genesis doctor` (packages/genesis-cli, which bundles this file at build\n * time). One implementation, so a bypass fixed here is fixed in both gates.\n *\n * Pure functions only: no filesystem, no process state.\n */\n\n// Extensions where `//` opens a genuine line comment (C-style langs, plus the\n// CSS supersets SCSS/LESS which DO have `//`). Plain `.css` is deliberately\n// absent: CSS has NO `//` line comment, and an unquoted `url(https://cdn/x.svg)`\n// contains `//`. Treating that `//` as a comment blanks the rest of the line, so\n// a real hex after it (`... color: #ff0000;`) never gets scanned and the gate is\n// bypassed. Only files with this extension run the `//` branch in\n// stripBlockComments(); `/* ... */` block comments are stripped for ALL types.\nexport const LINE_COMMENT_EXTS = new Set(['.ts', '.tsx', '.jsx', '.js', '.mjs', '.cjs', '.scss', '.less']);\n\n// Numeric HTML entities (`Ӓ`) are not colors.\nconst HTML_ENTITY_RE = /&#\\d+;/g;\n\n// Blank out `/* ... */` block comments (JS/TS JSDoc AND CSS comments) while\n// preserving line numbers, so hex inside a comment is ignored without skipping\n// any `*`-prefixed CSS selector line. Uses escape-aware lexical scanning to\n// avoid removing comment-like sequences inside string and template literals.\n//\n// `hasLineComments` gates the `//` line-comment branch: pass `true` only for\n// file types where `//` is a real line comment (see LINE_COMMENT_EXTS). For\n// plain CSS it must be `false`, otherwise `url(https://…)` gets blanked from the\n// `//` onward and any hex after it slips past the gate. String/template/`/* */`\n// handling is unaffected by this flag and runs for ALL file types.\n/** Blank out C-style block comments (and `//` line comments when enabled) while preserving line numbers and skipping string/template literals. */\nexport function stripBlockComments(content, hasLineComments = true) {\n let result = '';\n let i = 0;\n const len = content.length;\n\n while (i < len) {\n const ch = content[i];\n const next = i + 1 < len ? content[i + 1] : '';\n const prevIsColon = i > 0 && content[i - 1] === ':';\n const prevIsBackslash = i > 0 && content[i - 1] === '\\\\';\n\n // Handle string literals: \"...\" with escape support\n if (ch === '\"') {\n result += ch;\n i++;\n while (i < len) {\n const c = content[i];\n result += c;\n if (c === '\\\\' && i + 1 < len) {\n result += content[i + 1]; // escaped character\n i += 2;\n } else if (c === '\"') {\n i++;\n break;\n } else {\n i++;\n }\n }\n continue;\n }\n\n // Handle string literals: '...' with escape support\n if (ch === \"'\") {\n result += ch;\n i++;\n while (i < len) {\n const c = content[i];\n result += c;\n if (c === '\\\\' && i + 1 < len) {\n result += content[i + 1]; // escaped character\n i += 2;\n } else if (c === \"'\") {\n i++;\n break;\n } else {\n i++;\n }\n }\n continue;\n }\n\n // Handle template literals: `...` with escape support\n if (ch === '`') {\n result += ch;\n i++;\n while (i < len) {\n const c = content[i];\n result += c;\n if (c === '\\\\' && i + 1 < len) {\n result += content[i + 1]; // escaped character\n i += 2;\n } else if (c === '`') {\n i++;\n break;\n } else {\n i++;\n }\n }\n continue;\n }\n\n // Handle CSS/SCSS/LESS `url(...)` tokens. The contents of `url(...)` are\n // NEVER a comment regardless of scheme, so consume the whole token verbatim\n // through to the matching `)` and do NOT let the `//` inside it open a line\n // comment. This structurally closes the entire `url()`-`//` bypass class in\n // one place — `url(//cdn/x)` (protocol-relative), `url(https://…)` and\n // `url(http://…)` all stay scannable, so a trailing `color: #ff0000;` on the\n // same line is still caught (CMT-250-004 + Codex protocol-relative P2).\n // Detect an `url` identifier (case-insensitive) directly followed by `(`,\n // where `u` starts the identifier (previous char is not an identifier char,\n // so `blurUrl(` / `baseurl(` don't match). Quotes inside are respected via\n // the same escape rules as string state, so a `)` inside `url(\"a)b\")` does\n // not end the token early; `/* */` is left intact (never appears in url()).\n if (\n (ch === 'u' || ch === 'U') &&\n content.slice(i, i + 4).toLowerCase() === 'url(' &&\n !/[\\w$]/.test(content[i - 1] ?? '')\n ) {\n result += content.slice(i, i + 4); // 'url('\n i += 4;\n while (i < len && content[i] !== ')') {\n const c = content[i];\n if (c === '\"' || c === \"'\") {\n // Consume a quoted segment (escape-aware) so a `)` inside it is not\n // mistaken for the url() close.\n result += c;\n i++;\n while (i < len) {\n const q = content[i];\n result += q;\n if (q === '\\\\' && i + 1 < len) {\n result += content[i + 1];\n i += 2;\n } else if (q === c) {\n i++;\n break;\n } else {\n i++;\n }\n }\n } else {\n result += c;\n i++;\n }\n }\n if (i < len && content[i] === ')') {\n result += ')';\n i++;\n }\n continue;\n }\n\n // Handle line comments: // ... to end of line\n // A `//` at top level must NOT open string/template/block state: an\n // apostrophe in a contraction (\"don't\") inside a line comment would\n // otherwise enter string-mode and consume across the newline, corrupting\n // the stripping of a following real block comment (CMT-250-001).\n // Gated on `hasLineComments`: plain CSS has no `//` comment (an unquoted\n // `url(https://…)` contains `//`), so this branch is skipped there and the\n // `//` is treated as ordinary content, keeping any following hex scannable.\n // The `url(...)` branch above already neutralizes `//` inside url() for ALL\n // file types; the guards below are defense-in-depth for `//` sequences that\n // arise OUTSIDE url(). Skip when the `//` is immediately preceded by `:` — a\n // URL scheme separator (`http://`, `https://`), not a comment (CMT-250-004).\n // AND skip when the `//` is immediately preceded by `\\` — strings/templates\n // are already lexed above, so a backslash in code state means we are inside\n // a regex literal (e.g. `/https?:\\/\\//`), where the escaped `\\/` + closing\n // `/` read as `//`. Without this the rest of the line (and any hex on it)\n // would be blanked and slip past the gate (Codex P2, same bypass class).\n if (hasLineComments && ch === '/' && next === '/' && !prevIsColon && !prevIsBackslash) {\n let j = i + 2;\n while (j < len && content[j] !== '\\n') {\n j++;\n }\n const commentLen = j - i;\n // Blank comment chars to spaces; the trailing `\\n` (if any) is left for\n // the next iteration so line numbers are preserved.\n const commentText = content.slice(i, i + commentLen);\n result += commentText.replace(/[^\\n]/g, ' ');\n i += commentLen;\n continue;\n }\n\n // Handle block comments: /* ... */\n if (ch === '/' && next === '*') {\n let commentLen = 2;\n let j = i + 2;\n while (j < len) {\n if (content[j] === '*' && j + 1 < len && content[j + 1] === '/') {\n commentLen = j + 2 - i;\n break;\n }\n j++;\n }\n // Replace non-newline chars with spaces to preserve line numbers\n const commentText = content.slice(i, i + commentLen);\n result += commentText.replace(/[^\\n]/g, ' ');\n i += commentLen;\n continue;\n }\n\n // Regular character\n result += ch;\n i++;\n }\n\n return result;\n}\n\n// Hex color literal: `#` + 3, 4, 6, or 8 hex digits, NOT inside an HTML\n// entity (which is `Ӓ` — pure decimal). The match is intentionally\n// generous (any hex run in {3,4,6,8}); the all-digits-in-3/4 case is\n// filtered out post-match because pure-decimal `#163` / `#1284`\n// overwhelmingly appears in natural language as issue / order refs\n// (\"Merged PR #163\", \"Order #1284\") rather than as colors. CSS\n// developers writing literal short-hand colors almost always include a\n// letter (`#fff`, `#a1b`, `#0af`). For 6- and 8-digit forms we accept\n// all-digit hex (`#000000` is a real color). False-negative tradeoff:\n// `#123` written as a short-hand for `#112233` will pass — but the\n// long-form is the dominant style, and the alternative (false-positive\n// every issue reference) is worse.\nconst HEX_RE = /(^|[^\\w&])#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b/g;\nconst HEX_LETTER_RE = /[a-fA-F]/;\n\n// Color-function literal: rgb()/rgba()/hsl()/hsla() whose first argument is a\n// number or percentage — e.g. `rgba(0,0,0,0.08)`, `rgb(0 0 0 / 0.1)`,\n// `hsl(160 84% 39%)`. Raw color-function literals sneak past the hex check\n// (finding #4: `rgba(0,0,0,0.08)` borders), so they're flagged the same way.\n// Requiring a digit/`.` right after `(` deliberately spares token-backed forms\n// like `hsl(var(--primary))` — those reference a CSS variable, not a raw\n// literal — and non-color CSS functions (translate(), scale(), matrix()) never\n// match the rgb/rgba/hsl/hsla names. The match is captured up to the first\n// closing paren for the reported literal.\nconst COLOR_FN_RE = /\\b(rgba?|hsla?)\\(\\s*[\\d.][^)\\n]*\\)?/gi;\n\n/** Strip numeric HTML entities (`Ӓ`) from a line so they are not mistaken for hex color literals. */\nfunction stripHtmlEntities(line) {\n return line.replace(HTML_ENTITY_RE, '');\n}\n\n/** Find raw hex color literals in a line, filtering out decimal-only 3/4-digit matches (likely issue/order refs). */\nexport function findHexLiterals(line) {\n const cleaned = stripHtmlEntities(line);\n const matches = [];\n let m;\n HEX_RE.lastIndex = 0;\n while ((m = HEX_RE.exec(cleaned)) !== null) {\n const digits = m[2];\n // Filter pure-decimal 3/4-digit matches as likely issue refs (#163,\n // #1284). 6/8-digit forms are accepted unconditionally.\n if (digits.length <= 4 && !HEX_LETTER_RE.test(digits)) continue;\n const literal = `#${digits}`;\n const idx = m.index + m[1].length;\n matches.push({ literal, column: idx + 1 });\n }\n return matches;\n}\n\n/** Find raw rgb()/rgba()/hsl()/hsla() literals with numeric arguments in a line (token-backed `hsl(var(--x))` is spared). */\nexport function findColorFunctions(line) {\n const cleaned = stripHtmlEntities(line);\n const matches = [];\n let m;\n COLOR_FN_RE.lastIndex = 0;\n while ((m = COLOR_FN_RE.exec(cleaned)) !== null) {\n matches.push({ literal: m[0], column: m.index + 1 });\n }\n return matches;\n}\n","/**\n * Collects the app files the doctor checks.\n */\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { LINE_COMMENT_EXTS, stripBlockComments } from \"../../../../scripts/lib/color-literals.mjs\";\nimport { globMatcher } from \"./glob.js\";\nimport type { DoctorConfig, SourceFile } from \"./types.js\";\n\nexport const DEFAULT_SRC = [\"src\"];\nexport const DEFAULT_EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".jsx\", \".mts\", \".cts\", \".css\"];\n/** Always skipped: tests, fixtures, declarations and generated files are not shipped UI. */\nexport const DEFAULT_IGNORE = [\n \"**/*.d.ts\",\n \"**/*.gen.*\",\n \"**/*.test.*\",\n \"**/*.spec.*\",\n \"**/__tests__/**\",\n \"**/__fixtures__/**\",\n \"**/__mocks__/**\",\n];\nconst SKIP_DIRS = new Set([\"node_modules\", \"dist\", \"build\", \".git\", \".next\", \".output\", \".turbo\", \"coverage\"]);\nconst MAX_FILE_BYTES = 2 * 1024 * 1024;\n\nconst toPosix = (p: string) => p.split(path.sep).join(\"/\");\n\nexport function scanFiles(root: string, config: DoctorConfig): SourceFile[] {\n const extensions = new Set(config.extensions ?? DEFAULT_EXTENSIONS);\n const ignored = globMatcher([...DEFAULT_IGNORE, ...(config.ignore ?? [])]);\n const files: SourceFile[] = [];\n const seen = new Set<string>();\n const visit = (abs: string) => {\n const rel = toPosix(path.relative(root, abs));\n if (seen.has(rel) || ignored(rel)) return;\n const ext = path.extname(abs);\n if (!extensions.has(ext)) return;\n if (statSync(abs).size > MAX_FILE_BYTES) return;\n seen.add(rel);\n const text = readFileSync(abs, \"utf8\");\n files.push({ path: rel, absolutePath: abs, ext, text, code: stripBlockComments(text, LINE_COMMENT_EXTS.has(ext)) });\n };\n const walk = (dir: string) => {\n for (const entry of readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) walk(path.join(dir, entry.name));\n } else if (entry.isFile()) {\n visit(path.join(dir, entry.name));\n }\n }\n };\n for (const src of config.src ?? DEFAULT_SRC) {\n const abs = path.resolve(root, src);\n if (!existsSync(abs)) continue;\n if (statSync(abs).isDirectory()) walk(abs);\n else visit(abs);\n }\n return files;\n}\n\n/** 1-based line of a character offset. */\nexport function lineAt(text: string, index: number): number {\n let line = 1;\n for (let i = 0; i < index && i < text.length; i++) if (text.charCodeAt(i) === 10) line++;\n return line;\n}\n","/**\n * Declarative app rules: from config `patterns`, or from a markdown rules\n * document so the rules can live next to the prose that explains them.\n *\n * The markdown format: a `### rule-id` heading starts a rule; the `- key: value`\n * lines under it (level, files, exclude, forbid, require, path, message) set\n * it; any `#` or `##` heading ends it. `files`/`exclude` are comma-separated.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { DoctorConfigError } from \"./config.js\";\nimport { globMatcher } from \"./glob.js\";\nimport { lineAt } from \"./scan.js\";\nimport type { DoctorContext, DoctorPlugin, PatternRule } from \"./types.js\";\n\nexport function parseRulesMarkdown(markdown: string): PatternRule[] {\n const rules: PatternRule[] = [];\n let current: PatternRule | null = null;\n for (const line of markdown.split(\"\\n\")) {\n const heading = line.match(/^###\\s+([A-Za-z0-9_-]+)\\s*$/);\n if (heading) {\n current = { id: heading[1] };\n rules.push(current);\n continue;\n }\n if (/^#{1,2}\\s/.test(line)) {\n current = null;\n continue;\n }\n const kv = current && line.match(/^-\\s+(level|files|exclude|forbid|require|path|message):\\s*(.*)$/);\n if (!current || !kv) continue;\n const [, key, raw] = kv;\n const value = raw.trim();\n if (key === \"files\" || key === \"exclude\") current[key] = value.split(\",\").map((s) => s.trim()).filter(Boolean);\n else if (key === \"level\") current.level = value as PatternRule[\"level\"];\n else current[key as \"forbid\" | \"require\" | \"path\" | \"message\"] = value;\n }\n return rules;\n}\n\n/** `(?i)` at the start means case-insensitive, as in the markdown format. */\nfunction toRegExp(source: string, flags = \"\"): RegExp {\n if (source.startsWith(\"(?i)\")) return new RegExp(source.slice(4), flags + \"i\");\n return new RegExp(source, flags);\n}\n\ninterface CompiledRule {\n rule: PatternRule;\n level: \"error\" | \"warn\";\n includes: (p: string) => boolean;\n excludes: (p: string) => boolean;\n forbid?: RegExp;\n require?: RegExp;\n path?: RegExp;\n}\n\n/** Validate and compile rules up front, so a broken pattern fails the run with its rule id. */\nexport function compilePatternRules(rules: PatternRule[], source: string): CompiledRule[] {\n const ids = new Set<string>();\n const out: CompiledRule[] = [];\n for (const rule of rules) {\n if (ids.has(rule.id)) throw new DoctorConfigError(`${source}: rule \"${rule.id}\" is defined twice`);\n ids.add(rule.id);\n const level = rule.level ?? \"error\";\n if (![\"error\", \"warn\", \"guide\"].includes(level)) {\n throw new DoctorConfigError(`${source}: rule \"${rule.id}\" has level \"${level}\" (use error, warn or guide)`);\n }\n if (level === \"guide\") continue;\n if (!rule.files?.length) throw new DoctorConfigError(`${source}: rule \"${rule.id}\" needs \"files\" (or level: guide)`);\n if (!rule.forbid && !rule.require && !rule.path) {\n throw new DoctorConfigError(`${source}: rule \"${rule.id}\" needs forbid, require or path (or level: guide)`);\n }\n try {\n out.push({\n rule,\n level,\n includes: globMatcher(rule.files),\n excludes: globMatcher(rule.exclude),\n forbid: rule.forbid ? toRegExp(rule.forbid, \"m\") : undefined,\n require: rule.require ? toRegExp(rule.require, \"m\") : undefined,\n path: rule.path ? toRegExp(rule.path) : undefined,\n });\n } catch (err) {\n throw new DoctorConfigError(`${source}: rule \"${rule.id}\" has an invalid pattern: ${(err as Error).message}`);\n }\n }\n return out;\n}\n\n/** Pattern rules from config and the rules doc, as one plugin. Returns null when there are none. */\nexport function loadPatternRules(root: string, patterns: PatternRule[] | undefined, rulesDoc: string | undefined): { plugin: DoctorPlugin; count: number } | null {\n const compiled = compilePatternRules(patterns ?? [], \"doctor.patterns\");\n let all = compiled;\n if (rulesDoc) {\n const file = path.resolve(root, rulesDoc);\n if (!existsSync(file)) throw new DoctorConfigError(`doctor.rulesDoc: ${rulesDoc} not found`);\n const fromDoc = compilePatternRules(parseRulesMarkdown(readFileSync(file, \"utf8\")), rulesDoc);\n const clash = fromDoc.find((d) => compiled.some((c) => c.rule.id === d.rule.id));\n if (clash) throw new DoctorConfigError(`rule \"${clash.rule.id}\" is defined in both doctor.patterns and ${rulesDoc}`);\n all = [...compiled, ...fromDoc];\n }\n if (all.length === 0) return null;\n return {\n count: all.length,\n plugin: {\n name: \"patterns\",\n check(ctx: DoctorContext) {\n for (const r of all) {\n const message = r.rule.message ?? \"breaks a design rule\";\n for (const file of ctx.files) {\n if (!r.includes(file.path) || r.excludes(file.path)) continue;\n const report = (line: number) => ctx.report({ rule: r.rule.id, level: r.level, file: file.path, line, message });\n if (r.path && !r.path.test(file.path)) report(0);\n if (r.require && !r.require.test(file.code)) report(0);\n if (r.forbid) {\n const m = r.forbid.exec(file.code);\n if (m) report(lineAt(file.code, m.index));\n }\n }\n }\n },\n },\n };\n}\n","/**\n * Loads app rule modules listed in config `plugins`.\n *\n * A module default-exports a plugin, an array of plugins, or a function that\n * takes the options from `[\"./path.mjs\", options]` and returns either.\n */\nimport { statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { DoctorConfigError } from \"./config.js\";\nimport type { DoctorPlugin, PluginSpec } from \"./types.js\";\n\n/** Identity helper that types a plugin. */\nexport function defineDoctorPlugin(plugin: DoctorPlugin): DoctorPlugin {\n return plugin;\n}\n\nexport async function loadPlugins(specs: PluginSpec[] | undefined, configDir: string): Promise<DoctorPlugin[]> {\n const plugins: DoctorPlugin[] = [];\n for (const spec of specs ?? []) {\n const [id, options] = typeof spec === \"string\" ? [spec, undefined] : spec;\n const file = resolvePlugin(id, configDir);\n // The mtime query re-imports an edited module in a long-lived dev server.\n const url = `${pathToFileURL(file).href}?mtime=${statSync(file).mtimeMs}`;\n let mod: { default?: unknown };\n try {\n mod = await import(url);\n } catch (err) {\n throw new DoctorConfigError(`doctor.plugins: could not load ${id}: ${(err as Error).message}`);\n }\n let value = mod.default;\n if (typeof value === \"function\") value = await (value as (o: unknown) => unknown)(options);\n const list = Array.isArray(value) ? value : [value];\n for (const p of list) {\n if (!p || typeof p !== \"object\" || typeof (p as DoctorPlugin).check !== \"function\" || typeof (p as DoctorPlugin).name !== \"string\") {\n throw new DoctorConfigError(`doctor.plugins: ${id} must default-export { name, check(context) } (or an array, or a factory returning one)`);\n }\n plugins.push(p as DoctorPlugin);\n }\n }\n return plugins;\n}\n\nfunction resolvePlugin(id: string, configDir: string): string {\n try {\n if (id.startsWith(\".\") || path.isAbsolute(id)) return resolveFrom(path.resolve(configDir, id), configDir);\n return resolveFrom(id, configDir);\n } catch {\n throw new DoctorConfigError(`doctor.plugins: cannot find ${id} (relative paths resolve from ${configDir})`);\n }\n}\n\nfunction resolveFrom(id: string, from: string): string {\n return createRequire(path.join(from, \"noop.js\")).resolve(id);\n}\n","/**\n * The built-in, app-agnostic checks. Each is driven by facts read from the\n * installed Genesis packages, never by a hardcoded component or token list.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { findColorFunctions, findHexLiterals } from \"../../../../scripts/lib/color-literals.mjs\";\nimport { globMatcher } from \"./glob.js\";\nimport { declaredTokens } from \"./genesis.js\";\nimport type { DoctorContext, SourceFile } from \"./types.js\";\n\n/** Ids of the built-in rules, for `rules` overrides and `allow` entries. */\nexport const BUILTIN_RULES = [\n \"local-primitives\",\n \"starter-leftover\",\n \"forbidden-import\",\n \"raw-tag\",\n \"palette-color\",\n \"arbitrary-color\",\n \"raw-color\",\n \"undefined-token\",\n \"shadowed-export\",\n] as const;\n\nexport const DEFAULT_LOCAL_PRIMITIVE_DIRS = [\"src/components/ui\"];\nconst STARTER_LEFTOVERS = [\"components.json\", \"src/lib/utils.ts\"];\nconst DEFAULT_IGNORE_TOKEN_PREFIXES = [\"--tw-\", \"--radix-\"];\n\nconst JSX_EXTS = new Set([\".tsx\", \".jsx\"]);\nconst SCRIPT_EXTS = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mts\", \".cts\", \".mjs\", \".cjs\"]);\n\n/** Every module specifier a file imports or re-exports, with its 1-based line. */\nexport function importSpecifiers(file: SourceFile): Array<{ specifier: string; line: number }> {\n const out: Array<{ specifier: string; line: number }> = [];\n const lines = file.code.split(\"\\n\");\n const re = /(?:\\bfrom\\s*|\\bimport\\s*\\(\\s*|\\bimport\\s+|\\brequire\\s*\\(\\s*|@import\\s+)[\"']([^\"']+)[\"']/g;\n lines.forEach((text, i) => {\n for (const m of text.matchAll(re)) out.push({ specifier: m[1], line: i + 1 });\n });\n return out;\n}\n\nexport function checkProjectLayout(ctx: DoctorContext): void {\n for (const dir of ctx.config.localPrimitiveDirs ?? DEFAULT_LOCAL_PRIMITIVE_DIRS) {\n if (existsSync(path.join(ctx.root, dir))) {\n ctx.report({\n rule: \"local-primitives\",\n file: dir,\n subject: dir,\n message: `is a local design-system primitive folder; use ${ctx.genesis.uiPackage} (or extend it upstream)`,\n });\n }\n }\n for (const file of STARTER_LEFTOVERS) {\n if (existsSync(path.join(ctx.root, file))) {\n ctx.report({\n rule: \"starter-leftover\",\n level: \"warn\",\n file,\n subject: file,\n message: `is a starter leftover; Genesis ships cn and owns the components`,\n });\n }\n }\n}\n\nexport function checkImports(ctx: DoctorContext): void {\n const ui = ctx.genesis.uiPackage;\n const forbidden: Array<[RegExp, string]> = [\n [/^@radix-ui\\//, `imports Radix directly; use the Genesis wrapper from ${ui}`],\n [/^(?:[@~#]\\/|\\.{1,2}\\/)(?:.*\\/)?components\\/ui(?:\\/|$)/, `imports a local UI primitive; use ${ui}`],\n [/^[@~#]\\/lib\\/utils$/, `imports the starter's utils; use cn from ${ui}`],\n ...Object.entries(ctx.config.forbiddenImports ?? {}).map(([re, msg]) => [new RegExp(re), msg] as [RegExp, string]),\n ];\n for (const file of ctx.files) {\n if (!SCRIPT_EXTS.has(file.ext)) continue;\n for (const { specifier, line } of importSpecifiers(file)) {\n const hit = forbidden.find(([re]) => re.test(specifier));\n if (hit) ctx.report({ rule: \"forbidden-import\", file: file.path, line, subject: specifier, message: `${hit[1]} ('${specifier}')` });\n }\n }\n}\n\nexport function checkRawTags(ctx: DoctorContext): void {\n const tags = [...ctx.genesis.rawTags].map(([tag, component]) => [tag, component, new RegExp(`<${tag}(?=[\\\\s>/]|$)`)] as const);\n if (tags.length === 0) return;\n for (const file of ctx.files) {\n if (!JSX_EXTS.has(file.ext)) continue;\n file.code.split(\"\\n\").forEach((text, i) => {\n for (const [tag, component, re] of tags) {\n if (re.test(text)) {\n ctx.report({ rule: \"raw-tag\", file: file.path, line: i + 1, subject: tag, message: `renders a raw <${tag}>; use Genesis ${component}` });\n }\n }\n });\n }\n}\n\n/** Tailwind utilities that take a color. */\nconst COLOR_UTILITIES = \"bg|text|border(?:-[xytrbls])?|ring|ring-offset|fill|stroke|from|to|via|outline|divide|decoration|shadow|accent|caret|placeholder\";\nconst ARBITRARY_COLOR_RE = /(?<![\\w-])[a-z][a-z-]*-\\[(?:#|(?:rgba?|hsla?|oklch|oklab|lab|lch|hwb|color)\\()[^\\]]*\\]/g;\n\nexport function checkColors(ctx: DoctorContext): void {\n const palette = new RegExp(\n `(?<![\\\\w-])(?:${COLOR_UTILITIES})-(?:${ctx.genesis.palette.join(\"|\")})(?:-\\\\d{2,3})?(?:\\\\/\\\\d{1,3})?(?![\\\\w-])`,\n \"g\",\n );\n for (const file of ctx.files) {\n file.code.split(\"\\n\").forEach((text, i) => {\n const line = i + 1;\n for (const m of text.matchAll(palette)) {\n ctx.report({ rule: \"palette-color\", file: file.path, line, subject: m[0], message: `uses the literal palette color '${m[0]}'; use a semantic token (bg-primary, text-muted-foreground, …)` });\n }\n // Arbitrary values are reported once, as arbitrary-color, not again as raw-color.\n const arbitrary: Array<[number, number]> = [];\n for (const m of text.matchAll(ARBITRARY_COLOR_RE)) {\n arbitrary.push([m.index!, m.index! + m[0].length]);\n ctx.report({ rule: \"arbitrary-color\", file: file.path, line, subject: m[0], message: `uses the arbitrary color '${m[0]}'; define it as a brand token first` });\n }\n for (const hit of [...findHexLiterals(text), ...findColorFunctions(text)]) {\n const at = hit.column - 1;\n if (arbitrary.some(([a, b]) => at >= a && at < b)) continue;\n ctx.report({ rule: \"raw-color\", file: file.path, line, subject: hit.literal, message: `hardcodes the color ${hit.literal}; color values come from Genesis tokens` });\n }\n });\n }\n}\n\nexport function checkTokens(ctx: DoctorContext): void {\n const defined = new Set(ctx.genesis.tokens);\n const isTokenFile = ctx.config.tokenFiles ? globMatcher(ctx.config.tokenFiles) : (p: string) => p.endsWith(\".css\");\n for (const file of ctx.files) {\n if (isTokenFile(file.path)) for (const t of declaredTokens(file.code)) defined.add(t);\n // A custom property set inline (style={{ \"--progress\": \"40%\" }}) is a runtime variable, not a token.\n for (const m of file.code.matchAll(/[\"'](--[A-Za-z0-9_-]+)[\"']\\s*:/g)) defined.add(m[1]);\n }\n // Token files outside the scanned folders (e.g. a brand package).\n for (const pattern of ctx.config.tokenFiles ?? []) {\n if (/[*?]/.test(pattern)) continue;\n const abs = path.join(ctx.root, pattern);\n if (!ctx.files.some((f) => f.absolutePath === abs) && existsSync(abs)) {\n for (const t of declaredTokens(readFileSync(abs, \"utf8\"))) defined.add(t);\n }\n }\n const ignorePrefixes = ctx.config.ignoreTokenPrefixes ?? DEFAULT_IGNORE_TOKEN_PREFIXES;\n for (const file of ctx.files) {\n file.code.split(\"\\n\").forEach((text, i) => {\n for (const m of text.matchAll(/var\\(\\s*(--[A-Za-z0-9_-]+)/g)) {\n const token = m[1];\n if (defined.has(token) || ignorePrefixes.some((p) => token.startsWith(p))) continue;\n ctx.report({ rule: \"undefined-token\", file: file.path, line: i + 1, subject: token, message: `references the undefined token ${token}; define it in Genesis or the brand` });\n }\n });\n }\n}\n\nexport function checkShadowedExports(ctx: DoctorContext): void {\n const re = /\\bexport\\s+(?:default\\s+)?(?:declare\\s+)?(?:async\\s+)?(?:function\\*?|const|let|var|class)\\s+([A-Z][\\w$]*)/g;\n for (const file of ctx.files) {\n if (!SCRIPT_EXTS.has(file.ext)) continue;\n file.code.split(\"\\n\").forEach((text, i) => {\n for (const m of text.matchAll(re)) {\n if (!ctx.genesis.values.has(m[1])) continue;\n ctx.report({ rule: \"shadowed-export\", file: file.path, line: i + 1, subject: m[1], message: `shadows the Genesis export '${m[1]}'; reuse or extend Genesis ${m[1]}` });\n }\n });\n }\n}\n\n/** Genesis components that no scanned file imports (named imports or re-exports from the package or its subpaths). */\nexport function unusedComponents(ctx: Pick<DoctorContext, \"files\" | \"genesis\">): string[] {\n const used = new Set<string>();\n const pkg = ctx.genesis.uiPackage.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n const re = new RegExp(`\\\\b(?:import|export)\\\\s+(?:type\\\\s+)?(?:[\\\\w$]+\\\\s*,\\\\s*)?\\\\{([^}]*)\\\\}\\\\s*from\\\\s*[\"']${pkg}(?:/[^\"']*)?[\"']`, \"g\");\n for (const file of ctx.files) {\n for (const m of file.code.matchAll(re)) {\n for (const part of m[1].split(\",\")) {\n const name = part.trim().replace(/^type\\s+/, \"\").split(/\\s+as\\s+/)[0]?.trim();\n if (name) used.add(name);\n }\n }\n }\n return ctx.genesis.components.filter((c) => !used.has(c));\n}\n\n","/**\n * `genesis doctor`: checks an app against the installed Genesis — local\n * primitives, forbidden imports, raw tags Genesis has components for,\n * literal colors, undefined tokens, shadowed exports — plus the app's own\n * pattern rules and rule plugins. The CLI and the Vite plugin both call\n * `runDoctor`.\n */\nimport * as path from \"node:path\";\nimport { buildCommands, runBuild } from \"./build.js\";\nimport { DoctorConfigError, loadConfig } from \"./config.js\";\nimport { globToRegExp } from \"./glob.js\";\nimport { loadGenesis } from \"./genesis.js\";\nimport { loadPatternRules } from \"./patterns.js\";\nimport { loadPlugins } from \"./plugins.js\";\nimport {\n BUILTIN_RULES,\n checkColors,\n checkImports,\n checkProjectLayout,\n checkRawTags,\n checkShadowedExports,\n checkTokens,\n unusedComponents,\n} from \"./rules.js\";\nimport { scanFiles } from \"./scan.js\";\nimport type { DoctorConfig, DoctorContext, DoctorPlugin, DoctorResult, Finding, FindingInput, GenesisFacts } from \"./types.js\";\n\nexport type * from \"./types.js\";\nexport { DoctorConfigError, loadConfig, validateConfig } from \"./config.js\";\nexport { loadGenesis, findPackageDir, parseExportNames } from \"./genesis.js\";\nexport { parseRulesMarkdown } from \"./patterns.js\";\nexport { defineDoctorPlugin } from \"./plugins.js\";\nexport { BUILTIN_RULES } from \"./rules.js\";\nexport { globToRegExp } from \"./glob.js\";\n\nexport interface RunDoctorOptions {\n /** The app root. Default `process.cwd()`. */\n root?: string;\n /** Explicit config file (otherwise genesis.config.json, then package.json `genesis`). */\n configPath?: string;\n /** Use this config instead of reading one. Relative plugin paths resolve from `root`. */\n config?: DoctorConfig;\n /** Treat warnings as failures. */\n strict?: boolean;\n /** Run the app's typecheck and build after the checks. */\n build?: boolean;\n /** Pipe build output instead of inheriting the terminal (for --json). */\n quietBuild?: boolean;\n /** Reuse facts read earlier (the Vite dev server caches them). */\n genesis?: GenesisFacts;\n}\n\nexport async function runDoctor(options: RunDoctorOptions = {}): Promise<DoctorResult> {\n const root = path.resolve(options.root ?? process.cwd());\n const loaded = options.config ? { config: options.config, dir: root } : loadConfig(root, options.configPath);\n const config = loaded.config;\n const genesis = options.genesis ?? loadGenesis(root, config);\n const files = scanFiles(root, config);\n\n const patterns = loadPatternRules(root, config.patterns, config.rulesDoc);\n const plugins = await loadPlugins(config.plugins, loaded.dir);\n const builtinIds = new Set<string>(BUILTIN_RULES);\n for (const p of config.patterns ?? []) {\n if (builtinIds.has(p.id)) throw new DoctorConfigError(`doctor.patterns: \"${p.id}\" is a built-in rule id; pick another`);\n }\n\n const raw: FindingInput[] = [];\n const ctx: DoctorContext = { root, files, genesis, config, report: (f) => raw.push(f) };\n const builtins: DoctorPlugin[] = [\n { name: \"layout\", check: checkProjectLayout },\n { name: \"imports\", check: checkImports },\n { name: \"raw-tags\", check: checkRawTags },\n { name: \"colors\", check: checkColors },\n { name: \"tokens\", check: checkTokens },\n { name: \"shadowed-exports\", check: checkShadowedExports },\n ];\n for (const plugin of [...builtins, ...(patterns ? [patterns.plugin] : []), ...plugins]) {\n try {\n await plugin.check(ctx);\n } catch (err) {\n if (err instanceof DoctorConfigError) throw err;\n raw.push({ rule: \"plugin-error\", file: plugin.name, message: `rule plugin \"${plugin.name}\" threw: ${(err as Error).message}` });\n }\n }\n\n if (options.build) {\n const failure = runBuild(root, buildCommands(root, config), options.quietBuild ?? false);\n if (failure) raw.push(failure);\n }\n\n const findings = applyConfig(raw, config);\n const errors = findings.filter((f) => f.level === \"error\").length;\n const warnings = findings.length - errors;\n return {\n ok: errors === 0 && !(options.strict && warnings > 0),\n root,\n genesis,\n findings,\n unused: unusedComponents(ctx),\n ruleCount: (patterns?.count ?? 0) + plugins.length,\n errors,\n warnings,\n };\n}\n\n/** Apply `rules` level overrides and `allow` exceptions; flag exceptions that no longer match anything. */\nfunction applyConfig(raw: FindingInput[], config: DoctorConfig): Finding[] {\n const allow = (config.allow ?? []).map((entry) => ({ entry, file: entry.file ? globToRegExp(entry.file) : null, used: false }));\n const out: Finding[] = [];\n for (const input of raw) {\n const setting = config.rules?.[input.rule];\n if (setting === \"off\") continue;\n const finding: Finding = {\n rule: input.rule,\n level: setting ?? input.level ?? \"error\",\n file: input.file,\n line: input.line ?? 0,\n message: input.message,\n ...(input.subject !== undefined ? { subject: input.subject } : {}),\n };\n const exception = allow.find(\n (a) => a.entry.rule === finding.rule && (!a.file || a.file.test(finding.file)) && (a.entry.match === undefined || a.entry.match === finding.subject),\n );\n if (exception) {\n exception.used = true;\n continue;\n }\n out.push(finding);\n }\n // stale-exception is a rule like any other: `rules` can turn it off or change its level.\n const staleLevel = config.rules?.[\"stale-exception\"];\n for (const a of allow) {\n if (staleLevel === \"off\" || a.used || config.rules?.[a.entry.rule] === \"off\") continue;\n out.push({\n rule: \"stale-exception\",\n level: staleLevel ?? \"warn\",\n file: a.entry.file ?? \"genesis config\",\n line: 0,\n subject: a.entry.rule,\n message: `the allow entry for ${a.entry.rule}${a.entry.match ? ` (${a.entry.match})` : \"\"} no longer matches anything; remove it`,\n });\n }\n return out.sort((x, y) => x.file.localeCompare(y.file) || x.line - y.line || x.rule.localeCompare(y.rule));\n}\n\n/** The human-readable report. */\nexport function formatReport(result: DoctorResult): string {\n const g = result.genesis;\n const lines = [\n `Genesis doctor: ${g.uiPackage}@${g.uiVersion}, ${g.components.length} components, ${g.tokens.size} tokens, ` +\n `${result.ruleCount} app rules; raw tags checked: ${[...g.rawTags.keys()].join(\", \") || \"none\"}`,\n ];\n for (const f of result.findings) {\n lines.push(`${f.level.toUpperCase().padEnd(5)} ${f.file}${f.line ? `:${f.line}` : \"\"} [${f.rule}] ${f.message}`);\n }\n lines.push(`Available but unused (${result.unused.length}): ${result.unused.join(\", \") || \"none\"}`);\n lines.push(result.ok ? `PASS (${result.warnings} warnings)` : `FAIL (${result.errors} errors, ${result.warnings} warnings)`);\n return lines.join(\"\\n\");\n}\n\n/** The `--json` report: plain data, sets turned into sorted lists. */\nexport function toJson(result: DoctorResult) {\n return {\n ok: result.ok,\n genesis: `${result.genesis.uiPackage}@${result.genesis.uiVersion}`,\n errors: result.errors,\n warnings: result.warnings,\n findings: result.findings,\n unused: result.unused,\n };\n}\n\n/** What `--print-genesis` shows: the facts every rule is derived from. */\nexport function genesisSummary(g: GenesisFacts) {\n return {\n package: `${g.uiPackage}@${g.uiVersion}`,\n components: g.components,\n tokens: [...g.tokens].sort(),\n rawTags: Object.fromEntries(g.rawTags),\n palette: g.palette,\n };\n}\n","/**\n * `genesisDoctor()` for Vite: runs the same checks as `genesis doctor`.\n *\n * - `vite build`: fails the build when the doctor finds errors.\n * - `vite dev`: logs problems and shows Vite's error overlay, re-checking\n * (debounced) whenever a scanned file, the config or the rules doc changes.\n *\n * import { genesisDoctor } from \"@marktiderman/genesis-cli/vite\";\n * export default defineConfig({ plugins: [genesisDoctor()] });\n */\nimport * as path from \"node:path\";\nimport type { Plugin, ViteDevServer } from \"vite\";\nimport { formatReport, loadConfig, loadGenesis, runDoctor, type DoctorResult, type GenesisFacts } from \"./doctor/index.js\";\n\nexport interface GenesisDoctorOptions {\n /** The app root. Default: Vite's `root`. */\n root?: string;\n /** Explicit config file. */\n configPath?: string;\n /** Fail builds on warnings too. */\n strict?: boolean;\n /** Re-check delay after a change, in ms. Default 300. */\n debounceMs?: number;\n}\n\nconst formatProblems = (result: DoctorResult, withWarnings = false) =>\n result.findings\n .filter((f) => f.level === \"error\" || withWarnings)\n .map((f) => `${f.file}${f.line ? `:${f.line}` : \"\"} [${f.rule}] ${f.message}`)\n .join(\"\\n\");\n\nexport function genesisDoctor(options: GenesisDoctorOptions = {}): Plugin[] {\n let root = options.root ?? process.cwd();\n return [\n {\n name: \"genesis-doctor:build\",\n apply: \"build\",\n configResolved(config) {\n root = options.root ?? config.root;\n },\n async buildStart() {\n const result = await runDoctor({ root, configPath: options.configPath, strict: options.strict });\n if (!result.ok) this.error(`Genesis doctor found problems:\\n${formatProblems(result, options.strict)}`);\n if (result.warnings > 0) this.warn(formatReport(result));\n },\n },\n {\n name: \"genesis-doctor:serve\",\n apply: \"serve\",\n configResolved(config) {\n root = options.root ?? config.root;\n },\n configureServer(server: ViteDevServer) {\n let genesis: GenesisFacts | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let failing = false;\n // The last overlay message, re-sent to browsers that connect after the check ran.\n let lastError: string | null = null;\n const showError = (message: string) => {\n lastError = message;\n failing = true;\n server.config.logger.error(message, { timestamp: true });\n server.ws.send({ type: \"error\", err: { message, stack: \"\", plugin: \"genesis-doctor\" } });\n };\n let running = false;\n let again = false;\n\n const check = async () => {\n if (running) {\n again = true;\n return;\n }\n running = true;\n try {\n // Genesis facts only change on reinstall; read them once per server.\n genesis ??= loadGenesis(root, loadConfig(root, options.configPath).config);\n const result = await runDoctor({ root, configPath: options.configPath, genesis });\n if (result.errors > 0) {\n showError(`Genesis doctor found problems:\\n${formatProblems(result)}`);\n } else if (failing) {\n // Clear the overlay once the problems are fixed.\n failing = false;\n lastError = null;\n server.config.logger.info(\"Genesis doctor: all clear\", { timestamp: true });\n server.ws.send({ type: \"full-reload\" });\n }\n } catch (err) {\n showError(`Genesis doctor could not run: ${(err as Error).message}`);\n } finally {\n running = false;\n if (again) {\n again = false;\n void check();\n }\n }\n };\n\n // The config and rules doc live outside src/ (and may live outside root),\n // so watch them explicitly and always re-check when they change.\n const explicit = new Set([path.join(root, \"genesis.config.json\"), ...(options.configPath ? [path.resolve(root, options.configPath)] : [])]);\n try {\n const { config } = loadConfig(root, options.configPath);\n if (config.rulesDoc) explicit.add(path.resolve(root, config.rulesDoc));\n } catch {\n // A broken config is reported by the first check.\n }\n const schedule = (file: string) => {\n if (!explicit.has(path.resolve(file))) {\n const rel = path.relative(root, file).split(path.sep).join(\"/\");\n if (rel.startsWith(\"..\") || rel.includes(\"node_modules/\")) return;\n }\n clearTimeout(timer);\n timer = setTimeout(() => void check(), options.debounceMs ?? 300);\n };\n server.watcher.add([...explicit]);\n server.watcher.on(\"change\", schedule);\n server.watcher.on(\"add\", schedule);\n server.watcher.on(\"unlink\", schedule);\n server.ws.on(\"connection\", () => {\n if (lastError) server.ws.send({ type: \"error\", err: { message: lastError, stack: \"\", plugin: \"genesis-doctor\" } });\n });\n server.httpServer?.once(\"listening\", () => void check());\n if (!server.httpServer) void check();\n },\n },\n ];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Genesis CLI — `genesis init` scaffolds a Genesis app; `genesis studio init` turns the Data Studio on in an existing app; `genesis introspect` writes a checked-in contract.",
|
|
6
|
+
"description": "Genesis CLI — `genesis init` scaffolds a Genesis app; `genesis doctor` checks an app against the installed Genesis; `genesis studio init` turns the Data Studio on in an existing app; `genesis introspect` writes a checked-in contract; `genesis features build|check` keeps generated feature docs in step with features.ts.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/marktiderman/genesis.git",
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
"./scaffolder": {
|
|
29
29
|
"types": "./dist/scaffolder.d.ts",
|
|
30
30
|
"import": "./dist/scaffolder.js"
|
|
31
|
+
},
|
|
32
|
+
"./doctor": {
|
|
33
|
+
"types": "./dist/doctor.d.ts",
|
|
34
|
+
"import": "./dist/doctor.js"
|
|
35
|
+
},
|
|
36
|
+
"./vite": {
|
|
37
|
+
"types": "./dist/vite.d.ts",
|
|
38
|
+
"import": "./dist/vite.js"
|
|
31
39
|
}
|
|
32
40
|
},
|
|
33
41
|
"files": [
|
|
@@ -36,15 +44,26 @@
|
|
|
36
44
|
"README.md"
|
|
37
45
|
],
|
|
38
46
|
"dependencies": {
|
|
47
|
+
"@marktiderman/genesis-features": "^0.1.1",
|
|
39
48
|
"@marktiderman/genesis-studio-server": "^0.2.1",
|
|
40
49
|
"commander": "^12.1.0",
|
|
50
|
+
"jiti": "^2.4.0",
|
|
41
51
|
"postgres": "^3.4.9"
|
|
42
52
|
},
|
|
43
53
|
"devDependencies": {
|
|
44
54
|
"@types/node": "^22.9.0",
|
|
45
55
|
"tsup": "^8.3.0",
|
|
46
56
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^
|
|
57
|
+
"vitest": "^4.1.12",
|
|
58
|
+
"vite": "^8.0.3"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"vite": ">=5"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"vite": {
|
|
65
|
+
"optional": true
|
|
66
|
+
}
|
|
48
67
|
},
|
|
49
68
|
"scripts": {
|
|
50
69
|
"build": "tsup",
|