import { SerializedConfig, Compiler, Span, Diagnostic, MatchCategory, ExtractedCall, ExtractedJsx, ExtractResult, NativeTransformSourceInput, TransformSourceResult, BuildInfoNative, DesignSystemManifestInput, DesignSystemManifest, FileInspectionResult, SerializedHookFilter, CompileOutput } from '@pandacss/compiler-shared'; interface CompileInput { files?: Array<{ path: string; content: string; }>; config?: SerializedConfig; cwd?: string; cacheDir?: string; emitLayerDeclaration?: boolean; } type ImportSpecifierKind = 'named' | 'default' | 'namespace'; interface ImportSpecifier { kind: ImportSpecifierKind; imported: string; local: string; typeOnly: boolean; span: Span; } type ImportKind = 'sideEffect' | 'value'; interface ImportRecord { module: string; kind: ImportKind; typeOnly: boolean; specifiers: ImportSpecifier[]; span: Span; } interface ImportScanResult { imports: ImportRecord[]; diagnostics: Diagnostic[]; } interface Matcher { modules: string[]; /** Omit to match any imported name (used for recipes/patterns). */ names?: string[]; } type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik' | (string & {}); interface Matchers { css: Matcher; recipe: Matcher; pattern: Matcher; jsx?: Matcher; tokens: Matcher; /** Configured JSX framework. Enables JSX-aware extraction diagnostics. */ jsxFramework?: JsxFramework; /** Resolved Panda token dictionary. When present, `token('path')` and * `token.var('path')` calls fold to their dictionary value during * extraction. */ tokenDictionary?: TokenDictionary; /** Resolved JSX factory names that accept member-chain tags (``). */ jsxFactories?: string[]; } /** Two parallel `path → string` maps backing `token()` resolution. * - `values['colors.red.500']` → raw value, e.g. `'#ef4444'` * - `vars['colors.red.500']` → CSS-var form, e.g. `'var(--colors-red-500)'` */ interface TokenDictionary { values: Record; vars: Record; } interface MatchedImport { category: MatchCategory; module: string; name: string; alias: string; kind: ImportSpecifierKind; } interface ExtractedCallsResult { calls: ExtractedCall[]; diagnostics: Diagnostic[]; } interface ExtractedJsxResult { jsx: ExtractedJsx[]; diagnostics: Diagnostic[]; } /** Full result including raw + matched imports, for tooling / parity flows. */ interface ExtractDebugResult { imports: ImportRecord[]; matched: MatchedImport[]; calls: ExtractedCall[]; jsx: ExtractedJsx[]; diagnostics: Diagnostic[]; } /** Reusable extractor session — built once from a `Matchers` config, then * called per file. For one-off use, prefer a `Compiler` + `extractFileSource`. */ interface ExtractorSession { extract(path: string, source: string): ExtractResult; extractDebug(path: string, source: string): ExtractDebugResult; matchImports(scan: ImportScanResult): MatchedImport[]; } interface ExtractorSessionConstructor { new (matchers: Matchers): ExtractorSession; } interface TraceOptions { /** Tracing filter, e.g. "trace", "debug", or "pandacss_project=trace". */ filter?: string; /** `fmt` → stderr. `chrome-json` → trace file. `profile` → both, plus `takeTimingsJson`. */ output?: 'fmt' | 'chrome-json' | 'profile'; /** Required for useful `chrome-json`/`profile` output. Defaults to `.panda/trace.json`. */ file?: string; } interface NativeCompilerOptions { crossFile?: boolean; } interface RawDesignSystemBinding { createDesignSystemManifest(input: DesignSystemManifestInput): DesignSystemManifest; designSystemManifestSchemaVersion(): number; } interface RawFileSystemBinding { readFile(path: string): string | null | undefined; exists(path: string): boolean; } interface RawPathBinding { realpath(path: string): string; resolvePath(path: string, cwd?: string): string; joinPath(parts: string[]): string; dirname(path: string): string; } interface NativeCompiler extends Compiler { } interface RawSourceTransformBinding { transformSource(input: NativeTransformSourceInput): TransformSourceResult; } /** The raw native instance — superset of {@link NativeCompiler} carrying the internal * methods the facade hides. */ interface RawCompiler extends NativeCompiler, RawSourceTransformBinding, BuildInfoNative, RawDesignSystemBinding, RawFileSystemBinding, RawPathBinding { inspectFileSource(path: string, source: string): Omit; tokenDictionary?(): TokenDictionary | undefined; registerUtilityTransform?(id: string, callback: (resolved: unknown, original: unknown) => unknown): void; registerPatternTransform?(id: string, callback: (props: unknown, helpers: Record) => unknown): void; registerSourceTransform?(id: string, filter: SerializedHookFilter | undefined, callback: (filePath: string, content: string) => string | undefined): void; } interface CompilerConstructor { fromConfig(config: SerializedConfig, options?: NativeCompilerOptions, utilityValuesCallbacks?: Record Record | undefined) => unknown>): RawCompiler; } interface NativeBinding { startTracing?(options?: TraceOptions): boolean; flushTracing?(): void; takeTimingsJson?(): string | null | undefined; shutdownTracing?(): boolean; compile(input?: CompileInput): CompileOutput; scanImports(path: string, source: string): ImportScanResult; matchImports(scan: ImportScanResult, matchers: Matchers): MatchedImport[]; extractCalls(path: string, source: string, matched: MatchedImport[], matchers: Matchers): ExtractedCallsResult; extractJsx(path: string, source: string, matched: MatchedImport[], matchers: Matchers): ExtractedJsxResult; extract(path: string, source: string, matchers: Matchers): ExtractResult; extractDebug(path: string, source: string, matchers: Matchers): ExtractDebugResult; Extractor: ExtractorSessionConstructor; Compiler: CompilerConstructor; } export type { CompileInput as C, ExtractedCallsResult as E, ImportSpecifierKind as I, JsxFramework as J, Matcher as M, NativeCompiler as N, RawSourceTransformBinding as R, TraceOptions as T, ImportSpecifier as a, ImportKind as b, ImportRecord as c, ImportScanResult as d, Matchers as e, TokenDictionary as f, MatchedImport as g, ExtractedJsxResult as h, ExtractDebugResult as i, ExtractorSession as j, ExtractorSessionConstructor as k, NativeCompilerOptions as l, RawCompiler as m, CompilerConstructor as n, NativeBinding as o };