import { z } from 'zod'; /** * Shared trace utilities for CLI, devtools, and dashboard * * Provides reusable trace snapshot handling, formatting, and analysis * across the tailwind-styled-v4 ecosystem without introducing coupling. */ interface TraceSnapshot { generatedAt: string; buildMs: number | null; scanMs: number | null; analyzeMs: number | null; compileMs: number | null; memoryMb: { rss: number; heapUsed: number; heapTotal: number; } | null; classCount: number | null; fileCount: number | null; cssBytes: number | null; mode: string | null; eventsReceived?: number; eventsProcessed?: number; batchesProcessed?: number; incrementalUpdates?: number; fullRescans?: number; } interface TraceSummary { workspace: { totalPackages: number; totalFiles: number; totalClasses: number; lastScanDurationMs: number; lastBuildDurationMs: number; }; cache: { hitRate: number; totalEntries: number; memoryUsageMb: number; }; pipeline: { scanDurationMs: number; analyzeDurationMs: number; compileDurationMs: number; totalDurationMs: number; }; health: { status: "healthy" | "degraded" | "unhealthy"; issues: Array<{ severity: string; message: string; }>; }; } /** * Get health status color for UI rendering */ declare function getHealthColor(status?: string): string; /** * Get mode color for UI rendering */ declare function getModeColor(mode?: string | null): string; /** * Format memory in human-readable format */ declare function formatMemory(bytes: number): string; /** * Format duration in human-readable format */ declare function formatDuration(ms: number | null): string; /** * Calculate health status from metrics */ declare function calculateHealth(metrics: TraceSnapshot, summary?: TraceSummary): "healthy" | "degraded" | "unhealthy"; /** * Get color for build time indicator */ declare function getBuildTimeColor(ms: number | null): string; /** * Get color for memory usage indicator */ declare function getMemoryColor(mb: number): string; /** * Create trace snapshot from dashboard data */ declare function createTraceSnapshot(data: Record): TraceSnapshot; /** * Calculate pipeline time distribution */ declare function getPipelinePercentages(metrics: TraceSnapshot): { scanPct: number; analyzePct: number; compilePct: number; }; /** * Error code registry — single source of truth for all error codes. * * Format: E[0-9]xx for errors, W[0-9]xx for warnings. * Use with TwError for consistent error handling. */ declare const ERROR_CODES: { readonly NATIVE_NOT_FOUND: "E001"; readonly NATIVE_LOAD_FAILED: "E002"; readonly NATIVE_VERSION_MISMATCH: "E003"; readonly SCANNER_NATIVE_NOT_FOUND: "E004"; readonly SCANNER_HASH_FAILED: "E005"; readonly NATIVE_TRANSFORM_UNAVAILABLE: "E006"; readonly MISSING_REACT_IMPORT: "E201"; readonly UNSUPPORTED_PATTERN: "E202"; readonly TEMPLATE_PARSE_ERROR: "E203"; readonly COMPILE_TIMEOUT: "E204"; readonly TAILWIND_VERSION_UNSUPPORTED: "E301"; readonly NODE_VERSION_UNSUPPORTED: "E302"; readonly CACHE_READ_FAILED: "E401"; readonly CACHE_WRITE_FAILED: "E402"; readonly CACHE_CORRUPTED: "E403"; readonly RSC_BOUNDARY_CONFLICT: "E501"; readonly DYNAMIC_CONTENT: "W101"; readonly INVALID_VARIANT_VALUE: "W201"; readonly DEPRECATED_MODE: "W301"; }; type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES]; declare function getSuggestion(code: string): string | undefined; declare function formatErrorCode(code: string): string; /** * Tailwind CSS version detection and compatibility checks. * * tailwind-styled-v4 requires Tailwind CSS v4.x. * This module detects the installed version and provides * clear error messages for unsupported versions. */ interface TailwindInfo { version: string; major: number; supported: boolean; path: string | null; } declare function detectTailwind(): TailwindInfo; declare function assertTailwindV4(): void; declare function getTailwindVersion(): string; declare function isTailwindV4(): boolean; /** * Zod schemas untuk validasi native binding responses. * * Dipakai untuk memvalidasi data yang datang dari Rust native bindings * sebelum masuk ke domain logic TypeScript. * * Pattern: * const raw = native.scanWorkspace(root) * const validated = NativeScanResultSchema.parse(raw) * // Setelah ini, gunakan `validated` (trusted typed object) */ declare const NativeScanFileSchema: z.ZodObject<{ file: z.ZodString; classes: z.ZodArray; hash: z.ZodOptional; }, z.core.$strip>; declare const NativeScanResultSchema: z.ZodObject<{ files: z.ZodArray; hash: z.ZodOptional; }, z.core.$strip>>; totalFiles: z.ZodNumber; uniqueClasses: z.ZodArray; }, z.core.$strip>; declare const NativeAnalyzerReportSchema: z.ZodObject<{ root: z.ZodString; topClasses: z.ZodOptional>; }, z.core.$strip>>>; safelist: z.ZodOptional>; css: z.ZodOptional; conflicts: z.ZodOptional>; unusedClasses: z.ZodOptional>; durationMs: z.ZodOptional; }, z.core.$strip>; declare const NativeTransformResultSchema: z.ZodObject<{ code: z.ZodString; classes: z.ZodArray; changed: z.ZodBoolean; rsc: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; declare const NativeCssCompileResultSchema: z.ZodObject<{ css: z.ZodString; resolvedClasses: z.ZodArray; unresolvedClasses: z.ZodOptional>; }, z.core.$strip>; declare const NativeWatchResultSchema: z.ZodObject<{ status: z.ZodEnum<{ error: "error"; ok: "ok"; }>; handleId: z.ZodOptional; error: z.ZodOptional; }, z.core.$strip>; declare const NativeCacheEntrySchema: z.ZodObject<{ file: z.ZodString; hash: z.ZodString; classes: z.ZodArray; timestamp: z.ZodNumber; size: z.ZodOptional; }, z.core.$strip>; declare const NativeCacheReadResultSchema: z.ZodObject<{ entries: z.ZodArray; timestamp: z.ZodNumber; size: z.ZodOptional; }, z.core.$strip>>; version: z.ZodOptional; }, z.core.$strip>; /** * Validasi native binding response dengan fallback ke nilai default. * Gunakan ini di hot path agar tidak crash saat native returns unexpected shape. * * @example * const raw = native.scanWorkspace(root) * const result = safeParseNative(NativeScanResultSchema, raw, { * files: [], totalFiles: 0, uniqueClasses: [] * }) */ declare function safeParseNative(schema: z.ZodType, data: unknown, fallback: T): T; /** * Parse native response — throw TwError jika gagal. * Gunakan ini di boundary entry points. */ declare function parseNative(schema: z.ZodType, data: unknown, context: string): T; /** * ESM-safe runtime helpers untuk monorepo. * * Menggantikan pola fragile seperti: * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()` * - `__dirname` → gunakan `getDirname(import.meta.url)` * - `__filename` → gunakan `getFilename(import.meta.url)` * * Semua helper ini bekerja di ESM dan CJS. * * @module @tailwind-styled/shared/esmHelpers */ /** * Buat `require()` function yang relative terhadap sebuah ESM module. * * @example * const req = createEsmRequire(import.meta.url) * const mod = req("some-pkg") */ declare function createEsmRequire(importMetaUrl: string): NodeRequire; /** * Dapat `__dirname` dari `import.meta.url`. * * @example * const dir = getDirname(import.meta.url) */ declare function getDirname(importMetaUrl: string): string; /** * Dapat `__filename` dari `import.meta.url`. */ declare function getFilename(importMetaUrl: string): string; /** * Resolve path dari root monorepo (bukan CWD). */ declare function resolveFromRoot(...segments: string[]): string; /** * Require sebuah module dengan fallback ke null jika tidak tersedia. */ declare function tryRequire(moduleName: string, importMetaUrl: string): T | null; /** * Resolve .node binary path yang cross-platform dan ESM-safe. */ declare function resolveNativeNodePath(importMetaUrl: string, ...relativeSegments: string[]): string; /** * Build performance telemetry untuk tailwind-styled-v4. * QA #14: Visibility ke build performance — scan speed, cache hit rate, trends. * * Design: zero-dependency, ring-buffer based, opt-in via TWS_TELEMETRY=1. */ interface BuildPhases { scan: number; compile: number; engine: number; output: number; } interface BuildTelemetry { timestamp: number; durationMs: number; filesScanned: number; filesCached: number; classesExtracted: number; nativeVersion?: string; phases: BuildPhases; cacheHitRate: number; mode?: string; } interface TelemetrySummary { totalBuilds: number; avgDurationMs: number; p95DurationMs: number; avgCacheHitRate: number; avgFilesScanned: number; avgClassesExtracted: number; phaseAvgs: BuildPhases; slowestBuildMs: number; fastestBuildMs: number; } declare class TelemetryCollector { private data; private enabled; constructor(enabled?: boolean); record(build: BuildTelemetry): void; snapshot(): BuildTelemetry[]; summary(): TelemetrySummary | null; reset(): void; /** Format ringkas untuk CLI output */ formatCli(): string; /** Export sebagai JSON untuk dashboard/prometheus */ toJSON(): object; } declare function getGlobalTelemetry(): TelemetryCollector; declare function resetGlobalTelemetry(): void; /** Helper untuk record build dengan timing otomatis */ declare function createBuildTimer(): { phase(name: keyof BuildPhases): void; finish(opts: Omit & { cacheHitRate?: number; }): BuildTelemetry; }; /** * Zod schemas untuk JSON, cache, manifest, dan config reads. * PLAN.md: "JSON, cache, manifest, and config reads should be parsed into typed schema-backed values" * * Pattern: validate at the I/O boundary, pass typed values inward. */ /** Schema untuk .tailwind-styled/scan-cache.json */ declare const ScanCacheClassEntrySchema: z.ZodObject<{ name: z.ZodString; usedIn: z.ZodArray; risk: z.ZodDefault>; bundleContribution: z.ZodDefault; variants: z.ZodDefault>; }, z.core.$strip>; type ScanCacheClassEntry = z.infer; declare const ScanCacheSchema: z.ZodObject<{ version: z.ZodDefault; generatedAt: z.ZodString; root: z.ZodString; classNames: z.ZodArray; risk: z.ZodDefault>; bundleContribution: z.ZodDefault; variants: z.ZodDefault>; }, z.core.$strip>>; totalFiles: z.ZodNumber; uniqueCount: z.ZodNumber; }, z.core.$strip>; type ScanCache = z.infer; declare const TailwindConfigSchema: z.ZodObject<{ content: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ files: z.ZodArray; transform: z.ZodOptional>; }, z.core.$strip>]>>>; theme: z.ZodOptional>; plugins: z.ZodOptional>; darkMode: z.ZodOptional, z.ZodLiteral<"media">, z.ZodLiteral]>>; prefix: z.ZodOptional; safelist: z.ZodOptional; }, z.core.$strip>]>>>; blocklist: z.ZodOptional>; }, z.core.$loose>; type TailwindConfig = z.infer; declare const RegistryPluginEntrySchema: z.ZodObject<{ name: z.ZodString; description: z.ZodString; version: z.ZodString; tags: z.ZodDefault>; official: z.ZodDefault; docs: z.ZodOptional; install: z.ZodOptional; integrity: z.ZodOptional; }, z.core.$strip>; type RegistryPluginEntry = z.infer; declare const RegistryFileSchema: z.ZodObject<{ version: z.ZodString; official: z.ZodDefault>; official: z.ZodDefault; docs: z.ZodOptional; install: z.ZodOptional; integrity: z.ZodOptional; }, z.core.$strip>>>; community: z.ZodDefault>; official: z.ZodDefault; docs: z.ZodOptional; install: z.ZodOptional; integrity: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>; type RegistryFile = z.infer; declare const PackageJsonSchema: z.ZodObject<{ name: z.ZodString; version: z.ZodString; scripts: z.ZodOptional>; dependencies: z.ZodOptional>; devDependencies: z.ZodOptional>; peerDependencies: z.ZodOptional>; main: z.ZodOptional; module: z.ZodOptional; exports: z.ZodOptional; type: z.ZodOptional>; }, z.core.$loose>; type PackageJson = z.infer; /** * Parse JSON string dengan schema validation. * Melempar error yang human-readable jika gagal. * * @example * const cache = parseJsonWithSchema( * fs.readFileSync(".tailwind-styled/scan-cache.json", "utf-8"), * ScanCacheSchema, * "scan-cache.json" * ) */ declare function parseJsonWithSchema(jsonString: string, schema: z.ZodType, sourceName: string): T; /** * Parse JSON file dengan schema validation. * * @example * const pkg = parseJsonFileWithSchema("package.json", PackageJsonSchema) */ declare function parseJsonFileWithSchema(filePath: string, schema: z.ZodType): T; /** * Worker/bootstrap path resolution untuk artifact release safety. * Dari monorepo checklist: "Perkuat worker/bootstrap path agar artifact release aman" * * Masalah: path ke worker/loader script bisa berbeda antara: * - Development (src/*.ts) * - Built dist (dist/*.js / dist/*.cjs) * - Packed npm artifact (dist/ saja, tanpa src/) * * Solusi: resolve path secara hierarchical dengan fallback yang eksplisit. */ interface WorkerPathOptions { /** Nama file worker tanpa extension */ basename: string; /** Import meta URL dari caller module */ importMetaUrl: string; /** Extensions yang dicoba secara urutan (default: [".cjs", ".js", ".mjs"]) */ extensions?: string[]; /** Sub-directories relatif dari runtimeDir yang dicoba */ subdirs?: string[]; /** Throw jika tidak ditemukan (default: true) */ required?: boolean; } interface WorkerPathResult { /** Absolute path ke worker file */ path: string; /** Extension yang ditemukan */ extension: string; /** Apakah ini dari CJS atau ESM artifact */ format: "cjs" | "esm"; } /** * Resolve worker/loader script path yang aman untuk release artifacts. * * Prioritas: * 1. CJS (.cjs) — untuk Node.js workers yang butuh require() * 2. JS (.js) — bundled output * 3. MJS (.mjs) — explicit ESM * * @example * const workerPath = resolveWorkerPath({ * basename: "scanner-worker", * importMetaUrl: import.meta.url, * }) * // → "/path/to/dist/scanner-worker.cjs" */ declare function resolveWorkerPath(opts: WorkerPathOptions): WorkerPathResult; /** * Resolve loader path (untuk webpack/rspack/vite loaders). * Same as resolveWorkerPath but dengan nama yang lebih eksplisit. */ declare function resolveLoaderPath(loaderBasename: string, importMetaUrl: string): string; /** * Codegen helpers untuk tailwind-styled-v4. * Dari monorepo checklist: "Tambahkan helper codegen bila memang relevan" * * Berguna untuk: * - Generate component boilerplate dari config * - Generate type definitions dari variant schemas * - Generate Storybook stories dari cv() configs * - Generate migration codemods * * Design: tidak ada coupling ke compiler — hanya string manipulation. */ interface ComponentCodegenOptions { /** Nama komponen (PascalCase) */ name: string; /** HTML tag */ tag?: string; /** Base classes */ base?: string; /** Variant definitions */ variants?: Record>; /** Default variants */ defaultVariants?: Record; /** Compound variants */ compoundVariants?: Array<{ class: string; [key: string]: string; }>; /** Framework target */ framework?: "react" | "vue" | "svelte" | "vanilla"; /** Include TypeScript types */ withTypes?: boolean; /** Include Storybook story */ withStory?: boolean; } /** * Generate cv() component boilerplate. * * @example * const code = generateComponentCode({ * name: "Button", * tag: "button", * base: "px-4 py-2 rounded font-medium", * variants: { * intent: { primary: "bg-blue-500 text-white", danger: "bg-red-500 text-white" }, * size: { sm: "h-8 text-sm", lg: "h-12 text-lg" }, * }, * defaultVariants: { intent: "primary", size: "sm" }, * }) */ declare function generateComponentCode(opts: ComponentCodegenOptions): string; /** * Generate Storybook stories dari component config. * * @example * const stories = generateStorybookStory({ name: "Button", ... }) */ declare function generateStorybookStory(opts: ComponentCodegenOptions): string; /** * Generate migration codemod untuk class renames. * Berguna saat ada class yang deprecated atau diganti nama. * * @example * const codemod = generateClassRenameCodemod({ * "btn-primary": "bg-blue-500 text-white", * "btn-danger": "bg-red-500 text-white", * }) */ declare function generateClassRenameCodemod(renames: Record, opts?: { format?: "jscodeshift" | "regex"; filename?: string; }): string; /** * Generate index barrel file untuk sebuah directory. * * @example * const barrel = generateBarrelFile(["Button", "Card", "Input"], "src/components") */ declare function generateBarrelFile(exports: string[], dir: string, opts?: { includeTypes?: boolean; }): string; /** * Prebuilt binary resolution untuk native NAPI bindings. * QA #1: Resolve native binary dari prebuilt packages atau local build. * * Prioritas: * 1. TW_NATIVE_PATH env var (explicit override) * 2. Prebuilt binary dari platform-specific npm package * 3. Local build dari source (developer mode) */ interface NativeResolutionResult { path: string | null; source: "env" | "prebuilt" | "local" | "not-found"; platform: string; tried: string[]; } /** * Resolve native binary path dari semua sumber yang tersedia. * * @example * const result = resolveNativeBinary() * if (result.path) { * const binding = require(result.path) * } else { * throw new Error("Native binding not found — run npm run build:rust") * } */ declare function resolveNativeBinary(runtimeDir?: string): NativeResolutionResult; /** * Format human-readable error untuk "binary not found". */ declare function formatNativeNotFoundError(result: NativeResolutionResult): string; /** * Shared observability contract lintas CLI, dashboard, dan devtools. * Dari execution-log: "Stabilkan shared observability contract" * * Semua surface inspection (CLI why, DevTools trace, dashboard /inspect) * menggunakan type contract yang sama di sini. */ interface ClassProperty { property: string; value: string; } interface ClassUsageLocation { file: string; line: number; column: number; usage: "direct" | "variant" | "component"; } /** Unified inspection result - dipakai oleh CLI, DevTools, Dashboard */ interface ClassInspection { className: string; /** CSS properties yang di-set oleh class ini */ properties: ClassProperty[]; /** Konflik dengan class lain (property conflicts) */ conflicts: string[]; /** Files yang menggunakan class ini */ usedIn: ClassUsageLocation[]; /** Risk level untuk removal */ risk: "low" | "medium" | "high"; /** Estimated bundle contribution dalam bytes */ bundleBytes: number; /** Raw CSS string */ css: string; /** Variant chain (hover:, md:, dll) */ variants: string[]; /** Timestamp */ inspectedAt: number; } interface BuildPhaseTrace { phase: "scan" | "compile" | "engine" | "output"; durationMs: number; filesProcessed?: number; classesFound?: number; } interface BuildTrace { buildId: string; totalDurationMs: number; phases: BuildPhaseTrace[]; classCount: number; fileCount: number; cacheHitRate: number; mode: string; timestamp: number; } interface DashboardMetrics { buildMs: number; scanMs: number; analyzeMs: number; compileMs: number; classCount: number; fileCount: number; mode: string; cacheHitRate?: number; nativeVersion?: string; } interface DashboardSummary { totalBuilds: number; avgBuildMs: number; p95BuildMs: number; avgCacheHitRate: number; lastBuild: DashboardMetrics | null; } interface ObservabilityClient { /** Fetch class inspection dari dashboard */ inspectClass(className: string): Promise; /** Fetch current metrics */ getMetrics(): Promise; /** Fetch summary */ getSummary(): Promise; /** Fetch build history */ getHistory(): Promise; } /** Buat observability client yang connect ke dashboard server */ declare function createObservabilityClient(opts?: { baseUrl?: string; timeoutMs?: number; }): ObservabilityClient; /** * staticStateExtractor.ts — Build-time State CSS Pre-generator * * Mengkoordinasi pipeline untuk mengeliminasi runtime CSS injection untuk `states` config. * * Flow: * 1. Walk semua source files (.ts/.tsx/.js/.jsx) * 2. Per file: panggil `extractTwStateConfigs()` (Rust NAPI) * → temukan semua `tw.tag({ states: {...} })` calls * 3. Kumpulkan semua configs, panggil `generateStaticStateCss()` (Rust NAPI) * → compute hash identik dengan runtime stateEngine.ts * → generate CSS rules dengan selector `.tw-s-[hash][data-stateName="true"]` * 4. Append hasilnya ke safelist CSS file * * Hasilnya: browser load state CSS dari static file — ZERO runtime injection, * ZERO flicker saat component dengan states di-render. * * Dipanggil dari withTailwindStyled.ts setelah initial Tailwind CSS scan. * * @module staticStateExtractor */ interface TwStateConfigEntry { tag: string; componentName: string; statesJson: string; sourceFile: string; } interface StaticStateCssInput { tag: string; componentName: string; statesJson: string; } interface GeneratedStateRule { selector: string; declarations: string; cssRule: string; componentName: string; stateName: string; } interface StaticStateExtractionResult { /** Total source files di-scan */ filesScanned: number; /** Files yang punya tw() state configs */ filesWithStates: number; /** Total komponen dengan states ditemukan */ componentsFound: number; /** Total CSS rules yang di-generate */ rulesGenerated: number; /** Rules yang tidak bisa di-resolve (butuh Tailwind full pipeline) */ rulesSkipped: number; /** CSS yang siap di-append ke safelist file */ generatedCss: string; /** Debug: semua rules yang di-generate */ rules: GeneratedStateRule[]; } /** * Scan semua source files di `srcDir`, extract tw() state configs, * generate static CSS, dan return hasilnya. * * @param srcDir Root directory untuk scan (biasanya `process.cwd()/src`) * @param options Optional configuration */ declare function extractStaticStateCss(srcDir: string, options?: { /** Emit debug logging */ verbose?: boolean; /** Max files untuk di-scan (default: unlimited) */ maxFiles?: number; /** * CSS output dari Tailwind pipeline (isi `_initial-scan.css`). * * Kalau di-provide, dipakai untuk resolve class names via `parseTailwindCssToClassMap` * → semua Tailwind class (termasuk `w-full`, `ring-2`, dll) bisa di-resolve dengan benar. * * Kalau tidak di-provide, fallback ke Rust resolver (hanya class sederhana yang ter-resolve). */ resolvedCss?: string; }): StaticStateExtractionResult; /** Nama file output untuk static state CSS — di-import langsung dari globals.css */ declare const TW_STATE_STATIC_FILENAME = "_tw-state-static.css"; /** * Extract static state CSS dan tulis ke file terpisah `_tw-state-static.css` * di `.next/tw-classes/_tw-state-static.css` — grouped bersama `_initial-scan.css`. * * File ini harus di-`@import` langsung dari globals.css karena berisi raw CSS * (bukan Tailwind class names), sehingga tidak bisa di-pickup oleh `@source`. * * Dipanggil dari `withTailwindStyled.ts` setelah initial Tailwind scan. * * @param srcDir Source directory untuk scan * @param safelistPath Path ke safelist CSS file — dipakai untuk derive direktori output * @param options Optional config * @returns Summary string untuk logging */ declare function appendStaticStateCssToSafelist(srcDir: string, safelistPath: string, options?: { verbose?: boolean; /** * CSS output dari Tailwind pipeline — isi dari `_initial-scan.css`. * * Wajib di-provide untuk resolve semua Tailwind class dengan benar. * Kalau tidak di-provide, fallback ke Rust resolver (class sederhana saja). */ resolvedCss?: string; }): string; declare function setGlobalLogFile(filePath: string): void; type TokenMap = Record; type VariantValue = string | number | boolean | undefined; type VariantProps = Record; type HtmlTagName = keyof HTMLElementTagNameMap; type CompoundCondition = Record; type VariantMatrix = Record>; interface Logger { warn(...args: unknown[]): void; debug(...args: unknown[]): void; error(...args: unknown[]): void; log(...args: unknown[]): void; } declare function createLogger(namespace: string): Logger; declare function createDebugLogger(namespace: string, label?: string): (msg: string) => void; type ErrorSource = "rust" | "validation" | "compile" | "io" | "config" | "unknown"; type ZodLikeIssue = { path?: readonly PropertyKey[]; message?: string; }; declare class TwError extends Error { /** @deprecated Gunakan source */ readonly domain: string; readonly source: ErrorSource; readonly code: string; readonly originalCause?: unknown; constructor(domainOrSource: string, code: string, message: string, cause?: unknown); static fromIo(code: string, message: string): TwError; static fromCompile(code: string, message: string): TwError; static fromRust(err: { code?: string; message?: string; } | Error | unknown): TwError; /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */ static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[]; }): TwError; static wrap(source: string, code: string, err: unknown): TwError; toString(): string; toJSON(): { name: string; source: string; code: string; message: string; }; toCliMessage(): string; } declare function wrapUnknownError(domain: string, code: string, error: unknown): TwError; declare function isTwError(err: unknown): err is TwError; interface LoadNativeBindingOptions { runtimeDir: string; candidates: string[]; isValid: (module: unknown) => module is T; invalidExportMessage: string; } interface LoadNativeBindingResult { binding: T | null; loadErrors: Array<{ path: string; message: string; }>; loadedPath?: string; } declare function loadNativeBinding(options: LoadNativeBindingOptions): LoadNativeBindingResult; interface ResolveCandidatesOptions { runtimeDir?: string; envVarNames?: string[]; includeDefaultCandidates?: boolean; enforceNodeExtensionForEnvPath?: boolean; /** @deprecated — ignored, kept for backward compat */ packageName?: string; } declare function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[]; declare function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string; declare function hashContent(content: string, algorithm?: string, length?: number): string; declare function formatErrorMessage(error: unknown): string; declare class LRUCache { private capacity; private cache; constructor(capacity: number); get(key: K): V | undefined; set(key: K, value: V): void; delete(key: K): boolean; has(key: K): boolean; clear(): void; entries(): IterableIterator<[K, V]>; get size(): number; } export { type BuildPhaseTrace, type BuildPhases, type BuildTelemetry, type BuildTrace, type ClassInspection, type ClassProperty, type ClassUsageLocation, type ComponentCodegenOptions, type CompoundCondition, type DashboardMetrics, type DashboardSummary, ERROR_CODES, type ErrorCode, type ErrorSource, type GeneratedStateRule, type HtmlTagName, LRUCache, type LoadNativeBindingOptions, type LoadNativeBindingResult, type Logger, NativeAnalyzerReportSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema, NativeCssCompileResultSchema, type NativeResolutionResult, NativeScanFileSchema, NativeScanResultSchema, NativeTransformResultSchema, NativeWatchResultSchema, type ObservabilityClient, type PackageJson, PackageJsonSchema, type RegistryFile, RegistryFileSchema, type RegistryPluginEntry, RegistryPluginEntrySchema, type ResolveCandidatesOptions, type ScanCache, type ScanCacheClassEntry, ScanCacheClassEntrySchema, ScanCacheSchema, type StaticStateCssInput, type StaticStateExtractionResult, TW_STATE_STATIC_FILENAME, type TailwindConfig, TailwindConfigSchema, type TailwindInfo, TelemetryCollector, type TelemetrySummary, type TokenMap, type TraceSnapshot, type TraceSummary, TwError, type TwStateConfigEntry, type VariantMatrix, type VariantProps, type VariantValue, type WorkerPathOptions, type WorkerPathResult, appendStaticStateCssToSafelist, assertTailwindV4, calculateHealth, createBuildTimer, createDebugLogger, createEsmRequire, createLogger, createObservabilityClient, createTraceSnapshot, detectTailwind, extractStaticStateCss, formatDuration, formatErrorCode, formatErrorMessage, formatMemory, formatNativeNotFoundError, generateBarrelFile, generateClassRenameCodemod, generateComponentCode, generateStorybookStory, getBuildTimeColor, getDirname, getFilename, getGlobalTelemetry, getHealthColor, getMemoryColor, getModeColor, getPipelinePercentages, getSuggestion, getTailwindVersion, hashContent, isTailwindV4, isTwError, loadNativeBinding, parseJsonFileWithSchema, parseJsonWithSchema, parseNative, resetGlobalTelemetry, resolveFromRoot, resolveLoaderPath, resolveNativeBinary, resolveNativeBindingCandidates, resolveNativeNodePath, resolveRuntimeDir, resolveWorkerPath, safeParseNative, setGlobalLogFile, tryRequire, wrapUnknownError };