/** * Generic primitive resolver -- replaces boundary-resolve, * token-resolve, theme-resolve, and style-resolve with a single * parameterised implementation. * * Resolution order for each kind: * * 1. `userDir/kinds.ts` (if `userDir` provided) * 2. `userDir/*.kinds.ts` (if `userDir` provided) * 3. `fromFile`'s dir / `kinds.ts` * 4. `fromFile`'s dir / `*.kinds.ts` * 5. `projectRoot/kinds.ts` * 6. `projectRoot/*.kinds.ts` * 7. `null` * * @module */ import type { Boundary, Token, Theme, Style } from '@czap/core'; import type { PrimitiveKind } from '@czap/core'; export type { PrimitiveKind }; /** * Map a {@link PrimitiveKind} to the structural type of the primitive * it resolves (`Boundary.Shape`, `Token.Shape`, ...). */ export type PrimitiveShape = K extends 'boundary' ? Boundary.Shape : K extends 'token' ? Token.Shape : K extends 'theme' ? Theme.Shape : Style.Shape; /** * A successful primitive resolution: the loaded primitive plus the * absolute path of the module it came from (surfaced in diagnostics). */ export interface PrimitiveResolution { readonly primitive: PrimitiveShape; readonly source: string; } /** * Per-`PrimitiveKind` metadata used by {@link resolvePrimitive}: * canonical filename, wildcard suffix, and the exported tag name the * module is expected to decorate its primitives with. */ export declare const KIND_META: Record; /** * The candidate module patterns {@link resolvePrimitive} searches for a * given lookup, in search order (e.g. `src/tokens.ts`, `src/*.tokens.ts`, * `tokens.ts`, `*.tokens.ts`). Used to make "could not resolve" * diagnostics name the exact places that were searched. * * @param kind - Primitive kind being resolved. * @param fromFile - Path of the file that triggered the lookup. * @param projectRoot - Vite project root (search fallback). * @param userDir - Optional override directory (searched first). */ export declare function primitiveSearchPatterns(kind: PrimitiveKind, fromFile: string, projectRoot: string, userDir?: string): readonly string[]; /** * Doctor-style warning for an unresolved primitive: what happened (the * name and the file that referenced it), why probably (none of the * searched convention modules exported it), and the literal next thing * to type (the factory export, or the `dirs` override). */ export declare function unresolvedPrimitiveWarning(kind: PrimitiveKind, name: string, id: string, line: number, projectRoot: string, userDir: string | undefined): string; /** * Resolve a named primitive (boundary / token / theme / style) by * walking the convention-based search order. Returns `null` when no * module exports a matching named value. * * @param kind - Primitive kind to resolve. * @param name - Named export to look up. * @param fromFile - Path of the file that triggered the lookup. * @param projectRoot - Vite project root (search fallback). * @param userDir - Optional override directory (searched first). */ export declare function resolvePrimitive(kind: K, name: string, fromFile: string, projectRoot: string, userDir?: string): Promise | null>; //# sourceMappingURL=primitive-resolve.d.ts.map