@nanisoft/prism-llms 0.2.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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/dist/data.json +557 -0
  3. package/dist/demo-graph.d.ts +24 -0
  4. package/dist/demo-graph.d.ts.map +1 -0
  5. package/dist/demo-graph.js +56 -0
  6. package/dist/demo-graph.js.map +1 -0
  7. package/dist/extractor.d.ts +37 -0
  8. package/dist/extractor.d.ts.map +1 -0
  9. package/dist/extractor.js +243 -0
  10. package/dist/extractor.js.map +1 -0
  11. package/dist/index.d.ts +10 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +9 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/llms-full.txt +1876 -0
  16. package/dist/llms.txt +98 -0
  17. package/dist/markdown.d.ts +42 -0
  18. package/dist/markdown.d.ts.map +1 -0
  19. package/dist/markdown.js +118 -0
  20. package/dist/markdown.js.map +1 -0
  21. package/dist/md/blocks/component-demo.md +19 -0
  22. package/dist/md/blocks/page-header.md +19 -0
  23. package/dist/md/components/affix.md +14 -0
  24. package/dist/md/components/alert.md +14 -0
  25. package/dist/md/components/anchor.md +14 -0
  26. package/dist/md/components/auto-complete.md +14 -0
  27. package/dist/md/components/avatar.md +14 -0
  28. package/dist/md/components/back-top.md +14 -0
  29. package/dist/md/components/badge.md +14 -0
  30. package/dist/md/components/border-beam.md +14 -0
  31. package/dist/md/components/breadcrumb.md +14 -0
  32. package/dist/md/components/button.md +14 -0
  33. package/dist/md/components/calendar.md +14 -0
  34. package/dist/md/components/card.md +14 -0
  35. package/dist/md/components/carousel.md +14 -0
  36. package/dist/md/components/cascader.md +14 -0
  37. package/dist/md/components/checkbox.md +14 -0
  38. package/dist/md/components/col.md +14 -0
  39. package/dist/md/components/collapse.md +14 -0
  40. package/dist/md/components/color-picker.md +14 -0
  41. package/dist/md/components/date-picker.md +14 -0
  42. package/dist/md/components/descriptions.md +14 -0
  43. package/dist/md/components/display-title.md +20 -0
  44. package/dist/md/components/divider.md +14 -0
  45. package/dist/md/components/drawer.md +14 -0
  46. package/dist/md/components/dropdown.md +14 -0
  47. package/dist/md/components/empty.md +14 -0
  48. package/dist/md/components/flex.md +14 -0
  49. package/dist/md/components/float-button.md +14 -0
  50. package/dist/md/components/form.md +14 -0
  51. package/dist/md/components/grid.md +14 -0
  52. package/dist/md/components/image.md +14 -0
  53. package/dist/md/components/input-number.md +14 -0
  54. package/dist/md/components/input.md +14 -0
  55. package/dist/md/components/layout.md +14 -0
  56. package/dist/md/components/list.md +14 -0
  57. package/dist/md/components/listy.md +14 -0
  58. package/dist/md/components/masonry.md +14 -0
  59. package/dist/md/components/mentions.md +14 -0
  60. package/dist/md/components/menu.md +14 -0
  61. package/dist/md/components/modal.md +14 -0
  62. package/dist/md/components/pagination.md +14 -0
  63. package/dist/md/components/popconfirm.md +14 -0
  64. package/dist/md/components/popover.md +14 -0
  65. package/dist/md/components/progress.md +14 -0
  66. package/dist/md/components/qrcode.md +14 -0
  67. package/dist/md/components/radio.md +14 -0
  68. package/dist/md/components/rate.md +14 -0
  69. package/dist/md/components/result.md +14 -0
  70. package/dist/md/components/row.md +14 -0
  71. package/dist/md/components/segmented.md +14 -0
  72. package/dist/md/components/select.md +14 -0
  73. package/dist/md/components/skeleton.md +14 -0
  74. package/dist/md/components/slider.md +14 -0
  75. package/dist/md/components/space.md +14 -0
  76. package/dist/md/components/spin.md +14 -0
  77. package/dist/md/components/splitter.md +14 -0
  78. package/dist/md/components/statistic.md +14 -0
  79. package/dist/md/components/steps.md +14 -0
  80. package/dist/md/components/switch.md +14 -0
  81. package/dist/md/components/table.md +14 -0
  82. package/dist/md/components/tabs.md +14 -0
  83. package/dist/md/components/tag.md +14 -0
  84. package/dist/md/components/time-picker.md +14 -0
  85. package/dist/md/components/timeline.md +14 -0
  86. package/dist/md/components/tooltip.md +14 -0
  87. package/dist/md/components/tour.md +14 -0
  88. package/dist/md/components/transfer.md +14 -0
  89. package/dist/md/components/tree-select.md +14 -0
  90. package/dist/md/components/tree.md +14 -0
  91. package/dist/md/components/typography.md +14 -0
  92. package/dist/md/components/upload.md +14 -0
  93. package/dist/md/components/watermark.md +14 -0
  94. package/dist/md/docs/brand.md +41 -0
  95. package/dist/md/pages/blog-layout.md +19 -0
  96. package/dist/md/pages/docs-shell.md +23 -0
  97. package/dist/md/theme/blue-dark.md +126 -0
  98. package/dist/md/theme/blue-light.md +128 -0
  99. package/dist/md/theme/green-dark.md +126 -0
  100. package/dist/md/theme/green-light.md +128 -0
  101. package/package.json +48 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The demo contract (ticket 16 check invariant 2, ticket 12 §2): each example
