bejamas 0.1.0 → 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.
@@ -0,0 +1,479 @@
1
+ import { createRequire } from "module";
2
+ import path, { dirname, extname, join, posix } from "path";
3
+ import fsExtra from "fs-extra";
4
+ import { z } from "zod";
5
+ import { cyan, green, red, yellow } from "kleur/colors";
6
+ import ora from "ora";
7
+ import { configSchema, rawConfigSchema } from "shadcn/schema";
8
+ import fg from "fast-glob";
9
+ import { createMatchPath, loadConfig } from "tsconfig-paths";
10
+ import { cosmiconfig } from "cosmiconfig";
11
+ import { existsSync } from "fs";
12
+ import { readdir } from "fs/promises";
13
+ import { Project, SyntaxKind } from "ts-morph";
14
+
15
+ //#region src/registry/constants.ts
16
+ const REGISTRY_URL = process.env.REGISTRY_URL ?? "http://localhost:4321/r";
17
+ const BASE_COLORS = [
18
+ {
19
+ name: "neutral",
20
+ label: "Neutral"
21
+ },
22
+ {
23
+ name: "gray",
24
+ label: "Gray"
25
+ },
26
+ {
27
+ name: "zinc",
28
+ label: "Zinc"
29
+ },
30
+ {
31
+ name: "stone",
32
+ label: "Stone"
33
+ },
34
+ {
35
+ name: "slate",
36
+ label: "Slate"
37
+ }
38
+ ];
39
+ const BUILTIN_REGISTRIES = { "@bejamas": `${REGISTRY_URL}/{name}.json` };
40
+
41
+ //#endregion
42
+ //#region src/utils/highlighter.ts
43
+ const highlighter = {
44
+ error: red,
45
+ warn: yellow,
46
+ info: cyan,
47
+ success: green
48
+ };
49
+
50
+ //#endregion
51
+ //#region src/utils/logger.ts
52
+ const logger = {
53
+ error(...args) {
54
+ console.log(highlighter.error(args.join(" ")));
55
+ },
56
+ warn(...args) {
57
+ console.log(highlighter.warn(args.join(" ")));
58
+ },
59
+ info(...args) {
60
+ console.log(highlighter.info(args.join(" ")));
61
+ },
62
+ success(...args) {
63
+ console.log(highlighter.success(args.join(" ")));
64
+ },
65
+ log(...args) {
66
+ console.log(args.join(" "));
67
+ },
68
+ break() {
69
+ console.log("");
70
+ }
71
+ };
72
+
73
+ //#endregion
74
+ //#region src/utils/spinner.ts
75
+ function spinner(text, options) {
76
+ return ora({
77
+ text,
78
+ isSilent: options?.silent
79
+ });
80
+ }
81
+
82
+ //#endregion
83
+ //#region src/utils/get-package-info.ts
84
+ function getPackageInfo(cwd = "", shouldThrow = true) {
85
+ const packageJsonPath = path.join(cwd, "package.json");
86
+ return fsExtra.readJSONSync(packageJsonPath, { throws: shouldThrow });
87
+ }
88
+
89
+ //#endregion
90
+ //#region src/utils/get-project-info.ts
91
+ const PROJECT_SHARED_IGNORE = [
92
+ "**/node_modules/**",
93
+ ".astro",
94
+ "public",
95
+ "dist",
96
+ "build"
97
+ ];
98
+ const TS_CONFIG_SCHEMA = z.object({ compilerOptions: z.object({ paths: z.record(z.string().or(z.array(z.string()))) }) });
99
+ async function getProjectInfo(cwd) {
100
+ const [configFiles, tailwindConfigFile, tailwindCssFile, tailwindVersion, aliasPrefix, packageJson] = await Promise.all([
101
+ fg.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*", {
102
+ cwd,
103
+ deep: 3,
104
+ ignore: PROJECT_SHARED_IGNORE
105
+ }),
106
+ getTailwindConfigFile(cwd),
107
+ getTailwindCssFile(cwd),
108
+ getTailwindVersion(cwd),
109
+ getTsConfigAliasPrefix(cwd),
110
+ getPackageInfo(cwd, false)
111
+ ]);
112
+ const type = {
113
+ isAstro: false,
114
+ tailwindConfigFile,
115
+ tailwindCssFile,
116
+ tailwindVersion,
117
+ aliasPrefix
118
+ };
119
+ if (configFiles.find((file) => file.startsWith("astro.config."))?.length) {
120
+ type.isAstro = true;
121
+ return type;
122
+ }
123
+ return type;
124
+ }
125
+ async function getTailwindVersion(cwd) {
126
+ const [packageInfo, config] = await Promise.all([getPackageInfo(cwd, false), getConfig(cwd)]);
127
+ if (config?.tailwind?.config === "") return "v4";
128
+ if (!packageInfo?.dependencies?.tailwindcss && !packageInfo?.devDependencies?.tailwindcss) return null;
129
+ if (/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(packageInfo?.dependencies?.tailwindcss || packageInfo?.devDependencies?.tailwindcss || "")) return "v3";
130
+ return "v4";
131
+ }
132
+ async function getTailwindCssFile(cwd) {
133
+ const [files, tailwindVersion] = await Promise.all([fg.glob(["**/*.css", "**/*.scss"], {
134
+ cwd,
135
+ deep: 5,
136
+ ignore: PROJECT_SHARED_IGNORE
137
+ }), getTailwindVersion(cwd)]);
138
+ if (!files.length) return null;
139
+ for (const file of files) {
140
+ const contents = await fsExtra.readFile(path.resolve(cwd, file), "utf8");
141
+ if (contents.includes(`@import "tailwindcss"`) || contents.includes(`@import 'tailwindcss'`) || contents.includes(`@tailwind base`)) return file;
142
+ }
143
+ return null;
144
+ }
145
+ async function getTailwindConfigFile(cwd) {
146
+ const files = await fg.glob("tailwind.config.*", {
147
+ cwd,
148
+ deep: 3,
149
+ ignore: PROJECT_SHARED_IGNORE
150
+ });
151
+ if (!files.length) return null;
152
+ return files[0];
153
+ }
154
+ async function getTsConfigAliasPrefix(cwd) {
155
+ const tsConfig = await loadConfig(cwd);
156
+ if (tsConfig?.resultType === "failed" || !Object.entries(tsConfig?.paths).length) return null;
157
+ for (const [alias, paths] of Object.entries(tsConfig.paths)) if (paths.includes("./*") || paths.includes("./src/*") || paths.includes("./app/*") || paths.includes("./resources/js/*")) return alias.replace(/\/\*$/, "") ?? null;
158
+ return Object.keys(tsConfig?.paths)?.[0].replace(/\/\*$/, "") ?? null;
159
+ }
160
+
161
+ //#endregion
162
+ //#region src/utils/resolve-import.ts
163
+ async function resolveImport(importPath, config) {
164
+ return createMatchPath(config.absoluteBaseUrl, config.paths)(importPath, void 0, () => true, [
165
+ ".ts",
166
+ ".tsx",
167
+ ".jsx",
168
+ ".js",
169
+ ".css"
170
+ ]);
171
+ }
172
+
173
+ //#endregion
174
+ //#region src/utils/get-config.ts
175
+ const explorer = cosmiconfig("components", { searchPlaces: ["components.json"] });
176
+ async function getConfig(cwd) {
177
+ const config = await getRawConfig(cwd);
178
+ if (!config) return null;
179
+ if (!config.iconLibrary) config.iconLibrary = config.style === "new-york" ? "radix" : "lucide";
180
+ return await resolveConfigPaths(cwd, config);
181
+ }
182
+ async function resolveConfigPaths(cwd, config) {
183
+ config.registries = {
184
+ ...BUILTIN_REGISTRIES,
185
+ ...config.registries || {}
186
+ };
187
+ const tsConfig = await loadConfig(cwd);
188
+ if (tsConfig.resultType === "failed") throw new Error(`Failed to load ${config.tsx ? "tsconfig" : "jsconfig"}.json. ${tsConfig.message ?? ""}`.trim());
189
+ return configSchema.parse({
190
+ ...config,
191
+ resolvedPaths: {
192
+ cwd,
193
+ tailwindConfig: config.tailwind.config ? path.resolve(cwd, config.tailwind.config) : "",
194
+ tailwindCss: path.resolve(cwd, config.tailwind.css),
195
+ utils: await resolveImport(config.aliases["utils"], tsConfig),
196
+ components: await resolveImport(config.aliases["components"], tsConfig),
197
+ ui: config.aliases["ui"] ? await resolveImport(config.aliases["ui"], tsConfig) : path.resolve(await resolveImport(config.aliases["components"], tsConfig) ?? cwd, "ui"),
198
+ lib: config.aliases["lib"] ? await resolveImport(config.aliases["lib"], tsConfig) : path.resolve(await resolveImport(config.aliases["utils"], tsConfig) ?? cwd, ".."),
199
+ hooks: config.aliases["hooks"] ? await resolveImport(config.aliases["hooks"], tsConfig) : path.resolve(await resolveImport(config.aliases["components"], tsConfig) ?? cwd, "..", "hooks")
200
+ }
201
+ });
202
+ }
203
+ async function getRawConfig(cwd) {
204
+ try {
205
+ const configResult = await explorer.search(cwd);
206
+ if (!configResult) return null;
207
+ const config = rawConfigSchema.parse(configResult.config);
208
+ if (config.registries) {
209
+ for (const registryName of Object.keys(config.registries)) if (registryName in BUILTIN_REGISTRIES) throw new Error(`"${registryName}" is a built-in registry and cannot be overridden.`);
210
+ }
211
+ return config;
212
+ } catch (error) {
213
+ const componentPath = `${cwd}/components.json`;
214
+ if (error instanceof Error && error.message.includes("reserved registry")) throw error;
215
+ throw new Error(`Invalid configuration found in ${highlighter.info(componentPath)}.`);
216
+ }
217
+ }
218
+
219
+ //#endregion
220
+ //#region src/docs/generate-mdx/utils.ts
221
+ const RESERVED_COMPONENTS = new Set([
222
+ "Fragment",
223
+ "CodePackageManagers",
224
+ "DocsTabs",
225
+ "DocsTabItem",
226
+ "DocsCodePackageManagers",
227
+ "Tabs",
228
+ "TabItem"
229
+ ]);
230
+ function slugify(input) {
231
+ return input.replace(/\.(astro|md|mdx|tsx|ts|jsx|js)$/i, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/\s+/g, "-").replace(/_+/g, "-").toLowerCase();
232
+ }
233
+ function extractFrontmatter(source) {
234
+ const match = source.match(/^---\n([\s\S]*?)\n---/);
235
+ return match && match[1] || "";
236
+ }
237
+ function toIdentifier(name) {
238
+ const base = name.replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9]+/g, " ").trim().replace(/\b\w/g, (c) => c.toUpperCase()).replace(/\s+/g, "");
239
+ return /^[A-Za-z_]/.test(base) ? base : `Ex${base}`;
240
+ }
241
+ function parseJsDocMetadata(frontmatterCode) {
242
+ const jsDocMatch = frontmatterCode.match(/\/\*\*([\s\S]*?)\*\//);
243
+ if (!jsDocMatch) return {};
244
+ const lines = jsDocMatch[1].split("\n").map((l) => l.replace(/^\s*\*\s?/, ""));
245
+ const meta = {};
246
+ let inUsage = false;
247
+ let inExamples = false;
248
+ let inPrimaryExample = false;
249
+ let captureDescriptionBody = false;
250
+ const usageLines = [];
251
+ const examplesLines = [];
252
+ const primaryExampleLines = [];
253
+ const descriptionBodyLines = [];
254
+ for (const rawLine of lines) {
255
+ const line = rawLine;
256
+ if (inUsage) if (line.trim().startsWith("@")) inUsage = false;
257
+ else {
258
+ usageLines.push(line);
259
+ continue;
260
+ }
261
+ if (inPrimaryExample) if (line.trim().startsWith("@")) inPrimaryExample = false;
262
+ else {
263
+ primaryExampleLines.push(line);
264
+ continue;
265
+ }
266
+ if (inExamples) if (line.trim().startsWith("@")) inExamples = false;
267
+ else {
268
+ examplesLines.push(line);
269
+ continue;
270
+ }
271
+ if (captureDescriptionBody) if (line.trim().startsWith("@")) captureDescriptionBody = false;
272
+ else {
273
+ descriptionBodyLines.push(line);
274
+ continue;
275
+ }
276
+ if (line.trim().startsWith("@component")) meta.name = line.replace("@component", "").trim();
277
+ else if (line.trim().startsWith("@title")) meta.title = line.replace("@title", "").trim();
278
+ else if (line.trim().startsWith("@description")) {
279
+ meta.description = line.replace("@description", "").trim();
280
+ captureDescriptionBody = true;
281
+ continue;
282
+ } else if (line.trim().startsWith("@figmaUrl")) meta.figmaUrl = line.replace("@figmaUrl", "").trim();
283
+ else if (line.trim().startsWith("@figma")) meta.figmaUrl = line.replace("@figma", "").trim();
284
+ else if (line.trim().startsWith("@usage")) {
285
+ inUsage = true;
286
+ continue;
287
+ } else if (line.trim().startsWith("@examples")) {
288
+ inExamples = true;
289
+ continue;
290
+ } else if (line.trim().startsWith("@preview")) {
291
+ inPrimaryExample = true;
292
+ continue;
293
+ } else if (line.trim().startsWith("@example")) {
294
+ inPrimaryExample = true;
295
+ continue;
296
+ }
297
+ }
298
+ if (usageLines.length) meta.usageMDX = usageLines.join("\n").trim();
299
+ if (examplesLines.length) meta.examplesMDX = examplesLines.join("\n").trim();
300
+ if (primaryExampleLines.length) meta.primaryExampleMDX = primaryExampleLines.join("\n").trim();
301
+ if (descriptionBodyLines.length) meta.descriptionBodyMDX = descriptionBodyLines.join("\n").trim();
302
+ return meta;
303
+ }
304
+ function extractPropsFromAstroProps(sourceFile) {
305
+ function unwrapAstroProps(node) {
306
+ let current = node;
307
+ for (let i = 0; i < 10; i += 1) {
308
+ const kind = current.getKind();
309
+ if (kind === SyntaxKind.PropertyAccessExpression) {
310
+ const expr = current.getExpression();
311
+ if (expr && expr.getText() === "Astro" && current.getName() === "props") return current;
312
+ return null;
313
+ }
314
+ if (kind === SyntaxKind.AsExpression || kind === SyntaxKind.TypeAssertion || kind === SyntaxKind.SatisfiesExpression || kind === SyntaxKind.NonNullExpression || kind === SyntaxKind.ParenthesizedExpression) {
315
+ const next = current.getExpression && current.getExpression();
316
+ if (!next) return null;
317
+ current = next;
318
+ continue;
319
+ }
320
+ return null;
321
+ }
322
+ return null;
323
+ }
324
+ const target = sourceFile.getDescendantsOfKind(SyntaxKind.VariableDeclaration).find((decl) => {
325
+ const init = decl.getInitializer();
326
+ if (!init) return false;
327
+ return !!unwrapAstroProps(init);
328
+ });
329
+ if (!target) return [];
330
+ const nameNode = target.getNameNode();
331
+ if (!nameNode || nameNode.getKind() !== SyntaxKind.ObjectBindingPattern) return [];
332
+ return nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern).getElements().map((el) => {
333
+ if (!!el.getDotDotDotToken()) return {
334
+ isRest: true,
335
+ hasDefault: false,
336
+ alias: el.getName()
337
+ };
338
+ const propertyNameNode = el.getPropertyNameNode();
339
+ const name = el.getName();
340
+ const propName = propertyNameNode ? propertyNameNode.getText() : name;
341
+ const initializer = el.getInitializer();
342
+ let defaultValue;
343
+ if (initializer) defaultValue = initializer.getText();
344
+ return {
345
+ name: propName,
346
+ hasDefault: initializer != null,
347
+ defaultValue
348
+ };
349
+ });
350
+ }
351
+ function extractPropsFromDeclaredProps(sourceFile) {
352
+ function normalizeTypeText(text) {
353
+ if (!text) return "";
354
+ return text.replace(/\s+/g, " ").replace(/;\s*$/, "").trim();
355
+ }
356
+ const iface = sourceFile.getInterface("Props");
357
+ if (iface) return iface.getProperties().map((prop) => {
358
+ const name = prop.getName();
359
+ const typeNode = prop.getTypeNode();
360
+ const rawType = typeNode ? typeNode.getText() : prop.getType().getText();
361
+ const typeText = normalizeTypeText(rawType);
362
+ const optional = prop.hasQuestionToken();
363
+ return {
364
+ name,
365
+ type: typeText,
366
+ optional
367
+ };
368
+ });
369
+ const typeAlias = sourceFile.getTypeAlias("Props");
370
+ if (typeAlias) {
371
+ const typeNode = typeAlias.getTypeNode();
372
+ if (typeNode && typeNode.getKind() === SyntaxKind.TypeLiteral) return typeNode.asKindOrThrow(SyntaxKind.TypeLiteral).getProperties().map((prop) => {
373
+ const name = prop.getName();
374
+ const tn = prop.getTypeNode();
375
+ const rawType = tn ? tn.getText() : prop.getType().getText();
376
+ const typeText = normalizeTypeText(rawType);
377
+ const optional = prop.hasQuestionToken();
378
+ return {
379
+ name,
380
+ type: typeText,
381
+ optional
382
+ };
383
+ });
384
+ }
385
+ return [];
386
+ }
387
+ function resolveUiRoot(cwd) {
388
+ const require = createRequire(import.meta.url);
389
+ const envRoot = process.env.BEJAMAS_UI_ROOT;
390
+ if (envRoot && existsSync(path.join(envRoot, "package.json"))) return envRoot;
391
+ try {
392
+ const pkgPath = require.resolve("@bejamas/ui/package.json", { paths: [cwd] });
393
+ return path.dirname(pkgPath);
394
+ } catch {}
395
+ let current = cwd;
396
+ for (let i = 0; i < 6; i += 1) {
397
+ const candidate = path.join(current, "packages", "ui", "package.json");
398
+ if (existsSync(candidate)) return path.dirname(candidate);
399
+ const parent = path.dirname(current);
400
+ if (parent === current) break;
401
+ current = parent;
402
+ }
403
+ try {
404
+ const anyEntry = require.resolve("@bejamas/ui/*", { paths: [cwd] });
405
+ return path.resolve(anyEntry, "..", "..");
406
+ } catch {}
407
+ throw new Error("Unable to locate @bejamas/ui in the workspace");
408
+ }
409
+ function resolveOutDir(cwd) {
410
+ const envOut = process.env.BEJAMAS_DOCS_OUT_DIR;
411
+ if (envOut && envOut.length) return path.isAbsolute(envOut) ? envOut : path.resolve(cwd, envOut);
412
+ return path.resolve(cwd, "../../apps/web/src/content/docs/components");
413
+ }
414
+ function detectHasImportTopLevel(block, pascalName) {
415
+ if (!block) return false;
416
+ let inFence = false;
417
+ const importLineRegex = /* @__PURE__ */ new RegExp(`^\\s*import\\s+.*\\bfrom\\s+['"][^'"]+\\b${pascalName}\\.astro['"]`);
418
+ for (const line of block.split("\n")) {
419
+ if (line.trim().startsWith("```")) {
420
+ inFence = !inFence;
421
+ continue;
422
+ }
423
+ if (!inFence && importLineRegex.test(line)) return true;
424
+ }
425
+ return false;
426
+ }
427
+ function normalizeBlockMDX(block) {
428
+ if (!block) return "";
429
+ return block.replace(/from\s+['"]@\/ui\/components\//g, "from '@bejamas/ui/components/");
430
+ }
431
+ function normalizeUsageMDX(usageMDX, pascalName) {
432
+ const normalized = normalizeBlockMDX(usageMDX);
433
+ const hasImport = detectHasImportTopLevel(normalized, pascalName);
434
+ return {
435
+ text: normalized.trim(),
436
+ hasImport
437
+ };
438
+ }
439
+ function extractComponentTagsFromMDX(block) {
440
+ if (!block) return [];
441
+ let inFence = false;
442
+ const found = /* @__PURE__ */ new Set();
443
+ const tagRegex = /<([A-Z][A-Za-z0-9_]*)\b/g;
444
+ for (const line of block.split("\n")) {
445
+ if (line.trim().startsWith("```")) {
446
+ inFence = !inFence;
447
+ continue;
448
+ }
449
+ if (inFence) continue;
450
+ let match;
451
+ while ((match = tagRegex.exec(line)) !== null) {
452
+ const name = match[1];
453
+ found.add(name);
454
+ }
455
+ }
456
+ return Array.from(found);
457
+ }
458
+ async function discoverExamples(componentFilePath, componentsDir) {
459
+ const fileBase = path.basename(componentFilePath, path.extname(componentFilePath));
460
+ const kebabBase = slugify(fileBase);
461
+ const candidates = [join(dirname(componentFilePath), `${fileBase}.examples`), join(dirname(componentFilePath), `${kebabBase}.examples`)];
462
+ const found = [];
463
+ for (const dir of candidates) try {
464
+ const items = await readdir(dir, { withFileTypes: true });
465
+ for (const it of items) if (it.isFile() && extname(it.name).toLowerCase() === ".astro") {
466
+ const abs = join(dir, it.name);
467
+ const relFromComponents = path.relative(componentsDir, abs).split(path.sep).join(posix.sep);
468
+ found.push(relFromComponents);
469
+ }
470
+ } catch {}
471
+ return found;
472
+ }
473
+ function createSourceFileFromFrontmatter(frontmatterCode) {
474
+ return new Project({ useInMemoryFileSystem: true }).createSourceFile("Component.ts", frontmatterCode, { overwrite: true });
475
+ }
476
+
477
+ //#endregion
478
+ export { BASE_COLORS, RESERVED_COMPONENTS, createSourceFileFromFrontmatter, detectHasImportTopLevel, discoverExamples, extractComponentTagsFromMDX, extractFrontmatter, extractPropsFromAstroProps, extractPropsFromDeclaredProps, getConfig, getProjectInfo, highlighter, logger, normalizeBlockMDX, normalizeUsageMDX, parseJsDocMetadata, resolveOutDir, resolveUiRoot, slugify, spinner, toIdentifier };
479
+ //# sourceMappingURL=utils-DfvCox_O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DfvCox_O.js","names":["BUILTIN_REGISTRIES: z.infer<typeof registryConfigSchema>","fs","type: ProjectInfo","fs","RESERVED_COMPONENTS: Set<string>","meta: Record<string, any>","usageLines: string[]","examplesLines: string[]","primaryExampleLines: string[]","descriptionBodyLines: string[]","current: any","nameNode: any","defaultValue: string | undefined","match: RegExpExecArray | null","found: string[]","pathPosix"],"sources":["../src/registry/constants.ts","../src/utils/highlighter.ts","../src/utils/logger.ts","../src/utils/spinner.ts","../src/utils/get-package-info.ts","../src/utils/get-project-info.ts","../src/utils/resolve-import.ts","../src/utils/get-config.ts","../src/docs/generate-mdx/utils.ts"],"sourcesContent":["import { registryConfigSchema } from \"shadcn/schema\";\nimport { z } from \"zod\";\n\nexport const REGISTRY_URL =\n process.env.REGISTRY_URL ?? \"http://localhost:4321/r\";\n\nexport const FALLBACK_STYLE = \"new-york-v4\";\n\nexport const BASE_COLORS = [\n {\n name: \"neutral\",\n label: \"Neutral\",\n },\n {\n name: \"gray\",\n label: \"Gray\",\n },\n {\n name: \"zinc\",\n label: \"Zinc\",\n },\n {\n name: \"stone\",\n label: \"Stone\",\n },\n {\n name: \"slate\",\n label: \"Slate\",\n },\n] as const;\n\n// Built-in registries that are always available and cannot be overridden\nexport const BUILTIN_REGISTRIES: z.infer<typeof registryConfigSchema> = {\n \"@bejamas\": `${REGISTRY_URL}/{name}.json`,\n};\n\nexport const BUILTIN_MODULES = new Set([\n [\n // Node.js built-in modules\n // From https://github.com/sindresorhus/builtin-modules.\n \"node:assert\",\n \"assert\",\n \"node:assert/strict\",\n \"assert/strict\",\n \"node:async_hooks\",\n \"async_hooks\",\n \"node:buffer\",\n \"buffer\",\n \"node:child_process\",\n \"child_process\",\n \"node:cluster\",\n \"cluster\",\n \"node:console\",\n \"console\",\n \"node:constants\",\n \"constants\",\n \"node:crypto\",\n \"crypto\",\n \"node:dgram\",\n \"dgram\",\n \"node:diagnostics_channel\",\n \"diagnostics_channel\",\n \"node:dns\",\n \"dns\",\n \"node:dns/promises\",\n \"dns/promises\",\n \"node:domain\",\n \"domain\",\n \"node:events\",\n \"events\",\n \"node:fs\",\n \"fs\",\n \"node:fs/promises\",\n \"fs/promises\",\n \"node:http\",\n \"http\",\n \"node:http2\",\n \"http2\",\n \"node:https\",\n \"https\",\n \"node:inspector\",\n \"inspector\",\n \"node:inspector/promises\",\n \"inspector/promises\",\n \"node:module\",\n \"module\",\n \"node:net\",\n \"net\",\n \"node:os\",\n \"os\",\n \"node:path\",\n \"path\",\n \"node:path/posix\",\n \"path/posix\",\n \"node:path/win32\",\n \"path/win32\",\n \"node:perf_hooks\",\n \"perf_hooks\",\n \"node:process\",\n \"process\",\n \"node:querystring\",\n \"querystring\",\n \"node:quic\",\n \"node:readline\",\n \"readline\",\n \"node:readline/promises\",\n \"readline/promises\",\n \"node:repl\",\n \"repl\",\n \"node:sea\",\n \"node:sqlite\",\n \"node:stream\",\n \"stream\",\n \"node:stream/consumers\",\n \"stream/consumers\",\n \"node:stream/promises\",\n \"stream/promises\",\n \"node:stream/web\",\n \"stream/web\",\n \"node:string_decoder\",\n \"string_decoder\",\n \"node:test\",\n \"node:test/reporters\",\n \"node:timers\",\n \"timers\",\n \"node:timers/promises\",\n \"timers/promises\",\n \"node:tls\",\n \"tls\",\n \"node:trace_events\",\n \"trace_events\",\n \"node:tty\",\n \"tty\",\n \"node:url\",\n \"url\",\n \"node:util\",\n \"util\",\n \"node:util/types\",\n \"util/types\",\n \"node:v8\",\n \"v8\",\n \"node:vm\",\n \"vm\",\n \"node:wasi\",\n \"wasi\",\n \"node:worker_threads\",\n \"worker_threads\",\n \"node:zlib\",\n \"zlib\",\n\n // Bun built-in modules.\n \"bun\",\n \"bun:test\",\n \"bun:sqlite\",\n \"bun:ffi\",\n \"bun:jsc\",\n \"bun:internal\",\n ],\n]);\n\nexport const DEPRECATED_COMPONENTS = [\n {\n name: \"toast\",\n deprecatedBy: \"sonner\",\n message:\n \"The toast component is deprecated. Use the sonner component instead.\",\n },\n {\n name: \"toaster\",\n deprecatedBy: \"sonner\",\n message:\n \"The toaster component is deprecated. Use the sonner component instead.\",\n },\n];\n","import { cyan, green, red, yellow } from \"kleur/colors\";\n\nexport const highlighter = {\n error: red,\n warn: yellow,\n info: cyan,\n success: green,\n};\n","import { highlighter } from \"@/src/utils/highlighter\";\n\nexport const logger = {\n error(...args: unknown[]) {\n console.log(highlighter.error(args.join(\" \")));\n },\n warn(...args: unknown[]) {\n console.log(highlighter.warn(args.join(\" \")));\n },\n info(...args: unknown[]) {\n console.log(highlighter.info(args.join(\" \")));\n },\n success(...args: unknown[]) {\n console.log(highlighter.success(args.join(\" \")));\n },\n log(...args: unknown[]) {\n console.log(args.join(\" \"));\n },\n break() {\n console.log(\"\");\n },\n};\n","import ora, { type Options } from \"ora\";\n\nexport function spinner(\n text: Options[\"text\"],\n options?: {\n silent?: boolean;\n },\n) {\n return ora({\n text,\n isSilent: options?.silent,\n });\n}\n","import path from \"path\";\nimport fs from \"fs-extra\";\nimport { type PackageJson } from \"type-fest\";\n\nexport function getPackageInfo(\n cwd: string = \"\",\n shouldThrow: boolean = true,\n): PackageJson | null {\n const packageJsonPath = path.join(cwd, \"package.json\");\n\n return fs.readJSONSync(packageJsonPath, {\n throws: shouldThrow,\n }) as PackageJson;\n}\n","import path from \"path\";\nimport { rawConfigSchema } from \"shadcn/schema\";\nimport { Config, getConfig, resolveConfigPaths } from \"@/src/utils/get-config\";\nimport { getPackageInfo } from \"@/src/utils/get-package-info\";\nimport fg from \"fast-glob\";\nimport fs from \"fs-extra\";\nimport { loadConfig } from \"tsconfig-paths\";\nimport { z } from \"zod\";\n\nexport type TailwindVersion = \"v3\" | \"v4\" | null;\n\nexport type ProjectInfo = {\n isAstro: boolean;\n tailwindConfigFile: string | null;\n tailwindCssFile: string | null;\n tailwindVersion: TailwindVersion;\n aliasPrefix: string | null;\n};\n\nconst PROJECT_SHARED_IGNORE = [\n \"**/node_modules/**\",\n \".astro\",\n \"public\",\n \"dist\",\n \"build\",\n];\n\nconst TS_CONFIG_SCHEMA = z.object({\n compilerOptions: z.object({\n paths: z.record(z.string().or(z.array(z.string()))),\n }),\n});\n\nexport async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {\n const [\n configFiles,\n tailwindConfigFile,\n tailwindCssFile,\n tailwindVersion,\n aliasPrefix,\n packageJson,\n ] = await Promise.all([\n fg.glob(\n \"**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*\",\n {\n cwd,\n deep: 3,\n ignore: PROJECT_SHARED_IGNORE,\n },\n ),\n getTailwindConfigFile(cwd),\n getTailwindCssFile(cwd),\n getTailwindVersion(cwd),\n getTsConfigAliasPrefix(cwd),\n getPackageInfo(cwd, false),\n ]);\n\n const type: ProjectInfo = {\n isAstro: false,\n tailwindConfigFile,\n tailwindCssFile,\n tailwindVersion,\n aliasPrefix,\n };\n\n // Astro.\n if (configFiles.find((file) => file.startsWith(\"astro.config.\"))?.length) {\n type.isAstro = true;\n return type;\n }\n\n return type;\n}\n\nexport async function getTailwindVersion(\n cwd: string,\n): Promise<ProjectInfo[\"tailwindVersion\"]> {\n const [packageInfo, config] = await Promise.all([\n getPackageInfo(cwd, false),\n getConfig(cwd),\n ]);\n\n // If the config file is empty, we can assume that it's a v4 project.\n if (config?.tailwind?.config === \"\") {\n return \"v4\";\n }\n\n if (\n !packageInfo?.dependencies?.tailwindcss &&\n !packageInfo?.devDependencies?.tailwindcss\n ) {\n return null;\n }\n\n if (\n /^(?:\\^|~)?3(?:\\.\\d+)*(?:-.*)?$/.test(\n packageInfo?.dependencies?.tailwindcss ||\n packageInfo?.devDependencies?.tailwindcss ||\n \"\",\n )\n ) {\n return \"v3\";\n }\n\n return \"v4\";\n}\n\nexport async function getTailwindCssFile(cwd: string) {\n const [files, tailwindVersion] = await Promise.all([\n fg.glob([\"**/*.css\", \"**/*.scss\"], {\n cwd,\n deep: 5,\n ignore: PROJECT_SHARED_IGNORE,\n }),\n getTailwindVersion(cwd),\n ]);\n\n if (!files.length) {\n return null;\n }\n\n const needle =\n tailwindVersion === \"v4\" ? `@import \"tailwindcss\"` : \"@tailwind base\";\n for (const file of files) {\n const contents = await fs.readFile(path.resolve(cwd, file), \"utf8\");\n if (\n contents.includes(`@import \"tailwindcss\"`) ||\n contents.includes(`@import 'tailwindcss'`) ||\n contents.includes(`@tailwind base`)\n ) {\n return file;\n }\n }\n\n return null;\n}\n\nexport async function getTailwindConfigFile(cwd: string) {\n const files = await fg.glob(\"tailwind.config.*\", {\n cwd,\n deep: 3,\n ignore: PROJECT_SHARED_IGNORE,\n });\n\n if (!files.length) {\n return null;\n }\n\n return files[0];\n}\n\nexport async function getTsConfigAliasPrefix(cwd: string) {\n const tsConfig = await loadConfig(cwd);\n\n if (\n tsConfig?.resultType === \"failed\" ||\n !Object.entries(tsConfig?.paths).length\n ) {\n return null;\n }\n\n // This assume that the first alias is the prefix.\n for (const [alias, paths] of Object.entries(tsConfig.paths)) {\n if (\n paths.includes(\"./*\") ||\n paths.includes(\"./src/*\") ||\n paths.includes(\"./app/*\") ||\n paths.includes(\"./resources/js/*\") // Laravel.\n ) {\n return alias.replace(/\\/\\*$/, \"\") ?? null;\n }\n }\n\n // Use the first alias as the prefix.\n return Object.keys(tsConfig?.paths)?.[0].replace(/\\/\\*$/, \"\") ?? null;\n}\n\nexport async function isTypeScriptProject(cwd: string) {\n const files = await fg.glob(\"tsconfig.*\", {\n cwd,\n deep: 1,\n ignore: PROJECT_SHARED_IGNORE,\n });\n\n return files.length > 0;\n}\n\nexport async function getTsConfig(cwd: string) {\n for (const fallback of [\n \"tsconfig.json\",\n \"tsconfig.web.json\",\n \"tsconfig.app.json\",\n ]) {\n const filePath = path.resolve(cwd, fallback);\n if (!(await fs.pathExists(filePath))) {\n continue;\n }\n\n // We can't use fs.readJSON because it doesn't support comments.\n const contents = await fs.readFile(filePath, \"utf8\");\n const cleanedContents = contents.replace(/\\/\\*\\s*\\*\\//g, \"\");\n const result = TS_CONFIG_SCHEMA.safeParse(JSON.parse(cleanedContents));\n\n if (result.error) {\n continue;\n }\n\n return result.data;\n }\n\n return null;\n}\n\nexport async function getProjectConfig(\n cwd: string,\n defaultProjectInfo: ProjectInfo | null = null,\n): Promise<Config | null> {\n // Check for existing component config.\n const [existingConfig, projectInfo] = await Promise.all([\n getConfig(cwd),\n !defaultProjectInfo\n ? getProjectInfo(cwd)\n : Promise.resolve(defaultProjectInfo),\n ]);\n\n if (existingConfig) {\n return existingConfig;\n }\n\n if (\n !projectInfo ||\n !projectInfo.tailwindCssFile ||\n (projectInfo.tailwindVersion === \"v3\" && !projectInfo.tailwindConfigFile)\n ) {\n return null;\n }\n\n const config: z.infer<typeof rawConfigSchema> = {\n $schema: \"https://ui.shadcn.com/schema.json\",\n style: \"new-york\",\n tailwind: {\n config: projectInfo.tailwindConfigFile ?? \"\",\n baseColor: \"zinc\",\n css: projectInfo.tailwindCssFile,\n cssVariables: true,\n prefix: \"\",\n },\n iconLibrary: \"lucide\",\n aliases: {\n components: `${projectInfo.aliasPrefix}/components`,\n ui: `${projectInfo.aliasPrefix}/components/ui`,\n lib: `${projectInfo.aliasPrefix}/lib`,\n utils: `${projectInfo.aliasPrefix}/lib/utils`,\n },\n };\n\n return await resolveConfigPaths(cwd, config);\n}\n\nexport async function getProjectTailwindVersionFromConfig(config: {\n resolvedPaths: Pick<Config[\"resolvedPaths\"], \"cwd\">;\n}): Promise<TailwindVersion> {\n if (!config.resolvedPaths?.cwd) {\n return \"v3\";\n }\n\n const projectInfo = await getProjectInfo(config.resolvedPaths.cwd);\n\n if (!projectInfo?.tailwindVersion) {\n return null;\n }\n\n return projectInfo.tailwindVersion;\n}\n","import {\n createMatchPath,\n type ConfigLoaderSuccessResult,\n} from \"tsconfig-paths\";\n\nexport async function resolveImport(\n importPath: string,\n config: Pick<ConfigLoaderSuccessResult, \"absoluteBaseUrl\" | \"paths\">,\n) {\n return createMatchPath(config.absoluteBaseUrl, config.paths)(\n importPath,\n undefined,\n () => true,\n [\".ts\", \".tsx\", \".jsx\", \".js\", \".css\"],\n );\n}\n","import path from \"path\";\nimport { BUILTIN_REGISTRIES } from \"@/src/registry/constants\";\nimport {\n configSchema,\n rawConfigSchema,\n workspaceConfigSchema,\n} from \"shadcn/schema\";\nimport { getProjectInfo } from \"@/src/utils/get-project-info\";\nimport { highlighter } from \"@/src/utils/highlighter\";\nimport { resolveImport } from \"@/src/utils/resolve-import\";\nimport { cosmiconfig } from \"cosmiconfig\";\nimport fg from \"fast-glob\";\nimport { loadConfig } from \"tsconfig-paths\";\nimport { z } from \"zod\";\n\nexport const DEFAULT_STYLE = \"default\";\nexport const DEFAULT_COMPONENTS = \"@/components\";\nexport const DEFAULT_UTILS = \"@/lib/utils\";\nexport const DEFAULT_TAILWIND_CSS = \"app/globals.css\";\nexport const DEFAULT_TAILWIND_CONFIG = \"tailwind.config.js\";\nexport const DEFAULT_TAILWIND_BASE_COLOR = \"slate\";\n\n// TODO: Figure out if we want to support all cosmiconfig formats.\n// A simple components.json file would be nice.\nexport const explorer = cosmiconfig(\"components\", {\n searchPlaces: [\"components.json\"],\n});\n\nexport type Config = z.infer<typeof configSchema>;\n\nexport async function getConfig(cwd: string) {\n const config = await getRawConfig(cwd);\n\n if (!config) {\n return null;\n }\n\n // Set default icon library if not provided.\n if (!config.iconLibrary) {\n config.iconLibrary = config.style === \"new-york\" ? \"radix\" : \"lucide\";\n }\n\n return await resolveConfigPaths(cwd, config);\n}\n\nexport async function resolveConfigPaths(\n cwd: string,\n config: z.infer<typeof rawConfigSchema>,\n) {\n // Merge built-in registries with user registries\n config.registries = {\n ...BUILTIN_REGISTRIES,\n ...(config.registries || {}),\n };\n\n // Read tsconfig.json.\n const tsConfig = await loadConfig(cwd);\n\n if (tsConfig.resultType === \"failed\") {\n throw new Error(\n `Failed to load ${config.tsx ? \"tsconfig\" : \"jsconfig\"}.json. ${\n tsConfig.message ?? \"\"\n }`.trim(),\n );\n }\n\n return configSchema.parse({\n ...config,\n resolvedPaths: {\n cwd,\n tailwindConfig: config.tailwind.config\n ? path.resolve(cwd, config.tailwind.config)\n : \"\",\n tailwindCss: path.resolve(cwd, config.tailwind.css),\n utils: await resolveImport(config.aliases[\"utils\"], tsConfig),\n components: await resolveImport(config.aliases[\"components\"], tsConfig),\n ui: config.aliases[\"ui\"]\n ? await resolveImport(config.aliases[\"ui\"], tsConfig)\n : path.resolve(\n (await resolveImport(config.aliases[\"components\"], tsConfig)) ??\n cwd,\n \"ui\",\n ),\n // TODO: Make this configurable.\n // For now, we assume the lib and hooks directories are one level up from the components directory.\n lib: config.aliases[\"lib\"]\n ? await resolveImport(config.aliases[\"lib\"], tsConfig)\n : path.resolve(\n (await resolveImport(config.aliases[\"utils\"], tsConfig)) ?? cwd,\n \"..\",\n ),\n hooks: config.aliases[\"hooks\"]\n ? await resolveImport(config.aliases[\"hooks\"], tsConfig)\n : path.resolve(\n (await resolveImport(config.aliases[\"components\"], tsConfig)) ??\n cwd,\n \"..\",\n \"hooks\",\n ),\n },\n });\n}\n\nexport async function getRawConfig(\n cwd: string,\n): Promise<z.infer<typeof rawConfigSchema> | null> {\n try {\n const configResult = await explorer.search(cwd);\n\n if (!configResult) {\n return null;\n }\n\n const config = rawConfigSchema.parse(configResult.config);\n\n // Check if user is trying to override built-in registries\n if (config.registries) {\n for (const registryName of Object.keys(config.registries)) {\n if (registryName in BUILTIN_REGISTRIES) {\n throw new Error(\n `\"${registryName}\" is a built-in registry and cannot be overridden.`,\n );\n }\n }\n }\n\n return config;\n } catch (error) {\n const componentPath = `${cwd}/components.json`;\n if (error instanceof Error && error.message.includes(\"reserved registry\")) {\n throw error;\n }\n throw new Error(\n `Invalid configuration found in ${highlighter.info(componentPath)}.`,\n );\n }\n}\n\n// Note: we can check for -workspace.yaml or \"workspace\" in package.json.\n// Since cwd is not necessarily the root of the project.\n// We'll instead check if ui aliases resolve to a different root.\nexport async function getWorkspaceConfig(config: Config) {\n let resolvedAliases: any = {};\n\n for (const key of Object.keys(config.aliases)) {\n if (!isAliasKey(key, config)) {\n continue;\n }\n\n const resolvedPath = config.resolvedPaths[key];\n const packageRoot = await findPackageRoot(\n config.resolvedPaths.cwd,\n resolvedPath,\n );\n\n if (!packageRoot) {\n resolvedAliases[key] = config;\n continue;\n }\n\n resolvedAliases[key] = await getConfig(packageRoot);\n }\n\n const result = workspaceConfigSchema.safeParse(resolvedAliases);\n if (!result.success) {\n return null;\n }\n\n return result.data;\n}\n\nexport async function findPackageRoot(cwd: string, resolvedPath: string) {\n const commonRoot = findCommonRoot(cwd, resolvedPath);\n const relativePath = path.relative(commonRoot, resolvedPath);\n\n const packageRoots = await fg.glob(\"**/package.json\", {\n cwd: commonRoot,\n deep: 3,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/build/**\", \"**/public/**\"],\n });\n\n const matchingPackageRoot = packageRoots\n .map((pkgPath) => path.dirname(pkgPath))\n .find((pkgDir) => relativePath.startsWith(pkgDir));\n\n return matchingPackageRoot\n ? path.join(commonRoot, matchingPackageRoot)\n : null;\n}\n\nfunction isAliasKey(\n key: string,\n config: Config,\n): key is keyof Config[\"aliases\"] {\n return Object.keys(config.resolvedPaths)\n .filter((key) => key !== \"utils\")\n .includes(key);\n}\n\nexport function findCommonRoot(cwd: string, resolvedPath: string) {\n const parts1 = cwd.split(path.sep);\n const parts2 = resolvedPath.split(path.sep);\n const commonParts = [];\n\n for (let i = 0; i < Math.min(parts1.length, parts2.length); i++) {\n if (parts1[i] !== parts2[i]) {\n break;\n }\n commonParts.push(parts1[i]);\n }\n\n return commonParts.join(path.sep);\n}\n\n// TODO: Cache this call.\nexport async function getTargetStyleFromConfig(cwd: string, fallback: string) {\n const projectInfo = await getProjectInfo(cwd);\n return projectInfo?.tailwindVersion === \"v4\" ? \"new-york-v4\" : fallback;\n}\n\ntype DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\n/**\n * Creates a config object with sensible defaults.\n * Useful for universal registry items that bypass framework detection.\n *\n * @param partial - Partial config values to override defaults\n * @returns A complete Config object\n */\nexport function createConfig(partial?: DeepPartial<Config>): Config {\n const defaultConfig: Config = {\n resolvedPaths: {\n cwd: process.cwd(),\n tailwindConfig: \"\",\n tailwindCss: \"\",\n utils: \"\",\n components: \"\",\n ui: \"\",\n lib: \"\",\n hooks: \"\",\n },\n style: \"\",\n tailwind: {\n config: \"\",\n css: \"\",\n baseColor: \"\",\n cssVariables: false,\n },\n rsc: false,\n tsx: true,\n aliases: {\n components: \"\",\n utils: \"\",\n },\n registries: {\n ...BUILTIN_REGISTRIES,\n },\n };\n\n // Deep merge the partial config with defaults\n if (partial) {\n return {\n ...defaultConfig,\n ...partial,\n resolvedPaths: {\n ...defaultConfig.resolvedPaths,\n ...(partial.resolvedPaths || {}),\n },\n tailwind: {\n ...defaultConfig.tailwind,\n ...(partial.tailwind || {}),\n },\n aliases: {\n ...defaultConfig.aliases,\n ...(partial.aliases || {}),\n },\n registries: {\n ...defaultConfig.registries,\n ...(partial.registries || {}),\n },\n };\n }\n\n return defaultConfig;\n}\n","import { existsSync, readFileSync } from \"fs\";\nimport { readdir } from \"fs/promises\";\nimport path, { dirname, extname, join, posix as pathPosix } from \"path\";\nimport { createRequire } from \"module\";\nimport { Project, SyntaxKind, SourceFile } from \"ts-morph\";\n\nexport const RESERVED_COMPONENTS: Set<string> = new Set([\n \"Fragment\",\n \"CodePackageManagers\",\n \"DocsTabs\",\n \"DocsTabItem\",\n \"DocsCodePackageManagers\",\n \"Tabs\",\n \"TabItem\",\n]);\n\nexport function slugify(input: string): string {\n return input\n .replace(/\\.(astro|md|mdx|tsx|ts|jsx|js)$/i, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/\\s+/g, \"-\")\n .replace(/_+/g, \"-\")\n .toLowerCase();\n}\n\nexport function extractFrontmatter(source: string): string {\n const match = source.match(/^---\\n([\\s\\S]*?)\\n---/);\n return (match && match[1]) || \"\";\n}\n\nexport function toIdentifier(name: string): string {\n const base = name\n .replace(/\\.[^.]+$/, \"\")\n .replace(/[^a-zA-Z0-9]+/g, \" \")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n .replace(/\\s+/g, \"\");\n return /^[A-Za-z_]/.test(base) ? base : `Ex${base}`;\n}\n\nexport function parseJsDocMetadata(\n frontmatterCode: string,\n): Record<string, any> {\n const jsDocMatch = frontmatterCode.match(/\\/\\*\\*([\\s\\S]*?)\\*\\//);\n if (!jsDocMatch) return {};\n const content = jsDocMatch[1];\n const lines = content.split(\"\\n\").map((l) => l.replace(/^\\s*\\*\\s?/, \"\"));\n const meta: Record<string, any> = {};\n let inUsage = false;\n let inExamples = false;\n let inPrimaryExample = false;\n let captureDescriptionBody = false;\n const usageLines: string[] = [];\n const examplesLines: string[] = [];\n const primaryExampleLines: string[] = [];\n const descriptionBodyLines: string[] = [];\n for (const rawLine of lines) {\n const line = rawLine;\n if (inUsage) {\n if (line.trim().startsWith(\"@\")) {\n inUsage = false;\n } else {\n usageLines.push(line);\n continue;\n }\n }\n if (inPrimaryExample) {\n if (line.trim().startsWith(\"@\")) {\n inPrimaryExample = false;\n } else {\n primaryExampleLines.push(line);\n continue;\n }\n }\n if (inExamples) {\n if (line.trim().startsWith(\"@\")) {\n inExamples = false;\n } else {\n examplesLines.push(line);\n continue;\n }\n }\n if (captureDescriptionBody) {\n if (line.trim().startsWith(\"@\")) {\n captureDescriptionBody = false;\n } else {\n descriptionBodyLines.push(line);\n continue;\n }\n }\n if (line.trim().startsWith(\"@component\"))\n meta.name = line.replace(\"@component\", \"\").trim();\n else if (line.trim().startsWith(\"@title\"))\n meta.title = line.replace(\"@title\", \"\").trim();\n else if (line.trim().startsWith(\"@description\")) {\n meta.description = line.replace(\"@description\", \"\").trim();\n captureDescriptionBody = true;\n continue;\n } else if (line.trim().startsWith(\"@figmaUrl\"))\n meta.figmaUrl = line.replace(\"@figmaUrl\", \"\").trim();\n // Backward compatibility: support @figma but map to figmaUrl\n else if (line.trim().startsWith(\"@figma\"))\n meta.figmaUrl = line.replace(\"@figma\", \"\").trim();\n else if (line.trim().startsWith(\"@usage\")) {\n inUsage = true;\n continue;\n } else if (line.trim().startsWith(\"@examples\")) {\n inExamples = true;\n continue;\n } else if (line.trim().startsWith(\"@preview\")) {\n inPrimaryExample = true;\n continue;\n } else if (line.trim().startsWith(\"@example\")) {\n // backward compatibility with older docs\n inPrimaryExample = true;\n continue;\n }\n }\n if (usageLines.length) meta.usageMDX = usageLines.join(\"\\n\").trim();\n if (examplesLines.length) meta.examplesMDX = examplesLines.join(\"\\n\").trim();\n if (primaryExampleLines.length)\n meta.primaryExampleMDX = primaryExampleLines.join(\"\\n\").trim();\n if (descriptionBodyLines.length)\n meta.descriptionBodyMDX = descriptionBodyLines.join(\"\\n\").trim();\n return meta;\n}\n\nexport function extractPropsFromAstroProps(sourceFile: SourceFile): Array<{\n name?: string;\n isRest?: boolean;\n hasDefault?: boolean;\n defaultValue?: string;\n alias?: string;\n}> {\n // Helper: unwrap expressions like `(Astro.props as Props)`, `Astro.props as Props`,\n // `<Props>Astro.props`, `(Astro.props)!`, and parenthesized variants until we reach\n // the underlying PropertyAccessExpression.\n function unwrapAstroProps(node: any): any | null {\n let current: any = node;\n // Unwrap layers that can wrap the property access\n // AsExpression, TypeAssertion, SatisfiesExpression, NonNullExpression, ParenthesizedExpression\n // Keep drilling down via getExpression()\n // Guard against cycles by limiting iterations\n for (let i = 0; i < 10; i += 1) {\n const kind = current.getKind();\n if (kind === SyntaxKind.PropertyAccessExpression) {\n const expr = current.getExpression();\n if (\n expr &&\n expr.getText() === \"Astro\" &&\n current.getName() === \"props\"\n ) {\n return current;\n }\n return null;\n }\n if (\n kind === SyntaxKind.AsExpression ||\n kind === SyntaxKind.TypeAssertion ||\n // @ts-ignore - SatisfiesExpression may not exist in older TS versions\n kind === (SyntaxKind as any).SatisfiesExpression ||\n kind === SyntaxKind.NonNullExpression ||\n kind === SyntaxKind.ParenthesizedExpression\n ) {\n const next = current.getExpression && current.getExpression();\n if (!next) return null;\n current = next;\n continue;\n }\n return null;\n }\n return null;\n }\n\n const declarations = sourceFile.getDescendantsOfKind(\n SyntaxKind.VariableDeclaration,\n );\n const target = declarations.find((decl) => {\n const init = decl.getInitializer();\n if (!init) return false;\n return !!unwrapAstroProps(init);\n });\n if (!target) return [];\n const nameNode: any = target.getNameNode();\n if (!nameNode || nameNode.getKind() !== SyntaxKind.ObjectBindingPattern)\n return [];\n const obj = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n return obj.getElements().map((el: any) => {\n const isRest = !!el.getDotDotDotToken();\n if (isRest) return { isRest: true, hasDefault: false, alias: el.getName() };\n const propertyNameNode = el.getPropertyNameNode();\n const name = el.getName();\n const propName = propertyNameNode ? propertyNameNode.getText() : name;\n const initializer = el.getInitializer();\n let defaultValue: string | undefined;\n if (initializer) defaultValue = initializer.getText();\n return { name: propName, hasDefault: initializer != null, defaultValue };\n });\n}\n\nexport function extractPropsFromDeclaredProps(sourceFile: SourceFile): Array<{\n name: string;\n type: string;\n optional: boolean;\n}> {\n function normalizeTypeText(text: string | undefined): string {\n if (!text) return \"\";\n return text.replace(/\\s+/g, \" \").replace(/;\\s*$/, \"\").trim();\n }\n // Prefer interface Props\n const iface = sourceFile.getInterface(\"Props\");\n if (iface) {\n const properties = iface.getProperties();\n return properties.map((prop) => {\n const name = prop.getName();\n const typeNode = prop.getTypeNode();\n const rawType = typeNode ? typeNode.getText() : prop.getType().getText();\n const typeText = normalizeTypeText(rawType);\n const optional = prop.hasQuestionToken();\n return { name, type: typeText, optional };\n });\n }\n\n // Fallback: type Props = { ... }\n const typeAlias = sourceFile.getTypeAlias(\"Props\");\n if (typeAlias) {\n const typeNode = typeAlias.getTypeNode();\n if (typeNode && typeNode.getKind() === SyntaxKind.TypeLiteral) {\n const literal = typeNode.asKindOrThrow(SyntaxKind.TypeLiteral);\n const properties = literal.getProperties();\n return properties.map((prop) => {\n const name = prop.getName();\n const tn = prop.getTypeNode();\n const rawType = tn ? tn.getText() : prop.getType().getText();\n const typeText = normalizeTypeText(rawType);\n const optional = prop.hasQuestionToken();\n return { name, type: typeText, optional };\n });\n }\n }\n\n return [];\n}\n\nexport function resolveUiRoot(cwd: string): string {\n const require = createRequire(import.meta.url);\n\n const envRoot = process.env.BEJAMAS_UI_ROOT;\n if (envRoot && existsSync(path.join(envRoot, \"package.json\"))) {\n return envRoot;\n }\n\n try {\n const pkgPath = require.resolve(\"@bejamas/ui/package.json\", {\n paths: [cwd],\n });\n return path.dirname(pkgPath);\n } catch {}\n\n let current = cwd;\n for (let i = 0; i < 6; i += 1) {\n const candidate = path.join(current, \"packages\", \"ui\", \"package.json\");\n if (existsSync(candidate)) return path.dirname(candidate);\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n\n try {\n const anyEntry = require.resolve(\"@bejamas/ui/*\", { paths: [cwd] });\n return path.resolve(anyEntry, \"..\", \"..\");\n } catch {}\n\n throw new Error(\"Unable to locate @bejamas/ui in the workspace\");\n}\n\nexport function resolveOutDir(cwd: string): string {\n const envOut = process.env.BEJAMAS_DOCS_OUT_DIR;\n if (envOut && envOut.length) {\n return path.isAbsolute(envOut) ? envOut : path.resolve(cwd, envOut);\n }\n return path.resolve(cwd, \"../../apps/web/src/content/docs/components\");\n}\n\nexport function detectHasImportTopLevel(\n block: string,\n pascalName: string,\n): boolean {\n if (!block) return false;\n let inFence = false;\n const importLineRegex = new RegExp(\n `^\\\\s*import\\\\s+.*\\\\bfrom\\\\s+['\"][^'\"]+\\\\b${pascalName}\\\\.astro['\"]`,\n );\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && importLineRegex.test(line)) return true;\n }\n return false;\n}\n\nexport function hasImportOfTopLevel(\n block: string,\n componentName: string,\n): boolean {\n if (!block) return false;\n let inFence = false;\n const importRegex = new RegExp(\n `^\\\\s*import\\\\s+[^;]*\\\\b${componentName}\\\\b[^;]*from\\\\s+['\"][^'\"]*(?:/|^)${componentName}\\\\.astro['\"]`,\n );\n const lucideIconRegex = /Icon$/.test(componentName)\n ? new RegExp(\n `^\\\\s*import\\\\s+\\\\{[^}]*\\\\b${componentName}\\\\b[^}]*\\\\}\\\\s+from\\\\s+['\"]@lucide/astro['\"]`,\n )\n : null;\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && importRegex.test(line)) return true;\n if (!inFence && lucideIconRegex && lucideIconRegex.test(line)) return true;\n }\n return false;\n}\n\nexport function normalizeBlockMDX(block: string): string {\n if (!block) return \"\";\n return block.replace(\n /from\\s+['\"]@\\/ui\\/components\\//g,\n \"from '@bejamas/ui/components/\",\n );\n}\n\nexport function replaceDocsComponentTags(block: string): string {\n if (!block) return \"\";\n let inFence = false;\n const lines = block.split(\"\\n\");\n const out: string[] = [];\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n out.push(line);\n continue;\n }\n if (inFence) {\n out.push(line);\n continue;\n }\n const replaced = line\n .replace(/<Tabs(\\b|\\s)/g, \"<DocsTabs$1\")\n .replace(/<\\/Tabs>/g, \"</DocsTabs>\")\n .replace(/<TabItem(\\b|\\s)/g, \"<DocsTabItem$1\")\n .replace(/<\\/TabItem>/g, \"</DocsTabItem>\");\n out.push(replaced);\n }\n return out.join(\"\\n\");\n}\n\nexport function normalizeUsageMDX(\n usageMDX: string,\n pascalName: string,\n): { text: string; hasImport: boolean } {\n const normalized = normalizeBlockMDX(usageMDX);\n const hasImport = detectHasImportTopLevel(normalized, pascalName);\n return { text: normalized.trim(), hasImport };\n}\n\nexport function extractComponentTagsFromMDX(block: string): string[] {\n if (!block) return [];\n let inFence = false;\n const found = new Set<string>();\n const tagRegex = /<([A-Z][A-Za-z0-9_]*)\\b/g;\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (inFence) continue;\n let match: RegExpExecArray | null;\n while ((match = tagRegex.exec(line)) !== null) {\n const name = match[1];\n found.add(name);\n }\n }\n return Array.from(found);\n}\n\nexport async function discoverExamples(\n componentFilePath: string,\n componentsDir: string,\n): Promise<string[]> {\n const fileBase = path.basename(\n componentFilePath,\n path.extname(componentFilePath),\n );\n const kebabBase = slugify(fileBase);\n const candidates = [\n join(dirname(componentFilePath), `${fileBase}.examples`),\n join(dirname(componentFilePath), `${kebabBase}.examples`),\n ];\n const found: string[] = [];\n for (const dir of candidates) {\n try {\n const items = await readdir(dir, { withFileTypes: true });\n for (const it of items) {\n if (it.isFile() && extname(it.name).toLowerCase() === \".astro\") {\n const abs = join(dir, it.name);\n const relFromComponents = path\n .relative(componentsDir, abs)\n .split(path.sep)\n .join(pathPosix.sep);\n found.push(relFromComponents);\n }\n }\n } catch {}\n }\n return found;\n}\n\nexport function createSourceFileFromFrontmatter(\n frontmatterCode: string,\n): SourceFile {\n const project = new Project({ useInMemoryFileSystem: true });\n return project.createSourceFile(\"Component.ts\", frontmatterCode, {\n overwrite: true,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,MAAa,eACX,QAAQ,IAAI,gBAAgB;AAI9B,MAAa,cAAc;CACzB;EACE,MAAM;EACN,OAAO;EACR;CACD;EACE,MAAM;EACN,OAAO;EACR;CACD;EACE,MAAM;EACN,OAAO;EACR;CACD;EACE,MAAM;EACN,OAAO;EACR;CACD;EACE,MAAM;EACN,OAAO;EACR;CACF;AAGD,MAAaA,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