tailwind-styled-v4 5.0.13 → 5.0.14

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.
Files changed (58) hide show
  1. package/dist/atomic.js +14 -14
  2. package/dist/atomic.js.map +1 -1
  3. package/dist/atomic.mjs +14 -14
  4. package/dist/atomic.mjs.map +1 -1
  5. package/dist/cli.js +14 -14
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.mjs +14 -14
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/compiler.js +14 -14
  10. package/dist/compiler.js.map +1 -1
  11. package/dist/compiler.mjs +14 -14
  12. package/dist/compiler.mjs.map +1 -1
  13. package/dist/engine.js +14 -14
  14. package/dist/engine.js.map +1 -1
  15. package/dist/engine.mjs +14 -14
  16. package/dist/engine.mjs.map +1 -1
  17. package/dist/index.browser.mjs +3 -1
  18. package/dist/index.browser.mjs.map +1 -1
  19. package/dist/index.js +45 -25
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +45 -25
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/next.js +14 -14
  24. package/dist/next.js.map +1 -1
  25. package/dist/next.mjs +14 -14
  26. package/dist/next.mjs.map +1 -1
  27. package/dist/shared.d.mts +3 -2
  28. package/dist/shared.d.ts +3 -2
  29. package/dist/shared.js +14 -14
  30. package/dist/shared.js.map +1 -1
  31. package/dist/shared.mjs +14 -14
  32. package/dist/shared.mjs.map +1 -1
  33. package/dist/svelte.js +42 -24
  34. package/dist/svelte.js.map +1 -1
  35. package/dist/svelte.mjs +42 -24
  36. package/dist/svelte.mjs.map +1 -1
  37. package/dist/turbopackLoader.js +14 -14
  38. package/dist/turbopackLoader.js.map +1 -1
  39. package/dist/turbopackLoader.mjs +14 -14
  40. package/dist/turbopackLoader.mjs.map +1 -1
  41. package/dist/tw.js +14 -14
  42. package/dist/tw.js.map +1 -1
  43. package/dist/tw.mjs +14 -14
  44. package/dist/tw.mjs.map +1 -1
  45. package/dist/vite.js +14 -14
  46. package/dist/vite.js.map +1 -1
  47. package/dist/vite.mjs +14 -14
  48. package/dist/vite.mjs.map +1 -1
  49. package/dist/vue.js +42 -24
  50. package/dist/vue.js.map +1 -1
  51. package/dist/vue.mjs +42 -24
  52. package/dist/vue.mjs.map +1 -1
  53. package/dist/webpackLoader.js +14 -14
  54. package/dist/webpackLoader.js.map +1 -1
  55. package/dist/webpackLoader.mjs +14 -14
  56. package/dist/webpackLoader.mjs.map +1 -1
  57. package/package.json +3 -2
  58. package/native/index.node +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/domain/shared/src/native-resolution.ts","../packages/domain/shared/src/index.ts","../packages/domain/compiler/src/nativeBridge.ts","../packages/domain/compiler/src/compiler/cssGeneratorNative.ts","../packages/domain/compiler/src/compiler/compilationNative.ts","../packages/domain/compiler/src/compiler/cssCompilationNative.ts","../packages/domain/compiler/src/compiler/idRegistryNative.ts","../packages/domain/compiler/src/compiler/streamingNative.ts","../packages/domain/compiler/src/compiler/tailwindEngine.ts","../packages/domain/compiler/src/compiler/index.ts","../packages/domain/compiler/src/parser/index.ts","../packages/domain/compiler/src/analyzer/analyzerNative.ts","../packages/domain/compiler/src/analyzer/themeResolutionNative.ts","../packages/domain/compiler/src/analyzer/scannerNative.ts","../packages/domain/compiler/src/analyzer/index.ts","../packages/domain/compiler/src/cache/cacheNative.ts","../packages/domain/compiler/src/cache/index.ts","../packages/domain/compiler/src/redis/redisNative.ts","../packages/domain/compiler/src/redis/index.ts","../packages/domain/compiler/src/watch/watchSystemNative.ts","../packages/domain/compiler/src/watch/index.ts","../packages/domain/compiler/src/index.ts","../packages/domain/compiler/src/internal.ts","../packages/presentation/next/src/turbopackLoader.ts"],"names":["fs","path","createRequire","fileURLToPath","init_src","runCssPipeline","batchExtractClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,WAAA,GAAsB;AAC7B,EAAA,I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CAAoB,IAAA,CAAK,YAAA,EAAc,MAAA,CAAO,OAAO,CAAA;AAGrD,MAAA,oBAAA,CAAqB,OAAA,CAAQ,YAAA,EAAc,IAAA,CAAK,YAAA,EAAc,OAAO,OAAO,CAAA;AAAA,IAC9E;AAGA,IAAA,IAAI,MAAA,CAAO,SAAA,IAAa,OAAA,CAAQ,YAAA,EAAc;AAC5C,MAAA,qBAAA,CAAsB,MAAA,CAAO,SAAA,EAAW,OAAA,CAAQ,YAAY,CAAA;AAAA,IAC9D;AAGA,IAAA,IAAI,CAAC,SAAA,EAAW,OAAO,MAAA,CAAO,IAAA;AAG9B,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,kDAAkD,EAAE,CAAA;AACtF,IAAA,OAAO,SAAA,GAAY,KAAA;AAAA,EACrB,SAAS,GAAA,EAAK;AAEZ,IAAA,MAAM,MAAM,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC3D,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,iCAAA,EAAoC,QAAQ,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAA;AAAA,IACrE;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"turbopackLoader.js","sourcesContent":["/**\r\n * Prebuilt binary resolution untuk native NAPI bindings.\r\n * QA #1: Resolve native binary dari prebuilt packages atau local build.\r\n *\r\n * Prioritas:\r\n * 1. TW_NATIVE_PATH env var (explicit override)\r\n * 2. Prebuilt binary dari platform-specific npm package\r\n * 3. Local build dari source (developer mode)\r\n */\r\n\r\nimport { createRequire } from \"node:module\"\r\nimport * as fs from \"node:fs\"\r\nimport * as path from \"node:path\"\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require — works in both ESM and CJS contexts\r\nconst _require = typeof require !== \"undefined\" ? require : createRequire(import.meta.url)\r\n\r\nexport interface NativeResolutionResult {\r\n path: string | null\r\n source: \"env\" | \"prebuilt\" | \"local\" | \"not-found\"\r\n platform: string\r\n tried: string[]\r\n}\r\n\r\n/** Platform key → prebuilt npm package name */\r\nconst PLATFORM_MAP: Record<string, string[]> = {\r\n \"linux-x64\": [\"@tailwind-styled/native-linux-x64-gnu\", \"@tailwind-styled/native-linux-x64\"],\r\n \"linux-arm64\": [\"@tailwind-styled/native-linux-arm64-gnu\", \"@tailwind-styled/native-linux-arm64\"],\r\n \"darwin-x64\": [\"@tailwind-styled/native-darwin-x64\"],\r\n \"darwin-arm64\": [\"@tailwind-styled/native-darwin-arm64\"],\r\n \"win32-x64\": [\"@tailwind-styled/native-win32-x64-msvc\", \"@tailwind-styled/native-win32-x64\"],\r\n \"win32-arm64\": [\"@tailwind-styled/native-win32-arm64-msvc\", \"@tailwind-styled/native-win32-arm64\"],\r\n}\r\n\r\nfunction platformKey(): string {\r\n if (isBrowser) return \"browser\"\r\n return `${process.platform}-${process.arch}`\r\n}\r\n\r\n/**\r\n * Resolve native binary path dari semua sumber yang tersedia.\r\n *\r\n * @example\r\n * const result = resolveNativeBinary()\r\n * if (result.path) {\r\n * const binding = require(result.path)\r\n * } else {\r\n * throw new Error(\"Native binding not found — run npm run build:rust\")\r\n * }\r\n */\r\nexport function resolveNativeBinary(runtimeDir?: string): NativeResolutionResult {\r\n const platform = platformKey()\r\n const tried: string[] = []\r\n\r\n if (isBrowser) {\r\n return { path: null, source: \"not-found\", platform, tried: [\"not available in browser\"] }\r\n }\r\n\r\n // 0. Disabled flag — always short-circuit before any I/O\r\n // TWS_NO_NATIVE adalah nama canonical; TWS_DISABLE_NATIVE diterima untuk backward compat\r\n if (process.env.TWS_NO_NATIVE === \"1\" || process.env.TWS_DISABLE_NATIVE === \"1\") {\r\n return { path: null, source: \"not-found\", platform, tried: [] }\r\n }\r\n\r\n // 1. Env var override\r\n const envPath = process.env.TW_NATIVE_PATH?.trim()\r\n if (envPath) {\r\n if (fs.existsSync(envPath)) {\r\n return { path: envPath, source: \"env\", platform, tried }\r\n }\r\n tried.push(`env:${envPath} (not found)`)\r\n }\r\n\r\n // 2. Prebuilt binary dari platform-specific npm package\r\n const prebuiltPkgs = PLATFORM_MAP[platform] ?? []\r\n for (const pkg of prebuiltPkgs) {\r\n try {\r\n const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"prebuilt\", platform, tried }\r\n }\r\n tried.push(`prebuilt:${pkg} (resolved but missing)`)\r\n } catch {\r\n tried.push(`prebuilt:${pkg} (not installed)`)\r\n }\r\n }\r\n\r\n // 2b. .node file bundled inside this package itself (via \"files\": [\"native/*.node\"])\r\n // Covers the case where user installs tailwind-styled-v4 directly from npm\r\n // and the .node file lands at node_modules/tailwind-styled-v4/native/*.node\r\n const napiPlatform = platform === \"linux-x64\" ? \"linux-x64-gnu\"\r\n : platform === \"linux-arm64\" ? \"linux-arm64-gnu\"\r\n : platform\r\n const BINARY_NAMES_SELF = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n if (runtimeDir) {\r\n // runtimeDir is typically dist/ — go up to package root, then into native/\r\n for (const depth of [\"..\", path.join(\"..\", \"..\"), path.join(\"..\", \"..\", \"..\")]) {\r\n const pkgRoot = path.resolve(runtimeDir, depth)\r\n for (const bin of BINARY_NAMES_SELF) {\r\n for (const suffix of [\"\", `.${platform}`, `.${napiPlatform}`]) {\r\n const candidate = path.resolve(pkgRoot, \"native\", `${bin}${suffix}.node`)\r\n tried.push(`self-bundled:${candidate}`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"prebuilt\", platform, tried }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // 3. Local build candidates\r\n const cwd = process.cwd()\r\n const base = runtimeDir ?? cwd\r\n // napi-rs naming: platform key may have -gnu suffix on Linux (already computed above)\r\n\r\n // Both possible binary names:\r\n // - \"tailwind_styled_parser\" (old hardcoded name in resolvers)\r\n // - \"tailwind-styled-native\" (actual binaryName in native/package.json)\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n\r\n const localCandidates: string[] = []\r\n\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(base, `${bin}.node`))\r\n localCandidates.push(path.resolve(base, \"..\", `${bin}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`))\r\n }\r\n\r\n // Walk up from cwd AND base to find repo root native/ dir\r\n // Needed when npm workspaces sets cwd to the package subdir\r\n for (const startDir of [cwd, base]) {\r\n let dir = startDir\r\n for (let i = 0; i < 6; i++) {\r\n const nativeDir = path.resolve(dir, \"native\")\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, \"target\", \"release\", `${bin}.node`))\r\n }\r\n const parent = path.resolve(dir, \"..\")\r\n if (parent === dir) break\r\n dir = parent\r\n }\r\n }\r\n\r\n for (const candidate of localCandidates) {\r\n tried.push(`local:${candidate}`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"local\", platform, tried }\r\n }\r\n }\r\n\r\n return { path: null, source: \"not-found\", platform, tried }\r\n}\r\n\r\n/**\r\n * Format human-readable error untuk \"binary not found\".\r\n */\r\nexport function formatNativeNotFoundError(result: NativeResolutionResult): string {\r\n const lines = [\r\n `[tailwind-styled] Native binding not found for ${result.platform}`,\r\n ``,\r\n `Tried:`,\r\n ...result.tried.map(t => ` - ${t}`),\r\n ``,\r\n `Solutions:`,\r\n ` 1. Build locally: npm run build:rust`,\r\n ` 2. Install prebuilt: npm install @tailwind-styled/native-${result.platform}`,\r\n ` 3. Override path: TW_NATIVE_PATH=/path/to/parser.node`,\r\n ]\r\n return lines.join(\"\\n\")\r\n}","import { createHash } from \"node:crypto\"\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { fileURLToPath } from \"node:url\"\r\nimport { createRequire } from \"node:module\"\r\n\r\n// Native-only: Node.js is always available. No browser fallback.\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type TokenMap = Record<string, string>\r\n\r\nexport type VariantValue = string | number | boolean | undefined\r\n\r\nexport type VariantProps = Record<string, VariantValue>\r\n\r\nexport type HtmlTagName = keyof HTMLElementTagNameMap\r\n\r\nexport type CompoundCondition = Record<string, string | number | boolean>\r\n\r\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Logging\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface Logger {\r\n warn(...args: unknown[]): void\r\n debug(...args: unknown[]): void\r\n error(...args: unknown[]): void\r\n log(...args: unknown[]): void\r\n}\r\n\r\nexport function createLogger(namespace: string): Logger {\r\n const prefix = `[${namespace}]`\r\n return {\r\n warn(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n debug(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n error(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n log(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n }\r\n}\r\n\r\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\r\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\r\n return (msg: string) => {\r\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\r\n console.debug(prefix, msg)\r\n }\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error handling\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\r\n\r\ntype ZodLikeIssue = {\r\n path?: readonly PropertyKey[]\r\n message?: string\r\n}\r\n\r\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\r\n if (!path || path.length === 0) return \"(root)\"\r\n return path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n}\r\n\r\nexport class TwError extends Error {\r\n /** @deprecated Gunakan source */\r\n public readonly domain: string\r\n public readonly source: ErrorSource\r\n public readonly code: string\r\n public readonly originalCause?: unknown\r\n\r\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\r\n super(message)\r\n this.name = \"TwError\"\r\n this.domain = domainOrSource\r\n this.source = domainOrSource as ErrorSource\r\n this.code = code\r\n this.originalCause = cause\r\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\r\n }\r\n\r\n static fromIo(code: string, message: string): TwError {\r\n return new TwError(\"io\", code, message)\r\n }\r\n\r\n static fromCompile(code: string, message: string): TwError {\r\n return new TwError(\"compile\", code, message)\r\n }\r\n\r\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\r\n if (err && typeof err === \"object\") {\r\n const e = err as { code?: string; message?: string }\r\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\r\n }\r\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\r\n }\r\n\r\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\r\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\r\n const first = err.issues?.[0] ?? err.errors?.[0]\r\n const path = formatIssuePath(first?.path)\r\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\r\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\r\n }\r\n\r\n static wrap(source: string, code: string, err: unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(source, code, err.message, err)\r\n return new TwError(source, code, String(err), err)\r\n }\r\n\r\n override toString(): string {\r\n return `TwError [${this.source}:${this.code}] ${this.message}`\r\n }\r\n\r\n toJSON(): { name: string; source: string; code: string; message: string } {\r\n return { name: this.name, source: this.source, code: this.code, message: this.message }\r\n }\r\n\r\n toCliMessage(): string {\r\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\r\n }\r\n}\r\n\r\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\r\n return TwError.wrap(domain, code, error)\r\n}\r\n\r\nexport function isTwError(err: unknown): err is TwError {\r\n return err instanceof TwError\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Native binding resolution\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface LoadNativeBindingOptions<T> {\r\n runtimeDir: string\r\n candidates: string[]\r\n isValid: (module: unknown) => module is T\r\n invalidExportMessage: string\r\n}\r\n\r\nexport interface LoadNativeBindingResult<T> {\r\n binding: T | null\r\n loadErrors: Array<{ path: string; message: string }>\r\n loadedPath?: string\r\n}\r\n\r\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n\r\n for (const candidate of candidates) {\r\n const candidatePath = path.resolve(runtimeDir, candidate)\r\n try {\r\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\r\n continue\r\n }\r\n const mod = requireNativeModule(candidatePath)\r\n if (mod && isValid(mod)) {\r\n return { binding: mod, loadErrors, loadedPath: candidatePath }\r\n }\r\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\r\n } catch (e) {\r\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\r\n }\r\n }\r\n\r\n return { binding: null, loadErrors }\r\n}\r\n\r\nconst _require = createRequire(import.meta.url)\r\n\r\nfunction requireNativeModule(p: string): unknown {\r\n return _require(p)\r\n}\r\n\r\nexport interface ResolveCandidatesOptions {\r\n runtimeDir?: string\r\n envVarNames?: string[]\r\n includeDefaultCandidates?: boolean\r\n enforceNodeExtensionForEnvPath?: boolean\r\n /** @deprecated — ignored, kept for backward compat */\r\n packageName?: string\r\n}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n const {\r\n envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\r\n includeDefaultCandidates = true,\r\n enforceNodeExtensionForEnvPath = false,\r\n } = options\r\n // Default ke cwd kalau runtimeDir tidak disediakan\r\n const runtimeDir = options.runtimeDir || process.cwd()\r\n const candidates: string[] = []\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\r\n }\r\n }\r\n\r\n if (!includeDefaultCandidates) return candidates\r\n\r\n if (fs.existsSync(runtimeDir)) {\r\n try {\r\n for (const entry of fs.readdirSync(runtimeDir)) {\r\n if (entry.endsWith(\".node\")) candidates.push(entry)\r\n }\r\n } catch { /* ignore read errors */ }\r\n }\r\n\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\r\n : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\r\n : `${process.platform}-${process.arch}`\r\n\r\n for (const bin of BINARY_NAMES) {\r\n candidates.push(path.resolve(runtimeDir, `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\r\n // 1 level: dist/ → package-root/native/ (published npm package)\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.${napiPlatform}.node`))\r\n // cwd fallback (user project root)\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\r\n // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/ (monorepo dev)\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\r\n // 3 level fallback\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n }\r\n\r\n return Array.from(new Set(candidates))\r\n}\r\n\r\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\r\n if (dir) return path.resolve(dir)\r\n try {\r\n return path.dirname(fileURLToPath(importMetaUrl))\r\n } catch {\r\n return process.cwd()\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Hashing\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\r\n const hash = createHash(algorithm).update(content).digest(\"hex\")\r\n return length ? hash.slice(0, length) : hash\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error formatting\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function formatErrorMessage(error: unknown): string {\r\n if (error instanceof TwError) return error.toString()\r\n if (error instanceof Error) return error.message\r\n return String(error)\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport class LRUCache<K, V> {\r\n private capacity: number\r\n private cache: Map<K, V>\r\n\r\n constructor(capacity: number) {\r\n this.capacity = capacity\r\n this.cache = new Map()\r\n }\r\n\r\n get(key: K): V | undefined {\r\n if (!this.cache.has(key)) return undefined\r\n const value = this.cache.get(key)!\r\n this.cache.delete(key)\r\n this.cache.set(key, value)\r\n return value\r\n }\r\n\r\n set(key: K, value: V): void {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key)\r\n } else if (this.cache.size >= this.capacity) {\r\n const firstKey = this.cache.keys().next().value\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey)\r\n }\r\n }\r\n this.cache.set(key, value)\r\n }\r\n\r\n delete(key: K): boolean {\r\n return this.cache.delete(key)\r\n }\r\n\r\n has(key: K): boolean {\r\n return this.cache.has(key)\r\n }\r\n\r\n clear(): void {\r\n this.cache.clear()\r\n }\r\n\r\n entries(): IterableIterator<[K, V]> {\r\n return this.cache.entries()\r\n }\r\n\r\n get size(): number {\r\n return this.cache.size\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Trace Utilities\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\r\nexport {\r\n getHealthColor,\r\n getModeColor,\r\n formatMemory,\r\n formatDuration,\r\n calculateHealth,\r\n getBuildTimeColor,\r\n getMemoryColor,\r\n createTraceSnapshot,\r\n getPipelinePercentages,\r\n} from \"./trace\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Performance Telemetry\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error Codes\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { ErrorCode } from \"./error-codes\"\r\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Tailwind Compatibility\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TailwindInfo } from \"./compatibility\"\r\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\r\n\r\n// ── Native binding schemas (Zod boundary validation)\r\nexport {\r\n NativeScanFileSchema, NativeScanResultSchema,\r\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\r\n NativeCssCompileResultSchema, NativeWatchResultSchema,\r\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\r\n safeParseNative, parseNative,\r\n} from './native-schemas'\r\n\r\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\r\nexport {\r\n createEsmRequire,\r\n getDirname,\r\n getFilename,\r\n resolveFromRoot,\r\n tryRequire,\r\n resolveNativeNodePath,\r\n} from \"./esmHelpers\"\r\n\r\n// ── Performance telemetry ────────────────────────────────────────────────────\r\nexport {\r\n TelemetryCollector,\r\n getGlobalTelemetry,\r\n resetGlobalTelemetry,\r\n createBuildTimer,\r\n type BuildTelemetry,\r\n type TelemetrySummary,\r\n type BuildPhases,\r\n} from \"./telemetry\"\r\n\r\n// ── Config/JSON schema validation ─────────────────────────────────────────────\r\nexport {\r\n ScanCacheSchema,\r\n ScanCacheClassEntrySchema,\r\n TailwindConfigSchema,\r\n RegistryPluginEntrySchema,\r\n RegistryFileSchema,\r\n PackageJsonSchema,\r\n parseJsonWithSchema,\r\n parseJsonFileWithSchema,\r\n type ScanCache,\r\n type ScanCacheClassEntry,\r\n type TailwindConfig,\r\n type RegistryPluginEntry,\r\n type RegistryFile,\r\n type PackageJson,\r\n} from \"./configSchemas\"\r\n\r\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\r\nexport {\r\n resolveWorkerPath,\r\n resolveLoaderPath,\r\n type WorkerPathOptions,\r\n type WorkerPathResult,\r\n} from \"./workerResolver\"\r\n\r\n// ── Codegen helpers ───────────────────────────────────────────────────────────\r\nexport {\r\n generateComponentCode,\r\n generateStorybookStory,\r\n generateClassRenameCodemod,\r\n generateBarrelFile,\r\n type ComponentCodegenOptions,\r\n} from \"./codegen\"\r\n\r\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\r\nexport {\r\n resolveNativeBinary,\r\n formatNativeNotFoundError,\r\n type NativeResolutionResult,\r\n} from \"./native-resolution\"\r\n\r\n// ── Shared observability contract ────────────────────────────────────────────\r\nexport {\r\n createObservabilityClient,\r\n type ClassInspection,\r\n type ClassProperty,\r\n type ClassUsageLocation,\r\n type BuildTrace,\r\n type BuildPhaseTrace,\r\n type DashboardMetrics,\r\n type DashboardSummary,\r\n type ObservabilityClient,\r\n} from \"./observability\"\r\n\r\nexport {\r\n TW_STATE_STATIC_FILENAME,\r\n extractStaticStateCss,\r\n appendStaticStateCssToSafelist,\r\n type TwStateConfigEntry,\r\n type StaticStateCssInput,\r\n type GeneratedStateRule,\r\n type StaticStateExtractionResult,\r\n} from \"./staticStateExtractor\"\r\nexport { setGlobalLogFile } from \"./logger\"","/**\r\n * tailwind-styled-v5 — Native Bridge Loader\r\n *\r\n * Uses @tailwind-styled/shared for native binding resolution.\r\n * All functions require native Rust binding - no JS fallback.\r\n */\r\n\r\nimport { resolveNativeBinary, resolveRuntimeDir } from \"@tailwind-styled/shared\"\r\n\r\n// require() is safe here — tsup banner injects CJS-compatible require into ESM output.\r\n// See tsup.config.ts esbuildOptions banner for how this is set up.\r\nconst _loadNative = (path: string): unknown => require(path)\r\n\r\nexport interface ComponentMetadata {\r\n component: string\r\n tag: string\r\n baseClass: string\r\n subComponents: Record<string, { tag?: string; class: string }>\r\n}\r\n\r\nexport interface NativeRscResult {\r\n isServer: boolean\r\n needsClientDirective: boolean\r\n clientReasons: string[]\r\n}\r\n\r\nconst log = (...args: unknown[]) => {\r\n if (process.env.DEBUG?.includes(\"compiler:native\")) {\r\n console.log(\"[compiler:native]\", ...args)\r\n }\r\n}\r\n\r\n// ── Structured Type Definitions ─────────────────────────────────────────────\r\n\r\nexport interface ScanWorkspaceResult {\r\n files: string[]\r\n total_files: number\r\n classes: string[]\r\n unique_classes: number\r\n duration_ms: number\r\n errors: string[]\r\n}\r\n\r\nexport interface ScanFileResult {\r\n file: string\r\n classes: string[]\r\n class_count: number\r\n has_tw_usage: boolean\r\n size_bytes: number\r\n duration_ms: number\r\n}\r\n\r\nexport interface BatchExtractResult {\r\n file: string\r\n classes: string[]\r\n contentHash: string\r\n ok: boolean\r\n error?: string\r\n}\r\n\r\nexport interface SafelistCheckResult {\r\n matched: string[]\r\n unmatched: string[]\r\n safelistSize: number\r\n}\r\n\r\nexport interface PrefilterFileResult {\r\n file: string\r\n has_tw_usage: boolean\r\n duration_ms: number\r\n size_bytes: number\r\n status: \"processed\" | \"skipped\" | \"error\"\r\n error?: string\r\n}\r\n\r\nexport interface DeadCodeResult {\r\n deadInCss: string[]\r\n deadInSource: string[]\r\n liveClasses: string[]\r\n totalCssClasses: number\r\n totalSourceClasses: number\r\n}\r\n\r\nexport interface ProcessedCssResult {\r\n css: string\r\n size_bytes: number\r\n resolved_classes: string[]\r\n unknown_classes: string[]\r\n}\r\n\r\nexport interface ContainerConfig {\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n}\r\n\r\nexport interface HoistResult {\r\n code: string\r\n hoisted: string[]\r\n warnings: string[]\r\n}\r\n\r\nexport interface VariantTableResult {\r\n id: string\r\n tableJson: string\r\n keys: string[]\r\n defaultKey: string\r\n combinations: number\r\n}\r\n\r\nexport interface ClassifyResult {\r\n className: string\r\n bucket: string\r\n sortOrder: number\r\n}\r\n\r\nexport interface MergeResult {\r\n declarationsJson: string\r\n declarationString: string\r\n count: number\r\n}\r\n\r\nexport interface ClassUsageItem {\r\n className: string\r\n usageCount: number\r\n filesJson: string\r\n bundleSizeBytes: number\r\n isDeadCode: boolean\r\n}\r\n\r\nexport interface StateCssConfig {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n sourceFile: string\r\n}\r\n\r\nexport interface GeneratedStateCss {\r\n selector: string\r\n declarations: string\r\n cssRule: string\r\n componentName: string\r\n stateName: string\r\n}\r\n\r\n// ── Type Exports ────────────────────────────────────────────────────────────────\r\n\r\nexport interface NativeBridge {\r\n // CSS Compiler - New Rust implementation\r\n generateCssNative?: (classes: string[], theme_json: string) => string\r\n getCacheStats?: () => [number, number]\r\n clearThemeCache?: () => void\r\n // Core transform\r\n transformSource?: (source: string, opts?: Record<string, string>) => NativeTransformResult | null\r\n extractClassesFromSource?: (source: string) => string[]\r\n hasTwUsage?: (source: string) => boolean\r\n isAlreadyTransformed?: (source: string) => boolean\r\n // Phase 5: Scanner functions (snake_case from Rust)\r\n scan_workspace?: (root: string, extensions?: string[]) => ScanWorkspaceResult\r\n extract_classes_from_source?: (source: string) => string[]\r\n batch_extract_classes?: (filePaths: string[]) => BatchExtractResult[]\r\n check_against_safelist?: (classes: string[], safelist: string[]) => SafelistCheckResult\r\n scan_file?: (filePath: string) => ScanFileResult\r\n collect_files?: (root: string, extensions?: string[]) => string[]\r\n walk_and_prefilter_source_files?: (root: string, extensions?: string[]) => PrefilterFileResult[]\r\n generate_sub_component_types?: (root: string, outputPath?: string) => string\r\n // Class Extractor\r\n extractAllClasses?: (source: string) => string[]\r\n parseClasses?: (raw: string) => Array<{ raw: string; type: string }>\r\n // Application functions\r\n extractComponentUsage?: (source: string) => Array<{ component: string; propsJson: string }>\r\n normalizeAndDedupClasses?: (raw: string) => { normalized: string; duplicatesRemoved: number; uniqueCount: number }\r\n diffClassLists?: (previous: string[], current: string[]) => { added: string[]; removed: string[]; unchanged: string[]; hasChanges: boolean }\r\n batchExtractClasses?: (filePaths: string[]) => Array<{ file: string; classes: string[]; contentHash: string; ok: boolean; error?: string }>\r\n checkAgainstSafelist?: (classes: string[], safelist: string[]) => { matched: string[]; unmatched: string[]; safelistSize: number }\r\n // Batch 2\r\n hoistComponents?: (source: string) => HoistResult\r\n compileVariantTable?: (configJson: string) => VariantTableResult\r\n classifyAndSortClasses?: (classes: string[]) => ClassifyResult[]\r\n mergeCssDeclarations?: (cssChunks: string[]) => MergeResult\r\n analyzeClassUsage?: (classes: string[], scanResultJson: string, css: string) => ClassUsageItem[]\r\n analyzeRsc?: (source: string, filename: string) => {\r\n isServer: boolean\r\n needsClientDirective: boolean\r\n clientReasons: string[]\r\n }\r\n analyzeClasses?: (\r\n filesJson: string,\r\n cwd: string,\r\n flags: number\r\n ) => {\r\n css?: string\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rscJson?: string\r\n metadataJson?: string\r\n safelist?: string[]\r\n } | null\r\n // CSS compilation\r\n compileCss?: (classes: string[], prefix?: string | null) => { css: string; classes: string[] }\r\n compileCssLightning?: (classes: string[]) => string\r\n /** Post-process raw Tailwind-generated CSS dengan LightningCSS di Rust */\r\n detectDeadCode?: (scanResultJson: string, css: string) => DeadCodeResult\r\n processTailwindCssLightning?: (css: string) => ProcessedCssResult\r\n processTailwindCssWithTargets?: (css: string, targets: string | null) => { css: string; size_bytes: number }\r\n // Atomic CSS (atomic.rs)\r\n parseAtomicClass?: (twClass: string) => string | null\r\n generateAtomicCss?: (rulesJson: string) => string\r\n toAtomicClasses?: (twClasses: string) => string\r\n clearAtomicRegistry?: () => void\r\n atomicRegistrySize?: () => number\r\n // Impact analysis (impact_analysis.rs)\r\n calculateImpact?: (impactJson: string) => string\r\n calculateRisk?: (className: string, totalComponents: number) => string\r\n calculateSavings?: (bundleSizeBytes: number, componentCount: number) => number\r\n // Static state CSS pre-generation (state_css.rs)\r\n extractTwStateConfigs?: (source: string, filename: string) => StateCssConfig[]\r\n generateStaticStateCss?: (inputs: Array<{\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n }>, resolvedCss: string | null) => GeneratedStateCss[]\r\n extractAndGenerateStateCss?: (source: string, filename: string) => GeneratedStateCss[]\r\n /**\r\n * Convert layout/utility class string ke CSS declarations.\r\n * Dipakai oleh extractContainerCssFromSource sebagai Rust-accelerated fallback.\r\n */\r\n layoutClassesToCss?: (classes: string) => string\r\n /**\r\n * Hash string dengan algoritma tertentu, return n karakter pertama.\r\n * Dipakai untuk generate deterministic container CSS IDs.\r\n */\r\n hashContent?: (input: string, algo: string, length: number) => string\r\n /** Hapus dead CSS selectors + minify via Lightning CSS. */\r\n eliminateDeadCss?: (css: string, deadClasses: string[]) => string\r\n /** Dead code detection + strip + Lightning CSS minify dalam satu call. */\r\n optimizeCss?: (css: string) => string\r\n /** Extract tw container configs dari source untuk static @container CSS generation. */\r\n extractTwContainerConfigs?: (source: string) => Array<{\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n }>\r\n \r\n // Phase 5.1: Cache Management (9 functions)\r\n get_cache_statistics?: () => string // Returns JSON\r\n clear_all_caches?: () => void\r\n clear_parse_cache?: () => void\r\n clear_resolve_cache?: () => void\r\n clear_compile_cache?: () => void\r\n clear_css_gen_cache?: () => void\r\n get_cache_optimization_hints?: (hit_rate_percent: number, memory_used_mb: number) => string // Returns JSON\r\n estimate_optimal_cache_config_native?: (total_budget_mb: number, workload_type: string) => string // Returns JSON\r\n cache_read?: (cache_path: string) => { entries_json: string }\r\n cache_write?: (cache_path: string, entries: Array<{ file: string; content_hash: string; classes: string[]; mtime_ms: number; size_bytes: number }>) => boolean\r\n cache_priority?: (mtime_ms: number, size_bytes: number, hit_count: number) => number\r\n \r\n // Phase 5.1: Theme Resolution Extended (7 functions)\r\n resolve_variants?: (configJson: string) => string // Returns JSON\r\n validate_variant_config?: (configJson: string) => string // Returns JSON\r\n resolve_cascade?: (baseThemeJson: string, overridesJson: string) => string // Returns JSON\r\n resolve_class_names?: (classNames: string[], themeJson: string) => string // Returns JSON\r\n resolve_conflict_group?: (groupName: string, themeJson: string) => string // Returns JSON\r\n resolve_theme_value?: (keyPath: string, themeJson: string) => string | null\r\n resolve_simple_variants?: (configJson: string) => string // Returns JSON\r\n \r\n // Phase 5.1: Streaming & Incremental Processing (8 functions)\r\n process_file_change?: (fileChangeJson: string) => string // Returns JSON\r\n compute_incremental_diff?: (oldScanJson: string, newScanJson: string) => string // Returns JSON\r\n create_fingerprint?: (filePath: string, fileContent: string) => string // Returns JSON\r\n inject_state_hash?: (css: string, stateHash: string) => string // Returns JSON\r\n prune_stale_entries?: (maxAgeSeconds: number, maxEntries: number) => string // Returns JSON\r\n rebuild_workspace_result?: (rootDir: string, extensions?: string[]) => string // Returns JSON\r\n scan_file_native?: (filePath: string, fileContent: string) => string // Returns JSON\r\n scan_files_batch_native?: (filesJson: string) => string // Returns JSON\r\n \r\n // Phase 5.2: CSS Compilation (12 functions)\r\n compile_class?: (input: string) => string // Returns JSON\r\n compile_classes?: (inputs: string[]) => string // Returns JSON\r\n compile_to_css?: (input: string, minify: boolean) => string\r\n compile_to_css_batch?: (inputs: string[], minify: boolean) => string\r\n minify_css?: (css: string) => string\r\n compile_animation?: (animationName: string, from: string, to: string) => string // Returns JSON\r\n compile_keyframes?: (name: string, stopsJson: string) => string // Returns JSON\r\n compile_theme?: (tokensJson: string, themeName: string, prefix: string) => string // Returns JSON\r\n tw_merge?: (classString: string) => string\r\n tw_merge_many?: (classStrings: string[]) => string\r\n tw_merge_with_separator?: (classString: string, options: Record<string, unknown>) => string\r\n tw_merge_many_with_separator?: (classStrings: string[], options: Record<string, unknown>) => string\r\n tw_merge_raw?: (classLists: string[]) => string\r\n \r\n // Phase 5.2: ID Registry (16 functions)\r\n id_registry_create?: () => number\r\n id_registry_generate?: (handle: number, name: string) => number\r\n id_registry_lookup?: (handle: number, name: string) => number\r\n id_registry_next?: (handle: number) => number\r\n id_registry_destroy?: (handle: number) => void\r\n id_registry_reset?: (handle: number) => void\r\n id_registry_snapshot?: (handle: number) => string // Returns JSON\r\n id_registry_active_count?: () => number\r\n register_property_name?: (propertyName: string) => number\r\n register_value_name?: (valueName: string) => number\r\n property_id_to_string?: (propertyId: number) => string\r\n value_id_to_string?: (valueId: number) => string\r\n reverse_lookup_property?: (propertyId: number) => string\r\n reverse_lookup_value?: (valueId: number) => string\r\n id_registry_export?: (handle: number) => string\r\n id_registry_import?: (importedData: string) => number\r\n \r\n // Phase 5.3: Redis Integration (40 functions)\r\n redis_ping?: () => string\r\n redis_get?: (key: string) => string\r\n redis_set?: (key: string, value: string, ttl_seconds?: number) => string\r\n redis_delete?: (key: string) => number\r\n redis_exists?: (key: string) => number\r\n redis_mget?: (keys: string[]) => string // Returns JSON\r\n redis_mset?: (pairs: Array<[string, string]>) => string\r\n redis_flush_db?: () => number\r\n redis_flush_all?: () => number\r\n redis_pool_connect?: (host: string, port: number, pool_size?: number) => string\r\n redis_pool_stats?: () => string // Returns JSON\r\n redis_pool_reconnect?: () => string\r\n redis_enable_cluster?: (initial_nodes: string[]) => string // Returns JSON\r\n redis_disable_cluster?: () => string\r\n redis_cluster_status?: () => string // Returns JSON\r\n redis_subscribe?: (channel: string) => string\r\n redis_publish?: (channel: string, message: string) => number\r\n redis_expiration_set?: (key: string, ttl_seconds: number) => number\r\n redis_expiration_get?: (key: string) => string // Returns JSON\r\n redis_info?: () => string\r\n redis_monitor?: () => string\r\n redis_cache_size?: () => number\r\n redis_cache_key_count?: () => number\r\n redis_cache_clear?: () => number\r\n redis_cache_hit_rate?: () => number\r\n redis_enable_persistence?: (mode: string) => string\r\n redis_disable_persistence?: () => string\r\n redis_snapshot?: () => string\r\n redis_memory_stats?: () => string\r\n redis_optimize_memory?: () => number\r\n redis_set_eviction_policy?: (policy: string) => string\r\n redis_get_eviction_policy?: () => string\r\n redis_replicate?: (target_host: string, target_port: number) => number\r\n redis_replication_status?: () => string\r\n redis_cache_sync?: (peers: string[]) => number\r\n redis_enable_cache_warming?: (key_pattern: string) => string\r\n redis_disable_cache_warming?: () => string\r\n redis_diagnose?: () => string\r\n \r\n // Phase 5.4: Watch System & File Monitoring (20 functions)\r\n start_watch?: (root_path: string, patterns?: string[]) => number\r\n poll_watch_events?: (handle: number, timeout_ms?: number) => string // Returns JSON\r\n stop_watch?: (handle: number) => number\r\n watch_add_pattern?: (handle: number, pattern: string) => string\r\n watch_remove_pattern?: (handle: number, pattern: string) => string\r\n watch_get_active_handles?: () => string // Returns JSON\r\n watch_clear_all?: () => number\r\n watch_event_type_to_string?: (event_type_code: number) => string\r\n is_watch_running?: (handle: number) => boolean\r\n get_watch_stats?: () => string // Returns JSON\r\n watch_pause?: (handle: number) => string\r\n watch_resume?: (handle: number) => string\r\n scan_cache_optimizations?: () => string // Returns JSON\r\n get_plugin_hooks?: () => string // Returns JSON\r\n register_plugin_hook?: (hook_name: string, handler_id: string) => string\r\n unregister_plugin_hook?: (hook_name: string, handler_id: string) => string\r\n emit_plugin_hook?: (hook_name: string, data_json: string) => string\r\n get_compilation_metrics?: () => string // Returns JSON\r\n reset_compilation_metrics?: () => string\r\n validate_css_output?: (css: string) => string // Returns JSON\r\n get_compiler_diagnostics?: () => string // Returns JSON\r\n\r\n // ── Cache Management (napi_bridge_cache.rs) ────────────────────────────────\r\n configureCacheBackend?: (configJson: string) => string\r\n getRecommendedCacheConfig?: (workloadType: string) => string\r\n clearAllCachesNapi?: () => void\r\n clearResolveCacheNapi?: () => void\r\n clearCompileCacheNapi?: () => void\r\n clearCssGenCacheNapi?: () => void\r\n getResolverPoolStats?: () => string\r\n clearResolverPool?: () => string\r\n getCacheOptimizationHints?: () => string\r\n estimateStreamingBatchSize?: (targetMemoryMb: number) => string\r\n\r\n // ── Parsing (napi_bridge_parsing.rs) ──────────────────────────────────────\r\n parseClass?: (input: string) => string\r\n compileClassNapi?: (input: string) => string\r\n getParseStats?: () => string\r\n clearParseCacheNapi?: () => void\r\n\r\n // ── Theme Parsing (napi_bridge_theme_parsing.rs) ───────────────────────────\r\n parseColorsNapi?: (colorsJson: string) => string | Record<string, string>\r\n parseSpacingNapi?: (spacingJson: string) => string | Record<string, string>\r\n parseTransformNapi?: (transformJson: string) => string | Record<string, string>\r\n normalizeColorNapi?: (color: string, opacity: string) => string\r\n sanitizeColorNapi?: (color: string) => string\r\n splitRgbaNapi?: (color: string) => string | { r: number; g: number; b: number; a: number }\r\n validateColorsNapi?: (colorsJson: string) => boolean\r\n validateBreakpointsNapi?: (breakpointsJson: string) => boolean\r\n runHealthCheck?: () => void\r\n\r\n // ── Watch (napi_bridge_watch.rs) ───────────────────────────────────────────\r\n watchFiles?: (rootDir: string, optionsJson?: string | null) => string\r\n stopWatching?: (handleId: number) => string\r\n getWatchEvents?: (handleId: number, maxEvents?: number | null) => string\r\n getWatchPerformance?: () => string\r\n clearWatchStats?: () => string\r\n getActiveWatches?: () => number\r\n setWatchMetrics?: (metricName: string, value: string) => string\r\n setWatchAggregation?: (aggregationType: string) => string\r\n\r\n // ── Week 6 Optimization (week6_api.rs) ────────────────────────────────────\r\n getOptimizationRecommendations?: (hitRate: number, memoryMb: number, classCount: number) => string\r\n estimateOptimalBatchSize?: (totalClasses: number, memoryAvailableMb: number) => number\r\n predictMemoryUsage?: (uniqueClasses: number, avgClassSizeBytes: number) => number\r\n recommendCachingStrategy?: (isSsr: boolean, memoryConstraintMb: number) => string\r\n benchmarkStreamingVsBuffered?: (classCount: number) => string\r\n getWeek6OptimizationStatus?: () => string\r\n\r\n // ── Scan Cache (scan_cache_api.rs) ────────────────────────────────────────\r\n scanCacheGet?: (filePath: string, contentHash: string) => string[] | null\r\n scanCachePut?: (filePath: string, contentHash: string, classes: string[], mtimeMs: number, size: number) => void\r\n scanCacheInvalidate?: (filePath: string) => void\r\n scanCacheStats?: () => { size: number }\r\n}\r\n\r\nexport interface NativeTransformResult {\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rscJson?: string\r\n metadataJson?: string\r\n}\r\n\r\nexport interface ClassExtractResult {\r\n classes: string[]\r\n component_names: string[]\r\n has_tw_usage: boolean\r\n has_use_client: boolean\r\n imports: string[]\r\n}\r\n\r\nconst NATIVE_UNAVAILABLE_MESSAGE =\r\n \"[tailwind-styled/compiler v5] Native binding is required but not available.\\n\" +\r\n \"This package requires native Rust bindings. There is no JavaScript fallback.\\n\" +\r\n \"Please ensure:\\n\" +\r\n \" 1. The native module is properly installed\\n\" +\r\n \" 2. You have run: npm run build:rust (or use prebuilt binary)\\n\" +\r\n \"\\n\" +\r\n \"For help, see: https://tailwind-styled.dev/docs/install\"\r\n\r\n// ── Native Bridge - Factory Pattern\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nlet nativeBridge: NativeBridge | null = null\r\nlet bridgeLoadAttempted = false\r\nlet bridgeLoadError: Error | null = null\r\n\r\nconst isValidNativeBridge = (mod: unknown): mod is NativeBridge => {\r\n const m = mod as Partial<NativeBridge>\r\n return !!(\r\n typeof m.transformSource === \"function\" ||\r\n typeof m.extractAllClasses === \"function\" ||\r\n typeof m.hasTwUsage === \"function\"\r\n )\r\n}\r\n\r\nexport const getNativeBridge = (): NativeBridge => {\r\n if (nativeBridge) {\r\n return nativeBridge\r\n }\r\n\r\n if (bridgeLoadAttempted) {\r\n if (bridgeLoadError) {\r\n throw bridgeLoadError\r\n }\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n\r\n bridgeLoadAttempted = true\r\n\r\n try {\r\n const runtimeDir = resolveRuntimeDir(undefined, import.meta.url)\r\n \r\n // Use shared's native resolution\r\n const result = resolveNativeBinary(runtimeDir)\r\n\r\n if (result.path && result.path.endsWith(\".node\")) {\r\n try {\r\n const binding = _loadNative(result.path) as NativeBridge\r\n if (isValidNativeBridge(binding)) {\r\n nativeBridge = binding\r\n log(\"Native bridge loaded successfully from:\", result.path)\r\n return nativeBridge\r\n }\r\n } catch (e) {\r\n log(\"Failed to require native binding:\", e)\r\n }\r\n }\r\n\r\n throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}\\n\\nTried paths: ${result.tried.join(\"\\n\")}`)\r\n } catch (err) {\r\n bridgeLoadError = err instanceof Error ? err : new Error(String(err))\r\n log(\"Failed to load native bridge:\", bridgeLoadError.message)\r\n throw bridgeLoadError\r\n }\r\n}\r\n\r\nexport const resetNativeBridgeCache = (): void => {\r\n nativeBridge = null\r\n bridgeLoadAttempted = false\r\n bridgeLoadError = null\r\n log(\"Native bridge cache reset\")\r\n}\r\n\r\n// ── Adaptor for native results\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport const adaptNativeResult = (\r\n raw: NativeTransformResult\r\n): {\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rsc?: NativeRscResult\r\n metadata?: ComponentMetadata[]\r\n} => {\r\n return {\r\n code: raw.code ?? \"\",\r\n classes: raw.classes ?? [],\r\n changed: raw.changed ?? false,\r\n rsc: raw.rscJson ? JSON.parse(raw.rscJson) : undefined,\r\n metadata: raw.metadataJson ? JSON.parse(raw.metadataJson) : undefined,\r\n }\r\n}\r\n\r\n// ── Eager init — load native bridge saat module dimuat, bukan saat request pertama\r\n// Mencegah crash di Turbopack dev mode karena lazy init mid-request\r\n// ─────────────────────────────────────────────────────────────────────────────\r\nif (typeof process !== \"undefined\" && !bridgeLoadAttempted) {\r\n try {\r\n getNativeBridge()\r\n } catch {\r\n // Sudah di-capture di bridgeLoadError — akan di-throw saat dipanggil pertama kali\r\n }\r\n}\r\n\r\n// ── Re-export all 63 wrapper functions from nativeBridgeWrappers\r\n// These provide complete type safety, error handling, and JSDoc documentation\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport {\r\n // Redis Cache Functions (40)\r\n redis_pool_connect,\r\n redis_pool_stats,\r\n redis_pool_reconnect,\r\n redis_ping,\r\n redis_get,\r\n redis_set,\r\n redis_delete,\r\n redis_exists,\r\n redis_mget,\r\n redis_mset,\r\n redis_flush_db,\r\n redis_flush_all,\r\n redis_cache_size,\r\n redis_cache_key_count,\r\n redis_cache_clear,\r\n redis_cache_hit_rate,\r\n redis_info,\r\n redis_monitor,\r\n redis_enable_cluster,\r\n redis_disable_cluster,\r\n redis_cluster_status,\r\n redis_expiration_set,\r\n redis_expiration_get,\r\n redis_subscribe,\r\n redis_publish,\r\n redis_enable_persistence,\r\n redis_disable_persistence,\r\n redis_snapshot,\r\n redis_replicate,\r\n redis_replication_status,\r\n redis_enable_cache_warming,\r\n redis_disable_cache_warming,\r\n redis_cache_sync,\r\n redis_set_eviction_policy,\r\n redis_get_eviction_policy,\r\n redis_memory_stats,\r\n redis_optimize_memory,\r\n redis_diagnose,\r\n // Watch System Functions (20)\r\n start_watch,\r\n poll_watch_events,\r\n stop_watch,\r\n watch_add_pattern,\r\n watch_remove_pattern,\r\n watch_pause,\r\n watch_resume,\r\n is_watch_running,\r\n get_watch_stats,\r\n watch_get_active_handles,\r\n watch_clear_all,\r\n register_plugin_hook,\r\n unregister_plugin_hook,\r\n emit_plugin_hook,\r\n get_plugin_hooks,\r\n // ID Registry Functions (16)\r\n id_registry_create,\r\n id_registry_generate,\r\n id_registry_lookup,\r\n id_registry_next,\r\n id_registry_destroy,\r\n id_registry_reset,\r\n id_registry_snapshot,\r\n id_registry_active_count,\r\n register_property_name,\r\n register_value_name,\r\n property_id_to_string,\r\n value_id_to_string,\r\n reverse_lookup_property,\r\n reverse_lookup_value,\r\n id_registry_export,\r\n id_registry_import,\r\n // Incremental Compilation Functions (8)\r\n process_file_change,\r\n compute_incremental_diff,\r\n create_fingerprint,\r\n inject_state_hash,\r\n prune_stale_entries,\r\n rebuild_workspace_result,\r\n scan_files_batch_native,\r\n // Theme Resolution Functions (7)\r\n resolve_variants,\r\n validate_variant_config,\r\n resolve_cascade,\r\n resolve_class_names,\r\n resolve_conflict_group,\r\n resolve_theme_value,\r\n resolve_simple_variants,\r\n} from \"./nativeBridgeWrappers\"","/**\r\n * cssGeneratorNative.ts\r\n *\r\n * High-performance CSS generator using Rust compiler via NAPI binding.\r\n * Rust-only implementation - no JavaScript fallback.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\nexport interface GenerateCssNativeOptions {\r\n theme: Record<string, unknown>\r\n}\r\n\r\n/**\r\n * Generate CSS from Tailwind classes using the Rust compiler.\r\n * \r\n * @param classes - Array of Tailwind class names (e.g., [\"px-4\", \"hover:bg-blue-600\"])\r\n * @param options - Configuration including theme object\r\n * @returns Promise resolving to CSS string\r\n * \r\n * @example\r\n * ```ts\r\n * const css = await generateCssNative(\r\n * [\"px-4\", \"hover:bg-blue-600\", \"md:text-lg\"],\r\n * {\r\n * theme: defaultTheme,\r\n * fallbackToJs: true,\r\n * logFallback: process.env.DEBUG === \"true\"\r\n * }\r\n * )\r\n * ```\r\n * \r\n * **Performance**: Rust compiler typically 40-60% faster than Tailwind JS\r\n * - Rust: 60-90ms for 100 classes\r\n * - JavaScript: 150ms baseline\r\n * \r\n * **Error Handling**:\r\n * - If Rust binding fails and fallbackToJs=true, falls back to Tailwind JS\r\n * - If Rust binding fails and fallbackToJs=false, throws error\r\n * - Invalid classes log warnings but don't stop compilation\r\n */\r\nexport async function generateCssNative(\r\n classes: string[],\r\n options: GenerateCssNativeOptions\r\n): Promise<string> {\r\n const { theme } = options\r\n\r\n const native = getNativeBridge()\r\n \r\n if (!native?.generateCssNative) {\r\n throw new Error(\r\n \"FATAL: Rust CSS generator (generateCssNative) is required but not available. \" +\r\n \"Ensure native binding is properly loaded. Check that native/.node binary exists.\"\r\n )\r\n }\r\n\r\n // Convert theme object to JSON string for Rust\r\n const themeJson = JSON.stringify(theme)\r\n \r\n // Call Rust compiler - no fallback, fail fast\r\n const css = native.generateCssNative(classes, themeJson)\r\n \r\n return css\r\n}\r\n\r\n/**\r\n * Get cache statistics from the Rust compiler.\r\n * \r\n * @returns Object with cache hit/miss counts, or null if binding unavailable\r\n * \r\n * @example\r\n * ```ts\r\n * const stats = getCacheStats()\r\n * if (stats) {\r\n * console.log(`Cache hits: ${stats.hits}, misses: ${stats.misses}`)\r\n * console.log(`Hit rate: ${(stats.hits / (stats.hits + stats.misses) * 100).toFixed(1)}%`)\r\n * }\r\n * ```\r\n */\r\nexport function getCacheStats(): { hits: number; misses: number } | null {\r\n try {\r\n const native = getNativeBridge()\r\n \r\n if (!native?.getCacheStats) {\r\n return null\r\n }\r\n\r\n const [hits, misses] = native.getCacheStats()\r\n return { hits, misses }\r\n } catch {\r\n return null\r\n }\r\n}\r\n\r\n/**\r\n * Clear the theme resolver cache.\r\n * \r\n * Useful for:\r\n * - Testing with different themes\r\n * - Freeing memory in long-running processes\r\n * - Resetting state between build cycles\r\n * \r\n * @example\r\n * ```ts\r\n * // Clear cache before each build\r\n * clearThemeCache()\r\n * const css = await generateCssNative(classes, { theme })\r\n * ```\r\n */\r\nexport function clearThemeCache(): void {\r\n try {\r\n const native = getNativeBridge()\r\n \r\n if (!native?.clearThemeCache) {\r\n return\r\n }\r\n\r\n native.clearThemeCache()\r\n } catch {\r\n // Silently ignore if native binding unavailable\r\n }\r\n}\r\n\r\n/**\r\n * Recommended default theme configuration for Tailwind v4.\r\n * \r\n * Use this when you need a complete theme object for the Rust compiler.\r\n */\r\nexport const DEFAULT_THEME = {\r\n colors: {\r\n slate: {\r\n \"50\": \"#f8fafc\",\r\n \"100\": \"#f1f5f9\",\r\n \"200\": \"#e2e8f0\",\r\n \"300\": \"#cbd5e1\",\r\n \"400\": \"#94a3b8\",\r\n \"500\": \"#64748b\",\r\n \"600\": \"#475569\",\r\n \"700\": \"#334155\",\r\n \"800\": \"#1e293b\",\r\n \"900\": \"#0f172a\",\r\n },\r\n // ... other colors from Tailwind defaults\r\n },\r\n spacing: {\r\n \"0\": \"0px\",\r\n \"1\": \"0.25rem\",\r\n \"2\": \"0.5rem\",\r\n \"3\": \"0.75rem\",\r\n \"4\": \"1rem\",\r\n \"5\": \"1.25rem\",\r\n \"6\": \"1.5rem\",\r\n \"8\": \"2rem\",\r\n \"10\": \"2.5rem\",\r\n \"12\": \"3rem\",\r\n },\r\n breakpoints: {\r\n \"sm\": \"640px\",\r\n \"md\": \"768px\",\r\n \"lg\": \"1024px\",\r\n \"xl\": \"1280px\",\r\n \"2xl\": \"1536px\",\r\n },\r\n darkMode: \"media\" as const,\r\n} as const\r\n","/**\r\n * compilationNative.ts\r\n *\r\n * Native Rust bindings for CSS compilation and advanced features.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nexport type {\r\n ContainerConfig,\r\n StateCssConfig,\r\n GeneratedStateCss,\r\n} from \"../nativeBridge\"\r\n\r\n/**\r\n * Compile Tailwind classes directly to CSS.\r\n */\r\nexport function compileCssNative2(classes: string[], prefix?: string | null) {\r\n const native = getNativeBridge()\r\n if (!native?.compileCss) throw new Error(\"compileCss not available\")\r\n return native.compileCss(classes, prefix)\r\n}\r\n\r\n/**\r\n * Compile CSS using Lightning CSS post-processing.\r\n */\r\nexport function compileCssLightning(classes: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.compileCssLightning) throw new Error(\"compileCssLightning not available\")\r\n return native.compileCssLightning(classes)\r\n}\r\n\r\n/**\r\n * Extract Tailwind state configurations from source code.\r\n */\r\nexport function extractTwStateConfigsNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwStateConfigs) throw new Error(\"extractTwStateConfigs not available\")\r\n return native.extractTwStateConfigs(source, filename)\r\n}\r\n\r\n/**\r\n * Generate static state CSS from configuration.\r\n */\r\nexport function generateStaticStateCssNative(\r\n inputs: Array<{\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n }>,\r\n resolvedCss?: string | null\r\n) {\r\n const native = getNativeBridge()\r\n if (!native?.generateStaticStateCss) throw new Error(\"generateStaticStateCss not available\")\r\n return native.generateStaticStateCss(inputs, resolvedCss ?? null)\r\n}\r\n\r\n/**\r\n * Extract and generate state CSS in one step.\r\n */\r\nexport function extractAndGenerateStateCssNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractAndGenerateStateCss) throw new Error(\"extractAndGenerateStateCss not available\")\r\n return native.extractAndGenerateStateCss(source, filename)\r\n}\r\n\r\n/**\r\n * Convert layout/utility class string to CSS declarations.\r\n */\r\nexport function layoutClassesToCss(classes: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.layoutClassesToCss) throw new Error(\"layoutClassesToCss not available\")\r\n return native.layoutClassesToCss(classes)\r\n}\r\n\r\n/**\r\n * Hash content for deterministic ID generation.\r\n */\r\nexport function hashContent(input: string, algorithm: string = \"sha256\", length: number = 8): string {\r\n const native = getNativeBridge()\r\n if (!native?.hashContent) throw new Error(\"hashContent not available\")\r\n return native.hashContent(input, algorithm, length)\r\n}\r\n\r\n/**\r\n * Extract container query configurations from source.\r\n */\r\nexport function extractTwContainerConfigs(source: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwContainerConfigs) throw new Error(\"extractTwContainerConfigs not available\")\r\n return native.extractTwContainerConfigs(source)\r\n}\r\n\r\n/**\r\n * Parse Tailwind class into atomic CSS representation.\r\n */\r\nexport function parseAtomicClass(twClass: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.parseAtomicClass) throw new Error(\"parseAtomicClass not available\")\r\n return native.parseAtomicClass(twClass)\r\n}\r\n\r\n/**\r\n * Generate atomic CSS from rules.\r\n */\r\nexport function generateAtomicCss(rulesJson: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.generateAtomicCss) throw new Error(\"generateAtomicCss not available\")\r\n return native.generateAtomicCss(rulesJson)\r\n}\r\n\r\n/**\r\n * Convert Tailwind classes to atomic CSS classes.\r\n */\r\nexport function toAtomicClasses(twClasses: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.toAtomicClasses) throw new Error(\"toAtomicClasses not available\")\r\n return native.toAtomicClasses(twClasses)\r\n}\r\n\r\n/**\r\n * Clear atomic CSS registry.\r\n */\r\nexport function clearAtomicRegistry(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clearAtomicRegistry) return\r\n native.clearAtomicRegistry()\r\n}\r\n\r\n/**\r\n * Get atomic registry size.\r\n */\r\nexport function atomicRegistrySize(): number {\r\n const native = getNativeBridge()\r\n if (!native?.atomicRegistrySize) return 0\r\n return native.atomicRegistrySize()\r\n}\r\n\r\n","/**\r\n * cssCompilationNative.ts\r\n *\r\n * Phase 5.2: Advanced CSS Compilation - Complex CSS generation and transformations\r\n * Exposes 12 CSS compilation functions for animations, themes, and merging\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Compiled CSS rule result\r\n */\r\nexport interface CompiledCssRule {\r\n selector: string\r\n declarations: string\r\n properties: Array<{ key: string; value: string }>\r\n specificity: number\r\n}\r\n\r\n/**\r\n * Compiled animation result\r\n */\r\nexport interface CompiledAnimation {\r\n animation_id: string\r\n keyframes_css: string\r\n animation_rule: string\r\n duration_ms: number\r\n}\r\n\r\n/**\r\n * Compiled theme result\r\n */\r\nexport interface CompiledTheme {\r\n selector: string\r\n variables: Array<{ name: string; value: string }>\r\n variables_css: string\r\n theme_name: string\r\n}\r\n\r\n/**\r\n * CSS compile result with metadata\r\n */\r\nexport interface CssCompileResult {\r\n css: string\r\n resolved_classes: string[]\r\n unknown_classes: string[]\r\n size_bytes: number\r\n duration_ms: number\r\n}\r\n\r\n/**\r\n * tw_merge options\r\n */\r\nexport interface TwMergeOptions {\r\n separator?: string\r\n debug?: boolean\r\n}\r\n\r\n/**\r\n * Compile a single Tailwind class to CSS rule\r\n * Full compilation pipeline: parse → resolve → generate\r\n *\r\n * @param input - Single Tailwind class (e.g., \"md:hover:bg-blue-600/50\")\r\n * @returns Compiled CSS rule as JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const rule = compileClass('md:hover:bg-blue-600')\r\n * // Returns: {\r\n * // selector: '.md\\\\:hover\\\\:bg-blue-600',\r\n * // declarations: 'background-color: #2563eb;',\r\n * // ...\r\n * // }\r\n * ```\r\n */\r\nexport function compileClass(input: string): CompiledCssRule {\r\n const native = getNativeBridge()\r\n if (!native?.compile_class) throw new Error(\"compile_class not available\")\r\n const resultJson = native.compile_class(input)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n selector: \"\",\r\n declarations: \"\",\r\n properties: [],\r\n specificity: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile multiple Tailwind classes to CSS rules\r\n * Batch processing with parallel compilation\r\n *\r\n * @param inputs - Array of Tailwind classes\r\n * @returns JSON string of compiled rules\r\n *\r\n * @example\r\n * ```ts\r\n * const rules = compileClasses(['px-4', 'bg-blue-600', 'hover:opacity-80'])\r\n * ```\r\n */\r\nexport function compileClasses(inputs: string[]): CssCompileResult {\r\n const native = getNativeBridge()\r\n if (!native?.compile_classes) throw new Error(\"compile_classes not available\")\r\n const resultJson = native.compile_classes(inputs)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n css: \"\",\r\n resolved_classes: [],\r\n unknown_classes: [],\r\n size_bytes: 0,\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * One-step: class → CSS string\r\n * Compiles and generates in single call\r\n *\r\n * @param input - Single Tailwind class\r\n * @param minify - Whether to minify output (default: false)\r\n * @returns Generated CSS string\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileToCss('bg-blue-600')\r\n * // Returns: \".bg-blue-600 { background-color: #2563eb; }\"\r\n *\r\n * const minified = compileToCss('bg-blue-600', true)\r\n * // Returns: \".bg-blue-600{background-color:#2563eb}\"\r\n * ```\r\n */\r\nexport function compileToCss(input: string, minify?: boolean): string {\r\n const native = getNativeBridge()\r\n if (!native?.compile_to_css) throw new Error(\"compile_to_css not available\")\r\n return native.compile_to_css(input, minify ?? false)\r\n}\r\n\r\n/**\r\n * Batch compile to CSS\r\n * Compiles multiple classes and generates combined CSS\r\n *\r\n * @param inputs - Array of Tailwind classes\r\n * @param minify - Whether to minify output\r\n * @returns Combined CSS string\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileToCssBatch(['px-4', 'bg-blue-600'], true)\r\n * ```\r\n */\r\nexport function compileToCssBatch(inputs: string[], minify?: boolean): string {\r\n const native = getNativeBridge()\r\n if (!native?.compile_to_css_batch) throw new Error(\"compile_to_css_batch not available\")\r\n return native.compile_to_css_batch(inputs, minify ?? false)\r\n}\r\n\r\n/**\r\n * Minify CSS string\r\n * Removes unnecessary whitespace and formatting\r\n *\r\n * @param css - Raw CSS string\r\n * @returns Minified CSS (40-60% size reduction)\r\n *\r\n * @example\r\n * ```ts\r\n * const css = \".px-4 { padding-left: 1rem; padding-right: 1rem; }\"\r\n * const minified = minifyCss(css)\r\n * // Returns: \".px-4{padding-left:1rem;padding-right:1rem}\"\r\n * ```\r\n */\r\nexport function minifyCss(css: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.minify_css) throw new Error(\"minify_css not available\")\r\n return native.minify_css(css)\r\n}\r\n\r\n/**\r\n * Compile animation from from/to states\r\n * Generates @keyframes and animation rule\r\n *\r\n * @param animationName - Animation name\r\n * @param from - From state classes (e.g., \"opacity-0 scale-95\")\r\n * @param to - To state classes (e.g., \"opacity-100 scale-100\")\r\n * @returns Compiled animation with keyframes\r\n *\r\n * @example\r\n * ```ts\r\n * const anim = compileAnimation('fade-in', 'opacity-0', 'opacity-100')\r\n * console.log(anim.keyframes_css) // @keyframes fade-in { ... }\r\n * console.log(anim.animation_rule) // animation: fade-in 300ms;\r\n * ```\r\n */\r\nexport function compileAnimation(\r\n animationName: string,\r\n from: string,\r\n to: string\r\n): CompiledAnimation {\r\n const native = getNativeBridge()\r\n if (!native?.compile_animation) throw new Error(\"compile_animation not available\")\r\n const resultJson = native.compile_animation(animationName, from, to)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n animation_id: \"\",\r\n keyframes_css: \"\",\r\n animation_rule: \"\",\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile keyframes from stop definitions\r\n * Creates @keyframes from percentage stops\r\n *\r\n * @param name - Keyframes name\r\n * @param stopsJson - JSON array of stops: `[{\"stop\":\"0%\",\"classes\":\"opacity-0\"}...]`\r\n * @returns Compiled @keyframes rule\r\n *\r\n * @example\r\n * ```ts\r\n * const kf = compileKeyframes('slide-in', JSON.stringify([\r\n * { stop: '0%', classes: 'translate-x-full' },\r\n * { stop: '100%', classes: 'translate-x-0' }\r\n * ]))\r\n * ```\r\n */\r\nexport function compileKeyframes(name: string, stopsJson: string): CompiledAnimation {\r\n const native = getNativeBridge()\r\n if (!native?.compile_keyframes) throw new Error(\"compile_keyframes not available\")\r\n const resultJson = native.compile_keyframes(name, stopsJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n animation_id: \"\",\r\n keyframes_css: \"\",\r\n animation_rule: \"\",\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile theme to CSS variables\r\n * Converts token map to CSS custom properties\r\n *\r\n * @param tokensJson - Theme tokens as JSON\r\n * @param themeName - Theme name (\"light\", \"dark\", etc.)\r\n * @param prefix - CSS variable prefix (e.g., \"tw\" → \"--tw-color-primary\")\r\n * @returns Compiled theme with variables CSS\r\n *\r\n * @example\r\n * ```ts\r\n * const theme = compileTheme(\r\n * JSON.stringify({ colors: { blue: { 600: '#2563eb' } } }),\r\n * 'light',\r\n * 'tw'\r\n * )\r\n * // Returns CSS: :root { --tw-color-blue-600: #2563eb; }\r\n * ```\r\n */\r\nexport function compileTheme(\r\n tokensJson: string,\r\n themeName: string,\r\n prefix: string\r\n): CompiledTheme {\r\n const native = getNativeBridge()\r\n if (!native?.compile_theme) throw new Error(\"compile_theme not available\")\r\n const resultJson = native.compile_theme(tokensJson, themeName, prefix)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n selector: \":root\",\r\n variables: [],\r\n variables_css: \"\",\r\n theme_name: themeName,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Merge conflicting Tailwind classes\r\n * Resolves conflicts intelligently (last-one-wins by default)\r\n *\r\n * @param classString - Space-separated class string (e.g., \"px-4 px-8 bg-red-500 bg-blue-600\")\r\n * @returns Merged classes with conflicts resolved\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMerge('px-4 px-8 bg-red-500 bg-blue-600')\r\n * // Returns: \"px-8 bg-blue-600\"\r\n * ```\r\n */\r\nexport function twMerge(classString: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge) throw new Error(\"tw_merge not available\")\r\n return native.tw_merge(classString)\r\n}\r\n\r\n/**\r\n * Merge multiple class strings\r\n * Combines and resolves conflicts across multiple strings\r\n *\r\n * @param classStrings - Array of class strings\r\n * @returns Merged result\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeMany([\r\n * 'px-4 hover:bg-blue-600',\r\n * 'px-8 hover:opacity-80'\r\n * ])\r\n * // Returns: \"px-8 hover:bg-blue-600 hover:opacity-80\"\r\n * ```\r\n */\r\nexport function twMergeMany(classStrings: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_many) throw new Error(\"tw_merge_many not available\")\r\n return native.tw_merge_many(classStrings)\r\n}\r\n\r\n/**\r\n * Merge with custom separator\r\n * Useful for non-standard class separators\r\n *\r\n * @param classString - Classes to merge\r\n * @param options - Merge options (separator, debug)\r\n * @returns Merged classes\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeWithSeparator(\r\n * 'px-4,px-8,bg-red-500,bg-blue-600',\r\n * { separator: ',' }\r\n * )\r\n * ```\r\n */\r\nexport function twMergeWithSeparator(\r\n classString: string,\r\n options: TwMergeOptions\r\n): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_with_separator)\r\n throw new Error(\"tw_merge_with_separator not available\")\r\n const opts = {\r\n separator: options.separator,\r\n debug: options.debug,\r\n }\r\n return native.tw_merge_with_separator(classString, opts)\r\n}\r\n\r\n/**\r\n * Merge many with custom separator\r\n * Batch merge with custom separator\r\n *\r\n * @param classStrings - Array of class strings\r\n * @param options - Merge options\r\n * @returns Merged result\r\n */\r\nexport function twMergeManyWithSeparator(\r\n classStrings: string[],\r\n options: TwMergeOptions\r\n): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_many_with_separator)\r\n throw new Error(\"tw_merge_many_with_separator not available\")\r\n const opts = {\r\n separator: options.separator,\r\n debug: options.debug,\r\n }\r\n return native.tw_merge_many_with_separator(classStrings, opts)\r\n}\r\n\r\n/**\r\n * Raw merge from class lists\r\n * Direct merge without preprocessing\r\n *\r\n * @param classLists - Array of class lists\r\n * @returns Merged classes\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeRaw(['px-4 px-8', 'bg-red bg-blue'])\r\n * ```\r\n */\r\nexport function twMergeRaw(classLists: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_raw) throw new Error(\"tw_merge_raw not available\")\r\n return native.tw_merge_raw(classLists)\r\n}\r\n\r\n","/**\r\n * idRegistryNative.ts\r\n *\r\n * Phase 5.2: ID Registry Management - Efficient ID generation and lookup\r\n * Exposes 16 ID registry functions for deterministic class/component identification\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Registry snapshot data\r\n */\r\nexport interface RegistrySnapshot {\r\n handle: number\r\n next_id: number\r\n entries: Array<{ name: string; id: number }>\r\n total_entries: number\r\n}\r\n\r\n/**\r\n * Create a new ID generator\r\n * Returns a handle to be used in subsequent operations\r\n *\r\n * @returns Generator handle (u32)\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * // Use handle for all subsequent operations\r\n * try {\r\n * const id = idRegistryGenerate(handle, 'MyComponent')\r\n * // ... use id ...\r\n * } finally {\r\n * idRegistryDestroy(handle) // Clean up\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryCreate(): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_create) throw new Error(\"id_registry_create not available\")\r\n return native.id_registry_create()\r\n}\r\n\r\n/**\r\n * Generate a new ID for a name\r\n * Same name always returns same ID (deterministic)\r\n *\r\n * @param handle - Generator handle from idRegistryCreate()\r\n * @param name - Identifier name (e.g., component name, class name)\r\n * @returns Generated ID\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * const id1 = idRegistryGenerate(handle, 'Button') // Returns 1\r\n * const id2 = idRegistryGenerate(handle, 'Button') // Returns 1 (same)\r\n * const id3 = idRegistryGenerate(handle, 'Card') // Returns 2 (different)\r\n * ```\r\n */\r\nexport function idRegistryGenerate(handle: number, name: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_generate) throw new Error(\"id_registry_generate not available\")\r\n return native.id_registry_generate(handle, name)\r\n}\r\n\r\n/**\r\n * Lookup existing ID for a name\r\n * Returns -1 if not found\r\n *\r\n * @param handle - Generator handle\r\n * @param name - Name to look up\r\n * @returns ID if found, -1 if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const id = idRegistryLookup(handle, 'Button')\r\n * if (id !== -1) {\r\n * console.log(`Button has ID: ${id}`)\r\n * } else {\r\n * console.log('Button not in registry yet')\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryLookup(handle: number, name: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_lookup) throw new Error(\"id_registry_lookup not available\")\r\n return native.id_registry_lookup(handle, name)\r\n}\r\n\r\n/**\r\n * Get the next ID that would be assigned\r\n * Useful for knowing how many unique IDs exist\r\n *\r\n * @param handle - Generator handle\r\n * @returns Next available ID\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Button')\r\n * idRegistryGenerate(handle, 'Card')\r\n * const nextId = idRegistryNext(handle) // Returns 2 (next available)\r\n * ```\r\n */\r\nexport function idRegistryNext(handle: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_next) throw new Error(\"id_registry_next not available\")\r\n return native.id_registry_next(handle)\r\n}\r\n\r\n/**\r\n * Destroy a registry (clean up resources)\r\n * Must be called when done with registry\r\n *\r\n * @param handle - Generator handle\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * try {\r\n * // Use registry\r\n * } finally {\r\n * idRegistryDestroy(handle)\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryDestroy(handle: number): void {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_destroy) return\r\n native.id_registry_destroy(handle)\r\n}\r\n\r\n/**\r\n * Reset registry to initial state\r\n * Clears all entries but reuses handle\r\n *\r\n * @param handle - Generator handle\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Component1')\r\n * idRegistryGenerate(handle, 'Component2')\r\n * idRegistryReset(handle) // Clear all\r\n * const id = idRegistryNext(handle) // Back to 0\r\n * ```\r\n */\r\nexport function idRegistryReset(handle: number): void {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_reset) return\r\n native.id_registry_reset(handle)\r\n}\r\n\r\n/**\r\n * Get snapshot of current registry state\r\n * Useful for serialization/debugging\r\n *\r\n * @param handle - Generator handle\r\n * @returns Snapshot with all entries\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Button')\r\n * idRegistryGenerate(handle, 'Card')\r\n * const snapshot = idRegistrySnapshot(handle)\r\n * console.log(JSON.stringify(snapshot, null, 2))\r\n * ```\r\n */\r\nexport function idRegistrySnapshot(handle: number): RegistrySnapshot {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_snapshot) throw new Error(\"id_registry_snapshot not available\")\r\n const snapshotJson = native.id_registry_snapshot(handle)\r\n try {\r\n return JSON.parse(snapshotJson)\r\n } catch {\r\n return {\r\n handle,\r\n next_id: 0,\r\n entries: [],\r\n total_entries: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Get count of active registries\r\n * Useful for monitoring resource usage\r\n *\r\n * @returns Number of active generator handles\r\n *\r\n * @example\r\n * ```ts\r\n * console.log(`Active registries: ${idRegistryActiveCount()}`)\r\n * ```\r\n */\r\nexport function idRegistryActiveCount(): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_active_count) throw new Error(\"id_registry_active_count not available\")\r\n return native.id_registry_active_count()\r\n}\r\n\r\n/**\r\n * Register a property name with global registry\r\n * Maps property names to consistent IDs\r\n *\r\n * @param propertyName - Property name (e.g., \"background-color\")\r\n * @returns Assigned property ID\r\n *\r\n * @example\r\n * ```ts\r\n * const bgColorId = registerPropertyName('background-color')\r\n * const paddingId = registerPropertyName('padding')\r\n * ```\r\n */\r\nexport function registerPropertyName(propertyName: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.register_property_name)\r\n throw new Error(\"register_property_name not available\")\r\n return native.register_property_name(propertyName)\r\n}\r\n\r\n/**\r\n * Register a value name with global registry\r\n * Maps values to consistent IDs\r\n *\r\n * @param valueName - Value name (e.g., \"blue-600\")\r\n * @returns Assigned value ID\r\n *\r\n * @example\r\n * ```ts\r\n * const blueId = registerValueName('blue-600')\r\n * const redId = registerValueName('red-500')\r\n * ```\r\n */\r\nexport function registerValueName(valueName: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.register_value_name) throw new Error(\"register_value_name not available\")\r\n return native.register_value_name(valueName)\r\n}\r\n\r\n/**\r\n * Convert property ID back to name\r\n * Reverse lookup for serialized data\r\n *\r\n * @param propertyId - Property ID\r\n * @returns Property name or empty string if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const bgColorId = registerPropertyName('background-color')\r\n * const name = propertyIdToString(bgColorId)\r\n * console.log(name) // \"background-color\"\r\n * ```\r\n */\r\nexport function propertyIdToString(propertyId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.property_id_to_string) throw new Error(\"property_id_to_string not available\")\r\n return native.property_id_to_string(propertyId)\r\n}\r\n\r\n/**\r\n * Convert value ID back to name\r\n * Reverse lookup for serialized data\r\n *\r\n * @param valueId - Value ID\r\n * @returns Value name or empty string if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const blueId = registerValueName('blue-600')\r\n * const value = valueIdToString(blueId)\r\n * console.log(value) // \"blue-600\"\r\n * ```\r\n */\r\nexport function valueIdToString(valueId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.value_id_to_string) throw new Error(\"value_id_to_string not available\")\r\n return native.value_id_to_string(valueId)\r\n}\r\n\r\n/**\r\n * Reverse lookup: find property by ID\r\n * Alternative way to look up property names\r\n *\r\n * @param propertyId - Property ID to look up\r\n * @returns Property name\r\n */\r\nexport function reverseLookupProperty(propertyId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.reverse_lookup_property)\r\n throw new Error(\"reverse_lookup_property not available\")\r\n return native.reverse_lookup_property(propertyId)\r\n}\r\n\r\n/**\r\n * Reverse lookup: find value by ID\r\n * Alternative way to look up value names\r\n *\r\n * @param valueId - Value ID to look up\r\n * @returns Value name\r\n */\r\nexport function reverseLookupValue(valueId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.reverse_lookup_value) throw new Error(\"reverse_lookup_value not available\")\r\n return native.reverse_lookup_value(valueId)\r\n}\r\n\r\n/**\r\n * Export registry state for persistence\r\n * Useful for saving/restoring registry data\r\n *\r\n * @param handle - Generator handle\r\n * @returns Serialized registry state\r\n *\r\n * @example\r\n * ```ts\r\n * const exported = idRegistryExport(handle)\r\n * // Save to file/database\r\n * ```\r\n */\r\nexport function idRegistryExport(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_export) throw new Error(\"id_registry_export not available\")\r\n return native.id_registry_export(handle)\r\n}\r\n\r\n/**\r\n * Import registry state\r\n * Restore registry from saved state\r\n *\r\n * @param importedData - Serialized registry data\r\n * @returns New handle with imported data\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryImport(savedData)\r\n * // Registry restored with same IDs\r\n * ```\r\n */\r\nexport function idRegistryImport(importedData: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_import) throw new Error(\"id_registry_import not available\")\r\n return native.id_registry_import(importedData)\r\n}\r\n\r\n","/**\r\n * streamingNative.ts\r\n *\r\n * Phase 5.1: Streaming & Incremental Processing - Handle file changes efficiently\r\n * Exposes 8 functions for real-time incremental compilation\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * File change notification\r\n */\r\nexport interface FileChangeEvent {\r\n file_path: string\r\n event_type: \"added\" | \"modified\" | \"deleted\"\r\n old_content?: string\r\n new_content?: string\r\n timestamp_ms: number\r\n}\r\n\r\n/**\r\n * Processed file change result\r\n */\r\nexport interface ProcessedFileChange {\r\n file_path: string\r\n status: \"processed\" | \"skipped\" | \"error\"\r\n old_classes: string[]\r\n new_classes: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n changed: boolean\r\n fingerprint: string\r\n error?: string\r\n}\r\n\r\n/**\r\n * Diff between two scan results\r\n */\r\nexport interface FileDiff {\r\n added_files: string[]\r\n removed_files: string[]\r\n modified_files: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n total_changes: number\r\n}\r\n\r\n/**\r\n * File fingerprint for change detection\r\n */\r\nexport interface FileFingerprint {\r\n file_path: string\r\n content_hash: string\r\n size_bytes: number\r\n mtime_ms: number\r\n class_hash: string\r\n signature: string\r\n}\r\n\r\n/**\r\n * Incremental diff result\r\n */\r\nexport interface IncrementalDiffResult {\r\n is_changed: boolean\r\n changes_count: number\r\n diff: FileDiff\r\n processing_time_ms: number\r\n}\r\n\r\n/**\r\n * State injection result\r\n */\r\nexport interface StateInjectionResult {\r\n injected: boolean\r\n state_hash: string\r\n affected_files: number\r\n total_injected_bytes: number\r\n}\r\n\r\n/**\r\n * Stale entry pruning result\r\n */\r\nexport interface PruneResult {\r\n entries_before: number\r\n entries_after: number\r\n entries_removed: number\r\n freed_bytes: number\r\n}\r\n\r\n/**\r\n * Rebuilt workspace result\r\n */\r\nexport interface RebuildWorkspaceResult {\r\n total_files_scanned: number\r\n total_classes_found: number\r\n unique_classes: number\r\n build_time_ms: number\r\n files_with_changes: number\r\n}\r\n\r\n/**\r\n * Process a single file change event\r\n * Called when a file is added, modified, or deleted\r\n *\r\n * @param fileChangeJson - JSON string describing the file change\r\n * @returns Processing result with class changes\r\n *\r\n * @example\r\n * ```ts\r\n * const change = processFileChange(JSON.stringify({\r\n * file_path: 'src/Button.tsx',\r\n * event_type: 'modified',\r\n * new_content: 'export const Button = ...',\r\n * timestamp_ms: Date.now()\r\n * }))\r\n *\r\n * console.log('Added classes:', change.added_classes)\r\n * console.log('Removed classes:', change.removed_classes)\r\n * ```\r\n */\r\nexport function processFileChange(fileChangeJson: string): ProcessedFileChange {\r\n const native = getNativeBridge()\r\n if (!native?.process_file_change) throw new Error(\"process_file_change not available\")\r\n const resultJson = native.process_file_change(fileChangeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n file_path: \"\",\r\n status: \"error\",\r\n old_classes: [],\r\n new_classes: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n changed: false,\r\n fingerprint: \"\",\r\n error: \"Failed to parse result\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compute incremental diff between old and new scan results\r\n * Efficient way to identify only what changed\r\n *\r\n * @param oldScanJson - JSON string of previous scan result\r\n * @param newScanJson - JSON string of new scan result\r\n * @returns Diff showing what changed\r\n *\r\n * @example\r\n * ```ts\r\n * const oldResult = scanWorkspace('./src')\r\n * // ... files changed ...\r\n * const newResult = scanWorkspace('./src')\r\n *\r\n * const diff = computeIncrementalDiff(\r\n * JSON.stringify(oldResult),\r\n * JSON.stringify(newResult)\r\n * )\r\n *\r\n * if (diff.is_changed) {\r\n * console.log(`${diff.changes_count} files changed`)\r\n * console.log('Added:', diff.diff.added_classes)\r\n * console.log('Removed:', diff.diff.removed_classes)\r\n * }\r\n * ```\r\n */\r\nexport function computeIncrementalDiff(\r\n oldScanJson: string,\r\n newScanJson: string\r\n): IncrementalDiffResult {\r\n const native = getNativeBridge()\r\n if (!native?.compute_incremental_diff)\r\n throw new Error(\"compute_incremental_diff not available\")\r\n const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n is_changed: false,\r\n changes_count: 0,\r\n diff: {\r\n added_files: [],\r\n removed_files: [],\r\n modified_files: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n total_changes: 0,\r\n },\r\n processing_time_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Create a fingerprint of a file for change detection\r\n * Use fingerprints to quickly check if file needs reprocessing\r\n *\r\n * @param filePath - Path to file\r\n * @param fileContent - File content\r\n * @returns File fingerprint\r\n *\r\n * @example\r\n * ```ts\r\n * const fingerprint = createFingerprint('src/Button.tsx', fileContent)\r\n * // Store fingerprint, check later if content changed\r\n * const newFingerprint = createFingerprint('src/Button.tsx', newContent)\r\n * if (fingerprint.signature !== newFingerprint.signature) {\r\n * // Content changed, needs reprocessing\r\n * }\r\n * ```\r\n */\r\nexport function createFingerprint(filePath: string, fileContent: string): FileFingerprint {\r\n const native = getNativeBridge()\r\n if (!native?.create_fingerprint) throw new Error(\"create_fingerprint not available\")\r\n const fingerprintJson = native.create_fingerprint(filePath, fileContent)\r\n try {\r\n return JSON.parse(fingerprintJson)\r\n } catch {\r\n return {\r\n file_path: filePath,\r\n content_hash: \"\",\r\n size_bytes: fileContent.length,\r\n mtime_ms: Date.now(),\r\n class_hash: \"\",\r\n signature: \"\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Inject state hash into compiled CSS\r\n * Marks CSS with version/state hash for cache busting\r\n *\r\n * @param css - Raw CSS string\r\n * @param stateHash - State hash to inject\r\n * @returns Modified CSS with injected state\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileCssNative2(['px-4', 'bg-blue-600'])\r\n * const withState = injectStateHash(css, 'v5-hash-123')\r\n * // CSS now includes version marker for cache control\r\n * ```\r\n */\r\nexport function injectStateHash(css: string, stateHash: string): StateInjectionResult {\r\n const native = getNativeBridge()\r\n if (!native?.inject_state_hash) throw new Error(\"inject_state_hash not available\")\r\n const resultJson = native.inject_state_hash(css, stateHash)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n injected: false,\r\n state_hash: stateHash,\r\n affected_files: 0,\r\n total_injected_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Prune stale entries from cache\r\n * Removes old/unused cache entries to free memory\r\n *\r\n * @param maxAgeSeconds - Remove entries older than this many seconds\r\n * @param maxEntries - Keep only this many most-recent entries\r\n * @returns Result of pruning operation\r\n *\r\n * @example\r\n * ```ts\r\n * // Remove cache entries older than 1 hour, keep max 10000 entries\r\n * const result = pruneStaleCacheEntries(3600, 10000)\r\n * console.log(`Freed ${result.freed_bytes / 1024}KB`)\r\n * ```\r\n */\r\nexport function pruneStaleCacheEntries(maxAgeSeconds: number, maxEntries: number): PruneResult {\r\n const native = getNativeBridge()\r\n if (!native?.prune_stale_entries) throw new Error(\"prune_stale_entries not available\")\r\n const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n entries_before: 0,\r\n entries_after: 0,\r\n entries_removed: 0,\r\n freed_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Rebuild workspace result from scratch\r\n * Useful after major configuration changes\r\n *\r\n * @param rootDir - Root directory to scan\r\n * @param extensions - File extensions to scan (e.g., [\".tsx\", \".ts\"])\r\n * @returns Rebuilt workspace result\r\n *\r\n * @example\r\n * ```ts\r\n * const result = rebuildWorkspaceResult('./src', ['.tsx', '.ts'])\r\n * console.log(`Found ${result.unique_classes} unique classes`)\r\n * console.log(`${result.files_with_changes} files had changes`)\r\n * ```\r\n */\r\nexport function rebuildWorkspaceResult(\r\n rootDir: string,\r\n extensions?: string[]\r\n): RebuildWorkspaceResult {\r\n const native = getNativeBridge()\r\n if (!native?.rebuild_workspace_result)\r\n throw new Error(\"rebuild_workspace_result not available\")\r\n const resultJson = native.rebuild_workspace_result(rootDir, extensions || [])\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n total_files_scanned: 0,\r\n total_classes_found: 0,\r\n unique_classes: 0,\r\n build_time_ms: 0,\r\n files_with_changes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scan a single file with incremental state\r\n * Returns only new/changed classes since last scan\r\n *\r\n * @param filePath - Path to file\r\n * @param fileContent - File content\r\n * @returns Updated classes and change status\r\n *\r\n * @example\r\n * ```ts\r\n * // On file change, get only what changed\r\n * const file = scanFileNative('src/Button.tsx', newContent)\r\n * if (file.changed) {\r\n * console.log('Added:', file.added_classes)\r\n * console.log('Removed:', file.removed_classes)\r\n * }\r\n * ```\r\n */\r\nexport function scanFileNative(\r\n filePath: string,\r\n fileContent: string\r\n): {\r\n file: string\r\n classes: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n changed: boolean\r\n} {\r\n const native = getNativeBridge()\r\n if (!native?.scan_file_native) throw new Error(\"scan_file_native not available\")\r\n const resultJson = native.scan_file_native(filePath, fileContent)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n file: filePath,\r\n classes: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n changed: false,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scan multiple files in batch with incremental state\r\n * Efficient batch processing of file changes\r\n *\r\n * @param filesJson - JSON array of {file, content} objects\r\n * @returns Results for each file\r\n *\r\n * @example\r\n * ```ts\r\n * const files = [\r\n * { file: 'src/Button.tsx', content: newButtonContent },\r\n * { file: 'src/Card.tsx', content: newCardContent }\r\n * ]\r\n * const results = scanFilesBatchNative(JSON.stringify(files))\r\n * ```\r\n */\r\nexport function scanFilesBatchNative(\r\n filesJson: string\r\n): Array<{\r\n file: string\r\n classes: string[]\r\n changed: boolean\r\n}> {\r\n const native = getNativeBridge()\r\n if (!native?.scan_files_batch_native)\r\n throw new Error(\"scan_files_batch_native not available\")\r\n const resultJson = native.scan_files_batch_native(filesJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n","/**\r\n * tailwindEngine.ts\r\n *\r\n * Pipeline: classes[] → Rust CSS Compiler (only path)\r\n *\r\n * The Rust compiler provides 40-60% performance improvement over pure JavaScript.\r\n * No JavaScript fallback - fail fast if native binding unavailable.\r\n */\r\n\r\nimport { createRequire } from \"node:module\"\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nimport { generateCssNative as generateCssNativeImpl } from \"./cssGeneratorNative\"\r\n\r\nconst require = createRequire(import.meta.url)\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache for CSS Pipeline (PHASE 0: Quick Win - 30-40% faster)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\ninterface CacheStats {\r\n hits: number\r\n misses: number\r\n hitRate: number\r\n size: number\r\n maxSize: number\r\n}\r\n\r\nconst _cssCache = new Map<string, CssPipelineResult>()\r\nlet _cacheHits = 0\r\nlet _cacheMisses = 0\r\nconst MAX_CACHE_SIZE = 100\r\nconst MAX_CACHE_MEMORY = 256 * 1024 // 256KB\r\n\r\nfunction _getCacheKey(classes: string[], minify: boolean, cssEntry?: string, root?: string): string {\r\n // Sort classes for consistent hashing\r\n const sorted = [...classes].sort().join(\",\")\r\n const flags = `${minify ? \"1\" : \"0\"}${cssEntry ? \"1\" : \"0\"}${root ? \"1\" : \"0\"}`\r\n return `${sorted}|${flags}`\r\n}\r\n\r\nfunction _evictOldestIfNeeded(): void {\r\n if (_cssCache.size >= MAX_CACHE_SIZE) {\r\n const firstKey = _cssCache.keys().next().value as string | undefined\r\n if (firstKey !== undefined) {\r\n _cssCache.delete(firstKey)\r\n }\r\n }\r\n}\r\n\r\nexport function getCacheStats(): CacheStats {\r\n const total = _cacheHits + _cacheMisses\r\n return {\r\n hits: _cacheHits,\r\n misses: _cacheMisses,\r\n hitRate: total > 0 ? _cacheHits / total : 0,\r\n size: _cssCache.size,\r\n maxSize: MAX_CACHE_SIZE,\r\n }\r\n}\r\n\r\nexport function clearCache(): void {\r\n _cssCache.clear()\r\n _cacheHits = 0\r\n _cacheMisses = 0\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Deprecated - Kept for reference only, not used\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// The JavaScript Tailwind engine path has been removed in favor of Rust-only\r\n// compilation. The code below is legacy and can be removed in future cleanup.\r\n\r\n// export async function generateRawCss(...) { /* removed */ }\r\n// export function loadTailwindEngine() { /* removed */ }\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Rust CSS Compiler (Primary Path)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Load theme configuration from the project.\r\n * For now, returns a minimal theme object.\r\n * In production, this should load from tailwind.config.ts/js\r\n */\r\nfunction getThemeConfig(): Record<string, unknown> {\r\n // TODO: Load from tailwind.config.ts/js\r\n // This is a simplified version - in production, parse the actual config\r\n return {\r\n colors: {\r\n slate: {\r\n \"50\": \"#f8fafc\",\r\n \"100\": \"#f1f5f9\",\r\n \"200\": \"#e2e8f0\",\r\n \"300\": \"#cbd5e1\",\r\n \"400\": \"#94a3b8\",\r\n \"500\": \"#64748b\",\r\n \"600\": \"#475569\",\r\n \"700\": \"#334155\",\r\n \"800\": \"#1e293b\",\r\n \"900\": \"#0f172a\",\r\n },\r\n gray: {\r\n \"50\": \"#f9fafb\",\r\n \"100\": \"#f3f4f6\",\r\n \"200\": \"#e5e7eb\",\r\n \"300\": \"#d1d5db\",\r\n \"400\": \"#9ca3af\",\r\n \"500\": \"#6b7280\",\r\n \"600\": \"#4b5563\",\r\n \"700\": \"#374151\",\r\n \"800\": \"#1f2937\",\r\n \"900\": \"#111827\",\r\n },\r\n white: \"#ffffff\",\r\n black: \"#000000\",\r\n red: {\r\n \"500\": \"#ef4444\",\r\n \"600\": \"#dc2626\",\r\n },\r\n blue: {\r\n \"500\": \"#3b82f6\",\r\n \"600\": \"#1e40af\",\r\n },\r\n },\r\n spacing: {\r\n \"0\": \"0px\",\r\n \"1\": \"0.25rem\",\r\n \"2\": \"0.5rem\",\r\n \"3\": \"0.75rem\",\r\n \"4\": \"1rem\",\r\n \"5\": \"1.25rem\",\r\n \"6\": \"1.5rem\",\r\n \"8\": \"2rem\",\r\n \"10\": \"2.5rem\",\r\n \"12\": \"3rem\",\r\n \"16\": \"4rem\",\r\n \"20\": \"5rem\",\r\n \"24\": \"6rem\",\r\n },\r\n breakpoints: {\r\n \"sm\": \"640px\",\r\n \"md\": \"768px\",\r\n \"lg\": \"1024px\",\r\n \"xl\": \"1280px\",\r\n \"2xl\": \"1536px\",\r\n },\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LightningCSS post-process via Rust\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nfunction postProcessWithLightning(rawCss: string): string {\r\n if (!rawCss) return \"\"\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) {\r\n throw new Error(\"FATAL: Native binding 'processTailwindCssLightning' is required but not available.\")\r\n }\r\n const result = native.processTailwindCssLightning(rawCss) as { css: string } | null\r\n if (!result?.css) {\r\n throw new Error(\"FATAL: processTailwindCssLightning returned null\")\r\n }\r\n return result.css\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Main pipeline\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface CssPipelineResult {\r\n css: string\r\n classes: string[]\r\n sizeBytes: number\r\n optimized: boolean\r\n}\r\n\r\nexport async function runCssPipeline(\r\n classes: string[],\r\n cssEntryContent?: string,\r\n root?: string,\r\n minify = true\r\n): Promise<CssPipelineResult> {\r\n // Deduplicate classes while preserving Array compatibility\r\n const filtered = classes.filter(Boolean)\r\n const uniqueMap = new Map<string, string>()\r\n filtered.forEach((cls) => uniqueMap.set(cls, cls))\r\n const unique = Array.from(uniqueMap.values())\r\n\r\n if (unique.length === 0) {\r\n return { css: \"\", classes: [], sizeBytes: 0, optimized: false }\r\n }\r\n\r\n // ✅ PHASE 0: Check cache first (30-40% faster for cache hits)\r\n const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root)\r\n const cached = _cssCache.get(cacheKey)\r\n if (cached) {\r\n _cacheHits++\r\n if (process.env.DEBUG?.includes(\"compiler\")) {\r\n console.log(\r\n `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`\r\n )\r\n }\r\n return cached\r\n }\r\n\r\n _cacheMisses++\r\n\r\n let rawCss: string\r\n let usedRustCompiler = false\r\n\r\n // Phase 1: Rust CSS Compiler (Only Path - no JS fallback)\r\n const theme = getThemeConfig()\r\n rawCss = await generateCssNativeImpl(unique, { theme })\r\n usedRustCompiler = true\r\n\r\n // Phase 2: Optional post-processing with LightningCSS (if minify=true)\r\n const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss\r\n\r\n if (process.env.DEBUG?.includes(\"compiler\")) {\r\n console.log(\r\n `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? \"Rust\" : \"JavaScript\"})`,\r\n `Size: ${finalCss.length} bytes`\r\n )\r\n }\r\n\r\n const result: CssPipelineResult = {\r\n css: finalCss,\r\n classes: unique,\r\n sizeBytes: finalCss.length,\r\n optimized: minify,\r\n }\r\n\r\n // Store in cache with eviction\r\n _evictOldestIfNeeded()\r\n _cssCache.set(cacheKey, result)\r\n\r\n return result\r\n}\r\n\r\n/**\r\n * @deprecated Tidak dipakai di Tailwind v4. Ditinggal untuk backward compatibility.\r\n */\r\nexport function runCssPipelineSync(_classes: string[]): CssPipelineResult {\r\n return { css: \"\", classes: [], sizeBytes: 0, optimized: false }\r\n}\r\n\r\n/**\r\n * Minify dan vendor-prefix CSS dengan explicit browser targets.\r\n */\r\nexport function processTailwindCssWithTargets(css: string, targets?: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssWithTargets) {\r\n throw new Error(\"FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.\")\r\n }\r\n const result = native.processTailwindCssWithTargets(css, targets ?? null) as { css: string } | null\r\n if (!result?.css) {\r\n throw new Error(\"FATAL: processTailwindCssWithTargets returned null\")\r\n }\r\n return result.css\r\n}\r\n","/**\r\n * Compiler Sub-entry Point\r\n * \r\n * Exports CSS generation and compilation functionality.\r\n * - CSS generation with caching\r\n * - Compilation of classes to CSS\r\n * - ID registry management\r\n * - Streaming and incremental processing\r\n */\r\n\r\nexport {\r\n generateCssNative,\r\n getCacheStats,\r\n clearThemeCache,\r\n} from './cssGeneratorNative'\r\n\r\nexport {\r\n compileCssNative2,\r\n compileCssLightning,\r\n extractTwStateConfigsNative,\r\n generateStaticStateCssNative,\r\n extractAndGenerateStateCssNative,\r\n layoutClassesToCss,\r\n hashContent,\r\n extractTwContainerConfigs,\r\n parseAtomicClass,\r\n generateAtomicCss,\r\n toAtomicClasses,\r\n clearAtomicRegistry,\r\n atomicRegistrySize,\r\n type ContainerConfig,\r\n type StateCssConfig,\r\n type GeneratedStateCss,\r\n} from './compilationNative'\r\n\r\nexport {\r\n compileClass,\r\n compileClasses,\r\n compileToCss,\r\n compileToCssBatch,\r\n minifyCss,\r\n compileAnimation,\r\n compileKeyframes,\r\n compileTheme,\r\n twMerge,\r\n twMergeMany,\r\n twMergeWithSeparator,\r\n twMergeManyWithSeparator,\r\n twMergeRaw,\r\n type CompiledCssRule,\r\n type CompiledAnimation,\r\n type CompiledTheme,\r\n type CssCompileResult,\r\n type TwMergeOptions,\r\n} from './cssCompilationNative'\r\n\r\nexport {\r\n idRegistryCreate,\r\n idRegistryGenerate,\r\n idRegistryLookup,\r\n idRegistryNext,\r\n idRegistryDestroy,\r\n idRegistryReset,\r\n idRegistrySnapshot,\r\n idRegistryActiveCount,\r\n registerPropertyName,\r\n registerValueName,\r\n propertyIdToString,\r\n valueIdToString,\r\n reverseLookupProperty,\r\n reverseLookupValue,\r\n idRegistryExport,\r\n idRegistryImport,\r\n type RegistrySnapshot,\r\n} from './idRegistryNative'\r\n\r\nexport {\r\n processFileChange,\r\n computeIncrementalDiff,\r\n createFingerprint,\r\n injectStateHash,\r\n pruneStaleCacheEntries,\r\n rebuildWorkspaceResult,\r\n scanFileNative,\r\n scanFilesBatchNative,\r\n type FileChangeEvent,\r\n type ProcessedFileChange,\r\n type FileDiff,\r\n type FileFingerprint,\r\n type IncrementalDiffResult,\r\n type StateInjectionResult,\r\n type PruneResult,\r\n type RebuildWorkspaceResult,\r\n} from './streamingNative'\r\n\r\nexport { runCssPipeline } from './tailwindEngine'\r\n","/**\r\n * Parser Sub-entry Point\r\n * \r\n * Exports class parsing and extraction functionality.\r\n * - Tailwind class parsing\r\n * - Class extraction from source\r\n * - Class normalization and deduplication\r\n * - Component analysis\r\n */\r\n\r\nimport { getNativeBridge } from '../nativeBridge'\r\n\r\n// ============================================================================\r\n// PARSING FUNCTIONS\r\n// ============================================================================\r\n\r\nexport const parseClasses = (raw: string): Array<{ raw: string; type: string }> => {\r\n const native = getNativeBridge()\r\n if (!native?.parseClasses) {\r\n throw new Error('FATAL: Native binding \\'parseClasses\\' is required but not available.')\r\n }\r\n return native.parseClasses(raw) || []\r\n}\r\n\r\n// ============================================================================\r\n// CLASS EXTRACTION\r\n// ============================================================================\r\n\r\nexport const extractAllClasses = (source: string): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.extractAllClasses) {\r\n throw new Error('FATAL: Native binding \\'extractAllClasses\\' is required but not available.')\r\n }\r\n return native.extractAllClasses(source) || []\r\n}\r\n\r\nexport const extractClassesFromSource = (source: string): string => {\r\n const native = getNativeBridge()\r\n if (!native?.extractClassesFromSource) {\r\n throw new Error('FATAL: Native binding \\'extractClassesFromSource\\' is required but not available.')\r\n }\r\n const result = native.extractClassesFromSource(source)\r\n return Array.isArray(result) ? result.join(' ') : String(result || '')\r\n}\r\n\r\nexport const astExtractClasses = (source: string, _filename: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.extractClassesFromSource) {\r\n throw new Error('FATAL: Native binding \\'extractClassesFromSource\\' is required but not available.')\r\n }\r\n return native.extractClassesFromSource(source) || []\r\n}\r\n\r\n// ============================================================================\r\n// CLASS NORMALIZATION & MERGING\r\n// ============================================================================\r\n\r\nexport const normalizeClasses = (raw: string): string => {\r\n const result = normalizeAndDedupClasses(raw)\r\n return result?.normalized || ''\r\n}\r\n\r\nexport const mergeClassesStatic = (classes: string): string => {\r\n const result = normalizeAndDedupClasses(classes)\r\n return result?.normalized || ''\r\n}\r\n\r\nexport const normalizeAndDedupClasses = (raw: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.normalizeAndDedupClasses) {\r\n throw new Error('FATAL: Native binding \\'normalizeAndDedupClasses\\' is required but not available.')\r\n }\r\n const result = native.normalizeAndDedupClasses(raw)\r\n return result || { normalized: '', duplicatesRemoved: 0, uniqueCount: 0 }\r\n}\r\n\r\n// ============================================================================\r\n// COMPONENT ANALYSIS\r\n// ============================================================================\r\n\r\nexport const extractComponentUsage = (source: string): Array<{ component: string; propsJson: string }> => {\r\n const native = getNativeBridge()\r\n if (!native?.extractComponentUsage) {\r\n throw new Error('FATAL: Native binding \\'extractComponentUsage\\' is required but not available.')\r\n }\r\n return native.extractComponentUsage(source) || []\r\n}\r\n\r\n// ============================================================================\r\n// BATCH OPERATIONS\r\n// ============================================================================\r\n\r\nexport const batchExtractClasses = (filePaths: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.batchExtractClasses) {\r\n throw new Error('FATAL: Native binding \\'batchExtractClasses\\' is required but not available.')\r\n }\r\n return native.batchExtractClasses(filePaths) || []\r\n}\r\n\r\nexport const checkAgainstSafelist = (classes: string[], safelist: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.checkAgainstSafelist) {\r\n throw new Error('FATAL: Native binding \\'checkAgainstSafelist\\' is required but not available.')\r\n }\r\n return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 }\r\n}\r\n\r\n// ============================================================================\r\n// DIFF & MERGING\r\n// ============================================================================\r\n\r\nexport const diffClassLists = (previous: string[], current: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.diffClassLists) {\r\n throw new Error('FATAL: Native binding \\'diffClassLists\\' is required but not available.')\r\n }\r\n return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false }\r\n}\r\n\r\n// Re-export types if any\r\nexport type { ClassExtractResult, ComponentMetadata } from '../nativeBridge'\r\n","/**\r\n * analyzerNative.ts\r\n *\r\n * Native Rust bindings for CSS analysis and optimization.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nexport type {\r\n DeadCodeResult,\r\n ClassUsageItem,\r\n ContainerConfig,\r\n HoistResult,\r\n VariantTableResult,\r\n ClassifyResult,\r\n MergeResult,\r\n ProcessedCssResult,\r\n} from \"../nativeBridge\"\r\n\r\n/**\r\n * Detect dead CSS selectors in generated CSS.\r\n */\r\nexport function detectDeadCode(scanResultJson: string, css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.detectDeadCode) throw new Error(\"detectDeadCode not available\")\r\n return native.detectDeadCode(scanResultJson, css)\r\n}\r\n\r\n/**\r\n * Analyze class usage across scanned files.\r\n */\r\nexport function analyzeClassUsageNative(classes: string[], scanResultJson: string, css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClassUsage) throw new Error(\"analyzeClassUsage not available\")\r\n return native.analyzeClassUsage(classes, scanResultJson, css)\r\n}\r\n\r\n/**\r\n * Analyze entire class list and generate CSS.\r\n */\r\nexport function analyzeClassesNative(filesJson: string, cwd: string, flags?: number) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) throw new Error(\"analyzeClasses not available\")\r\n return native.analyzeClasses(filesJson, cwd, flags ?? 0)\r\n}\r\n\r\n/**\r\n * Analyze React Server Component requirements.\r\n */\r\nexport function analyzeRscNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeRsc) throw new Error(\"analyzeRsc not available\")\r\n return native.analyzeRsc(source, filename)\r\n}\r\n\r\n/**\r\n * Optimize CSS by removing dead code and minifying.\r\n */\r\nexport function optimizeCssNative(css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) throw new Error(\"processTailwindCssLightning not available\")\r\n const result = native.processTailwindCssLightning(css)\r\n return {\r\n css: result.css,\r\n originalSize: css.length,\r\n optimizedSize: result.size_bytes,\r\n reductionPercentage: ((css.length - result.size_bytes) / css.length) * 100,\r\n }\r\n}\r\n\r\n/**\r\n * Process Tailwind CSS with Lightning CSS post-processing.\r\n */\r\nexport function processTailwindCssLightning(css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) throw new Error(\"processTailwindCssLightning not available\")\r\n return native.processTailwindCssLightning(css)\r\n}\r\n\r\n/**\r\n * Eliminate dead CSS selectors.\r\n */\r\nexport function eliminateDeadCssNative(css: string, deadClasses: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.eliminateDeadCss) throw new Error(\"eliminateDeadCss not available\")\r\n return native.eliminateDeadCss(css, deadClasses)\r\n}\r\n\r\n/**\r\n * Hoist components from source code.\r\n */\r\nexport function hoistComponentsNative(source: string) {\r\n const native = getNativeBridge()\r\n if (!native?.hoistComponents) throw new Error(\"hoistComponents not available\")\r\n return native.hoistComponents(source)\r\n}\r\n\r\n/**\r\n * Compile variant configuration table.\r\n */\r\nexport function compileVariantTableNative(configJson: string) {\r\n const native = getNativeBridge()\r\n if (!native?.compileVariantTable) throw new Error(\"compileVariantTable not available\")\r\n return native.compileVariantTable(configJson)\r\n}\r\n\r\n/**\r\n * Classify and sort classes by bucket.\r\n */\r\nexport function classifyAndSortClassesNative(classes: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) throw new Error(\"classifyAndSortClasses not available\")\r\n return native.classifyAndSortClasses(classes)\r\n}\r\n\r\n/**\r\n * Merge CSS declarations from multiple chunks.\r\n */\r\nexport function mergeCssDeclarationsNative(cssChunks: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.mergeCssDeclarations) throw new Error(\"mergeCssDeclarations not available\")\r\n return native.mergeCssDeclarations(cssChunks)\r\n}\r\n","/**\r\n * themeResolutionNative.ts\r\n *\r\n * Phase 5.1: Theme Resolution Extended - Advanced theme configuration handling\r\n * Exposes 7 theme resolution functions for complex Tailwind configurations\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Validation result for theme config\r\n */\r\nexport interface ThemeValidationResult {\r\n is_valid: boolean\r\n errors: string[]\r\n warnings: string[]\r\n suggestions: string[]\r\n}\r\n\r\n/**\r\n * Resolved variant configuration\r\n */\r\nexport interface ResolvedVariantConfig {\r\n variants: string[]\r\n supported: string[]\r\n deprecated: string[]\r\n conflicting: string[]\r\n}\r\n\r\n/**\r\n * Theme cascade resolution result\r\n */\r\nexport interface ThemeCascadeResult {\r\n base_theme: Record<string, unknown>\r\n user_overrides: Record<string, unknown>\r\n merged_theme: Record<string, unknown>\r\n conflict_resolutions: Array<{\r\n key: string\r\n base_value: unknown\r\n override_value: unknown\r\n resolution: \"override\" | \"merge\" | \"error\"\r\n }>\r\n}\r\n\r\n/**\r\n * Class name resolution from theme\r\n */\r\nexport interface ResolvedClassName {\r\n class_name: string\r\n property: string\r\n value: string\r\n from_theme_path: string\r\n is_responsive: boolean\r\n variants: string[]\r\n}\r\n\r\n/**\r\n * Conflict group information\r\n */\r\nexport interface ConflictGroupInfo {\r\n group_name: string\r\n conflicting_classes: string[]\r\n description: string\r\n resolution_strategy: string\r\n}\r\n\r\n/**\r\n * Get all resolved variants from theme configuration\r\n * Parses theme config and returns all variant prefixes\r\n *\r\n * @param configJson - JSON string of theme configuration\r\n * @returns Resolved variants with metadata\r\n *\r\n * @example\r\n * ```ts\r\n * const config = {\r\n * screens: { md: '768px', lg: '1024px' },\r\n * state: { hover: '&:hover', focus: '&:focus' }\r\n * }\r\n * const variants = resolveVariants(JSON.stringify(config))\r\n * console.log(variants.variants) // ['md', 'lg', 'hover', 'focus', ...]\r\n * ```\r\n */\r\nexport function resolveVariants(configJson: string): ResolvedVariantConfig {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_variants) throw new Error(\"resolve_variants not available\")\r\n const resultJson = native.resolve_variants(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n variants: [],\r\n supported: [],\r\n deprecated: [],\r\n conflicting: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Validate theme configuration for correctness\r\n * Checks for common issues and provides warnings\r\n *\r\n * @param configJson - JSON string of theme configuration\r\n * @returns Validation result with errors and suggestions\r\n *\r\n * @example\r\n * ```ts\r\n * const result = validateThemeConfig(JSON.stringify(myTheme))\r\n * if (!result.is_valid) {\r\n * console.error('Errors:', result.errors)\r\n * console.warn('Warnings:', result.warnings)\r\n * }\r\n * ```\r\n */\r\nexport function validateThemeConfig(configJson: string): ThemeValidationResult {\r\n const native = getNativeBridge()\r\n if (!native?.validate_variant_config) throw new Error(\"validate_variant_config not available\")\r\n const resultJson = native.validate_variant_config(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n is_valid: false,\r\n errors: [\"Unable to parse configuration\"],\r\n warnings: [],\r\n suggestions: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve theme cascade (base + overrides)\r\n * Merges base theme with user overrides intelligently\r\n *\r\n * @param baseThemeJson - Base theme configuration\r\n * @param overridesJson - User overrides configuration\r\n * @returns Merged theme with conflict information\r\n *\r\n * @example\r\n * ```ts\r\n * const cascade = resolveCascade(\r\n * JSON.stringify(baseTheme),\r\n * JSON.stringify(userOverrides)\r\n * )\r\n * console.log(cascade.merged_theme)\r\n * console.log('Conflicts resolved:', cascade.conflict_resolutions.length)\r\n * ```\r\n */\r\nexport function resolveCascade(\r\n baseThemeJson: string,\r\n overridesJson: string\r\n): ThemeCascadeResult {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_cascade) throw new Error(\"resolve_cascade not available\")\r\n const resultJson = native.resolve_cascade(baseThemeJson, overridesJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n base_theme: {},\r\n user_overrides: {},\r\n merged_theme: {},\r\n conflict_resolutions: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve class names from theme\r\n * Maps Tailwind class names to theme values\r\n *\r\n * @param classNames - Array of Tailwind class names (e.g., [\"text-lg\", \"bg-blue-600\"])\r\n * @param themeJson - Theme configuration\r\n * @returns Resolved class name information\r\n *\r\n * @example\r\n * ```ts\r\n * const resolved = resolveClassNames(\r\n * ['text-lg', 'bg-blue-600', 'md:p-4'],\r\n * JSON.stringify(theme)\r\n * )\r\n * resolved.forEach(item => {\r\n * console.log(`${item.class_name} -> ${item.property}: ${item.value}`)\r\n * })\r\n * ```\r\n */\r\nexport function resolveClassNames(\r\n classNames: string[],\r\n themeJson: string\r\n): ResolvedClassName[] {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_class_names) throw new Error(\"resolve_class_names not available\")\r\n const resultJson = native.resolve_class_names(classNames, themeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Get conflict group information\r\n * Identifies classes that conflict with each other\r\n *\r\n * @param groupName - Conflict group name (e.g., \"display\", \"position\", \"flex-direction\")\r\n * @param themeJson - Theme configuration\r\n * @returns Information about the conflict group\r\n *\r\n * @example\r\n * ```ts\r\n * const info = resolveConflictGroup('display', JSON.stringify(theme))\r\n * console.log('Conflicting classes:', info.conflicting_classes)\r\n * console.log('Strategy:', info.resolution_strategy)\r\n * ```\r\n */\r\nexport function resolveConflictGroup(groupName: string, themeJson: string): ConflictGroupInfo {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_conflict_group)\r\n throw new Error(\"resolve_conflict_group not available\")\r\n const resultJson = native.resolve_conflict_group(groupName, themeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n group_name: groupName,\r\n conflicting_classes: [],\r\n description: \"\",\r\n resolution_strategy: \"last-wins\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve theme value from key path\r\n * Navigates nested theme config to find values\r\n *\r\n * @param keyPath - Dot-separated path (e.g., \"colors.blue.600\")\r\n * @param themeJson - Theme configuration\r\n * @returns Resolved value or null if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const color = resolveThemeValue('colors.blue.600', JSON.stringify(theme))\r\n * console.log(color) // \"#2563eb\" or similar\r\n * ```\r\n */\r\nexport function resolveThemeValue(keyPath: string, themeJson: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_theme_value) throw new Error(\"resolve_theme_value not available\")\r\n return native.resolve_theme_value(keyPath, themeJson)\r\n}\r\n\r\n/**\r\n * Get all simple variants from configuration\r\n * Returns variants that don't require complex selector nesting\r\n *\r\n * @param configJson - Theme/variant configuration\r\n * @returns Array of simple variant names\r\n *\r\n * @example\r\n * ```ts\r\n * const simpleVariants = resolveSimpleVariants(JSON.stringify(config))\r\n * console.log(simpleVariants)\r\n * // [\"hover\", \"focus\", \"active\", \"group-hover\", ...]\r\n * ```\r\n */\r\nexport function resolveSimpleVariants(configJson: string): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_simple_variants) throw new Error(\"resolve_simple_variants not available\")\r\n const resultJson = native.resolve_simple_variants(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n","/**\r\n * scannerNative.ts - Rust bindings for workspace scanning and class extraction\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\nexport type {\r\n ScanWorkspaceResult,\r\n ScanFileResult,\r\n BatchExtractResult,\r\n SafelistCheckResult,\r\n PrefilterFileResult,\r\n} from \"../nativeBridge\"\r\n\r\nexport function scanWorkspace(root: string, extensions?: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.scan_workspace) throw new Error(\"scan_workspace not available\")\r\n return native.scan_workspace(root, extensions)\r\n}\r\n\r\nexport function extractClassesFromSourceNative(source: string): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.extract_classes_from_source) throw new Error(\"extract_classes_from_source not available\")\r\n return native.extract_classes_from_source(source)\r\n}\r\n\r\nexport function batchExtractClassesNative(filePaths: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.batch_extract_classes) throw new Error(\"batch_extract_classes not available\")\r\n return native.batch_extract_classes(filePaths)\r\n}\r\n\r\nexport function checkAgainstSafelistNative(classes: string[], safelist: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.check_against_safelist) throw new Error(\"check_against_safelist not available\")\r\n return native.check_against_safelist(classes, safelist)\r\n}\r\n\r\nexport function scanFile(filePath: string) {\r\n const native = getNativeBridge()\r\n if (!native?.scan_file) throw new Error(\"scan_file not available\")\r\n return native.scan_file(filePath)\r\n}\r\n\r\nexport function collectFiles(root: string, extensions?: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.collect_files) throw new Error(\"collect_files not available\")\r\n return native.collect_files(root, extensions)\r\n}\r\n\r\nexport function walkAndPrefilterSourceFiles(root: string, extensions?: string[], _parallel?: boolean) {\r\n const native = getNativeBridge()\r\n if (!native?.walk_and_prefilter_source_files) throw new Error(\"walk_and_prefilter_source_files not available\")\r\n return native.walk_and_prefilter_source_files(root, extensions)\r\n}\r\n\r\nexport function generateSubComponentTypes(root: string, outputPath?: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.generate_sub_component_types) throw new Error(\"generate_sub_component_types not available\")\r\n return native.generate_sub_component_types(root, outputPath)\r\n}\r\n","/**\r\n * Analyzer Sub-entry Point\r\n * \r\n * Exports analysis and optimization functionality.\r\n * - CSS and class analysis\r\n * - Dead code detection\r\n * - Theme resolution and validation\r\n * - Code classification and optimization\r\n */\r\n\r\nexport {\r\n detectDeadCode,\r\n analyzeClassUsageNative,\r\n analyzeClassesNative,\r\n analyzeRscNative,\r\n optimizeCssNative,\r\n processTailwindCssLightning,\r\n eliminateDeadCssNative,\r\n hoistComponentsNative,\r\n compileVariantTableNative,\r\n classifyAndSortClassesNative,\r\n mergeCssDeclarationsNative,\r\n type DeadCodeResult,\r\n type ClassUsageItem,\r\n type ProcessedCssResult,\r\n type HoistResult,\r\n type VariantTableResult,\r\n type ClassifyResult,\r\n type MergeResult,\r\n} from './analyzerNative'\r\n\r\nexport {\r\n resolveVariants,\r\n validateThemeConfig,\r\n resolveCascade,\r\n resolveClassNames,\r\n resolveConflictGroup,\r\n resolveThemeValue,\r\n resolveSimpleVariants,\r\n type ThemeValidationResult,\r\n type ResolvedVariantConfig,\r\n type ThemeCascadeResult,\r\n type ResolvedClassName,\r\n type ConflictGroupInfo,\r\n} from './themeResolutionNative'\r\n\r\nexport {\r\n scanWorkspace,\r\n extractClassesFromSourceNative,\r\n batchExtractClassesNative,\r\n checkAgainstSafelistNative,\r\n scanFile,\r\n collectFiles,\r\n walkAndPrefilterSourceFiles,\r\n generateSubComponentTypes,\r\n type ScanWorkspaceResult,\r\n type ScanFileResult,\r\n type BatchExtractResult,\r\n type SafelistCheckResult,\r\n type PrefilterFileResult,\r\n} from './scannerNative'\r\n","/**\r\n * cacheNative.ts\r\n *\r\n * Phase 5.1: Cache Management - Advanced caching strategies and optimization\r\n * Exposes 9 cache-related Rust functions for improved performance tuning\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Cache optimization hints and recommendations\r\n */\r\nexport interface CacheOptimizationHints {\r\n current_strategy: string\r\n recommended_strategy: string\r\n estimated_improvement_percent: number\r\n suggested_memory_mb: number\r\n notes: string[]\r\n}\r\n\r\n/**\r\n * Optimal cache configuration recommendations\r\n */\r\nexport interface OptimalCacheConfig {\r\n parse_cache_size: number\r\n resolve_cache_size: number\r\n compile_cache_size: number\r\n css_gen_cache_size: number\r\n recommended_eviction_policy: string\r\n ttl_seconds: number\r\n expected_hit_rate_percent: number\r\n}\r\n\r\n/**\r\n * Cache statistics from all layers\r\n */\r\nexport interface CacheStatistics {\r\n parse_cache: { hits: number; misses: number; size: number }\r\n resolve_cache: { hits: number; misses: number; size: number }\r\n compile_cache: { hits: number; misses: number; size: number }\r\n css_gen_cache: { hits: number; misses: number; size: number }\r\n overall_hit_rate: number\r\n total_memory_bytes: number\r\n}\r\n\r\n/**\r\n * Get comprehensive cache statistics across all layers\r\n * Useful for monitoring and optimization\r\n *\r\n * @returns Cache stats including hit rates, sizes, and recommendations\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * console.log(`Overall hit rate: ${stats.overall_hit_rate}%`)\r\n * console.log(`Total memory used: ${stats.total_memory_bytes / 1024}KB`)\r\n * ```\r\n */\r\nexport function getCacheStatistics(): CacheStatistics {\r\n const native = getNativeBridge()\r\n if (!native?.get_cache_statistics) throw new Error(\"get_cache_statistics not available\")\r\n const statsJson = native.get_cache_statistics()\r\n try {\r\n return JSON.parse(statsJson)\r\n } catch {\r\n return {\r\n parse_cache: { hits: 0, misses: 0, size: 0 },\r\n resolve_cache: { hits: 0, misses: 0, size: 0 },\r\n compile_cache: { hits: 0, misses: 0, size: 0 },\r\n css_gen_cache: { hits: 0, misses: 0, size: 0 },\r\n overall_hit_rate: 0,\r\n total_memory_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Clear all caches (parse, resolve, compile, CSS generation)\r\n * Use when switching themes or major configuration changes\r\n *\r\n * @example\r\n * ```ts\r\n * // Clear before switching themes\r\n * clearAllCaches()\r\n * const css = await generateCssNative(classes, { theme: newTheme })\r\n * ```\r\n */\r\nexport function clearAllCaches(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_all_caches) return\r\n try {\r\n native.clear_all_caches()\r\n } catch {\r\n // Silently ignore if not available\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the parse cache\r\n * Useful when parser behavior changes or cache gets stale\r\n */\r\nexport function clearParseCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_parse_cache) return\r\n try {\r\n native.clear_parse_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the resolve cache\r\n * Use when theme configuration changes\r\n */\r\nexport function clearResolveCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_resolve_cache) return\r\n try {\r\n native.clear_resolve_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the compile cache\r\n * Use when Tailwind configuration changes\r\n */\r\nexport function clearCompileCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_compile_cache) return\r\n try {\r\n native.clear_compile_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the CSS generation cache\r\n * Use when theme or layout changes\r\n */\r\nexport function clearCssGenCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_css_gen_cache) return\r\n try {\r\n native.clear_css_gen_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Get optimization hints based on current cache performance\r\n * Analyzes hit rates and suggests improvements\r\n *\r\n * @param hitRatePercent - Current hit rate (0-100)\r\n * @param memoryUsedMb - Memory currently used in MB\r\n * @returns Optimization recommendations\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * const hints = getCacheOptimizationHints(\r\n * stats.overall_hit_rate,\r\n * stats.total_memory_bytes / (1024 * 1024)\r\n * )\r\n * console.log(`Recommendation: ${hints.recommended_strategy}`)\r\n * console.log(`Potential improvement: ${hints.estimated_improvement_percent}%`)\r\n * ```\r\n */\r\nexport function getCacheOptimizationHints(\r\n hitRatePercent: number,\r\n memoryUsedMb: number\r\n): CacheOptimizationHints {\r\n const native = getNativeBridge()\r\n if (!native?.get_cache_optimization_hints)\r\n throw new Error(\"get_cache_optimization_hints not available\")\r\n const hintsJson = native.get_cache_optimization_hints(\r\n Math.min(100, Math.max(0, hitRatePercent)),\r\n Math.max(1, memoryUsedMb)\r\n )\r\n try {\r\n return JSON.parse(hintsJson)\r\n } catch {\r\n return {\r\n current_strategy: \"unknown\",\r\n recommended_strategy: \"increase_size\",\r\n estimated_improvement_percent: 0,\r\n suggested_memory_mb: 256,\r\n notes: [\"Unable to analyze cache statistics\"],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Estimate optimal cache configuration for your workload\r\n * Analyzes typical patterns and recommends sizes\r\n *\r\n * @param totalBudgetMb - Maximum memory budget in MB\r\n * @param workloadType - \"small\" (< 100 files), \"medium\" (100-1000), \"large\" (1000+)\r\n * @returns Recommended cache configuration\r\n *\r\n * @example\r\n * ```ts\r\n * const config = estimateOptimalCacheConfig(512, 'large')\r\n * console.log(`Parse cache: ${config.parse_cache_size}MB`)\r\n * console.log(`Expected hit rate: ${config.expected_hit_rate_percent}%`)\r\n * ```\r\n */\r\nexport function estimateOptimalCacheConfig(\r\n totalBudgetMb: number,\r\n workloadType: \"small\" | \"medium\" | \"large\"\r\n): OptimalCacheConfig {\r\n const native = getNativeBridge()\r\n if (!native?.estimate_optimal_cache_config_native)\r\n throw new Error(\"estimate_optimal_cache_config_native not available\")\r\n const configJson = native.estimate_optimal_cache_config_native(\r\n Math.max(64, totalBudgetMb),\r\n workloadType\r\n )\r\n try {\r\n return JSON.parse(configJson)\r\n } catch {\r\n // Return sensible defaults\r\n return {\r\n parse_cache_size: 128,\r\n resolve_cache_size: 64,\r\n compile_cache_size: 256,\r\n css_gen_cache_size: 128,\r\n recommended_eviction_policy: \"lru\",\r\n ttl_seconds: 3600,\r\n expected_hit_rate_percent: 75,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Read cache from disk (persistence)\r\n * Restores cached data from previous sessions\r\n *\r\n * @param cachePath - Path to cache file\r\n * @returns Entries loaded from disk\r\n *\r\n * @example\r\n * ```ts\r\n * const entries = cacheRead('./.tw-cache/scan.json')\r\n * // Warm up cache with persisted data\r\n * ```\r\n */\r\nexport function cacheRead(cachePath: string): Array<{\r\n file: string\r\n contentHash: string\r\n classes: string[]\r\n mtimeMs: number\r\n sizeBytes: number\r\n}> {\r\n const native = getNativeBridge()\r\n if (!native?.cache_read) throw new Error(\"cache_read not available\")\r\n const result = native.cache_read(cachePath)\r\n try {\r\n return JSON.parse(result.entries_json || \"[]\")\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Write cache to disk (persistence)\r\n * Saves cached data for next session\r\n *\r\n * @param cachePath - Path where cache should be written\r\n * @param entries - Cache entries to persist\r\n * @returns Success status\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * const success = cacheWrite(\r\n * './.tw-cache/scan.json',\r\n * // entries array from previous scan\r\n * )\r\n * ```\r\n */\r\nexport function cacheWrite(\r\n cachePath: string,\r\n entries: Array<{\r\n file: string\r\n contentHash: string\r\n classes: string[]\r\n mtimeMs: number\r\n sizeBytes: number\r\n }>\r\n): boolean {\r\n const native = getNativeBridge()\r\n if (!native?.cache_write) throw new Error(\"cache_write not available\")\r\n try {\r\n const result = native.cache_write(\r\n cachePath,\r\n entries.map((e) => ({\r\n file: e.file,\r\n content_hash: e.contentHash,\r\n classes: e.classes,\r\n mtime_ms: e.mtimeMs,\r\n size_bytes: e.sizeBytes,\r\n }))\r\n )\r\n return typeof result === \"boolean\" ? result : result === true\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\n/**\r\n * Calculate cache priority score for file ordering\r\n * Useful for prioritizing which files to scan first\r\n *\r\n * @param mtimeMs - File modification time in milliseconds\r\n * @param sizeBytes - File size in bytes\r\n * @param hitCount - Number of times this file was accessed from cache\r\n * @returns Priority score (higher = process first)\r\n *\r\n * @example\r\n * ```ts\r\n * const priority = cachePriority(Date.now(), 2048, 5)\r\n * // Use priority to sort files for scanning\r\n * ```\r\n */\r\nexport function cachePriority(mtimeMs: number, sizeBytes: number, hitCount: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.cache_priority) throw new Error(\"cache_priority not available\")\r\n return native.cache_priority(mtimeMs, sizeBytes, hitCount)\r\n}\r\n","/**\r\n * Cache Sub-entry Point\r\n * \r\n * Exports cache management functionality.\r\n * - Cache statistics retrieval\r\n * - Cache clearing operations\r\n * - Cache optimization\r\n * - Cache configuration\r\n */\r\n\r\nexport {\r\n getCacheStatistics,\r\n clearAllCaches,\r\n clearParseCache,\r\n clearResolveCache,\r\n clearCompileCache,\r\n clearCssGenCache,\r\n getCacheOptimizationHints,\r\n estimateOptimalCacheConfig,\r\n cacheRead,\r\n cacheWrite,\r\n cachePriority,\r\n type CacheOptimizationHints,\r\n type OptimalCacheConfig,\r\n type CacheStatistics,\r\n} from './cacheNative'\r\n","/**\r\n * redisNative.ts\r\n *\r\n * Phase 5.3: Redis Integration - Distributed caching and cluster support\r\n * Exposes 40 Redis functions for high-performance distributed CSS compilation caching\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Redis pool configuration\r\n */\r\nexport interface RedisCacheConfig {\r\n host: string\r\n port: number\r\n database: number\r\n password?: string\r\n pool_size: number\r\n connection_timeout_ms: number\r\n}\r\n\r\n/**\r\n * Redis pool statistics\r\n */\r\nexport interface RedisPoolStats {\r\n connected_count: number\r\n idle_count: number\r\n waiting_count: number\r\n total_requests: number\r\n total_errors: number\r\n}\r\n\r\n/**\r\n * Redis cluster node information\r\n */\r\nexport interface RedisClusterNode {\r\n node_id: string\r\n host: string\r\n port: number\r\n is_master: boolean\r\n slot_range: Array<{ start: number; end: number }>\r\n connected: boolean\r\n}\r\n\r\n/**\r\n * Redis cluster status\r\n */\r\nexport interface RedisClusterStatus {\r\n enabled: boolean\r\n cluster_state: string\r\n nodes: RedisClusterNode[]\r\n slots_assigned: number\r\n slots_ok: number\r\n slots_fail: number\r\n}\r\n\r\n/**\r\n * Key expiration information\r\n */\r\nexport interface KeyExpiration {\r\n key: string\r\n ttl_seconds: number\r\n expiration_timestamp: number\r\n is_persistent: boolean\r\n}\r\n\r\n/**\r\n * Pub/Sub message\r\n */\r\nexport interface PubSubMessage {\r\n channel: string\r\n message: string\r\n timestamp_ms: number\r\n subscriber_count: number\r\n}\r\n\r\n/**\r\n * Connection pool information\r\n */\r\nexport interface PoolInfo {\r\n host: string\r\n port: number\r\n pool_size: number\r\n active_connections: number\r\n idle_connections: number\r\n average_latency_ms: number\r\n}\r\n\r\n/**\r\n * Ping Redis server for connectivity check\r\n *\r\n * @returns \"PONG\" if connected, error message otherwise\r\n *\r\n * @example\r\n * ```ts\r\n * const response = redisPing()\r\n * if (response === \"PONG\") console.log(\"Connected\")\r\n * ```\r\n */\r\nexport function redisPing(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_ping) throw new Error(\"redis_ping not available\")\r\n return native.redis_ping()\r\n}\r\n\r\n/**\r\n * Get value from Redis\r\n *\r\n * @param key - Cache key\r\n * @returns Value if found, null if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const value = redisGet('compiled:bg-blue-600')\r\n * if (value) console.log(JSON.parse(value))\r\n * ```\r\n */\r\nexport function redisGet(key: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.redis_get) throw new Error(\"redis_get not available\")\r\n const result = native.redis_get(key)\r\n return result === \"nil\" ? null : result\r\n}\r\n\r\n/**\r\n * Set value in Redis\r\n *\r\n * @param key - Cache key\r\n * @param value - Value to store\r\n * @param ttl_seconds - Time to live in seconds (optional)\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSet('compiled:bg-blue-600', JSON.stringify(css), 3600)\r\n * ```\r\n */\r\nexport function redisSet(key: string, value: string, ttl_seconds?: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_set) throw new Error(\"redis_set not available\")\r\n return native.redis_set(key, value, ttl_seconds)\r\n}\r\n\r\n/**\r\n * Delete key from Redis\r\n *\r\n * @param key - Cache key\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const deleted = redisDelete('compiled:bg-blue-600')\r\n * console.log(`Deleted ${deleted} keys`)\r\n * ```\r\n */\r\nexport function redisDelete(key: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_delete) throw new Error(\"redis_delete not available\")\r\n return native.redis_delete(key)\r\n}\r\n\r\n/**\r\n * Check if key exists in Redis\r\n *\r\n * @param key - Cache key\r\n * @returns 1 if exists, 0 if not\r\n *\r\n * @example\r\n * ```ts\r\n * if (redisExists('compiled:bg-blue-600')) {\r\n * console.log('Cache hit')\r\n * }\r\n * ```\r\n */\r\nexport function redisExists(key: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_exists) throw new Error(\"redis_exists not available\")\r\n return native.redis_exists(key)\r\n}\r\n\r\n/**\r\n * Get multiple values from Redis (atomic operation)\r\n *\r\n * @param keys - Array of cache keys\r\n * @returns Array of values (null for missing keys)\r\n *\r\n * @example\r\n * ```ts\r\n * const values = redisMget(['key1', 'key2', 'key3'])\r\n * ```\r\n */\r\nexport function redisMget(keys: string[]): Array<string | null> {\r\n const native = getNativeBridge()\r\n if (!native?.redis_mget) throw new Error(\"redis_mget not available\")\r\n const result = native.redis_mget(keys)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return keys.map(() => null)\r\n }\r\n}\r\n\r\n/**\r\n * Set multiple key-value pairs in Redis (atomic operation)\r\n *\r\n * @param pairs - Array of [key, value] tuples\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisMset([\r\n * ['key1', 'value1'],\r\n * ['key2', 'value2']\r\n * ])\r\n * ```\r\n */\r\nexport function redisMset(pairs: Array<[string, string]>): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_mset) throw new Error(\"redis_mset not available\")\r\n return native.redis_mset(pairs)\r\n}\r\n\r\n/**\r\n * Flush all keys from current Redis database\r\n *\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const flushed = redisFlushDb()\r\n * console.log(`Flushed ${flushed} keys from database`)\r\n * ```\r\n */\r\nexport function redisFlushDb(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_flush_db) throw new Error(\"redis_flush_db not available\")\r\n return native.redis_flush_db()\r\n}\r\n\r\n/**\r\n * Flush all keys from all Redis databases (cluster-wide)\r\n *\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const flushed = redisFlushAll()\r\n * console.log(`Flushed ${flushed} keys from all databases`)\r\n * ```\r\n */\r\nexport function redisFlushAll(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_flush_all) throw new Error(\"redis_flush_all not available\")\r\n return native.redis_flush_all()\r\n}\r\n\r\n/**\r\n * Initialize Redis connection pool\r\n *\r\n * @param host - Redis host (e.g., \"localhost\")\r\n * @param port - Redis port (default: 6379)\r\n * @param pool_size - Connection pool size (default: 32)\r\n * @returns Pool info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisPoolConnect('localhost', 6379, 32)\r\n * console.log(info)\r\n * ```\r\n */\r\nexport function redisPoolConnect(host: string, port: number, pool_size?: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_connect) throw new Error(\"redis_pool_connect not available\")\r\n return native.redis_pool_connect(host, port, pool_size)\r\n}\r\n\r\n/**\r\n * Get Redis pool statistics\r\n *\r\n * @returns Pool stats as JSON string\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = redisPoolStats()\r\n * const parsed: RedisPoolStats = JSON.parse(stats)\r\n * console.log(`Connected: ${parsed.connected_count}`)\r\n * ```\r\n */\r\nexport function redisPoolStats(): RedisPoolStats {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_stats) throw new Error(\"redis_pool_stats not available\")\r\n const result = native.redis_pool_stats()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n connected_count: 0,\r\n idle_count: 0,\r\n waiting_count: 0,\r\n total_requests: 0,\r\n total_errors: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Reconnect Redis pool after disconnect\r\n *\r\n * @returns \"OK\" if reconnected\r\n *\r\n * @example\r\n * ```ts\r\n * const result = redisPoolReconnect()\r\n * console.log(result)\r\n * ```\r\n */\r\nexport function redisPoolReconnect(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_reconnect) throw new Error(\"redis_pool_reconnect not available\")\r\n return native.redis_pool_reconnect()\r\n}\r\n\r\n/**\r\n * Enable Redis cluster mode\r\n *\r\n * @param initial_nodes - Initial cluster nodes (host:port format)\r\n * @returns Cluster status JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisEnableCluster(['localhost:6379', 'localhost:6380'])\r\n * ```\r\n */\r\nexport function redisEnableCluster(initial_nodes: string[]): RedisClusterStatus {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_cluster) throw new Error(\"redis_enable_cluster not available\")\r\n const result = native.redis_enable_cluster(initial_nodes)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n enabled: false,\r\n cluster_state: \"error\",\r\n nodes: [],\r\n slots_assigned: 0,\r\n slots_ok: 0,\r\n slots_fail: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Disable Redis cluster mode\r\n *\r\n * @returns \"OK\" when disabled\r\n *\r\n * @example\r\n * ```ts\r\n * const result = redisDisableCluster()\r\n * ```\r\n */\r\nexport function redisDisableCluster(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_cluster) throw new Error(\"redis_disable_cluster not available\")\r\n return native.redis_disable_cluster()\r\n}\r\n\r\n/**\r\n * Get current Redis cluster status\r\n *\r\n * @returns Cluster status information\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisClusterStatus()\r\n * if (status.enabled) console.log(`Cluster has ${status.nodes.length} nodes`)\r\n * ```\r\n */\r\nexport function redisClusterStatus(): RedisClusterStatus {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cluster_status) throw new Error(\"redis_cluster_status not available\")\r\n const result = native.redis_cluster_status()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n enabled: false,\r\n cluster_state: \"unknown\",\r\n nodes: [],\r\n slots_assigned: 0,\r\n slots_ok: 0,\r\n slots_fail: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Subscribe to Redis pub/sub channel\r\n *\r\n * @param channel - Channel name\r\n * @param callback - Function to call on message (optional)\r\n * @returns Subscription ID\r\n *\r\n * @example\r\n * ```ts\r\n * const id = redisSubscribe('cache:updates', (msg) => {\r\n * console.log(`Update: ${msg.message}`)\r\n * })\r\n * ```\r\n */\r\nexport function redisSubscribe(channel: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_subscribe) throw new Error(\"redis_subscribe not available\")\r\n return native.redis_subscribe(channel)\r\n}\r\n\r\n/**\r\n * Publish message to Redis pub/sub channel\r\n *\r\n * @param channel - Channel name\r\n * @param message - Message to publish\r\n * @returns Number of subscribers that received the message\r\n *\r\n * @example\r\n * ```ts\r\n * const count = redisPublish('cache:updates', 'CSS compiled')\r\n * console.log(`Delivered to ${count} subscribers`)\r\n * ```\r\n */\r\nexport function redisPublish(channel: string, message: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_publish) throw new Error(\"redis_publish not available\")\r\n return native.redis_publish(channel, message)\r\n}\r\n\r\n/**\r\n * Set expiration on key\r\n *\r\n * @param key - Cache key\r\n * @param ttl_seconds - Time to live in seconds\r\n * @returns 1 if timeout set, 0 if key doesn't exist\r\n *\r\n * @example\r\n * ```ts\r\n * redisExpirationSet('compiled:bg-blue-600', 3600)\r\n * ```\r\n */\r\nexport function redisExpirationSet(key: string, ttl_seconds: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_expiration_set) throw new Error(\"redis_expiration_set not available\")\r\n return native.redis_expiration_set(key, ttl_seconds)\r\n}\r\n\r\n/**\r\n * Get expiration info for key\r\n *\r\n * @param key - Cache key\r\n * @returns Expiration information\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisExpirationGet('compiled:bg-blue-600')\r\n * console.log(`TTL: ${info.ttl_seconds} seconds`)\r\n * ```\r\n */\r\nexport function redisExpirationGet(key: string): KeyExpiration {\r\n const native = getNativeBridge()\r\n if (!native?.redis_expiration_get) throw new Error(\"redis_expiration_get not available\")\r\n const result = native.redis_expiration_get(key)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n key,\r\n ttl_seconds: -1,\r\n expiration_timestamp: 0,\r\n is_persistent: true,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Get Redis server info\r\n *\r\n * @returns Server information JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisInfo()\r\n * ```\r\n */\r\nexport function redisInfo(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_info) throw new Error(\"redis_info not available\")\r\n return native.redis_info()\r\n}\r\n\r\n/**\r\n * Monitor Redis operations in real-time (for debugging)\r\n *\r\n * @returns Monitor output stream\r\n *\r\n * @example\r\n * ```ts\r\n * const monitor = redisMonitor()\r\n * // Logs all Redis operations\r\n * ```\r\n */\r\nexport function redisMonitor(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_monitor) throw new Error(\"redis_monitor not available\")\r\n return native.redis_monitor()\r\n}\r\n\r\n/**\r\n * Get size of cache in bytes\r\n *\r\n * @returns Total memory usage in bytes\r\n *\r\n * @example\r\n * ```ts\r\n * const bytes = redisCacheSize()\r\n * console.log(`Cache: ${bytes / 1024 / 1024} MB`)\r\n * ```\r\n */\r\nexport function redisCacheSize(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_size) throw new Error(\"redis_cache_size not available\")\r\n return native.redis_cache_size()\r\n}\r\n\r\n/**\r\n * Get number of keys in cache\r\n *\r\n * @returns Total key count\r\n *\r\n * @example\r\n * ```ts\r\n * const count = redisCacheKeyCount()\r\n * console.log(`Cached keys: ${count}`)\r\n * ```\r\n */\r\nexport function redisCacheKeyCount(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_key_count) throw new Error(\"redis_cache_key_count not available\")\r\n return native.redis_cache_key_count()\r\n}\r\n\r\n/**\r\n * Clear Redis cache and reset statistics\r\n *\r\n * @returns Number of keys cleared\r\n *\r\n * @example\r\n * ```ts\r\n * const cleared = redisCacheClear()\r\n * console.log(`Cleared ${cleared} keys`)\r\n * ```\r\n */\r\nexport function redisCacheClear(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_clear) throw new Error(\"redis_cache_clear not available\")\r\n return native.redis_cache_clear()\r\n}\r\n\r\n/**\r\n * Get Redis cache hit rate statistics\r\n *\r\n * @returns Hit rate percentage (0-100)\r\n *\r\n * @example\r\n * ```ts\r\n * const hitRate = redisCacheHitRate()\r\n * console.log(`Hit rate: ${hitRate}%`)\r\n * ```\r\n */\r\nexport function redisCacheHitRate(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_hit_rate) throw new Error(\"redis_cache_hit_rate not available\")\r\n return native.redis_cache_hit_rate()\r\n}\r\n\r\n/**\r\n * Enable Redis persistence (AOF/RDB)\r\n *\r\n * @param mode - \"aof\" or \"rdb\"\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisEnablePersistence('aof')\r\n * ```\r\n */\r\nexport function redisEnablePersistence(mode: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_persistence) throw new Error(\"redis_enable_persistence not available\")\r\n return native.redis_enable_persistence(mode)\r\n}\r\n\r\n/**\r\n * Disable Redis persistence\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisDisablePersistence()\r\n * ```\r\n */\r\nexport function redisDisablePersistence(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_persistence) throw new Error(\"redis_disable_persistence not available\")\r\n return native.redis_disable_persistence()\r\n}\r\n\r\n/**\r\n * Save Redis data to disk (snapshot)\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSnapshot()\r\n * ```\r\n */\r\nexport function redisSnapshot(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_snapshot) throw new Error(\"redis_snapshot not available\")\r\n return native.redis_snapshot()\r\n}\r\n\r\n/**\r\n * Get Redis memory statistics and recommendations\r\n *\r\n * @returns Memory info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const memory = redisMemoryStats()\r\n * console.log(memory)\r\n * ```\r\n */\r\nexport function redisMemoryStats(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_memory_stats) throw new Error(\"redis_memory_stats not available\")\r\n return native.redis_memory_stats()\r\n}\r\n\r\n/**\r\n * Optimize Redis memory usage\r\n *\r\n * @returns Number of keys optimized\r\n *\r\n * @example\r\n * ```ts\r\n * const optimized = redisOptimizeMemory()\r\n * console.log(`Optimized ${optimized} keys`)\r\n * ```\r\n */\r\nexport function redisOptimizeMemory(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_optimize_memory) throw new Error(\"redis_optimize_memory not available\")\r\n return native.redis_optimize_memory()\r\n}\r\n\r\n/**\r\n * Set Redis key eviction policy\r\n *\r\n * @param policy - LRU, LFU, TTL, RANDOM, etc.\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSetEvictionPolicy('allkeys-lru')\r\n * ```\r\n */\r\nexport function redisSetEvictionPolicy(policy: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_set_eviction_policy) throw new Error(\"redis_set_eviction_policy not available\")\r\n return native.redis_set_eviction_policy(policy)\r\n}\r\n\r\n/**\r\n * Get current Redis eviction policy\r\n *\r\n * @returns Current policy name\r\n *\r\n * @example\r\n * ```ts\r\n * const policy = redisGetEvictionPolicy()\r\n * console.log(`Eviction policy: ${policy}`)\r\n * ```\r\n */\r\nexport function redisGetEvictionPolicy(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_get_eviction_policy) throw new Error(\"redis_get_eviction_policy not available\")\r\n return native.redis_get_eviction_policy()\r\n}\r\n\r\n/**\r\n * Replicate data to another Redis instance\r\n *\r\n * @param target_host - Target host\r\n * @param target_port - Target port\r\n * @returns Number of keys replicated\r\n *\r\n * @example\r\n * ```ts\r\n * const replicated = redisReplicate('replica.example.com', 6379)\r\n * console.log(`Replicated ${replicated} keys`)\r\n * ```\r\n */\r\nexport function redisReplicate(target_host: string, target_port: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_replicate) throw new Error(\"redis_replicate not available\")\r\n return native.redis_replicate(target_host, target_port)\r\n}\r\n\r\n/**\r\n * Get replication status\r\n *\r\n * @returns Replication info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisReplicationStatus()\r\n * console.log(status)\r\n * ```\r\n */\r\nexport function redisReplicationStatus(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_replication_status) throw new Error(\"redis_replication_status not available\")\r\n return native.redis_replication_status()\r\n}\r\n\r\n/**\r\n * Sync cache between Redis instances (distributed cache sync)\r\n *\r\n * @param peers - Array of peer Redis addresses\r\n * @returns Number of keys synced\r\n *\r\n * @example\r\n * ```ts\r\n * const synced = redisCacheSync(['redis1:6379', 'redis2:6379'])\r\n * console.log(`Synced ${synced} keys`)\r\n * ```\r\n */\r\nexport function redisCacheSync(peers: string[]): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_sync) throw new Error(\"redis_cache_sync not available\")\r\n return native.redis_cache_sync(peers)\r\n}\r\n\r\n/**\r\n * Enable automatic cache warming\r\n *\r\n * @param key_pattern - Glob pattern for keys to warm (e.g., \"compiled:*\")\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisEnableCacheWarming('compiled:*')\r\n * ```\r\n */\r\nexport function redisEnableCacheWarming(key_pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_cache_warming) throw new Error(\"redis_enable_cache_warming not available\")\r\n return native.redis_enable_cache_warming(key_pattern)\r\n}\r\n\r\n/**\r\n * Disable cache warming\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisDisableCacheWarming()\r\n * ```\r\n */\r\nexport function redisDisableCacheWarming(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_cache_warming) throw new Error(\"redis_disable_cache_warming not available\")\r\n return native.redis_disable_cache_warming()\r\n}\r\n\r\n/**\r\n * Diagnose Redis connection issues\r\n *\r\n * @returns Diagnostic report\r\n *\r\n * @example\r\n * ```ts\r\n * const diagnosis = redisDiagnose()\r\n * console.log(diagnosis)\r\n * ```\r\n */\r\nexport function redisDiagnose(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_diagnose) throw new Error(\"redis_diagnose not available\")\r\n return native.redis_diagnose()\r\n}\r\n","/**\r\n * Redis Sub-entry Point\r\n * \r\n * Exports Redis and distributed cache functionality.\r\n * - Redis operations (get, set, delete, etc.)\r\n * - Redis pool management\r\n * - Cluster management\r\n * - Cache synchronization\r\n * - Persistence management\r\n */\r\n\r\nexport {\r\n redisPing,\r\n redisGet,\r\n redisSet,\r\n redisDelete,\r\n redisExists,\r\n redisMget,\r\n redisMset,\r\n redisFlushDb,\r\n redisFlushAll,\r\n redisPoolConnect,\r\n redisPoolStats,\r\n redisPoolReconnect,\r\n redisEnableCluster,\r\n redisDisableCluster,\r\n redisClusterStatus,\r\n redisSubscribe,\r\n redisPublish,\r\n redisExpirationSet,\r\n redisExpirationGet,\r\n redisInfo,\r\n redisMonitor,\r\n redisCacheSize,\r\n redisCacheKeyCount,\r\n redisCacheClear,\r\n redisCacheHitRate,\r\n redisEnablePersistence,\r\n redisDisablePersistence,\r\n redisSnapshot,\r\n redisMemoryStats,\r\n redisOptimizeMemory,\r\n redisSetEvictionPolicy,\r\n redisGetEvictionPolicy,\r\n redisReplicate,\r\n redisReplicationStatus,\r\n redisCacheSync,\r\n redisEnableCacheWarming,\r\n redisDisableCacheWarming,\r\n redisDiagnose,\r\n type RedisCacheConfig,\r\n type RedisPoolStats,\r\n type RedisClusterNode,\r\n type RedisClusterStatus,\r\n type KeyExpiration,\r\n type PubSubMessage,\r\n type PoolInfo,\r\n} from './redisNative'\r\n","/**\r\n * watchSystemNative.ts\r\n *\r\n * Phase 5.4: Watch System & File Monitoring - Real-time CSS recompilation\r\n * Exposes 12 watch/monitoring functions for hot-reload and incremental compilation\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * File watch event\r\n */\r\nexport interface WatchEvent {\r\n event_type: \"create\" | \"modify\" | \"delete\" | \"rename\"\r\n file_path: string\r\n timestamp_ms: number\r\n is_dir: boolean\r\n}\r\n\r\n/**\r\n * Watch handle for tracking active watchers\r\n */\r\nexport interface WatchHandle {\r\n handle_id: number\r\n patterns: string[]\r\n is_running: boolean\r\n created_at_ms: number\r\n}\r\n\r\n/**\r\n * Watch statistics\r\n */\r\nexport interface WatchStats {\r\n active_watchers: number\r\n total_events: number\r\n events_this_second: number\r\n average_latency_ms: number\r\n largest_batch_size: number\r\n}\r\n\r\n/**\r\n * Start file system watcher for directory\r\n *\r\n * @param root_path - Directory to watch\r\n * @param patterns - Glob patterns to match (e.g., [\"*.tsx\", \"*.ts\"])\r\n * @returns Handle ID for the watcher\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = startWatch('./src', ['*.tsx', '*.ts'])\r\n * // Watcher is now active\r\n * ```\r\n */\r\nexport function startWatch(root_path: string, patterns?: string[]): number {\r\n const native = getNativeBridge()\r\n if (!native?.start_watch) throw new Error(\"start_watch not available\")\r\n return native.start_watch(root_path, patterns)\r\n}\r\n\r\n/**\r\n * Poll for watch events (non-blocking)\r\n *\r\n * @param handle - Watcher handle from startWatch()\r\n * @param timeout_ms - Max time to wait for events (default: 100)\r\n * @returns Array of watch events\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = startWatch('./src', ['*.tsx'])\r\n * const events = pollWatchEvents(handle, 100)\r\n * events.forEach(evt => {\r\n * console.log(`${evt.event_type}: ${evt.file_path}`)\r\n * })\r\n * ```\r\n */\r\nexport function pollWatchEvents(handle: number, timeout_ms?: number): WatchEvent[] {\r\n const native = getNativeBridge()\r\n if (!native?.poll_watch_events) throw new Error(\"poll_watch_events not available\")\r\n const result = native.poll_watch_events(handle, timeout_ms)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Stop file system watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @returns Number of events processed before stopping\r\n *\r\n * @example\r\n * ```ts\r\n * const eventsProcessed = stopWatch(handle)\r\n * console.log(`Watcher processed ${eventsProcessed} events`)\r\n * ```\r\n */\r\nexport function stopWatch(handle: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.stop_watch) throw new Error(\"stop_watch not available\")\r\n return native.stop_watch(handle)\r\n}\r\n\r\n/**\r\n * Add pattern to active watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @param pattern - Glob pattern to add (e.g., \"*.md\")\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchAddPattern(handle, '*.md')\r\n * // Now watching markdown files too\r\n * ```\r\n */\r\nexport function watchAddPattern(handle: number, pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_add_pattern) throw new Error(\"watch_add_pattern not available\")\r\n return native.watch_add_pattern(handle, pattern)\r\n}\r\n\r\n/**\r\n * Remove pattern from watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @param pattern - Pattern to remove\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchRemovePattern(handle, '*.md')\r\n * ```\r\n */\r\nexport function watchRemovePattern(handle: number, pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_remove_pattern) throw new Error(\"watch_remove_pattern not available\")\r\n return native.watch_remove_pattern(handle, pattern)\r\n}\r\n\r\n/**\r\n * Get all active watcher handles\r\n *\r\n * @returns Array of active watch handles\r\n *\r\n * @example\r\n * ```ts\r\n * const handles = watchGetActiveHandles()\r\n * console.log(`${handles.length} active watchers`)\r\n * ```\r\n */\r\nexport function watchGetActiveHandles(): WatchHandle[] {\r\n const native = getNativeBridge()\r\n if (!native?.watch_get_active_handles) throw new Error(\"watch_get_active_handles not available\")\r\n const result = native.watch_get_active_handles()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Clear all active watchers\r\n *\r\n * @returns Number of watchers cleared\r\n *\r\n * @example\r\n * ```ts\r\n * const cleared = watchClearAll()\r\n * console.log(`Cleared ${cleared} watchers`)\r\n * ```\r\n */\r\nexport function watchClearAll(): number {\r\n const native = getNativeBridge()\r\n if (!native?.watch_clear_all) throw new Error(\"watch_clear_all not available\")\r\n return native.watch_clear_all()\r\n}\r\n\r\n/**\r\n * Convert watch event type to string\r\n *\r\n * @param event_type_code - Event type code (0-3)\r\n * @returns Event type as string\r\n *\r\n * @example\r\n * ```ts\r\n * const typeStr = watchEventTypeToString(0)\r\n * console.log(typeStr) // \"create\"\r\n * ```\r\n */\r\nexport function watchEventTypeToString(event_type_code: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_event_type_to_string) throw new Error(\"watch_event_type_to_string not available\")\r\n return native.watch_event_type_to_string(event_type_code)\r\n}\r\n\r\n/**\r\n * Check if watcher is running\r\n *\r\n * @param handle - Watcher handle\r\n * @returns True if running\r\n *\r\n * @example\r\n * ```ts\r\n * if (isWatchRunning(handle)) {\r\n * console.log(\"Watcher is active\")\r\n * }\r\n * ```\r\n */\r\nexport function isWatchRunning(handle: number): boolean {\r\n const native = getNativeBridge()\r\n if (!native?.is_watch_running) throw new Error(\"is_watch_running not available\")\r\n return native.is_watch_running(handle)\r\n}\r\n\r\n/**\r\n * Get watch system statistics\r\n *\r\n * @returns Watch statistics\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getWatchStats()\r\n * console.log(`Active: ${stats.active_watchers}, Events: ${stats.total_events}`)\r\n * ```\r\n */\r\nexport function getWatchStats(): WatchStats {\r\n const native = getNativeBridge()\r\n if (!native?.get_watch_stats) throw new Error(\"get_watch_stats not available\")\r\n const result = native.get_watch_stats()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n active_watchers: 0,\r\n total_events: 0,\r\n events_this_second: 0,\r\n average_latency_ms: 0,\r\n largest_batch_size: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Pause watching (pause event delivery without stopping watcher)\r\n *\r\n * @param handle - Watcher handle\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchPause(handle)\r\n * // Events still detected but not delivered\r\n * ```\r\n */\r\nexport function watchPause(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_pause) throw new Error(\"watch_pause not available\")\r\n return native.watch_pause(handle)\r\n}\r\n\r\n/**\r\n * Resume watching after pause\r\n *\r\n * @param handle - Watcher handle\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchResume(handle)\r\n * // Event delivery resumes\r\n * ```\r\n */\r\nexport function watchResume(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_resume) throw new Error(\"watch_resume not available\")\r\n return native.watch_resume(handle)\r\n}\r\n\r\n/**\r\n * Scan cache and get optimization recommendations\r\n *\r\n * @returns Optimization hints JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const hints = scanCacheOptimizations()\r\n * console.log(hints)\r\n * ```\r\n */\r\nexport function scanCacheOptimizations(): string {\r\n const native = getNativeBridge()\r\n if (!native?.scan_cache_optimizations) throw new Error(\"scan_cache_optimizations not available\")\r\n return native.scan_cache_optimizations()\r\n}\r\n\r\n/**\r\n * Get plugin hook list\r\n *\r\n * @returns Available plugin hooks\r\n *\r\n * @example\r\n * ```ts\r\n * const hooks = getPluginHooks()\r\n * console.log(hooks)\r\n * ```\r\n */\r\nexport function getPluginHooks(): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.get_plugin_hooks) throw new Error(\"get_plugin_hooks not available\")\r\n const result = native.get_plugin_hooks()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Register plugin hook handler\r\n *\r\n * @param hook_name - Hook name\r\n * @param handler_id - Handler identifier\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * registerPluginHook('compile:before', 'my-handler-1')\r\n * ```\r\n */\r\nexport function registerPluginHook(hook_name: string, handler_id: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.register_plugin_hook) throw new Error(\"register_plugin_hook not available\")\r\n return native.register_plugin_hook(hook_name, handler_id)\r\n}\r\n\r\n/**\r\n * Unregister plugin hook handler\r\n *\r\n * @param hook_name - Hook name\r\n * @param handler_id - Handler identifier\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * unregisterPluginHook('compile:before', 'my-handler-1')\r\n * ```\r\n */\r\nexport function unregisterPluginHook(hook_name: string, handler_id: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.unregister_plugin_hook) throw new Error(\"unregister_plugin_hook not available\")\r\n return native.unregister_plugin_hook(hook_name, handler_id)\r\n}\r\n\r\n/**\r\n * Emit plugin hook event\r\n *\r\n * @param hook_name - Hook name\r\n * @param data_json - Event data as JSON\r\n * @returns Modified data\r\n *\r\n * @example\r\n * ```ts\r\n * const result = emitPluginHook('compile:before', JSON.stringify({css: '...'}))\r\n * ```\r\n */\r\nexport function emitPluginHook(hook_name: string, data_json: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.emit_plugin_hook) throw new Error(\"emit_plugin_hook not available\")\r\n return native.emit_plugin_hook(hook_name, data_json)\r\n}\r\n\r\n/**\r\n * Get compilation performance metrics\r\n *\r\n * @returns Performance metrics\r\n *\r\n * @example\r\n * ```ts\r\n * const metrics = getCompilationMetrics()\r\n * console.log(metrics)\r\n * ```\r\n */\r\nexport function getCompilationMetrics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.get_compilation_metrics) throw new Error(\"get_compilation_metrics not available\")\r\n return native.get_compilation_metrics()\r\n}\r\n\r\n/**\r\n * Reset compilation performance counters\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * resetCompilationMetrics()\r\n * ```\r\n */\r\nexport function resetCompilationMetrics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.reset_compilation_metrics) throw new Error(\"reset_compilation_metrics not available\")\r\n return native.reset_compilation_metrics()\r\n}\r\n\r\n/**\r\n * Validate CSS output for errors\r\n *\r\n * @param css - CSS to validate\r\n * @returns Validation result as JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const result = validateCssOutput('.test { color: red; }')\r\n * ```\r\n */\r\nexport function validateCssOutput(css: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.validate_css_output) throw new Error(\"validate_css_output not available\")\r\n return native.validate_css_output(css)\r\n}\r\n\r\n/**\r\n * Get compiler diagnostics\r\n *\r\n * @returns Diagnostic information\r\n *\r\n * @example\r\n * ```ts\r\n * const diagnostics = getCompilerDiagnostics()\r\n * console.log(diagnostics)\r\n * ```\r\n */\r\nexport function getCompilerDiagnostics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.get_compiler_diagnostics) throw new Error(\"get_compiler_diagnostics not available\")\r\n return native.get_compiler_diagnostics()\r\n}\r\n","/**\r\n * Watch Sub-entry Point\r\n * \r\n * Exports file watching and compilation monitoring functionality.\r\n * - File system watching\r\n * - Watch event polling and management\r\n * - Watch statistics\r\n * - Plugin hooks\r\n * - Compilation metrics\r\n */\r\n\r\nexport {\r\n startWatch,\r\n pollWatchEvents,\r\n stopWatch,\r\n watchAddPattern,\r\n watchRemovePattern,\r\n watchGetActiveHandles,\r\n watchClearAll,\r\n watchEventTypeToString,\r\n isWatchRunning,\r\n getWatchStats,\r\n watchPause,\r\n watchResume,\r\n scanCacheOptimizations,\r\n getPluginHooks,\r\n registerPluginHook,\r\n unregisterPluginHook,\r\n emitPluginHook,\r\n getCompilationMetrics,\r\n resetCompilationMetrics,\r\n validateCssOutput,\r\n getCompilerDiagnostics,\r\n type WatchEvent,\r\n type WatchHandle,\r\n type WatchStats,\r\n} from './watchSystemNative'\r\n","/**\r\n * tailwind-styled-v5 — Compiler Main Entry Point\r\n * \r\n * Re-exports all sub-entry points for backward compatibility.\r\n * For better tree-shaking, import from specific sub-entries:\r\n * - '@tailwind-styled/compiler/compiler' - CSS generation and compilation\r\n * - '@tailwind-styled/compiler/parser' - Class parsing and extraction\r\n * - '@tailwind-styled/compiler/analyzer' - Analysis and optimization\r\n * - '@tailwind-styled/compiler/cache' - Cache management\r\n * - '@tailwind-styled/compiler/redis' - Redis and distributed cache\r\n * - '@tailwind-styled/compiler/watch' - File watching and monitoring\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\n\r\nimport { getNativeBridge, resetNativeBridgeCache, adaptNativeResult, type NativeBridge, type NativeTransformResult, type ClassExtractResult, type ComponentMetadata, type NativeRscResult } from \"./nativeBridge\"\r\n\r\nexport { getNativeBridge, resetNativeBridgeCache, adaptNativeResult }\r\nexport type { NativeBridge, NativeTransformResult, ClassExtractResult, ComponentMetadata, NativeRscResult }\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// RE-EXPORT ALL SUB-ENTRIES FOR BACKWARD COMPATIBILITY\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\n// Compiler sub-entry - CSS generation, compilation, ID registry, streaming\r\nexport * from './compiler'\r\n\r\n// Parser sub-entry - Class parsing and extraction\r\nexport * from './parser'\r\n\r\n// Analyzer sub-entry - Analysis, optimization, theme resolution\r\nexport * from './analyzer'\r\n\r\n// Cache sub-entry - Cache management\r\nexport * from './cache'\r\n\r\n// Redis sub-entry - Redis and distributed cache\r\nexport * from './redis'\r\n\r\n// Watch sub-entry - File watching and monitoring\r\nexport * from './watch'\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// TRANSFORM & CORE FUNCTIONS\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const transformSource = (source: string, opts?: Record<string, unknown>) => {\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(source, opts as Record<string, string>)\r\n if (!result) {\r\n throw new Error(\"FATAL: transformSource returned null\")\r\n }\r\n return result\r\n}\r\n\r\nexport const hasTwUsage = (source: string): boolean => {\r\n const native = getNativeBridge()\r\n if (!native?.hasTwUsage) {\r\n throw new Error(\"FATAL: Native binding 'hasTwUsage' is required but not available.\")\r\n }\r\n return native.hasTwUsage(source)\r\n}\r\n\r\nexport const isAlreadyTransformed = (source: string): boolean => {\r\n const native = getNativeBridge()\r\n if (!native?.isAlreadyTransformed) {\r\n throw new Error(\"FATAL: Native binding 'isAlreadyTransformed' is required but not available.\")\r\n }\r\n return native.isAlreadyTransformed(source)\r\n}\r\n\r\nexport const shouldProcess = (source: string): boolean => {\r\n return hasTwUsage(source) && !isAlreadyTransformed(source)\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// ADDITIONAL UTILITIES\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const compileCssFromClasses = (classes: string[], prefix?: string | null) => {\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(classes.join(\" \"), { prefix: prefix ?? \"\" })\r\n if (!result) {\r\n throw new Error(\"FATAL: transformSource returned null\")\r\n }\r\n return result\r\n}\r\n\r\nexport const buildStyleTag = (classes: string[]): string => {\r\n const result = compileCssFromClasses(classes)\r\n return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : \"\"\r\n}\r\n\r\nexport const generateCssForClasses = async (\r\n classes: string[],\r\n _tailwindConfig?: Record<string, unknown>,\r\n root?: string,\r\n cssEntryContent?: string,\r\n minify = false\r\n): Promise<string> => {\r\n try {\r\n const { runCssPipeline } = await import(\"./compiler/tailwindEngine\")\r\n const result = await runCssPipeline(classes, cssEntryContent, root, minify)\r\n return result.css\r\n } catch {\r\n // Fallback if import fails\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(classes.join(\" \"), {})\r\n return result?.code || \"\"\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// DEAD STYLE ELIMINATION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const eliminateDeadCss = (css: string, deadClasses: Set<string>): string => {\r\n const native = getNativeBridge()\r\n if (!native?.eliminateDeadCss) {\r\n throw new Error(\"FATAL: Native binding 'eliminateDeadCss' is required but not available.\")\r\n }\r\n return native.eliminateDeadCss(css, Array.from(deadClasses)) as string\r\n}\r\n\r\nexport const findDeadVariants = (\r\n variantConfig: Record<string, unknown> | Array<{ name: string; variants: Record<string, Record<string, string>>; defaultVariants?: Record<string, string> }>,\r\n usage: Record<string, Set<string>>\r\n) => {\r\n const unused: string[] = []\r\n\r\n const configs = Array.isArray(variantConfig)\r\n ? variantConfig\r\n : [{ name: \"__root__\", variants: variantConfig as Record<string, Record<string, string>> }]\r\n\r\n for (const component of configs) {\r\n const componentUsage = usage[component.name] ?? new Set<string>()\r\n const variants = component.variants as Record<string, Record<string, string>>\r\n for (const [key, values] of Object.entries(variants)) {\r\n for (const [value] of Object.entries(values)) {\r\n if (!componentUsage.has(`${key}:${value}`)) {\r\n unused.push(`${component.name !== \"__root__\" ? `${component.name}/` : \"\"}${key}:${value}`)\r\n }\r\n }\r\n }\r\n }\r\n\r\n return { unusedCount: unused.length, unused }\r\n}\r\n\r\nexport const runElimination = (css: string, scanResult: unknown): string => {\r\n const native = getNativeBridge()\r\n if (!native?.detectDeadCode) {\r\n throw new Error(\"FATAL: Native binding 'detectDeadCode' is required but not available.\")\r\n }\r\n const dead = native.detectDeadCode(JSON.stringify(scanResult), css) as { deadInCss: string[] }\r\n return eliminateDeadCss(css, new Set(dead.deadInCss ?? []))\r\n}\r\n\r\nexport const scanProjectUsage = (dirs: string[], cwd: string) => {\r\n // Import locally to avoid circular dependency\r\n const { batchExtractClasses } = require('./parser')\r\n const files = dirs.map(dir => path.resolve(cwd, dir))\r\n const results = batchExtractClasses(files) || []\r\n\r\n const combined: Record<string, Record<string, Set<string>>> = {}\r\n for (const result of results) {\r\n if (result.ok && result.classes) {\r\n for (const cls of result.classes) {\r\n if (!combined[cls]) combined[cls] = {}\r\n combined[cls][result.file] = new Set([cls])\r\n }\r\n }\r\n }\r\n return combined\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// CONFIG & UTILITIES\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const generateSafelist = (scanDirs: string[], outputPath?: string, cwd?: string) => {\r\n const classes = scanProjectUsage(scanDirs, cwd || process.cwd())\r\n const allClasses = Object.keys(classes).sort()\r\n if (outputPath) {\r\n fs.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2))\r\n }\r\n return allClasses\r\n}\r\n\r\nexport const loadSafelist = (safelistPath: string): string[] => {\r\n try {\r\n const content = fs.readFileSync(safelistPath, \"utf-8\")\r\n return JSON.parse(content)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\nexport const loadTailwindConfig = (cwd: string = process.cwd()) => {\r\n const configFiles = [\r\n \"tailwind.config.ts\",\r\n \"tailwind.config.js\",\r\n \"tailwind.config.mjs\",\r\n \"tailwind.config.cjs\",\r\n ]\r\n for (const file of configFiles) {\r\n const fullPath = path.join(cwd, file)\r\n if (fs.existsSync(fullPath)) {\r\n const mod = require(fullPath) as { default?: unknown }\r\n return mod.default || mod\r\n }\r\n }\r\n return {}\r\n}\r\n\r\nexport const getContentPaths = (cwd: string = process.cwd()) => {\r\n return {\r\n content: [\r\n path.join(cwd, \"src/**/*.{js,ts,jsx,tsx}\"),\r\n path.join(cwd, \"app/**/*.{js,ts,jsx,tsx}\"),\r\n path.join(cwd, \"pages/**/*.{js,ts,jsx,tsx}\"),\r\n ],\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// CONTAINER CSS EXTRACTION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nfunction _layoutClassesToCss(classes: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.layoutClassesToCss) {\r\n throw new Error(\"FATAL: Native binding 'layoutClassesToCss' is required but not available.\")\r\n }\r\n return native.layoutClassesToCss(classes)\r\n}\r\n\r\nfunction _hashContainer(tag: string, containerJson: string, name?: string): string {\r\n const sortedKey = tag + (name ?? \"\") + containerJson\r\n const native = getNativeBridge()\r\n if (!native?.hashContent) {\r\n throw new Error(\"FATAL: Native binding 'hashContent' is required but not available.\")\r\n }\r\n return `tw-cq-${native.hashContent(sortedKey, \"fnv\", 6)}`\r\n}\r\n\r\nconst _CONTAINER_BREAKPOINTS: Record<string, string> = {\r\n xs: \"240px\",\r\n sm: \"320px\",\r\n md: \"640px\",\r\n lg: \"1024px\",\r\n xl: \"1280px\",\r\n \"2xl\": \"1536px\",\r\n}\r\n\r\nexport function extractContainerCssFromSource(source: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwContainerConfigs) {\r\n throw new Error(\"FATAL: Native binding 'extractTwContainerConfigs' is required but not available.\")\r\n }\r\n\r\n const configs = native.extractTwContainerConfigs(source) as Array<{\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n }>\r\n\r\n const rules: string[] = []\r\n for (const cfg of configs) {\r\n const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName)\r\n for (const { key, classes } of cfg.breakpoints) {\r\n const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key\r\n const css = _layoutClassesToCss(classes)\r\n if (!css) continue\r\n const query = cfg.containerName\r\n ? `@container ${cfg.containerName} (min-width: ${minWidth})`\r\n : `@container (min-width: ${minWidth})`\r\n rules.push(`${query}{.${id}{${css}}}`)\r\n }\r\n }\r\n return rules.join(\"\\n\")\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// LOADER INTERFACE\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport type LoaderOutput = {\r\n code: string\r\n changed: boolean\r\n classes: string[]\r\n staticCss?: string\r\n rsc?: { isServer?: boolean; needsClientDirective?: boolean; clientReasons?: string[] }\r\n engine?: string\r\n}\r\n\r\nexport const runLoaderTransform = (ctx: { filepath: string; source: string; options?: Record<string, unknown> }) => {\r\n const { filepath, source, options } = ctx\r\n const result = transformSource(source, { filename: filepath, ...options })\r\n\r\n let staticCss: string | undefined\r\n try {\r\n const cssChunks: string[] = []\r\n\r\n const stateRules = extractAndGenerateStateCss(source, filepath)\r\n if (stateRules.length > 0) {\r\n cssChunks.push(stateRules.map((r) => r.cssRule).join(\"\\n\"))\r\n }\r\n\r\n const containerCss = extractContainerCssFromSource(source)\r\n if (containerCss) cssChunks.push(containerCss)\r\n\r\n const combined = cssChunks.join(\"\\n\").trim()\r\n if (combined) staticCss = combined\r\n } catch (err) {\r\n // Non-fatal — static CSS extraction failure should not break transform pipeline.\r\n console.debug(\"Static CSS extraction warning:\", err)\r\n }\r\n\r\n return {\r\n code: result?.code || \"\",\r\n changed: result?.changed || false,\r\n classes: result?.classes || [],\r\n staticCss,\r\n } as LoaderOutput\r\n}\r\n\r\nexport const shouldSkipFile = (filepath: string): boolean => {\r\n const SKIP_PATHS = [\"node_modules\", \".next\", \".rspack-dist\", \".turbo\", \"dist/\", \"out/\"]\r\n const skipExtensions = [\".css\", \".json\", \".md\", \".txt\", \".yaml\", \".yml\"]\r\n for (const p of SKIP_PATHS) {\r\n if (filepath.includes(p)) return true\r\n }\r\n for (const ext of skipExtensions) {\r\n if (filepath.endsWith(ext)) return true\r\n }\r\n return false\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// ROUTE MANAGEMENT\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const fileToRoute = (filepath: string): string | null => {\r\n const normalized = filepath.replace(/\\\\/g, \"/\")\r\n if (normalized.includes(\"/layout.\") || normalized.includes(\"/loading.\") || normalized.includes(\"/error.\")) {\r\n return \"__global\"\r\n }\r\n const pageMatch = normalized.match(/\\/app\\/(.+?)\\/page\\.[tj]sx?$/)\r\n if (pageMatch) return `/${pageMatch[1]}`\r\n const rootPage = normalized.match(/\\/app\\/page\\.[tj]sx?$/)\r\n if (rootPage) return \"/\"\r\n return null\r\n}\r\n\r\nexport const getAllRoutes = (): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClasses' is required but not available.\")\r\n }\r\n return [\"/\", \"__global\"]\r\n}\r\n\r\nexport const getRouteClasses = (_route: string): Set<string> => new Set()\r\nexport const registerFileClasses = (_filepath: string, _classes: string[]): void => {}\r\nexport const registerGlobalClasses = (_classes: string[]): void => {}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// INCREMENTAL ENGINE\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nlet _incrementalEngineInstance: InstanceType<typeof IncrementalEngine> | null = null\r\n\r\nexport const getIncrementalEngine = () => {\r\n if (!_incrementalEngineInstance) {\r\n _incrementalEngineInstance = new IncrementalEngine()\r\n }\r\n return _incrementalEngineInstance\r\n}\r\n\r\nexport const resetIncrementalEngine = (): void => {\r\n _incrementalEngineInstance = null\r\n}\r\n\r\nexport class IncrementalEngine {\r\n compile(source: string) {\r\n return transformSource(source)\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// STYLE BUCKET SYSTEM\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const getBucketEngine = () => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n return {\r\n add: (className: string) => className,\r\n get: (_bucket: string): string[] => [],\r\n }\r\n}\r\n\r\nexport const resetBucketEngine = (): void => {}\r\n\r\nexport class BucketEngine {\r\n add(className: string) { return className }\r\n}\r\n\r\nexport const classifyNode = (_node: unknown): string => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n return \"unknown\"\r\n}\r\n\r\nexport const detectConflicts = (_classes: string[]): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClassUsage) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClassUsage' is required but not available.\")\r\n }\r\n return []\r\n}\r\n\r\nexport const bucketSort = (classes: string[]): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n const sorted = native.classifyAndSortClasses(classes)\r\n return sorted.map((c) => (c as { raw?: string }).raw ?? (c as unknown as string))\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// RSC & FILE ANALYSIS CONTINUED\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const analyzeFile = (source: string, filename: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeRsc) {\r\n throw new Error(\"FATAL: Native binding 'analyzeRsc' is required but not available.\")\r\n }\r\n const rsc = native.analyzeRsc(source, filename)\r\n return {\r\n isServer: rsc?.isServer ?? true,\r\n needsClientDirective: rsc?.needsClientDirective ?? false,\r\n clientReasons: rsc?.clientReasons ?? [],\r\n interactiveClasses: [],\r\n canStaticResolveVariants: true,\r\n }\r\n}\r\n\r\nexport const analyzeVariantUsage = (_source: string, _componentName: string, _variantKeys: string[]) => {\r\n return { resolved: {} as Record<string, string>, dynamic: [] as string[] }\r\n}\r\n\r\nexport const injectClientDirective = (source: string): string => {\r\n if (!source.includes('\"use client\"') && !source.includes(\"'use client'\")) {\r\n return '\"use client\";\\n' + source\r\n }\r\n return source\r\n}\r\n\r\nexport const injectServerOnlyComment = (source: string): string => {\r\n return `/* @server-only */\\n${source}`\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// FULL ANALYSIS\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const analyzeClasses = (filesJson: string, cwd: string, flags: number) => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClasses' is required but not available.\")\r\n }\r\n return native.analyzeClasses(filesJson, cwd, flags)\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// STATE CSS PRE-GENERATION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport interface TwStateConfigEntry {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n sourceFile: string\r\n}\r\n\r\nexport interface StaticStateCssInput {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n}\r\n\r\nexport interface GeneratedStateRule {\r\n selector: string\r\n declarations: string\r\n cssRule: string\r\n componentName: string\r\n stateName: string\r\n}\r\n\r\nexport const extractTwStateConfigs = (source: string, filename: string): TwStateConfigEntry[] => {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwStateConfigs) {\r\n throw new Error(\"FATAL: Native binding 'extractTwStateConfigs' is required but not available.\")\r\n }\r\n return native.extractTwStateConfigs(source, filename)\r\n}\r\n\r\nexport const generateStaticStateCss = (\r\n entries: TwStateConfigEntry[],\r\n _themeConfig?: Record<string, unknown>\r\n): GeneratedStateRule[] => {\r\n const rules: GeneratedStateRule[] = []\r\n for (const entry of entries) {\r\n const stateConfig = JSON.parse(entry.statesJson) as Record<string, string>\r\n for (const [stateName, classes] of Object.entries(stateConfig)) {\r\n rules.push({\r\n selector: `.${entry.componentName}[data-state=\"${stateName}\"]`,\r\n declarations: classes,\r\n cssRule: `.${entry.componentName}[data-state=\"${stateName}\"]{${classes}}`,\r\n componentName: entry.componentName,\r\n stateName,\r\n })\r\n }\r\n }\r\n return rules\r\n}\r\n\r\nexport const extractAndGenerateStateCss = (source: string, filename: string): GeneratedStateRule[] => {\r\n const entries = extractTwStateConfigs(source, filename)\r\n return generateStaticStateCss(entries)\r\n}\r\n","/**\r\n * tailwind-styled-v5 — Internal API\r\n * \r\n * Re-exports functions needed by other package consumers.\r\n * All functions require native Rust bindings.\r\n */\r\n\r\nimport {\r\n type NativeBridge,\r\n type NativeTransformResult,\r\n type ComponentMetadata,\r\n type NativeRscResult,\r\n type LoaderOutput,\r\n getNativeBridge,\r\n adaptNativeResult,\r\n transformSource,\r\n hasTwUsage,\r\n isAlreadyTransformed,\r\n shouldProcess,\r\n compileCssFromClasses,\r\n buildStyleTag,\r\n extractAllClasses,\r\n extractClassesFromSource,\r\n astExtractClasses,\r\n parseClasses,\r\n normalizeClasses,\r\n mergeClassesStatic,\r\n normalizeAndDedupClasses,\r\n eliminateDeadCss,\r\n findDeadVariants,\r\n runElimination,\r\n scanProjectUsage,\r\n extractComponentUsage,\r\n diffClassLists,\r\n batchExtractClasses,\r\n checkAgainstSafelist,\r\n generateSafelist,\r\n loadSafelist,\r\n loadTailwindConfig,\r\n getContentPaths,\r\n runLoaderTransform,\r\n shouldSkipFile,\r\n fileToRoute,\r\n getAllRoutes,\r\n getRouteClasses,\r\n registerFileClasses,\r\n registerGlobalClasses,\r\n getIncrementalEngine,\r\n resetIncrementalEngine,\r\n getBucketEngine,\r\n resetBucketEngine,\r\n classifyNode,\r\n detectConflicts,\r\n bucketSort,\r\n generateCssForClasses,\r\n analyzeFile,\r\n analyzeVariantUsage,\r\n injectClientDirective,\r\n injectServerOnlyComment,\r\n analyzeClasses,\r\n // Static state CSS pre-generation\r\n extractTwStateConfigs,\r\n generateStaticStateCss,\r\n extractAndGenerateStateCss,\r\n extractContainerCssFromSource,\r\n} from \"./index\"\r\n\r\nexport {\r\n getNativeBridge,\r\n adaptNativeResult,\r\n transformSource,\r\n hasTwUsage,\r\n isAlreadyTransformed,\r\n shouldProcess,\r\n compileCssFromClasses,\r\n buildStyleTag,\r\n extractAllClasses,\r\n extractClassesFromSource,\r\n astExtractClasses,\r\n parseClasses,\r\n normalizeClasses,\r\n mergeClassesStatic,\r\n normalizeAndDedupClasses,\r\n eliminateDeadCss,\r\n findDeadVariants,\r\n runElimination,\r\n scanProjectUsage,\r\n extractComponentUsage,\r\n diffClassLists,\r\n batchExtractClasses,\r\n checkAgainstSafelist,\r\n generateSafelist,\r\n loadSafelist,\r\n loadTailwindConfig,\r\n getContentPaths,\r\n runLoaderTransform,\r\n shouldSkipFile,\r\n fileToRoute,\r\n getAllRoutes,\r\n getRouteClasses,\r\n registerFileClasses,\r\n registerGlobalClasses,\r\n getIncrementalEngine,\r\n resetIncrementalEngine,\r\n getBucketEngine,\r\n resetBucketEngine,\r\n classifyNode,\r\n detectConflicts,\r\n bucketSort,\r\n generateCssForClasses,\r\n analyzeFile,\r\n analyzeVariantUsage,\r\n injectClientDirective,\r\n injectServerOnlyComment,\r\n analyzeClasses,\r\n // Static state + container CSS pre-generation\r\n extractTwStateConfigs,\r\n generateStaticStateCss,\r\n extractAndGenerateStateCss,\r\n extractContainerCssFromSource,\r\n}\r\n\r\nexport { type NativeBridge, type NativeTransformResult, type ComponentMetadata, type NativeRscResult, type LoaderOutput }\r\n\r\nexport type CssCompileResult = NativeTransformResult\r\n\r\n// CSS pipeline — Tailwind → LightningCSS\r\n// PHASE 0: Includes LRU caching for 30-40% performance improvement\r\nexport { runCssPipeline, runCssPipelineSync, getCacheStats, clearCache, type CssPipelineResult } from \"./compiler/tailwindEngine\"\r\n\r\n// Re-export all sub-entries directly for convenience\r\nexport * from \"./compiler\"\r\nexport * from \"./parser\"\r\nexport * from \"./analyzer\"\r\nexport * from \"./cache\"\r\nexport * from \"./redis\"\r\nexport * from \"./watch\"\r\n\r\n","/**\r\n * tailwind-styled-v4 — Turbopack / Webpack Loader\r\n *\r\n * QA #7: Router-aware loader dengan:\r\n * - App Router vs Pages Router detection\r\n * - Directive preservation (use client / use server)\r\n * - Version-specific Next.js optimizations\r\n * - Source map passthrough\r\n * - Skip non-component files (node_modules, .d.ts, already transformed)\r\n */\r\n\r\nimport { type LoaderOutput, runLoaderTransform, registerFileClasses } from \"@tailwind-styled/compiler/internal\"\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\n\r\n// ── Static CSS writer (identik dengan webpackLoader.ts) ─────────────────────\r\nconst _writtenRules = new Set<string>()\r\n\r\nfunction appendStaticCssToFile(staticCss: string, safelistPath: string): void {\r\n if (!staticCss.trim() || !safelistPath) return\r\n const stateFilePath = path.join(path.dirname(safelistPath), \"_tw-state-static.css\")\r\n const newRules: string[] = []\r\n for (const chunk of staticCss.split(/(?<=\\})\\s*/)) {\r\n const rule = chunk.trim()\r\n if (rule && !_writtenRules.has(rule)) {\r\n _writtenRules.add(rule)\r\n newRules.push(rule)\r\n }\r\n }\r\n if (newRules.length === 0) return\r\n try {\r\n fs.mkdirSync(path.dirname(stateFilePath), { recursive: true })\r\n if (!fs.existsSync(stateFilePath)) {\r\n fs.writeFileSync(\r\n stateFilePath,\r\n `/* _tw-state-static.css — Auto-generated by tailwind-styled-v4. DO NOT EDIT.\\n` +\r\n ` * Import di globals.css: @import \"./_tw-state-static.css\";\\n` +\r\n ` * Berisi: state CSS (.tw-s-*[data-*=\"true\"]) + container queries (@container .tw-cq-*).\\n` +\r\n ` */\\n\\n`,\r\n \"utf-8\"\r\n )\r\n }\r\n fs.appendFileSync(stateFilePath, newRules.join(\"\\n\") + \"\\n\", \"utf-8\")\r\n } catch { /* non-fatal */ }\r\n}\r\n\r\nexport interface TurbopackContext {\r\n /** Absolute path ke file yang sedang di-transform */\r\n resourcePath: string\r\n /** Next.js version (jika di-inject oleh withTailwindStyled) */\r\n query?: Record<string, unknown>\r\n}\r\n\r\nexport interface TurbopackLoaderOptions {\r\n addDataAttr?: boolean | string\r\n autoClientBoundary?: boolean | string\r\n hoist?: boolean | string\r\n preserveImports?: boolean | string\r\n /** Debug mode — log transform details */\r\n debug?: boolean | string\r\n /** Explicit Next.js major version */\r\n nextMajor?: number | string\r\n /** Path ke safelist CSS file — di-inject oleh withTailwindStyled (dev only) */\r\n safelistPath?: string\r\n}\r\n\r\nfunction parseBool(val: boolean | string | undefined, fallback = false): boolean {\r\n if (typeof val === \"boolean\") return val\r\n if (typeof val === \"string\") return val === \"true\" || val === \"1\"\r\n return fallback\r\n}\r\n\r\nfunction parseNum(val: number | string | undefined): number | undefined {\r\n if (typeof val === \"number\") return val\r\n if (typeof val === \"string\") return parseInt(val, 10) || undefined\r\n return undefined\r\n}\r\n\r\nfunction detectRouter(resourcePath: string): \"app\" | \"pages\" | \"unknown\" {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n if (/\\/app\\//.test(normalized)) return \"app\"\r\n if (/\\/pages\\//.test(normalized)) return \"pages\"\r\n return \"unknown\"\r\n}\r\n\r\n/**\r\n * Next.js App Router entry-point files yang TIDAK boleh diproses loader ini.\r\n *\r\n * Turbopack tidak support `exclude` di rule level seperti webpack, sehingga\r\n * *.tsx glob akan match layout.tsx, page.tsx, dll. Guard ini memastikan loader\r\n * skip file-file tersebut secara eksplisit — identik dengan NEXT_RSC_ENTRIES\r\n * di withTailwindStyled.ts yang hanya efektif untuk webpack path.\r\n *\r\n * Tanpa guard ini: loader menyentuh layout.tsx → Next.js/React Compiler\r\n * kehilangan sinyal pure RSC → locale injection dari Accept-Language header\r\n * (Next.js 16+) tidak konsisten antara SSR pass dan hydration pass →\r\n * hydration mismatch `lang=\"id\"` vs `lang=\"en\"`.\r\n */\r\nconst NEXT_RSC_ENTRIES =\r\n /(?:^|[\\\\/])(?:layout|page|loading|error|not-found|template|default)\\.[jt]sx?$/\r\n\r\nfunction isSkippable(resourcePath: string): boolean {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n return (\r\n normalized.includes(\"/node_modules/\") ||\r\n normalized.endsWith(\".d.ts\") ||\r\n normalized.endsWith(\".d.mts\") ||\r\n normalized.endsWith(\".d.cts\") ||\r\n // Skip CSS/assets\r\n /\\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized) ||\r\n // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,\r\n // jadi guard ini menggantikan NEXT_RSC_ENTRIES exclude yang ada di webpack path.\r\n NEXT_RSC_ENTRIES.test(normalized)\r\n )\r\n}\r\n\r\n/** Extract directive line dari source */\r\nfunction extractDirective(source: string): { directive: string; stripped: string } {\r\n const match = source.match(/^(\\s*[\"'](use client|use server)[\"']\\s*;?\\s*\\n?)/)\r\n if (!match) return { directive: \"\", stripped: source }\r\n const directive = match[1].trim().replace(/['\"]/g, '\"') + \"\\n\"\r\n const stripped = source.slice(match[0].length)\r\n return { directive, stripped }\r\n}\r\n\r\n\r\n// ─── Per-file safelist writer ─────────────────────────────────────────────────\r\n// Turbopack tidak punya afterCompile hook dan bisa spawn multiple workers.\r\n// Solusi: tiap file menulis file CSS-nya sendiri di .next/tw-classes/<slug>.css\r\n// Tailwind scan seluruh direktori via @source \".next/tw-classes/**\"\r\n// Tidak ada race condition karena tiap file punya output path unik.\r\n//\r\n// Stale file handling:\r\n// - Setiap dev server start, Next.js hapus .next/ → tw-classes/ otomatis hilang\r\n// - Setiap compile cycle, TwSafelistDevPlugin (webpack) clear tw-classes/\r\n// - Turbopack: pakai _cycle sentinel file — kalau cycle berubah, clear dulu\r\n\r\n// ─── Cycle ID ─────────────────────────────────────────────────────────────────\r\n// withTailwindStyled menulis _start.txt saat wrap() dipanggil (= saat next.config.ts\r\n// di-load, yaitu sekali per dev server start). Setiap compile cycle Turbopack,\r\n// loader baca _start.txt dan compare dengan _cycle.txt di tw-classes/:\r\n//\r\n// _start.txt = timestamp dev server start (ditulis withTailwindStyled)\r\n// _cycle.txt = timestamp cycle terakhir (ditulis loader pertama di tiap cycle)\r\n//\r\n// Kalau _cycle.txt != _start.txt → compile cycle baru → clear tw-classes/ dulu.\r\n// Ini solve masalah \"file yang dihapus tetap ada di safelist\" tanpa butuh hook.\r\n\r\nconst CYCLE_SENTINEL = \"_cycle.txt\"\r\nconst START_SENTINEL = \"_start.txt\"\r\n\r\n// Cached per worker instance — hindari readFileSync berulang di file yang sama\r\nconst _workerCache = new Map<string, string>()\r\n\r\nfunction getTwClassesDir(safelistPath: string): string {\r\n return path.join(path.dirname(safelistPath), \"tw-classes\")\r\n}\r\n\r\nfunction readSentinel(filePath: string): string {\r\n try { return fs.readFileSync(filePath, \"utf-8\").trim() } catch { return \"\" }\r\n}\r\n\r\n// Lock untuk serialisasi clearAndMarkCycle di dalam satu worker process.\r\n// Turbopack bisa spawn multiple concurrent loader calls — tanpa lock,\r\n// dua worker bisa clear tw-classes/ bersamaan → window dimana semua file\r\n// hilang → Tailwind scan → CSS output kosong → FLICKER.\r\n// Lock ini hanya efektif dalam satu Node.js process (per worker), tapi itu cukup\r\n// karena Turbopack menggunakan single-threaded Node.js per worker.\r\nlet _clearLock = false\r\n\r\nfunction clearAndMarkCycle(twClassesDir: string, startId: string): void {\r\n // Sudah ada clear yang sedang berjalan di worker ini — skip, biarkan yang pertama selesai.\r\n // Worker lain yang mungkin sudah clear duluan akan tulis _cycle.txt → kita akan\r\n // melihat cachedCycle === startId di iterasi berikutnya dan skip juga.\r\n if (_clearLock) return\r\n _clearLock = true\r\n try {\r\n if (fs.existsSync(twClassesDir)) {\r\n // Rename-then-recreate strategy: rename folder lama dulu, lalu buat folder baru kosong,\r\n // baru hapus folder lama. Ini memastikan tidak ada window dimana tw-classes/ tidak ada\r\n // atau kosong (yang akan bikin Tailwind re-scan dan generate CSS tanpa classes → flicker).\r\n const tempDir = `${twClassesDir}_clearing_${Date.now()}`\r\n try {\r\n fs.renameSync(twClassesDir, tempDir)\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n // Copy _start.txt ke folder baru sebelum hapus folder lama\r\n const startFile = path.join(tempDir, START_SENTINEL)\r\n if (fs.existsSync(startFile)) {\r\n fs.copyFileSync(startFile, path.join(twClassesDir, START_SENTINEL))\r\n }\r\n // Copy _webpack-merged.css kalau ada\r\n const mergedFile = path.join(tempDir, \"_webpack-merged.css\")\r\n if (fs.existsSync(mergedFile)) {\r\n fs.copyFileSync(mergedFile, path.join(twClassesDir, \"_webpack-merged.css\"))\r\n }\r\n // Tulis _cycle.txt di folder baru SEBELUM hapus folder lama\r\n // Ini pastikan tw-classes/ selalu punya content valid\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n // Baru hapus folder lama secara async — tidak blokir compile\r\n fs.rmSync(tempDir, { recursive: true, force: true })\r\n } catch {\r\n // Fallback ke cara lama jika rename gagal (mis. cross-device)\r\n for (const file of fs.readdirSync(twClassesDir)) {\r\n if (file === START_SENTINEL || file === \"_webpack-merged.css\") continue\r\n try { fs.unlinkSync(path.join(twClassesDir, file)) } catch { /* non-fatal */ }\r\n }\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n }\r\n } else {\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n }\r\n } catch { /* non-fatal */ } finally {\r\n _clearLock = false\r\n }\r\n}\r\n\r\nfunction getPerFileSafelistPath(safelistDir: string, resourcePath: string): string {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n const slug = normalized\r\n .replace(/^.*\\/src\\//, \"\")\r\n .replace(/\\.[tj]sx?$/, \"\")\r\n .replace(/[^a-zA-Z0-9]/g, \"_\")\r\n .slice(0, 80)\r\n return path.join(safelistDir, `${slug}.css`)\r\n}\r\n\r\nfunction writePerFileSafelist(\r\n safelistPath: string | undefined,\r\n resourcePath: string,\r\n classes: string[]\r\n): void {\r\n if (!safelistPath || classes.length === 0) return\r\n try {\r\n const twClassesDir = getTwClassesDir(safelistPath)\r\n\r\n // Baca start ID dari _start.txt (ditulis withTailwindStyled saat config load)\r\n const startId = readSentinel(path.join(twClassesDir, START_SENTINEL))\r\n\r\n // Compare dengan cycle ID terakhir — pakai in-memory cache dulu, fallback ke disk\r\n const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(path.join(twClassesDir, CYCLE_SENTINEL))\r\n\r\n if (startId && cachedCycle !== startId) {\r\n // Compile cycle baru — clear tw-classes/ dan tulis _cycle.txt baru\r\n clearAndMarkCycle(twClassesDir, startId)\r\n } else if (!fs.existsSync(twClassesDir)) {\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n }\r\n\r\n const outPath = getPerFileSafelistPath(twClassesDir, resourcePath)\r\n const sorted = [...new Set(classes)].sort()\r\n const css = [\r\n `/* tw-safelist: ${path.basename(resourcePath)} — auto-generated */`,\r\n \"@layer utilities {\",\r\n sorted.map((cls) => `.${cls.replace(/([^a-zA-Z0-9_-])/g, \"\\\\$1\")} {}`).join(\"\\n\"),\r\n \"}\",\r\n ].join(\"\\n\")\r\n\r\n // Skip write jika isi sama — avoid Tailwind re-scan yang tidak perlu\r\n try {\r\n if (fs.readFileSync(outPath, \"utf-8\") === css) return\r\n } catch { /* file belum ada, lanjut write */ }\r\n\r\n // Atomic write: tulis ke temp file dulu, lalu rename ke path final.\r\n // Ini mencegah Tailwind scanner membaca file yang sedang ditulis (partial read)\r\n // yang akan menghasilkan CSS incomplete → FLICKER.\r\n // rename() dijamin atomic di semua OS modern (POSIX dan Windows NTFS).\r\n const tmpPath = `${outPath}.tmp`\r\n try {\r\n fs.writeFileSync(tmpPath, css, \"utf-8\")\r\n fs.renameSync(tmpPath, outPath)\r\n } catch {\r\n // Fallback kalau rename gagal (mis. cross-device, Windows lock)\r\n try { fs.unlinkSync(tmpPath) } catch { /* ignore */ }\r\n fs.writeFileSync(outPath, css, \"utf-8\")\r\n }\r\n } catch {\r\n // Non-fatal\r\n }\r\n}\r\n\r\n/**\r\n * Main loader function — compatible dengan Turbopack, Webpack 5, rspack.\r\n */\r\nexport default function turbopackLoader(\r\n this: TurbopackContext,\r\n source: string,\r\n options: TurbopackLoaderOptions = {}\r\n): string {\r\n // Skip files yang tidak perlu di-transform\r\n if (isSkippable(this.resourcePath)) return source\r\n\r\n // Detect router context\r\n const router = detectRouter(this.resourcePath)\r\n const nextMajor = parseNum(options.nextMajor)\r\n const debug = parseBool(options.debug)\r\n const filename = path.basename(this.resourcePath)\r\n\r\n // Build effective options berdasarkan router context\r\n const effective = {\r\n addDataAttr: parseBool(options.addDataAttr),\r\n // App Router: selalu auto-detect client boundary\r\n // Pages Router: opt-in via option\r\n autoClientBoundary: router === \"app\" ? true : parseBool(options.autoClientBoundary),\r\n // Hoist by default untuk semua contexts\r\n hoist: parseBool(options.hoist, true),\r\n // Pages Router: preserve imports (RSC tidak berlaku)\r\n preserveImports: router === \"pages\" ? true : parseBool(options.preserveImports, false),\r\n }\r\n\r\n if (debug) {\r\n console.debug(`[tw-loader] ${filename}: router=${router} nextMajor=${nextMajor ?? \"unknown\"}`)\r\n }\r\n\r\n // Preserve directive (use client / use server)\r\n const { directive, stripped } = extractDirective(source)\r\n\r\n // ── Hash pre-embedding (build-time optimization) ────────────────────────\r\n // Inject `__hash: \"abc123\"` ke semua tw() calls yang punya states config.\r\n // stateEngine.ts akan pakai __hash langsung — skip runtime hashState() computation.\r\n // Zero dependency baru: pakai Rust NAPI yang sama dengan compiler.\r\n let processedSource = stripped\r\n try {\r\n const compilerMod = require(\"@tailwind-styled/compiler/internal\") as {\r\n injectStateHash?: (source: string, filename: string) => { code: string; changed: boolean; injectedCount: number }\r\n }\r\n if (typeof compilerMod?.injectStateHash === \"function\" && stripped.includes(\"states:\")) {\r\n const hashResult = compilerMod.injectStateHash(stripped, this.resourcePath)\r\n if (hashResult.changed) {\r\n processedSource = hashResult.code\r\n if (debug) {\r\n console.debug(`[tw-loader] ${filename}: injected __hash for ${hashResult.injectedCount} component(s)`)\r\n }\r\n }\r\n }\r\n } catch {\r\n // injectStateHash tidak tersedia (binary belum di-rebuild) — skip, tidak fatal\r\n }\r\n\r\n try {\r\n const output: LoaderOutput = runLoaderTransform({\r\n filepath: this.resourcePath,\r\n source: processedSource,\r\n options: effective,\r\n })\r\n\r\n // Tidak ada perubahan — Rust kembalikan source asli (bukan string kosong).\r\n // Guard lama `!output.code.length` selalu false karena code = original source.\r\n // Fix: cukup cek changed flag saja; return source asli agar Next.js RSC boundary\r\n // tetap intact dan tidak ada interaksi dengan React Compiler locale detection.\r\n if (!output.changed) {\r\n // Meski tidak ada transform, tetap tulis safelist kalau ada classes yang ditemukan.\r\n // Object config style (tw.div({...})) tidak butuh transform tapi tetap punya classes.\r\n if (output.classes.length > 0) {\r\n writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes)\r\n }\r\n // Tetap collect static CSS meski file tidak di-transform\r\n if (output.staticCss && options.safelistPath) {\r\n appendStaticCssToFile(output.staticCss, options.safelistPath)\r\n }\r\n return source\r\n }\r\n\r\n // Register classes untuk route map (dipakai webpack dev plugin & build manifest)\r\n if (output.classes.length > 0) {\r\n registerFileClasses(this.resourcePath, output.classes)\r\n // Turbopack: tulis per-file safelist langsung dari loader.\r\n // Race-condition-safe karena tiap file punya output path unik.\r\n writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes)\r\n }\r\n\r\n // ── Append static CSS (state + container) ──────────────────────────────\r\n if (output.staticCss && options.safelistPath) {\r\n appendStaticCssToFile(output.staticCss, options.safelistPath)\r\n }\r\n\r\n // Re-attach directive di depan\r\n if (!directive) return output.code\r\n\r\n // Strip any duplicate directives yang mungkin diinject oleh compiler\r\n const clean = output.code.replace(/^\\s*[\"'](use client|use server)[\"']\\s*;?\\s*\\n?/, \"\")\r\n return directive + clean\r\n } catch (err) {\r\n // Loader harus tidak pernah throw — return source asli dengan warning\r\n const msg = err instanceof Error ? err.message : String(err)\r\n if (debug) {\r\n console.warn(`[tw-loader] transform failed for ${filename}: ${msg}`)\r\n }\r\n return source\r\n }\r\n}"]}
1
+ {"version":3,"sources":["../packages/domain/shared/src/native-resolution.ts","../packages/domain/shared/src/index.ts","../packages/domain/compiler/src/nativeBridge.ts","../packages/domain/compiler/src/compiler/cssGeneratorNative.ts","../packages/domain/compiler/src/compiler/compilationNative.ts","../packages/domain/compiler/src/compiler/cssCompilationNative.ts","../packages/domain/compiler/src/compiler/idRegistryNative.ts","../packages/domain/compiler/src/compiler/streamingNative.ts","../packages/domain/compiler/src/compiler/tailwindEngine.ts","../packages/domain/compiler/src/compiler/index.ts","../packages/domain/compiler/src/parser/index.ts","../packages/domain/compiler/src/analyzer/analyzerNative.ts","../packages/domain/compiler/src/analyzer/themeResolutionNative.ts","../packages/domain/compiler/src/analyzer/scannerNative.ts","../packages/domain/compiler/src/analyzer/index.ts","../packages/domain/compiler/src/cache/cacheNative.ts","../packages/domain/compiler/src/cache/index.ts","../packages/domain/compiler/src/redis/redisNative.ts","../packages/domain/compiler/src/redis/index.ts","../packages/domain/compiler/src/watch/watchSystemNative.ts","../packages/domain/compiler/src/watch/index.ts","../packages/domain/compiler/src/index.ts","../packages/domain/compiler/src/internal.ts","../packages/presentation/next/src/turbopackLoader.ts"],"names":["fs","path","createRequire","fileURLToPath","init_src","runCssPipeline","batchExtractClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,WAAA,GAAsB;AAC7B,EAAA,IAAI,WAAW,OAAO,SAAA;AACtB,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,CAAA,EAAI,QAAQ,IAAI,CAAA,CAAA;AAC5C;AAaO,SAAS,oBAAoB,UAAA,EAA6C;AAC/E,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,EAAE,MAAM,IAAA,EAAM,MAAA,EAAQ,aAAa,QAAA,EAAU,KAAA,EAAO,CAAC,0BAA0B,CAAA,EAAE;AAAA,EAC1F;AAIA,EAAA,IAAI,QAAQ,GAAA,CAAI,aAAA,KAAkB,OAAO,OAAA,CAAQ,GAAA,CAAI,uBAAuB,GAAA,EAAK;AAC/E,IAAA,OAAO,EAAE,MAAM,IAAA,EAAM,MAAA,EAAQ,aAAa,QAAA,EAAU,KAAA,EAAO,EAAC,EAAE;AAAA,EAChE;AAGA,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,cAAA,EAAgB,IAAA,EAAK;AACjD,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,IAAOA,cAAA,CAAA,UAAA,CAAW,OAAO,CAAA,EAAG;AAC1B,MAAA,OAAO,EAAE,IAAA,EAAM,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O,MAAA;AAAA,EACT;AACF","file":"turbopackLoader.js","sourcesContent":["/**\r\n * Prebuilt binary resolution untuk native NAPI bindings.\r\n * QA #1: Resolve native binary dari prebuilt packages atau local build.\r\n *\r\n * Prioritas:\r\n * 1. TW_NATIVE_PATH env var (explicit override)\r\n * 2. Local native/ folder in npm package (via \"files\": [\"native/*.node\"])\r\n * 3. Prebuilt binary dari platform-specific npm package\r\n * 4. Local build dari source (developer mode)\r\n */\r\n\r\nimport { createRequire } from \"node:module\"\r\nimport * as fs from \"node:fs\"\r\nimport * as path from \"node:path\"\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require — works in both ESM and CJS contexts\r\nconst _require = typeof require !== \"undefined\" ? require : createRequire(import.meta.url)\r\n\r\nexport interface NativeResolutionResult {\r\n path: string | null\r\n source: \"env\" | \"prebuilt\" | \"local\" | \"not-found\"\r\n platform: string\r\n tried: string[]\r\n}\r\n\r\n/** Platform key → prebuilt npm package name */\r\nconst PLATFORM_MAP: Record<string, string[]> = {\r\n \"linux-x64\": [\"@tailwind-styled/native-linux-x64-gnu\", \"@tailwind-styled/native-linux-x64\"],\r\n \"linux-arm64\": [\"@tailwind-styled/native-linux-arm64-gnu\", \"@tailwind-styled/native-linux-arm64\"],\r\n \"darwin-x64\": [\"@tailwind-styled/native-darwin-x64\"],\r\n \"darwin-arm64\": [\"@tailwind-styled/native-darwin-arm64\"],\r\n \"win32-x64\": [\"@tailwind-styled/native-win32-x64-msvc\", \"@tailwind-styled/native-win32-x64\"],\r\n \"win32-arm64\": [\"@tailwind-styled/native-win32-arm64-msvc\", \"@tailwind-styled/native-win32-arm64\"],\r\n}\r\n\r\nfunction platformKey(): string {\r\n if (isBrowser) return \"browser\"\r\n return `${process.platform}-${process.arch}`\r\n}\r\n\r\n/**\r\n * Resolve native binary path dari semua sumber yang tersedia.\r\n *\r\n * @example\r\n * const result = resolveNativeBinary()\r\n * if (result.path) {\r\n * const binding = require(result.path)\r\n * } else {\r\n * throw new Error(\"Native binding not found — run npm run build:rust\")\r\n * }\r\n */\r\nexport function resolveNativeBinary(runtimeDir?: string): NativeResolutionResult {\r\n const platform = platformKey()\r\n const tried: string[] = []\r\n\r\n if (isBrowser) {\r\n return { path: null, source: \"not-found\", platform, tried: [\"not available in browser\"] }\r\n }\r\n\r\n // 0. Disabled flag — always short-circuit before any I/O\r\n // TWS_NO_NATIVE adalah nama canonical; TWS_DISABLE_NATIVE diterima untuk backward compat\r\n if (process.env.TWS_NO_NATIVE === \"1\" || process.env.TWS_DISABLE_NATIVE === \"1\") {\r\n return { path: null, source: \"not-found\", platform, tried: [] }\r\n }\r\n\r\n // 1. Env var override\r\n const envPath = process.env.TW_NATIVE_PATH?.trim()\r\n if (envPath) {\r\n if (fs.existsSync(envPath)) {\r\n return { path: envPath, source: \"env\", platform, tried }\r\n }\r\n tried.push(`env:${envPath} (not found)`)\r\n }\r\n\r\n // 2. Local build candidates FIRST (native/ folder in node_modules package)\r\n // When installed via npm, \"files\": [\"native/*.node\"] includes them\r\n // Priority: node_modules/tailwind-styled-v4/native/*.node\r\n const napiPlatform = platform === \"linux-x64\" ? \"linux-x64-gnu\"\r\n : platform === \"linux-arm64\" ? \"linux-arm64-gnu\"\r\n : platform\r\n const BINARY_NAMES_SELF = [\"tailwind-styled-native\", \"tailwind_styled_parser\", \"index\"]\r\n if (runtimeDir) {\r\n // runtimeDir is typically dist/ — go up to package root, then into native/\r\n for (const depth of [\"..\", path.join(\"..\", \"..\"), path.join(\"..\", \"..\", \"..\")]) {\r\n const pkgRoot = path.resolve(runtimeDir, depth)\r\n for (const bin of BINARY_NAMES_SELF) {\r\n for (const suffix of [\"\", `.${platform}`, `.${napiPlatform}`]) {\r\n const candidate = path.resolve(pkgRoot, \"native\", `${bin}${suffix}.node`)\r\n tried.push(`native:${candidate}`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"prebuilt\", platform, tried }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // 2b. Prebuilt binary dari platform-specific npm package\r\n const prebuiltPkgs = PLATFORM_MAP[platform] ?? []\r\n for (const pkg of prebuiltPkgs) {\r\n try {\r\n const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"prebuilt\", platform, tried }\r\n }\r\n tried.push(`prebuilt:${pkg} (resolved but missing)`)\r\n } catch {\r\n tried.push(`prebuilt:${pkg} (not installed)`)\r\n }\r\n }\r\n\r\n // 3. Local build candidates\r\n const cwd = process.cwd()\r\n const base = runtimeDir ?? cwd\r\n // napi-rs naming: platform key may have -gnu suffix on Linux (already computed above)\r\n\r\n // Both possible binary names:\r\n // - \"tailwind_styled_parser\" (old hardcoded name in resolvers)\r\n // - \"tailwind-styled-native\" (actual binaryName in native/package.json)\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n\r\n const localCandidates: string[] = []\r\n\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(base, `${bin}.node`))\r\n localCandidates.push(path.resolve(base, \"..\", `${bin}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`))\r\n }\r\n\r\n // Walk up from cwd AND base to find repo root native/ dir\r\n // Needed when npm workspaces sets cwd to the package subdir\r\n for (const startDir of [cwd, base]) {\r\n let dir = startDir\r\n for (let i = 0; i < 6; i++) {\r\n const nativeDir = path.resolve(dir, \"native\")\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, \"target\", \"release\", `${bin}.node`))\r\n }\r\n const parent = path.resolve(dir, \"..\")\r\n if (parent === dir) break\r\n dir = parent\r\n }\r\n }\r\n\r\n for (const candidate of localCandidates) {\r\n tried.push(`local:${candidate}`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"local\", platform, tried }\r\n }\r\n }\r\n\r\n return { path: null, source: \"not-found\", platform, tried }\r\n}\r\n\r\n/**\r\n * Format human-readable error untuk \"binary not found\".\r\n */\r\nexport function formatNativeNotFoundError(result: NativeResolutionResult): string {\r\n const lines = [\r\n `[tailwind-styled] Native binding not found for ${result.platform}`,\r\n ``,\r\n `Tried:`,\r\n ...result.tried.map(t => ` - ${t}`),\r\n ``,\r\n `Solutions:`,\r\n ` 1. Build locally: npm run build:rust`,\r\n ` 2. Install prebuilt: npm install @tailwind-styled/native-${result.platform}`,\r\n ` 3. Override path: TW_NATIVE_PATH=/path/to/parser.node`,\r\n ]\r\n return lines.join(\"\\n\")\r\n}","import { createHash } from \"node:crypto\"\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { fileURLToPath } from \"node:url\"\r\nimport { createRequire } from \"node:module\"\r\n\r\n// Native-only: Node.js is always available. No browser fallback.\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type TokenMap = Record<string, string>\r\n\r\nexport type VariantValue = string | number | boolean | undefined\r\n\r\nexport type VariantProps = Record<string, VariantValue>\r\n\r\nexport type HtmlTagName = keyof HTMLElementTagNameMap\r\n\r\nexport type CompoundCondition = Record<string, string | number | boolean>\r\n\r\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Logging\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface Logger {\r\n warn(...args: unknown[]): void\r\n debug(...args: unknown[]): void\r\n error(...args: unknown[]): void\r\n log(...args: unknown[]): void\r\n}\r\n\r\nexport function createLogger(namespace: string): Logger {\r\n const prefix = `[${namespace}]`\r\n return {\r\n warn(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n debug(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n error(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n log(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n }\r\n}\r\n\r\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\r\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\r\n return (msg: string) => {\r\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\r\n console.debug(prefix, msg)\r\n }\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error handling\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\r\n\r\ntype ZodLikeIssue = {\r\n path?: readonly PropertyKey[]\r\n message?: string\r\n}\r\n\r\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\r\n if (!path || path.length === 0) return \"(root)\"\r\n return path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n}\r\n\r\nexport class TwError extends Error {\r\n /** @deprecated Gunakan source */\r\n public readonly domain: string\r\n public readonly source: ErrorSource\r\n public readonly code: string\r\n public readonly originalCause?: unknown\r\n\r\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\r\n super(message)\r\n this.name = \"TwError\"\r\n this.domain = domainOrSource\r\n this.source = domainOrSource as ErrorSource\r\n this.code = code\r\n this.originalCause = cause\r\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\r\n }\r\n\r\n static fromIo(code: string, message: string): TwError {\r\n return new TwError(\"io\", code, message)\r\n }\r\n\r\n static fromCompile(code: string, message: string): TwError {\r\n return new TwError(\"compile\", code, message)\r\n }\r\n\r\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\r\n if (err && typeof err === \"object\") {\r\n const e = err as { code?: string; message?: string }\r\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\r\n }\r\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\r\n }\r\n\r\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\r\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\r\n const first = err.issues?.[0] ?? err.errors?.[0]\r\n const path = formatIssuePath(first?.path)\r\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\r\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\r\n }\r\n\r\n static wrap(source: string, code: string, err: unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(source, code, err.message, err)\r\n return new TwError(source, code, String(err), err)\r\n }\r\n\r\n override toString(): string {\r\n return `TwError [${this.source}:${this.code}] ${this.message}`\r\n }\r\n\r\n toJSON(): { name: string; source: string; code: string; message: string } {\r\n return { name: this.name, source: this.source, code: this.code, message: this.message }\r\n }\r\n\r\n toCliMessage(): string {\r\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\r\n }\r\n}\r\n\r\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\r\n return TwError.wrap(domain, code, error)\r\n}\r\n\r\nexport function isTwError(err: unknown): err is TwError {\r\n return err instanceof TwError\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Native binding resolution\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface LoadNativeBindingOptions<T> {\r\n runtimeDir: string\r\n candidates: string[]\r\n isValid: (module: unknown) => module is T\r\n invalidExportMessage: string\r\n}\r\n\r\nexport interface LoadNativeBindingResult<T> {\r\n binding: T | null\r\n loadErrors: Array<{ path: string; message: string }>\r\n loadedPath?: string\r\n}\r\n\r\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n\r\n for (const candidate of candidates) {\r\n const candidatePath = path.resolve(runtimeDir, candidate)\r\n try {\r\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\r\n continue\r\n }\r\n const mod = requireNativeModule(candidatePath)\r\n if (mod && isValid(mod)) {\r\n return { binding: mod, loadErrors, loadedPath: candidatePath }\r\n }\r\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\r\n } catch (e) {\r\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\r\n }\r\n }\r\n\r\n return { binding: null, loadErrors }\r\n}\r\n\r\nconst _require = createRequire(import.meta.url)\r\n\r\nfunction requireNativeModule(p: string): unknown {\r\n return _require(p)\r\n}\r\n\r\nexport interface ResolveCandidatesOptions {\r\n runtimeDir?: string\r\n envVarNames?: string[]\r\n includeDefaultCandidates?: boolean\r\n enforceNodeExtensionForEnvPath?: boolean\r\n /** @deprecated — ignored, kept for backward compat */\r\n packageName?: string\r\n}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n const {\r\n envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\r\n includeDefaultCandidates = true,\r\n enforceNodeExtensionForEnvPath = false,\r\n } = options\r\n // Default ke cwd kalau runtimeDir tidak disediakan\r\n const runtimeDir = options.runtimeDir || process.cwd()\r\n const candidates: string[] = []\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\r\n }\r\n }\r\n\r\n if (!includeDefaultCandidates) return candidates\r\n\r\n if (fs.existsSync(runtimeDir)) {\r\n try {\r\n for (const entry of fs.readdirSync(runtimeDir)) {\r\n if (entry.endsWith(\".node\")) candidates.push(entry)\r\n }\r\n } catch { /* ignore read errors */ }\r\n }\r\n\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\r\n : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\r\n : `${process.platform}-${process.arch}`\r\n\r\n for (const bin of BINARY_NAMES) {\r\n candidates.push(path.resolve(runtimeDir, `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\r\n // 1 level: dist/ → package-root/native/ (published npm package)\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.${napiPlatform}.node`))\r\n // cwd fallback (user project root)\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\r\n // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/ (monorepo dev)\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\r\n // 3 level fallback\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n }\r\n\r\n return Array.from(new Set(candidates))\r\n}\r\n\r\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\r\n if (dir) return path.resolve(dir)\r\n try {\r\n return path.dirname(fileURLToPath(importMetaUrl))\r\n } catch {\r\n return process.cwd()\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Hashing\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\r\n const hash = createHash(algorithm).update(content).digest(\"hex\")\r\n return length ? hash.slice(0, length) : hash\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error formatting\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function formatErrorMessage(error: unknown): string {\r\n if (error instanceof TwError) return error.toString()\r\n if (error instanceof Error) return error.message\r\n return String(error)\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport class LRUCache<K, V> {\r\n private capacity: number\r\n private cache: Map<K, V>\r\n\r\n constructor(capacity: number) {\r\n this.capacity = capacity\r\n this.cache = new Map()\r\n }\r\n\r\n get(key: K): V | undefined {\r\n if (!this.cache.has(key)) return undefined\r\n const value = this.cache.get(key)!\r\n this.cache.delete(key)\r\n this.cache.set(key, value)\r\n return value\r\n }\r\n\r\n set(key: K, value: V): void {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key)\r\n } else if (this.cache.size >= this.capacity) {\r\n const firstKey = this.cache.keys().next().value\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey)\r\n }\r\n }\r\n this.cache.set(key, value)\r\n }\r\n\r\n delete(key: K): boolean {\r\n return this.cache.delete(key)\r\n }\r\n\r\n has(key: K): boolean {\r\n return this.cache.has(key)\r\n }\r\n\r\n clear(): void {\r\n this.cache.clear()\r\n }\r\n\r\n entries(): IterableIterator<[K, V]> {\r\n return this.cache.entries()\r\n }\r\n\r\n get size(): number {\r\n return this.cache.size\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Trace Utilities\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\r\nexport {\r\n getHealthColor,\r\n getModeColor,\r\n formatMemory,\r\n formatDuration,\r\n calculateHealth,\r\n getBuildTimeColor,\r\n getMemoryColor,\r\n createTraceSnapshot,\r\n getPipelinePercentages,\r\n} from \"./trace\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Performance Telemetry\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error Codes\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { ErrorCode } from \"./error-codes\"\r\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Tailwind Compatibility\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TailwindInfo } from \"./compatibility\"\r\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\r\n\r\n// ── Native binding schemas (Zod boundary validation)\r\nexport {\r\n NativeScanFileSchema, NativeScanResultSchema,\r\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\r\n NativeCssCompileResultSchema, NativeWatchResultSchema,\r\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\r\n safeParseNative, parseNative,\r\n} from './native-schemas'\r\n\r\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\r\nexport {\r\n createEsmRequire,\r\n getDirname,\r\n getFilename,\r\n resolveFromRoot,\r\n tryRequire,\r\n resolveNativeNodePath,\r\n} from \"./esmHelpers\"\r\n\r\n// ── Performance telemetry ────────────────────────────────────────────────────\r\nexport {\r\n TelemetryCollector,\r\n getGlobalTelemetry,\r\n resetGlobalTelemetry,\r\n createBuildTimer,\r\n type BuildTelemetry,\r\n type TelemetrySummary,\r\n type BuildPhases,\r\n} from \"./telemetry\"\r\n\r\n// ── Config/JSON schema validation ─────────────────────────────────────────────\r\nexport {\r\n ScanCacheSchema,\r\n ScanCacheClassEntrySchema,\r\n TailwindConfigSchema,\r\n RegistryPluginEntrySchema,\r\n RegistryFileSchema,\r\n PackageJsonSchema,\r\n parseJsonWithSchema,\r\n parseJsonFileWithSchema,\r\n type ScanCache,\r\n type ScanCacheClassEntry,\r\n type TailwindConfig,\r\n type RegistryPluginEntry,\r\n type RegistryFile,\r\n type PackageJson,\r\n} from \"./configSchemas\"\r\n\r\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\r\nexport {\r\n resolveWorkerPath,\r\n resolveLoaderPath,\r\n type WorkerPathOptions,\r\n type WorkerPathResult,\r\n} from \"./workerResolver\"\r\n\r\n// ── Codegen helpers ───────────────────────────────────────────────────────────\r\nexport {\r\n generateComponentCode,\r\n generateStorybookStory,\r\n generateClassRenameCodemod,\r\n generateBarrelFile,\r\n type ComponentCodegenOptions,\r\n} from \"./codegen\"\r\n\r\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\r\nexport {\r\n resolveNativeBinary,\r\n formatNativeNotFoundError,\r\n type NativeResolutionResult,\r\n} from \"./native-resolution\"\r\n\r\n// ── Shared observability contract ────────────────────────────────────────────\r\nexport {\r\n createObservabilityClient,\r\n type ClassInspection,\r\n type ClassProperty,\r\n type ClassUsageLocation,\r\n type BuildTrace,\r\n type BuildPhaseTrace,\r\n type DashboardMetrics,\r\n type DashboardSummary,\r\n type ObservabilityClient,\r\n} from \"./observability\"\r\n\r\nexport {\r\n TW_STATE_STATIC_FILENAME,\r\n extractStaticStateCss,\r\n appendStaticStateCssToSafelist,\r\n type TwStateConfigEntry,\r\n type StaticStateCssInput,\r\n type GeneratedStateRule,\r\n type StaticStateExtractionResult,\r\n} from \"./staticStateExtractor\"\r\nexport { setGlobalLogFile } from \"./logger\"","/**\r\n * tailwind-styled-v5 — Native Bridge Loader\r\n *\r\n * Uses @tailwind-styled/shared for native binding resolution.\r\n * All functions require native Rust binding - no JS fallback.\r\n */\r\n\r\nimport { resolveNativeBinary, resolveRuntimeDir } from \"@tailwind-styled/shared\"\r\n\r\n// require() is safe here — tsup banner injects CJS-compatible require into ESM output.\r\n// See tsup.config.ts esbuildOptions banner for how this is set up.\r\nconst _loadNative = (path: string): unknown => require(path)\r\n\r\nexport interface ComponentMetadata {\r\n component: string\r\n tag: string\r\n baseClass: string\r\n subComponents: Record<string, { tag?: string; class: string }>\r\n}\r\n\r\nexport interface NativeRscResult {\r\n isServer: boolean\r\n needsClientDirective: boolean\r\n clientReasons: string[]\r\n}\r\n\r\nconst log = (...args: unknown[]) => {\r\n if (process.env.DEBUG?.includes(\"compiler:native\")) {\r\n console.log(\"[compiler:native]\", ...args)\r\n }\r\n}\r\n\r\n// ── Structured Type Definitions ─────────────────────────────────────────────\r\n\r\nexport interface ScanWorkspaceResult {\r\n files: string[]\r\n total_files: number\r\n classes: string[]\r\n unique_classes: number\r\n duration_ms: number\r\n errors: string[]\r\n}\r\n\r\nexport interface ScanFileResult {\r\n file: string\r\n classes: string[]\r\n class_count: number\r\n has_tw_usage: boolean\r\n size_bytes: number\r\n duration_ms: number\r\n}\r\n\r\nexport interface BatchExtractResult {\r\n file: string\r\n classes: string[]\r\n contentHash: string\r\n ok: boolean\r\n error?: string\r\n}\r\n\r\nexport interface SafelistCheckResult {\r\n matched: string[]\r\n unmatched: string[]\r\n safelistSize: number\r\n}\r\n\r\nexport interface PrefilterFileResult {\r\n file: string\r\n has_tw_usage: boolean\r\n duration_ms: number\r\n size_bytes: number\r\n status: \"processed\" | \"skipped\" | \"error\"\r\n error?: string\r\n}\r\n\r\nexport interface DeadCodeResult {\r\n deadInCss: string[]\r\n deadInSource: string[]\r\n liveClasses: string[]\r\n totalCssClasses: number\r\n totalSourceClasses: number\r\n}\r\n\r\nexport interface ProcessedCssResult {\r\n css: string\r\n size_bytes: number\r\n resolved_classes: string[]\r\n unknown_classes: string[]\r\n}\r\n\r\nexport interface ContainerConfig {\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n}\r\n\r\nexport interface HoistResult {\r\n code: string\r\n hoisted: string[]\r\n warnings: string[]\r\n}\r\n\r\nexport interface VariantTableResult {\r\n id: string\r\n tableJson: string\r\n keys: string[]\r\n defaultKey: string\r\n combinations: number\r\n}\r\n\r\nexport interface ClassifyResult {\r\n className: string\r\n bucket: string\r\n sortOrder: number\r\n}\r\n\r\nexport interface MergeResult {\r\n declarationsJson: string\r\n declarationString: string\r\n count: number\r\n}\r\n\r\nexport interface ClassUsageItem {\r\n className: string\r\n usageCount: number\r\n filesJson: string\r\n bundleSizeBytes: number\r\n isDeadCode: boolean\r\n}\r\n\r\nexport interface StateCssConfig {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n sourceFile: string\r\n}\r\n\r\nexport interface GeneratedStateCss {\r\n selector: string\r\n declarations: string\r\n cssRule: string\r\n componentName: string\r\n stateName: string\r\n}\r\n\r\n// ── Type Exports ────────────────────────────────────────────────────────────────\r\n\r\nexport interface NativeBridge {\r\n // CSS Compiler - New Rust implementation\r\n generateCssNative?: (classes: string[], theme_json: string) => string\r\n getCacheStats?: () => [number, number]\r\n clearThemeCache?: () => void\r\n // Core transform\r\n transformSource?: (source: string, opts?: Record<string, string>) => NativeTransformResult | null\r\n extractClassesFromSource?: (source: string) => string[]\r\n hasTwUsage?: (source: string) => boolean\r\n isAlreadyTransformed?: (source: string) => boolean\r\n // Phase 5: Scanner functions (snake_case from Rust)\r\n scan_workspace?: (root: string, extensions?: string[]) => ScanWorkspaceResult\r\n extract_classes_from_source?: (source: string) => string[]\r\n batch_extract_classes?: (filePaths: string[]) => BatchExtractResult[]\r\n check_against_safelist?: (classes: string[], safelist: string[]) => SafelistCheckResult\r\n scan_file?: (filePath: string) => ScanFileResult\r\n collect_files?: (root: string, extensions?: string[]) => string[]\r\n walk_and_prefilter_source_files?: (root: string, extensions?: string[]) => PrefilterFileResult[]\r\n generate_sub_component_types?: (root: string, outputPath?: string) => string\r\n // Class Extractor\r\n extractAllClasses?: (source: string) => string[]\r\n parseClasses?: (raw: string) => Array<{ raw: string; type: string }>\r\n // Application functions\r\n extractComponentUsage?: (source: string) => Array<{ component: string; propsJson: string }>\r\n normalizeAndDedupClasses?: (raw: string) => { normalized: string; duplicatesRemoved: number; uniqueCount: number }\r\n diffClassLists?: (previous: string[], current: string[]) => { added: string[]; removed: string[]; unchanged: string[]; hasChanges: boolean }\r\n batchExtractClasses?: (filePaths: string[]) => Array<{ file: string; classes: string[]; contentHash: string; ok: boolean; error?: string }>\r\n checkAgainstSafelist?: (classes: string[], safelist: string[]) => { matched: string[]; unmatched: string[]; safelistSize: number }\r\n // Batch 2\r\n hoistComponents?: (source: string) => HoistResult\r\n compileVariantTable?: (configJson: string) => VariantTableResult\r\n classifyAndSortClasses?: (classes: string[]) => ClassifyResult[]\r\n mergeCssDeclarations?: (cssChunks: string[]) => MergeResult\r\n analyzeClassUsage?: (classes: string[], scanResultJson: string, css: string) => ClassUsageItem[]\r\n analyzeRsc?: (source: string, filename: string) => {\r\n isServer: boolean\r\n needsClientDirective: boolean\r\n clientReasons: string[]\r\n }\r\n analyzeClasses?: (\r\n filesJson: string,\r\n cwd: string,\r\n flags: number\r\n ) => {\r\n css?: string\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rscJson?: string\r\n metadataJson?: string\r\n safelist?: string[]\r\n } | null\r\n // CSS compilation\r\n compileCss?: (classes: string[], prefix?: string | null) => { css: string; classes: string[] }\r\n compileCssLightning?: (classes: string[]) => string\r\n /** Post-process raw Tailwind-generated CSS dengan LightningCSS di Rust */\r\n detectDeadCode?: (scanResultJson: string, css: string) => DeadCodeResult\r\n processTailwindCssLightning?: (css: string) => ProcessedCssResult\r\n processTailwindCssWithTargets?: (css: string, targets: string | null) => { css: string; size_bytes: number }\r\n // Atomic CSS (atomic.rs)\r\n parseAtomicClass?: (twClass: string) => string | null\r\n generateAtomicCss?: (rulesJson: string) => string\r\n toAtomicClasses?: (twClasses: string) => string\r\n clearAtomicRegistry?: () => void\r\n atomicRegistrySize?: () => number\r\n // Impact analysis (impact_analysis.rs)\r\n calculateImpact?: (impactJson: string) => string\r\n calculateRisk?: (className: string, totalComponents: number) => string\r\n calculateSavings?: (bundleSizeBytes: number, componentCount: number) => number\r\n // Static state CSS pre-generation (state_css.rs)\r\n extractTwStateConfigs?: (source: string, filename: string) => StateCssConfig[]\r\n generateStaticStateCss?: (inputs: Array<{\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n }>, resolvedCss: string | null) => GeneratedStateCss[]\r\n extractAndGenerateStateCss?: (source: string, filename: string) => GeneratedStateCss[]\r\n /**\r\n * Convert layout/utility class string ke CSS declarations.\r\n * Dipakai oleh extractContainerCssFromSource sebagai Rust-accelerated fallback.\r\n */\r\n layoutClassesToCss?: (classes: string) => string\r\n /**\r\n * Hash string dengan algoritma tertentu, return n karakter pertama.\r\n * Dipakai untuk generate deterministic container CSS IDs.\r\n */\r\n hashContent?: (input: string, algo: string, length: number) => string\r\n /** Hapus dead CSS selectors + minify via Lightning CSS. */\r\n eliminateDeadCss?: (css: string, deadClasses: string[]) => string\r\n /** Dead code detection + strip + Lightning CSS minify dalam satu call. */\r\n optimizeCss?: (css: string) => string\r\n /** Extract tw container configs dari source untuk static @container CSS generation. */\r\n extractTwContainerConfigs?: (source: string) => Array<{\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n }>\r\n \r\n // Phase 5.1: Cache Management (9 functions)\r\n get_cache_statistics?: () => string // Returns JSON\r\n clear_all_caches?: () => void\r\n clear_parse_cache?: () => void\r\n clear_resolve_cache?: () => void\r\n clear_compile_cache?: () => void\r\n clear_css_gen_cache?: () => void\r\n get_cache_optimization_hints?: (hit_rate_percent: number, memory_used_mb: number) => string // Returns JSON\r\n estimate_optimal_cache_config_native?: (total_budget_mb: number, workload_type: string) => string // Returns JSON\r\n cache_read?: (cache_path: string) => { entries_json: string }\r\n cache_write?: (cache_path: string, entries: Array<{ file: string; content_hash: string; classes: string[]; mtime_ms: number; size_bytes: number }>) => boolean\r\n cache_priority?: (mtime_ms: number, size_bytes: number, hit_count: number) => number\r\n \r\n // Phase 5.1: Theme Resolution Extended (7 functions)\r\n resolve_variants?: (configJson: string) => string // Returns JSON\r\n validate_variant_config?: (configJson: string) => string // Returns JSON\r\n resolve_cascade?: (baseThemeJson: string, overridesJson: string) => string // Returns JSON\r\n resolve_class_names?: (classNames: string[], themeJson: string) => string // Returns JSON\r\n resolve_conflict_group?: (groupName: string, themeJson: string) => string // Returns JSON\r\n resolve_theme_value?: (keyPath: string, themeJson: string) => string | null\r\n resolve_simple_variants?: (configJson: string) => string // Returns JSON\r\n \r\n // Phase 5.1: Streaming & Incremental Processing (8 functions)\r\n process_file_change?: (fileChangeJson: string) => string // Returns JSON\r\n compute_incremental_diff?: (oldScanJson: string, newScanJson: string) => string // Returns JSON\r\n create_fingerprint?: (filePath: string, fileContent: string) => string // Returns JSON\r\n inject_state_hash?: (css: string, stateHash: string) => string // Returns JSON\r\n prune_stale_entries?: (maxAgeSeconds: number, maxEntries: number) => string // Returns JSON\r\n rebuild_workspace_result?: (rootDir: string, extensions?: string[]) => string // Returns JSON\r\n scan_file_native?: (filePath: string, fileContent: string) => string // Returns JSON\r\n scan_files_batch_native?: (filesJson: string) => string // Returns JSON\r\n \r\n // Phase 5.2: CSS Compilation (12 functions)\r\n compile_class?: (input: string) => string // Returns JSON\r\n compile_classes?: (inputs: string[]) => string // Returns JSON\r\n compile_to_css?: (input: string, minify: boolean) => string\r\n compile_to_css_batch?: (inputs: string[], minify: boolean) => string\r\n minify_css?: (css: string) => string\r\n compile_animation?: (animationName: string, from: string, to: string) => string // Returns JSON\r\n compile_keyframes?: (name: string, stopsJson: string) => string // Returns JSON\r\n compile_theme?: (tokensJson: string, themeName: string, prefix: string) => string // Returns JSON\r\n tw_merge?: (classString: string) => string\r\n tw_merge_many?: (classStrings: string[]) => string\r\n tw_merge_with_separator?: (classString: string, options: Record<string, unknown>) => string\r\n tw_merge_many_with_separator?: (classStrings: string[], options: Record<string, unknown>) => string\r\n tw_merge_raw?: (classLists: string[]) => string\r\n \r\n // Phase 5.2: ID Registry (16 functions)\r\n id_registry_create?: () => number\r\n id_registry_generate?: (handle: number, name: string) => number\r\n id_registry_lookup?: (handle: number, name: string) => number\r\n id_registry_next?: (handle: number) => number\r\n id_registry_destroy?: (handle: number) => void\r\n id_registry_reset?: (handle: number) => void\r\n id_registry_snapshot?: (handle: number) => string // Returns JSON\r\n id_registry_active_count?: () => number\r\n register_property_name?: (propertyName: string) => number\r\n register_value_name?: (valueName: string) => number\r\n property_id_to_string?: (propertyId: number) => string\r\n value_id_to_string?: (valueId: number) => string\r\n reverse_lookup_property?: (propertyId: number) => string\r\n reverse_lookup_value?: (valueId: number) => string\r\n id_registry_export?: (handle: number) => string\r\n id_registry_import?: (importedData: string) => number\r\n \r\n // Phase 5.3: Redis Integration (40 functions)\r\n redis_ping?: () => string\r\n redis_get?: (key: string) => string\r\n redis_set?: (key: string, value: string, ttl_seconds?: number) => string\r\n redis_delete?: (key: string) => number\r\n redis_exists?: (key: string) => number\r\n redis_mget?: (keys: string[]) => string // Returns JSON\r\n redis_mset?: (pairs: Array<[string, string]>) => string\r\n redis_flush_db?: () => number\r\n redis_flush_all?: () => number\r\n redis_pool_connect?: (host: string, port: number, pool_size?: number) => string\r\n redis_pool_stats?: () => string // Returns JSON\r\n redis_pool_reconnect?: () => string\r\n redis_enable_cluster?: (initial_nodes: string[]) => string // Returns JSON\r\n redis_disable_cluster?: () => string\r\n redis_cluster_status?: () => string // Returns JSON\r\n redis_subscribe?: (channel: string) => string\r\n redis_publish?: (channel: string, message: string) => number\r\n redis_expiration_set?: (key: string, ttl_seconds: number) => number\r\n redis_expiration_get?: (key: string) => string // Returns JSON\r\n redis_info?: () => string\r\n redis_monitor?: () => string\r\n redis_cache_size?: () => number\r\n redis_cache_key_count?: () => number\r\n redis_cache_clear?: () => number\r\n redis_cache_hit_rate?: () => number\r\n redis_enable_persistence?: (mode: string) => string\r\n redis_disable_persistence?: () => string\r\n redis_snapshot?: () => string\r\n redis_memory_stats?: () => string\r\n redis_optimize_memory?: () => number\r\n redis_set_eviction_policy?: (policy: string) => string\r\n redis_get_eviction_policy?: () => string\r\n redis_replicate?: (target_host: string, target_port: number) => number\r\n redis_replication_status?: () => string\r\n redis_cache_sync?: (peers: string[]) => number\r\n redis_enable_cache_warming?: (key_pattern: string) => string\r\n redis_disable_cache_warming?: () => string\r\n redis_diagnose?: () => string\r\n \r\n // Phase 5.4: Watch System & File Monitoring (20 functions)\r\n start_watch?: (root_path: string, patterns?: string[]) => number\r\n poll_watch_events?: (handle: number, timeout_ms?: number) => string // Returns JSON\r\n stop_watch?: (handle: number) => number\r\n watch_add_pattern?: (handle: number, pattern: string) => string\r\n watch_remove_pattern?: (handle: number, pattern: string) => string\r\n watch_get_active_handles?: () => string // Returns JSON\r\n watch_clear_all?: () => number\r\n watch_event_type_to_string?: (event_type_code: number) => string\r\n is_watch_running?: (handle: number) => boolean\r\n get_watch_stats?: () => string // Returns JSON\r\n watch_pause?: (handle: number) => string\r\n watch_resume?: (handle: number) => string\r\n scan_cache_optimizations?: () => string // Returns JSON\r\n get_plugin_hooks?: () => string // Returns JSON\r\n register_plugin_hook?: (hook_name: string, handler_id: string) => string\r\n unregister_plugin_hook?: (hook_name: string, handler_id: string) => string\r\n emit_plugin_hook?: (hook_name: string, data_json: string) => string\r\n get_compilation_metrics?: () => string // Returns JSON\r\n reset_compilation_metrics?: () => string\r\n validate_css_output?: (css: string) => string // Returns JSON\r\n get_compiler_diagnostics?: () => string // Returns JSON\r\n\r\n // ── Cache Management (napi_bridge_cache.rs) ────────────────────────────────\r\n configureCacheBackend?: (configJson: string) => string\r\n getRecommendedCacheConfig?: (workloadType: string) => string\r\n clearAllCachesNapi?: () => void\r\n clearResolveCacheNapi?: () => void\r\n clearCompileCacheNapi?: () => void\r\n clearCssGenCacheNapi?: () => void\r\n getResolverPoolStats?: () => string\r\n clearResolverPool?: () => string\r\n getCacheOptimizationHints?: () => string\r\n estimateStreamingBatchSize?: (targetMemoryMb: number) => string\r\n\r\n // ── Parsing (napi_bridge_parsing.rs) ──────────────────────────────────────\r\n parseClass?: (input: string) => string\r\n compileClassNapi?: (input: string) => string\r\n getParseStats?: () => string\r\n clearParseCacheNapi?: () => void\r\n\r\n // ── Theme Parsing (napi_bridge_theme_parsing.rs) ───────────────────────────\r\n parseColorsNapi?: (colorsJson: string) => string | Record<string, string>\r\n parseSpacingNapi?: (spacingJson: string) => string | Record<string, string>\r\n parseTransformNapi?: (transformJson: string) => string | Record<string, string>\r\n normalizeColorNapi?: (color: string, opacity: string) => string\r\n sanitizeColorNapi?: (color: string) => string\r\n splitRgbaNapi?: (color: string) => string | { r: number; g: number; b: number; a: number }\r\n validateColorsNapi?: (colorsJson: string) => boolean\r\n validateBreakpointsNapi?: (breakpointsJson: string) => boolean\r\n runHealthCheck?: () => void\r\n\r\n // ── Watch (napi_bridge_watch.rs) ───────────────────────────────────────────\r\n watchFiles?: (rootDir: string, optionsJson?: string | null) => string\r\n stopWatching?: (handleId: number) => string\r\n getWatchEvents?: (handleId: number, maxEvents?: number | null) => string\r\n getWatchPerformance?: () => string\r\n clearWatchStats?: () => string\r\n getActiveWatches?: () => number\r\n setWatchMetrics?: (metricName: string, value: string) => string\r\n setWatchAggregation?: (aggregationType: string) => string\r\n\r\n // ── Week 6 Optimization (week6_api.rs) ────────────────────────────────────\r\n getOptimizationRecommendations?: (hitRate: number, memoryMb: number, classCount: number) => string\r\n estimateOptimalBatchSize?: (totalClasses: number, memoryAvailableMb: number) => number\r\n predictMemoryUsage?: (uniqueClasses: number, avgClassSizeBytes: number) => number\r\n recommendCachingStrategy?: (isSsr: boolean, memoryConstraintMb: number) => string\r\n benchmarkStreamingVsBuffered?: (classCount: number) => string\r\n getWeek6OptimizationStatus?: () => string\r\n\r\n // ── Scan Cache (scan_cache_api.rs) ────────────────────────────────────────\r\n scanCacheGet?: (filePath: string, contentHash: string) => string[] | null\r\n scanCachePut?: (filePath: string, contentHash: string, classes: string[], mtimeMs: number, size: number) => void\r\n scanCacheInvalidate?: (filePath: string) => void\r\n scanCacheStats?: () => { size: number }\r\n}\r\n\r\nexport interface NativeTransformResult {\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rscJson?: string\r\n metadataJson?: string\r\n}\r\n\r\nexport interface ClassExtractResult {\r\n classes: string[]\r\n component_names: string[]\r\n has_tw_usage: boolean\r\n has_use_client: boolean\r\n imports: string[]\r\n}\r\n\r\nconst NATIVE_UNAVAILABLE_MESSAGE =\r\n \"[tailwind-styled/compiler v5] Native binding is required but not available.\\n\" +\r\n \"This package requires native Rust bindings. There is no JavaScript fallback.\\n\" +\r\n \"Please ensure:\\n\" +\r\n \" 1. The native module is properly installed\\n\" +\r\n \" 2. You have run: npm run build:rust (or use prebuilt binary)\\n\" +\r\n \"\\n\" +\r\n \"For help, see: https://tailwind-styled.dev/docs/install\"\r\n\r\n// ── Native Bridge - Factory Pattern\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nlet nativeBridge: NativeBridge | null = null\r\nlet bridgeLoadAttempted = false\r\nlet bridgeLoadError: Error | null = null\r\n\r\nconst isValidNativeBridge = (mod: unknown): mod is NativeBridge => {\r\n const m = mod as Partial<NativeBridge>\r\n return !!(\r\n typeof m.transformSource === \"function\" ||\r\n typeof m.extractAllClasses === \"function\" ||\r\n typeof m.hasTwUsage === \"function\"\r\n )\r\n}\r\n\r\nexport const getNativeBridge = (): NativeBridge => {\r\n if (nativeBridge) {\r\n return nativeBridge\r\n }\r\n\r\n if (bridgeLoadAttempted) {\r\n if (bridgeLoadError) {\r\n throw bridgeLoadError\r\n }\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n\r\n bridgeLoadAttempted = true\r\n\r\n try {\r\n const runtimeDir = resolveRuntimeDir(undefined, import.meta.url)\r\n \r\n // Use shared's native resolution\r\n const result = resolveNativeBinary(runtimeDir)\r\n\r\n if (result.path && result.path.endsWith(\".node\")) {\r\n try {\r\n const binding = _loadNative(result.path) as NativeBridge\r\n if (isValidNativeBridge(binding)) {\r\n nativeBridge = binding\r\n log(\"Native bridge loaded successfully from:\", result.path)\r\n return nativeBridge\r\n }\r\n } catch (e) {\r\n log(\"Failed to require native binding:\", e)\r\n }\r\n }\r\n\r\n throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}\\n\\nTried paths: ${result.tried.join(\"\\n\")}`)\r\n } catch (err) {\r\n bridgeLoadError = err instanceof Error ? err : new Error(String(err))\r\n log(\"Failed to load native bridge:\", bridgeLoadError.message)\r\n throw bridgeLoadError\r\n }\r\n}\r\n\r\nexport const resetNativeBridgeCache = (): void => {\r\n nativeBridge = null\r\n bridgeLoadAttempted = false\r\n bridgeLoadError = null\r\n log(\"Native bridge cache reset\")\r\n}\r\n\r\n// ── Adaptor for native results\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport const adaptNativeResult = (\r\n raw: NativeTransformResult\r\n): {\r\n code: string\r\n classes: string[]\r\n changed: boolean\r\n rsc?: NativeRscResult\r\n metadata?: ComponentMetadata[]\r\n} => {\r\n return {\r\n code: raw.code ?? \"\",\r\n classes: raw.classes ?? [],\r\n changed: raw.changed ?? false,\r\n rsc: raw.rscJson ? JSON.parse(raw.rscJson) : undefined,\r\n metadata: raw.metadataJson ? JSON.parse(raw.metadataJson) : undefined,\r\n }\r\n}\r\n\r\n// ── Eager init — load native bridge saat module dimuat, bukan saat request pertama\r\n// Mencegah crash di Turbopack dev mode karena lazy init mid-request\r\n// ─────────────────────────────────────────────────────────────────────────────\r\nif (typeof process !== \"undefined\" && !bridgeLoadAttempted) {\r\n try {\r\n getNativeBridge()\r\n } catch {\r\n // Sudah di-capture di bridgeLoadError — akan di-throw saat dipanggil pertama kali\r\n }\r\n}\r\n\r\n// ── Re-export all 63 wrapper functions from nativeBridgeWrappers\r\n// These provide complete type safety, error handling, and JSDoc documentation\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport {\r\n // Redis Cache Functions (40)\r\n redis_pool_connect,\r\n redis_pool_stats,\r\n redis_pool_reconnect,\r\n redis_ping,\r\n redis_get,\r\n redis_set,\r\n redis_delete,\r\n redis_exists,\r\n redis_mget,\r\n redis_mset,\r\n redis_flush_db,\r\n redis_flush_all,\r\n redis_cache_size,\r\n redis_cache_key_count,\r\n redis_cache_clear,\r\n redis_cache_hit_rate,\r\n redis_info,\r\n redis_monitor,\r\n redis_enable_cluster,\r\n redis_disable_cluster,\r\n redis_cluster_status,\r\n redis_expiration_set,\r\n redis_expiration_get,\r\n redis_subscribe,\r\n redis_publish,\r\n redis_enable_persistence,\r\n redis_disable_persistence,\r\n redis_snapshot,\r\n redis_replicate,\r\n redis_replication_status,\r\n redis_enable_cache_warming,\r\n redis_disable_cache_warming,\r\n redis_cache_sync,\r\n redis_set_eviction_policy,\r\n redis_get_eviction_policy,\r\n redis_memory_stats,\r\n redis_optimize_memory,\r\n redis_diagnose,\r\n // Watch System Functions (20)\r\n start_watch,\r\n poll_watch_events,\r\n stop_watch,\r\n watch_add_pattern,\r\n watch_remove_pattern,\r\n watch_pause,\r\n watch_resume,\r\n is_watch_running,\r\n get_watch_stats,\r\n watch_get_active_handles,\r\n watch_clear_all,\r\n register_plugin_hook,\r\n unregister_plugin_hook,\r\n emit_plugin_hook,\r\n get_plugin_hooks,\r\n // ID Registry Functions (16)\r\n id_registry_create,\r\n id_registry_generate,\r\n id_registry_lookup,\r\n id_registry_next,\r\n id_registry_destroy,\r\n id_registry_reset,\r\n id_registry_snapshot,\r\n id_registry_active_count,\r\n register_property_name,\r\n register_value_name,\r\n property_id_to_string,\r\n value_id_to_string,\r\n reverse_lookup_property,\r\n reverse_lookup_value,\r\n id_registry_export,\r\n id_registry_import,\r\n // Incremental Compilation Functions (8)\r\n process_file_change,\r\n compute_incremental_diff,\r\n create_fingerprint,\r\n inject_state_hash,\r\n prune_stale_entries,\r\n rebuild_workspace_result,\r\n scan_files_batch_native,\r\n // Theme Resolution Functions (7)\r\n resolve_variants,\r\n validate_variant_config,\r\n resolve_cascade,\r\n resolve_class_names,\r\n resolve_conflict_group,\r\n resolve_theme_value,\r\n resolve_simple_variants,\r\n} from \"./nativeBridgeWrappers\"","/**\r\n * cssGeneratorNative.ts\r\n *\r\n * High-performance CSS generator using Rust compiler via NAPI binding.\r\n * Rust-only implementation - no JavaScript fallback.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\nexport interface GenerateCssNativeOptions {\r\n theme: Record<string, unknown>\r\n}\r\n\r\n/**\r\n * Generate CSS from Tailwind classes using the Rust compiler.\r\n * \r\n * @param classes - Array of Tailwind class names (e.g., [\"px-4\", \"hover:bg-blue-600\"])\r\n * @param options - Configuration including theme object\r\n * @returns Promise resolving to CSS string\r\n * \r\n * @example\r\n * ```ts\r\n * const css = await generateCssNative(\r\n * [\"px-4\", \"hover:bg-blue-600\", \"md:text-lg\"],\r\n * {\r\n * theme: defaultTheme,\r\n * fallbackToJs: true,\r\n * logFallback: process.env.DEBUG === \"true\"\r\n * }\r\n * )\r\n * ```\r\n * \r\n * **Performance**: Rust compiler typically 40-60% faster than Tailwind JS\r\n * - Rust: 60-90ms for 100 classes\r\n * - JavaScript: 150ms baseline\r\n * \r\n * **Error Handling**:\r\n * - If Rust binding fails and fallbackToJs=true, falls back to Tailwind JS\r\n * - If Rust binding fails and fallbackToJs=false, throws error\r\n * - Invalid classes log warnings but don't stop compilation\r\n */\r\nexport async function generateCssNative(\r\n classes: string[],\r\n options: GenerateCssNativeOptions\r\n): Promise<string> {\r\n const { theme } = options\r\n\r\n const native = getNativeBridge()\r\n \r\n if (!native?.generateCssNative) {\r\n throw new Error(\r\n \"FATAL: Rust CSS generator (generateCssNative) is required but not available. \" +\r\n \"Ensure native binding is properly loaded. Check that native/.node binary exists.\"\r\n )\r\n }\r\n\r\n // Convert theme object to JSON string for Rust\r\n const themeJson = JSON.stringify(theme)\r\n \r\n // Call Rust compiler - no fallback, fail fast\r\n const css = native.generateCssNative(classes, themeJson)\r\n \r\n return css\r\n}\r\n\r\n/**\r\n * Get cache statistics from the Rust compiler.\r\n * \r\n * @returns Object with cache hit/miss counts, or null if binding unavailable\r\n * \r\n * @example\r\n * ```ts\r\n * const stats = getCacheStats()\r\n * if (stats) {\r\n * console.log(`Cache hits: ${stats.hits}, misses: ${stats.misses}`)\r\n * console.log(`Hit rate: ${(stats.hits / (stats.hits + stats.misses) * 100).toFixed(1)}%`)\r\n * }\r\n * ```\r\n */\r\nexport function getCacheStats(): { hits: number; misses: number } | null {\r\n try {\r\n const native = getNativeBridge()\r\n \r\n if (!native?.getCacheStats) {\r\n return null\r\n }\r\n\r\n const [hits, misses] = native.getCacheStats()\r\n return { hits, misses }\r\n } catch {\r\n return null\r\n }\r\n}\r\n\r\n/**\r\n * Clear the theme resolver cache.\r\n * \r\n * Useful for:\r\n * - Testing with different themes\r\n * - Freeing memory in long-running processes\r\n * - Resetting state between build cycles\r\n * \r\n * @example\r\n * ```ts\r\n * // Clear cache before each build\r\n * clearThemeCache()\r\n * const css = await generateCssNative(classes, { theme })\r\n * ```\r\n */\r\nexport function clearThemeCache(): void {\r\n try {\r\n const native = getNativeBridge()\r\n \r\n if (!native?.clearThemeCache) {\r\n return\r\n }\r\n\r\n native.clearThemeCache()\r\n } catch {\r\n // Silently ignore if native binding unavailable\r\n }\r\n}\r\n\r\n/**\r\n * Recommended default theme configuration for Tailwind v4.\r\n * \r\n * Use this when you need a complete theme object for the Rust compiler.\r\n */\r\nexport const DEFAULT_THEME = {\r\n colors: {\r\n slate: {\r\n \"50\": \"#f8fafc\",\r\n \"100\": \"#f1f5f9\",\r\n \"200\": \"#e2e8f0\",\r\n \"300\": \"#cbd5e1\",\r\n \"400\": \"#94a3b8\",\r\n \"500\": \"#64748b\",\r\n \"600\": \"#475569\",\r\n \"700\": \"#334155\",\r\n \"800\": \"#1e293b\",\r\n \"900\": \"#0f172a\",\r\n },\r\n // ... other colors from Tailwind defaults\r\n },\r\n spacing: {\r\n \"0\": \"0px\",\r\n \"1\": \"0.25rem\",\r\n \"2\": \"0.5rem\",\r\n \"3\": \"0.75rem\",\r\n \"4\": \"1rem\",\r\n \"5\": \"1.25rem\",\r\n \"6\": \"1.5rem\",\r\n \"8\": \"2rem\",\r\n \"10\": \"2.5rem\",\r\n \"12\": \"3rem\",\r\n },\r\n breakpoints: {\r\n \"sm\": \"640px\",\r\n \"md\": \"768px\",\r\n \"lg\": \"1024px\",\r\n \"xl\": \"1280px\",\r\n \"2xl\": \"1536px\",\r\n },\r\n darkMode: \"media\" as const,\r\n} as const\r\n","/**\r\n * compilationNative.ts\r\n *\r\n * Native Rust bindings for CSS compilation and advanced features.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nexport type {\r\n ContainerConfig,\r\n StateCssConfig,\r\n GeneratedStateCss,\r\n} from \"../nativeBridge\"\r\n\r\n/**\r\n * Compile Tailwind classes directly to CSS.\r\n */\r\nexport function compileCssNative2(classes: string[], prefix?: string | null) {\r\n const native = getNativeBridge()\r\n if (!native?.compileCss) throw new Error(\"compileCss not available\")\r\n return native.compileCss(classes, prefix)\r\n}\r\n\r\n/**\r\n * Compile CSS using Lightning CSS post-processing.\r\n */\r\nexport function compileCssLightning(classes: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.compileCssLightning) throw new Error(\"compileCssLightning not available\")\r\n return native.compileCssLightning(classes)\r\n}\r\n\r\n/**\r\n * Extract Tailwind state configurations from source code.\r\n */\r\nexport function extractTwStateConfigsNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwStateConfigs) throw new Error(\"extractTwStateConfigs not available\")\r\n return native.extractTwStateConfigs(source, filename)\r\n}\r\n\r\n/**\r\n * Generate static state CSS from configuration.\r\n */\r\nexport function generateStaticStateCssNative(\r\n inputs: Array<{\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n }>,\r\n resolvedCss?: string | null\r\n) {\r\n const native = getNativeBridge()\r\n if (!native?.generateStaticStateCss) throw new Error(\"generateStaticStateCss not available\")\r\n return native.generateStaticStateCss(inputs, resolvedCss ?? null)\r\n}\r\n\r\n/**\r\n * Extract and generate state CSS in one step.\r\n */\r\nexport function extractAndGenerateStateCssNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractAndGenerateStateCss) throw new Error(\"extractAndGenerateStateCss not available\")\r\n return native.extractAndGenerateStateCss(source, filename)\r\n}\r\n\r\n/**\r\n * Convert layout/utility class string to CSS declarations.\r\n */\r\nexport function layoutClassesToCss(classes: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.layoutClassesToCss) throw new Error(\"layoutClassesToCss not available\")\r\n return native.layoutClassesToCss(classes)\r\n}\r\n\r\n/**\r\n * Hash content for deterministic ID generation.\r\n */\r\nexport function hashContent(input: string, algorithm: string = \"sha256\", length: number = 8): string {\r\n const native = getNativeBridge()\r\n if (!native?.hashContent) throw new Error(\"hashContent not available\")\r\n return native.hashContent(input, algorithm, length)\r\n}\r\n\r\n/**\r\n * Extract container query configurations from source.\r\n */\r\nexport function extractTwContainerConfigs(source: string) {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwContainerConfigs) throw new Error(\"extractTwContainerConfigs not available\")\r\n return native.extractTwContainerConfigs(source)\r\n}\r\n\r\n/**\r\n * Parse Tailwind class into atomic CSS representation.\r\n */\r\nexport function parseAtomicClass(twClass: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.parseAtomicClass) throw new Error(\"parseAtomicClass not available\")\r\n return native.parseAtomicClass(twClass)\r\n}\r\n\r\n/**\r\n * Generate atomic CSS from rules.\r\n */\r\nexport function generateAtomicCss(rulesJson: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.generateAtomicCss) throw new Error(\"generateAtomicCss not available\")\r\n return native.generateAtomicCss(rulesJson)\r\n}\r\n\r\n/**\r\n * Convert Tailwind classes to atomic CSS classes.\r\n */\r\nexport function toAtomicClasses(twClasses: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.toAtomicClasses) throw new Error(\"toAtomicClasses not available\")\r\n return native.toAtomicClasses(twClasses)\r\n}\r\n\r\n/**\r\n * Clear atomic CSS registry.\r\n */\r\nexport function clearAtomicRegistry(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clearAtomicRegistry) return\r\n native.clearAtomicRegistry()\r\n}\r\n\r\n/**\r\n * Get atomic registry size.\r\n */\r\nexport function atomicRegistrySize(): number {\r\n const native = getNativeBridge()\r\n if (!native?.atomicRegistrySize) return 0\r\n return native.atomicRegistrySize()\r\n}\r\n\r\n","/**\r\n * cssCompilationNative.ts\r\n *\r\n * Phase 5.2: Advanced CSS Compilation - Complex CSS generation and transformations\r\n * Exposes 12 CSS compilation functions for animations, themes, and merging\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Compiled CSS rule result\r\n */\r\nexport interface CompiledCssRule {\r\n selector: string\r\n declarations: string\r\n properties: Array<{ key: string; value: string }>\r\n specificity: number\r\n}\r\n\r\n/**\r\n * Compiled animation result\r\n */\r\nexport interface CompiledAnimation {\r\n animation_id: string\r\n keyframes_css: string\r\n animation_rule: string\r\n duration_ms: number\r\n}\r\n\r\n/**\r\n * Compiled theme result\r\n */\r\nexport interface CompiledTheme {\r\n selector: string\r\n variables: Array<{ name: string; value: string }>\r\n variables_css: string\r\n theme_name: string\r\n}\r\n\r\n/**\r\n * CSS compile result with metadata\r\n */\r\nexport interface CssCompileResult {\r\n css: string\r\n resolved_classes: string[]\r\n unknown_classes: string[]\r\n size_bytes: number\r\n duration_ms: number\r\n}\r\n\r\n/**\r\n * tw_merge options\r\n */\r\nexport interface TwMergeOptions {\r\n separator?: string\r\n debug?: boolean\r\n}\r\n\r\n/**\r\n * Compile a single Tailwind class to CSS rule\r\n * Full compilation pipeline: parse → resolve → generate\r\n *\r\n * @param input - Single Tailwind class (e.g., \"md:hover:bg-blue-600/50\")\r\n * @returns Compiled CSS rule as JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const rule = compileClass('md:hover:bg-blue-600')\r\n * // Returns: {\r\n * // selector: '.md\\\\:hover\\\\:bg-blue-600',\r\n * // declarations: 'background-color: #2563eb;',\r\n * // ...\r\n * // }\r\n * ```\r\n */\r\nexport function compileClass(input: string): CompiledCssRule {\r\n const native = getNativeBridge()\r\n if (!native?.compile_class) throw new Error(\"compile_class not available\")\r\n const resultJson = native.compile_class(input)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n selector: \"\",\r\n declarations: \"\",\r\n properties: [],\r\n specificity: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile multiple Tailwind classes to CSS rules\r\n * Batch processing with parallel compilation\r\n *\r\n * @param inputs - Array of Tailwind classes\r\n * @returns JSON string of compiled rules\r\n *\r\n * @example\r\n * ```ts\r\n * const rules = compileClasses(['px-4', 'bg-blue-600', 'hover:opacity-80'])\r\n * ```\r\n */\r\nexport function compileClasses(inputs: string[]): CssCompileResult {\r\n const native = getNativeBridge()\r\n if (!native?.compile_classes) throw new Error(\"compile_classes not available\")\r\n const resultJson = native.compile_classes(inputs)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n css: \"\",\r\n resolved_classes: [],\r\n unknown_classes: [],\r\n size_bytes: 0,\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * One-step: class → CSS string\r\n * Compiles and generates in single call\r\n *\r\n * @param input - Single Tailwind class\r\n * @param minify - Whether to minify output (default: false)\r\n * @returns Generated CSS string\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileToCss('bg-blue-600')\r\n * // Returns: \".bg-blue-600 { background-color: #2563eb; }\"\r\n *\r\n * const minified = compileToCss('bg-blue-600', true)\r\n * // Returns: \".bg-blue-600{background-color:#2563eb}\"\r\n * ```\r\n */\r\nexport function compileToCss(input: string, minify?: boolean): string {\r\n const native = getNativeBridge()\r\n if (!native?.compile_to_css) throw new Error(\"compile_to_css not available\")\r\n return native.compile_to_css(input, minify ?? false)\r\n}\r\n\r\n/**\r\n * Batch compile to CSS\r\n * Compiles multiple classes and generates combined CSS\r\n *\r\n * @param inputs - Array of Tailwind classes\r\n * @param minify - Whether to minify output\r\n * @returns Combined CSS string\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileToCssBatch(['px-4', 'bg-blue-600'], true)\r\n * ```\r\n */\r\nexport function compileToCssBatch(inputs: string[], minify?: boolean): string {\r\n const native = getNativeBridge()\r\n if (!native?.compile_to_css_batch) throw new Error(\"compile_to_css_batch not available\")\r\n return native.compile_to_css_batch(inputs, minify ?? false)\r\n}\r\n\r\n/**\r\n * Minify CSS string\r\n * Removes unnecessary whitespace and formatting\r\n *\r\n * @param css - Raw CSS string\r\n * @returns Minified CSS (40-60% size reduction)\r\n *\r\n * @example\r\n * ```ts\r\n * const css = \".px-4 { padding-left: 1rem; padding-right: 1rem; }\"\r\n * const minified = minifyCss(css)\r\n * // Returns: \".px-4{padding-left:1rem;padding-right:1rem}\"\r\n * ```\r\n */\r\nexport function minifyCss(css: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.minify_css) throw new Error(\"minify_css not available\")\r\n return native.minify_css(css)\r\n}\r\n\r\n/**\r\n * Compile animation from from/to states\r\n * Generates @keyframes and animation rule\r\n *\r\n * @param animationName - Animation name\r\n * @param from - From state classes (e.g., \"opacity-0 scale-95\")\r\n * @param to - To state classes (e.g., \"opacity-100 scale-100\")\r\n * @returns Compiled animation with keyframes\r\n *\r\n * @example\r\n * ```ts\r\n * const anim = compileAnimation('fade-in', 'opacity-0', 'opacity-100')\r\n * console.log(anim.keyframes_css) // @keyframes fade-in { ... }\r\n * console.log(anim.animation_rule) // animation: fade-in 300ms;\r\n * ```\r\n */\r\nexport function compileAnimation(\r\n animationName: string,\r\n from: string,\r\n to: string\r\n): CompiledAnimation {\r\n const native = getNativeBridge()\r\n if (!native?.compile_animation) throw new Error(\"compile_animation not available\")\r\n const resultJson = native.compile_animation(animationName, from, to)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n animation_id: \"\",\r\n keyframes_css: \"\",\r\n animation_rule: \"\",\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile keyframes from stop definitions\r\n * Creates @keyframes from percentage stops\r\n *\r\n * @param name - Keyframes name\r\n * @param stopsJson - JSON array of stops: `[{\"stop\":\"0%\",\"classes\":\"opacity-0\"}...]`\r\n * @returns Compiled @keyframes rule\r\n *\r\n * @example\r\n * ```ts\r\n * const kf = compileKeyframes('slide-in', JSON.stringify([\r\n * { stop: '0%', classes: 'translate-x-full' },\r\n * { stop: '100%', classes: 'translate-x-0' }\r\n * ]))\r\n * ```\r\n */\r\nexport function compileKeyframes(name: string, stopsJson: string): CompiledAnimation {\r\n const native = getNativeBridge()\r\n if (!native?.compile_keyframes) throw new Error(\"compile_keyframes not available\")\r\n const resultJson = native.compile_keyframes(name, stopsJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n animation_id: \"\",\r\n keyframes_css: \"\",\r\n animation_rule: \"\",\r\n duration_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compile theme to CSS variables\r\n * Converts token map to CSS custom properties\r\n *\r\n * @param tokensJson - Theme tokens as JSON\r\n * @param themeName - Theme name (\"light\", \"dark\", etc.)\r\n * @param prefix - CSS variable prefix (e.g., \"tw\" → \"--tw-color-primary\")\r\n * @returns Compiled theme with variables CSS\r\n *\r\n * @example\r\n * ```ts\r\n * const theme = compileTheme(\r\n * JSON.stringify({ colors: { blue: { 600: '#2563eb' } } }),\r\n * 'light',\r\n * 'tw'\r\n * )\r\n * // Returns CSS: :root { --tw-color-blue-600: #2563eb; }\r\n * ```\r\n */\r\nexport function compileTheme(\r\n tokensJson: string,\r\n themeName: string,\r\n prefix: string\r\n): CompiledTheme {\r\n const native = getNativeBridge()\r\n if (!native?.compile_theme) throw new Error(\"compile_theme not available\")\r\n const resultJson = native.compile_theme(tokensJson, themeName, prefix)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n selector: \":root\",\r\n variables: [],\r\n variables_css: \"\",\r\n theme_name: themeName,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Merge conflicting Tailwind classes\r\n * Resolves conflicts intelligently (last-one-wins by default)\r\n *\r\n * @param classString - Space-separated class string (e.g., \"px-4 px-8 bg-red-500 bg-blue-600\")\r\n * @returns Merged classes with conflicts resolved\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMerge('px-4 px-8 bg-red-500 bg-blue-600')\r\n * // Returns: \"px-8 bg-blue-600\"\r\n * ```\r\n */\r\nexport function twMerge(classString: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge) throw new Error(\"tw_merge not available\")\r\n return native.tw_merge(classString)\r\n}\r\n\r\n/**\r\n * Merge multiple class strings\r\n * Combines and resolves conflicts across multiple strings\r\n *\r\n * @param classStrings - Array of class strings\r\n * @returns Merged result\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeMany([\r\n * 'px-4 hover:bg-blue-600',\r\n * 'px-8 hover:opacity-80'\r\n * ])\r\n * // Returns: \"px-8 hover:bg-blue-600 hover:opacity-80\"\r\n * ```\r\n */\r\nexport function twMergeMany(classStrings: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_many) throw new Error(\"tw_merge_many not available\")\r\n return native.tw_merge_many(classStrings)\r\n}\r\n\r\n/**\r\n * Merge with custom separator\r\n * Useful for non-standard class separators\r\n *\r\n * @param classString - Classes to merge\r\n * @param options - Merge options (separator, debug)\r\n * @returns Merged classes\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeWithSeparator(\r\n * 'px-4,px-8,bg-red-500,bg-blue-600',\r\n * { separator: ',' }\r\n * )\r\n * ```\r\n */\r\nexport function twMergeWithSeparator(\r\n classString: string,\r\n options: TwMergeOptions\r\n): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_with_separator)\r\n throw new Error(\"tw_merge_with_separator not available\")\r\n const opts = {\r\n separator: options.separator,\r\n debug: options.debug,\r\n }\r\n return native.tw_merge_with_separator(classString, opts)\r\n}\r\n\r\n/**\r\n * Merge many with custom separator\r\n * Batch merge with custom separator\r\n *\r\n * @param classStrings - Array of class strings\r\n * @param options - Merge options\r\n * @returns Merged result\r\n */\r\nexport function twMergeManyWithSeparator(\r\n classStrings: string[],\r\n options: TwMergeOptions\r\n): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_many_with_separator)\r\n throw new Error(\"tw_merge_many_with_separator not available\")\r\n const opts = {\r\n separator: options.separator,\r\n debug: options.debug,\r\n }\r\n return native.tw_merge_many_with_separator(classStrings, opts)\r\n}\r\n\r\n/**\r\n * Raw merge from class lists\r\n * Direct merge without preprocessing\r\n *\r\n * @param classLists - Array of class lists\r\n * @returns Merged classes\r\n *\r\n * @example\r\n * ```ts\r\n * const merged = twMergeRaw(['px-4 px-8', 'bg-red bg-blue'])\r\n * ```\r\n */\r\nexport function twMergeRaw(classLists: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.tw_merge_raw) throw new Error(\"tw_merge_raw not available\")\r\n return native.tw_merge_raw(classLists)\r\n}\r\n\r\n","/**\r\n * idRegistryNative.ts\r\n *\r\n * Phase 5.2: ID Registry Management - Efficient ID generation and lookup\r\n * Exposes 16 ID registry functions for deterministic class/component identification\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Registry snapshot data\r\n */\r\nexport interface RegistrySnapshot {\r\n handle: number\r\n next_id: number\r\n entries: Array<{ name: string; id: number }>\r\n total_entries: number\r\n}\r\n\r\n/**\r\n * Create a new ID generator\r\n * Returns a handle to be used in subsequent operations\r\n *\r\n * @returns Generator handle (u32)\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * // Use handle for all subsequent operations\r\n * try {\r\n * const id = idRegistryGenerate(handle, 'MyComponent')\r\n * // ... use id ...\r\n * } finally {\r\n * idRegistryDestroy(handle) // Clean up\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryCreate(): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_create) throw new Error(\"id_registry_create not available\")\r\n return native.id_registry_create()\r\n}\r\n\r\n/**\r\n * Generate a new ID for a name\r\n * Same name always returns same ID (deterministic)\r\n *\r\n * @param handle - Generator handle from idRegistryCreate()\r\n * @param name - Identifier name (e.g., component name, class name)\r\n * @returns Generated ID\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * const id1 = idRegistryGenerate(handle, 'Button') // Returns 1\r\n * const id2 = idRegistryGenerate(handle, 'Button') // Returns 1 (same)\r\n * const id3 = idRegistryGenerate(handle, 'Card') // Returns 2 (different)\r\n * ```\r\n */\r\nexport function idRegistryGenerate(handle: number, name: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_generate) throw new Error(\"id_registry_generate not available\")\r\n return native.id_registry_generate(handle, name)\r\n}\r\n\r\n/**\r\n * Lookup existing ID for a name\r\n * Returns -1 if not found\r\n *\r\n * @param handle - Generator handle\r\n * @param name - Name to look up\r\n * @returns ID if found, -1 if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const id = idRegistryLookup(handle, 'Button')\r\n * if (id !== -1) {\r\n * console.log(`Button has ID: ${id}`)\r\n * } else {\r\n * console.log('Button not in registry yet')\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryLookup(handle: number, name: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_lookup) throw new Error(\"id_registry_lookup not available\")\r\n return native.id_registry_lookup(handle, name)\r\n}\r\n\r\n/**\r\n * Get the next ID that would be assigned\r\n * Useful for knowing how many unique IDs exist\r\n *\r\n * @param handle - Generator handle\r\n * @returns Next available ID\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Button')\r\n * idRegistryGenerate(handle, 'Card')\r\n * const nextId = idRegistryNext(handle) // Returns 2 (next available)\r\n * ```\r\n */\r\nexport function idRegistryNext(handle: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_next) throw new Error(\"id_registry_next not available\")\r\n return native.id_registry_next(handle)\r\n}\r\n\r\n/**\r\n * Destroy a registry (clean up resources)\r\n * Must be called when done with registry\r\n *\r\n * @param handle - Generator handle\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * try {\r\n * // Use registry\r\n * } finally {\r\n * idRegistryDestroy(handle)\r\n * }\r\n * ```\r\n */\r\nexport function idRegistryDestroy(handle: number): void {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_destroy) return\r\n native.id_registry_destroy(handle)\r\n}\r\n\r\n/**\r\n * Reset registry to initial state\r\n * Clears all entries but reuses handle\r\n *\r\n * @param handle - Generator handle\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Component1')\r\n * idRegistryGenerate(handle, 'Component2')\r\n * idRegistryReset(handle) // Clear all\r\n * const id = idRegistryNext(handle) // Back to 0\r\n * ```\r\n */\r\nexport function idRegistryReset(handle: number): void {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_reset) return\r\n native.id_registry_reset(handle)\r\n}\r\n\r\n/**\r\n * Get snapshot of current registry state\r\n * Useful for serialization/debugging\r\n *\r\n * @param handle - Generator handle\r\n * @returns Snapshot with all entries\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryCreate()\r\n * idRegistryGenerate(handle, 'Button')\r\n * idRegistryGenerate(handle, 'Card')\r\n * const snapshot = idRegistrySnapshot(handle)\r\n * console.log(JSON.stringify(snapshot, null, 2))\r\n * ```\r\n */\r\nexport function idRegistrySnapshot(handle: number): RegistrySnapshot {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_snapshot) throw new Error(\"id_registry_snapshot not available\")\r\n const snapshotJson = native.id_registry_snapshot(handle)\r\n try {\r\n return JSON.parse(snapshotJson)\r\n } catch {\r\n return {\r\n handle,\r\n next_id: 0,\r\n entries: [],\r\n total_entries: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Get count of active registries\r\n * Useful for monitoring resource usage\r\n *\r\n * @returns Number of active generator handles\r\n *\r\n * @example\r\n * ```ts\r\n * console.log(`Active registries: ${idRegistryActiveCount()}`)\r\n * ```\r\n */\r\nexport function idRegistryActiveCount(): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_active_count) throw new Error(\"id_registry_active_count not available\")\r\n return native.id_registry_active_count()\r\n}\r\n\r\n/**\r\n * Register a property name with global registry\r\n * Maps property names to consistent IDs\r\n *\r\n * @param propertyName - Property name (e.g., \"background-color\")\r\n * @returns Assigned property ID\r\n *\r\n * @example\r\n * ```ts\r\n * const bgColorId = registerPropertyName('background-color')\r\n * const paddingId = registerPropertyName('padding')\r\n * ```\r\n */\r\nexport function registerPropertyName(propertyName: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.register_property_name)\r\n throw new Error(\"register_property_name not available\")\r\n return native.register_property_name(propertyName)\r\n}\r\n\r\n/**\r\n * Register a value name with global registry\r\n * Maps values to consistent IDs\r\n *\r\n * @param valueName - Value name (e.g., \"blue-600\")\r\n * @returns Assigned value ID\r\n *\r\n * @example\r\n * ```ts\r\n * const blueId = registerValueName('blue-600')\r\n * const redId = registerValueName('red-500')\r\n * ```\r\n */\r\nexport function registerValueName(valueName: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.register_value_name) throw new Error(\"register_value_name not available\")\r\n return native.register_value_name(valueName)\r\n}\r\n\r\n/**\r\n * Convert property ID back to name\r\n * Reverse lookup for serialized data\r\n *\r\n * @param propertyId - Property ID\r\n * @returns Property name or empty string if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const bgColorId = registerPropertyName('background-color')\r\n * const name = propertyIdToString(bgColorId)\r\n * console.log(name) // \"background-color\"\r\n * ```\r\n */\r\nexport function propertyIdToString(propertyId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.property_id_to_string) throw new Error(\"property_id_to_string not available\")\r\n return native.property_id_to_string(propertyId)\r\n}\r\n\r\n/**\r\n * Convert value ID back to name\r\n * Reverse lookup for serialized data\r\n *\r\n * @param valueId - Value ID\r\n * @returns Value name or empty string if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const blueId = registerValueName('blue-600')\r\n * const value = valueIdToString(blueId)\r\n * console.log(value) // \"blue-600\"\r\n * ```\r\n */\r\nexport function valueIdToString(valueId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.value_id_to_string) throw new Error(\"value_id_to_string not available\")\r\n return native.value_id_to_string(valueId)\r\n}\r\n\r\n/**\r\n * Reverse lookup: find property by ID\r\n * Alternative way to look up property names\r\n *\r\n * @param propertyId - Property ID to look up\r\n * @returns Property name\r\n */\r\nexport function reverseLookupProperty(propertyId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.reverse_lookup_property)\r\n throw new Error(\"reverse_lookup_property not available\")\r\n return native.reverse_lookup_property(propertyId)\r\n}\r\n\r\n/**\r\n * Reverse lookup: find value by ID\r\n * Alternative way to look up value names\r\n *\r\n * @param valueId - Value ID to look up\r\n * @returns Value name\r\n */\r\nexport function reverseLookupValue(valueId: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.reverse_lookup_value) throw new Error(\"reverse_lookup_value not available\")\r\n return native.reverse_lookup_value(valueId)\r\n}\r\n\r\n/**\r\n * Export registry state for persistence\r\n * Useful for saving/restoring registry data\r\n *\r\n * @param handle - Generator handle\r\n * @returns Serialized registry state\r\n *\r\n * @example\r\n * ```ts\r\n * const exported = idRegistryExport(handle)\r\n * // Save to file/database\r\n * ```\r\n */\r\nexport function idRegistryExport(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_export) throw new Error(\"id_registry_export not available\")\r\n return native.id_registry_export(handle)\r\n}\r\n\r\n/**\r\n * Import registry state\r\n * Restore registry from saved state\r\n *\r\n * @param importedData - Serialized registry data\r\n * @returns New handle with imported data\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = idRegistryImport(savedData)\r\n * // Registry restored with same IDs\r\n * ```\r\n */\r\nexport function idRegistryImport(importedData: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.id_registry_import) throw new Error(\"id_registry_import not available\")\r\n return native.id_registry_import(importedData)\r\n}\r\n\r\n","/**\r\n * streamingNative.ts\r\n *\r\n * Phase 5.1: Streaming & Incremental Processing - Handle file changes efficiently\r\n * Exposes 8 functions for real-time incremental compilation\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * File change notification\r\n */\r\nexport interface FileChangeEvent {\r\n file_path: string\r\n event_type: \"added\" | \"modified\" | \"deleted\"\r\n old_content?: string\r\n new_content?: string\r\n timestamp_ms: number\r\n}\r\n\r\n/**\r\n * Processed file change result\r\n */\r\nexport interface ProcessedFileChange {\r\n file_path: string\r\n status: \"processed\" | \"skipped\" | \"error\"\r\n old_classes: string[]\r\n new_classes: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n changed: boolean\r\n fingerprint: string\r\n error?: string\r\n}\r\n\r\n/**\r\n * Diff between two scan results\r\n */\r\nexport interface FileDiff {\r\n added_files: string[]\r\n removed_files: string[]\r\n modified_files: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n total_changes: number\r\n}\r\n\r\n/**\r\n * File fingerprint for change detection\r\n */\r\nexport interface FileFingerprint {\r\n file_path: string\r\n content_hash: string\r\n size_bytes: number\r\n mtime_ms: number\r\n class_hash: string\r\n signature: string\r\n}\r\n\r\n/**\r\n * Incremental diff result\r\n */\r\nexport interface IncrementalDiffResult {\r\n is_changed: boolean\r\n changes_count: number\r\n diff: FileDiff\r\n processing_time_ms: number\r\n}\r\n\r\n/**\r\n * State injection result\r\n */\r\nexport interface StateInjectionResult {\r\n injected: boolean\r\n state_hash: string\r\n affected_files: number\r\n total_injected_bytes: number\r\n}\r\n\r\n/**\r\n * Stale entry pruning result\r\n */\r\nexport interface PruneResult {\r\n entries_before: number\r\n entries_after: number\r\n entries_removed: number\r\n freed_bytes: number\r\n}\r\n\r\n/**\r\n * Rebuilt workspace result\r\n */\r\nexport interface RebuildWorkspaceResult {\r\n total_files_scanned: number\r\n total_classes_found: number\r\n unique_classes: number\r\n build_time_ms: number\r\n files_with_changes: number\r\n}\r\n\r\n/**\r\n * Process a single file change event\r\n * Called when a file is added, modified, or deleted\r\n *\r\n * @param fileChangeJson - JSON string describing the file change\r\n * @returns Processing result with class changes\r\n *\r\n * @example\r\n * ```ts\r\n * const change = processFileChange(JSON.stringify({\r\n * file_path: 'src/Button.tsx',\r\n * event_type: 'modified',\r\n * new_content: 'export const Button = ...',\r\n * timestamp_ms: Date.now()\r\n * }))\r\n *\r\n * console.log('Added classes:', change.added_classes)\r\n * console.log('Removed classes:', change.removed_classes)\r\n * ```\r\n */\r\nexport function processFileChange(fileChangeJson: string): ProcessedFileChange {\r\n const native = getNativeBridge()\r\n if (!native?.process_file_change) throw new Error(\"process_file_change not available\")\r\n const resultJson = native.process_file_change(fileChangeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n file_path: \"\",\r\n status: \"error\",\r\n old_classes: [],\r\n new_classes: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n changed: false,\r\n fingerprint: \"\",\r\n error: \"Failed to parse result\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Compute incremental diff between old and new scan results\r\n * Efficient way to identify only what changed\r\n *\r\n * @param oldScanJson - JSON string of previous scan result\r\n * @param newScanJson - JSON string of new scan result\r\n * @returns Diff showing what changed\r\n *\r\n * @example\r\n * ```ts\r\n * const oldResult = scanWorkspace('./src')\r\n * // ... files changed ...\r\n * const newResult = scanWorkspace('./src')\r\n *\r\n * const diff = computeIncrementalDiff(\r\n * JSON.stringify(oldResult),\r\n * JSON.stringify(newResult)\r\n * )\r\n *\r\n * if (diff.is_changed) {\r\n * console.log(`${diff.changes_count} files changed`)\r\n * console.log('Added:', diff.diff.added_classes)\r\n * console.log('Removed:', diff.diff.removed_classes)\r\n * }\r\n * ```\r\n */\r\nexport function computeIncrementalDiff(\r\n oldScanJson: string,\r\n newScanJson: string\r\n): IncrementalDiffResult {\r\n const native = getNativeBridge()\r\n if (!native?.compute_incremental_diff)\r\n throw new Error(\"compute_incremental_diff not available\")\r\n const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n is_changed: false,\r\n changes_count: 0,\r\n diff: {\r\n added_files: [],\r\n removed_files: [],\r\n modified_files: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n total_changes: 0,\r\n },\r\n processing_time_ms: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Create a fingerprint of a file for change detection\r\n * Use fingerprints to quickly check if file needs reprocessing\r\n *\r\n * @param filePath - Path to file\r\n * @param fileContent - File content\r\n * @returns File fingerprint\r\n *\r\n * @example\r\n * ```ts\r\n * const fingerprint = createFingerprint('src/Button.tsx', fileContent)\r\n * // Store fingerprint, check later if content changed\r\n * const newFingerprint = createFingerprint('src/Button.tsx', newContent)\r\n * if (fingerprint.signature !== newFingerprint.signature) {\r\n * // Content changed, needs reprocessing\r\n * }\r\n * ```\r\n */\r\nexport function createFingerprint(filePath: string, fileContent: string): FileFingerprint {\r\n const native = getNativeBridge()\r\n if (!native?.create_fingerprint) throw new Error(\"create_fingerprint not available\")\r\n const fingerprintJson = native.create_fingerprint(filePath, fileContent)\r\n try {\r\n return JSON.parse(fingerprintJson)\r\n } catch {\r\n return {\r\n file_path: filePath,\r\n content_hash: \"\",\r\n size_bytes: fileContent.length,\r\n mtime_ms: Date.now(),\r\n class_hash: \"\",\r\n signature: \"\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Inject state hash into compiled CSS\r\n * Marks CSS with version/state hash for cache busting\r\n *\r\n * @param css - Raw CSS string\r\n * @param stateHash - State hash to inject\r\n * @returns Modified CSS with injected state\r\n *\r\n * @example\r\n * ```ts\r\n * const css = compileCssNative2(['px-4', 'bg-blue-600'])\r\n * const withState = injectStateHash(css, 'v5-hash-123')\r\n * // CSS now includes version marker for cache control\r\n * ```\r\n */\r\nexport function injectStateHash(css: string, stateHash: string): StateInjectionResult {\r\n const native = getNativeBridge()\r\n if (!native?.inject_state_hash) throw new Error(\"inject_state_hash not available\")\r\n const resultJson = native.inject_state_hash(css, stateHash)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n injected: false,\r\n state_hash: stateHash,\r\n affected_files: 0,\r\n total_injected_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Prune stale entries from cache\r\n * Removes old/unused cache entries to free memory\r\n *\r\n * @param maxAgeSeconds - Remove entries older than this many seconds\r\n * @param maxEntries - Keep only this many most-recent entries\r\n * @returns Result of pruning operation\r\n *\r\n * @example\r\n * ```ts\r\n * // Remove cache entries older than 1 hour, keep max 10000 entries\r\n * const result = pruneStaleCacheEntries(3600, 10000)\r\n * console.log(`Freed ${result.freed_bytes / 1024}KB`)\r\n * ```\r\n */\r\nexport function pruneStaleCacheEntries(maxAgeSeconds: number, maxEntries: number): PruneResult {\r\n const native = getNativeBridge()\r\n if (!native?.prune_stale_entries) throw new Error(\"prune_stale_entries not available\")\r\n const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n entries_before: 0,\r\n entries_after: 0,\r\n entries_removed: 0,\r\n freed_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Rebuild workspace result from scratch\r\n * Useful after major configuration changes\r\n *\r\n * @param rootDir - Root directory to scan\r\n * @param extensions - File extensions to scan (e.g., [\".tsx\", \".ts\"])\r\n * @returns Rebuilt workspace result\r\n *\r\n * @example\r\n * ```ts\r\n * const result = rebuildWorkspaceResult('./src', ['.tsx', '.ts'])\r\n * console.log(`Found ${result.unique_classes} unique classes`)\r\n * console.log(`${result.files_with_changes} files had changes`)\r\n * ```\r\n */\r\nexport function rebuildWorkspaceResult(\r\n rootDir: string,\r\n extensions?: string[]\r\n): RebuildWorkspaceResult {\r\n const native = getNativeBridge()\r\n if (!native?.rebuild_workspace_result)\r\n throw new Error(\"rebuild_workspace_result not available\")\r\n const resultJson = native.rebuild_workspace_result(rootDir, extensions || [])\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n total_files_scanned: 0,\r\n total_classes_found: 0,\r\n unique_classes: 0,\r\n build_time_ms: 0,\r\n files_with_changes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scan a single file with incremental state\r\n * Returns only new/changed classes since last scan\r\n *\r\n * @param filePath - Path to file\r\n * @param fileContent - File content\r\n * @returns Updated classes and change status\r\n *\r\n * @example\r\n * ```ts\r\n * // On file change, get only what changed\r\n * const file = scanFileNative('src/Button.tsx', newContent)\r\n * if (file.changed) {\r\n * console.log('Added:', file.added_classes)\r\n * console.log('Removed:', file.removed_classes)\r\n * }\r\n * ```\r\n */\r\nexport function scanFileNative(\r\n filePath: string,\r\n fileContent: string\r\n): {\r\n file: string\r\n classes: string[]\r\n added_classes: string[]\r\n removed_classes: string[]\r\n changed: boolean\r\n} {\r\n const native = getNativeBridge()\r\n if (!native?.scan_file_native) throw new Error(\"scan_file_native not available\")\r\n const resultJson = native.scan_file_native(filePath, fileContent)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n file: filePath,\r\n classes: [],\r\n added_classes: [],\r\n removed_classes: [],\r\n changed: false,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Scan multiple files in batch with incremental state\r\n * Efficient batch processing of file changes\r\n *\r\n * @param filesJson - JSON array of {file, content} objects\r\n * @returns Results for each file\r\n *\r\n * @example\r\n * ```ts\r\n * const files = [\r\n * { file: 'src/Button.tsx', content: newButtonContent },\r\n * { file: 'src/Card.tsx', content: newCardContent }\r\n * ]\r\n * const results = scanFilesBatchNative(JSON.stringify(files))\r\n * ```\r\n */\r\nexport function scanFilesBatchNative(\r\n filesJson: string\r\n): Array<{\r\n file: string\r\n classes: string[]\r\n changed: boolean\r\n}> {\r\n const native = getNativeBridge()\r\n if (!native?.scan_files_batch_native)\r\n throw new Error(\"scan_files_batch_native not available\")\r\n const resultJson = native.scan_files_batch_native(filesJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n","/**\r\n * tailwindEngine.ts\r\n *\r\n * Pipeline: classes[] → Rust CSS Compiler (only path)\r\n *\r\n * The Rust compiler provides 40-60% performance improvement over pure JavaScript.\r\n * No JavaScript fallback - fail fast if native binding unavailable.\r\n */\r\n\r\nimport { createRequire } from \"node:module\"\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nimport { generateCssNative as generateCssNativeImpl } from \"./cssGeneratorNative\"\r\n\r\nconst require = createRequire(import.meta.url)\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache for CSS Pipeline (PHASE 0: Quick Win - 30-40% faster)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\ninterface CacheStats {\r\n hits: number\r\n misses: number\r\n hitRate: number\r\n size: number\r\n maxSize: number\r\n}\r\n\r\nconst _cssCache = new Map<string, CssPipelineResult>()\r\nlet _cacheHits = 0\r\nlet _cacheMisses = 0\r\nconst MAX_CACHE_SIZE = 100\r\nconst MAX_CACHE_MEMORY = 256 * 1024 // 256KB\r\n\r\nfunction _getCacheKey(classes: string[], minify: boolean, cssEntry?: string, root?: string): string {\r\n // Sort classes for consistent hashing\r\n const sorted = [...classes].sort().join(\",\")\r\n const flags = `${minify ? \"1\" : \"0\"}${cssEntry ? \"1\" : \"0\"}${root ? \"1\" : \"0\"}`\r\n return `${sorted}|${flags}`\r\n}\r\n\r\nfunction _evictOldestIfNeeded(): void {\r\n if (_cssCache.size >= MAX_CACHE_SIZE) {\r\n const firstKey = _cssCache.keys().next().value as string | undefined\r\n if (firstKey !== undefined) {\r\n _cssCache.delete(firstKey)\r\n }\r\n }\r\n}\r\n\r\nexport function getCacheStats(): CacheStats {\r\n const total = _cacheHits + _cacheMisses\r\n return {\r\n hits: _cacheHits,\r\n misses: _cacheMisses,\r\n hitRate: total > 0 ? _cacheHits / total : 0,\r\n size: _cssCache.size,\r\n maxSize: MAX_CACHE_SIZE,\r\n }\r\n}\r\n\r\nexport function clearCache(): void {\r\n _cssCache.clear()\r\n _cacheHits = 0\r\n _cacheMisses = 0\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Deprecated - Kept for reference only, not used\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// The JavaScript Tailwind engine path has been removed in favor of Rust-only\r\n// compilation. The code below is legacy and can be removed in future cleanup.\r\n\r\n// export async function generateRawCss(...) { /* removed */ }\r\n// export function loadTailwindEngine() { /* removed */ }\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Rust CSS Compiler (Primary Path)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Load theme configuration from the project.\r\n * For now, returns a minimal theme object.\r\n * In production, this should load from tailwind.config.ts/js\r\n */\r\nfunction getThemeConfig(): Record<string, unknown> {\r\n // TODO: Load from tailwind.config.ts/js\r\n // This is a simplified version - in production, parse the actual config\r\n return {\r\n colors: {\r\n slate: {\r\n \"50\": \"#f8fafc\",\r\n \"100\": \"#f1f5f9\",\r\n \"200\": \"#e2e8f0\",\r\n \"300\": \"#cbd5e1\",\r\n \"400\": \"#94a3b8\",\r\n \"500\": \"#64748b\",\r\n \"600\": \"#475569\",\r\n \"700\": \"#334155\",\r\n \"800\": \"#1e293b\",\r\n \"900\": \"#0f172a\",\r\n },\r\n gray: {\r\n \"50\": \"#f9fafb\",\r\n \"100\": \"#f3f4f6\",\r\n \"200\": \"#e5e7eb\",\r\n \"300\": \"#d1d5db\",\r\n \"400\": \"#9ca3af\",\r\n \"500\": \"#6b7280\",\r\n \"600\": \"#4b5563\",\r\n \"700\": \"#374151\",\r\n \"800\": \"#1f2937\",\r\n \"900\": \"#111827\",\r\n },\r\n white: \"#ffffff\",\r\n black: \"#000000\",\r\n red: {\r\n \"500\": \"#ef4444\",\r\n \"600\": \"#dc2626\",\r\n },\r\n blue: {\r\n \"500\": \"#3b82f6\",\r\n \"600\": \"#1e40af\",\r\n },\r\n },\r\n spacing: {\r\n \"0\": \"0px\",\r\n \"1\": \"0.25rem\",\r\n \"2\": \"0.5rem\",\r\n \"3\": \"0.75rem\",\r\n \"4\": \"1rem\",\r\n \"5\": \"1.25rem\",\r\n \"6\": \"1.5rem\",\r\n \"8\": \"2rem\",\r\n \"10\": \"2.5rem\",\r\n \"12\": \"3rem\",\r\n \"16\": \"4rem\",\r\n \"20\": \"5rem\",\r\n \"24\": \"6rem\",\r\n },\r\n breakpoints: {\r\n \"sm\": \"640px\",\r\n \"md\": \"768px\",\r\n \"lg\": \"1024px\",\r\n \"xl\": \"1280px\",\r\n \"2xl\": \"1536px\",\r\n },\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LightningCSS post-process via Rust\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nfunction postProcessWithLightning(rawCss: string): string {\r\n if (!rawCss) return \"\"\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) {\r\n throw new Error(\"FATAL: Native binding 'processTailwindCssLightning' is required but not available.\")\r\n }\r\n const result = native.processTailwindCssLightning(rawCss) as { css: string } | null\r\n if (!result?.css) {\r\n throw new Error(\"FATAL: processTailwindCssLightning returned null\")\r\n }\r\n return result.css\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Main pipeline\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface CssPipelineResult {\r\n css: string\r\n classes: string[]\r\n sizeBytes: number\r\n optimized: boolean\r\n}\r\n\r\nexport async function runCssPipeline(\r\n classes: string[],\r\n cssEntryContent?: string,\r\n root?: string,\r\n minify = true\r\n): Promise<CssPipelineResult> {\r\n // Deduplicate classes while preserving Array compatibility\r\n const filtered = classes.filter(Boolean)\r\n const uniqueMap = new Map<string, string>()\r\n filtered.forEach((cls) => uniqueMap.set(cls, cls))\r\n const unique = Array.from(uniqueMap.values())\r\n\r\n if (unique.length === 0) {\r\n return { css: \"\", classes: [], sizeBytes: 0, optimized: false }\r\n }\r\n\r\n // ✅ PHASE 0: Check cache first (30-40% faster for cache hits)\r\n const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root)\r\n const cached = _cssCache.get(cacheKey)\r\n if (cached) {\r\n _cacheHits++\r\n if (process.env.DEBUG?.includes(\"compiler\")) {\r\n console.log(\r\n `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`\r\n )\r\n }\r\n return cached\r\n }\r\n\r\n _cacheMisses++\r\n\r\n let rawCss: string\r\n let usedRustCompiler = false\r\n\r\n // Phase 1: Rust CSS Compiler (Only Path - no JS fallback)\r\n const theme = getThemeConfig()\r\n rawCss = await generateCssNativeImpl(unique, { theme })\r\n usedRustCompiler = true\r\n\r\n // Phase 2: Optional post-processing with LightningCSS (if minify=true)\r\n const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss\r\n\r\n if (process.env.DEBUG?.includes(\"compiler\")) {\r\n console.log(\r\n `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? \"Rust\" : \"JavaScript\"})`,\r\n `Size: ${finalCss.length} bytes`\r\n )\r\n }\r\n\r\n const result: CssPipelineResult = {\r\n css: finalCss,\r\n classes: unique,\r\n sizeBytes: finalCss.length,\r\n optimized: minify,\r\n }\r\n\r\n // Store in cache with eviction\r\n _evictOldestIfNeeded()\r\n _cssCache.set(cacheKey, result)\r\n\r\n return result\r\n}\r\n\r\n/**\r\n * @deprecated Tidak dipakai di Tailwind v4. Ditinggal untuk backward compatibility.\r\n */\r\nexport function runCssPipelineSync(_classes: string[]): CssPipelineResult {\r\n return { css: \"\", classes: [], sizeBytes: 0, optimized: false }\r\n}\r\n\r\n/**\r\n * Minify dan vendor-prefix CSS dengan explicit browser targets.\r\n */\r\nexport function processTailwindCssWithTargets(css: string, targets?: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssWithTargets) {\r\n throw new Error(\"FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.\")\r\n }\r\n const result = native.processTailwindCssWithTargets(css, targets ?? null) as { css: string } | null\r\n if (!result?.css) {\r\n throw new Error(\"FATAL: processTailwindCssWithTargets returned null\")\r\n }\r\n return result.css\r\n}\r\n","/**\r\n * Compiler Sub-entry Point\r\n * \r\n * Exports CSS generation and compilation functionality.\r\n * - CSS generation with caching\r\n * - Compilation of classes to CSS\r\n * - ID registry management\r\n * - Streaming and incremental processing\r\n */\r\n\r\nexport {\r\n generateCssNative,\r\n getCacheStats,\r\n clearThemeCache,\r\n} from './cssGeneratorNative'\r\n\r\nexport {\r\n compileCssNative2,\r\n compileCssLightning,\r\n extractTwStateConfigsNative,\r\n generateStaticStateCssNative,\r\n extractAndGenerateStateCssNative,\r\n layoutClassesToCss,\r\n hashContent,\r\n extractTwContainerConfigs,\r\n parseAtomicClass,\r\n generateAtomicCss,\r\n toAtomicClasses,\r\n clearAtomicRegistry,\r\n atomicRegistrySize,\r\n type ContainerConfig,\r\n type StateCssConfig,\r\n type GeneratedStateCss,\r\n} from './compilationNative'\r\n\r\nexport {\r\n compileClass,\r\n compileClasses,\r\n compileToCss,\r\n compileToCssBatch,\r\n minifyCss,\r\n compileAnimation,\r\n compileKeyframes,\r\n compileTheme,\r\n twMerge,\r\n twMergeMany,\r\n twMergeWithSeparator,\r\n twMergeManyWithSeparator,\r\n twMergeRaw,\r\n type CompiledCssRule,\r\n type CompiledAnimation,\r\n type CompiledTheme,\r\n type CssCompileResult,\r\n type TwMergeOptions,\r\n} from './cssCompilationNative'\r\n\r\nexport {\r\n idRegistryCreate,\r\n idRegistryGenerate,\r\n idRegistryLookup,\r\n idRegistryNext,\r\n idRegistryDestroy,\r\n idRegistryReset,\r\n idRegistrySnapshot,\r\n idRegistryActiveCount,\r\n registerPropertyName,\r\n registerValueName,\r\n propertyIdToString,\r\n valueIdToString,\r\n reverseLookupProperty,\r\n reverseLookupValue,\r\n idRegistryExport,\r\n idRegistryImport,\r\n type RegistrySnapshot,\r\n} from './idRegistryNative'\r\n\r\nexport {\r\n processFileChange,\r\n computeIncrementalDiff,\r\n createFingerprint,\r\n injectStateHash,\r\n pruneStaleCacheEntries,\r\n rebuildWorkspaceResult,\r\n scanFileNative,\r\n scanFilesBatchNative,\r\n type FileChangeEvent,\r\n type ProcessedFileChange,\r\n type FileDiff,\r\n type FileFingerprint,\r\n type IncrementalDiffResult,\r\n type StateInjectionResult,\r\n type PruneResult,\r\n type RebuildWorkspaceResult,\r\n} from './streamingNative'\r\n\r\nexport { runCssPipeline } from './tailwindEngine'\r\n","/**\r\n * Parser Sub-entry Point\r\n * \r\n * Exports class parsing and extraction functionality.\r\n * - Tailwind class parsing\r\n * - Class extraction from source\r\n * - Class normalization and deduplication\r\n * - Component analysis\r\n */\r\n\r\nimport { getNativeBridge } from '../nativeBridge'\r\n\r\n// ============================================================================\r\n// PARSING FUNCTIONS\r\n// ============================================================================\r\n\r\nexport const parseClasses = (raw: string): Array<{ raw: string; type: string }> => {\r\n const native = getNativeBridge()\r\n if (!native?.parseClasses) {\r\n throw new Error('FATAL: Native binding \\'parseClasses\\' is required but not available.')\r\n }\r\n return native.parseClasses(raw) || []\r\n}\r\n\r\n// ============================================================================\r\n// CLASS EXTRACTION\r\n// ============================================================================\r\n\r\nexport const extractAllClasses = (source: string): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.extractAllClasses) {\r\n throw new Error('FATAL: Native binding \\'extractAllClasses\\' is required but not available.')\r\n }\r\n return native.extractAllClasses(source) || []\r\n}\r\n\r\nexport const extractClassesFromSource = (source: string): string => {\r\n const native = getNativeBridge()\r\n if (!native?.extractClassesFromSource) {\r\n throw new Error('FATAL: Native binding \\'extractClassesFromSource\\' is required but not available.')\r\n }\r\n const result = native.extractClassesFromSource(source)\r\n return Array.isArray(result) ? result.join(' ') : String(result || '')\r\n}\r\n\r\nexport const astExtractClasses = (source: string, _filename: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.extractClassesFromSource) {\r\n throw new Error('FATAL: Native binding \\'extractClassesFromSource\\' is required but not available.')\r\n }\r\n return native.extractClassesFromSource(source) || []\r\n}\r\n\r\n// ============================================================================\r\n// CLASS NORMALIZATION & MERGING\r\n// ============================================================================\r\n\r\nexport const normalizeClasses = (raw: string): string => {\r\n const result = normalizeAndDedupClasses(raw)\r\n return result?.normalized || ''\r\n}\r\n\r\nexport const mergeClassesStatic = (classes: string): string => {\r\n const result = normalizeAndDedupClasses(classes)\r\n return result?.normalized || ''\r\n}\r\n\r\nexport const normalizeAndDedupClasses = (raw: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.normalizeAndDedupClasses) {\r\n throw new Error('FATAL: Native binding \\'normalizeAndDedupClasses\\' is required but not available.')\r\n }\r\n const result = native.normalizeAndDedupClasses(raw)\r\n return result || { normalized: '', duplicatesRemoved: 0, uniqueCount: 0 }\r\n}\r\n\r\n// ============================================================================\r\n// COMPONENT ANALYSIS\r\n// ============================================================================\r\n\r\nexport const extractComponentUsage = (source: string): Array<{ component: string; propsJson: string }> => {\r\n const native = getNativeBridge()\r\n if (!native?.extractComponentUsage) {\r\n throw new Error('FATAL: Native binding \\'extractComponentUsage\\' is required but not available.')\r\n }\r\n return native.extractComponentUsage(source) || []\r\n}\r\n\r\n// ============================================================================\r\n// BATCH OPERATIONS\r\n// ============================================================================\r\n\r\nexport const batchExtractClasses = (filePaths: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.batchExtractClasses) {\r\n throw new Error('FATAL: Native binding \\'batchExtractClasses\\' is required but not available.')\r\n }\r\n return native.batchExtractClasses(filePaths) || []\r\n}\r\n\r\nexport const checkAgainstSafelist = (classes: string[], safelist: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.checkAgainstSafelist) {\r\n throw new Error('FATAL: Native binding \\'checkAgainstSafelist\\' is required but not available.')\r\n }\r\n return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 }\r\n}\r\n\r\n// ============================================================================\r\n// DIFF & MERGING\r\n// ============================================================================\r\n\r\nexport const diffClassLists = (previous: string[], current: string[]) => {\r\n const native = getNativeBridge()\r\n if (!native?.diffClassLists) {\r\n throw new Error('FATAL: Native binding \\'diffClassLists\\' is required but not available.')\r\n }\r\n return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false }\r\n}\r\n\r\n// Re-export types if any\r\nexport type { ClassExtractResult, ComponentMetadata } from '../nativeBridge'\r\n","/**\r\n * analyzerNative.ts\r\n *\r\n * Native Rust bindings for CSS analysis and optimization.\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\nexport type {\r\n DeadCodeResult,\r\n ClassUsageItem,\r\n ContainerConfig,\r\n HoistResult,\r\n VariantTableResult,\r\n ClassifyResult,\r\n MergeResult,\r\n ProcessedCssResult,\r\n} from \"../nativeBridge\"\r\n\r\n/**\r\n * Detect dead CSS selectors in generated CSS.\r\n */\r\nexport function detectDeadCode(scanResultJson: string, css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.detectDeadCode) throw new Error(\"detectDeadCode not available\")\r\n return native.detectDeadCode(scanResultJson, css)\r\n}\r\n\r\n/**\r\n * Analyze class usage across scanned files.\r\n */\r\nexport function analyzeClassUsageNative(classes: string[], scanResultJson: string, css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClassUsage) throw new Error(\"analyzeClassUsage not available\")\r\n return native.analyzeClassUsage(classes, scanResultJson, css)\r\n}\r\n\r\n/**\r\n * Analyze entire class list and generate CSS.\r\n */\r\nexport function analyzeClassesNative(filesJson: string, cwd: string, flags?: number) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) throw new Error(\"analyzeClasses not available\")\r\n return native.analyzeClasses(filesJson, cwd, flags ?? 0)\r\n}\r\n\r\n/**\r\n * Analyze React Server Component requirements.\r\n */\r\nexport function analyzeRscNative(source: string, filename: string) {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeRsc) throw new Error(\"analyzeRsc not available\")\r\n return native.analyzeRsc(source, filename)\r\n}\r\n\r\n/**\r\n * Optimize CSS by removing dead code and minifying.\r\n */\r\nexport function optimizeCssNative(css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) throw new Error(\"processTailwindCssLightning not available\")\r\n const result = native.processTailwindCssLightning(css)\r\n return {\r\n css: result.css,\r\n originalSize: css.length,\r\n optimizedSize: result.size_bytes,\r\n reductionPercentage: ((css.length - result.size_bytes) / css.length) * 100,\r\n }\r\n}\r\n\r\n/**\r\n * Process Tailwind CSS with Lightning CSS post-processing.\r\n */\r\nexport function processTailwindCssLightning(css: string) {\r\n const native = getNativeBridge()\r\n if (!native?.processTailwindCssLightning) throw new Error(\"processTailwindCssLightning not available\")\r\n return native.processTailwindCssLightning(css)\r\n}\r\n\r\n/**\r\n * Eliminate dead CSS selectors.\r\n */\r\nexport function eliminateDeadCssNative(css: string, deadClasses: string[]): string {\r\n const native = getNativeBridge()\r\n if (!native?.eliminateDeadCss) throw new Error(\"eliminateDeadCss not available\")\r\n return native.eliminateDeadCss(css, deadClasses)\r\n}\r\n\r\n/**\r\n * Hoist components from source code.\r\n */\r\nexport function hoistComponentsNative(source: string) {\r\n const native = getNativeBridge()\r\n if (!native?.hoistComponents) throw new Error(\"hoistComponents not available\")\r\n return native.hoistComponents(source)\r\n}\r\n\r\n/**\r\n * Compile variant configuration table.\r\n */\r\nexport function compileVariantTableNative(configJson: string) {\r\n const native = getNativeBridge()\r\n if (!native?.compileVariantTable) throw new Error(\"compileVariantTable not available\")\r\n return native.compileVariantTable(configJson)\r\n}\r\n\r\n/**\r\n * Classify and sort classes by bucket.\r\n */\r\nexport function classifyAndSortClassesNative(classes: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) throw new Error(\"classifyAndSortClasses not available\")\r\n return native.classifyAndSortClasses(classes)\r\n}\r\n\r\n/**\r\n * Merge CSS declarations from multiple chunks.\r\n */\r\nexport function mergeCssDeclarationsNative(cssChunks: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.mergeCssDeclarations) throw new Error(\"mergeCssDeclarations not available\")\r\n return native.mergeCssDeclarations(cssChunks)\r\n}\r\n","/**\r\n * themeResolutionNative.ts\r\n *\r\n * Phase 5.1: Theme Resolution Extended - Advanced theme configuration handling\r\n * Exposes 7 theme resolution functions for complex Tailwind configurations\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Validation result for theme config\r\n */\r\nexport interface ThemeValidationResult {\r\n is_valid: boolean\r\n errors: string[]\r\n warnings: string[]\r\n suggestions: string[]\r\n}\r\n\r\n/**\r\n * Resolved variant configuration\r\n */\r\nexport interface ResolvedVariantConfig {\r\n variants: string[]\r\n supported: string[]\r\n deprecated: string[]\r\n conflicting: string[]\r\n}\r\n\r\n/**\r\n * Theme cascade resolution result\r\n */\r\nexport interface ThemeCascadeResult {\r\n base_theme: Record<string, unknown>\r\n user_overrides: Record<string, unknown>\r\n merged_theme: Record<string, unknown>\r\n conflict_resolutions: Array<{\r\n key: string\r\n base_value: unknown\r\n override_value: unknown\r\n resolution: \"override\" | \"merge\" | \"error\"\r\n }>\r\n}\r\n\r\n/**\r\n * Class name resolution from theme\r\n */\r\nexport interface ResolvedClassName {\r\n class_name: string\r\n property: string\r\n value: string\r\n from_theme_path: string\r\n is_responsive: boolean\r\n variants: string[]\r\n}\r\n\r\n/**\r\n * Conflict group information\r\n */\r\nexport interface ConflictGroupInfo {\r\n group_name: string\r\n conflicting_classes: string[]\r\n description: string\r\n resolution_strategy: string\r\n}\r\n\r\n/**\r\n * Get all resolved variants from theme configuration\r\n * Parses theme config and returns all variant prefixes\r\n *\r\n * @param configJson - JSON string of theme configuration\r\n * @returns Resolved variants with metadata\r\n *\r\n * @example\r\n * ```ts\r\n * const config = {\r\n * screens: { md: '768px', lg: '1024px' },\r\n * state: { hover: '&:hover', focus: '&:focus' }\r\n * }\r\n * const variants = resolveVariants(JSON.stringify(config))\r\n * console.log(variants.variants) // ['md', 'lg', 'hover', 'focus', ...]\r\n * ```\r\n */\r\nexport function resolveVariants(configJson: string): ResolvedVariantConfig {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_variants) throw new Error(\"resolve_variants not available\")\r\n const resultJson = native.resolve_variants(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n variants: [],\r\n supported: [],\r\n deprecated: [],\r\n conflicting: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Validate theme configuration for correctness\r\n * Checks for common issues and provides warnings\r\n *\r\n * @param configJson - JSON string of theme configuration\r\n * @returns Validation result with errors and suggestions\r\n *\r\n * @example\r\n * ```ts\r\n * const result = validateThemeConfig(JSON.stringify(myTheme))\r\n * if (!result.is_valid) {\r\n * console.error('Errors:', result.errors)\r\n * console.warn('Warnings:', result.warnings)\r\n * }\r\n * ```\r\n */\r\nexport function validateThemeConfig(configJson: string): ThemeValidationResult {\r\n const native = getNativeBridge()\r\n if (!native?.validate_variant_config) throw new Error(\"validate_variant_config not available\")\r\n const resultJson = native.validate_variant_config(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n is_valid: false,\r\n errors: [\"Unable to parse configuration\"],\r\n warnings: [],\r\n suggestions: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve theme cascade (base + overrides)\r\n * Merges base theme with user overrides intelligently\r\n *\r\n * @param baseThemeJson - Base theme configuration\r\n * @param overridesJson - User overrides configuration\r\n * @returns Merged theme with conflict information\r\n *\r\n * @example\r\n * ```ts\r\n * const cascade = resolveCascade(\r\n * JSON.stringify(baseTheme),\r\n * JSON.stringify(userOverrides)\r\n * )\r\n * console.log(cascade.merged_theme)\r\n * console.log('Conflicts resolved:', cascade.conflict_resolutions.length)\r\n * ```\r\n */\r\nexport function resolveCascade(\r\n baseThemeJson: string,\r\n overridesJson: string\r\n): ThemeCascadeResult {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_cascade) throw new Error(\"resolve_cascade not available\")\r\n const resultJson = native.resolve_cascade(baseThemeJson, overridesJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n base_theme: {},\r\n user_overrides: {},\r\n merged_theme: {},\r\n conflict_resolutions: [],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve class names from theme\r\n * Maps Tailwind class names to theme values\r\n *\r\n * @param classNames - Array of Tailwind class names (e.g., [\"text-lg\", \"bg-blue-600\"])\r\n * @param themeJson - Theme configuration\r\n * @returns Resolved class name information\r\n *\r\n * @example\r\n * ```ts\r\n * const resolved = resolveClassNames(\r\n * ['text-lg', 'bg-blue-600', 'md:p-4'],\r\n * JSON.stringify(theme)\r\n * )\r\n * resolved.forEach(item => {\r\n * console.log(`${item.class_name} -> ${item.property}: ${item.value}`)\r\n * })\r\n * ```\r\n */\r\nexport function resolveClassNames(\r\n classNames: string[],\r\n themeJson: string\r\n): ResolvedClassName[] {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_class_names) throw new Error(\"resolve_class_names not available\")\r\n const resultJson = native.resolve_class_names(classNames, themeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Get conflict group information\r\n * Identifies classes that conflict with each other\r\n *\r\n * @param groupName - Conflict group name (e.g., \"display\", \"position\", \"flex-direction\")\r\n * @param themeJson - Theme configuration\r\n * @returns Information about the conflict group\r\n *\r\n * @example\r\n * ```ts\r\n * const info = resolveConflictGroup('display', JSON.stringify(theme))\r\n * console.log('Conflicting classes:', info.conflicting_classes)\r\n * console.log('Strategy:', info.resolution_strategy)\r\n * ```\r\n */\r\nexport function resolveConflictGroup(groupName: string, themeJson: string): ConflictGroupInfo {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_conflict_group)\r\n throw new Error(\"resolve_conflict_group not available\")\r\n const resultJson = native.resolve_conflict_group(groupName, themeJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return {\r\n group_name: groupName,\r\n conflicting_classes: [],\r\n description: \"\",\r\n resolution_strategy: \"last-wins\",\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Resolve theme value from key path\r\n * Navigates nested theme config to find values\r\n *\r\n * @param keyPath - Dot-separated path (e.g., \"colors.blue.600\")\r\n * @param themeJson - Theme configuration\r\n * @returns Resolved value or null if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const color = resolveThemeValue('colors.blue.600', JSON.stringify(theme))\r\n * console.log(color) // \"#2563eb\" or similar\r\n * ```\r\n */\r\nexport function resolveThemeValue(keyPath: string, themeJson: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_theme_value) throw new Error(\"resolve_theme_value not available\")\r\n return native.resolve_theme_value(keyPath, themeJson)\r\n}\r\n\r\n/**\r\n * Get all simple variants from configuration\r\n * Returns variants that don't require complex selector nesting\r\n *\r\n * @param configJson - Theme/variant configuration\r\n * @returns Array of simple variant names\r\n *\r\n * @example\r\n * ```ts\r\n * const simpleVariants = resolveSimpleVariants(JSON.stringify(config))\r\n * console.log(simpleVariants)\r\n * // [\"hover\", \"focus\", \"active\", \"group-hover\", ...]\r\n * ```\r\n */\r\nexport function resolveSimpleVariants(configJson: string): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.resolve_simple_variants) throw new Error(\"resolve_simple_variants not available\")\r\n const resultJson = native.resolve_simple_variants(configJson)\r\n try {\r\n return JSON.parse(resultJson)\r\n } catch {\r\n return []\r\n }\r\n}\r\n","/**\r\n * scannerNative.ts - Rust bindings for workspace scanning and class extraction\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\nexport type {\r\n ScanWorkspaceResult,\r\n ScanFileResult,\r\n BatchExtractResult,\r\n SafelistCheckResult,\r\n PrefilterFileResult,\r\n} from \"../nativeBridge\"\r\n\r\nexport function scanWorkspace(root: string, extensions?: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.scan_workspace) throw new Error(\"scan_workspace not available\")\r\n return native.scan_workspace(root, extensions)\r\n}\r\n\r\nexport function extractClassesFromSourceNative(source: string): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.extract_classes_from_source) throw new Error(\"extract_classes_from_source not available\")\r\n return native.extract_classes_from_source(source)\r\n}\r\n\r\nexport function batchExtractClassesNative(filePaths: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.batch_extract_classes) throw new Error(\"batch_extract_classes not available\")\r\n return native.batch_extract_classes(filePaths)\r\n}\r\n\r\nexport function checkAgainstSafelistNative(classes: string[], safelist: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.check_against_safelist) throw new Error(\"check_against_safelist not available\")\r\n return native.check_against_safelist(classes, safelist)\r\n}\r\n\r\nexport function scanFile(filePath: string) {\r\n const native = getNativeBridge()\r\n if (!native?.scan_file) throw new Error(\"scan_file not available\")\r\n return native.scan_file(filePath)\r\n}\r\n\r\nexport function collectFiles(root: string, extensions?: string[]) {\r\n const native = getNativeBridge()\r\n if (!native?.collect_files) throw new Error(\"collect_files not available\")\r\n return native.collect_files(root, extensions)\r\n}\r\n\r\nexport function walkAndPrefilterSourceFiles(root: string, extensions?: string[], _parallel?: boolean) {\r\n const native = getNativeBridge()\r\n if (!native?.walk_and_prefilter_source_files) throw new Error(\"walk_and_prefilter_source_files not available\")\r\n return native.walk_and_prefilter_source_files(root, extensions)\r\n}\r\n\r\nexport function generateSubComponentTypes(root: string, outputPath?: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.generate_sub_component_types) throw new Error(\"generate_sub_component_types not available\")\r\n return native.generate_sub_component_types(root, outputPath)\r\n}\r\n","/**\r\n * Analyzer Sub-entry Point\r\n * \r\n * Exports analysis and optimization functionality.\r\n * - CSS and class analysis\r\n * - Dead code detection\r\n * - Theme resolution and validation\r\n * - Code classification and optimization\r\n */\r\n\r\nexport {\r\n detectDeadCode,\r\n analyzeClassUsageNative,\r\n analyzeClassesNative,\r\n analyzeRscNative,\r\n optimizeCssNative,\r\n processTailwindCssLightning,\r\n eliminateDeadCssNative,\r\n hoistComponentsNative,\r\n compileVariantTableNative,\r\n classifyAndSortClassesNative,\r\n mergeCssDeclarationsNative,\r\n type DeadCodeResult,\r\n type ClassUsageItem,\r\n type ProcessedCssResult,\r\n type HoistResult,\r\n type VariantTableResult,\r\n type ClassifyResult,\r\n type MergeResult,\r\n} from './analyzerNative'\r\n\r\nexport {\r\n resolveVariants,\r\n validateThemeConfig,\r\n resolveCascade,\r\n resolveClassNames,\r\n resolveConflictGroup,\r\n resolveThemeValue,\r\n resolveSimpleVariants,\r\n type ThemeValidationResult,\r\n type ResolvedVariantConfig,\r\n type ThemeCascadeResult,\r\n type ResolvedClassName,\r\n type ConflictGroupInfo,\r\n} from './themeResolutionNative'\r\n\r\nexport {\r\n scanWorkspace,\r\n extractClassesFromSourceNative,\r\n batchExtractClassesNative,\r\n checkAgainstSafelistNative,\r\n scanFile,\r\n collectFiles,\r\n walkAndPrefilterSourceFiles,\r\n generateSubComponentTypes,\r\n type ScanWorkspaceResult,\r\n type ScanFileResult,\r\n type BatchExtractResult,\r\n type SafelistCheckResult,\r\n type PrefilterFileResult,\r\n} from './scannerNative'\r\n","/**\r\n * cacheNative.ts\r\n *\r\n * Phase 5.1: Cache Management - Advanced caching strategies and optimization\r\n * Exposes 9 cache-related Rust functions for improved performance tuning\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Cache optimization hints and recommendations\r\n */\r\nexport interface CacheOptimizationHints {\r\n current_strategy: string\r\n recommended_strategy: string\r\n estimated_improvement_percent: number\r\n suggested_memory_mb: number\r\n notes: string[]\r\n}\r\n\r\n/**\r\n * Optimal cache configuration recommendations\r\n */\r\nexport interface OptimalCacheConfig {\r\n parse_cache_size: number\r\n resolve_cache_size: number\r\n compile_cache_size: number\r\n css_gen_cache_size: number\r\n recommended_eviction_policy: string\r\n ttl_seconds: number\r\n expected_hit_rate_percent: number\r\n}\r\n\r\n/**\r\n * Cache statistics from all layers\r\n */\r\nexport interface CacheStatistics {\r\n parse_cache: { hits: number; misses: number; size: number }\r\n resolve_cache: { hits: number; misses: number; size: number }\r\n compile_cache: { hits: number; misses: number; size: number }\r\n css_gen_cache: { hits: number; misses: number; size: number }\r\n overall_hit_rate: number\r\n total_memory_bytes: number\r\n}\r\n\r\n/**\r\n * Get comprehensive cache statistics across all layers\r\n * Useful for monitoring and optimization\r\n *\r\n * @returns Cache stats including hit rates, sizes, and recommendations\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * console.log(`Overall hit rate: ${stats.overall_hit_rate}%`)\r\n * console.log(`Total memory used: ${stats.total_memory_bytes / 1024}KB`)\r\n * ```\r\n */\r\nexport function getCacheStatistics(): CacheStatistics {\r\n const native = getNativeBridge()\r\n if (!native?.get_cache_statistics) throw new Error(\"get_cache_statistics not available\")\r\n const statsJson = native.get_cache_statistics()\r\n try {\r\n return JSON.parse(statsJson)\r\n } catch {\r\n return {\r\n parse_cache: { hits: 0, misses: 0, size: 0 },\r\n resolve_cache: { hits: 0, misses: 0, size: 0 },\r\n compile_cache: { hits: 0, misses: 0, size: 0 },\r\n css_gen_cache: { hits: 0, misses: 0, size: 0 },\r\n overall_hit_rate: 0,\r\n total_memory_bytes: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Clear all caches (parse, resolve, compile, CSS generation)\r\n * Use when switching themes or major configuration changes\r\n *\r\n * @example\r\n * ```ts\r\n * // Clear before switching themes\r\n * clearAllCaches()\r\n * const css = await generateCssNative(classes, { theme: newTheme })\r\n * ```\r\n */\r\nexport function clearAllCaches(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_all_caches) return\r\n try {\r\n native.clear_all_caches()\r\n } catch {\r\n // Silently ignore if not available\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the parse cache\r\n * Useful when parser behavior changes or cache gets stale\r\n */\r\nexport function clearParseCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_parse_cache) return\r\n try {\r\n native.clear_parse_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the resolve cache\r\n * Use when theme configuration changes\r\n */\r\nexport function clearResolveCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_resolve_cache) return\r\n try {\r\n native.clear_resolve_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the compile cache\r\n * Use when Tailwind configuration changes\r\n */\r\nexport function clearCompileCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_compile_cache) return\r\n try {\r\n native.clear_compile_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Clear only the CSS generation cache\r\n * Use when theme or layout changes\r\n */\r\nexport function clearCssGenCache(): void {\r\n const native = getNativeBridge()\r\n if (!native?.clear_css_gen_cache) return\r\n try {\r\n native.clear_css_gen_cache()\r\n } catch {\r\n // Silently ignore\r\n }\r\n}\r\n\r\n/**\r\n * Get optimization hints based on current cache performance\r\n * Analyzes hit rates and suggests improvements\r\n *\r\n * @param hitRatePercent - Current hit rate (0-100)\r\n * @param memoryUsedMb - Memory currently used in MB\r\n * @returns Optimization recommendations\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * const hints = getCacheOptimizationHints(\r\n * stats.overall_hit_rate,\r\n * stats.total_memory_bytes / (1024 * 1024)\r\n * )\r\n * console.log(`Recommendation: ${hints.recommended_strategy}`)\r\n * console.log(`Potential improvement: ${hints.estimated_improvement_percent}%`)\r\n * ```\r\n */\r\nexport function getCacheOptimizationHints(\r\n hitRatePercent: number,\r\n memoryUsedMb: number\r\n): CacheOptimizationHints {\r\n const native = getNativeBridge()\r\n if (!native?.get_cache_optimization_hints)\r\n throw new Error(\"get_cache_optimization_hints not available\")\r\n const hintsJson = native.get_cache_optimization_hints(\r\n Math.min(100, Math.max(0, hitRatePercent)),\r\n Math.max(1, memoryUsedMb)\r\n )\r\n try {\r\n return JSON.parse(hintsJson)\r\n } catch {\r\n return {\r\n current_strategy: \"unknown\",\r\n recommended_strategy: \"increase_size\",\r\n estimated_improvement_percent: 0,\r\n suggested_memory_mb: 256,\r\n notes: [\"Unable to analyze cache statistics\"],\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Estimate optimal cache configuration for your workload\r\n * Analyzes typical patterns and recommends sizes\r\n *\r\n * @param totalBudgetMb - Maximum memory budget in MB\r\n * @param workloadType - \"small\" (< 100 files), \"medium\" (100-1000), \"large\" (1000+)\r\n * @returns Recommended cache configuration\r\n *\r\n * @example\r\n * ```ts\r\n * const config = estimateOptimalCacheConfig(512, 'large')\r\n * console.log(`Parse cache: ${config.parse_cache_size}MB`)\r\n * console.log(`Expected hit rate: ${config.expected_hit_rate_percent}%`)\r\n * ```\r\n */\r\nexport function estimateOptimalCacheConfig(\r\n totalBudgetMb: number,\r\n workloadType: \"small\" | \"medium\" | \"large\"\r\n): OptimalCacheConfig {\r\n const native = getNativeBridge()\r\n if (!native?.estimate_optimal_cache_config_native)\r\n throw new Error(\"estimate_optimal_cache_config_native not available\")\r\n const configJson = native.estimate_optimal_cache_config_native(\r\n Math.max(64, totalBudgetMb),\r\n workloadType\r\n )\r\n try {\r\n return JSON.parse(configJson)\r\n } catch {\r\n // Return sensible defaults\r\n return {\r\n parse_cache_size: 128,\r\n resolve_cache_size: 64,\r\n compile_cache_size: 256,\r\n css_gen_cache_size: 128,\r\n recommended_eviction_policy: \"lru\",\r\n ttl_seconds: 3600,\r\n expected_hit_rate_percent: 75,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Read cache from disk (persistence)\r\n * Restores cached data from previous sessions\r\n *\r\n * @param cachePath - Path to cache file\r\n * @returns Entries loaded from disk\r\n *\r\n * @example\r\n * ```ts\r\n * const entries = cacheRead('./.tw-cache/scan.json')\r\n * // Warm up cache with persisted data\r\n * ```\r\n */\r\nexport function cacheRead(cachePath: string): Array<{\r\n file: string\r\n contentHash: string\r\n classes: string[]\r\n mtimeMs: number\r\n sizeBytes: number\r\n}> {\r\n const native = getNativeBridge()\r\n if (!native?.cache_read) throw new Error(\"cache_read not available\")\r\n const result = native.cache_read(cachePath)\r\n try {\r\n return JSON.parse(result.entries_json || \"[]\")\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Write cache to disk (persistence)\r\n * Saves cached data for next session\r\n *\r\n * @param cachePath - Path where cache should be written\r\n * @param entries - Cache entries to persist\r\n * @returns Success status\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getCacheStatistics()\r\n * const success = cacheWrite(\r\n * './.tw-cache/scan.json',\r\n * // entries array from previous scan\r\n * )\r\n * ```\r\n */\r\nexport function cacheWrite(\r\n cachePath: string,\r\n entries: Array<{\r\n file: string\r\n contentHash: string\r\n classes: string[]\r\n mtimeMs: number\r\n sizeBytes: number\r\n }>\r\n): boolean {\r\n const native = getNativeBridge()\r\n if (!native?.cache_write) throw new Error(\"cache_write not available\")\r\n try {\r\n const result = native.cache_write(\r\n cachePath,\r\n entries.map((e) => ({\r\n file: e.file,\r\n content_hash: e.contentHash,\r\n classes: e.classes,\r\n mtime_ms: e.mtimeMs,\r\n size_bytes: e.sizeBytes,\r\n }))\r\n )\r\n return typeof result === \"boolean\" ? result : result === true\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\n/**\r\n * Calculate cache priority score for file ordering\r\n * Useful for prioritizing which files to scan first\r\n *\r\n * @param mtimeMs - File modification time in milliseconds\r\n * @param sizeBytes - File size in bytes\r\n * @param hitCount - Number of times this file was accessed from cache\r\n * @returns Priority score (higher = process first)\r\n *\r\n * @example\r\n * ```ts\r\n * const priority = cachePriority(Date.now(), 2048, 5)\r\n * // Use priority to sort files for scanning\r\n * ```\r\n */\r\nexport function cachePriority(mtimeMs: number, sizeBytes: number, hitCount: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.cache_priority) throw new Error(\"cache_priority not available\")\r\n return native.cache_priority(mtimeMs, sizeBytes, hitCount)\r\n}\r\n","/**\r\n * Cache Sub-entry Point\r\n * \r\n * Exports cache management functionality.\r\n * - Cache statistics retrieval\r\n * - Cache clearing operations\r\n * - Cache optimization\r\n * - Cache configuration\r\n */\r\n\r\nexport {\r\n getCacheStatistics,\r\n clearAllCaches,\r\n clearParseCache,\r\n clearResolveCache,\r\n clearCompileCache,\r\n clearCssGenCache,\r\n getCacheOptimizationHints,\r\n estimateOptimalCacheConfig,\r\n cacheRead,\r\n cacheWrite,\r\n cachePriority,\r\n type CacheOptimizationHints,\r\n type OptimalCacheConfig,\r\n type CacheStatistics,\r\n} from './cacheNative'\r\n","/**\r\n * redisNative.ts\r\n *\r\n * Phase 5.3: Redis Integration - Distributed caching and cluster support\r\n * Exposes 40 Redis functions for high-performance distributed CSS compilation caching\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * Redis pool configuration\r\n */\r\nexport interface RedisCacheConfig {\r\n host: string\r\n port: number\r\n database: number\r\n password?: string\r\n pool_size: number\r\n connection_timeout_ms: number\r\n}\r\n\r\n/**\r\n * Redis pool statistics\r\n */\r\nexport interface RedisPoolStats {\r\n connected_count: number\r\n idle_count: number\r\n waiting_count: number\r\n total_requests: number\r\n total_errors: number\r\n}\r\n\r\n/**\r\n * Redis cluster node information\r\n */\r\nexport interface RedisClusterNode {\r\n node_id: string\r\n host: string\r\n port: number\r\n is_master: boolean\r\n slot_range: Array<{ start: number; end: number }>\r\n connected: boolean\r\n}\r\n\r\n/**\r\n * Redis cluster status\r\n */\r\nexport interface RedisClusterStatus {\r\n enabled: boolean\r\n cluster_state: string\r\n nodes: RedisClusterNode[]\r\n slots_assigned: number\r\n slots_ok: number\r\n slots_fail: number\r\n}\r\n\r\n/**\r\n * Key expiration information\r\n */\r\nexport interface KeyExpiration {\r\n key: string\r\n ttl_seconds: number\r\n expiration_timestamp: number\r\n is_persistent: boolean\r\n}\r\n\r\n/**\r\n * Pub/Sub message\r\n */\r\nexport interface PubSubMessage {\r\n channel: string\r\n message: string\r\n timestamp_ms: number\r\n subscriber_count: number\r\n}\r\n\r\n/**\r\n * Connection pool information\r\n */\r\nexport interface PoolInfo {\r\n host: string\r\n port: number\r\n pool_size: number\r\n active_connections: number\r\n idle_connections: number\r\n average_latency_ms: number\r\n}\r\n\r\n/**\r\n * Ping Redis server for connectivity check\r\n *\r\n * @returns \"PONG\" if connected, error message otherwise\r\n *\r\n * @example\r\n * ```ts\r\n * const response = redisPing()\r\n * if (response === \"PONG\") console.log(\"Connected\")\r\n * ```\r\n */\r\nexport function redisPing(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_ping) throw new Error(\"redis_ping not available\")\r\n return native.redis_ping()\r\n}\r\n\r\n/**\r\n * Get value from Redis\r\n *\r\n * @param key - Cache key\r\n * @returns Value if found, null if not found\r\n *\r\n * @example\r\n * ```ts\r\n * const value = redisGet('compiled:bg-blue-600')\r\n * if (value) console.log(JSON.parse(value))\r\n * ```\r\n */\r\nexport function redisGet(key: string): string | null {\r\n const native = getNativeBridge()\r\n if (!native?.redis_get) throw new Error(\"redis_get not available\")\r\n const result = native.redis_get(key)\r\n return result === \"nil\" ? null : result\r\n}\r\n\r\n/**\r\n * Set value in Redis\r\n *\r\n * @param key - Cache key\r\n * @param value - Value to store\r\n * @param ttl_seconds - Time to live in seconds (optional)\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSet('compiled:bg-blue-600', JSON.stringify(css), 3600)\r\n * ```\r\n */\r\nexport function redisSet(key: string, value: string, ttl_seconds?: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_set) throw new Error(\"redis_set not available\")\r\n return native.redis_set(key, value, ttl_seconds)\r\n}\r\n\r\n/**\r\n * Delete key from Redis\r\n *\r\n * @param key - Cache key\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const deleted = redisDelete('compiled:bg-blue-600')\r\n * console.log(`Deleted ${deleted} keys`)\r\n * ```\r\n */\r\nexport function redisDelete(key: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_delete) throw new Error(\"redis_delete not available\")\r\n return native.redis_delete(key)\r\n}\r\n\r\n/**\r\n * Check if key exists in Redis\r\n *\r\n * @param key - Cache key\r\n * @returns 1 if exists, 0 if not\r\n *\r\n * @example\r\n * ```ts\r\n * if (redisExists('compiled:bg-blue-600')) {\r\n * console.log('Cache hit')\r\n * }\r\n * ```\r\n */\r\nexport function redisExists(key: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_exists) throw new Error(\"redis_exists not available\")\r\n return native.redis_exists(key)\r\n}\r\n\r\n/**\r\n * Get multiple values from Redis (atomic operation)\r\n *\r\n * @param keys - Array of cache keys\r\n * @returns Array of values (null for missing keys)\r\n *\r\n * @example\r\n * ```ts\r\n * const values = redisMget(['key1', 'key2', 'key3'])\r\n * ```\r\n */\r\nexport function redisMget(keys: string[]): Array<string | null> {\r\n const native = getNativeBridge()\r\n if (!native?.redis_mget) throw new Error(\"redis_mget not available\")\r\n const result = native.redis_mget(keys)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return keys.map(() => null)\r\n }\r\n}\r\n\r\n/**\r\n * Set multiple key-value pairs in Redis (atomic operation)\r\n *\r\n * @param pairs - Array of [key, value] tuples\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisMset([\r\n * ['key1', 'value1'],\r\n * ['key2', 'value2']\r\n * ])\r\n * ```\r\n */\r\nexport function redisMset(pairs: Array<[string, string]>): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_mset) throw new Error(\"redis_mset not available\")\r\n return native.redis_mset(pairs)\r\n}\r\n\r\n/**\r\n * Flush all keys from current Redis database\r\n *\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const flushed = redisFlushDb()\r\n * console.log(`Flushed ${flushed} keys from database`)\r\n * ```\r\n */\r\nexport function redisFlushDb(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_flush_db) throw new Error(\"redis_flush_db not available\")\r\n return native.redis_flush_db()\r\n}\r\n\r\n/**\r\n * Flush all keys from all Redis databases (cluster-wide)\r\n *\r\n * @returns Number of keys deleted\r\n *\r\n * @example\r\n * ```ts\r\n * const flushed = redisFlushAll()\r\n * console.log(`Flushed ${flushed} keys from all databases`)\r\n * ```\r\n */\r\nexport function redisFlushAll(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_flush_all) throw new Error(\"redis_flush_all not available\")\r\n return native.redis_flush_all()\r\n}\r\n\r\n/**\r\n * Initialize Redis connection pool\r\n *\r\n * @param host - Redis host (e.g., \"localhost\")\r\n * @param port - Redis port (default: 6379)\r\n * @param pool_size - Connection pool size (default: 32)\r\n * @returns Pool info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisPoolConnect('localhost', 6379, 32)\r\n * console.log(info)\r\n * ```\r\n */\r\nexport function redisPoolConnect(host: string, port: number, pool_size?: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_connect) throw new Error(\"redis_pool_connect not available\")\r\n return native.redis_pool_connect(host, port, pool_size)\r\n}\r\n\r\n/**\r\n * Get Redis pool statistics\r\n *\r\n * @returns Pool stats as JSON string\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = redisPoolStats()\r\n * const parsed: RedisPoolStats = JSON.parse(stats)\r\n * console.log(`Connected: ${parsed.connected_count}`)\r\n * ```\r\n */\r\nexport function redisPoolStats(): RedisPoolStats {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_stats) throw new Error(\"redis_pool_stats not available\")\r\n const result = native.redis_pool_stats()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n connected_count: 0,\r\n idle_count: 0,\r\n waiting_count: 0,\r\n total_requests: 0,\r\n total_errors: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Reconnect Redis pool after disconnect\r\n *\r\n * @returns \"OK\" if reconnected\r\n *\r\n * @example\r\n * ```ts\r\n * const result = redisPoolReconnect()\r\n * console.log(result)\r\n * ```\r\n */\r\nexport function redisPoolReconnect(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_pool_reconnect) throw new Error(\"redis_pool_reconnect not available\")\r\n return native.redis_pool_reconnect()\r\n}\r\n\r\n/**\r\n * Enable Redis cluster mode\r\n *\r\n * @param initial_nodes - Initial cluster nodes (host:port format)\r\n * @returns Cluster status JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisEnableCluster(['localhost:6379', 'localhost:6380'])\r\n * ```\r\n */\r\nexport function redisEnableCluster(initial_nodes: string[]): RedisClusterStatus {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_cluster) throw new Error(\"redis_enable_cluster not available\")\r\n const result = native.redis_enable_cluster(initial_nodes)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n enabled: false,\r\n cluster_state: \"error\",\r\n nodes: [],\r\n slots_assigned: 0,\r\n slots_ok: 0,\r\n slots_fail: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Disable Redis cluster mode\r\n *\r\n * @returns \"OK\" when disabled\r\n *\r\n * @example\r\n * ```ts\r\n * const result = redisDisableCluster()\r\n * ```\r\n */\r\nexport function redisDisableCluster(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_cluster) throw new Error(\"redis_disable_cluster not available\")\r\n return native.redis_disable_cluster()\r\n}\r\n\r\n/**\r\n * Get current Redis cluster status\r\n *\r\n * @returns Cluster status information\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisClusterStatus()\r\n * if (status.enabled) console.log(`Cluster has ${status.nodes.length} nodes`)\r\n * ```\r\n */\r\nexport function redisClusterStatus(): RedisClusterStatus {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cluster_status) throw new Error(\"redis_cluster_status not available\")\r\n const result = native.redis_cluster_status()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n enabled: false,\r\n cluster_state: \"unknown\",\r\n nodes: [],\r\n slots_assigned: 0,\r\n slots_ok: 0,\r\n slots_fail: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Subscribe to Redis pub/sub channel\r\n *\r\n * @param channel - Channel name\r\n * @param callback - Function to call on message (optional)\r\n * @returns Subscription ID\r\n *\r\n * @example\r\n * ```ts\r\n * const id = redisSubscribe('cache:updates', (msg) => {\r\n * console.log(`Update: ${msg.message}`)\r\n * })\r\n * ```\r\n */\r\nexport function redisSubscribe(channel: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_subscribe) throw new Error(\"redis_subscribe not available\")\r\n return native.redis_subscribe(channel)\r\n}\r\n\r\n/**\r\n * Publish message to Redis pub/sub channel\r\n *\r\n * @param channel - Channel name\r\n * @param message - Message to publish\r\n * @returns Number of subscribers that received the message\r\n *\r\n * @example\r\n * ```ts\r\n * const count = redisPublish('cache:updates', 'CSS compiled')\r\n * console.log(`Delivered to ${count} subscribers`)\r\n * ```\r\n */\r\nexport function redisPublish(channel: string, message: string): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_publish) throw new Error(\"redis_publish not available\")\r\n return native.redis_publish(channel, message)\r\n}\r\n\r\n/**\r\n * Set expiration on key\r\n *\r\n * @param key - Cache key\r\n * @param ttl_seconds - Time to live in seconds\r\n * @returns 1 if timeout set, 0 if key doesn't exist\r\n *\r\n * @example\r\n * ```ts\r\n * redisExpirationSet('compiled:bg-blue-600', 3600)\r\n * ```\r\n */\r\nexport function redisExpirationSet(key: string, ttl_seconds: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_expiration_set) throw new Error(\"redis_expiration_set not available\")\r\n return native.redis_expiration_set(key, ttl_seconds)\r\n}\r\n\r\n/**\r\n * Get expiration info for key\r\n *\r\n * @param key - Cache key\r\n * @returns Expiration information\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisExpirationGet('compiled:bg-blue-600')\r\n * console.log(`TTL: ${info.ttl_seconds} seconds`)\r\n * ```\r\n */\r\nexport function redisExpirationGet(key: string): KeyExpiration {\r\n const native = getNativeBridge()\r\n if (!native?.redis_expiration_get) throw new Error(\"redis_expiration_get not available\")\r\n const result = native.redis_expiration_get(key)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n key,\r\n ttl_seconds: -1,\r\n expiration_timestamp: 0,\r\n is_persistent: true,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Get Redis server info\r\n *\r\n * @returns Server information JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const info = redisInfo()\r\n * ```\r\n */\r\nexport function redisInfo(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_info) throw new Error(\"redis_info not available\")\r\n return native.redis_info()\r\n}\r\n\r\n/**\r\n * Monitor Redis operations in real-time (for debugging)\r\n *\r\n * @returns Monitor output stream\r\n *\r\n * @example\r\n * ```ts\r\n * const monitor = redisMonitor()\r\n * // Logs all Redis operations\r\n * ```\r\n */\r\nexport function redisMonitor(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_monitor) throw new Error(\"redis_monitor not available\")\r\n return native.redis_monitor()\r\n}\r\n\r\n/**\r\n * Get size of cache in bytes\r\n *\r\n * @returns Total memory usage in bytes\r\n *\r\n * @example\r\n * ```ts\r\n * const bytes = redisCacheSize()\r\n * console.log(`Cache: ${bytes / 1024 / 1024} MB`)\r\n * ```\r\n */\r\nexport function redisCacheSize(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_size) throw new Error(\"redis_cache_size not available\")\r\n return native.redis_cache_size()\r\n}\r\n\r\n/**\r\n * Get number of keys in cache\r\n *\r\n * @returns Total key count\r\n *\r\n * @example\r\n * ```ts\r\n * const count = redisCacheKeyCount()\r\n * console.log(`Cached keys: ${count}`)\r\n * ```\r\n */\r\nexport function redisCacheKeyCount(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_key_count) throw new Error(\"redis_cache_key_count not available\")\r\n return native.redis_cache_key_count()\r\n}\r\n\r\n/**\r\n * Clear Redis cache and reset statistics\r\n *\r\n * @returns Number of keys cleared\r\n *\r\n * @example\r\n * ```ts\r\n * const cleared = redisCacheClear()\r\n * console.log(`Cleared ${cleared} keys`)\r\n * ```\r\n */\r\nexport function redisCacheClear(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_clear) throw new Error(\"redis_cache_clear not available\")\r\n return native.redis_cache_clear()\r\n}\r\n\r\n/**\r\n * Get Redis cache hit rate statistics\r\n *\r\n * @returns Hit rate percentage (0-100)\r\n *\r\n * @example\r\n * ```ts\r\n * const hitRate = redisCacheHitRate()\r\n * console.log(`Hit rate: ${hitRate}%`)\r\n * ```\r\n */\r\nexport function redisCacheHitRate(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_hit_rate) throw new Error(\"redis_cache_hit_rate not available\")\r\n return native.redis_cache_hit_rate()\r\n}\r\n\r\n/**\r\n * Enable Redis persistence (AOF/RDB)\r\n *\r\n * @param mode - \"aof\" or \"rdb\"\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisEnablePersistence('aof')\r\n * ```\r\n */\r\nexport function redisEnablePersistence(mode: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_persistence) throw new Error(\"redis_enable_persistence not available\")\r\n return native.redis_enable_persistence(mode)\r\n}\r\n\r\n/**\r\n * Disable Redis persistence\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisDisablePersistence()\r\n * ```\r\n */\r\nexport function redisDisablePersistence(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_persistence) throw new Error(\"redis_disable_persistence not available\")\r\n return native.redis_disable_persistence()\r\n}\r\n\r\n/**\r\n * Save Redis data to disk (snapshot)\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSnapshot()\r\n * ```\r\n */\r\nexport function redisSnapshot(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_snapshot) throw new Error(\"redis_snapshot not available\")\r\n return native.redis_snapshot()\r\n}\r\n\r\n/**\r\n * Get Redis memory statistics and recommendations\r\n *\r\n * @returns Memory info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const memory = redisMemoryStats()\r\n * console.log(memory)\r\n * ```\r\n */\r\nexport function redisMemoryStats(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_memory_stats) throw new Error(\"redis_memory_stats not available\")\r\n return native.redis_memory_stats()\r\n}\r\n\r\n/**\r\n * Optimize Redis memory usage\r\n *\r\n * @returns Number of keys optimized\r\n *\r\n * @example\r\n * ```ts\r\n * const optimized = redisOptimizeMemory()\r\n * console.log(`Optimized ${optimized} keys`)\r\n * ```\r\n */\r\nexport function redisOptimizeMemory(): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_optimize_memory) throw new Error(\"redis_optimize_memory not available\")\r\n return native.redis_optimize_memory()\r\n}\r\n\r\n/**\r\n * Set Redis key eviction policy\r\n *\r\n * @param policy - LRU, LFU, TTL, RANDOM, etc.\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisSetEvictionPolicy('allkeys-lru')\r\n * ```\r\n */\r\nexport function redisSetEvictionPolicy(policy: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_set_eviction_policy) throw new Error(\"redis_set_eviction_policy not available\")\r\n return native.redis_set_eviction_policy(policy)\r\n}\r\n\r\n/**\r\n * Get current Redis eviction policy\r\n *\r\n * @returns Current policy name\r\n *\r\n * @example\r\n * ```ts\r\n * const policy = redisGetEvictionPolicy()\r\n * console.log(`Eviction policy: ${policy}`)\r\n * ```\r\n */\r\nexport function redisGetEvictionPolicy(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_get_eviction_policy) throw new Error(\"redis_get_eviction_policy not available\")\r\n return native.redis_get_eviction_policy()\r\n}\r\n\r\n/**\r\n * Replicate data to another Redis instance\r\n *\r\n * @param target_host - Target host\r\n * @param target_port - Target port\r\n * @returns Number of keys replicated\r\n *\r\n * @example\r\n * ```ts\r\n * const replicated = redisReplicate('replica.example.com', 6379)\r\n * console.log(`Replicated ${replicated} keys`)\r\n * ```\r\n */\r\nexport function redisReplicate(target_host: string, target_port: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_replicate) throw new Error(\"redis_replicate not available\")\r\n return native.redis_replicate(target_host, target_port)\r\n}\r\n\r\n/**\r\n * Get replication status\r\n *\r\n * @returns Replication info JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const status = redisReplicationStatus()\r\n * console.log(status)\r\n * ```\r\n */\r\nexport function redisReplicationStatus(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_replication_status) throw new Error(\"redis_replication_status not available\")\r\n return native.redis_replication_status()\r\n}\r\n\r\n/**\r\n * Sync cache between Redis instances (distributed cache sync)\r\n *\r\n * @param peers - Array of peer Redis addresses\r\n * @returns Number of keys synced\r\n *\r\n * @example\r\n * ```ts\r\n * const synced = redisCacheSync(['redis1:6379', 'redis2:6379'])\r\n * console.log(`Synced ${synced} keys`)\r\n * ```\r\n */\r\nexport function redisCacheSync(peers: string[]): number {\r\n const native = getNativeBridge()\r\n if (!native?.redis_cache_sync) throw new Error(\"redis_cache_sync not available\")\r\n return native.redis_cache_sync(peers)\r\n}\r\n\r\n/**\r\n * Enable automatic cache warming\r\n *\r\n * @param key_pattern - Glob pattern for keys to warm (e.g., \"compiled:*\")\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisEnableCacheWarming('compiled:*')\r\n * ```\r\n */\r\nexport function redisEnableCacheWarming(key_pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_enable_cache_warming) throw new Error(\"redis_enable_cache_warming not available\")\r\n return native.redis_enable_cache_warming(key_pattern)\r\n}\r\n\r\n/**\r\n * Disable cache warming\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * redisDisableCacheWarming()\r\n * ```\r\n */\r\nexport function redisDisableCacheWarming(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_disable_cache_warming) throw new Error(\"redis_disable_cache_warming not available\")\r\n return native.redis_disable_cache_warming()\r\n}\r\n\r\n/**\r\n * Diagnose Redis connection issues\r\n *\r\n * @returns Diagnostic report\r\n *\r\n * @example\r\n * ```ts\r\n * const diagnosis = redisDiagnose()\r\n * console.log(diagnosis)\r\n * ```\r\n */\r\nexport function redisDiagnose(): string {\r\n const native = getNativeBridge()\r\n if (!native?.redis_diagnose) throw new Error(\"redis_diagnose not available\")\r\n return native.redis_diagnose()\r\n}\r\n","/**\r\n * Redis Sub-entry Point\r\n * \r\n * Exports Redis and distributed cache functionality.\r\n * - Redis operations (get, set, delete, etc.)\r\n * - Redis pool management\r\n * - Cluster management\r\n * - Cache synchronization\r\n * - Persistence management\r\n */\r\n\r\nexport {\r\n redisPing,\r\n redisGet,\r\n redisSet,\r\n redisDelete,\r\n redisExists,\r\n redisMget,\r\n redisMset,\r\n redisFlushDb,\r\n redisFlushAll,\r\n redisPoolConnect,\r\n redisPoolStats,\r\n redisPoolReconnect,\r\n redisEnableCluster,\r\n redisDisableCluster,\r\n redisClusterStatus,\r\n redisSubscribe,\r\n redisPublish,\r\n redisExpirationSet,\r\n redisExpirationGet,\r\n redisInfo,\r\n redisMonitor,\r\n redisCacheSize,\r\n redisCacheKeyCount,\r\n redisCacheClear,\r\n redisCacheHitRate,\r\n redisEnablePersistence,\r\n redisDisablePersistence,\r\n redisSnapshot,\r\n redisMemoryStats,\r\n redisOptimizeMemory,\r\n redisSetEvictionPolicy,\r\n redisGetEvictionPolicy,\r\n redisReplicate,\r\n redisReplicationStatus,\r\n redisCacheSync,\r\n redisEnableCacheWarming,\r\n redisDisableCacheWarming,\r\n redisDiagnose,\r\n type RedisCacheConfig,\r\n type RedisPoolStats,\r\n type RedisClusterNode,\r\n type RedisClusterStatus,\r\n type KeyExpiration,\r\n type PubSubMessage,\r\n type PoolInfo,\r\n} from './redisNative'\r\n","/**\r\n * watchSystemNative.ts\r\n *\r\n * Phase 5.4: Watch System & File Monitoring - Real-time CSS recompilation\r\n * Exposes 12 watch/monitoring functions for hot-reload and incremental compilation\r\n */\r\n\r\nimport { getNativeBridge } from \"../nativeBridge\"\r\n\r\n/**\r\n * File watch event\r\n */\r\nexport interface WatchEvent {\r\n event_type: \"create\" | \"modify\" | \"delete\" | \"rename\"\r\n file_path: string\r\n timestamp_ms: number\r\n is_dir: boolean\r\n}\r\n\r\n/**\r\n * Watch handle for tracking active watchers\r\n */\r\nexport interface WatchHandle {\r\n handle_id: number\r\n patterns: string[]\r\n is_running: boolean\r\n created_at_ms: number\r\n}\r\n\r\n/**\r\n * Watch statistics\r\n */\r\nexport interface WatchStats {\r\n active_watchers: number\r\n total_events: number\r\n events_this_second: number\r\n average_latency_ms: number\r\n largest_batch_size: number\r\n}\r\n\r\n/**\r\n * Start file system watcher for directory\r\n *\r\n * @param root_path - Directory to watch\r\n * @param patterns - Glob patterns to match (e.g., [\"*.tsx\", \"*.ts\"])\r\n * @returns Handle ID for the watcher\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = startWatch('./src', ['*.tsx', '*.ts'])\r\n * // Watcher is now active\r\n * ```\r\n */\r\nexport function startWatch(root_path: string, patterns?: string[]): number {\r\n const native = getNativeBridge()\r\n if (!native?.start_watch) throw new Error(\"start_watch not available\")\r\n return native.start_watch(root_path, patterns)\r\n}\r\n\r\n/**\r\n * Poll for watch events (non-blocking)\r\n *\r\n * @param handle - Watcher handle from startWatch()\r\n * @param timeout_ms - Max time to wait for events (default: 100)\r\n * @returns Array of watch events\r\n *\r\n * @example\r\n * ```ts\r\n * const handle = startWatch('./src', ['*.tsx'])\r\n * const events = pollWatchEvents(handle, 100)\r\n * events.forEach(evt => {\r\n * console.log(`${evt.event_type}: ${evt.file_path}`)\r\n * })\r\n * ```\r\n */\r\nexport function pollWatchEvents(handle: number, timeout_ms?: number): WatchEvent[] {\r\n const native = getNativeBridge()\r\n if (!native?.poll_watch_events) throw new Error(\"poll_watch_events not available\")\r\n const result = native.poll_watch_events(handle, timeout_ms)\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Stop file system watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @returns Number of events processed before stopping\r\n *\r\n * @example\r\n * ```ts\r\n * const eventsProcessed = stopWatch(handle)\r\n * console.log(`Watcher processed ${eventsProcessed} events`)\r\n * ```\r\n */\r\nexport function stopWatch(handle: number): number {\r\n const native = getNativeBridge()\r\n if (!native?.stop_watch) throw new Error(\"stop_watch not available\")\r\n return native.stop_watch(handle)\r\n}\r\n\r\n/**\r\n * Add pattern to active watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @param pattern - Glob pattern to add (e.g., \"*.md\")\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchAddPattern(handle, '*.md')\r\n * // Now watching markdown files too\r\n * ```\r\n */\r\nexport function watchAddPattern(handle: number, pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_add_pattern) throw new Error(\"watch_add_pattern not available\")\r\n return native.watch_add_pattern(handle, pattern)\r\n}\r\n\r\n/**\r\n * Remove pattern from watcher\r\n *\r\n * @param handle - Watcher handle\r\n * @param pattern - Pattern to remove\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchRemovePattern(handle, '*.md')\r\n * ```\r\n */\r\nexport function watchRemovePattern(handle: number, pattern: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_remove_pattern) throw new Error(\"watch_remove_pattern not available\")\r\n return native.watch_remove_pattern(handle, pattern)\r\n}\r\n\r\n/**\r\n * Get all active watcher handles\r\n *\r\n * @returns Array of active watch handles\r\n *\r\n * @example\r\n * ```ts\r\n * const handles = watchGetActiveHandles()\r\n * console.log(`${handles.length} active watchers`)\r\n * ```\r\n */\r\nexport function watchGetActiveHandles(): WatchHandle[] {\r\n const native = getNativeBridge()\r\n if (!native?.watch_get_active_handles) throw new Error(\"watch_get_active_handles not available\")\r\n const result = native.watch_get_active_handles()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Clear all active watchers\r\n *\r\n * @returns Number of watchers cleared\r\n *\r\n * @example\r\n * ```ts\r\n * const cleared = watchClearAll()\r\n * console.log(`Cleared ${cleared} watchers`)\r\n * ```\r\n */\r\nexport function watchClearAll(): number {\r\n const native = getNativeBridge()\r\n if (!native?.watch_clear_all) throw new Error(\"watch_clear_all not available\")\r\n return native.watch_clear_all()\r\n}\r\n\r\n/**\r\n * Convert watch event type to string\r\n *\r\n * @param event_type_code - Event type code (0-3)\r\n * @returns Event type as string\r\n *\r\n * @example\r\n * ```ts\r\n * const typeStr = watchEventTypeToString(0)\r\n * console.log(typeStr) // \"create\"\r\n * ```\r\n */\r\nexport function watchEventTypeToString(event_type_code: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_event_type_to_string) throw new Error(\"watch_event_type_to_string not available\")\r\n return native.watch_event_type_to_string(event_type_code)\r\n}\r\n\r\n/**\r\n * Check if watcher is running\r\n *\r\n * @param handle - Watcher handle\r\n * @returns True if running\r\n *\r\n * @example\r\n * ```ts\r\n * if (isWatchRunning(handle)) {\r\n * console.log(\"Watcher is active\")\r\n * }\r\n * ```\r\n */\r\nexport function isWatchRunning(handle: number): boolean {\r\n const native = getNativeBridge()\r\n if (!native?.is_watch_running) throw new Error(\"is_watch_running not available\")\r\n return native.is_watch_running(handle)\r\n}\r\n\r\n/**\r\n * Get watch system statistics\r\n *\r\n * @returns Watch statistics\r\n *\r\n * @example\r\n * ```ts\r\n * const stats = getWatchStats()\r\n * console.log(`Active: ${stats.active_watchers}, Events: ${stats.total_events}`)\r\n * ```\r\n */\r\nexport function getWatchStats(): WatchStats {\r\n const native = getNativeBridge()\r\n if (!native?.get_watch_stats) throw new Error(\"get_watch_stats not available\")\r\n const result = native.get_watch_stats()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return {\r\n active_watchers: 0,\r\n total_events: 0,\r\n events_this_second: 0,\r\n average_latency_ms: 0,\r\n largest_batch_size: 0,\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Pause watching (pause event delivery without stopping watcher)\r\n *\r\n * @param handle - Watcher handle\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchPause(handle)\r\n * // Events still detected but not delivered\r\n * ```\r\n */\r\nexport function watchPause(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_pause) throw new Error(\"watch_pause not available\")\r\n return native.watch_pause(handle)\r\n}\r\n\r\n/**\r\n * Resume watching after pause\r\n *\r\n * @param handle - Watcher handle\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * watchResume(handle)\r\n * // Event delivery resumes\r\n * ```\r\n */\r\nexport function watchResume(handle: number): string {\r\n const native = getNativeBridge()\r\n if (!native?.watch_resume) throw new Error(\"watch_resume not available\")\r\n return native.watch_resume(handle)\r\n}\r\n\r\n/**\r\n * Scan cache and get optimization recommendations\r\n *\r\n * @returns Optimization hints JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const hints = scanCacheOptimizations()\r\n * console.log(hints)\r\n * ```\r\n */\r\nexport function scanCacheOptimizations(): string {\r\n const native = getNativeBridge()\r\n if (!native?.scan_cache_optimizations) throw new Error(\"scan_cache_optimizations not available\")\r\n return native.scan_cache_optimizations()\r\n}\r\n\r\n/**\r\n * Get plugin hook list\r\n *\r\n * @returns Available plugin hooks\r\n *\r\n * @example\r\n * ```ts\r\n * const hooks = getPluginHooks()\r\n * console.log(hooks)\r\n * ```\r\n */\r\nexport function getPluginHooks(): string[] {\r\n const native = getNativeBridge()\r\n if (!native?.get_plugin_hooks) throw new Error(\"get_plugin_hooks not available\")\r\n const result = native.get_plugin_hooks()\r\n try {\r\n return JSON.parse(result)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\n/**\r\n * Register plugin hook handler\r\n *\r\n * @param hook_name - Hook name\r\n * @param handler_id - Handler identifier\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * registerPluginHook('compile:before', 'my-handler-1')\r\n * ```\r\n */\r\nexport function registerPluginHook(hook_name: string, handler_id: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.register_plugin_hook) throw new Error(\"register_plugin_hook not available\")\r\n return native.register_plugin_hook(hook_name, handler_id)\r\n}\r\n\r\n/**\r\n * Unregister plugin hook handler\r\n *\r\n * @param hook_name - Hook name\r\n * @param handler_id - Handler identifier\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * unregisterPluginHook('compile:before', 'my-handler-1')\r\n * ```\r\n */\r\nexport function unregisterPluginHook(hook_name: string, handler_id: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.unregister_plugin_hook) throw new Error(\"unregister_plugin_hook not available\")\r\n return native.unregister_plugin_hook(hook_name, handler_id)\r\n}\r\n\r\n/**\r\n * Emit plugin hook event\r\n *\r\n * @param hook_name - Hook name\r\n * @param data_json - Event data as JSON\r\n * @returns Modified data\r\n *\r\n * @example\r\n * ```ts\r\n * const result = emitPluginHook('compile:before', JSON.stringify({css: '...'}))\r\n * ```\r\n */\r\nexport function emitPluginHook(hook_name: string, data_json: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.emit_plugin_hook) throw new Error(\"emit_plugin_hook not available\")\r\n return native.emit_plugin_hook(hook_name, data_json)\r\n}\r\n\r\n/**\r\n * Get compilation performance metrics\r\n *\r\n * @returns Performance metrics\r\n *\r\n * @example\r\n * ```ts\r\n * const metrics = getCompilationMetrics()\r\n * console.log(metrics)\r\n * ```\r\n */\r\nexport function getCompilationMetrics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.get_compilation_metrics) throw new Error(\"get_compilation_metrics not available\")\r\n return native.get_compilation_metrics()\r\n}\r\n\r\n/**\r\n * Reset compilation performance counters\r\n *\r\n * @returns \"OK\" on success\r\n *\r\n * @example\r\n * ```ts\r\n * resetCompilationMetrics()\r\n * ```\r\n */\r\nexport function resetCompilationMetrics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.reset_compilation_metrics) throw new Error(\"reset_compilation_metrics not available\")\r\n return native.reset_compilation_metrics()\r\n}\r\n\r\n/**\r\n * Validate CSS output for errors\r\n *\r\n * @param css - CSS to validate\r\n * @returns Validation result as JSON\r\n *\r\n * @example\r\n * ```ts\r\n * const result = validateCssOutput('.test { color: red; }')\r\n * ```\r\n */\r\nexport function validateCssOutput(css: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.validate_css_output) throw new Error(\"validate_css_output not available\")\r\n return native.validate_css_output(css)\r\n}\r\n\r\n/**\r\n * Get compiler diagnostics\r\n *\r\n * @returns Diagnostic information\r\n *\r\n * @example\r\n * ```ts\r\n * const diagnostics = getCompilerDiagnostics()\r\n * console.log(diagnostics)\r\n * ```\r\n */\r\nexport function getCompilerDiagnostics(): string {\r\n const native = getNativeBridge()\r\n if (!native?.get_compiler_diagnostics) throw new Error(\"get_compiler_diagnostics not available\")\r\n return native.get_compiler_diagnostics()\r\n}\r\n","/**\r\n * Watch Sub-entry Point\r\n * \r\n * Exports file watching and compilation monitoring functionality.\r\n * - File system watching\r\n * - Watch event polling and management\r\n * - Watch statistics\r\n * - Plugin hooks\r\n * - Compilation metrics\r\n */\r\n\r\nexport {\r\n startWatch,\r\n pollWatchEvents,\r\n stopWatch,\r\n watchAddPattern,\r\n watchRemovePattern,\r\n watchGetActiveHandles,\r\n watchClearAll,\r\n watchEventTypeToString,\r\n isWatchRunning,\r\n getWatchStats,\r\n watchPause,\r\n watchResume,\r\n scanCacheOptimizations,\r\n getPluginHooks,\r\n registerPluginHook,\r\n unregisterPluginHook,\r\n emitPluginHook,\r\n getCompilationMetrics,\r\n resetCompilationMetrics,\r\n validateCssOutput,\r\n getCompilerDiagnostics,\r\n type WatchEvent,\r\n type WatchHandle,\r\n type WatchStats,\r\n} from './watchSystemNative'\r\n","/**\r\n * tailwind-styled-v5 — Compiler Main Entry Point\r\n * \r\n * Re-exports all sub-entry points for backward compatibility.\r\n * For better tree-shaking, import from specific sub-entries:\r\n * - '@tailwind-styled/compiler/compiler' - CSS generation and compilation\r\n * - '@tailwind-styled/compiler/parser' - Class parsing and extraction\r\n * - '@tailwind-styled/compiler/analyzer' - Analysis and optimization\r\n * - '@tailwind-styled/compiler/cache' - Cache management\r\n * - '@tailwind-styled/compiler/redis' - Redis and distributed cache\r\n * - '@tailwind-styled/compiler/watch' - File watching and monitoring\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\n\r\nimport { getNativeBridge, resetNativeBridgeCache, adaptNativeResult, type NativeBridge, type NativeTransformResult, type ClassExtractResult, type ComponentMetadata, type NativeRscResult } from \"./nativeBridge\"\r\n\r\nexport { getNativeBridge, resetNativeBridgeCache, adaptNativeResult }\r\nexport type { NativeBridge, NativeTransformResult, ClassExtractResult, ComponentMetadata, NativeRscResult }\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// RE-EXPORT ALL SUB-ENTRIES FOR BACKWARD COMPATIBILITY\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\n// Compiler sub-entry - CSS generation, compilation, ID registry, streaming\r\nexport * from './compiler'\r\n\r\n// Parser sub-entry - Class parsing and extraction\r\nexport * from './parser'\r\n\r\n// Analyzer sub-entry - Analysis, optimization, theme resolution\r\nexport * from './analyzer'\r\n\r\n// Cache sub-entry - Cache management\r\nexport * from './cache'\r\n\r\n// Redis sub-entry - Redis and distributed cache\r\nexport * from './redis'\r\n\r\n// Watch sub-entry - File watching and monitoring\r\nexport * from './watch'\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// TRANSFORM & CORE FUNCTIONS\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const transformSource = (source: string, opts?: Record<string, unknown>) => {\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(source, opts as Record<string, string>)\r\n if (!result) {\r\n throw new Error(\"FATAL: transformSource returned null\")\r\n }\r\n return result\r\n}\r\n\r\nexport const hasTwUsage = (source: string): boolean => {\r\n const native = getNativeBridge()\r\n if (!native?.hasTwUsage) {\r\n throw new Error(\"FATAL: Native binding 'hasTwUsage' is required but not available.\")\r\n }\r\n return native.hasTwUsage(source)\r\n}\r\n\r\nexport const isAlreadyTransformed = (source: string): boolean => {\r\n const native = getNativeBridge()\r\n if (!native?.isAlreadyTransformed) {\r\n throw new Error(\"FATAL: Native binding 'isAlreadyTransformed' is required but not available.\")\r\n }\r\n return native.isAlreadyTransformed(source)\r\n}\r\n\r\nexport const shouldProcess = (source: string): boolean => {\r\n return hasTwUsage(source) && !isAlreadyTransformed(source)\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// ADDITIONAL UTILITIES\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const compileCssFromClasses = (classes: string[], prefix?: string | null) => {\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(classes.join(\" \"), { prefix: prefix ?? \"\" })\r\n if (!result) {\r\n throw new Error(\"FATAL: transformSource returned null\")\r\n }\r\n return result\r\n}\r\n\r\nexport const buildStyleTag = (classes: string[]): string => {\r\n const result = compileCssFromClasses(classes)\r\n return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : \"\"\r\n}\r\n\r\nexport const generateCssForClasses = async (\r\n classes: string[],\r\n _tailwindConfig?: Record<string, unknown>,\r\n root?: string,\r\n cssEntryContent?: string,\r\n minify = false\r\n): Promise<string> => {\r\n try {\r\n const { runCssPipeline } = await import(\"./compiler/tailwindEngine\")\r\n const result = await runCssPipeline(classes, cssEntryContent, root, minify)\r\n return result.css\r\n } catch {\r\n // Fallback if import fails\r\n const native = getNativeBridge()\r\n if (!native?.transformSource) {\r\n throw new Error(\"FATAL: Native binding 'transformSource' is required but not available.\")\r\n }\r\n const result = native.transformSource(classes.join(\" \"), {})\r\n return result?.code || \"\"\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// DEAD STYLE ELIMINATION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const eliminateDeadCss = (css: string, deadClasses: Set<string>): string => {\r\n const native = getNativeBridge()\r\n if (!native?.eliminateDeadCss) {\r\n throw new Error(\"FATAL: Native binding 'eliminateDeadCss' is required but not available.\")\r\n }\r\n return native.eliminateDeadCss(css, Array.from(deadClasses)) as string\r\n}\r\n\r\nexport const findDeadVariants = (\r\n variantConfig: Record<string, unknown> | Array<{ name: string; variants: Record<string, Record<string, string>>; defaultVariants?: Record<string, string> }>,\r\n usage: Record<string, Set<string>>\r\n) => {\r\n const unused: string[] = []\r\n\r\n const configs = Array.isArray(variantConfig)\r\n ? variantConfig\r\n : [{ name: \"__root__\", variants: variantConfig as Record<string, Record<string, string>> }]\r\n\r\n for (const component of configs) {\r\n const componentUsage = usage[component.name] ?? new Set<string>()\r\n const variants = component.variants as Record<string, Record<string, string>>\r\n for (const [key, values] of Object.entries(variants)) {\r\n for (const [value] of Object.entries(values)) {\r\n if (!componentUsage.has(`${key}:${value}`)) {\r\n unused.push(`${component.name !== \"__root__\" ? `${component.name}/` : \"\"}${key}:${value}`)\r\n }\r\n }\r\n }\r\n }\r\n\r\n return { unusedCount: unused.length, unused }\r\n}\r\n\r\nexport const runElimination = (css: string, scanResult: unknown): string => {\r\n const native = getNativeBridge()\r\n if (!native?.detectDeadCode) {\r\n throw new Error(\"FATAL: Native binding 'detectDeadCode' is required but not available.\")\r\n }\r\n const dead = native.detectDeadCode(JSON.stringify(scanResult), css) as { deadInCss: string[] }\r\n return eliminateDeadCss(css, new Set(dead.deadInCss ?? []))\r\n}\r\n\r\nexport const scanProjectUsage = (dirs: string[], cwd: string) => {\r\n // Import locally to avoid circular dependency\r\n const { batchExtractClasses } = require('./parser')\r\n const files = dirs.map(dir => path.resolve(cwd, dir))\r\n const results = batchExtractClasses(files) || []\r\n\r\n const combined: Record<string, Record<string, Set<string>>> = {}\r\n for (const result of results) {\r\n if (result.ok && result.classes) {\r\n for (const cls of result.classes) {\r\n if (!combined[cls]) combined[cls] = {}\r\n combined[cls][result.file] = new Set([cls])\r\n }\r\n }\r\n }\r\n return combined\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// CONFIG & UTILITIES\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const generateSafelist = (scanDirs: string[], outputPath?: string, cwd?: string) => {\r\n const classes = scanProjectUsage(scanDirs, cwd || process.cwd())\r\n const allClasses = Object.keys(classes).sort()\r\n if (outputPath) {\r\n fs.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2))\r\n }\r\n return allClasses\r\n}\r\n\r\nexport const loadSafelist = (safelistPath: string): string[] => {\r\n try {\r\n const content = fs.readFileSync(safelistPath, \"utf-8\")\r\n return JSON.parse(content)\r\n } catch {\r\n return []\r\n }\r\n}\r\n\r\nexport const loadTailwindConfig = (cwd: string = process.cwd()) => {\r\n const configFiles = [\r\n \"tailwind.config.ts\",\r\n \"tailwind.config.js\",\r\n \"tailwind.config.mjs\",\r\n \"tailwind.config.cjs\",\r\n ]\r\n for (const file of configFiles) {\r\n const fullPath = path.join(cwd, file)\r\n if (fs.existsSync(fullPath)) {\r\n const mod = require(fullPath) as { default?: unknown }\r\n return mod.default || mod\r\n }\r\n }\r\n return {}\r\n}\r\n\r\nexport const getContentPaths = (cwd: string = process.cwd()) => {\r\n return {\r\n content: [\r\n path.join(cwd, \"src/**/*.{js,ts,jsx,tsx}\"),\r\n path.join(cwd, \"app/**/*.{js,ts,jsx,tsx}\"),\r\n path.join(cwd, \"pages/**/*.{js,ts,jsx,tsx}\"),\r\n ],\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// CONTAINER CSS EXTRACTION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nfunction _layoutClassesToCss(classes: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.layoutClassesToCss) {\r\n throw new Error(\"FATAL: Native binding 'layoutClassesToCss' is required but not available.\")\r\n }\r\n return native.layoutClassesToCss(classes)\r\n}\r\n\r\nfunction _hashContainer(tag: string, containerJson: string, name?: string): string {\r\n const sortedKey = tag + (name ?? \"\") + containerJson\r\n const native = getNativeBridge()\r\n if (!native?.hashContent) {\r\n throw new Error(\"FATAL: Native binding 'hashContent' is required but not available.\")\r\n }\r\n return `tw-cq-${native.hashContent(sortedKey, \"fnv\", 6)}`\r\n}\r\n\r\nconst _CONTAINER_BREAKPOINTS: Record<string, string> = {\r\n xs: \"240px\",\r\n sm: \"320px\",\r\n md: \"640px\",\r\n lg: \"1024px\",\r\n xl: \"1280px\",\r\n \"2xl\": \"1536px\",\r\n}\r\n\r\nexport function extractContainerCssFromSource(source: string): string {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwContainerConfigs) {\r\n throw new Error(\"FATAL: Native binding 'extractTwContainerConfigs' is required but not available.\")\r\n }\r\n\r\n const configs = native.extractTwContainerConfigs(source) as Array<{\r\n tag: string\r\n containerJson: string\r\n containerName?: string\r\n breakpoints: Array<{ key: string; classes: string }>\r\n }>\r\n\r\n const rules: string[] = []\r\n for (const cfg of configs) {\r\n const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName)\r\n for (const { key, classes } of cfg.breakpoints) {\r\n const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key\r\n const css = _layoutClassesToCss(classes)\r\n if (!css) continue\r\n const query = cfg.containerName\r\n ? `@container ${cfg.containerName} (min-width: ${minWidth})`\r\n : `@container (min-width: ${minWidth})`\r\n rules.push(`${query}{.${id}{${css}}}`)\r\n }\r\n }\r\n return rules.join(\"\\n\")\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// LOADER INTERFACE\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport type LoaderOutput = {\r\n code: string\r\n changed: boolean\r\n classes: string[]\r\n staticCss?: string\r\n rsc?: { isServer?: boolean; needsClientDirective?: boolean; clientReasons?: string[] }\r\n engine?: string\r\n}\r\n\r\nexport const runLoaderTransform = (ctx: { filepath: string; source: string; options?: Record<string, unknown> }) => {\r\n const { filepath, source, options } = ctx\r\n const result = transformSource(source, { filename: filepath, ...options })\r\n\r\n let staticCss: string | undefined\r\n try {\r\n const cssChunks: string[] = []\r\n\r\n const stateRules = extractAndGenerateStateCss(source, filepath)\r\n if (stateRules.length > 0) {\r\n cssChunks.push(stateRules.map((r) => r.cssRule).join(\"\\n\"))\r\n }\r\n\r\n const containerCss = extractContainerCssFromSource(source)\r\n if (containerCss) cssChunks.push(containerCss)\r\n\r\n const combined = cssChunks.join(\"\\n\").trim()\r\n if (combined) staticCss = combined\r\n } catch (err) {\r\n // Non-fatal — static CSS extraction failure should not break transform pipeline.\r\n console.debug(\"Static CSS extraction warning:\", err)\r\n }\r\n\r\n return {\r\n code: result?.code || \"\",\r\n changed: result?.changed || false,\r\n classes: result?.classes || [],\r\n staticCss,\r\n } as LoaderOutput\r\n}\r\n\r\nexport const shouldSkipFile = (filepath: string): boolean => {\r\n const SKIP_PATHS = [\"node_modules\", \".next\", \".rspack-dist\", \".turbo\", \"dist/\", \"out/\"]\r\n const skipExtensions = [\".css\", \".json\", \".md\", \".txt\", \".yaml\", \".yml\"]\r\n for (const p of SKIP_PATHS) {\r\n if (filepath.includes(p)) return true\r\n }\r\n for (const ext of skipExtensions) {\r\n if (filepath.endsWith(ext)) return true\r\n }\r\n return false\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// ROUTE MANAGEMENT\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const fileToRoute = (filepath: string): string | null => {\r\n const normalized = filepath.replace(/\\\\/g, \"/\")\r\n if (normalized.includes(\"/layout.\") || normalized.includes(\"/loading.\") || normalized.includes(\"/error.\")) {\r\n return \"__global\"\r\n }\r\n const pageMatch = normalized.match(/\\/app\\/(.+?)\\/page\\.[tj]sx?$/)\r\n if (pageMatch) return `/${pageMatch[1]}`\r\n const rootPage = normalized.match(/\\/app\\/page\\.[tj]sx?$/)\r\n if (rootPage) return \"/\"\r\n return null\r\n}\r\n\r\nexport const getAllRoutes = (): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClasses' is required but not available.\")\r\n }\r\n return [\"/\", \"__global\"]\r\n}\r\n\r\nexport const getRouteClasses = (_route: string): Set<string> => new Set()\r\nexport const registerFileClasses = (_filepath: string, _classes: string[]): void => {}\r\nexport const registerGlobalClasses = (_classes: string[]): void => {}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// INCREMENTAL ENGINE\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nlet _incrementalEngineInstance: InstanceType<typeof IncrementalEngine> | null = null\r\n\r\nexport const getIncrementalEngine = () => {\r\n if (!_incrementalEngineInstance) {\r\n _incrementalEngineInstance = new IncrementalEngine()\r\n }\r\n return _incrementalEngineInstance\r\n}\r\n\r\nexport const resetIncrementalEngine = (): void => {\r\n _incrementalEngineInstance = null\r\n}\r\n\r\nexport class IncrementalEngine {\r\n compile(source: string) {\r\n return transformSource(source)\r\n }\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// STYLE BUCKET SYSTEM\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const getBucketEngine = () => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n return {\r\n add: (className: string) => className,\r\n get: (_bucket: string): string[] => [],\r\n }\r\n}\r\n\r\nexport const resetBucketEngine = (): void => {}\r\n\r\nexport class BucketEngine {\r\n add(className: string) { return className }\r\n}\r\n\r\nexport const classifyNode = (_node: unknown): string => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n return \"unknown\"\r\n}\r\n\r\nexport const detectConflicts = (_classes: string[]): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClassUsage) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClassUsage' is required but not available.\")\r\n }\r\n return []\r\n}\r\n\r\nexport const bucketSort = (classes: string[]): string[] => {\r\n const native = getNativeBridge()\r\n if (!native?.classifyAndSortClasses) {\r\n throw new Error(\"FATAL: Native binding 'classifyAndSortClasses' is required but not available.\")\r\n }\r\n const sorted = native.classifyAndSortClasses(classes)\r\n return sorted.map((c) => (c as { raw?: string }).raw ?? (c as unknown as string))\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// RSC & FILE ANALYSIS CONTINUED\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const analyzeFile = (source: string, filename: string) => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeRsc) {\r\n throw new Error(\"FATAL: Native binding 'analyzeRsc' is required but not available.\")\r\n }\r\n const rsc = native.analyzeRsc(source, filename)\r\n return {\r\n isServer: rsc?.isServer ?? true,\r\n needsClientDirective: rsc?.needsClientDirective ?? false,\r\n clientReasons: rsc?.clientReasons ?? [],\r\n interactiveClasses: [],\r\n canStaticResolveVariants: true,\r\n }\r\n}\r\n\r\nexport const analyzeVariantUsage = (_source: string, _componentName: string, _variantKeys: string[]) => {\r\n return { resolved: {} as Record<string, string>, dynamic: [] as string[] }\r\n}\r\n\r\nexport const injectClientDirective = (source: string): string => {\r\n if (!source.includes('\"use client\"') && !source.includes(\"'use client'\")) {\r\n return '\"use client\";\\n' + source\r\n }\r\n return source\r\n}\r\n\r\nexport const injectServerOnlyComment = (source: string): string => {\r\n return `/* @server-only */\\n${source}`\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// FULL ANALYSIS\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport const analyzeClasses = (filesJson: string, cwd: string, flags: number) => {\r\n const native = getNativeBridge()\r\n if (!native?.analyzeClasses) {\r\n throw new Error(\"FATAL: Native binding 'analyzeClasses' is required but not available.\")\r\n }\r\n return native.analyzeClasses(filesJson, cwd, flags)\r\n}\r\n\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n// STATE CSS PRE-GENERATION\r\n// ═══════════════════════════════════════════════════════════════════════════\r\n\r\nexport interface TwStateConfigEntry {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n sourceFile: string\r\n}\r\n\r\nexport interface StaticStateCssInput {\r\n tag: string\r\n componentName: string\r\n statesJson: string\r\n}\r\n\r\nexport interface GeneratedStateRule {\r\n selector: string\r\n declarations: string\r\n cssRule: string\r\n componentName: string\r\n stateName: string\r\n}\r\n\r\nexport const extractTwStateConfigs = (source: string, filename: string): TwStateConfigEntry[] => {\r\n const native = getNativeBridge()\r\n if (!native?.extractTwStateConfigs) {\r\n throw new Error(\"FATAL: Native binding 'extractTwStateConfigs' is required but not available.\")\r\n }\r\n return native.extractTwStateConfigs(source, filename)\r\n}\r\n\r\nexport const generateStaticStateCss = (\r\n entries: TwStateConfigEntry[],\r\n _themeConfig?: Record<string, unknown>\r\n): GeneratedStateRule[] => {\r\n const rules: GeneratedStateRule[] = []\r\n for (const entry of entries) {\r\n const stateConfig = JSON.parse(entry.statesJson) as Record<string, string>\r\n for (const [stateName, classes] of Object.entries(stateConfig)) {\r\n rules.push({\r\n selector: `.${entry.componentName}[data-state=\"${stateName}\"]`,\r\n declarations: classes,\r\n cssRule: `.${entry.componentName}[data-state=\"${stateName}\"]{${classes}}`,\r\n componentName: entry.componentName,\r\n stateName,\r\n })\r\n }\r\n }\r\n return rules\r\n}\r\n\r\nexport const extractAndGenerateStateCss = (source: string, filename: string): GeneratedStateRule[] => {\r\n const entries = extractTwStateConfigs(source, filename)\r\n return generateStaticStateCss(entries)\r\n}\r\n","/**\r\n * tailwind-styled-v5 — Internal API\r\n * \r\n * Re-exports functions needed by other package consumers.\r\n * All functions require native Rust bindings.\r\n */\r\n\r\nimport {\r\n type NativeBridge,\r\n type NativeTransformResult,\r\n type ComponentMetadata,\r\n type NativeRscResult,\r\n type LoaderOutput,\r\n getNativeBridge,\r\n adaptNativeResult,\r\n transformSource,\r\n hasTwUsage,\r\n isAlreadyTransformed,\r\n shouldProcess,\r\n compileCssFromClasses,\r\n buildStyleTag,\r\n extractAllClasses,\r\n extractClassesFromSource,\r\n astExtractClasses,\r\n parseClasses,\r\n normalizeClasses,\r\n mergeClassesStatic,\r\n normalizeAndDedupClasses,\r\n eliminateDeadCss,\r\n findDeadVariants,\r\n runElimination,\r\n scanProjectUsage,\r\n extractComponentUsage,\r\n diffClassLists,\r\n batchExtractClasses,\r\n checkAgainstSafelist,\r\n generateSafelist,\r\n loadSafelist,\r\n loadTailwindConfig,\r\n getContentPaths,\r\n runLoaderTransform,\r\n shouldSkipFile,\r\n fileToRoute,\r\n getAllRoutes,\r\n getRouteClasses,\r\n registerFileClasses,\r\n registerGlobalClasses,\r\n getIncrementalEngine,\r\n resetIncrementalEngine,\r\n getBucketEngine,\r\n resetBucketEngine,\r\n classifyNode,\r\n detectConflicts,\r\n bucketSort,\r\n generateCssForClasses,\r\n analyzeFile,\r\n analyzeVariantUsage,\r\n injectClientDirective,\r\n injectServerOnlyComment,\r\n analyzeClasses,\r\n // Static state CSS pre-generation\r\n extractTwStateConfigs,\r\n generateStaticStateCss,\r\n extractAndGenerateStateCss,\r\n extractContainerCssFromSource,\r\n} from \"./index\"\r\n\r\nexport {\r\n getNativeBridge,\r\n adaptNativeResult,\r\n transformSource,\r\n hasTwUsage,\r\n isAlreadyTransformed,\r\n shouldProcess,\r\n compileCssFromClasses,\r\n buildStyleTag,\r\n extractAllClasses,\r\n extractClassesFromSource,\r\n astExtractClasses,\r\n parseClasses,\r\n normalizeClasses,\r\n mergeClassesStatic,\r\n normalizeAndDedupClasses,\r\n eliminateDeadCss,\r\n findDeadVariants,\r\n runElimination,\r\n scanProjectUsage,\r\n extractComponentUsage,\r\n diffClassLists,\r\n batchExtractClasses,\r\n checkAgainstSafelist,\r\n generateSafelist,\r\n loadSafelist,\r\n loadTailwindConfig,\r\n getContentPaths,\r\n runLoaderTransform,\r\n shouldSkipFile,\r\n fileToRoute,\r\n getAllRoutes,\r\n getRouteClasses,\r\n registerFileClasses,\r\n registerGlobalClasses,\r\n getIncrementalEngine,\r\n resetIncrementalEngine,\r\n getBucketEngine,\r\n resetBucketEngine,\r\n classifyNode,\r\n detectConflicts,\r\n bucketSort,\r\n generateCssForClasses,\r\n analyzeFile,\r\n analyzeVariantUsage,\r\n injectClientDirective,\r\n injectServerOnlyComment,\r\n analyzeClasses,\r\n // Static state + container CSS pre-generation\r\n extractTwStateConfigs,\r\n generateStaticStateCss,\r\n extractAndGenerateStateCss,\r\n extractContainerCssFromSource,\r\n}\r\n\r\nexport { type NativeBridge, type NativeTransformResult, type ComponentMetadata, type NativeRscResult, type LoaderOutput }\r\n\r\nexport type CssCompileResult = NativeTransformResult\r\n\r\n// CSS pipeline — Tailwind → LightningCSS\r\n// PHASE 0: Includes LRU caching for 30-40% performance improvement\r\nexport { runCssPipeline, runCssPipelineSync, getCacheStats, clearCache, type CssPipelineResult } from \"./compiler/tailwindEngine\"\r\n\r\n// Re-export all sub-entries directly for convenience\r\nexport * from \"./compiler\"\r\nexport * from \"./parser\"\r\nexport * from \"./analyzer\"\r\nexport * from \"./cache\"\r\nexport * from \"./redis\"\r\nexport * from \"./watch\"\r\n\r\n","/**\r\n * tailwind-styled-v4 — Turbopack / Webpack Loader\r\n *\r\n * QA #7: Router-aware loader dengan:\r\n * - App Router vs Pages Router detection\r\n * - Directive preservation (use client / use server)\r\n * - Version-specific Next.js optimizations\r\n * - Source map passthrough\r\n * - Skip non-component files (node_modules, .d.ts, already transformed)\r\n */\r\n\r\nimport { type LoaderOutput, runLoaderTransform, registerFileClasses } from \"@tailwind-styled/compiler/internal\"\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\n\r\n// ── Static CSS writer (identik dengan webpackLoader.ts) ─────────────────────\r\nconst _writtenRules = new Set<string>()\r\n\r\nfunction appendStaticCssToFile(staticCss: string, safelistPath: string): void {\r\n if (!staticCss.trim() || !safelistPath) return\r\n const stateFilePath = path.join(path.dirname(safelistPath), \"_tw-state-static.css\")\r\n const newRules: string[] = []\r\n for (const chunk of staticCss.split(/(?<=\\})\\s*/)) {\r\n const rule = chunk.trim()\r\n if (rule && !_writtenRules.has(rule)) {\r\n _writtenRules.add(rule)\r\n newRules.push(rule)\r\n }\r\n }\r\n if (newRules.length === 0) return\r\n try {\r\n fs.mkdirSync(path.dirname(stateFilePath), { recursive: true })\r\n if (!fs.existsSync(stateFilePath)) {\r\n fs.writeFileSync(\r\n stateFilePath,\r\n `/* _tw-state-static.css — Auto-generated by tailwind-styled-v4. DO NOT EDIT.\\n` +\r\n ` * Import di globals.css: @import \"./_tw-state-static.css\";\\n` +\r\n ` * Berisi: state CSS (.tw-s-*[data-*=\"true\"]) + container queries (@container .tw-cq-*).\\n` +\r\n ` */\\n\\n`,\r\n \"utf-8\"\r\n )\r\n }\r\n fs.appendFileSync(stateFilePath, newRules.join(\"\\n\") + \"\\n\", \"utf-8\")\r\n } catch { /* non-fatal */ }\r\n}\r\n\r\nexport interface TurbopackContext {\r\n /** Absolute path ke file yang sedang di-transform */\r\n resourcePath: string\r\n /** Next.js version (jika di-inject oleh withTailwindStyled) */\r\n query?: Record<string, unknown>\r\n}\r\n\r\nexport interface TurbopackLoaderOptions {\r\n addDataAttr?: boolean | string\r\n autoClientBoundary?: boolean | string\r\n hoist?: boolean | string\r\n preserveImports?: boolean | string\r\n /** Debug mode — log transform details */\r\n debug?: boolean | string\r\n /** Explicit Next.js major version */\r\n nextMajor?: number | string\r\n /** Path ke safelist CSS file — di-inject oleh withTailwindStyled (dev only) */\r\n safelistPath?: string\r\n}\r\n\r\nfunction parseBool(val: boolean | string | undefined, fallback = false): boolean {\r\n if (typeof val === \"boolean\") return val\r\n if (typeof val === \"string\") return val === \"true\" || val === \"1\"\r\n return fallback\r\n}\r\n\r\nfunction parseNum(val: number | string | undefined): number | undefined {\r\n if (typeof val === \"number\") return val\r\n if (typeof val === \"string\") return parseInt(val, 10) || undefined\r\n return undefined\r\n}\r\n\r\nfunction detectRouter(resourcePath: string): \"app\" | \"pages\" | \"unknown\" {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n if (/\\/app\\//.test(normalized)) return \"app\"\r\n if (/\\/pages\\//.test(normalized)) return \"pages\"\r\n return \"unknown\"\r\n}\r\n\r\n/**\r\n * Next.js App Router entry-point files yang TIDAK boleh diproses loader ini.\r\n *\r\n * Turbopack tidak support `exclude` di rule level seperti webpack, sehingga\r\n * *.tsx glob akan match layout.tsx, page.tsx, dll. Guard ini memastikan loader\r\n * skip file-file tersebut secara eksplisit — identik dengan NEXT_RSC_ENTRIES\r\n * di withTailwindStyled.ts yang hanya efektif untuk webpack path.\r\n *\r\n * Tanpa guard ini: loader menyentuh layout.tsx → Next.js/React Compiler\r\n * kehilangan sinyal pure RSC → locale injection dari Accept-Language header\r\n * (Next.js 16+) tidak konsisten antara SSR pass dan hydration pass →\r\n * hydration mismatch `lang=\"id\"` vs `lang=\"en\"`.\r\n */\r\nconst NEXT_RSC_ENTRIES =\r\n /(?:^|[\\\\/])(?:layout|page|loading|error|not-found|template|default)\\.[jt]sx?$/\r\n\r\nfunction isSkippable(resourcePath: string): boolean {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n return (\r\n normalized.includes(\"/node_modules/\") ||\r\n normalized.endsWith(\".d.ts\") ||\r\n normalized.endsWith(\".d.mts\") ||\r\n normalized.endsWith(\".d.cts\") ||\r\n // Skip CSS/assets\r\n /\\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized) ||\r\n // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,\r\n // jadi guard ini menggantikan NEXT_RSC_ENTRIES exclude yang ada di webpack path.\r\n NEXT_RSC_ENTRIES.test(normalized)\r\n )\r\n}\r\n\r\n/** Extract directive line dari source */\r\nfunction extractDirective(source: string): { directive: string; stripped: string } {\r\n const match = source.match(/^(\\s*[\"'](use client|use server)[\"']\\s*;?\\s*\\n?)/)\r\n if (!match) return { directive: \"\", stripped: source }\r\n const directive = match[1].trim().replace(/['\"]/g, '\"') + \"\\n\"\r\n const stripped = source.slice(match[0].length)\r\n return { directive, stripped }\r\n}\r\n\r\n\r\n// ─── Per-file safelist writer ─────────────────────────────────────────────────\r\n// Turbopack tidak punya afterCompile hook dan bisa spawn multiple workers.\r\n// Solusi: tiap file menulis file CSS-nya sendiri di .next/tw-classes/<slug>.css\r\n// Tailwind scan seluruh direktori via @source \".next/tw-classes/**\"\r\n// Tidak ada race condition karena tiap file punya output path unik.\r\n//\r\n// Stale file handling:\r\n// - Setiap dev server start, Next.js hapus .next/ → tw-classes/ otomatis hilang\r\n// - Setiap compile cycle, TwSafelistDevPlugin (webpack) clear tw-classes/\r\n// - Turbopack: pakai _cycle sentinel file — kalau cycle berubah, clear dulu\r\n\r\n// ─── Cycle ID ─────────────────────────────────────────────────────────────────\r\n// withTailwindStyled menulis _start.txt saat wrap() dipanggil (= saat next.config.ts\r\n// di-load, yaitu sekali per dev server start). Setiap compile cycle Turbopack,\r\n// loader baca _start.txt dan compare dengan _cycle.txt di tw-classes/:\r\n//\r\n// _start.txt = timestamp dev server start (ditulis withTailwindStyled)\r\n// _cycle.txt = timestamp cycle terakhir (ditulis loader pertama di tiap cycle)\r\n//\r\n// Kalau _cycle.txt != _start.txt → compile cycle baru → clear tw-classes/ dulu.\r\n// Ini solve masalah \"file yang dihapus tetap ada di safelist\" tanpa butuh hook.\r\n\r\nconst CYCLE_SENTINEL = \"_cycle.txt\"\r\nconst START_SENTINEL = \"_start.txt\"\r\n\r\n// Cached per worker instance — hindari readFileSync berulang di file yang sama\r\nconst _workerCache = new Map<string, string>()\r\n\r\nfunction getTwClassesDir(safelistPath: string): string {\r\n return path.join(path.dirname(safelistPath), \"tw-classes\")\r\n}\r\n\r\nfunction readSentinel(filePath: string): string {\r\n try { return fs.readFileSync(filePath, \"utf-8\").trim() } catch { return \"\" }\r\n}\r\n\r\n// Lock untuk serialisasi clearAndMarkCycle di dalam satu worker process.\r\n// Turbopack bisa spawn multiple concurrent loader calls — tanpa lock,\r\n// dua worker bisa clear tw-classes/ bersamaan → window dimana semua file\r\n// hilang → Tailwind scan → CSS output kosong → FLICKER.\r\n// Lock ini hanya efektif dalam satu Node.js process (per worker), tapi itu cukup\r\n// karena Turbopack menggunakan single-threaded Node.js per worker.\r\nlet _clearLock = false\r\n\r\nfunction clearAndMarkCycle(twClassesDir: string, startId: string): void {\r\n // Sudah ada clear yang sedang berjalan di worker ini — skip, biarkan yang pertama selesai.\r\n // Worker lain yang mungkin sudah clear duluan akan tulis _cycle.txt → kita akan\r\n // melihat cachedCycle === startId di iterasi berikutnya dan skip juga.\r\n if (_clearLock) return\r\n _clearLock = true\r\n try {\r\n if (fs.existsSync(twClassesDir)) {\r\n // Rename-then-recreate strategy: rename folder lama dulu, lalu buat folder baru kosong,\r\n // baru hapus folder lama. Ini memastikan tidak ada window dimana tw-classes/ tidak ada\r\n // atau kosong (yang akan bikin Tailwind re-scan dan generate CSS tanpa classes → flicker).\r\n const tempDir = `${twClassesDir}_clearing_${Date.now()}`\r\n try {\r\n fs.renameSync(twClassesDir, tempDir)\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n // Copy _start.txt ke folder baru sebelum hapus folder lama\r\n const startFile = path.join(tempDir, START_SENTINEL)\r\n if (fs.existsSync(startFile)) {\r\n fs.copyFileSync(startFile, path.join(twClassesDir, START_SENTINEL))\r\n }\r\n // Copy _webpack-merged.css kalau ada\r\n const mergedFile = path.join(tempDir, \"_webpack-merged.css\")\r\n if (fs.existsSync(mergedFile)) {\r\n fs.copyFileSync(mergedFile, path.join(twClassesDir, \"_webpack-merged.css\"))\r\n }\r\n // Tulis _cycle.txt di folder baru SEBELUM hapus folder lama\r\n // Ini pastikan tw-classes/ selalu punya content valid\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n // Baru hapus folder lama secara async — tidak blokir compile\r\n fs.rmSync(tempDir, { recursive: true, force: true })\r\n } catch {\r\n // Fallback ke cara lama jika rename gagal (mis. cross-device)\r\n for (const file of fs.readdirSync(twClassesDir)) {\r\n if (file === START_SENTINEL || file === \"_webpack-merged.css\") continue\r\n try { fs.unlinkSync(path.join(twClassesDir, file)) } catch { /* non-fatal */ }\r\n }\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n }\r\n } else {\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n fs.writeFileSync(path.join(twClassesDir, CYCLE_SENTINEL), startId, \"utf-8\")\r\n _workerCache.set(twClassesDir, startId)\r\n }\r\n } catch { /* non-fatal */ } finally {\r\n _clearLock = false\r\n }\r\n}\r\n\r\nfunction getPerFileSafelistPath(safelistDir: string, resourcePath: string): string {\r\n const normalized = resourcePath.replace(/\\\\/g, \"/\")\r\n const slug = normalized\r\n .replace(/^.*\\/src\\//, \"\")\r\n .replace(/\\.[tj]sx?$/, \"\")\r\n .replace(/[^a-zA-Z0-9]/g, \"_\")\r\n .slice(0, 80)\r\n return path.join(safelistDir, `${slug}.css`)\r\n}\r\n\r\nfunction writePerFileSafelist(\r\n safelistPath: string | undefined,\r\n resourcePath: string,\r\n classes: string[]\r\n): void {\r\n if (!safelistPath || classes.length === 0) return\r\n try {\r\n const twClassesDir = getTwClassesDir(safelistPath)\r\n\r\n // Baca start ID dari _start.txt (ditulis withTailwindStyled saat config load)\r\n const startId = readSentinel(path.join(twClassesDir, START_SENTINEL))\r\n\r\n // Compare dengan cycle ID terakhir — pakai in-memory cache dulu, fallback ke disk\r\n const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(path.join(twClassesDir, CYCLE_SENTINEL))\r\n\r\n if (startId && cachedCycle !== startId) {\r\n // Compile cycle baru — clear tw-classes/ dan tulis _cycle.txt baru\r\n clearAndMarkCycle(twClassesDir, startId)\r\n } else if (!fs.existsSync(twClassesDir)) {\r\n fs.mkdirSync(twClassesDir, { recursive: true })\r\n }\r\n\r\n const outPath = getPerFileSafelistPath(twClassesDir, resourcePath)\r\n const sorted = [...new Set(classes)].sort()\r\n const css = [\r\n `/* tw-safelist: ${path.basename(resourcePath)} — auto-generated */`,\r\n \"@layer utilities {\",\r\n sorted.map((cls) => `.${cls.replace(/([^a-zA-Z0-9_-])/g, \"\\\\$1\")} {}`).join(\"\\n\"),\r\n \"}\",\r\n ].join(\"\\n\")\r\n\r\n // Skip write jika isi sama — avoid Tailwind re-scan yang tidak perlu\r\n try {\r\n if (fs.readFileSync(outPath, \"utf-8\") === css) return\r\n } catch { /* file belum ada, lanjut write */ }\r\n\r\n // Atomic write: tulis ke temp file dulu, lalu rename ke path final.\r\n // Ini mencegah Tailwind scanner membaca file yang sedang ditulis (partial read)\r\n // yang akan menghasilkan CSS incomplete → FLICKER.\r\n // rename() dijamin atomic di semua OS modern (POSIX dan Windows NTFS).\r\n const tmpPath = `${outPath}.tmp`\r\n try {\r\n fs.writeFileSync(tmpPath, css, \"utf-8\")\r\n fs.renameSync(tmpPath, outPath)\r\n } catch {\r\n // Fallback kalau rename gagal (mis. cross-device, Windows lock)\r\n try { fs.unlinkSync(tmpPath) } catch { /* ignore */ }\r\n fs.writeFileSync(outPath, css, \"utf-8\")\r\n }\r\n } catch {\r\n // Non-fatal\r\n }\r\n}\r\n\r\n/**\r\n * Main loader function — compatible dengan Turbopack, Webpack 5, rspack.\r\n */\r\nexport default function turbopackLoader(\r\n this: TurbopackContext,\r\n source: string,\r\n options: TurbopackLoaderOptions = {}\r\n): string {\r\n // Skip files yang tidak perlu di-transform\r\n if (isSkippable(this.resourcePath)) return source\r\n\r\n // Detect router context\r\n const router = detectRouter(this.resourcePath)\r\n const nextMajor = parseNum(options.nextMajor)\r\n const debug = parseBool(options.debug)\r\n const filename = path.basename(this.resourcePath)\r\n\r\n // Build effective options berdasarkan router context\r\n const effective = {\r\n addDataAttr: parseBool(options.addDataAttr),\r\n // App Router: selalu auto-detect client boundary\r\n // Pages Router: opt-in via option\r\n autoClientBoundary: router === \"app\" ? true : parseBool(options.autoClientBoundary),\r\n // Hoist by default untuk semua contexts\r\n hoist: parseBool(options.hoist, true),\r\n // Pages Router: preserve imports (RSC tidak berlaku)\r\n preserveImports: router === \"pages\" ? true : parseBool(options.preserveImports, false),\r\n }\r\n\r\n if (debug) {\r\n console.debug(`[tw-loader] ${filename}: router=${router} nextMajor=${nextMajor ?? \"unknown\"}`)\r\n }\r\n\r\n // Preserve directive (use client / use server)\r\n const { directive, stripped } = extractDirective(source)\r\n\r\n // ── Hash pre-embedding (build-time optimization) ────────────────────────\r\n // Inject `__hash: \"abc123\"` ke semua tw() calls yang punya states config.\r\n // stateEngine.ts akan pakai __hash langsung — skip runtime hashState() computation.\r\n // Zero dependency baru: pakai Rust NAPI yang sama dengan compiler.\r\n let processedSource = stripped\r\n try {\r\n const compilerMod = require(\"@tailwind-styled/compiler/internal\") as {\r\n injectStateHash?: (source: string, filename: string) => { code: string; changed: boolean; injectedCount: number }\r\n }\r\n if (typeof compilerMod?.injectStateHash === \"function\" && stripped.includes(\"states:\")) {\r\n const hashResult = compilerMod.injectStateHash(stripped, this.resourcePath)\r\n if (hashResult.changed) {\r\n processedSource = hashResult.code\r\n if (debug) {\r\n console.debug(`[tw-loader] ${filename}: injected __hash for ${hashResult.injectedCount} component(s)`)\r\n }\r\n }\r\n }\r\n } catch {\r\n // injectStateHash tidak tersedia (binary belum di-rebuild) — skip, tidak fatal\r\n }\r\n\r\n try {\r\n const output: LoaderOutput = runLoaderTransform({\r\n filepath: this.resourcePath,\r\n source: processedSource,\r\n options: effective,\r\n })\r\n\r\n // Tidak ada perubahan — Rust kembalikan source asli (bukan string kosong).\r\n // Guard lama `!output.code.length` selalu false karena code = original source.\r\n // Fix: cukup cek changed flag saja; return source asli agar Next.js RSC boundary\r\n // tetap intact dan tidak ada interaksi dengan React Compiler locale detection.\r\n if (!output.changed) {\r\n // Meski tidak ada transform, tetap tulis safelist kalau ada classes yang ditemukan.\r\n // Object config style (tw.div({...})) tidak butuh transform tapi tetap punya classes.\r\n if (output.classes.length > 0) {\r\n writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes)\r\n }\r\n // Tetap collect static CSS meski file tidak di-transform\r\n if (output.staticCss && options.safelistPath) {\r\n appendStaticCssToFile(output.staticCss, options.safelistPath)\r\n }\r\n return source\r\n }\r\n\r\n // Register classes untuk route map (dipakai webpack dev plugin & build manifest)\r\n if (output.classes.length > 0) {\r\n registerFileClasses(this.resourcePath, output.classes)\r\n // Turbopack: tulis per-file safelist langsung dari loader.\r\n // Race-condition-safe karena tiap file punya output path unik.\r\n writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes)\r\n }\r\n\r\n // ── Append static CSS (state + container) ──────────────────────────────\r\n if (output.staticCss && options.safelistPath) {\r\n appendStaticCssToFile(output.staticCss, options.safelistPath)\r\n }\r\n\r\n // Re-attach directive di depan\r\n if (!directive) return output.code\r\n\r\n // Strip any duplicate directives yang mungkin diinject oleh compiler\r\n const clean = output.code.replace(/^\\s*[\"'](use client|use server)[\"']\\s*;?\\s*\\n?/, \"\")\r\n return directive + clean\r\n } catch (err) {\r\n // Loader harus tidak pernah throw — return source asli dengan warning\r\n const msg = err instanceof Error ? err.message : String(err)\r\n if (debug) {\r\n console.warn(`[tw-loader] transform failed for ${filename}: ${msg}`)\r\n }\r\n return source\r\n }\r\n}"]}