3
+ * is one self-contained `.tsx` — default-exported component, importing only
4
+ * from `@nanisoft/prism-ui/*` and `react`, no relative imports. This module is
5
+ * the contract's single enforcement point: the generator reuses the import
6
+ * scan for `## Blocks` / `## Pages` cross-refs, the check reuses the validator.
7
+ */
8
+ export interface DemoViolation {
9
+ readonly file: string;
10
+ readonly reason: string;
11
+ }
12
+ /**
13
+ * Validate one demo's source against the self-contained contract. Returns the
14
+ * violations (empty = compliant): non-allowlisted or relative imports, and a
15
+ * missing default export.
16
+ */
17
+ export declare function validateDemoSource(source: string): DemoViolation[];
18
+ /**
19
+ * The prism-ui export names a demo imports (for `## Blocks` / `## Pages`
20
+ * cross-refs). Returns catalog names — the pre-alias original — and skips
21
+ * type-only specifiers, which reference supporting types, not items.
22
+ */
23
+ export declare function scanPrismImports(source: string): string[];
24
+ //# sourceMappingURL=demo-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-graph.d.ts","sourceRoot":"","sources":["../src/demo-graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAmBlE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAazD"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The demo contract (ticket 16 check invariant 2, ticket 12 §2): each example
3
+ * is one self-contained `.tsx` — default-exported component, importing only
4
+ * from `@nanisoft/prism-ui/*` and `react`, no relative imports. This module is
5
+ * the contract's single enforcement point: the generator reuses the import
6
+ * scan for `## Blocks` / `## Pages` cross-refs, the check reuses the validator.
7
+ */
8
+ /** Module specifiers a demo may import. Everything else fails the contract. */
9
+ const ALLOWED_IMPORTS = [/^@nanisoft\/prism-ui(\/[\w.-]+)*$/, /^react$/];
10
+ /**
11
+ * Validate one demo's source against the self-contained contract. Returns the
12
+ * violations (empty = compliant): non-allowlisted or relative imports, and a
13
+ * missing default export.
14
+ */
15
+ export function validateDemoSource(source) {
16
+ const violations = [];
17
+ const importPattern = /(?:^|\n)\s*import\s+(?:[\w*{},\s]+?\s+from\s+)?["']([^"']+)["']/g;
18
+ let match;
19
+ while ((match = importPattern.exec(source)) !== null) {
20
+ const specifier = match[1] ?? '';
21
+ if (ALLOWED_IMPORTS.some((pattern) => pattern.test(specifier)))
22
+ continue;
23
+ violations.push({
24
+ file: '',
25
+ reason: specifier.startsWith('.')
26
+ ? `relative import '${specifier}' — demos must be self-contained`
27
+ : `import from '${specifier}' — demos import only from '@nanisoft/prism-ui/*' and 'react'`,
28
+ });
29
+ }
30
+ if (!/export\s+default/.test(source)) {
31
+ violations.push({ file: '', reason: 'no default export — each demo default-exports its example component' });
32
+ }
33
+ return violations;
34
+ }
35
+ /**
36
+ * The prism-ui export names a demo imports (for `## Blocks` / `## Pages`
37
+ * cross-refs). Returns catalog names — the pre-alias original — and skips
38
+ * type-only specifiers, which reference supporting types, not items.
39
+ */
40
+ export function scanPrismImports(source) {
41
+ const names = new Set();
42
+ const importPattern = /(?:^|\n)\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+["']@nanisoft\/prism-ui[^"']*["']/g;
43
+ let match;
44
+ while ((match = importPattern.exec(source)) !== null) {
45
+ for (const raw of (match[1] ?? '').split(',')) {
46
+ const trimmed = raw.trim();
47
+ if (!trimmed || trimmed.startsWith('type '))
48
+ continue;
49
+ const name = trimmed.split(/\s+as\s+/)[0]?.trim();
50
+ if (name)
51
+ names.add(name);
52
+ }
53
+ }
54
+ return [...names].sort();
55
+ }
56
+ //# sourceMappingURL=demo-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-graph.js","sourceRoot":"","sources":["../src/demo-graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,+EAA+E;AAC/E,MAAM,eAAe,GAAG,CAAE,mCAAmC,EAAE,SAAS,CAAE,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,UAAU,GAAoB,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,kEAAkE,CAAC;IACzF,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAAE,SAAS;QACzE,UAAU,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,EAAE;YACR,MAAM,EACJ,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;gBACvB,CAAC,CAAC,oBAAoB,SAAS,kCAAkC;gBACjE,CAAC,CAAC,gBAAgB,SAAS,+DAA+D;SAC/F,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,qEAAqE,EAAE,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,aAAa,GAAG,yFAAyF,CAAC;IAChH,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,KAAK,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;gBAAE,SAAS;YACtD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;YAClD,IAAI,IAAI;gBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The one props extractor (tickets 12/16): reads prism-ui's built `.d.ts`
3
+ * surface — TSDoc preserved — and returns the Prism-added props. Homed here
4
+ * and exported (`@nanisoft/prism-llms/extractor`) for the site's API tables;
5
+ * one extractor, two consumers. Runs after `^build`, so it reads declarations,
6
+ * never TS source.
7
+ *
8
+ * Deliberately compiler-API-free: TypeScript 7 (this repo's compiler) no
9
+ * longer ships the JS compiler API, and ADR-0003 already accepts cosmetic
10
+ * fidelity risk on gnarly unions. This is a small structural scanner for the
11
+ * declaration shape prism-ui emits — `export interface XProps [extends Y]`
12
+ * with JSDoc-carried descriptions. Pass-through re-exports never match, and
13
+ * that absence IS the Extends seam (ADR-0004): no extracted props means the
14
+ * item is "antd X, unchanged".
15
+ */
16
+ export interface ExtractedProp {
17
+ readonly name: string;
18
+ /** Type text as written, whitespace-normalised, comments stripped. */
19
+ readonly typeText: string;
20
+ /** Leading JSDoc text (the prop description). */
21
+ readonly description?: string;
22
+ readonly required: boolean;
23
+ /** `@defaultValue` tag text, when present. */
24
+ readonly defaultValue?: string;
25
+ }
26
+ export interface ExtractedInterface {
27
+ readonly typeName: string;
28
+ /** The type this interface extends, when declared (e.g. `TitleProps`). */
29
+ readonly extendsType?: string;
30
+ readonly props: readonly ExtractedProp[];
31
+ }
32
+ /**
33
+ * Extract every exported `*Props` interface from a `.d.ts` source, in source
34
+ * order. Returns an empty array for re-export-only files (pass-throughs).
35
+ */
36
+ export declare function extractProps(source: string): ExtractedInterface[];
37
+ //# sourceMappingURL=extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../src/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAgBjE"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * The one props extractor (tickets 12/16): reads prism-ui's built `.d.ts`
3
+ * surface — TSDoc preserved — and returns the Prism-added props. Homed here
4
+ * and exported (`@nanisoft/prism-llms/extractor`) for the site's API tables;
5
+ * one extractor, two consumers. Runs after `^build`, so it reads declarations,
6
+ * never TS source.
7
+ *
8
+ * Deliberately compiler-API-free: TypeScript 7 (this repo's compiler) no
9
+ * longer ships the JS compiler API, and ADR-0003 already accepts cosmetic
10
+ * fidelity risk on gnarly unions. This is a small structural scanner for the
11
+ * declaration shape prism-ui emits — `export interface XProps [extends Y]`
12
+ * with JSDoc-carried descriptions. Pass-through re-exports never match, and
13
+ * that absence IS the Extends seam (ADR-0004): no extracted props means the
14
+ * item is "antd X, unchanged".
15
+ */
16
+ /**
17
+ * Extract every exported `*Props` interface from a `.d.ts` source, in source
18
+ * order. Returns an empty array for re-export-only files (pass-throughs).
19
+ */
20
+ export function extractProps(source) {
21
+ const results = [];
22
+ const interfacePattern = /export\s+interface\s+(\w+)(?:\s+extends\s+([\w.]+))?\s*\{/g;
23
+ let match;
24
+ while ((match = interfacePattern.exec(source)) !== null) {
25
+ if (!(match[1] ?? '').endsWith('Props'))
26
+ continue; // supporting types (DocsNavEntry, BlogFrontmatter) are not props
27
+ const openBrace = interfacePattern.lastIndex - 1;
28
+ const body = readBalancedBody(source, openBrace);
29
+ if (body === undefined)
30
+ continue; // unbalanced — skip rather than guess
31
+ results.push({
32
+ typeName: match[1] ?? '',
33
+ extendsType: match[2],
34
+ props: parseProps(body),
35
+ });
36
+ }
37
+ return results;
38
+ }
39
+ /** The `{…}` body of the declaration whose brace sits at `openBrace`, or undefined when unbalanced. */
40
+ function readBalancedBody(source, openBrace) {
41
+ let depth = 0;
42
+ let i = openBrace;
43
+ while (i < source.length) {
44
+ const ch = source[i];
45
+ if (ch === '/' && source[i + 1] === '*') {
46
+ i = source.indexOf('*/', i + 2);
47
+ if (i === -1)
48
+ return undefined;
49
+ i += 2;
50
+ continue;
51
+ }
52
+ if (ch === '/' && source[i + 1] === '/') {
53
+ i = source.indexOf('\n', i);
54
+ if (i === -1)
55
+ return undefined;
56
+ continue;
57
+ }
58
+ if (ch === '"' || ch === "'" || ch === '`') {
59
+ i = skipString(source, i, ch);
60
+ if (i === -1)
61
+ return undefined;
62
+ continue;
63
+ }
64
+ if (ch === '{')
65
+ depth += 1;
66
+ if (ch === '}') {
67
+ depth -= 1;
68
+ if (depth === 0)
69
+ return source.slice(openBrace + 1, i);
70
+ }
71
+ i += 1;
72
+ }
73
+ return undefined;
74
+ }
75
+ function skipString(source, start, quote) {
76
+ let i = start + 1;
77
+ while (i < source.length) {
78
+ const ch = source[i];
79
+ if (ch === '\\') {
80
+ i += 2;
81
+ continue;
82
+ }
83
+ if (ch === quote)
84
+ return i + 1;
85
+ i += 1;
86
+ }
87
+ return -1;
88
+ }
89
+ /** Parse property signatures out of an interface body. Non-signature members (methods, indexers) are skipped. */
90
+ function parseProps(body) {
91
+ const props = [];
92
+ let i = 0;
93
+ let pendingDocs;
94
+ while (i < body.length) {
95
+ const trivia = skipTrivia(body, i);
96
+ i = trivia.next;
97
+ pendingDocs = trivia.jsDoc ?? pendingDocs;
98
+ if (i >= body.length)
99
+ break;
100
+ const nameMatch = /^([\w$]+)(\?)?\s*:/.exec(body.slice(i));
101
+ if (!nameMatch) {
102
+ // Not a property signature (call/construct/index signature, stray token) —
103
+ // skip to the next statement boundary at depth 0.
104
+ const boundary = nextTopLevelBoundary(body, i);
105
+ if (boundary === -1)
106
+ break;
107
+ pendingDocs = undefined;
108
+ i = boundary;
109
+ continue;
110
+ }
111
+ const typeStart = i + nameMatch[0].length;
112
+ const typeEnd = nextTopLevelBoundary(body, typeStart);
113
+ const rawType = typeEnd === -1 ? body.slice(typeStart) : body.slice(typeStart, typeEnd);
114
+ props.push({
115
+ name: nameMatch[1] ?? '',
116
+ typeText: normalizeType(rawType),
117
+ description: pendingDocs?.description,
118
+ defaultValue: pendingDocs?.defaultValue,
119
+ required: !nameMatch[2],
120
+ });
121
+ pendingDocs = undefined;
122
+ if (typeEnd === -1)
123
+ break;
124
+ i = typeEnd + 1;
125
+ }
126
+ return props;
127
+ }
128
+ /**
129
+ * Advance past whitespace/comments. `/**` comments are captured as JSDoc
130
+ * (description + `@defaultValue`), merged across consecutive blocks.
131
+ */
132
+ function skipTrivia(source, start) {
133
+ let i = start;
134
+ let jsDoc;
135
+ while (i < source.length) {
136
+ const ch = source[i] ?? '';
137
+ if (/\s/.test(ch)) {
138
+ i += 1;
139
+ continue;
140
+ }
141
+ if (ch === '/' && source[i + 1] === '*' && source[i + 2] === '*') {
142
+ const close = source.indexOf('*/', i + 3);
143
+ if (close === -1)
144
+ return { next: source.length };
145
+ // Consecutive JSDoc blocks merge — a description and a @defaultValue may
146
+ // live in separate blocks (tsc emits one, hand-written d.ts may not).
147
+ const parsed = readJsDoc(source.slice(i + 3, close));
148
+ if (parsed) {
149
+ jsDoc = {
150
+ description: jsDoc?.description ?? parsed.description,
151
+ defaultValue: jsDoc?.defaultValue ?? parsed.defaultValue,
152
+ };
153
+ }
154
+ i = close + 2;
155
+ continue;
156
+ }
157
+ if (ch === '/' && source[i + 1] === '*') {
158
+ const close = source.indexOf('*/', i + 2);
159
+ if (close === -1)
160
+ return { next: source.length };
161
+ i = close + 2;
162
+ continue;
163
+ }
164
+ if (ch === '/' && source[i + 1] === '/') {
165
+ const close = source.indexOf('\n', i);
166
+ if (close === -1)
167
+ return { next: source.length };
168
+ i = close;
169
+ continue;
170
+ }
171
+ return { next: i, jsDoc };
172
+ }
173
+ return { next: i, jsDoc };
174
+ }
175
+ function readJsDoc(text) {
176
+ const lines = text
177
+ .split('\n')
178
+ .map((line) => line.replace(/^\s*\*/, '').trim());
179
+ const description = [];
180
+ let defaultValue;
181
+ for (const line of lines) {
182
+ if (!line) {
183
+ if (description.length > 0)
184
+ description.push('');
185
+ continue;
186
+ }
187
+ const tag = /^@(\w+)\s*(.*)$/.exec(line);
188
+ if (tag) {
189
+ if (tag[1] === 'defaultValue')
190
+ defaultValue = tag[2] || undefined;
191
+ continue; // other tags (@example, @internal, …) stay out of the docs
192
+ }
193
+ description.push(line);
194
+ }
195
+ const joined = description.join(' ').trim();
196
+ if (!joined && !defaultValue)
197
+ return undefined;
198
+ return { description: joined || undefined, defaultValue };
199
+ }
200
+ /** Index of the next `;` or `,` at bracket depth 0 (starting at `from`), or -1. */
201
+ function nextTopLevelBoundary(source, from) {
202
+ let depth = 0;
203
+ let i = from;
204
+ while (i < source.length) {
205
+ const ch = source[i];
206
+ if (ch === '/' && source[i + 1] === '*') {
207
+ const close = source.indexOf('*/', i + 2);
208
+ if (close === -1)
209
+ return -1;
210
+ i = close + 2;
211
+ continue;
212
+ }
213
+ if (ch === '/' && source[i + 1] === '/') {
214
+ const close = source.indexOf('\n', i);
215
+ if (close === -1)
216
+ return -1;
217
+ i = close;
218
+ continue;
219
+ }
220
+ if (ch === '"' || ch === "'" || ch === '`') {
221
+ i = skipString(source, i, ch);
222
+ if (i === -1)
223
+ return -1;
224
+ continue;
225
+ }
226
+ if (ch === '(' || ch === '[' || ch === '{' || ch === '<')
227
+ depth += 1;
228
+ if (ch === ')' || ch === ']' || ch === '}' || ch === '>')
229
+ depth -= 1;
230
+ if (depth === 0 && (ch === ';' || ch === ','))
231
+ return i;
232
+ i += 1;
233
+ }
234
+ return -1;
235
+ }
236
+ /** Collapse comments and newlines to single spaces — readable, verbatim type text. */
237
+ function normalizeType(raw) {
238
+ return raw
239
+ .replace(/\/\*[\s\S]*?\*\//g, ' ')
240
+ .replace(/\s+/g, ' ')
241
+ .trim();
242
+ }
243
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1 @@
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AC,CAAC;QACxD,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,sFAAsF;AACtF,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG;SACP,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC;SACjC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * prism-llms public surface. The root stays compiler-free (the extractor sits
3
+ * behind `./extractor`); what ships here is the Markdown lane every consumer
4
+ * of the corpus shares — the site's stub/API tooling imports these helpers so
5
+ * it renders exactly what the generator emits.
6
+ */
7
+ export { parseMdx, fence, renderComponentDemos, stripMdxMechanics, renderTable, renderPropsSection, type DocMeta, type ParsedMdx, } from './markdown.js';
8
+ export type { ExtractedInterface, ExtractedProp } from './extractor.js';
9
+ export { scanPrismImports, validateDemoSource, type DemoViolation } from './demo-graph.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,KAAK,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,KAAK,OAAO,EACZ,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * prism-llms public surface. The root stays compiler-free (the extractor sits
3
+ * behind `./extractor`); what ships here is the Markdown lane every consumer
4
+ * of the corpus shares — the site's stub/API tooling imports these helpers so
5
+ * it renders exactly what the generator emits.
6
+ */
7
+ export { parseMdx, fence, renderComponentDemos, stripMdxMechanics, renderTable, renderPropsSection, } from './markdown.js';
8
+ export { scanPrismImports, validateDemoSource } from './demo-graph.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,KAAK,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,GAGnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAsB,MAAM,iBAAiB,CAAC"}