@estiva-app/ui 0.25.0 → 0.27.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/dist/AttachmentCard.d.ts +48 -6
- package/dist/AttachmentCard.d.ts.map +1 -1
- package/dist/Lightbox.d.ts +30 -0
- package/dist/Lightbox.d.ts.map +1 -0
- package/dist/eslint/index.js +4 -4
- package/dist/eslint/index.js.map +2 -2
- package/dist/gates/app-checks.d.ts.map +1 -1
- package/dist/gates/{chunk-GTQZEHPC.js → chunk-I7CJLUPM.js} +13 -1
- package/dist/gates/chunk-I7CJLUPM.js.map +7 -0
- package/dist/gates/cli.js +1 -1
- package/dist/gates/index.js +7 -3
- package/dist/gates/index.js.map +2 -2
- package/dist/gates/status.d.ts +2 -0
- package/dist/gates/status.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +594 -464
- package/dist/index.js.map +4 -4
- package/dist/registry/{app-DQI6WLHR.js → app-FXN4EI34.js} +2 -2
- package/dist/registry/app.d.ts.map +1 -1
- package/dist/registry/{chunk-W2B2G7OE.js → chunk-6OH3TWGF.js} +59 -1
- package/dist/registry/chunk-6OH3TWGF.js.map +7 -0
- package/dist/registry/{chunk-WMFF3MPP.js → chunk-XCBN2EKW.js} +3 -2
- package/dist/registry/{chunk-WMFF3MPP.js.map → chunk-XCBN2EKW.js.map} +2 -2
- package/dist/registry/cli.js +69 -8
- package/dist/registry/cli.js.map +3 -3
- package/dist/registry/contract.d.ts +29 -0
- package/dist/registry/contract.d.ts.map +1 -0
- package/dist/registry/gated-5CPIUQAW.js +230 -0
- package/dist/registry/gated-5CPIUQAW.js.map +7 -0
- package/dist/registry/gated.d.ts +31 -0
- package/dist/registry/gated.d.ts.map +1 -0
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +15 -3
- package/package.json +1 -1
- package/registry.json +94 -4
- package/src/AttachmentCard.mdx +32 -8
- package/src/AttachmentCard.stories.tsx +54 -0
- package/src/AttachmentCard.test.tsx +115 -0
- package/src/AttachmentCard.tsx +212 -37
- package/src/CollapsibleSection.stories.tsx +6 -0
- package/src/Lightbox.mdx +71 -0
- package/src/Lightbox.stories.tsx +72 -0
- package/src/Lightbox.test.tsx +65 -0
- package/src/Lightbox.tsx +87 -0
- package/src/ListColumn.stories.tsx +6 -0
- package/src/MenuItem.stories.tsx +151 -135
- package/src/Person.stories.tsx +7 -0
- package/src/PersonTrigger.stories.tsx +7 -0
- package/src/SectionHeader.stories.tsx +5 -0
- package/src/eslint/no-rebuilt-behaviour.ts +4 -4
- package/src/gates/app-checks.ts +6 -2
- package/src/gates/status.ts +15 -0
- package/src/index.ts +1 -0
- package/src/registry/app.test.ts +14 -1
- package/src/registry/app.ts +5 -1
- package/src/registry/cli.ts +79 -7
- package/src/registry/contract.test.ts +158 -0
- package/src/registry/contract.ts +108 -0
- package/src/registry/gated.test.ts +98 -0
- package/src/registry/gated.ts +308 -0
- package/src/registry/index.ts +1 -0
- package/src/registry/registry.test.ts +4 -4
- package/tailwind-preset.js +3 -0
- package/tokens.css +4 -0
- package/dist/gates/chunk-GTQZEHPC.js.map +0 -7
- package/dist/registry/chunk-W2B2G7OE.js.map +0 -7
- /package/dist/registry/{app-DQI6WLHR.js.map → app-FXN4EI34.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
buildAppRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XCBN2EKW.js";
|
|
5
5
|
import "./chunk-NJN4MQAM.js";
|
|
6
6
|
import "./chunk-E4JNV7PC.js";
|
|
7
7
|
export {
|
|
8
8
|
buildAppRegistry
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=app-
|
|
10
|
+
//# sourceMappingURL=app-FXN4EI34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/registry/app.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAwE,KAAK,QAAQ,EAAsB,MAAM,UAAU,CAAA;AAElI,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gIAAgI;IAChI,eAAe,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;IACjC,gIAAgI;IAChI,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B;AAwQD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAoB,EAAE,IAAI,EAAE,eAAe,EAAE,mBAAmB,EAAE,GAAE,eAAoB,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/registry/app.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAwE,KAAK,QAAQ,EAAsB,MAAM,UAAU,CAAA;AAElI,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gIAAgI;IAChI,eAAe,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;IACjC,gIAAgI;IAChI,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B;AAwQD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAoB,EAAE,IAAI,EAAE,eAAe,EAAE,mBAAmB,EAAE,GAAE,eAAoB,GAAG,QAAQ,CAuhBrI"}
|
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/registry/contract.ts
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
var PAGE_SECTIONS = ["When", "When not", "How", "What it owns"];
|
|
7
|
+
var CONTRACT_KINDS = ["reusable", "promote-candidate"];
|
|
8
|
+
var SEEN_IN = /^\*\*Seen in\*\*/m;
|
|
9
|
+
function pageProblem(source) {
|
|
10
|
+
const text = source.replace(/\r\n/g, "\n");
|
|
11
|
+
const heads = [...text.matchAll(/^##+\s+(.+?)\s*$/gm)].map((m) => m[1]);
|
|
12
|
+
const at = PAGE_SECTIONS.map((s) => heads.indexOf(s));
|
|
13
|
+
const missing = PAGE_SECTIONS.filter((_, i) => at[i] < 0);
|
|
14
|
+
if (missing.length) return `no ${missing.map((s) => `"${s}"`).join(", ")} section`;
|
|
15
|
+
if (at.some((i, n) => n > 0 && i < at[n - 1])) return `sections out of order: they go ${PAGE_SECTIONS.join(", ")}`;
|
|
16
|
+
const opening = text.split(/^# .*$/m)[1]?.split(/^##\s/m)[0]?.split(/\n\s*\n/).map((s) => s.trim()).find((s) => s && !s.startsWith("<") && !s.startsWith("import "));
|
|
17
|
+
if (!opening) return "no opening line under the title saying what the part is";
|
|
18
|
+
if (!/^##\s+How\s*\n[\s\S]*?```tsx?\n/m.test(text)) return 'no code under "How"';
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function hasSeenIn(source) {
|
|
22
|
+
return SEEN_IN.test(source.replace(/\r\n/g, "\n"));
|
|
23
|
+
}
|
|
24
|
+
function linkProblems(registry, ids) {
|
|
25
|
+
const problems = [];
|
|
26
|
+
for (const entry of registry.entries) {
|
|
27
|
+
for (const key of ["storyId", "docsId"]) {
|
|
28
|
+
const id = entry[key];
|
|
29
|
+
if (id && !ids.has(id)) problems.push(`${entry.name} (${entry.sourceFile}) links to ${key === "storyId" ? "a story" : "a docs page"} its Storybook does not have: ${id}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return problems;
|
|
33
|
+
}
|
|
34
|
+
function contractProblems(registry, root) {
|
|
35
|
+
const problems = [];
|
|
36
|
+
for (const entry of registry.entries) {
|
|
37
|
+
const cls = entry.app?.class;
|
|
38
|
+
if (!cls || !CONTRACT_KINDS.includes(cls)) continue;
|
|
39
|
+
const page = join(entry.sourceFile.replace(/[^/\\]+$/, ""), `${entry.name}.mdx`).replace(/\\/g, "/");
|
|
40
|
+
const where = `${entry.name} (${cls}, ${entry.sourceFile})`;
|
|
41
|
+
if (!existsSync(join(root, page))) {
|
|
42
|
+
problems.push(`${where} has no usage page: write ${page}, with an opening line, then ${PAGE_SECTIONS.join(", ")}`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const text = readFileSync(join(root, page), "utf8");
|
|
46
|
+
const problem = pageProblem(text);
|
|
47
|
+
if (problem) problems.push(`${where}: ${page} has ${problem}`);
|
|
48
|
+
if (entry.storyId === null && !hasSeenIn(text)) {
|
|
49
|
+
problems.push(`${where} is drawn nowhere: give it a story, or write a "**Seen in**" line on ${page} naming the stories that draw it, or why none can`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return problems;
|
|
53
|
+
}
|
|
54
|
+
|
|
3
55
|
// src/registry/find.ts
|
|
4
56
|
var STOP = /* @__PURE__ */ new Set([
|
|
5
57
|
"a",
|
|
@@ -180,9 +232,15 @@ function formatFindings(searched, findings, query) {
|
|
|
180
232
|
}
|
|
181
233
|
|
|
182
234
|
export {
|
|
235
|
+
PAGE_SECTIONS,
|
|
236
|
+
CONTRACT_KINDS,
|
|
237
|
+
pageProblem,
|
|
238
|
+
hasSeenIn,
|
|
239
|
+
linkProblems,
|
|
240
|
+
contractProblems,
|
|
183
241
|
findInRegistry,
|
|
184
242
|
findInRegistries,
|
|
185
243
|
docsLink,
|
|
186
244
|
formatFindings
|
|
187
245
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-6OH3TWGF.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/registry/contract.ts", "../../src/registry/find.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The usage-page contract, checked against an app's catalogue (UIG-19).\n *\n * Every part an app classifies **reusable** (or **promote-candidate**) has a\n * page beside it \u2014 `<PartName>.mdx` in the component's own folder \u2014 that opens\n * with a line saying what the part is, then `When`, `When not`, `How` (with\n * code) and `What it owns`, in that order. And it is drawn somewhere: a story\n * of its own, or a **Seen in** line on its page naming the stories that draw\n * it, or saying why none can (Katerina, 21 and 23 September 2026). A one-off\n * needs only its class and a purpose line, which the catalogue already refuses\n * to build without.\n *\n * This is the one copy. Peek and Ship each used to carry their own, pasted into\n * their `scripts/gates-checks.mjs` and run only by `gates:status`, so a page\n * could lose its `When not` and still merge. `estiva-ui check` runs this in\n * every app's `gate` job (docs/GATES.md \u00A723: one copy, in the package).\n *\n * The package's own pages keep the fuller contract in `src/pages.test.ts`,\n * which also reads `What it owns` back against the lint rule.\n */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport type { Registry } from './schema'\n\n/** The four headings, in the order a page carries them. */\nexport const PAGE_SECTIONS = ['When', 'When not', 'How', 'What it owns'] as const\n\n/** The classes that owe a page and a picture. */\nexport const CONTRACT_KINDS = ['reusable', 'promote-candidate'] as const\n\n/** The line that stands in for a story of the part's own. */\nconst SEEN_IN = /^\\*\\*Seen in\\*\\*/m\n\n/**\n * Why a page breaks the contract, or null when it keeps it.\n *\n * Read on normalised text: the apps are checked out with CRLF on Windows.\n */\nexport function pageProblem(source: string): string | null {\n const text = source.replace(/\\r\\n/g, '\\n')\n const heads = [...text.matchAll(/^##+\\s+(.+?)\\s*$/gm)].map((m) => m[1])\n const at = PAGE_SECTIONS.map((s) => heads.indexOf(s))\n const missing = PAGE_SECTIONS.filter((_, i) => at[i] < 0)\n if (missing.length) return `no ${missing.map((s) => `\"${s}\"`).join(', ')} section`\n if (at.some((i, n) => n > 0 && i < at[n - 1])) return `sections out of order: they go ${PAGE_SECTIONS.join(', ')}`\n // The opening line: the first paragraph under the title that is not markup.\n const opening = text\n .split(/^# .*$/m)[1]\n ?.split(/^##\\s/m)[0]\n ?.split(/\\n\\s*\\n/)\n .map((s) => s.trim())\n .find((s) => s && !s.startsWith('<') && !s.startsWith('import '))\n if (!opening) return 'no opening line under the title saying what the part is'\n if (!/^##\\s+How\\s*\\n[\\s\\S]*?```tsx?\\n/m.test(text)) return 'no code under \"How\"'\n return null\n}\n\n/** Whether a page records where the part is drawn, in place of a story of its own. */\nexport function hasSeenIn(source: string): boolean {\n return SEEN_IN.test(source.replace(/\\r\\n/g, '\\n'))\n}\n\n/**\n * Every catalogue link that names a story or a docs page its Storybook does not\n * have (UIG-19: a dead link is a build failure, not a dead end found six weeks\n * later). `ids` is every entry id in the Storybook's own index \u2014 what\n * `storybook index` writes \u2014 so this is Storybook's answer, not a guess at how\n * it builds an id.\n */\nexport function linkProblems(registry: Registry, ids: ReadonlySet<string>): string[] {\n const problems: string[] = []\n for (const entry of registry.entries) {\n for (const key of ['storyId', 'docsId'] as const) {\n const id = entry[key]\n if (id && !ids.has(id)) problems.push(`${entry.name} (${entry.sourceFile}) links to ${key === 'storyId' ? 'a story' : 'a docs page'} its Storybook does not have: ${id}`)\n }\n }\n return problems\n}\n\n/**\n * Every way an app's catalogue breaks the contract, one line each, naming the\n * part, its file and what to do. Empty when it keeps it.\n *\n * `root` is the app's own folder: the one its catalogue's paths are relative to.\n */\nexport function contractProblems(registry: Registry, root: string): string[] {\n const problems: string[] = []\n for (const entry of registry.entries) {\n const cls = entry.app?.class\n if (!cls || !(CONTRACT_KINDS as readonly string[]).includes(cls)) continue\n // Where the page must be: beside the component, named after the part \u2014\n // the same place the catalogue looks (src/registry/app.ts).\n const page = join(entry.sourceFile.replace(/[^/\\\\]+$/, ''), `${entry.name}.mdx`).replace(/\\\\/g, '/')\n const where = `${entry.name} (${cls}, ${entry.sourceFile})`\n if (!existsSync(join(root, page))) {\n problems.push(`${where} has no usage page: write ${page}, with an opening line, then ${PAGE_SECTIONS.join(', ')}`)\n continue\n }\n const text = readFileSync(join(root, page), 'utf8')\n const problem = pageProblem(text)\n if (problem) problems.push(`${where}: ${page} has ${problem}`)\n if (entry.storyId === null && !hasSeenIn(text)) {\n problems.push(`${where} is drawn nowhere: give it a story, or write a \"**Seen in**\" line on ${page} naming the stories that draw it, or why none can`)\n }\n }\n return problems\n}\n", "/**\n * The catalogue's reader (UIG-12): `ui:find <words>`.\n *\n * It exists to prove the format. A schema nobody consumes is a schema nobody\n * has tested, and the questions it has to answer are regression tests, not the\n * scope: \"floating panel\" must find `Popover`, \"scrolling\" `ScrollArea`,\n * \"empty\" `EmptyState`.\n *\n * It is also the answer to \"what do we have for this?\", which is the question\n * the wall cannot answer: a lint rule refuses the wrong thing, and this is\n * where the right one is named (UIG-20 makes a session ask it first).\n */\nimport type { Registry, RegistryEntry } from './schema'\n\nexport interface Finding {\n entry: RegistryEntry\n /** How many of the query's words matched anywhere. Ranked on this first. */\n matched: number\n score: number\n /** Which fields matched, for the reader to say why. */\n where: string[]\n /**\n * The props the query named **by name**, so the answer shows those rather\n * than all of them. A prop whose note merely carries one of the words counts\n * towards the score and is not shown: on \"floating panel\", six of `Popover`'s\n * notes say \"panel\", and printing all six buries the answer.\n */\n props: string[]\n}\n\n/**\n * Words that are in nearly every sentence, and so tell a search nothing.\n *\n * Measured: `ui:find \"truncate a long link\"` printed `Link`'s `external` prop,\n * because its note says \"in **a** new tab\" and the one-letter word matched\n * itself exactly. The minimum length in `alike` only guards a *prefix* match;\n * an exact match short-circuits it, which is right for `tab` and useless for `a`.\n */\nconst STOP = new Set([\n 'a', 'an', 'and', 'are', 'as', 'at', 'be', 'but', 'by', 'can', 'do', 'for', 'from', 'how', 'i', 'if', 'in', 'is', 'it', 'its', 'me', 'my', 'no', 'not', 'of',\n 'on', 'or', 'our', 'so', 'that', 'the', 'their', 'them', 'then', 'there', 'they', 'this', 'to', 'up', 'was', 'we', 'what', 'when', 'which', 'with', 'you', 'your',\n])\n\n/**\n * The words of a piece of text, with names taken apart.\n *\n * `CommandPalette` is kept whole *and* split, so \"palette\" reaches it and\n * \"commandpalette\" still does. Prose is already words; this costs it nothing.\n */\nfunction words(text: string): string[] {\n const found: string[] = []\n for (const token of text.match(/[A-Za-z0-9]+/g) ?? []) {\n found.push(token.toLowerCase())\n const parts = token.split(/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/)\n if (parts.length > 1) found.push(...parts.map((part) => part.toLowerCase()))\n }\n return found\n}\n\n/**\n * Whether a word of the query means a word of the text.\n *\n * Either being a prefix of the other covers \"scroll\" against \"scrolling\"; the\n * five-letter key covers \"scrolls\" against \"scrolling\", where neither is. Crude\n * on purpose \u2014 a stemmer is a dependency and a surprise, and the failure here\n * is an extra row in a list of five, not a wrong answer.\n *\n * **Three letters at least**, or a prefix match is no match at all: `person's`\n * puts the word \"s\" in the text, and every query on earth starts with some\n * letter. Measured \u2014 before this, \"scrolling\" found `Avatar`.\n */\nfunction alike(query: string, text: string): boolean {\n if (query === text) return true\n if (Math.min(query.length, text.length) < 3) return false\n if (text.startsWith(query) || query.startsWith(text)) return true\n return query.slice(0, 5) === text.slice(0, 5)\n}\n\nconst hit = (query: string, text: string) => words(text).some((word) => alike(query, word))\n\n/**\n * Search name, purpose, behaviours and variants.\n *\n * A row that answers more of the question comes first, whatever it scored:\n * \"floating panel\" has to reach `Popover`, whose purpose carries both words,\n * over `MenuPanel`, whose name carries one of them loudly.\n */\nexport function findInRegistry(registry: Registry, query: string, { limit = 5 }: { limit?: number } = {}): Finding[] {\n return findInRegistries([registry], query, { limit })\n}\n\n/**\n * Search several catalogues as one: the package's, the app's own, and any app\n * beside it (UIG-13).\n *\n * An app's pass-on is not a result of its own \u2014 it is the package's part, and\n * the package's entry answers for it, saying which apps hand it on. At the\n * same strength the package's part comes first: it is the one to reach for.\n */\nexport function findInRegistries(registries: Registry[], query: string, { limit = 5 }: { limit?: number } = {}): Finding[] {\n const all = words(query)\n // Drop the words that mean nothing. If the question was only those, keep them\n // rather than answer nothing at all.\n const carrying = all.filter((word) => word.length >= 3 && !STOP.has(word))\n const asked = carrying.length ? carrying : all\n if (asked.length === 0) return []\n\n const findings: Finding[] = []\n const entries = registries.flatMap((registry) => registry.entries).filter((entry) => entry.app?.class !== 're-export')\n for (const entry of entries) {\n let score = 0\n let matched = 0\n const where = new Set<string>()\n const byName = new Set<string>()\n const byNote = new Set<string>()\n for (const word of asked) {\n let best = 0\n if (entry.name.toLowerCase() === word) {\n best = 100\n where.add('name')\n } else if (hit(word, entry.name)) {\n best = 40\n where.add('name')\n }\n if (hit(word, entry.purpose)) {\n best = Math.max(best, 20)\n where.add('purpose')\n }\n for (const owned of entry.ownsBehaviours) {\n if (hit(word, owned.behaviour) || hit(word, owned.id)) {\n best = Math.max(best, 15)\n where.add('behaviour')\n }\n }\n for (const variant of entry.variants) {\n if (variant.values.some((value) => hit(word, value)) || hit(word, variant.prop)) {\n best = Math.max(best, 8)\n where.add('variant')\n byName.add(variant.prop)\n }\n }\n // What it can do. \"does Link already truncate?\" is the question this\n // answers, and answering it is what stops the thing being built twice.\n for (const prop of entry.props) {\n // A prop the question named by name is the answer; one whose note\n // happens to carry the word is a hint. Named ones go first, so a short\n // answer shows the right lines.\n if (hit(word, prop.name)) {\n best = Math.max(best, 14)\n where.add('prop')\n byName.add(prop.name)\n } else if (prop.note !== null && hit(word, prop.note)) {\n best = Math.max(best, 10)\n where.add('prop')\n byNote.add(prop.name)\n }\n }\n if (best > 0) matched += 1\n score += best\n }\n if (matched > 0) findings.push({ entry, matched, score, where: [...where], props: [...byName] })\n }\n\n const fromPackage = (finding: Finding) => (finding.entry.app === null ? 0 : 1)\n findings.sort((a, b) => b.matched - a.matched || b.score - a.score || fromPackage(a) - fromPackage(b) || a.entry.name.localeCompare(b.entry.name))\n return findings.slice(0, limit)\n}\n\n/** `http://localhost:6008/?path=/docs/overlays-popover--docs`, or `null` where the entry has no page. */\nexport function docsLink(registry: Registry, entry: RegistryEntry): string | null {\n if (!entry.docsId) return null\n return registry.storybook.devUrl + registry.storybook.docsPath.replace('{docsId}', entry.docsId)\n}\n\n/** What an app's part is, in the words the search prints. */\nconst CLASS_WORDS: Record<string, string> = {\n 'one-off': 'used in one place',\n reusable: 'used in several places',\n 'promote-candidate': 'used in several places; could move into the package',\n unused: 'used nowhere in the app',\n}\n\n/** What the command prints: the import line first, because that is what the reader came for. */\nexport function formatFindings(searched: Registry | Registry[], findings: Finding[], query: string): string {\n const registries = Array.isArray(searched) ? searched : [searched]\n if (findings.length === 0) {\n return [\n `Nothing in ${registries.map((registry) => registry.builtFrom.repo).join(', ')} matches \"${query}\".`,\n 'If nothing here does what you need, say so and ask \u2014 do not invent a component.',\n ].join('\\n')\n }\n const registryOf = (entry: RegistryEntry) => registries.find((registry) => registry.builtFrom.repo === entry.repo) ?? registries[0]\n // Which apps hand a package part on, and from where: in Peek, `Button` is\n // imported from `@/components/ui/Button`, and the answer should say so.\n const handedOn = new Map<string, string[]>()\n for (const registry of registries) {\n for (const entry of registry.entries) {\n if (entry.app?.class !== 're-export' || entry.app.handsOn === null) continue\n handedOn.set(entry.app.handsOn, [...(handedOn.get(entry.app.handsOn) ?? []), `${entry.repo} hands it on${entry.name === entry.app.handsOn ? '' : ` as ${entry.name}`} from ${entry.importPath}`])\n }\n }\n\n const blocks = findings.map((finding) => {\n const { entry } = finding\n const facts = entry.app\n const lines = [\n `${entry.name} \u00B7 ${facts ? CLASS_WORDS[facts.class] ?? facts.class : entry.kind} \u00B7 ${entry.repo} (matched ${finding.where.join(', ')})`,\n ` ${entry.purpose}`,\n facts?.defaultExport ? ` import ${entry.name} from '${entry.importPath}'` : ` import { ${entry.name} } from '${entry.importPath}'`,\n ]\n if (!facts) for (const said of handedOn.get(entry.name) ?? []) lines.push(` ${said}`)\n if (facts?.packageNamesake) lines.push(` the package has a ${facts.packageNamesake} too: check it first`)\n if (facts && facts.usedIn.length) lines.push(` used in ${facts.usedIn.slice(0, 2).join(', ')}${facts.usedIn.length > 2 ? ` and ${facts.usedIn.length - 2} more` : ''}`)\n if (entry.ownsBehaviours.length) lines.push(` owns: ${entry.ownsBehaviours.map((owned) => owned.behaviour).join(' \u00B7 ')}`)\n if (entry.variants.length) lines.push(` ${entry.variants.map((variant) => `${variant.prop}: ${variant.values.join(' | ')}`).join(' ')}`)\n // The props the question named, with their own line \u2014 not all of them. A\n // component with twenty props would bury its own answer.\n const shown = finding.props\n .filter((name) => !entry.variants.some((variant) => variant.prop === name))\n .slice(0, 3)\n .map((name) => entry.props.find((prop) => prop.name === name))\n for (const prop of shown) {\n if (prop) lines.push(` ${prop.name}: ${prop.takes}${prop.note ? ` \u2014 ${prop.note}` : ''}`)\n }\n if (entry.props.length) lines.push(` ${entry.props.length} props in all; see ${entry.docsId ? 'the page' : entry.sourceFile} for the rest`)\n const link = docsLink(registryOf(entry), entry)\n if (link) lines.push(` ${link}`)\n return lines.join('\\n')\n })\n\n return blocks.join('\\n\\n')\n}\n"],
|
|
5
|
+
"mappings": ";;;AAoBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AAId,IAAM,gBAAgB,CAAC,QAAQ,YAAY,OAAO,cAAc;AAGhE,IAAM,iBAAiB,CAAC,YAAY,mBAAmB;AAG9D,IAAM,UAAU;AAOT,SAAS,YAAY,QAA+B;AACzD,QAAM,OAAO,OAAO,QAAQ,SAAS,IAAI;AACzC,QAAM,QAAQ,CAAC,GAAG,KAAK,SAAS,oBAAoB,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AACtE,QAAM,KAAK,cAAc,IAAI,CAAC,MAAM,MAAM,QAAQ,CAAC,CAAC;AACpD,QAAM,UAAU,cAAc,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC;AACxD,MAAI,QAAQ,OAAQ,QAAO,MAAM,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;AACxE,MAAI,GAAG,KAAK,CAAC,GAAG,MAAM,IAAI,KAAK,IAAI,GA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C,SAAS,CAAC,MAAM,SAAS,KAAK,CAAC,YAAY,QAAQ,SAAS,IAAI,CAAC,EACzE,MAAM,GAAG,CAAC,EACV,IAAI,CAAC,SAAS,MAAM,MAAM,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC;AAC/D,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAM,OAAM,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,GAAG,KAAK,OAAO,WAAM,KAAK,IAAI,KAAK,EAAE,EAAE;AAAA,IAC3F;AACA,QAAI,MAAM,MAAM,OAAQ,OAAM,KAAK,KAAK,MAAM,MAAM,MAAM,sBAAsB,MAAM,SAAS,aAAa,MAAM,UAAU,eAAe;AAC3I,UAAM,OAAO,SAAS,WAAW,KAAK,GAAG,KAAK;AAC9C,QAAI,KAAM,OAAM,KAAK,KAAK,IAAI,EAAE;AAChC,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,CAAC;AAED,SAAO,OAAO,KAAK,MAAM;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -489,7 +489,8 @@ function buildAppRegistry({ root = process.cwd(), repo, packageRegistry, package
|
|
|
489
489
|
const storyOf = (p) => {
|
|
490
490
|
const stem = (file) => basename(file).replace(/\.stories\.[cm]?[jt]sx?$/, "");
|
|
491
491
|
const own = basename(p.file, extname(p.file));
|
|
492
|
-
const
|
|
492
|
+
const sameFile = (s2) => s2.imports.some((q) => q.file === p.file);
|
|
493
|
+
const candidates = stories.filter((s2) => s2.title && s2.names.length && (s2.component === p || s2.imports.includes(p) && (stem(s2.file) === p.name || stem(s2.file) === own) || stem(s2.file) === p.name && sameFile(s2)));
|
|
493
494
|
candidates.sort((a, b) => Number(b.component === p) - Number(a.component === p) || a.file.localeCompare(b.file));
|
|
494
495
|
const s = candidates[0];
|
|
495
496
|
if (!s || !s.title) return { docsId: null, storyId: null };
|
|
@@ -645,4 +646,4 @@ function buildAppRegistry({ root = process.cwd(), repo, packageRegistry, package
|
|
|
645
646
|
export {
|
|
646
647
|
buildAppRegistry
|
|
647
648
|
};
|
|
648
|
-
//# sourceMappingURL=chunk-
|
|
649
|
+
//# sourceMappingURL=chunk-XCBN2EKW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/registry/app.ts"],
|
|
4
|
-
"sourcesContent": ["/// <reference types=\"node\" />\n/**\n * An app's catalogue (UIG-13): every part in an app's own code, what it is for,\n * where it is used, and which of four kinds it is.\n *\n * **Built fresh, never committed** (Katerina, 18 September 2026). The package is\n * public and Peek and Ship are private, so an app's catalogue lives nowhere but\n * in its own code: `estiva-ui find` and `estiva-ui check` build it each time,\n * which takes about a second, and `estiva-ui build` writes it to a file only\n * when asked. A file that is never kept can never drift.\n *\n * **A file is not a part, and a folder says nothing.** Peek's `components/ui`\n * holds one-line pass-ons beside 187-line components, one file can hold six\n * parts, and a part can draw nothing at all (a provider, a listener). So the\n * target set is every name an app's `.tsx` files export that is a part: a\n * function that draws, or a name drawn as a tag somewhere in the app. The kind\n * is read from the code, and only from the code:\n *\n * - **re-export** \u2014 its file only hands a package part on.\n * - **one-off** \u2014 one file of the app uses it.\n * - **reusable** \u2014 two or more do.\n * - **promote-candidate** \u2014 two or more do, and everything it uses is already in\n * the package, so it could move there as it is. Katerina rules on each.\n * - **unused** \u2014 no file of the app uses it; its stories or tests may.\n *\n * Where the count is wrong \u2014 a general part only one screen uses yet \u2014 a person\n * writes the kind beside the part, with the reason, and the catalogue shows it:\n *\n * /**\n * * A timeline of what happened to a thing.\n * * @registry reusable: general; one screen uses it so far\n * *\\/\n *\n * TypeScript is the app's own install, as it is for the package's builder.\n */\nimport { existsSync, readFileSync, readdirSync, statSync } from 'node:fs'\nimport { basename, dirname, extname, join, relative, resolve, sep } from 'node:path'\nimport ts from 'typescript'\nimport { firstSentence, pageOpening, readModule, sanitize, toId, PACKAGE_IMPORT, type Resolved } from './build'\nimport { SCHEMA_VERSION, type AppFacts, type EntryClass, type FileWithoutPart, type Registry, type RegistryEntry } from './schema'\n\nexport interface AppBuildOptions {\n /** The app's folder: where its `package.json` and `src/` are. Ship's is `web`. */\n root?: string\n /** The name its entries are recorded under \u2014 `peek`, `ship`. Defaults to the app's package name. */\n repo?: string\n /** The package's own catalogue, for the parts an app part shares a name with. Defaults to the one this builder ships beside. */\n packageRegistry?: Registry | null\n /** The packages the package itself depends on. An import of one never ties a part to its app. Defaults to the package's own. */\n packageDependencies?: string[]\n}\n\n/** The kinds a person may write beside a part. A pass-on is a fact about its file; so is being used nowhere. */\nconst WRITABLE: EntryClass[] = ['reusable', 'one-off', 'promote-candidate']\nconst WRITTEN = /^@registry\\s+([a-z-]+)\\s*:\\s*(.+)$/m\n\nconst isStory = (file: string) => /\\.stories\\.[cm]?[jt]sx?$/.test(file)\nconst isTest = (file: string) => /\\.(test|spec)\\.[cm]?[jt]sx?$/.test(file) || /(^|\\/)__(tests|mocks)__\\//.test(file)\nconst isPascal = (name: string) => /^[A-Z][A-Za-z0-9]*$/.test(name) && !/^[A-Z0-9_]+$/.test(name)\n/**\n * What a dynamic `import('./x')` takes from its file. Written as\n * `import('./Settings').then((m) => ({ default: m.SettingsPage }))`, only the names\n * read off the module; otherwise the whole module (`*`), whose default a caller\n * then takes.\n */\nfunction pickedFrom(call: ts.CallExpression): { imported: string; local: string }[] {\n const then = call.parent\n const invoked = then?.parent\n if (then && ts.isPropertyAccessExpression(then) && then.name.text === 'then' && invoked && ts.isCallExpression(invoked)) {\n const callback = invoked.arguments[0]\n const param = callback && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) ? callback.parameters[0]?.name : undefined\n if (param && ts.isIdentifier(param)) {\n const names = new Set<string>()\n const visit = (n: ts.Node) => {\n if (ts.isPropertyAccessExpression(n) && ts.isIdentifier(n.expression) && n.expression.text === param.text) names.add(n.name.text)\n ts.forEachChild(n, visit)\n }\n visit(callback)\n if (names.size) return [...names].map((imported) => ({ imported, local: '(dynamic)' }))\n }\n }\n return [{ imported: '*', local: '(dynamic)' }]\n}\n\n/**\n * `export default memo(TopicRow)`: the default is TopicRow, wrapped. A call on\n * a name, with no function written into it, hands that name out, so the export\n * is read as if it named it \u2014 one part, whose comment and props are its own.\n */\nfunction unwrapDefault<T extends { isDefault: boolean; local: string | null; node: ts.Node | null }>(ex: T): T {\n if (!ex.isDefault || ex.local || !ex.node || !ts.isExpression(ex.node)) return ex\n const name = handedOut(ex.node)\n return name ? { ...ex, local: name, node: null } : ex\n}\n\n/**\n * The name an `export default \u2026` hands out, under whatever it is wrapped in:\n * `memo(forwardRef(Row))`, `Row as ComponentType`, `Row satisfies FC`,\n * `styled(Row)\\`\u2026\\``. `null` when what is exported is written right there.\n */\nfunction handedOut(expression: ts.Expression): string | null {\n let e: ts.Expression = expression\n for (;;) {\n if (ts.isIdentifier(e)) return e.text\n if (ts.isParenthesizedExpression(e) || ts.isAsExpression(e) || ts.isSatisfiesExpression(e) || ts.isNonNullExpression(e) || ts.isTypeAssertionExpression(e)) e = e.expression\n else if (ts.isTaggedTemplateExpression(e)) e = e.tag\n else if (ts.isCallExpression(e) && e.arguments[0] && !e.arguments.some((a) => ts.isArrowFunction(a) || ts.isFunctionExpression(a))) e = e.arguments[0]\n else return null\n }\n}\n\n/** `memo-page` \u2192 `MemoPage`, `topic_view` \u2192 `TopicView`. */\nconst pascalOf = (stem: string) => stem.split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word[0].toUpperCase() + word.slice(1)).join('')\n/** A default with no name of its own takes its file's \u2014 or, for `settings/index.tsx`, its folder's. */\nconst defaultNameOf = (file: string) => {\n const stem = basename(file, extname(file))\n return pascalOf(stem === 'index' ? basename(dirname(file)) : stem)\n}\nconst CODE = ['.tsx', '.ts', '.jsx', '.js', '.mts', '.cts']\n\n/** `@scope/name/sub` \u2192 `@scope/name`; `name/sub` \u2192 `name`. */\nfunction packageOf(specifier: string): string {\n const parts = specifier.split('/')\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]\n}\n\n/** What the package this builder belongs to depends on, and its catalogue. Read from beside the builder. */\nfunction packageSelf(): { dependencies: string[]; registry: Registry | null } {\n const at = (rel: string) => new URL(rel, import.meta.url)\n const manifest = JSON.parse(readFileSync(at('../../package.json'), 'utf8')) as { name: string; dependencies?: Record<string, string>; peerDependencies?: Record<string, string> }\n const registryUrl = at('../../registry.json')\n const registry = existsSync(registryUrl) ? (JSON.parse(readFileSync(registryUrl, 'utf8')) as Registry) : null\n return { dependencies: [manifest.name, ...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.peerDependencies ?? {})], registry }\n}\n\n/**\n * The import aliases an app's `tsconfig*.json` files declare \u2014 `@/*` \u2192\n * `<root>/src/*` \u2014 and the `baseUrl` folders a bare `src/Card` is read from.\n */\nfunction readAliases(root: string): { aliases: { prefix: string; target: string }[]; bases: string[] } {\n const aliases: { prefix: string; target: string }[] = []\n const bases: string[] = []\n for (const name of readdirSync(root).filter((file) => /^tsconfig.*\\.json$/.test(file)).sort()) {\n const read = ts.readConfigFile(join(root, name), ts.sys.readFile)\n const options = (read.config?.compilerOptions ?? {}) as { paths?: Record<string, string[]>; baseUrl?: string }\n const base = resolve(root, options.baseUrl ?? '.')\n if (options.baseUrl !== undefined && !bases.includes(base)) bases.push(base)\n for (const [pattern, targets] of Object.entries(options.paths ?? {})) {\n if (!pattern.endsWith('/*') || !targets[0]?.endsWith('/*')) continue\n const prefix = pattern.slice(0, -1)\n if (!aliases.some((alias) => alias.prefix === prefix)) aliases.push({ prefix, target: resolve(base, targets[0].slice(0, -2)) })\n }\n }\n return { aliases, bases }\n}\n\nfunction walk(dir: string): string[] {\n return readdirSync(dir).flatMap((name) => {\n if (name === 'node_modules' || name.startsWith('.')) return []\n const path = join(dir, name)\n return statSync(path).isDirectory() ? walk(path) : [path]\n })\n}\n\n/** One import, re-export or dynamic import of a file, resolved. */\ninterface Link {\n specifier: string\n /** An app code file, relative to the app; `null` for a package; `'?'` for anything else. */\n target: string | null\n /** `imported` name \u2192 local name; `*` for a namespace or a dynamic import. Type-only names are left out. */\n names: { imported: string; local: string }[]\n typeOnly: boolean\n kind: 'import' | 're-export' | 'dynamic'\n}\n\n/** A part a file exports, before anything is known about its use. */\ninterface Found {\n file: string\n /** The name it is exported as; a default export takes its own name, or the file's. */\n name: string\n /** The name it has inside its file, where it has one. */\n local: string | null\n defaultExport: boolean\n /** A pass-on: the package and the name it hands on. */\n from: { specifier: string; name: string } | null\n}\n\n/** Everything one file says, read once. */\ninterface FileFacts {\n file: string\n source: string\n sf: ts.SourceFile\n links: Link[]\n /** `exported name` \u2192 local name, and whether it is the default. */\n exports: { name: string; local: string | null; isDefault: boolean; node: ts.Node | null }[]\n /** Pass-ons and barrel entries: `export { A } from '\u2026'`. */\n reexports: { name: string; source: string; specifier: string; target: string | null }[]\n starFrom: { specifier: string; target: string | null }[]\n /** `export * as Parts from './parts'`: a name that stands for another file's parts. */\n namespaces: { name: string; target: string | null }[]\n /** Every name drawn as a JSX tag in this file. */\n tags: Set<string>\n /** Each imported value name \u2192 where it came from, for `import { X } from '\u2026'` then `export { X }`. */\n bindings: Map<string, { specifier: string; imported: string; target: string | null }>\n}\n\n/** Whether a node draws: JSX, or `createElement` / `createPortal`. */\nfunction draws(node: ts.Node): boolean {\n let found = false\n const visit = (n: ts.Node) => {\n if (found) return\n if (ts.isJsxElement(n) || ts.isJsxSelfClosingElement(n) || ts.isJsxFragment(n)) {\n found = true\n return\n }\n if (ts.isCallExpression(n)) {\n const callee = ts.isPropertyAccessExpression(n.expression) ? n.expression.name.text : ts.isIdentifier(n.expression) ? n.expression.text : ''\n if (callee === 'createElement' || callee === 'createPortal') {\n found = true\n return\n }\n }\n ts.forEachChild(n, visit)\n }\n visit(node)\n return found\n}\n\n/**\n * Whether a file names `local` anywhere but in `home` (its own declaration), its\n * imports and its export lines \u2014 as a tag, a value, or passed along. A property\n * name, an attribute name and a type are not uses of the part.\n */\nfunction mentions(sf: ts.SourceFile, local: string, home: ts.Node | null): boolean {\n let named = false\n const visit = (n: ts.Node) => {\n if (named) return\n if (ts.isIdentifier(n) && n.text === local) {\n const parent = n.parent\n // The name of something else that happens to be spelled the same \u2014 a\n // property of a type or a class, a member, another declaration \u2014 is not the part.\n const declares = (ts.isPropertySignature(parent) || ts.isPropertyDeclaration(parent) || ts.isMethodDeclaration(parent) || ts.isMethodSignature(parent) || ts.isGetAccessorDeclaration(parent) || ts.isSetAccessorDeclaration(parent) || ts.isEnumMember(parent) || ts.isVariableDeclaration(parent) || ts.isFunctionDeclaration(parent) || ts.isClassDeclaration(parent) || ts.isParameter(parent) || ts.isBindingElement(parent)) && (parent as { name?: ts.Node }).name === n\n const bindingKey = ts.isBindingElement(parent) && parent.propertyName === n\n const isName = declares || bindingKey || (ts.isPropertyAccessExpression(parent) && parent.name === n) || (ts.isPropertyAssignment(parent) && parent.name === n) || ts.isJsxAttribute(parent) || ts.isExportSpecifier(parent) || ts.isImportSpecifier(parent) || ts.isJsxClosingElement(parent)\n // `SlashMenu.displayName = 'SlashMenu'` sets something on the part; it does not use it.\n const configures = ts.isPropertyAccessExpression(parent) && parent.expression === n && ts.isBinaryExpression(parent.parent) && parent.parent.left === parent && parent.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken\n if (configures) {\n ts.forEachChild(n, visit)\n return\n }\n let inType = false\n for (let a: ts.Node | undefined = parent; a && a !== sf; a = a.parent) if (ts.isTypeNode(a)) inType = true\n if (!isName && !inType && !shadowed(n, local, sf)) named = true\n }\n ts.forEachChild(n, visit)\n }\n for (const s of sf.statements) {\n if (s === home || ts.isExportDeclaration(s) || ts.isImportDeclaration(s)) continue\n // `export default Row`, `memo(forwardRef(Row))`, `Row as ComponentType` hand the\n // part out; they do not use it. Anything else written into the default is code.\n if (ts.isExportAssignment(s) && handedOut(s.expression)) continue\n visit(s)\n }\n return named\n}\n\n/** Whether a binding name \u2014 `Icon`, `{ icon: Icon }`, `[Icon]` \u2014 binds `local`. */\nfunction binds(name: ts.BindingName | undefined, local: string): boolean {\n if (!name) return false\n if (ts.isIdentifier(name)) return name.text === local\n return name.elements.some((element) => !ts.isOmittedExpression(element) && binds(element.name, local))\n}\n\n/**\n * Whether `n` means something declared closer than the file: a parameter\n * (`Item({ icon: Icon }) { return <Icon /> }`), or a constant, function or class\n * of an enclosing block. That `Icon` is not the file's part called Icon.\n */\nfunction shadowed(n: ts.Node, local: string, sf: ts.SourceFile): boolean {\n for (let a: ts.Node | undefined = n.parent; a && a !== sf; a = a.parent) {\n if (ts.isFunctionLike(a)) {\n if (a.parameters.some((p) => binds(p.name, local))) return true\n if ((ts.isFunctionExpression(a) || ts.isClassExpression(a)) && a.name?.text === local) return true\n }\n if (ts.isCatchClause(a) && binds(a.variableDeclaration?.name, local)) return true\n if (ts.isBlock(a) || ts.isModuleBlock(a) || ts.isCaseClause(a) || ts.isDefaultClause(a)) {\n for (const s of a.statements) {\n if (ts.isVariableStatement(s) && s.declarationList.declarations.some((d) => binds(d.name, local))) return true\n if ((ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s)) && s.name?.text === local) return true\n }\n }\n if ((ts.isForStatement(a) || ts.isForOfStatement(a) || ts.isForInStatement(a)) && a.initializer && ts.isVariableDeclarationList(a.initializer) && a.initializer.declarations.some((d) => binds(d.name, local))) return true\n }\n return false\n}\n\n/**\n * The thing a declaration holds, if it is a function, a class, or a call that\n * wraps one (`forwardRef`, `memo`) \u2014 as a constant, or written straight into\n * `export default \u2026`.\n */\nfunction drawingBody(node: ts.Node): ts.Node | null {\n if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) return node\n const init = ts.isVariableDeclaration(node) ? node.initializer : ts.isExpression(node) ? node : undefined\n if (!init) return null\n if (ts.isArrowFunction(init) || ts.isFunctionExpression(init) || ts.isClassExpression(init)) return init\n if (ts.isCallExpression(init)) {\n const callee = init.expression.getText()\n if (/(^|\\.)createContext$/.test(callee)) return null\n if (init.arguments.some((a) => ts.isArrowFunction(a) || ts.isFunctionExpression(a))) return init\n }\n return null\n}\n\n/**\n * Read one app and return its catalogue.\n *\n * Throws on anything it cannot explain, with every problem at once: a part with\n * no purpose, a written kind it does not know. A catalogue that quietly drops\n * what it could not read would answer \"we have nothing for that\" when the\n * truth is \"the builder gave up\".\n */\nexport function buildAppRegistry({ root = process.cwd(), repo, packageRegistry, packageDependencies }: AppBuildOptions = {}): Registry {\n const app = resolve(root)\n const src = join(app, 'src')\n if (!existsSync(src)) throw new Error(`${app} has no src/ folder: estiva-ui reads an app's parts from src/`)\n const manifest = JSON.parse(readFileSync(join(app, 'package.json'), 'utf8')) as { name?: string; version?: string; scripts?: Record<string, string> }\n const self = packageRegistry === undefined || packageDependencies === undefined ? packageSelf() : null\n const theRegistry = packageRegistry === undefined ? (self?.registry ?? null) : packageRegistry\n const allowed = new Set(packageDependencies ?? self?.dependencies ?? [])\n const repoName = repo ?? manifest.name ?? basename(app)\n const { aliases, bases } = readAliases(app)\n const rel = (abs: string) => relative(app, abs).split(sep).join('/')\n\n const files = walk(src)\n .filter((path) => CODE.includes(extname(path)) && !path.endsWith('.d.ts'))\n .map(rel)\n .sort()\n const known = new Set(files)\n\n /** Where an import points: an app code file, a package (`null`), or something else (`'?'`). */\n const resolveSpecifier = (from: string, specifier: string): string | null => {\n let base: string | null = null\n if (specifier.startsWith('.')) base = resolve(app, dirname(from), specifier)\n else {\n const alias = aliases.find((a) => specifier.startsWith(a.prefix))\n if (alias) base = join(alias.target, specifier.slice(alias.prefix.length))\n }\n const lookUp = (at: string): string | null => {\n const stem = at.replace(/\\.(js|jsx)$/, '')\n for (const candidate of [at, ...CODE.map((e) => stem + e), ...CODE.map((e) => join(at, `index${e}`))]) {\n const r = rel(candidate)\n if (known.has(r)) return r\n }\n return null\n }\n if (base === null) {\n // A bare `src/Card` is the app's own when its tsconfig's baseUrl says so; otherwise a package.\n for (const folder of bases) {\n const hit = lookUp(join(folder, specifier))\n if (hit) return hit\n }\n return null\n }\n return lookUp(base) ?? '?'\n }\n\n // \u2500\u2500 Read every file once \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const facts = new Map<string, FileFacts>()\n for (const file of files) {\n const source = readFileSync(join(app, file), 'utf8')\n const sf = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true, /x$/.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS)\n const links: Link[] = []\n const exports: FileFacts['exports'] = []\n const reexports: FileFacts['reexports'] = []\n const starFrom: FileFacts['starFrom'] = []\n const namespaces: FileFacts['namespaces'] = []\n for (const statement of sf.statements) {\n if (ts.isImportDeclaration(statement)) {\n if (!ts.isStringLiteral(statement.moduleSpecifier)) continue\n const specifier = statement.moduleSpecifier.text\n const clause = statement.importClause\n const names: Link['names'] = []\n if (clause && !clause.isTypeOnly) {\n if (clause.name) names.push({ imported: 'default', local: clause.name.text })\n const bindings = clause.namedBindings\n if (bindings && ts.isNamedImports(bindings)) for (const e of bindings.elements) if (!e.isTypeOnly) names.push({ imported: (e.propertyName ?? e.name).text, local: e.name.text })\n if (bindings && ts.isNamespaceImport(bindings)) names.push({ imported: '*', local: bindings.name.text })\n }\n links.push({ specifier, target: resolveSpecifier(file, specifier), names, typeOnly: !!clause?.isTypeOnly || (clause !== undefined && names.length === 0 && !!clause.namedBindings), kind: 'import' })\n continue\n }\n if (ts.isExportDeclaration(statement)) {\n const specifier = statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : null\n if (specifier === null) {\n if (!statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause)) {\n // `export { Page as default }` is the file's default, named Page.\n for (const e of statement.exportClause.elements) if (!e.isTypeOnly) exports.push({ name: e.name.text, local: (e.propertyName ?? e.name).text, isDefault: e.name.text === 'default', node: null })\n }\n continue\n }\n const target = resolveSpecifier(file, specifier)\n links.push({ specifier, target, names: [], typeOnly: statement.isTypeOnly, kind: 're-export' })\n if (statement.isTypeOnly) continue\n if (!statement.exportClause) starFrom.push({ specifier, target })\n else if (ts.isNamedExports(statement.exportClause)) {\n for (const e of statement.exportClause.elements) if (!e.isTypeOnly) reexports.push({ name: e.name.text, source: (e.propertyName ?? e.name).text, specifier, target })\n } else if (ts.isNamespaceExport(statement.exportClause)) {\n // `export * as Parts from './parts'`: a caller's `Parts.Card` is the parts file's Card.\n namespaces.push({ name: statement.exportClause.name.text, target })\n }\n continue\n }\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n const e = statement.expression\n exports.push({ name: 'default', local: ts.isIdentifier(e) ? e.text : null, isDefault: true, node: ts.isIdentifier(e) ? null : e })\n continue\n }\n const mods = ts.canHaveModifiers(statement) ? (ts.getModifiers(statement) ?? []) : []\n if (!mods.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)) continue\n const isDefault = mods.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword)\n // An overload's signature is not a part of its own: the part is the one with a body.\n if (ts.isFunctionDeclaration(statement) && !statement.body) continue\n if (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) {\n exports.push({ name: isDefault ? 'default' : (statement.name?.text ?? 'default'), local: statement.name?.text ?? null, isDefault, node: statement })\n } else if (ts.isVariableStatement(statement)) {\n for (const d of statement.declarationList.declarations) if (ts.isIdentifier(d.name)) exports.push({ name: d.name.text, local: d.name.text, isDefault: false, node: d })\n }\n }\n const tags = new Set<string>()\n const visit = (n: ts.Node) => {\n if (ts.isCallExpression(n) && n.expression.kind === ts.SyntaxKind.ImportKeyword && n.arguments[0] && ts.isStringLiteralLike(n.arguments[0])) {\n const specifier = n.arguments[0].text\n links.push({ specifier, target: resolveSpecifier(file, specifier), names: pickedFrom(n), typeOnly: false, kind: 'dynamic' })\n }\n if ((ts.isJsxOpeningElement(n) || ts.isJsxSelfClosingElement(n)) && ts.isIdentifier(n.tagName)) tags.add(n.tagName.text)\n ts.forEachChild(n, visit)\n }\n visit(sf)\n const bindings: FileFacts['bindings'] = new Map()\n for (const link of links) if (link.kind === 'import') for (const n of link.names) if (n.imported !== '*') bindings.set(n.local, { specifier: link.specifier, imported: n.imported, target: link.target })\n facts.set(file, { file, source, sf, links, exports, reexports, starFrom, namespaces, tags, bindings })\n }\n\n const drawnAnywhere = new Set<string>()\n for (const f of facts.values()) for (const tag of f.tags) drawnAnywhere.add(tag)\n\n /** A top-level declaration of a file, by its local name. */\n const declarationOf = (f: FileFacts, local: string): ts.Node | null => {\n for (const s of f.sf.statements) {\n // Past an overload's signature, to the function with a body.\n if (ts.isFunctionDeclaration(s) && s.name?.text === local && !s.body) continue\n if ((ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s)) && s.name?.text === local) return s\n if (ts.isVariableStatement(s)) for (const d of s.declarationList.declarations) if (ts.isIdentifier(d.name) && d.name.text === local) return d\n }\n return null\n }\n\n // \u2500\u2500 The parts \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const problems: string[] = []\n const found: Found[] = []\n const targets = files.filter((file) => file.endsWith('.tsx') && !isStory(file) && !isTest(file))\n for (const file of targets) {\n const f = facts.get(file)!\n for (const written of f.exports) {\n const ex = unwrapDefault(written)\n // `export default memo(Avatar)` with Avatar imported: not Avatar handed on, but a\n // new part of this file that wraps it, named after the file.\n // Only a name that is a part's: `createBrowserRouter(routes)` hands out no part.\n if (ex !== written && ex.local && isPascal(ex.local) && !declarationOf(f, ex.local) && f.bindings.has(ex.local)) {\n found.push({ file, name: defaultNameOf(file), local: null, defaultExport: true, from: null })\n continue\n }\n // `export function App` and `export default App` \u2014 or `export default memo(App)`: one part, not two.\n if (ex.isDefault && ex.local && f.exports.some((other) => !other.isDefault && other.local === ex.local)) continue\n const node = ex.node ?? (ex.local ? declarationOf(f, ex.local) : null)\n // A default with no name of its own takes its file's, as a name: `memo-page.tsx` \u2192 MemoPage.\n const own = ex.local ?? (ex.isDefault ? defaultNameOf(file) : ex.name)\n const name = ex.isDefault ? own : ex.name\n if (!isPascal(name)) continue\n // `import { SkeletonBar } from '@estiva-app/ui'` and later `export { SkeletonBar }`:\n // handed on, exactly as `export { SkeletonBar } from '@estiva-app/ui'` is.\n // From another file of the app it is a barrel, and the part is listed there.\n const bound = node === null && ex.local ? f.bindings.get(ex.local) : undefined\n if (bound) {\n if (bound.target === null) found.push({ file, name, local: null, defaultExport: ex.isDefault, from: { specifier: bound.specifier, name: bound.imported } })\n continue\n }\n // `export const SkeletonSidebarList = SkeletonList`, SkeletonList imported: the\n // package's part under a second name, handed on. From an app file, a barrel.\n const alias = node && ts.isVariableDeclaration(node) && node.initializer && ts.isIdentifier(node.initializer) ? f.bindings.get(node.initializer.text) : undefined\n if (alias) {\n if (alias.target === null) found.push({ file, name, local: null, defaultExport: ex.isDefault, from: { specifier: alias.specifier, name: alias.imported } })\n continue\n }\n const body = node ? drawingBody(node) : null\n const isPart = (body !== null && draws(body)) || drawnAnywhere.has(ex.local ?? name)\n if (isPart) found.push({ file, name, local: ex.local, defaultExport: ex.isDefault, from: null })\n }\n for (const re of f.reexports) {\n // Handing on another file of the app is a barrel: the part is listed where it is written.\n if (re.target !== null || !isPascal(re.name)) continue\n found.push({ file, name: re.name, local: null, defaultExport: false, from: { specifier: re.specifier, name: re.source } })\n }\n for (const star of f.starFrom) {\n if (star.target === null) problems.push(`${file} hands on everything from '${star.specifier}' with export *: name the parts it hands on, so the catalogue can list them`)\n }\n }\n\n // \u2500\u2500 Where each is used \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const key = (file: string, name: string) => `${file}#${name}`\n const byKey = new Map(found.map((p) => [key(p.file, p.name), p]))\n const partsIn = (file: string) => found.filter((p) => p.file === file)\n /** The part a file's default export is, however it was written. */\n const defaultPartOf = (file: string): Found | null => {\n const written = facts.get(file)?.exports.find((e) => e.isDefault)\n if (!written) return null\n const d = unwrapDefault(written)\n return partsIn(file).find((p) => p.defaultExport || (d.local !== null && p.local === d.local)) ?? null\n }\n\n /** What `name`, imported from `file`, really is: follows barrels to the file that writes it. */\n const origin = (file: string, name: string, seen = new Set<string>()): Found | null => {\n if (seen.has(key(file, name))) return null\n seen.add(key(file, name))\n const direct = byKey.get(key(file, name))\n if (direct) return direct\n const f = facts.get(file)\n if (!f) return null\n // `export default Foo` elsewhere in the file: the default is Foo's part.\n if (name === 'default') {\n const d = defaultPartOf(file)\n if (d) return d\n }\n const re = f.reexports.find((r) => r.name === name)\n if (re && re.target && re.target !== '?') return origin(re.target, re.source, seen)\n // `import { X } from './X'` and `export { X }`: a barrel written in two lines.\n const ex = f.exports.find((e) => (name === 'default' ? e.isDefault : e.name === name && !e.isDefault))\n const renamed = ex?.node && ts.isVariableDeclaration(ex.node) && ex.node.initializer && ts.isIdentifier(ex.node.initializer) ? f.bindings.get(ex.node.initializer.text) : undefined\n const bound = (ex?.local && !ex.node && !declarationOf(f, ex.local) ? f.bindings.get(ex.local) : undefined) ?? renamed\n if (bound?.target && bound.target !== '?') return origin(bound.target, bound.imported, seen)\n for (const star of f.starFrom) if (star.target && star.target !== '?') {\n const hit = origin(star.target, name, seen)\n if (hit) return hit\n }\n return null\n }\n /** Every part a file hands out, through its barrels too. */\n const everyPartOf = (file: string, seen = new Set<string>()): Found[] => {\n if (seen.has(file)) return []\n seen.add(file)\n const f = facts.get(file)\n if (!f) return []\n const out = [...partsIn(file)]\n for (const re of f.reexports) if (re.target && re.target !== '?') { const o = origin(re.target, re.source); if (o) out.push(o) }\n for (const star of f.starFrom) if (star.target && star.target !== '?') out.push(...everyPartOf(star.target, seen))\n for (const ns of f.namespaces) if (ns.target && ns.target !== '?') out.push(...everyPartOf(ns.target, seen))\n return out\n }\n /** The parts a namespace export stands for, followed through barrels. */\n const namespaceParts = (file: string, name: string, seen = new Set<string>()): Found[] => {\n if (seen.has(`${file}#${name}`)) return []\n seen.add(`${file}#${name}`)\n const f = facts.get(file)\n if (!f) return []\n const ns = f.namespaces.find((x) => x.name === name)\n if (ns) return ns.target && ns.target !== '?' ? everyPartOf(ns.target) : []\n const re = f.reexports.find((r) => r.name === name)\n if (re?.target && re.target !== '?') return namespaceParts(re.target, re.source, seen)\n return f.starFrom.flatMap((star) => (star.target && star.target !== '?' ? namespaceParts(star.target, name, seen) : []))\n }\n\n const users = new Map<string, { app: Set<string>; stories: Set<string>; tests: Set<string> }>()\n for (const p of found) users.set(key(p.file, p.name), { app: new Set(), stories: new Set(), tests: new Set() })\n for (const f of facts.values()) {\n const bucket = (p: Found) => {\n const u = users.get(key(p.file, p.name))!\n return isStory(f.file) ? u.stories : isTest(f.file) ? u.tests : u.app\n }\n for (const link of f.links) {\n if (link.kind === 're-export' || link.typeOnly || !link.target || link.target === '?') continue\n for (const n of link.names) {\n if (n.imported === '*') {\n // `lazy(() => import('./Page'))` loads the default; a namespace may use any.\n const theDefault = link.kind === 'dynamic' ? defaultPartOf(link.target) : null\n const chosen = theDefault ? [theDefault] : everyPartOf(link.target)\n for (const p of chosen) if (p.file !== f.file) bucket(p).add(f.file)\n continue\n }\n const p = origin(link.target, n.imported)\n // A file that imports a part only to export it again hands it on; it does not use it.\n const handsOn = f.exports.some((e) => e.local === n.local && e.node === null) && !mentions(f.sf, n.local, null)\n if (handsOn) continue\n if (p) {\n if (p.file !== f.file) bucket(p).add(f.file)\n continue\n }\n // `import { Parts } from './barrel'`, where the barrel says `export * as Parts from './parts'`.\n for (const part of namespaceParts(link.target, n.imported)) if (part.file !== f.file) bucket(part).add(f.file)\n }\n }\n }\n // Its own file uses it when something there, other than its own declaration and\n // the export line, names it \u2014 a card drawn by the list beside it.\n for (const p of found) {\n if (p.from || !p.local) continue\n const f = facts.get(p.file)!\n const decl = declarationOf(f, p.local)\n const home = decl ? (ts.isVariableDeclaration(decl) ? decl.parent.parent : decl) : null\n if (mentions(f.sf, p.local, home)) users.get(key(p.file, p.name))!.app.add(p.file)\n }\n\n // \u2500\u2500 What ties each file to the app \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // A file is tied when it imports a package the package does not itself depend\n // on, something that is not code, or an app file that is tied. Types count: a\n // part typed by Peek's data is Peek's.\n const directTies = new Map<string, string[]>()\n const appDeps = new Map<string, string[]>()\n for (const f of facts.values()) {\n const ties: string[] = []\n const deps: string[] = []\n for (const link of f.links) {\n if (link.target === null) {\n const tie = link.specifier.startsWith('node:') ? link.specifier : allowed.has(packageOf(link.specifier)) ? null : packageOf(link.specifier)\n if (tie && !ties.includes(tie)) ties.push(tie)\n } else if (link.target === '?') {\n if (!ties.includes(link.specifier)) ties.push(link.specifier)\n } else if (link.target !== f.file && !deps.includes(link.target)) deps.push(link.target)\n }\n directTies.set(f.file, ties)\n appDeps.set(f.file, deps)\n }\n const tied = new Set([...directTies].filter(([, t]) => t.length > 0).map(([file]) => file))\n for (let changed = true; changed; ) {\n changed = false\n for (const [file, deps] of appDeps) if (!tied.has(file) && deps.some((d) => tied.has(d))) (tied.add(file), (changed = true))\n }\n const tiesOf = (file: string) => [...directTies.get(file)!, ...appDeps.get(file)!.filter((d) => tied.has(d))].sort()\n\n // \u2500\u2500 Stories: which one shows a part \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const stories = files.filter(isStory).map((file) => {\n const f = facts.get(file)!\n let title: string | null = null\n let component: string | null = null\n let noDocs = false\n const names: string[] = []\n for (const s of f.sf.statements) {\n if (!ts.isVariableStatement(s)) continue\n const exported = (ts.getModifiers(s) ?? []).some((m) => m.kind === ts.SyntaxKind.ExportKeyword)\n for (const d of s.declarationList.declarations) {\n if (!ts.isIdentifier(d.name)) continue\n if (d.name.text === 'meta') {\n let init = d.initializer\n while (init && (ts.isSatisfiesExpression(init) || ts.isAsExpression(init) || ts.isParenthesizedExpression(init))) init = init.expression\n if (init && ts.isObjectLiteralExpression(init)) {\n for (const prop of init.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue\n if (prop.name.text === 'title' && ts.isStringLiteralLike(prop.initializer)) title = prop.initializer.text\n if (prop.name.text === 'component' && ts.isIdentifier(prop.initializer)) component = prop.initializer.text\n if (prop.name.text === 'tags' && ts.isArrayLiteralExpression(prop.initializer)) noDocs = prop.initializer.elements.some((e) => ts.isStringLiteralLike(e) && e.text === '!autodocs')\n }\n }\n } else if (exported) names.push(d.name.text)\n }\n }\n // Which part each local name is, through the imports.\n const imported = new Map<string, Found>()\n for (const link of f.links) {\n if (!link.target || link.target === '?') continue\n for (const n of link.names) {\n if (n.imported === '*') continue\n const p = origin(link.target, n.imported)\n if (p) imported.set(n.local, p)\n }\n }\n return { file, title, component: component ? (imported.get(component) ?? null) : null, noDocs, names, imports: [...imported.values()] }\n })\n const storyOf = (p: Found) => {\n const stem = (file: string) => basename(file).replace(/\\.stories\\.[cm]?[jt]sx?$/, '')\n const own = basename(p.file, extname(p.file))\n const candidates = stories.filter((s) => s.title && s.names.length && (s.component === p || (s.imports.includes(p) && (stem(s.file) === p.name || stem(s.file) === own))))\n candidates.sort((a, b) => Number(b.component === p) - Number(a.component === p) || a.file.localeCompare(b.file))\n const s = candidates[0]\n if (!s || !s.title) return { docsId: null, storyId: null }\n return { docsId: s.noDocs ? null : `${sanitize(s.title)}--docs`, storyId: toId(s.title, s.names.includes(p.name) ? p.name : s.names[0]) }\n }\n\n // \u2500\u2500 Props, read the way the package's are \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n type Module = ReturnType<typeof readModule>\n const modules = new Map<string, Module>()\n const moduleAt = (file: string): Module => {\n const held = modules.get(file)\n if (held) return held\n const read = readModule(facts.get(file)!.source, (specifier, typeName): Resolved | undefined => {\n // A wrapper typed by the package's own props takes what the package's part\n // takes. The package names every part's props type after the part \u2014\n // `SearchInputProps` is `SearchInput`'s, all 65 of them \u2014 so its entry answers.\n if (specifier === PACKAGE_IMPORT) {\n const part = typeName.endsWith('Props') ? theRegistry?.entries.find((entry) => entry.name === typeName.slice(0, -'Props'.length)) : undefined\n return part ? { props: part.props, variants: part.variants } : undefined\n }\n const target = resolveSpecifier(file, specifier)\n return target && target !== '?' ? moduleAt(target).resolveName(typeName) : undefined\n // A comment directly above a part is that part's, first in its file or not.\n }, { lendFirstComment: false })\n modules.set(file, read)\n return read\n }\n\n // \u2500\u2500 The entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const namesakes = new Set((theRegistry?.entries ?? []).map((e) => e.name))\n const importPathOf = (file: string) => {\n const abs = join(app, file)\n const alias = aliases.find((a) => abs.startsWith(a.target + sep))\n const stem = file.replace(/\\.[cm]?[jt]sx?$/, '').replace(/\\/index$/, '')\n return alias ? `${alias.prefix}${relative(alias.target, join(app, stem)).split(sep).join('/')}` : stem\n }\n const port = /(?:-p|--port)[\\s=]+(\\d+)/.exec(manifest.scripts?.storybook ?? '')?.[1] ?? '6006'\n\n const entries: RegistryEntry[] = []\n for (const p of found) {\n const u = users.get(key(p.file, p.name))!\n const usedIn = [...u.app].sort()\n const pass = p.from\n const onePart = partsIn(p.file).filter((q) => !q.from).length === 1\n const module = pass ? null : moduleAt(p.file)\n // A default written as an expression has no name in its file: the builder keeps it as `default`.\n const declared = pass ? undefined : module!.declarations.get(p.local ?? 'default')\n const header = module?.headerDoc ?? ''\n // The file's default may carry its comment on `export default memo(Row)` rather than on Row.\n const doc = declared?.doc || (defaultPartOf(p.file) === p ? (module?.declarations.get('default')?.doc ?? '') : '')\n\n // Purpose: its page, else its own comment, else \u2014 for a file of one part \u2014\n // the file's. A pass-on says whose it is.\n const page = pass ? null : join(dirname(p.file), `${p.name}.mdx`).split(sep).join('/')\n const pageText = page && existsSync(join(app, page)) ? pageOpening(readFileSync(join(app, page), 'utf8')) : ''\n let purpose = ''\n let purposeFrom: RegistryEntry['purposeFrom'] = 'comment'\n if (pass) {\n const as = pass.name === p.name ? '' : ` as ${p.name}`\n purpose = pass.specifier === PACKAGE_IMPORT ? `The package's ${pass.name}, handed on${as} so the app can import it from ${importPathOf(p.file)}.` : `${pass.name} from ${pass.specifier}, handed on${as} so the app can import it from ${importPathOf(p.file)}.`\n purposeFrom = 'package'\n } else if (firstSentence(pageText)) {\n purpose = firstSentence(pageText)\n purposeFrom = 'page'\n } else if (firstSentence(doc)) {\n purpose = firstSentence(doc)\n } else if (onePart && firstSentence(header)) {\n purpose = firstSentence(header)\n purposeFrom = 'file'\n }\n if (!purpose) {\n problems.push(`${p.name} in ${p.file} has no one-line description. Write one as a /** \u2026 */ comment directly above it${onePart ? ', or at the top of the file' : ''}.`)\n continue\n }\n\n // Its kind: written beside it, or read from the evidence.\n const writtenLine = WRITTEN.exec(doc) ?? (onePart ? WRITTEN.exec(header) : null)\n const ties = pass ? [] : tiesOf(p.file)\n let cls: EntryClass\n let reason: string\n let written = false\n if (pass) {\n cls = 're-export'\n reason = `Its file only hands on ${pass.specifier === PACKAGE_IMPORT ? `the package's ${pass.name}` : `${pass.name} from ${pass.specifier}`}.`\n if (writtenLine) problems.push(`${p.name} in ${p.file} is a pass-on, so its kind is read from the file: remove \"@registry ${writtenLine[1]}\"`)\n } else if (writtenLine) {\n const said = writtenLine[1] as EntryClass\n if (!WRITABLE.includes(said)) {\n problems.push(`${p.name} in ${p.file} says \"@registry ${writtenLine[1]}\": the kinds a person may write are ${WRITABLE.join(', ')}`)\n continue\n }\n cls = said\n reason = writtenLine[2].trim()\n written = true\n } else if (usedIn.length === 0) {\n cls = 'unused'\n reason = u.stories.size ? 'No file of the app uses it; only its stories do.' : u.tests.size ? 'No file of the app uses it; only its tests do.' : 'Nothing uses it.'\n } else if (usedIn.length === 1) {\n cls = 'one-off'\n reason = `Used in one place: ${usedIn[0]}.`\n } else if (ties.length) {\n cls = 'reusable'\n reason = `Used in ${usedIn.length} places, and tied to the app by ${ties[0]}${ties.length > 1 ? ` and ${ties.length - 1} more` : ''}.`\n } else {\n cls = 'promote-candidate'\n reason = `Used in ${usedIn.length} places, and everything it uses is already in the package.`\n }\n\n const shape: Resolved = declared ? module!.resolve(declared.propsType) : { props: [], variants: [] }\n const facts_: AppFacts = {\n class: cls,\n reason,\n written,\n handsOn: pass ? (pass.specifier === PACKAGE_IMPORT ? pass.name : `${pass.name} from ${pass.specifier}`) : null,\n usedIn,\n tiedTo: ties,\n packageNamesake: namesakes.has(p.name) && !(pass && pass.specifier === PACKAGE_IMPORT && pass.name === p.name) ? p.name : null,\n defaultExport: p.defaultExport,\n }\n const { docsId, storyId } = pass ? { docsId: null, storyId: null } : storyOf(p)\n entries.push({\n name: p.name,\n repo: repoName,\n kind: 'component',\n importPath: importPathOf(p.file),\n sourceFile: p.file,\n purpose,\n purposeFrom,\n props: shape.props,\n variants: shape.variants,\n ownsBehaviours: [],\n status: declared?.deprecated ? 'deprecated' : 'stable',\n migrationStage: null,\n docsId,\n storyId,\n docPage: pageText ? page : null,\n app: facts_,\n })\n }\n\n if (problems.length) throw new Error(`the catalogue of ${repoName} cannot be built:\\n ${problems.join('\\n ')}`)\n\n entries.sort((a, b) => a.name.localeCompare(b.name) || a.sourceFile.localeCompare(b.sourceFile))\n const withParts = new Set(found.map((p) => p.file))\n const filesWithoutParts: FileWithoutPart[] = targets\n .filter((file) => !withParts.has(file))\n .map((file) => {\n const f = facts.get(file)!\n const names = [...f.exports.map((e) => (e.isDefault ? (e.local ?? 'a default') : e.name)), ...f.reexports.map((r) => r.name)]\n return { file, reason: names.length ? `It exports no part, only ${names.join(', ')}.` : 'It exports nothing.' }\n })\n\n return {\n schemaVersion: SCHEMA_VERSION,\n builtFrom: {\n kind: 'app',\n repo: repoName,\n package: manifest.name ?? repoName,\n packageVersion: manifest.version ?? '0.0.0',\n exports: found.length,\n typeExports: 0,\n files: targets.length,\n },\n storybook: {\n docsPath: '/?path=/docs/{docsId}',\n storyPath: '/?path=/story/{storyId}',\n devUrl: `http://localhost:${port}`,\n },\n entries,\n excluded: [],\n filesWithoutParts,\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAmCA,SAAS,YAAY,cAAc,aAAa,gBAAgB;AAChE,SAAS,UAAU,SAAS,SAAS,MAAM,UAAU,SAAS,WAAW;AACzE,OAAO,QAAQ;AAgBf,IAAM,WAAyB,CAAC,YAAY,WAAW,mBAAmB;AAC1E,IAAM,UAAU;AAEhB,IAAM,UAAU,C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wB,SAAS,KAAK,MAAM,CAAC,EAAE;AAEhH,UAAQ,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,KAAK,EAAE,WAAW,cAAc,EAAE,UAAU,CAAC;AAC/F,QAAM,YAAY,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;AAClD,QAAM,oBAAuC,QAC1C,OAAO,CAAC,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC,EACrC,IAAI,CAAC,SAAS;AACb,UAAM,IAAI,MAAM,IAAI,IAAI;AACxB,UAAM,QAAQ,CAAC,GAAG,EAAE,QAAQ,IAAI,CAAC,MAAO,EAAE,YAAa,EAAE,SAAS,cAAe,EAAE,IAAK,GAAG,GAAG,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;AAC5H,WAAO,EAAE,MAAM,QAAQ,MAAM,SAAS,4BAA4B,MAAM,KAAK,IAAI,CAAC,MAAM,sBAAsB;AAAA,EAChH,CAAC;AAEH,SAAO;AAAA,IACL,eAAe;AAAA,IACf,WAAW;AAAA,MACT,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS,SAAS,QAAQ;AAAA,MAC1B,gBAAgB,SAAS,WAAW;AAAA,MACpC,SAAS,MAAM;AAAA,MACf,aAAa;AAAA,MACb,OAAO,QAAQ;AAAA,IACjB;AAAA,IACA,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,MACX,QAAQ,oBAAoB,IAAI;AAAA,IAClC;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,IACX;AAAA,EACF;AACF;",
|
|
4
|
+
"sourcesContent": ["/// <reference types=\"node\" />\n/**\n * An app's catalogue (UIG-13): every part in an app's own code, what it is for,\n * where it is used, and which of four kinds it is.\n *\n * **Built fresh, never committed** (Katerina, 18 September 2026). The package is\n * public and Peek and Ship are private, so an app's catalogue lives nowhere but\n * in its own code: `estiva-ui find` and `estiva-ui check` build it each time,\n * which takes about a second, and `estiva-ui build` writes it to a file only\n * when asked. A file that is never kept can never drift.\n *\n * **A file is not a part, and a folder says nothing.** Peek's `components/ui`\n * holds one-line pass-ons beside 187-line components, one file can hold six\n * parts, and a part can draw nothing at all (a provider, a listener). So the\n * target set is every name an app's `.tsx` files export that is a part: a\n * function that draws, or a name drawn as a tag somewhere in the app. The kind\n * is read from the code, and only from the code:\n *\n * - **re-export** \u2014 its file only hands a package part on.\n * - **one-off** \u2014 one file of the app uses it.\n * - **reusable** \u2014 two or more do.\n * - **promote-candidate** \u2014 two or more do, and everything it uses is already in\n * the package, so it could move there as it is. Katerina rules on each.\n * - **unused** \u2014 no file of the app uses it; its stories or tests may.\n *\n * Where the count is wrong \u2014 a general part only one screen uses yet \u2014 a person\n * writes the kind beside the part, with the reason, and the catalogue shows it:\n *\n * /**\n * * A timeline of what happened to a thing.\n * * @registry reusable: general; one screen uses it so far\n * *\\/\n *\n * TypeScript is the app's own install, as it is for the package's builder.\n */\nimport { existsSync, readFileSync, readdirSync, statSync } from 'node:fs'\nimport { basename, dirname, extname, join, relative, resolve, sep } from 'node:path'\nimport ts from 'typescript'\nimport { firstSentence, pageOpening, readModule, sanitize, toId, PACKAGE_IMPORT, type Resolved } from './build'\nimport { SCHEMA_VERSION, type AppFacts, type EntryClass, type FileWithoutPart, type Registry, type RegistryEntry } from './schema'\n\nexport interface AppBuildOptions {\n /** The app's folder: where its `package.json` and `src/` are. Ship's is `web`. */\n root?: string\n /** The name its entries are recorded under \u2014 `peek`, `ship`. Defaults to the app's package name. */\n repo?: string\n /** The package's own catalogue, for the parts an app part shares a name with. Defaults to the one this builder ships beside. */\n packageRegistry?: Registry | null\n /** The packages the package itself depends on. An import of one never ties a part to its app. Defaults to the package's own. */\n packageDependencies?: string[]\n}\n\n/** The kinds a person may write beside a part. A pass-on is a fact about its file; so is being used nowhere. */\nconst WRITABLE: EntryClass[] = ['reusable', 'one-off', 'promote-candidate']\nconst WRITTEN = /^@registry\\s+([a-z-]+)\\s*:\\s*(.+)$/m\n\nconst isStory = (file: string) => /\\.stories\\.[cm]?[jt]sx?$/.test(file)\nconst isTest = (file: string) => /\\.(test|spec)\\.[cm]?[jt]sx?$/.test(file) || /(^|\\/)__(tests|mocks)__\\//.test(file)\nconst isPascal = (name: string) => /^[A-Z][A-Za-z0-9]*$/.test(name) && !/^[A-Z0-9_]+$/.test(name)\n/**\n * What a dynamic `import('./x')` takes from its file. Written as\n * `import('./Settings').then((m) => ({ default: m.SettingsPage }))`, only the names\n * read off the module; otherwise the whole module (`*`), whose default a caller\n * then takes.\n */\nfunction pickedFrom(call: ts.CallExpression): { imported: string; local: string }[] {\n const then = call.parent\n const invoked = then?.parent\n if (then && ts.isPropertyAccessExpression(then) && then.name.text === 'then' && invoked && ts.isCallExpression(invoked)) {\n const callback = invoked.arguments[0]\n const param = callback && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) ? callback.parameters[0]?.name : undefined\n if (param && ts.isIdentifier(param)) {\n const names = new Set<string>()\n const visit = (n: ts.Node) => {\n if (ts.isPropertyAccessExpression(n) && ts.isIdentifier(n.expression) && n.expression.text === param.text) names.add(n.name.text)\n ts.forEachChild(n, visit)\n }\n visit(callback)\n if (names.size) return [...names].map((imported) => ({ imported, local: '(dynamic)' }))\n }\n }\n return [{ imported: '*', local: '(dynamic)' }]\n}\n\n/**\n * `export default memo(TopicRow)`: the default is TopicRow, wrapped. A call on\n * a name, with no function written into it, hands that name out, so the export\n * is read as if it named it \u2014 one part, whose comment and props are its own.\n */\nfunction unwrapDefault<T extends { isDefault: boolean; local: string | null; node: ts.Node | null }>(ex: T): T {\n if (!ex.isDefault || ex.local || !ex.node || !ts.isExpression(ex.node)) return ex\n const name = handedOut(ex.node)\n return name ? { ...ex, local: name, node: null } : ex\n}\n\n/**\n * The name an `export default \u2026` hands out, under whatever it is wrapped in:\n * `memo(forwardRef(Row))`, `Row as ComponentType`, `Row satisfies FC`,\n * `styled(Row)\\`\u2026\\``. `null` when what is exported is written right there.\n */\nfunction handedOut(expression: ts.Expression): string | null {\n let e: ts.Expression = expression\n for (;;) {\n if (ts.isIdentifier(e)) return e.text\n if (ts.isParenthesizedExpression(e) || ts.isAsExpression(e) || ts.isSatisfiesExpression(e) || ts.isNonNullExpression(e) || ts.isTypeAssertionExpression(e)) e = e.expression\n else if (ts.isTaggedTemplateExpression(e)) e = e.tag\n else if (ts.isCallExpression(e) && e.arguments[0] && !e.arguments.some((a) => ts.isArrowFunction(a) || ts.isFunctionExpression(a))) e = e.arguments[0]\n else return null\n }\n}\n\n/** `memo-page` \u2192 `MemoPage`, `topic_view` \u2192 `TopicView`. */\nconst pascalOf = (stem: string) => stem.split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word[0].toUpperCase() + word.slice(1)).join('')\n/** A default with no name of its own takes its file's \u2014 or, for `settings/index.tsx`, its folder's. */\nconst defaultNameOf = (file: string) => {\n const stem = basename(file, extname(file))\n return pascalOf(stem === 'index' ? basename(dirname(file)) : stem)\n}\nconst CODE = ['.tsx', '.ts', '.jsx', '.js', '.mts', '.cts']\n\n/** `@scope/name/sub` \u2192 `@scope/name`; `name/sub` \u2192 `name`. */\nfunction packageOf(specifier: string): string {\n const parts = specifier.split('/')\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]\n}\n\n/** What the package this builder belongs to depends on, and its catalogue. Read from beside the builder. */\nfunction packageSelf(): { dependencies: string[]; registry: Registry | null } {\n const at = (rel: string) => new URL(rel, import.meta.url)\n const manifest = JSON.parse(readFileSync(at('../../package.json'), 'utf8')) as { name: string; dependencies?: Record<string, string>; peerDependencies?: Record<string, string> }\n const registryUrl = at('../../registry.json')\n const registry = existsSync(registryUrl) ? (JSON.parse(readFileSync(registryUrl, 'utf8')) as Registry) : null\n return { dependencies: [manifest.name, ...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.peerDependencies ?? {})], registry }\n}\n\n/**\n * The import aliases an app's `tsconfig*.json` files declare \u2014 `@/*` \u2192\n * `<root>/src/*` \u2014 and the `baseUrl` folders a bare `src/Card` is read from.\n */\nfunction readAliases(root: string): { aliases: { prefix: string; target: string }[]; bases: string[] } {\n const aliases: { prefix: string; target: string }[] = []\n const bases: string[] = []\n for (const name of readdirSync(root).filter((file) => /^tsconfig.*\\.json$/.test(file)).sort()) {\n const read = ts.readConfigFile(join(root, name), ts.sys.readFile)\n const options = (read.config?.compilerOptions ?? {}) as { paths?: Record<string, string[]>; baseUrl?: string }\n const base = resolve(root, options.baseUrl ?? '.')\n if (options.baseUrl !== undefined && !bases.includes(base)) bases.push(base)\n for (const [pattern, targets] of Object.entries(options.paths ?? {})) {\n if (!pattern.endsWith('/*') || !targets[0]?.endsWith('/*')) continue\n const prefix = pattern.slice(0, -1)\n if (!aliases.some((alias) => alias.prefix === prefix)) aliases.push({ prefix, target: resolve(base, targets[0].slice(0, -2)) })\n }\n }\n return { aliases, bases }\n}\n\nfunction walk(dir: string): string[] {\n return readdirSync(dir).flatMap((name) => {\n if (name === 'node_modules' || name.startsWith('.')) return []\n const path = join(dir, name)\n return statSync(path).isDirectory() ? walk(path) : [path]\n })\n}\n\n/** One import, re-export or dynamic import of a file, resolved. */\ninterface Link {\n specifier: string\n /** An app code file, relative to the app; `null` for a package; `'?'` for anything else. */\n target: string | null\n /** `imported` name \u2192 local name; `*` for a namespace or a dynamic import. Type-only names are left out. */\n names: { imported: string; local: string }[]\n typeOnly: boolean\n kind: 'import' | 're-export' | 'dynamic'\n}\n\n/** A part a file exports, before anything is known about its use. */\ninterface Found {\n file: string\n /** The name it is exported as; a default export takes its own name, or the file's. */\n name: string\n /** The name it has inside its file, where it has one. */\n local: string | null\n defaultExport: boolean\n /** A pass-on: the package and the name it hands on. */\n from: { specifier: string; name: string } | null\n}\n\n/** Everything one file says, read once. */\ninterface FileFacts {\n file: string\n source: string\n sf: ts.SourceFile\n links: Link[]\n /** `exported name` \u2192 local name, and whether it is the default. */\n exports: { name: string; local: string | null; isDefault: boolean; node: ts.Node | null }[]\n /** Pass-ons and barrel entries: `export { A } from '\u2026'`. */\n reexports: { name: string; source: string; specifier: string; target: string | null }[]\n starFrom: { specifier: string; target: string | null }[]\n /** `export * as Parts from './parts'`: a name that stands for another file's parts. */\n namespaces: { name: string; target: string | null }[]\n /** Every name drawn as a JSX tag in this file. */\n tags: Set<string>\n /** Each imported value name \u2192 where it came from, for `import { X } from '\u2026'` then `export { X }`. */\n bindings: Map<string, { specifier: string; imported: string; target: string | null }>\n}\n\n/** Whether a node draws: JSX, or `createElement` / `createPortal`. */\nfunction draws(node: ts.Node): boolean {\n let found = false\n const visit = (n: ts.Node) => {\n if (found) return\n if (ts.isJsxElement(n) || ts.isJsxSelfClosingElement(n) || ts.isJsxFragment(n)) {\n found = true\n return\n }\n if (ts.isCallExpression(n)) {\n const callee = ts.isPropertyAccessExpression(n.expression) ? n.expression.name.text : ts.isIdentifier(n.expression) ? n.expression.text : ''\n if (callee === 'createElement' || callee === 'createPortal') {\n found = true\n return\n }\n }\n ts.forEachChild(n, visit)\n }\n visit(node)\n return found\n}\n\n/**\n * Whether a file names `local` anywhere but in `home` (its own declaration), its\n * imports and its export lines \u2014 as a tag, a value, or passed along. A property\n * name, an attribute name and a type are not uses of the part.\n */\nfunction mentions(sf: ts.SourceFile, local: string, home: ts.Node | null): boolean {\n let named = false\n const visit = (n: ts.Node) => {\n if (named) return\n if (ts.isIdentifier(n) && n.text === local) {\n const parent = n.parent\n // The name of something else that happens to be spelled the same \u2014 a\n // property of a type or a class, a member, another declaration \u2014 is not the part.\n const declares = (ts.isPropertySignature(parent) || ts.isPropertyDeclaration(parent) || ts.isMethodDeclaration(parent) || ts.isMethodSignature(parent) || ts.isGetAccessorDeclaration(parent) || ts.isSetAccessorDeclaration(parent) || ts.isEnumMember(parent) || ts.isVariableDeclaration(parent) || ts.isFunctionDeclaration(parent) || ts.isClassDeclaration(parent) || ts.isParameter(parent) || ts.isBindingElement(parent)) && (parent as { name?: ts.Node }).name === n\n const bindingKey = ts.isBindingElement(parent) && parent.propertyName === n\n const isName = declares || bindingKey || (ts.isPropertyAccessExpression(parent) && parent.name === n) || (ts.isPropertyAssignment(parent) && parent.name === n) || ts.isJsxAttribute(parent) || ts.isExportSpecifier(parent) || ts.isImportSpecifier(parent) || ts.isJsxClosingElement(parent)\n // `SlashMenu.displayName = 'SlashMenu'` sets something on the part; it does not use it.\n const configures = ts.isPropertyAccessExpression(parent) && parent.expression === n && ts.isBinaryExpression(parent.parent) && parent.parent.left === parent && parent.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken\n if (configures) {\n ts.forEachChild(n, visit)\n return\n }\n let inType = false\n for (let a: ts.Node | undefined = parent; a && a !== sf; a = a.parent) if (ts.isTypeNode(a)) inType = true\n if (!isName && !inType && !shadowed(n, local, sf)) named = true\n }\n ts.forEachChild(n, visit)\n }\n for (const s of sf.statements) {\n if (s === home || ts.isExportDeclaration(s) || ts.isImportDeclaration(s)) continue\n // `export default Row`, `memo(forwardRef(Row))`, `Row as ComponentType` hand the\n // part out; they do not use it. Anything else written into the default is code.\n if (ts.isExportAssignment(s) && handedOut(s.expression)) continue\n visit(s)\n }\n return named\n}\n\n/** Whether a binding name \u2014 `Icon`, `{ icon: Icon }`, `[Icon]` \u2014 binds `local`. */\nfunction binds(name: ts.BindingName | undefined, local: string): boolean {\n if (!name) return false\n if (ts.isIdentifier(name)) return name.text === local\n return name.elements.some((element) => !ts.isOmittedExpression(element) && binds(element.name, local))\n}\n\n/**\n * Whether `n` means something declared closer than the file: a parameter\n * (`Item({ icon: Icon }) { return <Icon /> }`), or a constant, function or class\n * of an enclosing block. That `Icon` is not the file's part called Icon.\n */\nfunction shadowed(n: ts.Node, local: string, sf: ts.SourceFile): boolean {\n for (let a: ts.Node | undefined = n.parent; a && a !== sf; a = a.parent) {\n if (ts.isFunctionLike(a)) {\n if (a.parameters.some((p) => binds(p.name, local))) return true\n if ((ts.isFunctionExpression(a) || ts.isClassExpression(a)) && a.name?.text === local) return true\n }\n if (ts.isCatchClause(a) && binds(a.variableDeclaration?.name, local)) return true\n if (ts.isBlock(a) || ts.isModuleBlock(a) || ts.isCaseClause(a) || ts.isDefaultClause(a)) {\n for (const s of a.statements) {\n if (ts.isVariableStatement(s) && s.declarationList.declarations.some((d) => binds(d.name, local))) return true\n if ((ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s)) && s.name?.text === local) return true\n }\n }\n if ((ts.isForStatement(a) || ts.isForOfStatement(a) || ts.isForInStatement(a)) && a.initializer && ts.isVariableDeclarationList(a.initializer) && a.initializer.declarations.some((d) => binds(d.name, local))) return true\n }\n return false\n}\n\n/**\n * The thing a declaration holds, if it is a function, a class, or a call that\n * wraps one (`forwardRef`, `memo`) \u2014 as a constant, or written straight into\n * `export default \u2026`.\n */\nfunction drawingBody(node: ts.Node): ts.Node | null {\n if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) return node\n const init = ts.isVariableDeclaration(node) ? node.initializer : ts.isExpression(node) ? node : undefined\n if (!init) return null\n if (ts.isArrowFunction(init) || ts.isFunctionExpression(init) || ts.isClassExpression(init)) return init\n if (ts.isCallExpression(init)) {\n const callee = init.expression.getText()\n if (/(^|\\.)createContext$/.test(callee)) return null\n if (init.arguments.some((a) => ts.isArrowFunction(a) || ts.isFunctionExpression(a))) return init\n }\n return null\n}\n\n/**\n * Read one app and return its catalogue.\n *\n * Throws on anything it cannot explain, with every problem at once: a part with\n * no purpose, a written kind it does not know. A catalogue that quietly drops\n * what it could not read would answer \"we have nothing for that\" when the\n * truth is \"the builder gave up\".\n */\nexport function buildAppRegistry({ root = process.cwd(), repo, packageRegistry, packageDependencies }: AppBuildOptions = {}): Registry {\n const app = resolve(root)\n const src = join(app, 'src')\n if (!existsSync(src)) throw new Error(`${app} has no src/ folder: estiva-ui reads an app's parts from src/`)\n const manifest = JSON.parse(readFileSync(join(app, 'package.json'), 'utf8')) as { name?: string; version?: string; scripts?: Record<string, string> }\n const self = packageRegistry === undefined || packageDependencies === undefined ? packageSelf() : null\n const theRegistry = packageRegistry === undefined ? (self?.registry ?? null) : packageRegistry\n const allowed = new Set(packageDependencies ?? self?.dependencies ?? [])\n const repoName = repo ?? manifest.name ?? basename(app)\n const { aliases, bases } = readAliases(app)\n const rel = (abs: string) => relative(app, abs).split(sep).join('/')\n\n const files = walk(src)\n .filter((path) => CODE.includes(extname(path)) && !path.endsWith('.d.ts'))\n .map(rel)\n .sort()\n const known = new Set(files)\n\n /** Where an import points: an app code file, a package (`null`), or something else (`'?'`). */\n const resolveSpecifier = (from: string, specifier: string): string | null => {\n let base: string | null = null\n if (specifier.startsWith('.')) base = resolve(app, dirname(from), specifier)\n else {\n const alias = aliases.find((a) => specifier.startsWith(a.prefix))\n if (alias) base = join(alias.target, specifier.slice(alias.prefix.length))\n }\n const lookUp = (at: string): string | null => {\n const stem = at.replace(/\\.(js|jsx)$/, '')\n for (const candidate of [at, ...CODE.map((e) => stem + e), ...CODE.map((e) => join(at, `index${e}`))]) {\n const r = rel(candidate)\n if (known.has(r)) return r\n }\n return null\n }\n if (base === null) {\n // A bare `src/Card` is the app's own when its tsconfig's baseUrl says so; otherwise a package.\n for (const folder of bases) {\n const hit = lookUp(join(folder, specifier))\n if (hit) return hit\n }\n return null\n }\n return lookUp(base) ?? '?'\n }\n\n // \u2500\u2500 Read every file once \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const facts = new Map<string, FileFacts>()\n for (const file of files) {\n const source = readFileSync(join(app, file), 'utf8')\n const sf = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true, /x$/.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS)\n const links: Link[] = []\n const exports: FileFacts['exports'] = []\n const reexports: FileFacts['reexports'] = []\n const starFrom: FileFacts['starFrom'] = []\n const namespaces: FileFacts['namespaces'] = []\n for (const statement of sf.statements) {\n if (ts.isImportDeclaration(statement)) {\n if (!ts.isStringLiteral(statement.moduleSpecifier)) continue\n const specifier = statement.moduleSpecifier.text\n const clause = statement.importClause\n const names: Link['names'] = []\n if (clause && !clause.isTypeOnly) {\n if (clause.name) names.push({ imported: 'default', local: clause.name.text })\n const bindings = clause.namedBindings\n if (bindings && ts.isNamedImports(bindings)) for (const e of bindings.elements) if (!e.isTypeOnly) names.push({ imported: (e.propertyName ?? e.name).text, local: e.name.text })\n if (bindings && ts.isNamespaceImport(bindings)) names.push({ imported: '*', local: bindings.name.text })\n }\n links.push({ specifier, target: resolveSpecifier(file, specifier), names, typeOnly: !!clause?.isTypeOnly || (clause !== undefined && names.length === 0 && !!clause.namedBindings), kind: 'import' })\n continue\n }\n if (ts.isExportDeclaration(statement)) {\n const specifier = statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : null\n if (specifier === null) {\n if (!statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause)) {\n // `export { Page as default }` is the file's default, named Page.\n for (const e of statement.exportClause.elements) if (!e.isTypeOnly) exports.push({ name: e.name.text, local: (e.propertyName ?? e.name).text, isDefault: e.name.text === 'default', node: null })\n }\n continue\n }\n const target = resolveSpecifier(file, specifier)\n links.push({ specifier, target, names: [], typeOnly: statement.isTypeOnly, kind: 're-export' })\n if (statement.isTypeOnly) continue\n if (!statement.exportClause) starFrom.push({ specifier, target })\n else if (ts.isNamedExports(statement.exportClause)) {\n for (const e of statement.exportClause.elements) if (!e.isTypeOnly) reexports.push({ name: e.name.text, source: (e.propertyName ?? e.name).text, specifier, target })\n } else if (ts.isNamespaceExport(statement.exportClause)) {\n // `export * as Parts from './parts'`: a caller's `Parts.Card` is the parts file's Card.\n namespaces.push({ name: statement.exportClause.name.text, target })\n }\n continue\n }\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n const e = statement.expression\n exports.push({ name: 'default', local: ts.isIdentifier(e) ? e.text : null, isDefault: true, node: ts.isIdentifier(e) ? null : e })\n continue\n }\n const mods = ts.canHaveModifiers(statement) ? (ts.getModifiers(statement) ?? []) : []\n if (!mods.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)) continue\n const isDefault = mods.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword)\n // An overload's signature is not a part of its own: the part is the one with a body.\n if (ts.isFunctionDeclaration(statement) && !statement.body) continue\n if (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) {\n exports.push({ name: isDefault ? 'default' : (statement.name?.text ?? 'default'), local: statement.name?.text ?? null, isDefault, node: statement })\n } else if (ts.isVariableStatement(statement)) {\n for (const d of statement.declarationList.declarations) if (ts.isIdentifier(d.name)) exports.push({ name: d.name.text, local: d.name.text, isDefault: false, node: d })\n }\n }\n const tags = new Set<string>()\n const visit = (n: ts.Node) => {\n if (ts.isCallExpression(n) && n.expression.kind === ts.SyntaxKind.ImportKeyword && n.arguments[0] && ts.isStringLiteralLike(n.arguments[0])) {\n const specifier = n.arguments[0].text\n links.push({ specifier, target: resolveSpecifier(file, specifier), names: pickedFrom(n), typeOnly: false, kind: 'dynamic' })\n }\n if ((ts.isJsxOpeningElement(n) || ts.isJsxSelfClosingElement(n)) && ts.isIdentifier(n.tagName)) tags.add(n.tagName.text)\n ts.forEachChild(n, visit)\n }\n visit(sf)\n const bindings: FileFacts['bindings'] = new Map()\n for (const link of links) if (link.kind === 'import') for (const n of link.names) if (n.imported !== '*') bindings.set(n.local, { specifier: link.specifier, imported: n.imported, target: link.target })\n facts.set(file, { file, source, sf, links, exports, reexports, starFrom, namespaces, tags, bindings })\n }\n\n const drawnAnywhere = new Set<string>()\n for (const f of facts.values()) for (const tag of f.tags) drawnAnywhere.add(tag)\n\n /** A top-level declaration of a file, by its local name. */\n const declarationOf = (f: FileFacts, local: string): ts.Node | null => {\n for (const s of f.sf.statements) {\n // Past an overload's signature, to the function with a body.\n if (ts.isFunctionDeclaration(s) && s.name?.text === local && !s.body) continue\n if ((ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s)) && s.name?.text === local) return s\n if (ts.isVariableStatement(s)) for (const d of s.declarationList.declarations) if (ts.isIdentifier(d.name) && d.name.text === local) return d\n }\n return null\n }\n\n // \u2500\u2500 The parts \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const problems: string[] = []\n const found: Found[] = []\n const targets = files.filter((file) => file.endsWith('.tsx') && !isStory(file) && !isTest(file))\n for (const file of targets) {\n const f = facts.get(file)!\n for (const written of f.exports) {\n const ex = unwrapDefault(written)\n // `export default memo(Avatar)` with Avatar imported: not Avatar handed on, but a\n // new part of this file that wraps it, named after the file.\n // Only a name that is a part's: `createBrowserRouter(routes)` hands out no part.\n if (ex !== written && ex.local && isPascal(ex.local) && !declarationOf(f, ex.local) && f.bindings.has(ex.local)) {\n found.push({ file, name: defaultNameOf(file), local: null, defaultExport: true, from: null })\n continue\n }\n // `export function App` and `export default App` \u2014 or `export default memo(App)`: one part, not two.\n if (ex.isDefault && ex.local && f.exports.some((other) => !other.isDefault && other.local === ex.local)) continue\n const node = ex.node ?? (ex.local ? declarationOf(f, ex.local) : null)\n // A default with no name of its own takes its file's, as a name: `memo-page.tsx` \u2192 MemoPage.\n const own = ex.local ?? (ex.isDefault ? defaultNameOf(file) : ex.name)\n const name = ex.isDefault ? own : ex.name\n if (!isPascal(name)) continue\n // `import { SkeletonBar } from '@estiva-app/ui'` and later `export { SkeletonBar }`:\n // handed on, exactly as `export { SkeletonBar } from '@estiva-app/ui'` is.\n // From another file of the app it is a barrel, and the part is listed there.\n const bound = node === null && ex.local ? f.bindings.get(ex.local) : undefined\n if (bound) {\n if (bound.target === null) found.push({ file, name, local: null, defaultExport: ex.isDefault, from: { specifier: bound.specifier, name: bound.imported } })\n continue\n }\n // `export const SkeletonSidebarList = SkeletonList`, SkeletonList imported: the\n // package's part under a second name, handed on. From an app file, a barrel.\n const alias = node && ts.isVariableDeclaration(node) && node.initializer && ts.isIdentifier(node.initializer) ? f.bindings.get(node.initializer.text) : undefined\n if (alias) {\n if (alias.target === null) found.push({ file, name, local: null, defaultExport: ex.isDefault, from: { specifier: alias.specifier, name: alias.imported } })\n continue\n }\n const body = node ? drawingBody(node) : null\n const isPart = (body !== null && draws(body)) || drawnAnywhere.has(ex.local ?? name)\n if (isPart) found.push({ file, name, local: ex.local, defaultExport: ex.isDefault, from: null })\n }\n for (const re of f.reexports) {\n // Handing on another file of the app is a barrel: the part is listed where it is written.\n if (re.target !== null || !isPascal(re.name)) continue\n found.push({ file, name: re.name, local: null, defaultExport: false, from: { specifier: re.specifier, name: re.source } })\n }\n for (const star of f.starFrom) {\n if (star.target === null) problems.push(`${file} hands on everything from '${star.specifier}' with export *: name the parts it hands on, so the catalogue can list them`)\n }\n }\n\n // \u2500\u2500 Where each is used \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const key = (file: string, name: string) => `${file}#${name}`\n const byKey = new Map(found.map((p) => [key(p.file, p.name), p]))\n const partsIn = (file: string) => found.filter((p) => p.file === file)\n /** The part a file's default export is, however it was written. */\n const defaultPartOf = (file: string): Found | null => {\n const written = facts.get(file)?.exports.find((e) => e.isDefault)\n if (!written) return null\n const d = unwrapDefault(written)\n return partsIn(file).find((p) => p.defaultExport || (d.local !== null && p.local === d.local)) ?? null\n }\n\n /** What `name`, imported from `file`, really is: follows barrels to the file that writes it. */\n const origin = (file: string, name: string, seen = new Set<string>()): Found | null => {\n if (seen.has(key(file, name))) return null\n seen.add(key(file, name))\n const direct = byKey.get(key(file, name))\n if (direct) return direct\n const f = facts.get(file)\n if (!f) return null\n // `export default Foo` elsewhere in the file: the default is Foo's part.\n if (name === 'default') {\n const d = defaultPartOf(file)\n if (d) return d\n }\n const re = f.reexports.find((r) => r.name === name)\n if (re && re.target && re.target !== '?') return origin(re.target, re.source, seen)\n // `import { X } from './X'` and `export { X }`: a barrel written in two lines.\n const ex = f.exports.find((e) => (name === 'default' ? e.isDefault : e.name === name && !e.isDefault))\n const renamed = ex?.node && ts.isVariableDeclaration(ex.node) && ex.node.initializer && ts.isIdentifier(ex.node.initializer) ? f.bindings.get(ex.node.initializer.text) : undefined\n const bound = (ex?.local && !ex.node && !declarationOf(f, ex.local) ? f.bindings.get(ex.local) : undefined) ?? renamed\n if (bound?.target && bound.target !== '?') return origin(bound.target, bound.imported, seen)\n for (const star of f.starFrom) if (star.target && star.target !== '?') {\n const hit = origin(star.target, name, seen)\n if (hit) return hit\n }\n return null\n }\n /** Every part a file hands out, through its barrels too. */\n const everyPartOf = (file: string, seen = new Set<string>()): Found[] => {\n if (seen.has(file)) return []\n seen.add(file)\n const f = facts.get(file)\n if (!f) return []\n const out = [...partsIn(file)]\n for (const re of f.reexports) if (re.target && re.target !== '?') { const o = origin(re.target, re.source); if (o) out.push(o) }\n for (const star of f.starFrom) if (star.target && star.target !== '?') out.push(...everyPartOf(star.target, seen))\n for (const ns of f.namespaces) if (ns.target && ns.target !== '?') out.push(...everyPartOf(ns.target, seen))\n return out\n }\n /** The parts a namespace export stands for, followed through barrels. */\n const namespaceParts = (file: string, name: string, seen = new Set<string>()): Found[] => {\n if (seen.has(`${file}#${name}`)) return []\n seen.add(`${file}#${name}`)\n const f = facts.get(file)\n if (!f) return []\n const ns = f.namespaces.find((x) => x.name === name)\n if (ns) return ns.target && ns.target !== '?' ? everyPartOf(ns.target) : []\n const re = f.reexports.find((r) => r.name === name)\n if (re?.target && re.target !== '?') return namespaceParts(re.target, re.source, seen)\n return f.starFrom.flatMap((star) => (star.target && star.target !== '?' ? namespaceParts(star.target, name, seen) : []))\n }\n\n const users = new Map<string, { app: Set<string>; stories: Set<string>; tests: Set<string> }>()\n for (const p of found) users.set(key(p.file, p.name), { app: new Set(), stories: new Set(), tests: new Set() })\n for (const f of facts.values()) {\n const bucket = (p: Found) => {\n const u = users.get(key(p.file, p.name))!\n return isStory(f.file) ? u.stories : isTest(f.file) ? u.tests : u.app\n }\n for (const link of f.links) {\n if (link.kind === 're-export' || link.typeOnly || !link.target || link.target === '?') continue\n for (const n of link.names) {\n if (n.imported === '*') {\n // `lazy(() => import('./Page'))` loads the default; a namespace may use any.\n const theDefault = link.kind === 'dynamic' ? defaultPartOf(link.target) : null\n const chosen = theDefault ? [theDefault] : everyPartOf(link.target)\n for (const p of chosen) if (p.file !== f.file) bucket(p).add(f.file)\n continue\n }\n const p = origin(link.target, n.imported)\n // A file that imports a part only to export it again hands it on; it does not use it.\n const handsOn = f.exports.some((e) => e.local === n.local && e.node === null) && !mentions(f.sf, n.local, null)\n if (handsOn) continue\n if (p) {\n if (p.file !== f.file) bucket(p).add(f.file)\n continue\n }\n // `import { Parts } from './barrel'`, where the barrel says `export * as Parts from './parts'`.\n for (const part of namespaceParts(link.target, n.imported)) if (part.file !== f.file) bucket(part).add(f.file)\n }\n }\n }\n // Its own file uses it when something there, other than its own declaration and\n // the export line, names it \u2014 a card drawn by the list beside it.\n for (const p of found) {\n if (p.from || !p.local) continue\n const f = facts.get(p.file)!\n const decl = declarationOf(f, p.local)\n const home = decl ? (ts.isVariableDeclaration(decl) ? decl.parent.parent : decl) : null\n if (mentions(f.sf, p.local, home)) users.get(key(p.file, p.name))!.app.add(p.file)\n }\n\n // \u2500\u2500 What ties each file to the app \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // A file is tied when it imports a package the package does not itself depend\n // on, something that is not code, or an app file that is tied. Types count: a\n // part typed by Peek's data is Peek's.\n const directTies = new Map<string, string[]>()\n const appDeps = new Map<string, string[]>()\n for (const f of facts.values()) {\n const ties: string[] = []\n const deps: string[] = []\n for (const link of f.links) {\n if (link.target === null) {\n const tie = link.specifier.startsWith('node:') ? link.specifier : allowed.has(packageOf(link.specifier)) ? null : packageOf(link.specifier)\n if (tie && !ties.includes(tie)) ties.push(tie)\n } else if (link.target === '?') {\n if (!ties.includes(link.specifier)) ties.push(link.specifier)\n } else if (link.target !== f.file && !deps.includes(link.target)) deps.push(link.target)\n }\n directTies.set(f.file, ties)\n appDeps.set(f.file, deps)\n }\n const tied = new Set([...directTies].filter(([, t]) => t.length > 0).map(([file]) => file))\n for (let changed = true; changed; ) {\n changed = false\n for (const [file, deps] of appDeps) if (!tied.has(file) && deps.some((d) => tied.has(d))) (tied.add(file), (changed = true))\n }\n const tiesOf = (file: string) => [...directTies.get(file)!, ...appDeps.get(file)!.filter((d) => tied.has(d))].sort()\n\n // \u2500\u2500 Stories: which one shows a part \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const stories = files.filter(isStory).map((file) => {\n const f = facts.get(file)!\n let title: string | null = null\n let component: string | null = null\n let noDocs = false\n const names: string[] = []\n for (const s of f.sf.statements) {\n if (!ts.isVariableStatement(s)) continue\n const exported = (ts.getModifiers(s) ?? []).some((m) => m.kind === ts.SyntaxKind.ExportKeyword)\n for (const d of s.declarationList.declarations) {\n if (!ts.isIdentifier(d.name)) continue\n if (d.name.text === 'meta') {\n let init = d.initializer\n while (init && (ts.isSatisfiesExpression(init) || ts.isAsExpression(init) || ts.isParenthesizedExpression(init))) init = init.expression\n if (init && ts.isObjectLiteralExpression(init)) {\n for (const prop of init.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue\n if (prop.name.text === 'title' && ts.isStringLiteralLike(prop.initializer)) title = prop.initializer.text\n if (prop.name.text === 'component' && ts.isIdentifier(prop.initializer)) component = prop.initializer.text\n if (prop.name.text === 'tags' && ts.isArrayLiteralExpression(prop.initializer)) noDocs = prop.initializer.elements.some((e) => ts.isStringLiteralLike(e) && e.text === '!autodocs')\n }\n }\n } else if (exported) names.push(d.name.text)\n }\n }\n // Which part each local name is, through the imports.\n const imported = new Map<string, Found>()\n for (const link of f.links) {\n if (!link.target || link.target === '?') continue\n for (const n of link.names) {\n if (n.imported === '*') continue\n const p = origin(link.target, n.imported)\n if (p) imported.set(n.local, p)\n }\n }\n return { file, title, component: component ? (imported.get(component) ?? null) : null, noDocs, names, imports: [...imported.values()] }\n })\n const storyOf = (p: Found) => {\n const stem = (file: string) => basename(file).replace(/\\.stories\\.[cm]?[jt]sx?$/, '')\n const own = basename(p.file, extname(p.file))\n // A story file named after the part draws it even when its stories are of a\n // presentational half in the same file \u2014 `FilesPanel.stories.tsx` drawing\n // `FilesPanelView` is FilesPanel's picture, and its page attaches there (UIG-19).\n const sameFile = (s: (typeof stories)[number]) => s.imports.some((q) => q.file === p.file)\n const candidates = stories.filter((s) => s.title && s.names.length && (s.component === p || (s.imports.includes(p) && (stem(s.file) === p.name || stem(s.file) === own)) || (stem(s.file) === p.name && sameFile(s))))\n candidates.sort((a, b) => Number(b.component === p) - Number(a.component === p) || a.file.localeCompare(b.file))\n const s = candidates[0]\n if (!s || !s.title) return { docsId: null, storyId: null }\n return { docsId: s.noDocs ? null : `${sanitize(s.title)}--docs`, storyId: toId(s.title, s.names.includes(p.name) ? p.name : s.names[0]) }\n }\n\n // \u2500\u2500 Props, read the way the package's are \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n type Module = ReturnType<typeof readModule>\n const modules = new Map<string, Module>()\n const moduleAt = (file: string): Module => {\n const held = modules.get(file)\n if (held) return held\n const read = readModule(facts.get(file)!.source, (specifier, typeName): Resolved | undefined => {\n // A wrapper typed by the package's own props takes what the package's part\n // takes. The package names every part's props type after the part \u2014\n // `SearchInputProps` is `SearchInput`'s, all 65 of them \u2014 so its entry answers.\n if (specifier === PACKAGE_IMPORT) {\n const part = typeName.endsWith('Props') ? theRegistry?.entries.find((entry) => entry.name === typeName.slice(0, -'Props'.length)) : undefined\n return part ? { props: part.props, variants: part.variants } : undefined\n }\n const target = resolveSpecifier(file, specifier)\n return target && target !== '?' ? moduleAt(target).resolveName(typeName) : undefined\n // A comment directly above a part is that part's, first in its file or not.\n }, { lendFirstComment: false })\n modules.set(file, read)\n return read\n }\n\n // \u2500\u2500 The entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const namesakes = new Set((theRegistry?.entries ?? []).map((e) => e.name))\n const importPathOf = (file: string) => {\n const abs = join(app, file)\n const alias = aliases.find((a) => abs.startsWith(a.target + sep))\n const stem = file.replace(/\\.[cm]?[jt]sx?$/, '').replace(/\\/index$/, '')\n return alias ? `${alias.prefix}${relative(alias.target, join(app, stem)).split(sep).join('/')}` : stem\n }\n const port = /(?:-p|--port)[\\s=]+(\\d+)/.exec(manifest.scripts?.storybook ?? '')?.[1] ?? '6006'\n\n const entries: RegistryEntry[] = []\n for (const p of found) {\n const u = users.get(key(p.file, p.name))!\n const usedIn = [...u.app].sort()\n const pass = p.from\n const onePart = partsIn(p.file).filter((q) => !q.from).length === 1\n const module = pass ? null : moduleAt(p.file)\n // A default written as an expression has no name in its file: the builder keeps it as `default`.\n const declared = pass ? undefined : module!.declarations.get(p.local ?? 'default')\n const header = module?.headerDoc ?? ''\n // The file's default may carry its comment on `export default memo(Row)` rather than on Row.\n const doc = declared?.doc || (defaultPartOf(p.file) === p ? (module?.declarations.get('default')?.doc ?? '') : '')\n\n // Purpose: its page, else its own comment, else \u2014 for a file of one part \u2014\n // the file's. A pass-on says whose it is.\n const page = pass ? null : join(dirname(p.file), `${p.name}.mdx`).split(sep).join('/')\n const pageText = page && existsSync(join(app, page)) ? pageOpening(readFileSync(join(app, page), 'utf8')) : ''\n let purpose = ''\n let purposeFrom: RegistryEntry['purposeFrom'] = 'comment'\n if (pass) {\n const as = pass.name === p.name ? '' : ` as ${p.name}`\n purpose = pass.specifier === PACKAGE_IMPORT ? `The package's ${pass.name}, handed on${as} so the app can import it from ${importPathOf(p.file)}.` : `${pass.name} from ${pass.specifier}, handed on${as} so the app can import it from ${importPathOf(p.file)}.`\n purposeFrom = 'package'\n } else if (firstSentence(pageText)) {\n purpose = firstSentence(pageText)\n purposeFrom = 'page'\n } else if (firstSentence(doc)) {\n purpose = firstSentence(doc)\n } else if (onePart && firstSentence(header)) {\n purpose = firstSentence(header)\n purposeFrom = 'file'\n }\n if (!purpose) {\n problems.push(`${p.name} in ${p.file} has no one-line description. Write one as a /** \u2026 */ comment directly above it${onePart ? ', or at the top of the file' : ''}.`)\n continue\n }\n\n // Its kind: written beside it, or read from the evidence.\n const writtenLine = WRITTEN.exec(doc) ?? (onePart ? WRITTEN.exec(header) : null)\n const ties = pass ? [] : tiesOf(p.file)\n let cls: EntryClass\n let reason: string\n let written = false\n if (pass) {\n cls = 're-export'\n reason = `Its file only hands on ${pass.specifier === PACKAGE_IMPORT ? `the package's ${pass.name}` : `${pass.name} from ${pass.specifier}`}.`\n if (writtenLine) problems.push(`${p.name} in ${p.file} is a pass-on, so its kind is read from the file: remove \"@registry ${writtenLine[1]}\"`)\n } else if (writtenLine) {\n const said = writtenLine[1] as EntryClass\n if (!WRITABLE.includes(said)) {\n problems.push(`${p.name} in ${p.file} says \"@registry ${writtenLine[1]}\": the kinds a person may write are ${WRITABLE.join(', ')}`)\n continue\n }\n cls = said\n reason = writtenLine[2].trim()\n written = true\n } else if (usedIn.length === 0) {\n cls = 'unused'\n reason = u.stories.size ? 'No file of the app uses it; only its stories do.' : u.tests.size ? 'No file of the app uses it; only its tests do.' : 'Nothing uses it.'\n } else if (usedIn.length === 1) {\n cls = 'one-off'\n reason = `Used in one place: ${usedIn[0]}.`\n } else if (ties.length) {\n cls = 'reusable'\n reason = `Used in ${usedIn.length} places, and tied to the app by ${ties[0]}${ties.length > 1 ? ` and ${ties.length - 1} more` : ''}.`\n } else {\n cls = 'promote-candidate'\n reason = `Used in ${usedIn.length} places, and everything it uses is already in the package.`\n }\n\n const shape: Resolved = declared ? module!.resolve(declared.propsType) : { props: [], variants: [] }\n const facts_: AppFacts = {\n class: cls,\n reason,\n written,\n handsOn: pass ? (pass.specifier === PACKAGE_IMPORT ? pass.name : `${pass.name} from ${pass.specifier}`) : null,\n usedIn,\n tiedTo: ties,\n packageNamesake: namesakes.has(p.name) && !(pass && pass.specifier === PACKAGE_IMPORT && pass.name === p.name) ? p.name : null,\n defaultExport: p.defaultExport,\n }\n const { docsId, storyId } = pass ? { docsId: null, storyId: null } : storyOf(p)\n entries.push({\n name: p.name,\n repo: repoName,\n kind: 'component',\n importPath: importPathOf(p.file),\n sourceFile: p.file,\n purpose,\n purposeFrom,\n props: shape.props,\n variants: shape.variants,\n ownsBehaviours: [],\n status: declared?.deprecated ? 'deprecated' : 'stable',\n migrationStage: null,\n docsId,\n storyId,\n docPage: pageText ? page : null,\n app: facts_,\n })\n }\n\n if (problems.length) throw new Error(`the catalogue of ${repoName} cannot be built:\\n ${problems.join('\\n ')}`)\n\n entries.sort((a, b) => a.name.localeCompare(b.name) || a.sourceFile.localeCompare(b.sourceFile))\n const withParts = new Set(found.map((p) => p.file))\n const filesWithoutParts: FileWithoutPart[] = targets\n .filter((file) => !withParts.has(file))\n .map((file) => {\n const f = facts.get(file)!\n const names = [...f.exports.map((e) => (e.isDefault ? (e.local ?? 'a default') : e.name)), ...f.reexports.map((r) => r.name)]\n return { file, reason: names.length ? `It exports no part, only ${names.join(', ')}.` : 'It exports nothing.' }\n })\n\n return {\n schemaVersion: SCHEMA_VERSION,\n builtFrom: {\n kind: 'app',\n repo: repoName,\n package: manifest.name ?? repoName,\n packageVersion: manifest.version ?? '0.0.0',\n exports: found.length,\n typeExports: 0,\n files: targets.length,\n },\n storybook: {\n docsPath: '/?path=/docs/{docsId}',\n storyPath: '/?path=/story/{storyId}',\n devUrl: `http://localhost:${port}`,\n },\n entries,\n excluded: [],\n filesWithoutParts,\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAmCA,SAAS,YAAY,cAAc,aAAa,gBAAgB;AAChE,SAAS,UAAU,SAAS,SAAS,MAAM,UAAU,SAAS,WAAW;AACzE,OAAO,QAAQ;AAgBf,IAAM,WAAyB,CAAC,YAAY,WAAW,mBAAmB;AAC1E,IAAM,UAAU;AAEhB,IAAM,UAAU,CAAC,SAAiB,2BAA2B,KAAK,IAAI;AACtE,IAAM,SAAS,CAAC,SAAiB,+BAA+B,KAAK,IAAI,KAAK,4BAA4B,KAAK,IAAI;AACnH,IAAM,WAAW,CAAC,SAAiB,sBAAsB,KAAK,IAAI,KAAK,CAAC,eAAe,KAAK,IAAI;AAOhG,SAAS,WAAW,MAAgE;AAClF,QAAM,OAAO,KAAK;AAClB,QAAM,UAAU,MAAM;AACtB,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