@refrakt-md/cli 0.4.0 → 0.5.1
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/bin.js +499 -9
- package/dist/bin.js.map +1 -1
- package/dist/commands/contracts.d.ts +6 -0
- package/dist/commands/contracts.d.ts.map +1 -0
- package/dist/commands/contracts.js +41 -0
- package/dist/commands/contracts.js.map +1 -0
- package/dist/commands/edit.d.ts +8 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +100 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/extract.d.ts +10 -0
- package/dist/commands/extract.d.ts.map +1 -0
- package/dist/commands/extract.js +158 -0
- package/dist/commands/extract.js.map +1 -0
- package/dist/commands/inspect.d.ts +33 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +269 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/scaffold-css.d.ts +6 -0
- package/dist/commands/scaffold-css.d.ts.map +1 -0
- package/dist/commands/scaffold-css.js +113 -0
- package/dist/commands/scaffold-css.js.map +1 -0
- package/dist/commands/theme.d.ts +10 -0
- package/dist/commands/theme.d.ts.map +1 -0
- package/dist/commands/theme.js +160 -0
- package/dist/commands/theme.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +70 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/write.d.ts +7 -0
- package/dist/commands/write.d.ts.map +1 -1
- package/dist/commands/write.js +66 -10
- package/dist/commands/write.js.map +1 -1
- package/dist/config-file.d.ts +15 -0
- package/dist/config-file.d.ts.map +1 -0
- package/dist/config-file.js +47 -0
- package/dist/config-file.js.map +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -2
- package/dist/config.js.map +1 -1
- package/dist/extractors/index.d.ts +3 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/extractors/index.js +15 -0
- package/dist/extractors/index.js.map +1 -0
- package/dist/extractors/python.d.ts +6 -0
- package/dist/extractors/python.d.ts.map +1 -0
- package/dist/extractors/python.js +8 -0
- package/dist/extractors/python.js.map +1 -0
- package/dist/extractors/types.d.ts +55 -0
- package/dist/extractors/types.d.ts.map +1 -0
- package/dist/extractors/types.js +2 -0
- package/dist/extractors/types.js.map +1 -0
- package/dist/extractors/typescript.d.ts +28 -0
- package/dist/extractors/typescript.d.ts.map +1 -0
- package/dist/extractors/typescript.js +566 -0
- package/dist/extractors/typescript.js.map +1 -0
- package/dist/lib/css-audit.d.ts +23 -0
- package/dist/lib/css-audit.d.ts.map +1 -0
- package/dist/lib/css-audit.js +99 -0
- package/dist/lib/css-audit.js.map +1 -0
- package/dist/lib/css-resolve.d.ts +20 -0
- package/dist/lib/css-resolve.d.ts.map +1 -0
- package/dist/lib/css-resolve.js +57 -0
- package/dist/lib/css-resolve.js.map +1 -0
- package/dist/lib/fixtures.d.ts +10 -0
- package/dist/lib/fixtures.d.ts.map +1 -0
- package/dist/lib/fixtures.js +356 -0
- package/dist/lib/fixtures.js.map +1 -0
- package/dist/lib/format.d.ts +35 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +215 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/layout-generator.d.ts +8 -0
- package/dist/lib/layout-generator.d.ts.map +1 -0
- package/dist/lib/layout-generator.js +22 -0
- package/dist/lib/layout-generator.js.map +1 -0
- package/dist/lib/symbol-generator.d.ts +14 -0
- package/dist/lib/symbol-generator.d.ts.map +1 -0
- package/dist/lib/symbol-generator.js +202 -0
- package/dist/lib/symbol-generator.js.map +1 -0
- package/dist/lib/variants.d.ts +17 -0
- package/dist/lib/variants.d.ts.map +1 -0
- package/dist/lib/variants.js +32 -0
- package/dist/lib/variants.js.map +1 -0
- package/package.json +9 -3
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
const DIM = '\x1b[2m';
|
|
2
|
+
const BOLD = '\x1b[1m';
|
|
3
|
+
const CYAN = '\x1b[36m';
|
|
4
|
+
const GREEN = '\x1b[32m';
|
|
5
|
+
const YELLOW = '\x1b[33m';
|
|
6
|
+
const RED = '\x1b[31m';
|
|
7
|
+
const RESET = '\x1b[0m';
|
|
8
|
+
/** Format the "Config Applied" section showing what the identity transform does */
|
|
9
|
+
export function formatConfig(runeTypeof, config) {
|
|
10
|
+
const runeConfig = config.runes[runeTypeof];
|
|
11
|
+
if (!runeConfig) {
|
|
12
|
+
return ` ${DIM}No config found for ${runeTypeof}${RESET}`;
|
|
13
|
+
}
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push(` ${DIM}block:${RESET} ${runeConfig.block}`);
|
|
16
|
+
// Modifiers
|
|
17
|
+
if (runeConfig.modifiers && Object.keys(runeConfig.modifiers).length > 0) {
|
|
18
|
+
const mods = Object.entries(runeConfig.modifiers)
|
|
19
|
+
.map(([name, mod]) => {
|
|
20
|
+
const def = mod.default ? ` (default: ${mod.default})` : '';
|
|
21
|
+
return `${name} from ${mod.source}${def}`;
|
|
22
|
+
})
|
|
23
|
+
.join(', ');
|
|
24
|
+
lines.push(` ${DIM}modifiers:${RESET} ${mods}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
lines.push(` ${DIM}modifiers:${RESET} ${DIM}none${RESET}`);
|
|
28
|
+
}
|
|
29
|
+
// Structure
|
|
30
|
+
if (runeConfig.structure && Object.keys(runeConfig.structure).length > 0) {
|
|
31
|
+
const structs = Object.entries(runeConfig.structure)
|
|
32
|
+
.map(([name, entry]) => {
|
|
33
|
+
const children = entry.children
|
|
34
|
+
? entry.children.map(c => typeof c === 'string' ? c : (c.ref ?? '?')).join(' + ')
|
|
35
|
+
: name;
|
|
36
|
+
const pos = entry.before ? 'before' : 'after';
|
|
37
|
+
return `${name} → ${children} (${pos})`;
|
|
38
|
+
})
|
|
39
|
+
.join(', ');
|
|
40
|
+
lines.push(` ${DIM}structure:${RESET} ${structs}`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
lines.push(` ${DIM}structure:${RESET} ${DIM}none${RESET}`);
|
|
44
|
+
}
|
|
45
|
+
// Content wrapper
|
|
46
|
+
if (runeConfig.contentWrapper) {
|
|
47
|
+
lines.push(` ${DIM}contentWrapper:${RESET} ${runeConfig.contentWrapper.tag}[ref=${runeConfig.contentWrapper.ref}]`);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
lines.push(` ${DIM}contentWrapper:${RESET} ${DIM}none${RESET}`);
|
|
51
|
+
}
|
|
52
|
+
// Context modifiers
|
|
53
|
+
if (runeConfig.contextModifiers && Object.keys(runeConfig.contextModifiers).length > 0) {
|
|
54
|
+
const ctx = Object.entries(runeConfig.contextModifiers)
|
|
55
|
+
.map(([parent, suffix]) => `${parent} → ${suffix}`)
|
|
56
|
+
.join(', ');
|
|
57
|
+
lines.push(` ${DIM}contextModifiers:${RESET} ${ctx}`);
|
|
58
|
+
}
|
|
59
|
+
// Root attributes
|
|
60
|
+
if (runeConfig.rootAttributes && Object.keys(runeConfig.rootAttributes).length > 0) {
|
|
61
|
+
const attrs = Object.entries(runeConfig.rootAttributes)
|
|
62
|
+
.map(([k, v]) => `${k}="${v}"`)
|
|
63
|
+
.join(', ');
|
|
64
|
+
lines.push(` ${DIM}rootAttributes:${RESET} ${attrs}`);
|
|
65
|
+
}
|
|
66
|
+
// Static modifiers
|
|
67
|
+
if (runeConfig.staticModifiers && runeConfig.staticModifiers.length > 0) {
|
|
68
|
+
lines.push(` ${DIM}staticModifiers:${RESET} ${runeConfig.staticModifiers.join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
// Styles mapping
|
|
71
|
+
if (runeConfig.styles && Object.keys(runeConfig.styles).length > 0) {
|
|
72
|
+
const styles = Object.entries(runeConfig.styles)
|
|
73
|
+
.map(([mod, prop]) => `${mod} → ${prop}`)
|
|
74
|
+
.join(', ');
|
|
75
|
+
lines.push(` ${DIM}styles:${RESET} ${styles}`);
|
|
76
|
+
}
|
|
77
|
+
return lines.join('\n');
|
|
78
|
+
}
|
|
79
|
+
/** Format the selector list with visual grouping */
|
|
80
|
+
export function formatSelectors(selectors) {
|
|
81
|
+
return selectors.map(s => {
|
|
82
|
+
if (s.startsWith('['))
|
|
83
|
+
return ` ${YELLOW}${s}${RESET}`;
|
|
84
|
+
if (s.includes('__'))
|
|
85
|
+
return ` ${CYAN}${s}${RESET}`;
|
|
86
|
+
if (s.includes('--'))
|
|
87
|
+
return ` ${GREEN}${s}${RESET}`;
|
|
88
|
+
return ` ${BOLD}${s}${RESET}`;
|
|
89
|
+
}).join('\n');
|
|
90
|
+
}
|
|
91
|
+
/** Format a section heading */
|
|
92
|
+
export function heading(text) {
|
|
93
|
+
return `\n${BOLD}${text}${RESET}`;
|
|
94
|
+
}
|
|
95
|
+
/** Format the input Markdoc source (indented) */
|
|
96
|
+
export function formatInput(source) {
|
|
97
|
+
return source.split('\n').map(line => ` ${DIM}${line}${RESET}`).join('\n');
|
|
98
|
+
}
|
|
99
|
+
/** Format the HTML output (indented, already pretty-printed) */
|
|
100
|
+
export function formatHtml(html) {
|
|
101
|
+
return html.split('\n').map(line => ` ${line}`).join('\n');
|
|
102
|
+
}
|
|
103
|
+
/** Format the rune list for --list mode */
|
|
104
|
+
export function formatRuneList(runes) {
|
|
105
|
+
const lines = [];
|
|
106
|
+
for (const rune of runes) {
|
|
107
|
+
const aliasStr = rune.aliases.length > 0 ? ` ${DIM}(${rune.aliases.join(', ')})${RESET}` : '';
|
|
108
|
+
lines.push(` ${BOLD}${rune.name}${RESET}${aliasStr}`);
|
|
109
|
+
if (rune.description) {
|
|
110
|
+
lines.push(` ${rune.description}`);
|
|
111
|
+
}
|
|
112
|
+
if (Object.keys(rune.variants).length > 0) {
|
|
113
|
+
for (const [attr, values] of Object.entries(rune.variants)) {
|
|
114
|
+
lines.push(` ${DIM}${attr}:${RESET} ${values.join(', ')}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
lines.push('');
|
|
118
|
+
}
|
|
119
|
+
return lines.join('\n');
|
|
120
|
+
}
|
|
121
|
+
/** Build JSON output matching the spec format */
|
|
122
|
+
export function buildJsonOutput(opts) {
|
|
123
|
+
return {
|
|
124
|
+
rune: opts.rune,
|
|
125
|
+
theme: opts.theme,
|
|
126
|
+
input: opts.input,
|
|
127
|
+
config: opts.config ? {
|
|
128
|
+
block: opts.config.block,
|
|
129
|
+
modifiers: opts.config.modifiers ?? {},
|
|
130
|
+
structure: opts.config.structure ?? {},
|
|
131
|
+
contentWrapper: opts.config.contentWrapper ?? null,
|
|
132
|
+
contextModifiers: opts.config.contextModifiers ?? {},
|
|
133
|
+
rootAttributes: opts.config.rootAttributes ?? {},
|
|
134
|
+
staticModifiers: opts.config.staticModifiers ?? [],
|
|
135
|
+
styles: opts.config.styles ?? {},
|
|
136
|
+
} : null,
|
|
137
|
+
html: opts.html,
|
|
138
|
+
selectors: opts.selectors,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Format a single-rune audit result */
|
|
142
|
+
export function formatAuditResult(result, theme) {
|
|
143
|
+
const lines = [];
|
|
144
|
+
lines.push(heading(`CSS Coverage: ${result.rune} (${theme})`));
|
|
145
|
+
lines.push('');
|
|
146
|
+
// Find the longest selector for alignment
|
|
147
|
+
const selectors = Object.keys(result.selectors);
|
|
148
|
+
const maxLen = Math.max(...selectors.map(s => s.length));
|
|
149
|
+
for (const [sel, info] of Object.entries(result.selectors)) {
|
|
150
|
+
const padded = sel.padEnd(maxLen + 2);
|
|
151
|
+
if (info.styled) {
|
|
152
|
+
lines.push(` ${GREEN}\u2713${RESET} ${padded} ${DIM}\u2192 ${info.file}:${info.line}${RESET}`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
lines.push(` ${RED}\u2717${RESET} ${padded} ${RED}NOT STYLED${RESET}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
lines.push('');
|
|
159
|
+
const pct = result.total > 0 ? Math.round((result.styled / result.total) * 100) : 0;
|
|
160
|
+
const statusIcon = result.status === 'complete' ? `${GREEN}\u2713 complete${RESET}`
|
|
161
|
+
: result.status === 'partial' ? `${YELLOW}\u26a0 ${result.total - result.styled} unstyled${RESET}`
|
|
162
|
+
: `${RED}\u2717 not started${RESET}`;
|
|
163
|
+
lines.push(` Coverage: ${result.styled}/${result.total} selectors (${pct}%) ${statusIcon}`);
|
|
164
|
+
return lines.join('\n');
|
|
165
|
+
}
|
|
166
|
+
/** Format the full-theme audit summary */
|
|
167
|
+
export function formatAuditSummary(results, theme) {
|
|
168
|
+
const lines = [];
|
|
169
|
+
lines.push(heading(`Theme Audit: ${theme}`));
|
|
170
|
+
lines.push('');
|
|
171
|
+
// Find the longest rune name for alignment
|
|
172
|
+
const maxNameLen = Math.max(...results.map(r => r.rune.length));
|
|
173
|
+
for (const r of results) {
|
|
174
|
+
const name = r.rune.padEnd(maxNameLen + 2);
|
|
175
|
+
const fraction = `${r.styled}/${r.total}`.padStart(7);
|
|
176
|
+
const statusIcon = r.status === 'complete' ? `${GREEN}\u2713 complete${RESET}`
|
|
177
|
+
: r.status === 'partial' ? `${YELLOW}\u26a0 ${r.total - r.styled} unstyled${RESET}`
|
|
178
|
+
: `${RED}\u2717 not started${RESET}`;
|
|
179
|
+
lines.push(` ${name} ${fraction} selectors ${statusIcon}`);
|
|
180
|
+
}
|
|
181
|
+
// Summary
|
|
182
|
+
const totalSelectors = results.reduce((sum, r) => sum + r.total, 0);
|
|
183
|
+
const totalStyled = results.reduce((sum, r) => sum + r.styled, 0);
|
|
184
|
+
const complete = results.filter(r => r.status === 'complete').length;
|
|
185
|
+
const partial = results.filter(r => r.status === 'partial').length;
|
|
186
|
+
const notStarted = results.filter(r => r.status === 'not-started').length;
|
|
187
|
+
const pct = totalSelectors > 0 ? Math.round((totalStyled / totalSelectors) * 100) : 0;
|
|
188
|
+
lines.push('');
|
|
189
|
+
lines.push(` ${DIM}${'─'.repeat(40)}${RESET}`);
|
|
190
|
+
lines.push(` Overall: ${totalStyled}/${totalSelectors} selectors styled (${pct}%)`);
|
|
191
|
+
lines.push(` Complete: ${complete} runes`);
|
|
192
|
+
if (partial > 0)
|
|
193
|
+
lines.push(` Partial: ${partial} runes`);
|
|
194
|
+
if (notStarted > 0)
|
|
195
|
+
lines.push(` Not started: ${notStarted} runes`);
|
|
196
|
+
return lines.join('\n');
|
|
197
|
+
}
|
|
198
|
+
/** Build JSON output for an audit */
|
|
199
|
+
export function buildAuditJson(results, theme) {
|
|
200
|
+
const totalSelectors = results.reduce((sum, r) => sum + r.total, 0);
|
|
201
|
+
const totalStyled = results.reduce((sum, r) => sum + r.styled, 0);
|
|
202
|
+
return {
|
|
203
|
+
theme,
|
|
204
|
+
totalSelectors,
|
|
205
|
+
styledSelectors: totalStyled,
|
|
206
|
+
coverage: totalSelectors > 0 ? Math.round((totalStyled / totalSelectors) * 100) / 100 : 0,
|
|
207
|
+
runes: Object.fromEntries(results.map(r => [r.rune, {
|
|
208
|
+
total: r.total,
|
|
209
|
+
styled: r.styled,
|
|
210
|
+
status: r.status,
|
|
211
|
+
selectors: r.selectors,
|
|
212
|
+
}])),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,IAAI,GAAG,SAAS,CAAC;AACvB,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,MAAmB;IACnE,MAAM,UAAU,GAAG,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AAC,cAAc,OAAO,QAAQ,CAAC,CAAC;IAC3D,IAAI,UAAU,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,QAAQ,CAAC,CAAC;IAErE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,cAAc,CAAC,OAAsB,EAAE,KAAa;IACnE,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAElE,OAAO;QACN,KAAK;QACL,cAAc;QACd,eAAe,EAAE,WAAW;QAC5B,QAAQ,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACzF,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBACnD,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,SAAS,EAAE,CAAC,CAAC,SAAS;aACtB,CAAC,CAAC,CAAC;KACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SymbolDoc } from '../extractors/types.js';
|
|
2
|
+
export interface LayoutOptions {
|
|
3
|
+
/** Title for the nav section (default: "API Reference") */
|
|
4
|
+
title?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Generate a _layout.md with {% nav %} for API reference navigation */
|
|
7
|
+
export declare function generateLayoutMarkdown(symbols: SymbolDoc[], options?: LayoutOptions): string;
|
|
8
|
+
//# sourceMappingURL=layout-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-generator.d.ts","sourceRoot":"","sources":["../../src/lib/layout-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,MAAM,WAAW,aAAa;IAC7B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,SAAS,EAAE,EACpB,OAAO,CAAC,EAAE,aAAa,GACrB,MAAM,CAsBR"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { toSlug } from './symbol-generator.js';
|
|
2
|
+
/** Generate a _layout.md with {% nav %} for API reference navigation */
|
|
3
|
+
export function generateLayoutMarkdown(symbols, options) {
|
|
4
|
+
const title = options?.title ?? 'API Reference';
|
|
5
|
+
const lines = [];
|
|
6
|
+
lines.push('{% layout %}');
|
|
7
|
+
lines.push('{% region name="nav" %}');
|
|
8
|
+
lines.push('{% nav %}');
|
|
9
|
+
lines.push('');
|
|
10
|
+
lines.push(`## ${title}`);
|
|
11
|
+
lines.push('');
|
|
12
|
+
for (const doc of symbols) {
|
|
13
|
+
lines.push(`- ${toSlug(doc.name)}`);
|
|
14
|
+
}
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push('{% /nav %}');
|
|
17
|
+
lines.push('{% /region %}');
|
|
18
|
+
lines.push('{% /layout %}');
|
|
19
|
+
lines.push('');
|
|
20
|
+
return lines.join('\n');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=layout-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-generator.js","sourceRoot":"","sources":["../../src/lib/layout-generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAO/C,wEAAwE;AACxE,MAAM,UAAU,sBAAsB,CACrC,OAAoB,EACpB,OAAuB;IAEvB,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,eAAe,CAAC;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;IAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SymbolDoc } from '../extractors/types.js';
|
|
2
|
+
export interface GeneratorOptions {
|
|
3
|
+
/** Base heading level for the symbol name (default: 2 = ##) */
|
|
4
|
+
headingLevel?: number;
|
|
5
|
+
/** Whether to include frontmatter (default: true) */
|
|
6
|
+
frontmatter?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Convert camelCase/PascalCase to kebab-case for file slugs */
|
|
9
|
+
export declare function toSlug(name: string): string;
|
|
10
|
+
/** Generate a single {% symbol %} Markdown block for one SymbolDoc */
|
|
11
|
+
export declare function generateSymbolMarkdown(doc: SymbolDoc, options?: GeneratorOptions): string;
|
|
12
|
+
/** Generate a single file containing multiple symbols from the same source file */
|
|
13
|
+
export declare function generateMultiSymbolMarkdown(docs: SymbolDoc[], fileName: string): string;
|
|
14
|
+
//# sourceMappingURL=symbol-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-generator.d.ts","sourceRoot":"","sources":["../../src/lib/symbol-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAgD,MAAM,wBAAwB,CAAC;AAEtG,MAAM,WAAW,gBAAgB;IAChC,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAQD,gEAAgE;AAChE,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3C;AAoED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAmIzF;AAED,mFAAmF;AACnF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcvF"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const GROUP_KINDS = ['class', 'interface', 'module'];
|
|
2
|
+
function isGroupKind(kind) {
|
|
3
|
+
return GROUP_KINDS.includes(kind);
|
|
4
|
+
}
|
|
5
|
+
/** Convert camelCase/PascalCase to kebab-case for file slugs */
|
|
6
|
+
export function toSlug(name) {
|
|
7
|
+
return name
|
|
8
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
9
|
+
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
|
|
10
|
+
.toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
function escapeYaml(s) {
|
|
13
|
+
if (/[:"'{}\[\]#&*!|>%@`]/.test(s) || s.startsWith(' ') || s.endsWith(' ')) {
|
|
14
|
+
return `"${s.replace(/"/g, '\\"')}"`;
|
|
15
|
+
}
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
18
|
+
function heading(level, text) {
|
|
19
|
+
return `${'#'.repeat(level)} ${text}`;
|
|
20
|
+
}
|
|
21
|
+
function formatParameter(param) {
|
|
22
|
+
const optionalMark = param.optional ? ' *(optional)*' : '';
|
|
23
|
+
const defaultMark = param.defaultValue ? ` *Default: \`${param.defaultValue}\`*` : '';
|
|
24
|
+
const desc = param.description ? ` -- ${param.description}` : '';
|
|
25
|
+
return `- **${param.name}** \`${param.type}\`${optionalMark}${desc}${defaultMark}`;
|
|
26
|
+
}
|
|
27
|
+
function formatChildParameter(param) {
|
|
28
|
+
const optionalMark = param.optional ? ' *(optional)*' : '';
|
|
29
|
+
const defaultMark = param.defaultValue ? ` *Default: \`${param.defaultValue}\`*` : '';
|
|
30
|
+
const desc = param.description ? ` -- ${param.description}` : '';
|
|
31
|
+
return ` - **${param.name}** \`${param.type}\`${optionalMark}${desc}${defaultMark}`;
|
|
32
|
+
}
|
|
33
|
+
function writeMember(lines, member, memberLevel) {
|
|
34
|
+
lines.push(heading(memberLevel, member.name));
|
|
35
|
+
lines.push('');
|
|
36
|
+
if (member.description) {
|
|
37
|
+
lines.push(member.description);
|
|
38
|
+
lines.push('');
|
|
39
|
+
}
|
|
40
|
+
lines.push('```typescript');
|
|
41
|
+
lines.push(member.signature);
|
|
42
|
+
lines.push('```');
|
|
43
|
+
lines.push('');
|
|
44
|
+
if (member.parameters && member.parameters.length > 0) {
|
|
45
|
+
for (const param of member.parameters) {
|
|
46
|
+
lines.push(formatParameter(param));
|
|
47
|
+
if (param.children) {
|
|
48
|
+
for (const child of param.children) {
|
|
49
|
+
lines.push(formatChildParameter(child));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
lines.push('');
|
|
54
|
+
}
|
|
55
|
+
if (member.returns) {
|
|
56
|
+
const desc = member.returns.description ? ` -- ${member.returns.description}` : '';
|
|
57
|
+
lines.push(`> Returns \`${member.returns.type}\`${desc}`);
|
|
58
|
+
lines.push('');
|
|
59
|
+
}
|
|
60
|
+
if (member.throws) {
|
|
61
|
+
for (const t of member.throws) {
|
|
62
|
+
const desc = t.description ? ` ${t.description}` : '';
|
|
63
|
+
lines.push(`> Throws \`${t.type}\`${desc}`);
|
|
64
|
+
lines.push('');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Generate a single {% symbol %} Markdown block for one SymbolDoc */
|
|
69
|
+
export function generateSymbolMarkdown(doc, options) {
|
|
70
|
+
const level = options?.headingLevel ?? 2;
|
|
71
|
+
const lines = [];
|
|
72
|
+
// Frontmatter
|
|
73
|
+
if (options?.frontmatter !== false) {
|
|
74
|
+
lines.push('---');
|
|
75
|
+
lines.push(`title: ${escapeYaml(doc.name)}`);
|
|
76
|
+
const firstLine = doc.description.split('\n')[0].trim();
|
|
77
|
+
if (firstLine) {
|
|
78
|
+
lines.push(`description: ${escapeYaml(firstLine)}`);
|
|
79
|
+
}
|
|
80
|
+
lines.push('---');
|
|
81
|
+
lines.push('');
|
|
82
|
+
}
|
|
83
|
+
// Opening tag
|
|
84
|
+
const attrs = [`kind="${doc.kind}"`];
|
|
85
|
+
attrs.push(`lang="typescript"`);
|
|
86
|
+
if (doc.since)
|
|
87
|
+
attrs.push(`since="${doc.since}"`);
|
|
88
|
+
if (doc.deprecated)
|
|
89
|
+
attrs.push(`deprecated="${doc.deprecated}"`);
|
|
90
|
+
if (doc.source)
|
|
91
|
+
attrs.push(`source="${doc.source}"`);
|
|
92
|
+
if (level !== 2)
|
|
93
|
+
attrs.push(`headingLevel=${level}`);
|
|
94
|
+
lines.push(`{% symbol ${attrs.join(' ')} %}`);
|
|
95
|
+
lines.push('');
|
|
96
|
+
// Symbol name heading
|
|
97
|
+
lines.push(heading(level, doc.name));
|
|
98
|
+
lines.push('');
|
|
99
|
+
// For functions/enums/types: description before signature
|
|
100
|
+
// For classes/interfaces/modules: description after signature
|
|
101
|
+
if (!isGroupKind(doc.kind)) {
|
|
102
|
+
if (doc.description) {
|
|
103
|
+
lines.push(doc.description);
|
|
104
|
+
lines.push('');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Type signature
|
|
108
|
+
lines.push('```typescript');
|
|
109
|
+
lines.push(doc.signature);
|
|
110
|
+
lines.push('```');
|
|
111
|
+
lines.push('');
|
|
112
|
+
// For group kinds: description after signature
|
|
113
|
+
if (isGroupKind(doc.kind)) {
|
|
114
|
+
if (doc.description) {
|
|
115
|
+
lines.push(doc.description);
|
|
116
|
+
lines.push('');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Parameters (for function/enum kinds)
|
|
120
|
+
if (doc.parameters && doc.parameters.length > 0) {
|
|
121
|
+
for (const param of doc.parameters) {
|
|
122
|
+
lines.push(formatParameter(param));
|
|
123
|
+
if (param.children) {
|
|
124
|
+
for (const child of param.children) {
|
|
125
|
+
lines.push(formatChildParameter(child));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
lines.push('');
|
|
130
|
+
}
|
|
131
|
+
// Returns (as blockquote)
|
|
132
|
+
if (doc.returns) {
|
|
133
|
+
const desc = doc.returns.description ? ` -- ${doc.returns.description}` : '';
|
|
134
|
+
lines.push(`> Returns \`${doc.returns.type}\`${desc}`);
|
|
135
|
+
lines.push('');
|
|
136
|
+
}
|
|
137
|
+
// Throws (as blockquotes)
|
|
138
|
+
if (doc.throws) {
|
|
139
|
+
for (const t of doc.throws) {
|
|
140
|
+
const desc = t.description ? ` ${t.description}` : '';
|
|
141
|
+
lines.push(`> Throws \`${t.type}\`${desc}`);
|
|
142
|
+
lines.push('');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Groups (for class/interface/module kinds)
|
|
146
|
+
if (doc.groups) {
|
|
147
|
+
const groupLevel = level + 1;
|
|
148
|
+
const memberLevel = level + 2;
|
|
149
|
+
for (const group of doc.groups) {
|
|
150
|
+
// Special case: Constructor group has no group heading in the docs format
|
|
151
|
+
// Actually, looking at the docs, Constructor IS a group heading
|
|
152
|
+
lines.push(heading(groupLevel, group.label));
|
|
153
|
+
lines.push('');
|
|
154
|
+
if (group.members.length === 1 && group.label === 'Constructor') {
|
|
155
|
+
// Constructor is typically shown without a member sub-heading
|
|
156
|
+
const member = group.members[0];
|
|
157
|
+
if (member.description) {
|
|
158
|
+
lines.push(member.description);
|
|
159
|
+
lines.push('');
|
|
160
|
+
}
|
|
161
|
+
lines.push('```typescript');
|
|
162
|
+
lines.push(member.signature);
|
|
163
|
+
lines.push('```');
|
|
164
|
+
lines.push('');
|
|
165
|
+
if (member.parameters && member.parameters.length > 0) {
|
|
166
|
+
for (const param of member.parameters) {
|
|
167
|
+
lines.push(formatParameter(param));
|
|
168
|
+
if (param.children) {
|
|
169
|
+
for (const child of param.children) {
|
|
170
|
+
lines.push(formatChildParameter(child));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
lines.push('');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
for (const member of group.members) {
|
|
179
|
+
writeMember(lines, member, memberLevel);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Closing tag
|
|
185
|
+
lines.push('{% /symbol %}');
|
|
186
|
+
lines.push('');
|
|
187
|
+
return lines.join('\n');
|
|
188
|
+
}
|
|
189
|
+
/** Generate a single file containing multiple symbols from the same source file */
|
|
190
|
+
export function generateMultiSymbolMarkdown(docs, fileName) {
|
|
191
|
+
const lines = [];
|
|
192
|
+
lines.push('---');
|
|
193
|
+
lines.push(`title: ${escapeYaml(fileName)}`);
|
|
194
|
+
lines.push(`description: ${escapeYaml(`API reference for ${fileName}`)}`);
|
|
195
|
+
lines.push('---');
|
|
196
|
+
lines.push('');
|
|
197
|
+
for (const doc of docs) {
|
|
198
|
+
lines.push(generateSymbolMarkdown(doc, { frontmatter: false }));
|
|
199
|
+
}
|
|
200
|
+
return lines.join('\n');
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=symbol-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-generator.js","sourceRoot":"","sources":["../../src/lib/symbol-generator.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,GAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAEnE,SAAS,WAAW,CAAC,IAAgB;IACpC,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,MAAM,CAAC,IAAY;IAClC,OAAO,IAAI;SACT,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;SACxC,WAAW,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC5B,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5E,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,IAAY;IAC3C,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAA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,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Schema } from '@markdoc/markdoc';
|
|
2
|
+
/**
|
|
3
|
+
* Discover variant values for a rune's attributes from its Markdoc schema.
|
|
4
|
+
*
|
|
5
|
+
* Reads the `matches` array from each schema attribute to find enumerations.
|
|
6
|
+
* Returns a map of attribute name → array of valid values.
|
|
7
|
+
*/
|
|
8
|
+
export declare function discoverVariants(schema: Schema): Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if any flag value is the special "all" keyword requesting variant expansion.
|
|
11
|
+
* Returns the attribute name that should be expanded, or null.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findExpandedVariant(flags: Record<string, string>): {
|
|
14
|
+
attr: string;
|
|
15
|
+
values: string[];
|
|
16
|
+
} | null;
|
|
17
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYzE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAS5G"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover variant values for a rune's attributes from its Markdoc schema.
|
|
3
|
+
*
|
|
4
|
+
* Reads the `matches` array from each schema attribute to find enumerations.
|
|
5
|
+
* Returns a map of attribute name → array of valid values.
|
|
6
|
+
*/
|
|
7
|
+
export function discoverVariants(schema) {
|
|
8
|
+
const variants = {};
|
|
9
|
+
if (!schema.attributes)
|
|
10
|
+
return variants;
|
|
11
|
+
for (const [name, attr] of Object.entries(schema.attributes)) {
|
|
12
|
+
if (attr.matches && Array.isArray(attr.matches) && attr.matches.length > 0) {
|
|
13
|
+
variants[name] = attr.matches.map(String);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return variants;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if any flag value is the special "all" keyword requesting variant expansion.
|
|
20
|
+
* Returns the attribute name that should be expanded, or null.
|
|
21
|
+
*/
|
|
22
|
+
export function findExpandedVariant(flags) {
|
|
23
|
+
// This is called after variant discovery — we look for flags with value "all"
|
|
24
|
+
// The caller resolves the actual values from discoverVariants()
|
|
25
|
+
for (const [key, value] of Object.entries(flags)) {
|
|
26
|
+
if (value === 'all') {
|
|
27
|
+
return { attr: key, values: [] }; // values filled in by caller
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.js","sourceRoot":"","sources":["../../src/lib/variants.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC9C,MAAM,QAAQ,GAA6B,EAAE,CAAC;IAE9C,IAAI,CAAC,MAAM,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC;IAExC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,IAAI,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5E,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAChE,8EAA8E;IAC9E,gEAAgE;IAChE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,6BAA6B;QAChE,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/cli",
|
|
3
3
|
"description": "CLI tools for refrakt.md",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -24,7 +24,13 @@
|
|
|
24
24
|
"build": "tsc"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@refrakt-md/
|
|
27
|
+
"@markdoc/markdoc": "0.4.0",
|
|
28
|
+
"@refrakt-md/ai": "0.5.1",
|
|
29
|
+
"@refrakt-md/editor": "0.5.1",
|
|
30
|
+
"@refrakt-md/runes": "0.5.1",
|
|
31
|
+
"@refrakt-md/theme-base": "0.5.1",
|
|
32
|
+
"@refrakt-md/transform": "0.5.1",
|
|
33
|
+
"postcss": "^8.4.0",
|
|
34
|
+
"typescript": "^5.4.0"
|
|
29
35
|
}
|
|
30
36
|
}
|