import type { PackageManager } from './package-manager.js'; export declare const CONFIG_FILENAME = "components.json"; export interface ComponentsConfig { $schema?: string; /** Registry to fetch from. Overridden by `--registry`. */ registry?: string; /** * The directory `@/` points at, relative to the project root. * * Normally read from `tsconfig.json`'s `@/*` mapping. Set this only when that * reading is wrong — an alias declared in an extended base config, say. */ baseDir?: string; /** * Where each kind of file lands, relative to the `@/` alias root. * * Registry payloads carry a `target` like `components/ui/button.tsx`. These * remap the leading directory — and `add` rewrites the matching import * specifiers in the copied source, so the files still resolve afterwards. * * Note these are *not* project-root-relative. In a project whose `@/*` maps * to `./src/*`, components already land under `src/`; naming this * `src/components` would nest them twice. */ aliases?: { components?: string; hooks?: string; providers?: string; theme?: string; lib?: string; }; packageManager?: PackageManager; } export declare const DEFAULT_ALIASES: { readonly components: "components"; readonly hooks: "hooks"; readonly providers: "providers"; readonly theme: "theme"; readonly lib: "lib"; }; export type AliasKind = keyof typeof DEFAULT_ALIASES; export declare function configPath(projectPath: string): string; /** Returns null when the project has no config, which is not an error. */ export declare function readConfig(projectPath: string): Promise; export declare function writeConfig(projectPath: string, config: ComponentsConfig): Promise; /** * Drops a redundant alias root from alias values written before they were * `@/`-relative. * * `{ components: 'src/components' }` in a project whose `@/*` maps to `./src/*` * meant "put components under src/" when the CLI ignored that mapping. Now that * it does not, honouring the value literally would nest them twice. Reports the * kinds it touched so the caller can say so once. */ export declare function normalizeAliases(aliases: ComponentsConfig['aliases'], aliasRoot: string): { aliases: ComponentsConfig['aliases']; legacy: AliasKind[]; }; /** * Repoints a file's own imports at the project's aliases. * * One pass, so a value that happens to equal another kind's default — * `{ components: 'hooks' }` — is written in and never rescanned. */ export declare function rewriteImports(content: string, aliases: ComponentsConfig['aliases']): string; /** * Rewrites a payload's target through the project's aliases. * * Only the first path segment is remapped, and only when it is one we know: * `components/ui/button.tsx` follows `aliases.components`, but the `ui/` * beneath it is part of the registry's own layout and stays put. The result is * relative to the `@/` alias root, not to the project root. */ export declare function applyAliases(target: string, aliases: ComponentsConfig['aliases']): string;