tailwind-styled-v4 5.0.11 → 5.0.12

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 (107) hide show
  1. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  2. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  3. package/dist/analyzer.d.mts +4 -4
  4. package/dist/analyzer.d.ts +4 -4
  5. package/dist/analyzer.js +34 -69
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +33 -68
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +11 -11
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +11 -11
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +16 -7
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +16 -7
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +262 -190
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +259 -187
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +2543 -109
  22. package/dist/compiler.d.ts +2543 -109
  23. package/dist/compiler.js +1962 -435
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +1816 -382
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/devtools.js +17 -4
  28. package/dist/devtools.js.map +1 -1
  29. package/dist/devtools.mjs +17 -4
  30. package/dist/devtools.mjs.map +1 -1
  31. package/dist/engine.d.mts +11 -470
  32. package/dist/engine.d.ts +11 -470
  33. package/dist/engine.js +1442 -417
  34. package/dist/engine.js.map +1 -1
  35. package/dist/engine.mjs +1442 -417
  36. package/dist/engine.mjs.map +1 -1
  37. package/dist/index-BDQw13kn.d.ts +464 -0
  38. package/dist/index-DJv28Uzq.d.mts +464 -0
  39. package/dist/index.browser.mjs +143 -255
  40. package/dist/index.browser.mjs.map +1 -1
  41. package/dist/index.d.mts +23 -39
  42. package/dist/index.d.ts +23 -39
  43. package/dist/index.js +6000 -1463
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +5995 -1458
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/next.d.mts +44 -1
  48. package/dist/next.d.ts +44 -1
  49. package/dist/next.js +3197 -1128
  50. package/dist/next.js.map +1 -1
  51. package/dist/next.mjs +3196 -1129
  52. package/dist/next.mjs.map +1 -1
  53. package/dist/rspack.d.mts +9 -0
  54. package/dist/rspack.d.ts +9 -0
  55. package/dist/rspack.js +99 -61
  56. package/dist/rspack.js.map +1 -1
  57. package/dist/rspack.mjs +99 -61
  58. package/dist/rspack.mjs.map +1 -1
  59. package/dist/runtime-css.d.mts +8 -0
  60. package/dist/runtime-css.d.ts +8 -0
  61. package/dist/runtime-css.js +23 -7
  62. package/dist/runtime-css.js.map +1 -1
  63. package/dist/runtime-css.mjs +23 -7
  64. package/dist/runtime-css.mjs.map +1 -1
  65. package/dist/scanner.js +16 -37
  66. package/dist/scanner.js.map +1 -1
  67. package/dist/scanner.mjs +15 -36
  68. package/dist/scanner.mjs.map +1 -1
  69. package/dist/shared.d.mts +107 -1
  70. package/dist/shared.d.ts +107 -1
  71. package/dist/shared.js +1627 -376
  72. package/dist/shared.js.map +1 -1
  73. package/dist/shared.mjs +1620 -354
  74. package/dist/shared.mjs.map +1 -1
  75. package/dist/svelte.js +39 -35
  76. package/dist/svelte.js.map +1 -1
  77. package/dist/svelte.mjs +38 -34
  78. package/dist/svelte.mjs.map +1 -1
  79. package/dist/theme.js +85 -76
  80. package/dist/theme.js.map +1 -1
  81. package/dist/theme.mjs +83 -74
  82. package/dist/theme.mjs.map +1 -1
  83. package/dist/turbopackLoader.js +943 -76
  84. package/dist/turbopackLoader.js.map +1 -1
  85. package/dist/turbopackLoader.mjs +943 -76
  86. package/dist/turbopackLoader.mjs.map +1 -1
  87. package/dist/tw.js +262 -190
  88. package/dist/tw.js.map +1 -1
  89. package/dist/tw.mjs +259 -187
  90. package/dist/tw.mjs.map +1 -1
  91. package/dist/vite.js +1336 -296
  92. package/dist/vite.js.map +1 -1
  93. package/dist/vite.mjs +1336 -296
  94. package/dist/vite.mjs.map +1 -1
  95. package/dist/vue.js +39 -35
  96. package/dist/vue.js.map +1 -1
  97. package/dist/vue.mjs +38 -34
  98. package/dist/vue.mjs.map +1 -1
  99. package/dist/webpackLoader.js +140 -34
  100. package/dist/webpackLoader.js.map +1 -1
  101. package/dist/webpackLoader.mjs +140 -34
  102. package/dist/webpackLoader.mjs.map +1 -1
  103. package/native/index.node +0 -0
  104. package/native/tailwind-styled-native.node +0 -0
  105. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  106. package/package.json +9 -4
  107. package/CHANGELOG.md +0 -285
@@ -18,11 +18,122 @@ interface NativeRscResult {
18
18
  needsClientDirective: boolean;
19
19
  clientReasons: string[];
20
20
  }
21
+ interface ScanWorkspaceResult {
22
+ files: string[];
23
+ total_files: number;
24
+ classes: string[];
25
+ unique_classes: number;
26
+ duration_ms: number;
27
+ errors: string[];
28
+ }
29
+ interface ScanFileResult {
30
+ file: string;
31
+ classes: string[];
32
+ class_count: number;
33
+ has_tw_usage: boolean;
34
+ size_bytes: number;
35
+ duration_ms: number;
36
+ }
37
+ interface BatchExtractResult {
38
+ file: string;
39
+ classes: string[];
40
+ contentHash: string;
41
+ ok: boolean;
42
+ error?: string;
43
+ }
44
+ interface SafelistCheckResult {
45
+ matched: string[];
46
+ unmatched: string[];
47
+ safelistSize: number;
48
+ }
49
+ interface PrefilterFileResult {
50
+ file: string;
51
+ has_tw_usage: boolean;
52
+ duration_ms: number;
53
+ size_bytes: number;
54
+ status: "processed" | "skipped" | "error";
55
+ error?: string;
56
+ }
57
+ interface DeadCodeResult {
58
+ deadInCss: string[];
59
+ deadInSource: string[];
60
+ liveClasses: string[];
61
+ totalCssClasses: number;
62
+ totalSourceClasses: number;
63
+ }
64
+ interface ProcessedCssResult {
65
+ css: string;
66
+ size_bytes: number;
67
+ resolved_classes: string[];
68
+ unknown_classes: string[];
69
+ }
70
+ interface ContainerConfig {
71
+ tag: string;
72
+ containerJson: string;
73
+ containerName?: string;
74
+ breakpoints: Array<{
75
+ key: string;
76
+ classes: string;
77
+ }>;
78
+ }
79
+ interface HoistResult {
80
+ code: string;
81
+ hoisted: string[];
82
+ warnings: string[];
83
+ }
84
+ interface VariantTableResult {
85
+ id: string;
86
+ tableJson: string;
87
+ keys: string[];
88
+ defaultKey: string;
89
+ combinations: number;
90
+ }
91
+ interface ClassifyResult {
92
+ className: string;
93
+ bucket: string;
94
+ sortOrder: number;
95
+ }
96
+ interface MergeResult {
97
+ declarationsJson: string;
98
+ declarationString: string;
99
+ count: number;
100
+ }
101
+ interface ClassUsageItem {
102
+ className: string;
103
+ usageCount: number;
104
+ filesJson: string;
105
+ bundleSizeBytes: number;
106
+ isDeadCode: boolean;
107
+ }
108
+ interface StateCssConfig {
109
+ tag: string;
110
+ componentName: string;
111
+ statesJson: string;
112
+ sourceFile: string;
113
+ }
114
+ interface GeneratedStateCss {
115
+ selector: string;
116
+ declarations: string;
117
+ cssRule: string;
118
+ componentName: string;
119
+ stateName: string;
120
+ }
21
121
  interface NativeBridge {
122
+ generateCssNative?: (classes: string[], theme_json: string) => string;
123
+ getCacheStats?: () => [number, number];
124
+ clearThemeCache?: () => void;
22
125
  transformSource?: (source: string, opts?: Record<string, string>) => NativeTransformResult | null;
23
126
  extractClassesFromSource?: (source: string) => string[];
24
127
  hasTwUsage?: (source: string) => boolean;
25
128
  isAlreadyTransformed?: (source: string) => boolean;
129
+ scan_workspace?: (root: string, extensions?: string[]) => ScanWorkspaceResult;
130
+ extract_classes_from_source?: (source: string) => string[];
131
+ batch_extract_classes?: (filePaths: string[]) => BatchExtractResult[];
132
+ check_against_safelist?: (classes: string[], safelist: string[]) => SafelistCheckResult;
133
+ scan_file?: (filePath: string) => ScanFileResult;
134
+ collect_files?: (root: string, extensions?: string[]) => string[];
135
+ walk_and_prefilter_source_files?: (root: string, extensions?: string[]) => PrefilterFileResult[];
136
+ generate_sub_component_types?: (root: string, outputPath?: string) => string;
26
137
  extractAllClasses?: (source: string) => string[];
27
138
  parseClasses?: (raw: string) => Array<{
28
139
  raw: string;
@@ -55,35 +166,11 @@ interface NativeBridge {
55
166
  unmatched: string[];
56
167
  safelistSize: number;
57
168
  };
58
- hoistComponents?: (source: string) => {
59
- code: string;
60
- hoisted: string[];
61
- warnings: string[];
62
- };
63
- compileVariantTable?: (configJson: string) => {
64
- id: string;
65
- tableJson: string;
66
- keys: string[];
67
- defaultKey: string;
68
- combinations: number;
69
- };
70
- classifyAndSortClasses?: (classes: string[]) => Array<{
71
- className: string;
72
- bucket: string;
73
- sortOrder: number;
74
- }>;
75
- mergeCssDeclarations?: (cssChunks: string[]) => {
76
- declarationsJson: string;
77
- declarationString: string;
78
- count: number;
79
- };
80
- analyzeClassUsage?: (classes: string[], scanResultJson: string, css: string) => Array<{
81
- className: string;
82
- usageCount: number;
83
- filesJson: string;
84
- bundleSizeBytes: number;
85
- isDeadCode: boolean;
86
- }>;
169
+ hoistComponents?: (source: string) => HoistResult;
170
+ compileVariantTable?: (configJson: string) => VariantTableResult;
171
+ classifyAndSortClasses?: (classes: string[]) => ClassifyResult[];
172
+ mergeCssDeclarations?: (cssChunks: string[]) => MergeResult;
173
+ analyzeClassUsage?: (classes: string[], scanResultJson: string, css: string) => ClassUsageItem[];
87
174
  analyzeRsc?: (source: string, filename: string) => {
88
175
  isServer: boolean;
89
176
  needsClientDirective: boolean;
@@ -104,19 +191,8 @@ interface NativeBridge {
104
191
  };
105
192
  compileCssLightning?: (classes: string[]) => string;
106
193
  /** Post-process raw Tailwind-generated CSS dengan LightningCSS di Rust */
107
- detectDeadCode?: (scanResultJson: string, css: string) => {
108
- deadInCss: string[];
109
- deadInSource: string[];
110
- liveClasses: string[];
111
- totalCssClasses: number;
112
- totalSourceClasses: number;
113
- };
114
- processTailwindCssLightning?: (css: string) => {
115
- css: string;
116
- size_bytes: number;
117
- resolved_classes: string[];
118
- unknown_classes: string[];
119
- };
194
+ detectDeadCode?: (scanResultJson: string, css: string) => DeadCodeResult;
195
+ processTailwindCssLightning?: (css: string) => ProcessedCssResult;
120
196
  processTailwindCssWithTargets?: (css: string, targets: string | null) => {
121
197
  css: string;
122
198
  size_bytes: number;
@@ -129,42 +205,2404 @@ interface NativeBridge {
129
205
  calculateImpact?: (impactJson: string) => string;
130
206
  calculateRisk?: (className: string, totalComponents: number) => string;
131
207
  calculateSavings?: (bundleSizeBytes: number, componentCount: number) => number;
208
+ extractTwStateConfigs?: (source: string, filename: string) => StateCssConfig[];
209
+ generateStaticStateCss?: (inputs: Array<{
210
+ tag: string;
211
+ componentName: string;
212
+ statesJson: string;
213
+ }>, resolvedCss: string | null) => GeneratedStateCss[];
214
+ extractAndGenerateStateCss?: (source: string, filename: string) => GeneratedStateCss[];
215
+ /**
216
+ * Convert layout/utility class string ke CSS declarations.
217
+ * Dipakai oleh extractContainerCssFromSource sebagai Rust-accelerated fallback.
218
+ */
219
+ layoutClassesToCss?: (classes: string) => string;
220
+ /**
221
+ * Hash string dengan algoritma tertentu, return n karakter pertama.
222
+ * Dipakai untuk generate deterministic container CSS IDs.
223
+ */
224
+ hashContent?: (input: string, algo: string, length: number) => string;
225
+ /** Hapus dead CSS selectors + minify via Lightning CSS. */
226
+ eliminateDeadCss?: (css: string, deadClasses: string[]) => string;
227
+ /** Dead code detection + strip + Lightning CSS minify dalam satu call. */
228
+ optimizeCss?: (css: string) => string;
229
+ /** Extract tw container configs dari source untuk static @container CSS generation. */
230
+ extractTwContainerConfigs?: (source: string) => Array<{
231
+ tag: string;
232
+ containerJson: string;
233
+ containerName?: string;
234
+ breakpoints: Array<{
235
+ key: string;
236
+ classes: string;
237
+ }>;
238
+ }>;
239
+ get_cache_statistics?: () => string;
240
+ clear_all_caches?: () => void;
241
+ clear_parse_cache?: () => void;
242
+ clear_resolve_cache?: () => void;
243
+ clear_compile_cache?: () => void;
244
+ clear_css_gen_cache?: () => void;
245
+ get_cache_optimization_hints?: (hit_rate_percent: number, memory_used_mb: number) => string;
246
+ estimate_optimal_cache_config_native?: (total_budget_mb: number, workload_type: string) => string;
247
+ cache_read?: (cache_path: string) => {
248
+ entries_json: string;
249
+ };
250
+ cache_write?: (cache_path: string, entries: Array<{
251
+ file: string;
252
+ content_hash: string;
253
+ classes: string[];
254
+ mtime_ms: number;
255
+ size_bytes: number;
256
+ }>) => boolean;
257
+ cache_priority?: (mtime_ms: number, size_bytes: number, hit_count: number) => number;
258
+ resolve_variants?: (configJson: string) => string;
259
+ validate_variant_config?: (configJson: string) => string;
260
+ resolve_cascade?: (baseThemeJson: string, overridesJson: string) => string;
261
+ resolve_class_names?: (classNames: string[], themeJson: string) => string;
262
+ resolve_conflict_group?: (groupName: string, themeJson: string) => string;
263
+ resolve_theme_value?: (keyPath: string, themeJson: string) => string | null;
264
+ resolve_simple_variants?: (configJson: string) => string;
265
+ process_file_change?: (fileChangeJson: string) => string;
266
+ compute_incremental_diff?: (oldScanJson: string, newScanJson: string) => string;
267
+ create_fingerprint?: (filePath: string, fileContent: string) => string;
268
+ inject_state_hash?: (css: string, stateHash: string) => string;
269
+ prune_stale_entries?: (maxAgeSeconds: number, maxEntries: number) => string;
270
+ rebuild_workspace_result?: (rootDir: string, extensions?: string[]) => string;
271
+ scan_file_native?: (filePath: string, fileContent: string) => string;
272
+ scan_files_batch_native?: (filesJson: string) => string;
273
+ compile_class?: (input: string) => string;
274
+ compile_classes?: (inputs: string[]) => string;
275
+ compile_to_css?: (input: string, minify: boolean) => string;
276
+ compile_to_css_batch?: (inputs: string[], minify: boolean) => string;
277
+ minify_css?: (css: string) => string;
278
+ compile_animation?: (animationName: string, from: string, to: string) => string;
279
+ compile_keyframes?: (name: string, stopsJson: string) => string;
280
+ compile_theme?: (tokensJson: string, themeName: string, prefix: string) => string;
281
+ tw_merge?: (classString: string) => string;
282
+ tw_merge_many?: (classStrings: string[]) => string;
283
+ tw_merge_with_separator?: (classString: string, options: Record<string, unknown>) => string;
284
+ tw_merge_many_with_separator?: (classStrings: string[], options: Record<string, unknown>) => string;
285
+ tw_merge_raw?: (classLists: string[]) => string;
286
+ id_registry_create?: () => number;
287
+ id_registry_generate?: (handle: number, name: string) => number;
288
+ id_registry_lookup?: (handle: number, name: string) => number;
289
+ id_registry_next?: (handle: number) => number;
290
+ id_registry_destroy?: (handle: number) => void;
291
+ id_registry_reset?: (handle: number) => void;
292
+ id_registry_snapshot?: (handle: number) => string;
293
+ id_registry_active_count?: () => number;
294
+ register_property_name?: (propertyName: string) => number;
295
+ register_value_name?: (valueName: string) => number;
296
+ property_id_to_string?: (propertyId: number) => string;
297
+ value_id_to_string?: (valueId: number) => string;
298
+ reverse_lookup_property?: (propertyId: number) => string;
299
+ reverse_lookup_value?: (valueId: number) => string;
300
+ id_registry_export?: (handle: number) => string;
301
+ id_registry_import?: (importedData: string) => number;
302
+ redis_ping?: () => string;
303
+ redis_get?: (key: string) => string;
304
+ redis_set?: (key: string, value: string, ttl_seconds?: number) => string;
305
+ redis_delete?: (key: string) => number;
306
+ redis_exists?: (key: string) => number;
307
+ redis_mget?: (keys: string[]) => string;
308
+ redis_mset?: (pairs: Array<[string, string]>) => string;
309
+ redis_flush_db?: () => number;
310
+ redis_flush_all?: () => number;
311
+ redis_pool_connect?: (host: string, port: number, pool_size?: number) => string;
312
+ redis_pool_stats?: () => string;
313
+ redis_pool_reconnect?: () => string;
314
+ redis_enable_cluster?: (initial_nodes: string[]) => string;
315
+ redis_disable_cluster?: () => string;
316
+ redis_cluster_status?: () => string;
317
+ redis_subscribe?: (channel: string) => string;
318
+ redis_publish?: (channel: string, message: string) => number;
319
+ redis_expiration_set?: (key: string, ttl_seconds: number) => number;
320
+ redis_expiration_get?: (key: string) => string;
321
+ redis_info?: () => string;
322
+ redis_monitor?: () => string;
323
+ redis_cache_size?: () => number;
324
+ redis_cache_key_count?: () => number;
325
+ redis_cache_clear?: () => number;
326
+ redis_cache_hit_rate?: () => number;
327
+ redis_enable_persistence?: (mode: string) => string;
328
+ redis_disable_persistence?: () => string;
329
+ redis_snapshot?: () => string;
330
+ redis_memory_stats?: () => string;
331
+ redis_optimize_memory?: () => number;
332
+ redis_set_eviction_policy?: (policy: string) => string;
333
+ redis_get_eviction_policy?: () => string;
334
+ redis_replicate?: (target_host: string, target_port: number) => number;
335
+ redis_replication_status?: () => string;
336
+ redis_cache_sync?: (peers: string[]) => number;
337
+ redis_enable_cache_warming?: (key_pattern: string) => string;
338
+ redis_disable_cache_warming?: () => string;
339
+ redis_diagnose?: () => string;
340
+ start_watch?: (root_path: string, patterns?: string[]) => number;
341
+ poll_watch_events?: (handle: number, timeout_ms?: number) => string;
342
+ stop_watch?: (handle: number) => number;
343
+ watch_add_pattern?: (handle: number, pattern: string) => string;
344
+ watch_remove_pattern?: (handle: number, pattern: string) => string;
345
+ watch_get_active_handles?: () => string;
346
+ watch_clear_all?: () => number;
347
+ watch_event_type_to_string?: (event_type_code: number) => string;
348
+ is_watch_running?: (handle: number) => boolean;
349
+ get_watch_stats?: () => string;
350
+ watch_pause?: (handle: number) => string;
351
+ watch_resume?: (handle: number) => string;
352
+ scan_cache_optimizations?: () => string;
353
+ get_plugin_hooks?: () => string;
354
+ register_plugin_hook?: (hook_name: string, handler_id: string) => string;
355
+ unregister_plugin_hook?: (hook_name: string, handler_id: string) => string;
356
+ emit_plugin_hook?: (hook_name: string, data_json: string) => string;
357
+ get_compilation_metrics?: () => string;
358
+ reset_compilation_metrics?: () => string;
359
+ validate_css_output?: (css: string) => string;
360
+ get_compiler_diagnostics?: () => string;
361
+ }
362
+ interface NativeTransformResult {
363
+ code: string;
364
+ classes: string[];
365
+ changed: boolean;
366
+ rscJson?: string;
367
+ metadataJson?: string;
368
+ }
369
+ interface ClassExtractResult {
370
+ classes: string[];
371
+ component_names: string[];
372
+ has_tw_usage: boolean;
373
+ has_use_client: boolean;
374
+ imports: string[];
375
+ }
376
+ declare const getNativeBridge: () => NativeBridge;
377
+ declare const resetNativeBridgeCache: () => void;
378
+ declare const adaptNativeResult: (raw: NativeTransformResult) => {
379
+ code: string;
380
+ classes: string[];
381
+ changed: boolean;
382
+ rsc?: NativeRscResult;
383
+ metadata?: ComponentMetadata[];
384
+ };
385
+
386
+ /**
387
+ * cssGeneratorNative.ts
388
+ *
389
+ * High-performance CSS generator using Rust compiler via NAPI binding.
390
+ * Falls back to JavaScript Tailwind if Rust binding is unavailable.
391
+ */
392
+ interface GenerateCssNativeOptions {
393
+ theme: Record<string, unknown>;
394
+ fallbackToJs?: boolean;
395
+ logFallback?: boolean;
396
+ }
397
+ /**
398
+ * Generate CSS from Tailwind classes using the Rust compiler.
399
+ *
400
+ * @param classes - Array of Tailwind class names (e.g., ["px-4", "hover:bg-blue-600"])
401
+ * @param options - Configuration including theme object
402
+ * @returns Promise resolving to CSS string
403
+ *
404
+ * @example
405
+ * ```ts
406
+ * const css = await generateCssNative(
407
+ * ["px-4", "hover:bg-blue-600", "md:text-lg"],
408
+ * {
409
+ * theme: defaultTheme,
410
+ * fallbackToJs: true,
411
+ * logFallback: process.env.DEBUG === "true"
412
+ * }
413
+ * )
414
+ * ```
415
+ *
416
+ * **Performance**: Rust compiler typically 40-60% faster than Tailwind JS
417
+ * - Rust: 60-90ms for 100 classes
418
+ * - JavaScript: 150ms baseline
419
+ *
420
+ * **Error Handling**:
421
+ * - If Rust binding fails and fallbackToJs=true, falls back to Tailwind JS
422
+ * - If Rust binding fails and fallbackToJs=false, throws error
423
+ * - Invalid classes log warnings but don't stop compilation
424
+ */
425
+ declare function generateCssNative(classes: string[], options: GenerateCssNativeOptions): Promise<string>;
426
+ /**
427
+ * Get cache statistics from the Rust compiler.
428
+ *
429
+ * @returns Object with cache hit/miss counts, or null if binding unavailable
430
+ *
431
+ * @example
432
+ * ```ts
433
+ * const stats = getCacheStats()
434
+ * if (stats) {
435
+ * console.log(`Cache hits: ${stats.hits}, misses: ${stats.misses}`)
436
+ * console.log(`Hit rate: ${(stats.hits / (stats.hits + stats.misses) * 100).toFixed(1)}%`)
437
+ * }
438
+ * ```
439
+ */
440
+ declare function getCacheStats(): {
441
+ hits: number;
442
+ misses: number;
443
+ } | null;
444
+ /**
445
+ * Clear the theme resolver cache.
446
+ *
447
+ * Useful for:
448
+ * - Testing with different themes
449
+ * - Freeing memory in long-running processes
450
+ * - Resetting state between build cycles
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * // Clear cache before each build
455
+ * clearThemeCache()
456
+ * const css = await generateCssNative(classes, { theme })
457
+ * ```
458
+ */
459
+ declare function clearThemeCache(): void;
460
+
461
+ declare function scanWorkspace(root: string, extensions?: string[]): ScanWorkspaceResult;
462
+ declare function extractClassesFromSourceNative(source: string): string[];
463
+ declare function batchExtractClassesNative(filePaths: string[]): BatchExtractResult[];
464
+ declare function checkAgainstSafelistNative(classes: string[], safelist: string[]): SafelistCheckResult;
465
+ declare function scanFile(filePath: string): ScanFileResult;
466
+ declare function collectFiles(root: string, extensions?: string[]): string[];
467
+ declare function walkAndPrefilterSourceFiles(root: string, extensions?: string[], _parallel?: boolean): PrefilterFileResult[];
468
+ declare function generateSubComponentTypes(root: string, outputPath?: string): string;
469
+
470
+ /**
471
+ * Detect dead CSS selectors in generated CSS.
472
+ */
473
+ declare function detectDeadCode(scanResultJson: string, css: string): DeadCodeResult;
474
+ /**
475
+ * Analyze class usage across scanned files.
476
+ */
477
+ declare function analyzeClassUsageNative(classes: string[], scanResultJson: string, css: string): ClassUsageItem[];
478
+ /**
479
+ * Analyze entire class list and generate CSS.
480
+ */
481
+ declare function analyzeClassesNative(filesJson: string, cwd: string, flags?: number): {
482
+ css?: string;
483
+ code: string;
484
+ classes: string[];
485
+ changed: boolean;
486
+ rscJson?: string;
487
+ metadataJson?: string;
488
+ safelist?: string[];
489
+ } | null;
490
+ /**
491
+ * Analyze React Server Component requirements.
492
+ */
493
+ declare function analyzeRscNative(source: string, filename: string): {
494
+ isServer: boolean;
495
+ needsClientDirective: boolean;
496
+ clientReasons: string[];
497
+ };
498
+ /**
499
+ * Optimize CSS by removing dead code and minifying.
500
+ */
501
+ declare function optimizeCssNative(css: string): {
502
+ css: string;
503
+ originalSize: number;
504
+ optimizedSize: number;
505
+ reductionPercentage: number;
506
+ };
507
+ /**
508
+ * Process Tailwind CSS with Lightning CSS post-processing.
509
+ */
510
+ declare function processTailwindCssLightning(css: string): ProcessedCssResult;
511
+ /**
512
+ * Eliminate dead CSS selectors.
513
+ */
514
+ declare function eliminateDeadCssNative(css: string, deadClasses: string[]): string;
515
+ /**
516
+ * Hoist components from source code.
517
+ */
518
+ declare function hoistComponentsNative(source: string): HoistResult;
519
+ /**
520
+ * Compile variant configuration table.
521
+ */
522
+ declare function compileVariantTableNative(configJson: string): VariantTableResult;
523
+ /**
524
+ * Classify and sort classes by bucket.
525
+ */
526
+ declare function classifyAndSortClassesNative(classes: string[]): ClassifyResult[];
527
+ /**
528
+ * Merge CSS declarations from multiple chunks.
529
+ */
530
+ declare function mergeCssDeclarationsNative(cssChunks: string[]): MergeResult;
531
+
532
+ /**
533
+ * Compile Tailwind classes directly to CSS.
534
+ */
535
+ declare function compileCssNative2(classes: string[], prefix?: string | null): {
536
+ css: string;
537
+ classes: string[];
538
+ };
539
+ /**
540
+ * Compile CSS using Lightning CSS post-processing.
541
+ */
542
+ declare function compileCssLightning(classes: string[]): string;
543
+ /**
544
+ * Extract Tailwind state configurations from source code.
545
+ */
546
+ declare function extractTwStateConfigsNative(source: string, filename: string): StateCssConfig[];
547
+ /**
548
+ * Generate static state CSS from configuration.
549
+ */
550
+ declare function generateStaticStateCssNative(inputs: Array<{
551
+ tag: string;
552
+ componentName: string;
553
+ statesJson: string;
554
+ }>, resolvedCss?: string | null): GeneratedStateCss[];
555
+ /**
556
+ * Extract and generate state CSS in one step.
557
+ */
558
+ declare function extractAndGenerateStateCssNative(source: string, filename: string): GeneratedStateCss[];
559
+ /**
560
+ * Convert layout/utility class string to CSS declarations.
561
+ */
562
+ declare function layoutClassesToCss(classes: string): string;
563
+ /**
564
+ * Hash content for deterministic ID generation.
565
+ */
566
+ declare function hashContent(input: string, algorithm?: string, length?: number): string;
567
+ /**
568
+ * Extract container query configurations from source.
569
+ */
570
+ declare function extractTwContainerConfigs(source: string): {
571
+ tag: string;
572
+ containerJson: string;
573
+ containerName?: string;
574
+ breakpoints: Array<{
575
+ key: string;
576
+ classes: string;
577
+ }>;
578
+ }[];
579
+ /**
580
+ * Parse Tailwind class into atomic CSS representation.
581
+ */
582
+ declare function parseAtomicClass(twClass: string): string | null;
583
+ /**
584
+ * Generate atomic CSS from rules.
585
+ */
586
+ declare function generateAtomicCss(rulesJson: string): string;
587
+ /**
588
+ * Convert Tailwind classes to atomic CSS classes.
589
+ */
590
+ declare function toAtomicClasses(twClasses: string): string;
591
+ /**
592
+ * Clear atomic CSS registry.
593
+ */
594
+ declare function clearAtomicRegistry(): void;
595
+ /**
596
+ * Get atomic registry size.
597
+ */
598
+ declare function atomicRegistrySize(): number;
599
+
600
+ /**
601
+ * cacheNative.ts
602
+ *
603
+ * Phase 5.1: Cache Management - Advanced caching strategies and optimization
604
+ * Exposes 9 cache-related Rust functions for improved performance tuning
605
+ */
606
+ /**
607
+ * Cache optimization hints and recommendations
608
+ */
609
+ interface CacheOptimizationHints {
610
+ current_strategy: string;
611
+ recommended_strategy: string;
612
+ estimated_improvement_percent: number;
613
+ suggested_memory_mb: number;
614
+ notes: string[];
615
+ }
616
+ /**
617
+ * Optimal cache configuration recommendations
618
+ */
619
+ interface OptimalCacheConfig {
620
+ parse_cache_size: number;
621
+ resolve_cache_size: number;
622
+ compile_cache_size: number;
623
+ css_gen_cache_size: number;
624
+ recommended_eviction_policy: string;
625
+ ttl_seconds: number;
626
+ expected_hit_rate_percent: number;
627
+ }
628
+ /**
629
+ * Cache statistics from all layers
630
+ */
631
+ interface CacheStatistics {
632
+ parse_cache: {
633
+ hits: number;
634
+ misses: number;
635
+ size: number;
636
+ };
637
+ resolve_cache: {
638
+ hits: number;
639
+ misses: number;
640
+ size: number;
641
+ };
642
+ compile_cache: {
643
+ hits: number;
644
+ misses: number;
645
+ size: number;
646
+ };
647
+ css_gen_cache: {
648
+ hits: number;
649
+ misses: number;
650
+ size: number;
651
+ };
652
+ overall_hit_rate: number;
653
+ total_memory_bytes: number;
654
+ }
655
+ /**
656
+ * Get comprehensive cache statistics across all layers
657
+ * Useful for monitoring and optimization
658
+ *
659
+ * @returns Cache stats including hit rates, sizes, and recommendations
660
+ * @example
661
+ * ```ts
662
+ * const stats = getCacheStatistics()
663
+ * console.log(`Overall hit rate: ${stats.overall_hit_rate}%`)
664
+ * console.log(`Total memory used: ${stats.total_memory_bytes / 1024}KB`)
665
+ * ```
666
+ */
667
+ declare function getCacheStatistics(): CacheStatistics;
668
+ /**
669
+ * Clear all caches (parse, resolve, compile, CSS generation)
670
+ * Use when switching themes or major configuration changes
671
+ *
672
+ * @example
673
+ * ```ts
674
+ * // Clear before switching themes
675
+ * clearAllCaches()
676
+ * const css = await generateCssNative(classes, { theme: newTheme })
677
+ * ```
678
+ */
679
+ declare function clearAllCaches(): void;
680
+ /**
681
+ * Clear only the parse cache
682
+ * Useful when parser behavior changes or cache gets stale
683
+ */
684
+ declare function clearParseCache(): void;
685
+ /**
686
+ * Clear only the resolve cache
687
+ * Use when theme configuration changes
688
+ */
689
+ declare function clearResolveCache(): void;
690
+ /**
691
+ * Clear only the compile cache
692
+ * Use when Tailwind configuration changes
693
+ */
694
+ declare function clearCompileCache(): void;
695
+ /**
696
+ * Clear only the CSS generation cache
697
+ * Use when theme or layout changes
698
+ */
699
+ declare function clearCssGenCache(): void;
700
+ /**
701
+ * Get optimization hints based on current cache performance
702
+ * Analyzes hit rates and suggests improvements
703
+ *
704
+ * @param hitRatePercent - Current hit rate (0-100)
705
+ * @param memoryUsedMb - Memory currently used in MB
706
+ * @returns Optimization recommendations
707
+ *
708
+ * @example
709
+ * ```ts
710
+ * const stats = getCacheStatistics()
711
+ * const hints = getCacheOptimizationHints(
712
+ * stats.overall_hit_rate,
713
+ * stats.total_memory_bytes / (1024 * 1024)
714
+ * )
715
+ * console.log(`Recommendation: ${hints.recommended_strategy}`)
716
+ * console.log(`Potential improvement: ${hints.estimated_improvement_percent}%`)
717
+ * ```
718
+ */
719
+ declare function getCacheOptimizationHints(hitRatePercent: number, memoryUsedMb: number): CacheOptimizationHints;
720
+ /**
721
+ * Estimate optimal cache configuration for your workload
722
+ * Analyzes typical patterns and recommends sizes
723
+ *
724
+ * @param totalBudgetMb - Maximum memory budget in MB
725
+ * @param workloadType - "small" (< 100 files), "medium" (100-1000), "large" (1000+)
726
+ * @returns Recommended cache configuration
727
+ *
728
+ * @example
729
+ * ```ts
730
+ * const config = estimateOptimalCacheConfig(512, 'large')
731
+ * console.log(`Parse cache: ${config.parse_cache_size}MB`)
732
+ * console.log(`Expected hit rate: ${config.expected_hit_rate_percent}%`)
733
+ * ```
734
+ */
735
+ declare function estimateOptimalCacheConfig(totalBudgetMb: number, workloadType: "small" | "medium" | "large"): OptimalCacheConfig;
736
+ /**
737
+ * Read cache from disk (persistence)
738
+ * Restores cached data from previous sessions
739
+ *
740
+ * @param cachePath - Path to cache file
741
+ * @returns Entries loaded from disk
742
+ *
743
+ * @example
744
+ * ```ts
745
+ * const entries = cacheRead('./.tw-cache/scan.json')
746
+ * // Warm up cache with persisted data
747
+ * ```
748
+ */
749
+ declare function cacheRead(cachePath: string): Array<{
750
+ file: string;
751
+ contentHash: string;
752
+ classes: string[];
753
+ mtimeMs: number;
754
+ sizeBytes: number;
755
+ }>;
756
+ /**
757
+ * Write cache to disk (persistence)
758
+ * Saves cached data for next session
759
+ *
760
+ * @param cachePath - Path where cache should be written
761
+ * @param entries - Cache entries to persist
762
+ * @returns Success status
763
+ *
764
+ * @example
765
+ * ```ts
766
+ * const stats = getCacheStatistics()
767
+ * const success = cacheWrite(
768
+ * './.tw-cache/scan.json',
769
+ * // entries array from previous scan
770
+ * )
771
+ * ```
772
+ */
773
+ declare function cacheWrite(cachePath: string, entries: Array<{
774
+ file: string;
775
+ contentHash: string;
776
+ classes: string[];
777
+ mtimeMs: number;
778
+ sizeBytes: number;
779
+ }>): boolean;
780
+ /**
781
+ * Calculate cache priority score for file ordering
782
+ * Useful for prioritizing which files to scan first
783
+ *
784
+ * @param mtimeMs - File modification time in milliseconds
785
+ * @param sizeBytes - File size in bytes
786
+ * @param hitCount - Number of times this file was accessed from cache
787
+ * @returns Priority score (higher = process first)
788
+ *
789
+ * @example
790
+ * ```ts
791
+ * const priority = cachePriority(Date.now(), 2048, 5)
792
+ * // Use priority to sort files for scanning
793
+ * ```
794
+ */
795
+ declare function cachePriority(mtimeMs: number, sizeBytes: number, hitCount: number): number;
796
+
797
+ /**
798
+ * themeResolutionNative.ts
799
+ *
800
+ * Phase 5.1: Theme Resolution Extended - Advanced theme configuration handling
801
+ * Exposes 7 theme resolution functions for complex Tailwind configurations
802
+ */
803
+ /**
804
+ * Validation result for theme config
805
+ */
806
+ interface ThemeValidationResult {
807
+ is_valid: boolean;
808
+ errors: string[];
809
+ warnings: string[];
810
+ suggestions: string[];
811
+ }
812
+ /**
813
+ * Resolved variant configuration
814
+ */
815
+ interface ResolvedVariantConfig {
816
+ variants: string[];
817
+ supported: string[];
818
+ deprecated: string[];
819
+ conflicting: string[];
820
+ }
821
+ /**
822
+ * Theme cascade resolution result
823
+ */
824
+ interface ThemeCascadeResult {
825
+ base_theme: Record<string, unknown>;
826
+ user_overrides: Record<string, unknown>;
827
+ merged_theme: Record<string, unknown>;
828
+ conflict_resolutions: Array<{
829
+ key: string;
830
+ base_value: unknown;
831
+ override_value: unknown;
832
+ resolution: "override" | "merge" | "error";
833
+ }>;
834
+ }
835
+ /**
836
+ * Class name resolution from theme
837
+ */
838
+ interface ResolvedClassName {
839
+ class_name: string;
840
+ property: string;
841
+ value: string;
842
+ from_theme_path: string;
843
+ is_responsive: boolean;
844
+ variants: string[];
845
+ }
846
+ /**
847
+ * Conflict group information
848
+ */
849
+ interface ConflictGroupInfo {
850
+ group_name: string;
851
+ conflicting_classes: string[];
852
+ description: string;
853
+ resolution_strategy: string;
854
+ }
855
+ /**
856
+ * Get all resolved variants from theme configuration
857
+ * Parses theme config and returns all variant prefixes
858
+ *
859
+ * @param configJson - JSON string of theme configuration
860
+ * @returns Resolved variants with metadata
861
+ *
862
+ * @example
863
+ * ```ts
864
+ * const config = {
865
+ * screens: { md: '768px', lg: '1024px' },
866
+ * state: { hover: '&:hover', focus: '&:focus' }
867
+ * }
868
+ * const variants = resolveVariants(JSON.stringify(config))
869
+ * console.log(variants.variants) // ['md', 'lg', 'hover', 'focus', ...]
870
+ * ```
871
+ */
872
+ declare function resolveVariants(configJson: string): ResolvedVariantConfig;
873
+ /**
874
+ * Validate theme configuration for correctness
875
+ * Checks for common issues and provides warnings
876
+ *
877
+ * @param configJson - JSON string of theme configuration
878
+ * @returns Validation result with errors and suggestions
879
+ *
880
+ * @example
881
+ * ```ts
882
+ * const result = validateThemeConfig(JSON.stringify(myTheme))
883
+ * if (!result.is_valid) {
884
+ * console.error('Errors:', result.errors)
885
+ * console.warn('Warnings:', result.warnings)
886
+ * }
887
+ * ```
888
+ */
889
+ declare function validateThemeConfig(configJson: string): ThemeValidationResult;
890
+ /**
891
+ * Resolve theme cascade (base + overrides)
892
+ * Merges base theme with user overrides intelligently
893
+ *
894
+ * @param baseThemeJson - Base theme configuration
895
+ * @param overridesJson - User overrides configuration
896
+ * @returns Merged theme with conflict information
897
+ *
898
+ * @example
899
+ * ```ts
900
+ * const cascade = resolveCascade(
901
+ * JSON.stringify(baseTheme),
902
+ * JSON.stringify(userOverrides)
903
+ * )
904
+ * console.log(cascade.merged_theme)
905
+ * console.log('Conflicts resolved:', cascade.conflict_resolutions.length)
906
+ * ```
907
+ */
908
+ declare function resolveCascade(baseThemeJson: string, overridesJson: string): ThemeCascadeResult;
909
+ /**
910
+ * Resolve class names from theme
911
+ * Maps Tailwind class names to theme values
912
+ *
913
+ * @param classNames - Array of Tailwind class names (e.g., ["text-lg", "bg-blue-600"])
914
+ * @param themeJson - Theme configuration
915
+ * @returns Resolved class name information
916
+ *
917
+ * @example
918
+ * ```ts
919
+ * const resolved = resolveClassNames(
920
+ * ['text-lg', 'bg-blue-600', 'md:p-4'],
921
+ * JSON.stringify(theme)
922
+ * )
923
+ * resolved.forEach(item => {
924
+ * console.log(`${item.class_name} -> ${item.property}: ${item.value}`)
925
+ * })
926
+ * ```
927
+ */
928
+ declare function resolveClassNames(classNames: string[], themeJson: string): ResolvedClassName[];
929
+ /**
930
+ * Get conflict group information
931
+ * Identifies classes that conflict with each other
932
+ *
933
+ * @param groupName - Conflict group name (e.g., "display", "position", "flex-direction")
934
+ * @param themeJson - Theme configuration
935
+ * @returns Information about the conflict group
936
+ *
937
+ * @example
938
+ * ```ts
939
+ * const info = resolveConflictGroup('display', JSON.stringify(theme))
940
+ * console.log('Conflicting classes:', info.conflicting_classes)
941
+ * console.log('Strategy:', info.resolution_strategy)
942
+ * ```
943
+ */
944
+ declare function resolveConflictGroup(groupName: string, themeJson: string): ConflictGroupInfo;
945
+ /**
946
+ * Resolve theme value from key path
947
+ * Navigates nested theme config to find values
948
+ *
949
+ * @param keyPath - Dot-separated path (e.g., "colors.blue.600")
950
+ * @param themeJson - Theme configuration
951
+ * @returns Resolved value or null if not found
952
+ *
953
+ * @example
954
+ * ```ts
955
+ * const color = resolveThemeValue('colors.blue.600', JSON.stringify(theme))
956
+ * console.log(color) // "#2563eb" or similar
957
+ * ```
958
+ */
959
+ declare function resolveThemeValue(keyPath: string, themeJson: string): string | null;
960
+ /**
961
+ * Get all simple variants from configuration
962
+ * Returns variants that don't require complex selector nesting
963
+ *
964
+ * @param configJson - Theme/variant configuration
965
+ * @returns Array of simple variant names
966
+ *
967
+ * @example
968
+ * ```ts
969
+ * const simpleVariants = resolveSimpleVariants(JSON.stringify(config))
970
+ * console.log(simpleVariants)
971
+ * // ["hover", "focus", "active", "group-hover", ...]
972
+ * ```
973
+ */
974
+ declare function resolveSimpleVariants(configJson: string): string[];
975
+
976
+ /**
977
+ * streamingNative.ts
978
+ *
979
+ * Phase 5.1: Streaming & Incremental Processing - Handle file changes efficiently
980
+ * Exposes 8 functions for real-time incremental compilation
981
+ */
982
+ /**
983
+ * File change notification
984
+ */
985
+ interface FileChangeEvent {
986
+ file_path: string;
987
+ event_type: "added" | "modified" | "deleted";
988
+ old_content?: string;
989
+ new_content?: string;
990
+ timestamp_ms: number;
991
+ }
992
+ /**
993
+ * Processed file change result
994
+ */
995
+ interface ProcessedFileChange {
996
+ file_path: string;
997
+ status: "processed" | "skipped" | "error";
998
+ old_classes: string[];
999
+ new_classes: string[];
1000
+ added_classes: string[];
1001
+ removed_classes: string[];
1002
+ changed: boolean;
1003
+ fingerprint: string;
1004
+ error?: string;
1005
+ }
1006
+ /**
1007
+ * Diff between two scan results
1008
+ */
1009
+ interface FileDiff {
1010
+ added_files: string[];
1011
+ removed_files: string[];
1012
+ modified_files: string[];
1013
+ added_classes: string[];
1014
+ removed_classes: string[];
1015
+ total_changes: number;
1016
+ }
1017
+ /**
1018
+ * File fingerprint for change detection
1019
+ */
1020
+ interface FileFingerprint {
1021
+ file_path: string;
1022
+ content_hash: string;
1023
+ size_bytes: number;
1024
+ mtime_ms: number;
1025
+ class_hash: string;
1026
+ signature: string;
1027
+ }
1028
+ /**
1029
+ * Incremental diff result
1030
+ */
1031
+ interface IncrementalDiffResult {
1032
+ is_changed: boolean;
1033
+ changes_count: number;
1034
+ diff: FileDiff;
1035
+ processing_time_ms: number;
1036
+ }
1037
+ /**
1038
+ * State injection result
1039
+ */
1040
+ interface StateInjectionResult {
1041
+ injected: boolean;
1042
+ state_hash: string;
1043
+ affected_files: number;
1044
+ total_injected_bytes: number;
1045
+ }
1046
+ /**
1047
+ * Stale entry pruning result
1048
+ */
1049
+ interface PruneResult {
1050
+ entries_before: number;
1051
+ entries_after: number;
1052
+ entries_removed: number;
1053
+ freed_bytes: number;
1054
+ }
1055
+ /**
1056
+ * Rebuilt workspace result
1057
+ */
1058
+ interface RebuildWorkspaceResult {
1059
+ total_files_scanned: number;
1060
+ total_classes_found: number;
1061
+ unique_classes: number;
1062
+ build_time_ms: number;
1063
+ files_with_changes: number;
1064
+ }
1065
+ /**
1066
+ * Process a single file change event
1067
+ * Called when a file is added, modified, or deleted
1068
+ *
1069
+ * @param fileChangeJson - JSON string describing the file change
1070
+ * @returns Processing result with class changes
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * const change = processFileChange(JSON.stringify({
1075
+ * file_path: 'src/Button.tsx',
1076
+ * event_type: 'modified',
1077
+ * new_content: 'export const Button = ...',
1078
+ * timestamp_ms: Date.now()
1079
+ * }))
1080
+ *
1081
+ * console.log('Added classes:', change.added_classes)
1082
+ * console.log('Removed classes:', change.removed_classes)
1083
+ * ```
1084
+ */
1085
+ declare function processFileChange(fileChangeJson: string): ProcessedFileChange;
1086
+ /**
1087
+ * Compute incremental diff between old and new scan results
1088
+ * Efficient way to identify only what changed
1089
+ *
1090
+ * @param oldScanJson - JSON string of previous scan result
1091
+ * @param newScanJson - JSON string of new scan result
1092
+ * @returns Diff showing what changed
1093
+ *
1094
+ * @example
1095
+ * ```ts
1096
+ * const oldResult = scanWorkspace('./src')
1097
+ * // ... files changed ...
1098
+ * const newResult = scanWorkspace('./src')
1099
+ *
1100
+ * const diff = computeIncrementalDiff(
1101
+ * JSON.stringify(oldResult),
1102
+ * JSON.stringify(newResult)
1103
+ * )
1104
+ *
1105
+ * if (diff.is_changed) {
1106
+ * console.log(`${diff.changes_count} files changed`)
1107
+ * console.log('Added:', diff.diff.added_classes)
1108
+ * console.log('Removed:', diff.diff.removed_classes)
1109
+ * }
1110
+ * ```
1111
+ */
1112
+ declare function computeIncrementalDiff(oldScanJson: string, newScanJson: string): IncrementalDiffResult;
1113
+ /**
1114
+ * Create a fingerprint of a file for change detection
1115
+ * Use fingerprints to quickly check if file needs reprocessing
1116
+ *
1117
+ * @param filePath - Path to file
1118
+ * @param fileContent - File content
1119
+ * @returns File fingerprint
1120
+ *
1121
+ * @example
1122
+ * ```ts
1123
+ * const fingerprint = createFingerprint('src/Button.tsx', fileContent)
1124
+ * // Store fingerprint, check later if content changed
1125
+ * const newFingerprint = createFingerprint('src/Button.tsx', newContent)
1126
+ * if (fingerprint.signature !== newFingerprint.signature) {
1127
+ * // Content changed, needs reprocessing
1128
+ * }
1129
+ * ```
1130
+ */
1131
+ declare function createFingerprint(filePath: string, fileContent: string): FileFingerprint;
1132
+ /**
1133
+ * Inject state hash into compiled CSS
1134
+ * Marks CSS with version/state hash for cache busting
1135
+ *
1136
+ * @param css - Raw CSS string
1137
+ * @param stateHash - State hash to inject
1138
+ * @returns Modified CSS with injected state
1139
+ *
1140
+ * @example
1141
+ * ```ts
1142
+ * const css = compileCssNative2(['px-4', 'bg-blue-600'])
1143
+ * const withState = injectStateHash(css, 'v5-hash-123')
1144
+ * // CSS now includes version marker for cache control
1145
+ * ```
1146
+ */
1147
+ declare function injectStateHash(css: string, stateHash: string): StateInjectionResult;
1148
+ /**
1149
+ * Prune stale entries from cache
1150
+ * Removes old/unused cache entries to free memory
1151
+ *
1152
+ * @param maxAgeSeconds - Remove entries older than this many seconds
1153
+ * @param maxEntries - Keep only this many most-recent entries
1154
+ * @returns Result of pruning operation
1155
+ *
1156
+ * @example
1157
+ * ```ts
1158
+ * // Remove cache entries older than 1 hour, keep max 10000 entries
1159
+ * const result = pruneStaleCacheEntries(3600, 10000)
1160
+ * console.log(`Freed ${result.freed_bytes / 1024}KB`)
1161
+ * ```
1162
+ */
1163
+ declare function pruneStaleCacheEntries(maxAgeSeconds: number, maxEntries: number): PruneResult;
1164
+ /**
1165
+ * Rebuild workspace result from scratch
1166
+ * Useful after major configuration changes
1167
+ *
1168
+ * @param rootDir - Root directory to scan
1169
+ * @param extensions - File extensions to scan (e.g., [".tsx", ".ts"])
1170
+ * @returns Rebuilt workspace result
1171
+ *
1172
+ * @example
1173
+ * ```ts
1174
+ * const result = rebuildWorkspaceResult('./src', ['.tsx', '.ts'])
1175
+ * console.log(`Found ${result.unique_classes} unique classes`)
1176
+ * console.log(`${result.files_with_changes} files had changes`)
1177
+ * ```
1178
+ */
1179
+ declare function rebuildWorkspaceResult(rootDir: string, extensions?: string[]): RebuildWorkspaceResult;
1180
+ /**
1181
+ * Scan a single file with incremental state
1182
+ * Returns only new/changed classes since last scan
1183
+ *
1184
+ * @param filePath - Path to file
1185
+ * @param fileContent - File content
1186
+ * @returns Updated classes and change status
1187
+ *
1188
+ * @example
1189
+ * ```ts
1190
+ * // On file change, get only what changed
1191
+ * const file = scanFileNative('src/Button.tsx', newContent)
1192
+ * if (file.changed) {
1193
+ * console.log('Added:', file.added_classes)
1194
+ * console.log('Removed:', file.removed_classes)
1195
+ * }
1196
+ * ```
1197
+ */
1198
+ declare function scanFileNative(filePath: string, fileContent: string): {
1199
+ file: string;
1200
+ classes: string[];
1201
+ added_classes: string[];
1202
+ removed_classes: string[];
1203
+ changed: boolean;
1204
+ };
1205
+ /**
1206
+ * Scan multiple files in batch with incremental state
1207
+ * Efficient batch processing of file changes
1208
+ *
1209
+ * @param filesJson - JSON array of {file, content} objects
1210
+ * @returns Results for each file
1211
+ *
1212
+ * @example
1213
+ * ```ts
1214
+ * const files = [
1215
+ * { file: 'src/Button.tsx', content: newButtonContent },
1216
+ * { file: 'src/Card.tsx', content: newCardContent }
1217
+ * ]
1218
+ * const results = scanFilesBatchNative(JSON.stringify(files))
1219
+ * ```
1220
+ */
1221
+ declare function scanFilesBatchNative(filesJson: string): Array<{
1222
+ file: string;
1223
+ classes: string[];
1224
+ changed: boolean;
1225
+ }>;
1226
+
1227
+ /**
1228
+ * cssCompilationNative.ts
1229
+ *
1230
+ * Phase 5.2: Advanced CSS Compilation - Complex CSS generation and transformations
1231
+ * Exposes 12 CSS compilation functions for animations, themes, and merging
1232
+ */
1233
+ /**
1234
+ * Compiled CSS rule result
1235
+ */
1236
+ interface CompiledCssRule {
1237
+ selector: string;
1238
+ declarations: string;
1239
+ properties: Array<{
1240
+ key: string;
1241
+ value: string;
1242
+ }>;
1243
+ specificity: number;
1244
+ }
1245
+ /**
1246
+ * Compiled animation result
1247
+ */
1248
+ interface CompiledAnimation {
1249
+ animation_id: string;
1250
+ keyframes_css: string;
1251
+ animation_rule: string;
1252
+ duration_ms: number;
1253
+ }
1254
+ /**
1255
+ * Compiled theme result
1256
+ */
1257
+ interface CompiledTheme {
1258
+ selector: string;
1259
+ variables: Array<{
1260
+ name: string;
1261
+ value: string;
1262
+ }>;
1263
+ variables_css: string;
1264
+ theme_name: string;
1265
+ }
1266
+ /**
1267
+ * CSS compile result with metadata
1268
+ */
1269
+ interface CssCompileResult {
1270
+ css: string;
1271
+ resolved_classes: string[];
1272
+ unknown_classes: string[];
1273
+ size_bytes: number;
1274
+ duration_ms: number;
1275
+ }
1276
+ /**
1277
+ * tw_merge options
1278
+ */
1279
+ interface TwMergeOptions {
1280
+ separator?: string;
1281
+ debug?: boolean;
1282
+ }
1283
+ /**
1284
+ * Compile a single Tailwind class to CSS rule
1285
+ * Full compilation pipeline: parse → resolve → generate
1286
+ *
1287
+ * @param input - Single Tailwind class (e.g., "md:hover:bg-blue-600/50")
1288
+ * @returns Compiled CSS rule as JSON
1289
+ *
1290
+ * @example
1291
+ * ```ts
1292
+ * const rule = compileClass('md:hover:bg-blue-600')
1293
+ * // Returns: {
1294
+ * // selector: '.md\\:hover\\:bg-blue-600',
1295
+ * // declarations: 'background-color: #2563eb;',
1296
+ * // ...
1297
+ * // }
1298
+ * ```
1299
+ */
1300
+ declare function compileClass(input: string): CompiledCssRule;
1301
+ /**
1302
+ * Compile multiple Tailwind classes to CSS rules
1303
+ * Batch processing with parallel compilation
1304
+ *
1305
+ * @param inputs - Array of Tailwind classes
1306
+ * @returns JSON string of compiled rules
1307
+ *
1308
+ * @example
1309
+ * ```ts
1310
+ * const rules = compileClasses(['px-4', 'bg-blue-600', 'hover:opacity-80'])
1311
+ * ```
1312
+ */
1313
+ declare function compileClasses(inputs: string[]): CssCompileResult;
1314
+ /**
1315
+ * One-step: class → CSS string
1316
+ * Compiles and generates in single call
1317
+ *
1318
+ * @param input - Single Tailwind class
1319
+ * @param minify - Whether to minify output (default: false)
1320
+ * @returns Generated CSS string
1321
+ *
1322
+ * @example
1323
+ * ```ts
1324
+ * const css = compileToCss('bg-blue-600')
1325
+ * // Returns: ".bg-blue-600 { background-color: #2563eb; }"
1326
+ *
1327
+ * const minified = compileToCss('bg-blue-600', true)
1328
+ * // Returns: ".bg-blue-600{background-color:#2563eb}"
1329
+ * ```
1330
+ */
1331
+ declare function compileToCss(input: string, minify?: boolean): string;
1332
+ /**
1333
+ * Batch compile to CSS
1334
+ * Compiles multiple classes and generates combined CSS
1335
+ *
1336
+ * @param inputs - Array of Tailwind classes
1337
+ * @param minify - Whether to minify output
1338
+ * @returns Combined CSS string
1339
+ *
1340
+ * @example
1341
+ * ```ts
1342
+ * const css = compileToCssBatch(['px-4', 'bg-blue-600'], true)
1343
+ * ```
1344
+ */
1345
+ declare function compileToCssBatch(inputs: string[], minify?: boolean): string;
1346
+ /**
1347
+ * Minify CSS string
1348
+ * Removes unnecessary whitespace and formatting
1349
+ *
1350
+ * @param css - Raw CSS string
1351
+ * @returns Minified CSS (40-60% size reduction)
1352
+ *
1353
+ * @example
1354
+ * ```ts
1355
+ * const css = ".px-4 { padding-left: 1rem; padding-right: 1rem; }"
1356
+ * const minified = minifyCss(css)
1357
+ * // Returns: ".px-4{padding-left:1rem;padding-right:1rem}"
1358
+ * ```
1359
+ */
1360
+ declare function minifyCss(css: string): string;
1361
+ /**
1362
+ * Compile animation from from/to states
1363
+ * Generates @keyframes and animation rule
1364
+ *
1365
+ * @param animationName - Animation name
1366
+ * @param from - From state classes (e.g., "opacity-0 scale-95")
1367
+ * @param to - To state classes (e.g., "opacity-100 scale-100")
1368
+ * @returns Compiled animation with keyframes
1369
+ *
1370
+ * @example
1371
+ * ```ts
1372
+ * const anim = compileAnimation('fade-in', 'opacity-0', 'opacity-100')
1373
+ * console.log(anim.keyframes_css) // @keyframes fade-in { ... }
1374
+ * console.log(anim.animation_rule) // animation: fade-in 300ms;
1375
+ * ```
1376
+ */
1377
+ declare function compileAnimation(animationName: string, from: string, to: string): CompiledAnimation;
1378
+ /**
1379
+ * Compile keyframes from stop definitions
1380
+ * Creates @keyframes from percentage stops
1381
+ *
1382
+ * @param name - Keyframes name
1383
+ * @param stopsJson - JSON array of stops: `[{"stop":"0%","classes":"opacity-0"}...]`
1384
+ * @returns Compiled @keyframes rule
1385
+ *
1386
+ * @example
1387
+ * ```ts
1388
+ * const kf = compileKeyframes('slide-in', JSON.stringify([
1389
+ * { stop: '0%', classes: 'translate-x-full' },
1390
+ * { stop: '100%', classes: 'translate-x-0' }
1391
+ * ]))
1392
+ * ```
1393
+ */
1394
+ declare function compileKeyframes(name: string, stopsJson: string): CompiledAnimation;
1395
+ /**
1396
+ * Compile theme to CSS variables
1397
+ * Converts token map to CSS custom properties
1398
+ *
1399
+ * @param tokensJson - Theme tokens as JSON
1400
+ * @param themeName - Theme name ("light", "dark", etc.)
1401
+ * @param prefix - CSS variable prefix (e.g., "tw" → "--tw-color-primary")
1402
+ * @returns Compiled theme with variables CSS
1403
+ *
1404
+ * @example
1405
+ * ```ts
1406
+ * const theme = compileTheme(
1407
+ * JSON.stringify({ colors: { blue: { 600: '#2563eb' } } }),
1408
+ * 'light',
1409
+ * 'tw'
1410
+ * )
1411
+ * // Returns CSS: :root { --tw-color-blue-600: #2563eb; }
1412
+ * ```
1413
+ */
1414
+ declare function compileTheme(tokensJson: string, themeName: string, prefix: string): CompiledTheme;
1415
+ /**
1416
+ * Merge conflicting Tailwind classes
1417
+ * Resolves conflicts intelligently (last-one-wins by default)
1418
+ *
1419
+ * @param classString - Space-separated class string (e.g., "px-4 px-8 bg-red-500 bg-blue-600")
1420
+ * @returns Merged classes with conflicts resolved
1421
+ *
1422
+ * @example
1423
+ * ```ts
1424
+ * const merged = twMerge('px-4 px-8 bg-red-500 bg-blue-600')
1425
+ * // Returns: "px-8 bg-blue-600"
1426
+ * ```
1427
+ */
1428
+ declare function twMerge(classString: string): string;
1429
+ /**
1430
+ * Merge multiple class strings
1431
+ * Combines and resolves conflicts across multiple strings
1432
+ *
1433
+ * @param classStrings - Array of class strings
1434
+ * @returns Merged result
1435
+ *
1436
+ * @example
1437
+ * ```ts
1438
+ * const merged = twMergeMany([
1439
+ * 'px-4 hover:bg-blue-600',
1440
+ * 'px-8 hover:opacity-80'
1441
+ * ])
1442
+ * // Returns: "px-8 hover:bg-blue-600 hover:opacity-80"
1443
+ * ```
1444
+ */
1445
+ declare function twMergeMany(classStrings: string[]): string;
1446
+ /**
1447
+ * Merge with custom separator
1448
+ * Useful for non-standard class separators
1449
+ *
1450
+ * @param classString - Classes to merge
1451
+ * @param options - Merge options (separator, debug)
1452
+ * @returns Merged classes
1453
+ *
1454
+ * @example
1455
+ * ```ts
1456
+ * const merged = twMergeWithSeparator(
1457
+ * 'px-4,px-8,bg-red-500,bg-blue-600',
1458
+ * { separator: ',' }
1459
+ * )
1460
+ * ```
1461
+ */
1462
+ declare function twMergeWithSeparator(classString: string, options: TwMergeOptions): string;
1463
+ /**
1464
+ * Merge many with custom separator
1465
+ * Batch merge with custom separator
1466
+ *
1467
+ * @param classStrings - Array of class strings
1468
+ * @param options - Merge options
1469
+ * @returns Merged result
1470
+ */
1471
+ declare function twMergeManyWithSeparator(classStrings: string[], options: TwMergeOptions): string;
1472
+ /**
1473
+ * Raw merge from class lists
1474
+ * Direct merge without preprocessing
1475
+ *
1476
+ * @param classLists - Array of class lists
1477
+ * @returns Merged classes
1478
+ *
1479
+ * @example
1480
+ * ```ts
1481
+ * const merged = twMergeRaw(['px-4 px-8', 'bg-red bg-blue'])
1482
+ * ```
1483
+ */
1484
+ declare function twMergeRaw(classLists: string[]): string;
1485
+
1486
+ /**
1487
+ * idRegistryNative.ts
1488
+ *
1489
+ * Phase 5.2: ID Registry Management - Efficient ID generation and lookup
1490
+ * Exposes 16 ID registry functions for deterministic class/component identification
1491
+ */
1492
+ /**
1493
+ * Registry snapshot data
1494
+ */
1495
+ interface RegistrySnapshot {
1496
+ handle: number;
1497
+ next_id: number;
1498
+ entries: Array<{
1499
+ name: string;
1500
+ id: number;
1501
+ }>;
1502
+ total_entries: number;
1503
+ }
1504
+ /**
1505
+ * Create a new ID generator
1506
+ * Returns a handle to be used in subsequent operations
1507
+ *
1508
+ * @returns Generator handle (u32)
1509
+ *
1510
+ * @example
1511
+ * ```ts
1512
+ * const handle = idRegistryCreate()
1513
+ * // Use handle for all subsequent operations
1514
+ * try {
1515
+ * const id = idRegistryGenerate(handle, 'MyComponent')
1516
+ * // ... use id ...
1517
+ * } finally {
1518
+ * idRegistryDestroy(handle) // Clean up
1519
+ * }
1520
+ * ```
1521
+ */
1522
+ declare function idRegistryCreate(): number;
1523
+ /**
1524
+ * Generate a new ID for a name
1525
+ * Same name always returns same ID (deterministic)
1526
+ *
1527
+ * @param handle - Generator handle from idRegistryCreate()
1528
+ * @param name - Identifier name (e.g., component name, class name)
1529
+ * @returns Generated ID
1530
+ *
1531
+ * @example
1532
+ * ```ts
1533
+ * const handle = idRegistryCreate()
1534
+ * const id1 = idRegistryGenerate(handle, 'Button') // Returns 1
1535
+ * const id2 = idRegistryGenerate(handle, 'Button') // Returns 1 (same)
1536
+ * const id3 = idRegistryGenerate(handle, 'Card') // Returns 2 (different)
1537
+ * ```
1538
+ */
1539
+ declare function idRegistryGenerate(handle: number, name: string): number;
1540
+ /**
1541
+ * Lookup existing ID for a name
1542
+ * Returns -1 if not found
1543
+ *
1544
+ * @param handle - Generator handle
1545
+ * @param name - Name to look up
1546
+ * @returns ID if found, -1 if not found
1547
+ *
1548
+ * @example
1549
+ * ```ts
1550
+ * const id = idRegistryLookup(handle, 'Button')
1551
+ * if (id !== -1) {
1552
+ * console.log(`Button has ID: ${id}`)
1553
+ * } else {
1554
+ * console.log('Button not in registry yet')
1555
+ * }
1556
+ * ```
1557
+ */
1558
+ declare function idRegistryLookup(handle: number, name: string): number;
1559
+ /**
1560
+ * Get the next ID that would be assigned
1561
+ * Useful for knowing how many unique IDs exist
1562
+ *
1563
+ * @param handle - Generator handle
1564
+ * @returns Next available ID
1565
+ *
1566
+ * @example
1567
+ * ```ts
1568
+ * const handle = idRegistryCreate()
1569
+ * idRegistryGenerate(handle, 'Button')
1570
+ * idRegistryGenerate(handle, 'Card')
1571
+ * const nextId = idRegistryNext(handle) // Returns 2 (next available)
1572
+ * ```
1573
+ */
1574
+ declare function idRegistryNext(handle: number): number;
1575
+ /**
1576
+ * Destroy a registry (clean up resources)
1577
+ * Must be called when done with registry
1578
+ *
1579
+ * @param handle - Generator handle
1580
+ *
1581
+ * @example
1582
+ * ```ts
1583
+ * const handle = idRegistryCreate()
1584
+ * try {
1585
+ * // Use registry
1586
+ * } finally {
1587
+ * idRegistryDestroy(handle)
1588
+ * }
1589
+ * ```
1590
+ */
1591
+ declare function idRegistryDestroy(handle: number): void;
1592
+ /**
1593
+ * Reset registry to initial state
1594
+ * Clears all entries but reuses handle
1595
+ *
1596
+ * @param handle - Generator handle
1597
+ *
1598
+ * @example
1599
+ * ```ts
1600
+ * const handle = idRegistryCreate()
1601
+ * idRegistryGenerate(handle, 'Component1')
1602
+ * idRegistryGenerate(handle, 'Component2')
1603
+ * idRegistryReset(handle) // Clear all
1604
+ * const id = idRegistryNext(handle) // Back to 0
1605
+ * ```
1606
+ */
1607
+ declare function idRegistryReset(handle: number): void;
1608
+ /**
1609
+ * Get snapshot of current registry state
1610
+ * Useful for serialization/debugging
1611
+ *
1612
+ * @param handle - Generator handle
1613
+ * @returns Snapshot with all entries
1614
+ *
1615
+ * @example
1616
+ * ```ts
1617
+ * const handle = idRegistryCreate()
1618
+ * idRegistryGenerate(handle, 'Button')
1619
+ * idRegistryGenerate(handle, 'Card')
1620
+ * const snapshot = idRegistrySnapshot(handle)
1621
+ * console.log(JSON.stringify(snapshot, null, 2))
1622
+ * ```
1623
+ */
1624
+ declare function idRegistrySnapshot(handle: number): RegistrySnapshot;
1625
+ /**
1626
+ * Get count of active registries
1627
+ * Useful for monitoring resource usage
1628
+ *
1629
+ * @returns Number of active generator handles
1630
+ *
1631
+ * @example
1632
+ * ```ts
1633
+ * console.log(`Active registries: ${idRegistryActiveCount()}`)
1634
+ * ```
1635
+ */
1636
+ declare function idRegistryActiveCount(): number;
1637
+ /**
1638
+ * Register a property name with global registry
1639
+ * Maps property names to consistent IDs
1640
+ *
1641
+ * @param propertyName - Property name (e.g., "background-color")
1642
+ * @returns Assigned property ID
1643
+ *
1644
+ * @example
1645
+ * ```ts
1646
+ * const bgColorId = registerPropertyName('background-color')
1647
+ * const paddingId = registerPropertyName('padding')
1648
+ * ```
1649
+ */
1650
+ declare function registerPropertyName(propertyName: string): number;
1651
+ /**
1652
+ * Register a value name with global registry
1653
+ * Maps values to consistent IDs
1654
+ *
1655
+ * @param valueName - Value name (e.g., "blue-600")
1656
+ * @returns Assigned value ID
1657
+ *
1658
+ * @example
1659
+ * ```ts
1660
+ * const blueId = registerValueName('blue-600')
1661
+ * const redId = registerValueName('red-500')
1662
+ * ```
1663
+ */
1664
+ declare function registerValueName(valueName: string): number;
1665
+ /**
1666
+ * Convert property ID back to name
1667
+ * Reverse lookup for serialized data
1668
+ *
1669
+ * @param propertyId - Property ID
1670
+ * @returns Property name or empty string if not found
1671
+ *
1672
+ * @example
1673
+ * ```ts
1674
+ * const bgColorId = registerPropertyName('background-color')
1675
+ * const name = propertyIdToString(bgColorId)
1676
+ * console.log(name) // "background-color"
1677
+ * ```
1678
+ */
1679
+ declare function propertyIdToString(propertyId: number): string;
1680
+ /**
1681
+ * Convert value ID back to name
1682
+ * Reverse lookup for serialized data
1683
+ *
1684
+ * @param valueId - Value ID
1685
+ * @returns Value name or empty string if not found
1686
+ *
1687
+ * @example
1688
+ * ```ts
1689
+ * const blueId = registerValueName('blue-600')
1690
+ * const value = valueIdToString(blueId)
1691
+ * console.log(value) // "blue-600"
1692
+ * ```
1693
+ */
1694
+ declare function valueIdToString(valueId: number): string;
1695
+ /**
1696
+ * Reverse lookup: find property by ID
1697
+ * Alternative way to look up property names
1698
+ *
1699
+ * @param propertyId - Property ID to look up
1700
+ * @returns Property name
1701
+ */
1702
+ declare function reverseLookupProperty(propertyId: number): string;
1703
+ /**
1704
+ * Reverse lookup: find value by ID
1705
+ * Alternative way to look up value names
1706
+ *
1707
+ * @param valueId - Value ID to look up
1708
+ * @returns Value name
1709
+ */
1710
+ declare function reverseLookupValue(valueId: number): string;
1711
+ /**
1712
+ * Export registry state for persistence
1713
+ * Useful for saving/restoring registry data
1714
+ *
1715
+ * @param handle - Generator handle
1716
+ * @returns Serialized registry state
1717
+ *
1718
+ * @example
1719
+ * ```ts
1720
+ * const exported = idRegistryExport(handle)
1721
+ * // Save to file/database
1722
+ * ```
1723
+ */
1724
+ declare function idRegistryExport(handle: number): string;
1725
+ /**
1726
+ * Import registry state
1727
+ * Restore registry from saved state
1728
+ *
1729
+ * @param importedData - Serialized registry data
1730
+ * @returns New handle with imported data
1731
+ *
1732
+ * @example
1733
+ * ```ts
1734
+ * const handle = idRegistryImport(savedData)
1735
+ * // Registry restored with same IDs
1736
+ * ```
1737
+ */
1738
+ declare function idRegistryImport(importedData: string): number;
1739
+
1740
+ /**
1741
+ * redisNative.ts
1742
+ *
1743
+ * Phase 5.3: Redis Integration - Distributed caching and cluster support
1744
+ * Exposes 40 Redis functions for high-performance distributed CSS compilation caching
1745
+ */
1746
+ /**
1747
+ * Redis pool configuration
1748
+ */
1749
+ interface RedisCacheConfig {
1750
+ host: string;
1751
+ port: number;
1752
+ database: number;
1753
+ password?: string;
1754
+ pool_size: number;
1755
+ connection_timeout_ms: number;
1756
+ }
1757
+ /**
1758
+ * Redis pool statistics
1759
+ */
1760
+ interface RedisPoolStats {
1761
+ connected_count: number;
1762
+ idle_count: number;
1763
+ waiting_count: number;
1764
+ total_requests: number;
1765
+ total_errors: number;
1766
+ }
1767
+ /**
1768
+ * Redis cluster node information
1769
+ */
1770
+ interface RedisClusterNode {
1771
+ node_id: string;
1772
+ host: string;
1773
+ port: number;
1774
+ is_master: boolean;
1775
+ slot_range: Array<{
1776
+ start: number;
1777
+ end: number;
1778
+ }>;
1779
+ connected: boolean;
1780
+ }
1781
+ /**
1782
+ * Redis cluster status
1783
+ */
1784
+ interface RedisClusterStatus {
1785
+ enabled: boolean;
1786
+ cluster_state: string;
1787
+ nodes: RedisClusterNode[];
1788
+ slots_assigned: number;
1789
+ slots_ok: number;
1790
+ slots_fail: number;
1791
+ }
1792
+ /**
1793
+ * Key expiration information
1794
+ */
1795
+ interface KeyExpiration {
1796
+ key: string;
1797
+ ttl_seconds: number;
1798
+ expiration_timestamp: number;
1799
+ is_persistent: boolean;
1800
+ }
1801
+ /**
1802
+ * Pub/Sub message
1803
+ */
1804
+ interface PubSubMessage {
1805
+ channel: string;
1806
+ message: string;
1807
+ timestamp_ms: number;
1808
+ subscriber_count: number;
1809
+ }
1810
+ /**
1811
+ * Connection pool information
1812
+ */
1813
+ interface PoolInfo {
1814
+ host: string;
1815
+ port: number;
1816
+ pool_size: number;
1817
+ active_connections: number;
1818
+ idle_connections: number;
1819
+ average_latency_ms: number;
1820
+ }
1821
+ /**
1822
+ * Ping Redis server for connectivity check
1823
+ *
1824
+ * @returns "PONG" if connected, error message otherwise
1825
+ *
1826
+ * @example
1827
+ * ```ts
1828
+ * const response = redisPing()
1829
+ * if (response === "PONG") console.log("Connected")
1830
+ * ```
1831
+ */
1832
+ declare function redisPing(): string;
1833
+ /**
1834
+ * Get value from Redis
1835
+ *
1836
+ * @param key - Cache key
1837
+ * @returns Value if found, null if not found
1838
+ *
1839
+ * @example
1840
+ * ```ts
1841
+ * const value = redisGet('compiled:bg-blue-600')
1842
+ * if (value) console.log(JSON.parse(value))
1843
+ * ```
1844
+ */
1845
+ declare function redisGet(key: string): string | null;
1846
+ /**
1847
+ * Set value in Redis
1848
+ *
1849
+ * @param key - Cache key
1850
+ * @param value - Value to store
1851
+ * @param ttl_seconds - Time to live in seconds (optional)
1852
+ * @returns "OK" on success
1853
+ *
1854
+ * @example
1855
+ * ```ts
1856
+ * redisSet('compiled:bg-blue-600', JSON.stringify(css), 3600)
1857
+ * ```
1858
+ */
1859
+ declare function redisSet(key: string, value: string, ttl_seconds?: number): string;
1860
+ /**
1861
+ * Delete key from Redis
1862
+ *
1863
+ * @param key - Cache key
1864
+ * @returns Number of keys deleted
1865
+ *
1866
+ * @example
1867
+ * ```ts
1868
+ * const deleted = redisDelete('compiled:bg-blue-600')
1869
+ * console.log(`Deleted ${deleted} keys`)
1870
+ * ```
1871
+ */
1872
+ declare function redisDelete(key: string): number;
1873
+ /**
1874
+ * Check if key exists in Redis
1875
+ *
1876
+ * @param key - Cache key
1877
+ * @returns 1 if exists, 0 if not
1878
+ *
1879
+ * @example
1880
+ * ```ts
1881
+ * if (redisExists('compiled:bg-blue-600')) {
1882
+ * console.log('Cache hit')
1883
+ * }
1884
+ * ```
1885
+ */
1886
+ declare function redisExists(key: string): number;
1887
+ /**
1888
+ * Get multiple values from Redis (atomic operation)
1889
+ *
1890
+ * @param keys - Array of cache keys
1891
+ * @returns Array of values (null for missing keys)
1892
+ *
1893
+ * @example
1894
+ * ```ts
1895
+ * const values = redisMget(['key1', 'key2', 'key3'])
1896
+ * ```
1897
+ */
1898
+ declare function redisMget(keys: string[]): Array<string | null>;
1899
+ /**
1900
+ * Set multiple key-value pairs in Redis (atomic operation)
1901
+ *
1902
+ * @param pairs - Array of [key, value] tuples
1903
+ * @returns "OK" on success
1904
+ *
1905
+ * @example
1906
+ * ```ts
1907
+ * redisMset([
1908
+ * ['key1', 'value1'],
1909
+ * ['key2', 'value2']
1910
+ * ])
1911
+ * ```
1912
+ */
1913
+ declare function redisMset(pairs: Array<[string, string]>): string;
1914
+ /**
1915
+ * Flush all keys from current Redis database
1916
+ *
1917
+ * @returns Number of keys deleted
1918
+ *
1919
+ * @example
1920
+ * ```ts
1921
+ * const flushed = redisFlushDb()
1922
+ * console.log(`Flushed ${flushed} keys from database`)
1923
+ * ```
1924
+ */
1925
+ declare function redisFlushDb(): number;
1926
+ /**
1927
+ * Flush all keys from all Redis databases (cluster-wide)
1928
+ *
1929
+ * @returns Number of keys deleted
1930
+ *
1931
+ * @example
1932
+ * ```ts
1933
+ * const flushed = redisFlushAll()
1934
+ * console.log(`Flushed ${flushed} keys from all databases`)
1935
+ * ```
1936
+ */
1937
+ declare function redisFlushAll(): number;
1938
+ /**
1939
+ * Initialize Redis connection pool
1940
+ *
1941
+ * @param host - Redis host (e.g., "localhost")
1942
+ * @param port - Redis port (default: 6379)
1943
+ * @param pool_size - Connection pool size (default: 32)
1944
+ * @returns Pool info JSON
1945
+ *
1946
+ * @example
1947
+ * ```ts
1948
+ * const info = redisPoolConnect('localhost', 6379, 32)
1949
+ * console.log(info)
1950
+ * ```
1951
+ */
1952
+ declare function redisPoolConnect(host: string, port: number, pool_size?: number): string;
1953
+ /**
1954
+ * Get Redis pool statistics
1955
+ *
1956
+ * @returns Pool stats as JSON string
1957
+ *
1958
+ * @example
1959
+ * ```ts
1960
+ * const stats = redisPoolStats()
1961
+ * const parsed: RedisPoolStats = JSON.parse(stats)
1962
+ * console.log(`Connected: ${parsed.connected_count}`)
1963
+ * ```
1964
+ */
1965
+ declare function redisPoolStats(): RedisPoolStats;
1966
+ /**
1967
+ * Reconnect Redis pool after disconnect
1968
+ *
1969
+ * @returns "OK" if reconnected
1970
+ *
1971
+ * @example
1972
+ * ```ts
1973
+ * const result = redisPoolReconnect()
1974
+ * console.log(result)
1975
+ * ```
1976
+ */
1977
+ declare function redisPoolReconnect(): string;
1978
+ /**
1979
+ * Enable Redis cluster mode
1980
+ *
1981
+ * @param initial_nodes - Initial cluster nodes (host:port format)
1982
+ * @returns Cluster status JSON
1983
+ *
1984
+ * @example
1985
+ * ```ts
1986
+ * const status = redisEnableCluster(['localhost:6379', 'localhost:6380'])
1987
+ * ```
1988
+ */
1989
+ declare function redisEnableCluster(initial_nodes: string[]): RedisClusterStatus;
1990
+ /**
1991
+ * Disable Redis cluster mode
1992
+ *
1993
+ * @returns "OK" when disabled
1994
+ *
1995
+ * @example
1996
+ * ```ts
1997
+ * const result = redisDisableCluster()
1998
+ * ```
1999
+ */
2000
+ declare function redisDisableCluster(): string;
2001
+ /**
2002
+ * Get current Redis cluster status
2003
+ *
2004
+ * @returns Cluster status information
2005
+ *
2006
+ * @example
2007
+ * ```ts
2008
+ * const status = redisClusterStatus()
2009
+ * if (status.enabled) console.log(`Cluster has ${status.nodes.length} nodes`)
2010
+ * ```
2011
+ */
2012
+ declare function redisClusterStatus(): RedisClusterStatus;
2013
+ /**
2014
+ * Subscribe to Redis pub/sub channel
2015
+ *
2016
+ * @param channel - Channel name
2017
+ * @param callback - Function to call on message (optional)
2018
+ * @returns Subscription ID
2019
+ *
2020
+ * @example
2021
+ * ```ts
2022
+ * const id = redisSubscribe('cache:updates', (msg) => {
2023
+ * console.log(`Update: ${msg.message}`)
2024
+ * })
2025
+ * ```
2026
+ */
2027
+ declare function redisSubscribe(channel: string): string;
2028
+ /**
2029
+ * Publish message to Redis pub/sub channel
2030
+ *
2031
+ * @param channel - Channel name
2032
+ * @param message - Message to publish
2033
+ * @returns Number of subscribers that received the message
2034
+ *
2035
+ * @example
2036
+ * ```ts
2037
+ * const count = redisPublish('cache:updates', 'CSS compiled')
2038
+ * console.log(`Delivered to ${count} subscribers`)
2039
+ * ```
2040
+ */
2041
+ declare function redisPublish(channel: string, message: string): number;
2042
+ /**
2043
+ * Set expiration on key
2044
+ *
2045
+ * @param key - Cache key
2046
+ * @param ttl_seconds - Time to live in seconds
2047
+ * @returns 1 if timeout set, 0 if key doesn't exist
2048
+ *
2049
+ * @example
2050
+ * ```ts
2051
+ * redisExpirationSet('compiled:bg-blue-600', 3600)
2052
+ * ```
2053
+ */
2054
+ declare function redisExpirationSet(key: string, ttl_seconds: number): number;
2055
+ /**
2056
+ * Get expiration info for key
2057
+ *
2058
+ * @param key - Cache key
2059
+ * @returns Expiration information
2060
+ *
2061
+ * @example
2062
+ * ```ts
2063
+ * const info = redisExpirationGet('compiled:bg-blue-600')
2064
+ * console.log(`TTL: ${info.ttl_seconds} seconds`)
2065
+ * ```
2066
+ */
2067
+ declare function redisExpirationGet(key: string): KeyExpiration;
2068
+ /**
2069
+ * Get Redis server info
2070
+ *
2071
+ * @returns Server information JSON
2072
+ *
2073
+ * @example
2074
+ * ```ts
2075
+ * const info = redisInfo()
2076
+ * ```
2077
+ */
2078
+ declare function redisInfo(): string;
2079
+ /**
2080
+ * Monitor Redis operations in real-time (for debugging)
2081
+ *
2082
+ * @returns Monitor output stream
2083
+ *
2084
+ * @example
2085
+ * ```ts
2086
+ * const monitor = redisMonitor()
2087
+ * // Logs all Redis operations
2088
+ * ```
2089
+ */
2090
+ declare function redisMonitor(): string;
2091
+ /**
2092
+ * Get size of cache in bytes
2093
+ *
2094
+ * @returns Total memory usage in bytes
2095
+ *
2096
+ * @example
2097
+ * ```ts
2098
+ * const bytes = redisCacheSize()
2099
+ * console.log(`Cache: ${bytes / 1024 / 1024} MB`)
2100
+ * ```
2101
+ */
2102
+ declare function redisCacheSize(): number;
2103
+ /**
2104
+ * Get number of keys in cache
2105
+ *
2106
+ * @returns Total key count
2107
+ *
2108
+ * @example
2109
+ * ```ts
2110
+ * const count = redisCacheKeyCount()
2111
+ * console.log(`Cached keys: ${count}`)
2112
+ * ```
2113
+ */
2114
+ declare function redisCacheKeyCount(): number;
2115
+ /**
2116
+ * Clear Redis cache and reset statistics
2117
+ *
2118
+ * @returns Number of keys cleared
2119
+ *
2120
+ * @example
2121
+ * ```ts
2122
+ * const cleared = redisCacheClear()
2123
+ * console.log(`Cleared ${cleared} keys`)
2124
+ * ```
2125
+ */
2126
+ declare function redisCacheClear(): number;
2127
+ /**
2128
+ * Get Redis cache hit rate statistics
2129
+ *
2130
+ * @returns Hit rate percentage (0-100)
2131
+ *
2132
+ * @example
2133
+ * ```ts
2134
+ * const hitRate = redisCacheHitRate()
2135
+ * console.log(`Hit rate: ${hitRate}%`)
2136
+ * ```
2137
+ */
2138
+ declare function redisCacheHitRate(): number;
2139
+ /**
2140
+ * Enable Redis persistence (AOF/RDB)
2141
+ *
2142
+ * @param mode - "aof" or "rdb"
2143
+ * @returns "OK" on success
2144
+ *
2145
+ * @example
2146
+ * ```ts
2147
+ * redisEnablePersistence('aof')
2148
+ * ```
2149
+ */
2150
+ declare function redisEnablePersistence(mode: string): string;
2151
+ /**
2152
+ * Disable Redis persistence
2153
+ *
2154
+ * @returns "OK" on success
2155
+ *
2156
+ * @example
2157
+ * ```ts
2158
+ * redisDisablePersistence()
2159
+ * ```
2160
+ */
2161
+ declare function redisDisablePersistence(): string;
2162
+ /**
2163
+ * Save Redis data to disk (snapshot)
2164
+ *
2165
+ * @returns "OK" on success
2166
+ *
2167
+ * @example
2168
+ * ```ts
2169
+ * redisSnapshot()
2170
+ * ```
2171
+ */
2172
+ declare function redisSnapshot(): string;
2173
+ /**
2174
+ * Get Redis memory statistics and recommendations
2175
+ *
2176
+ * @returns Memory info JSON
2177
+ *
2178
+ * @example
2179
+ * ```ts
2180
+ * const memory = redisMemoryStats()
2181
+ * console.log(memory)
2182
+ * ```
2183
+ */
2184
+ declare function redisMemoryStats(): string;
2185
+ /**
2186
+ * Optimize Redis memory usage
2187
+ *
2188
+ * @returns Number of keys optimized
2189
+ *
2190
+ * @example
2191
+ * ```ts
2192
+ * const optimized = redisOptimizeMemory()
2193
+ * console.log(`Optimized ${optimized} keys`)
2194
+ * ```
2195
+ */
2196
+ declare function redisOptimizeMemory(): number;
2197
+ /**
2198
+ * Set Redis key eviction policy
2199
+ *
2200
+ * @param policy - LRU, LFU, TTL, RANDOM, etc.
2201
+ * @returns "OK" on success
2202
+ *
2203
+ * @example
2204
+ * ```ts
2205
+ * redisSetEvictionPolicy('allkeys-lru')
2206
+ * ```
2207
+ */
2208
+ declare function redisSetEvictionPolicy(policy: string): string;
2209
+ /**
2210
+ * Get current Redis eviction policy
2211
+ *
2212
+ * @returns Current policy name
2213
+ *
2214
+ * @example
2215
+ * ```ts
2216
+ * const policy = redisGetEvictionPolicy()
2217
+ * console.log(`Eviction policy: ${policy}`)
2218
+ * ```
2219
+ */
2220
+ declare function redisGetEvictionPolicy(): string;
2221
+ /**
2222
+ * Replicate data to another Redis instance
2223
+ *
2224
+ * @param target_host - Target host
2225
+ * @param target_port - Target port
2226
+ * @returns Number of keys replicated
2227
+ *
2228
+ * @example
2229
+ * ```ts
2230
+ * const replicated = redisReplicate('replica.example.com', 6379)
2231
+ * console.log(`Replicated ${replicated} keys`)
2232
+ * ```
2233
+ */
2234
+ declare function redisReplicate(target_host: string, target_port: number): number;
2235
+ /**
2236
+ * Get replication status
2237
+ *
2238
+ * @returns Replication info JSON
2239
+ *
2240
+ * @example
2241
+ * ```ts
2242
+ * const status = redisReplicationStatus()
2243
+ * console.log(status)
2244
+ * ```
2245
+ */
2246
+ declare function redisReplicationStatus(): string;
2247
+ /**
2248
+ * Sync cache between Redis instances (distributed cache sync)
2249
+ *
2250
+ * @param peers - Array of peer Redis addresses
2251
+ * @returns Number of keys synced
2252
+ *
2253
+ * @example
2254
+ * ```ts
2255
+ * const synced = redisCacheSync(['redis1:6379', 'redis2:6379'])
2256
+ * console.log(`Synced ${synced} keys`)
2257
+ * ```
2258
+ */
2259
+ declare function redisCacheSync(peers: string[]): number;
2260
+ /**
2261
+ * Enable automatic cache warming
2262
+ *
2263
+ * @param key_pattern - Glob pattern for keys to warm (e.g., "compiled:*")
2264
+ * @returns "OK" on success
2265
+ *
2266
+ * @example
2267
+ * ```ts
2268
+ * redisEnableCacheWarming('compiled:*')
2269
+ * ```
2270
+ */
2271
+ declare function redisEnableCacheWarming(key_pattern: string): string;
2272
+ /**
2273
+ * Disable cache warming
2274
+ *
2275
+ * @returns "OK" on success
2276
+ *
2277
+ * @example
2278
+ * ```ts
2279
+ * redisDisableCacheWarming()
2280
+ * ```
2281
+ */
2282
+ declare function redisDisableCacheWarming(): string;
2283
+ /**
2284
+ * Diagnose Redis connection issues
2285
+ *
2286
+ * @returns Diagnostic report
2287
+ *
2288
+ * @example
2289
+ * ```ts
2290
+ * const diagnosis = redisDiagnose()
2291
+ * console.log(diagnosis)
2292
+ * ```
2293
+ */
2294
+ declare function redisDiagnose(): string;
2295
+
2296
+ /**
2297
+ * watchSystemNative.ts
2298
+ *
2299
+ * Phase 5.4: Watch System & File Monitoring - Real-time CSS recompilation
2300
+ * Exposes 12 watch/monitoring functions for hot-reload and incremental compilation
2301
+ */
2302
+ /**
2303
+ * File watch event
2304
+ */
2305
+ interface WatchEvent {
2306
+ event_type: "create" | "modify" | "delete" | "rename";
2307
+ file_path: string;
2308
+ timestamp_ms: number;
2309
+ is_dir: boolean;
132
2310
  }
133
- interface NativeTransformResult {
134
- code: string;
135
- classes: string[];
136
- changed: boolean;
137
- rscJson?: string;
138
- metadataJson?: string;
2311
+ /**
2312
+ * Watch handle for tracking active watchers
2313
+ */
2314
+ interface WatchHandle {
2315
+ handle_id: number;
2316
+ patterns: string[];
2317
+ is_running: boolean;
2318
+ created_at_ms: number;
139
2319
  }
140
- interface ClassExtractResult {
141
- classes: string[];
142
- component_names: string[];
143
- has_tw_usage: boolean;
144
- has_use_client: boolean;
145
- imports: string[];
2320
+ /**
2321
+ * Watch statistics
2322
+ */
2323
+ interface WatchStats {
2324
+ active_watchers: number;
2325
+ total_events: number;
2326
+ events_this_second: number;
2327
+ average_latency_ms: number;
2328
+ largest_batch_size: number;
146
2329
  }
147
- declare const getNativeBridge: () => NativeBridge;
148
- declare const resetNativeBridgeCache: () => void;
149
- declare const adaptNativeResult: (raw: NativeTransformResult) => {
150
- code: string;
151
- classes: string[];
152
- changed: boolean;
153
- rsc?: NativeRscResult;
154
- metadata?: ComponentMetadata[];
155
- };
156
-
157
2330
  /**
158
- * tailwind-styled-v5 Compiler Index
2331
+ * Start file system watcher for directory
2332
+ *
2333
+ * @param root_path - Directory to watch
2334
+ * @param patterns - Glob patterns to match (e.g., ["*.tsx", "*.ts"])
2335
+ * @returns Handle ID for the watcher
2336
+ *
2337
+ * @example
2338
+ * ```ts
2339
+ * const handle = startWatch('./src', ['*.tsx', '*.ts'])
2340
+ * // Watcher is now active
2341
+ * ```
2342
+ */
2343
+ declare function startWatch(root_path: string, patterns?: string[]): number;
2344
+ /**
2345
+ * Poll for watch events (non-blocking)
2346
+ *
2347
+ * @param handle - Watcher handle from startWatch()
2348
+ * @param timeout_ms - Max time to wait for events (default: 100)
2349
+ * @returns Array of watch events
2350
+ *
2351
+ * @example
2352
+ * ```ts
2353
+ * const handle = startWatch('./src', ['*.tsx'])
2354
+ * const events = pollWatchEvents(handle, 100)
2355
+ * events.forEach(evt => {
2356
+ * console.log(`${evt.event_type}: ${evt.file_path}`)
2357
+ * })
2358
+ * ```
2359
+ */
2360
+ declare function pollWatchEvents(handle: number, timeout_ms?: number): WatchEvent[];
2361
+ /**
2362
+ * Stop file system watcher
2363
+ *
2364
+ * @param handle - Watcher handle
2365
+ * @returns Number of events processed before stopping
2366
+ *
2367
+ * @example
2368
+ * ```ts
2369
+ * const eventsProcessed = stopWatch(handle)
2370
+ * console.log(`Watcher processed ${eventsProcessed} events`)
2371
+ * ```
2372
+ */
2373
+ declare function stopWatch(handle: number): number;
2374
+ /**
2375
+ * Add pattern to active watcher
2376
+ *
2377
+ * @param handle - Watcher handle
2378
+ * @param pattern - Glob pattern to add (e.g., "*.md")
2379
+ * @returns "OK" on success
2380
+ *
2381
+ * @example
2382
+ * ```ts
2383
+ * watchAddPattern(handle, '*.md')
2384
+ * // Now watching markdown files too
2385
+ * ```
2386
+ */
2387
+ declare function watchAddPattern(handle: number, pattern: string): string;
2388
+ /**
2389
+ * Remove pattern from watcher
2390
+ *
2391
+ * @param handle - Watcher handle
2392
+ * @param pattern - Pattern to remove
2393
+ * @returns "OK" on success
2394
+ *
2395
+ * @example
2396
+ * ```ts
2397
+ * watchRemovePattern(handle, '*.md')
2398
+ * ```
2399
+ */
2400
+ declare function watchRemovePattern(handle: number, pattern: string): string;
2401
+ /**
2402
+ * Get all active watcher handles
2403
+ *
2404
+ * @returns Array of active watch handles
2405
+ *
2406
+ * @example
2407
+ * ```ts
2408
+ * const handles = watchGetActiveHandles()
2409
+ * console.log(`${handles.length} active watchers`)
2410
+ * ```
2411
+ */
2412
+ declare function watchGetActiveHandles(): WatchHandle[];
2413
+ /**
2414
+ * Clear all active watchers
2415
+ *
2416
+ * @returns Number of watchers cleared
2417
+ *
2418
+ * @example
2419
+ * ```ts
2420
+ * const cleared = watchClearAll()
2421
+ * console.log(`Cleared ${cleared} watchers`)
2422
+ * ```
2423
+ */
2424
+ declare function watchClearAll(): number;
2425
+ /**
2426
+ * Convert watch event type to string
2427
+ *
2428
+ * @param event_type_code - Event type code (0-3)
2429
+ * @returns Event type as string
2430
+ *
2431
+ * @example
2432
+ * ```ts
2433
+ * const typeStr = watchEventTypeToString(0)
2434
+ * console.log(typeStr) // "create"
2435
+ * ```
2436
+ */
2437
+ declare function watchEventTypeToString(event_type_code: number): string;
2438
+ /**
2439
+ * Check if watcher is running
2440
+ *
2441
+ * @param handle - Watcher handle
2442
+ * @returns True if running
2443
+ *
2444
+ * @example
2445
+ * ```ts
2446
+ * if (isWatchRunning(handle)) {
2447
+ * console.log("Watcher is active")
2448
+ * }
2449
+ * ```
2450
+ */
2451
+ declare function isWatchRunning(handle: number): boolean;
2452
+ /**
2453
+ * Get watch system statistics
2454
+ *
2455
+ * @returns Watch statistics
2456
+ *
2457
+ * @example
2458
+ * ```ts
2459
+ * const stats = getWatchStats()
2460
+ * console.log(`Active: ${stats.active_watchers}, Events: ${stats.total_events}`)
2461
+ * ```
2462
+ */
2463
+ declare function getWatchStats(): WatchStats;
2464
+ /**
2465
+ * Pause watching (pause event delivery without stopping watcher)
2466
+ *
2467
+ * @param handle - Watcher handle
2468
+ * @returns "OK" on success
2469
+ *
2470
+ * @example
2471
+ * ```ts
2472
+ * watchPause(handle)
2473
+ * // Events still detected but not delivered
2474
+ * ```
2475
+ */
2476
+ declare function watchPause(handle: number): string;
2477
+ /**
2478
+ * Resume watching after pause
2479
+ *
2480
+ * @param handle - Watcher handle
2481
+ * @returns "OK" on success
2482
+ *
2483
+ * @example
2484
+ * ```ts
2485
+ * watchResume(handle)
2486
+ * // Event delivery resumes
2487
+ * ```
2488
+ */
2489
+ declare function watchResume(handle: number): string;
2490
+ /**
2491
+ * Scan cache and get optimization recommendations
2492
+ *
2493
+ * @returns Optimization hints JSON
2494
+ *
2495
+ * @example
2496
+ * ```ts
2497
+ * const hints = scanCacheOptimizations()
2498
+ * console.log(hints)
2499
+ * ```
2500
+ */
2501
+ declare function scanCacheOptimizations(): string;
2502
+ /**
2503
+ * Get plugin hook list
2504
+ *
2505
+ * @returns Available plugin hooks
2506
+ *
2507
+ * @example
2508
+ * ```ts
2509
+ * const hooks = getPluginHooks()
2510
+ * console.log(hooks)
2511
+ * ```
2512
+ */
2513
+ declare function getPluginHooks(): string[];
2514
+ /**
2515
+ * Register plugin hook handler
2516
+ *
2517
+ * @param hook_name - Hook name
2518
+ * @param handler_id - Handler identifier
2519
+ * @returns "OK" on success
2520
+ *
2521
+ * @example
2522
+ * ```ts
2523
+ * registerPluginHook('compile:before', 'my-handler-1')
2524
+ * ```
2525
+ */
2526
+ declare function registerPluginHook(hook_name: string, handler_id: string): string;
2527
+ /**
2528
+ * Unregister plugin hook handler
2529
+ *
2530
+ * @param hook_name - Hook name
2531
+ * @param handler_id - Handler identifier
2532
+ * @returns "OK" on success
2533
+ *
2534
+ * @example
2535
+ * ```ts
2536
+ * unregisterPluginHook('compile:before', 'my-handler-1')
2537
+ * ```
2538
+ */
2539
+ declare function unregisterPluginHook(hook_name: string, handler_id: string): string;
2540
+ /**
2541
+ * Emit plugin hook event
2542
+ *
2543
+ * @param hook_name - Hook name
2544
+ * @param data_json - Event data as JSON
2545
+ * @returns Modified data
2546
+ *
2547
+ * @example
2548
+ * ```ts
2549
+ * const result = emitPluginHook('compile:before', JSON.stringify({css: '...'}))
2550
+ * ```
2551
+ */
2552
+ declare function emitPluginHook(hook_name: string, data_json: string): string;
2553
+ /**
2554
+ * Get compilation performance metrics
2555
+ *
2556
+ * @returns Performance metrics
2557
+ *
2558
+ * @example
2559
+ * ```ts
2560
+ * const metrics = getCompilationMetrics()
2561
+ * console.log(metrics)
2562
+ * ```
2563
+ */
2564
+ declare function getCompilationMetrics(): string;
2565
+ /**
2566
+ * Reset compilation performance counters
2567
+ *
2568
+ * @returns "OK" on success
2569
+ *
2570
+ * @example
2571
+ * ```ts
2572
+ * resetCompilationMetrics()
2573
+ * ```
2574
+ */
2575
+ declare function resetCompilationMetrics(): string;
2576
+ /**
2577
+ * Validate CSS output for errors
2578
+ *
2579
+ * @param css - CSS to validate
2580
+ * @returns Validation result as JSON
2581
+ *
2582
+ * @example
2583
+ * ```ts
2584
+ * const result = validateCssOutput('.test { color: red; }')
2585
+ * ```
2586
+ */
2587
+ declare function validateCssOutput(css: string): string;
2588
+ /**
2589
+ * Get compiler diagnostics
159
2590
  *
160
- * All functions are backed by native Rust bindings.
161
- * No JavaScript fallback - native is required.
2591
+ * @returns Diagnostic information
2592
+ *
2593
+ * @example
2594
+ * ```ts
2595
+ * const diagnostics = getCompilerDiagnostics()
2596
+ * console.log(diagnostics)
2597
+ * ```
162
2598
  */
2599
+ declare function getCompilerDiagnostics(): string;
163
2600
 
164
2601
  type LoaderOutput = {
165
2602
  code: string;
166
2603
  changed: boolean;
167
2604
  classes: string[];
2605
+ staticCss?: string;
168
2606
  rsc?: {
169
2607
  isServer?: boolean;
170
2608
  needsClientDirective?: boolean;
@@ -182,7 +2620,7 @@ declare const compileCssNative: (classes: string[], prefix?: string | null) => N
182
2620
  declare const generateCssForClasses: (classes: string[], _tailwindConfig?: Record<string, unknown>, root?: string, cssEntryContent?: string, minify?: boolean) => Promise<string>;
183
2621
  declare const extractAllClasses: (source: string) => string[];
184
2622
  declare const extractClassesFromSource: (source: string) => string;
185
- declare const astExtractClasses: (source: string, filename: string) => string[];
2623
+ declare const astExtractClasses: (source: string, _filename: string) => string[];
186
2624
  declare const parseClasses: (raw: string) => Array<{
187
2625
  raw: string;
188
2626
  type: string;
@@ -228,42 +2666,12 @@ declare const checkAgainstSafelist: (classes: string[], safelist: string[]) => {
228
2666
  unmatched: string[];
229
2667
  safelistSize: number;
230
2668
  };
231
- declare const hoistComponents: (source: string) => {
232
- code: string;
233
- hoisted: string[];
234
- warnings: string[];
235
- };
236
- declare const compileVariantTable: (configJson: string) => {
237
- id: string;
238
- tableJson: string;
239
- keys: string[];
240
- defaultKey: string;
241
- combinations: number;
242
- };
243
- declare const compileVariants: (componentId: string, config: Record<string, unknown>) => {
244
- id: string;
245
- tableJson: string;
246
- keys: string[];
247
- defaultKey: string;
248
- combinations: number;
249
- };
250
- declare const classifyAndSortClasses: (classes: string[]) => {
251
- className: string;
252
- bucket: string;
253
- sortOrder: number;
254
- }[];
255
- declare const mergeCssDeclarations: (cssChunks: string[]) => {
256
- declarationsJson: string;
257
- declarationString: string;
258
- count: number;
259
- };
260
- declare const analyzeClassUsage: (classes: string[], scanResultJson: string, css: string) => {
261
- className: string;
262
- usageCount: number;
263
- filesJson: string;
264
- bundleSizeBytes: number;
265
- isDeadCode: boolean;
266
- }[];
2669
+ declare const hoistComponents: (source: string) => HoistResult;
2670
+ declare const compileVariantTable: (configJson: string) => VariantTableResult;
2671
+ declare const compileVariants: (componentId: string, config: Record<string, unknown>) => VariantTableResult;
2672
+ declare const classifyAndSortClasses: (classes: string[]) => ClassifyResult[];
2673
+ declare const mergeCssDeclarations: (cssChunks: string[]) => MergeResult;
2674
+ declare const analyzeClassUsage: (classes: string[], scanResultJson: string, css: string) => ClassUsageItem[];
267
2675
  declare const analyzeRsc: (source: string, filename: string) => {
268
2676
  isServer: boolean;
269
2677
  needsClientDirective: boolean;
@@ -276,7 +2684,7 @@ declare const analyzeFile: (source: string, filename: string) => {
276
2684
  interactiveClasses: never[];
277
2685
  canStaticResolveVariants: boolean;
278
2686
  };
279
- declare const analyzeVariantUsage: (source: string, componentName: string, variantKeys: string[]) => {
2687
+ declare const analyzeVariantUsage: (_source: string, _componentName: string, _variantKeys: string[]) => {
280
2688
  resolved: Record<string, string>;
281
2689
  dynamic: string[];
282
2690
  };
@@ -293,10 +2701,15 @@ declare const analyzeClasses: (filesJson: string, cwd: string, flags: number) =>
293
2701
  } | null;
294
2702
  declare const generateSafelist: (scanDirs: string[], outputPath?: string, cwd?: string) => string[];
295
2703
  declare const loadSafelist: (safelistPath: string) => string[];
296
- declare const loadTailwindConfig: (cwd?: string) => any;
2704
+ declare const loadTailwindConfig: (cwd?: string) => {};
297
2705
  declare const getContentPaths: (cwd?: string) => {
298
- content: any[];
2706
+ content: string[];
299
2707
  };
2708
+ /**
2709
+ * Extract container configs dari source dan generate static `@container` CSS.
2710
+ * Native-only: delegates ke Rust extractTwContainerConfigs.
2711
+ */
2712
+ declare function extractContainerCssFromSource(source: string): string;
300
2713
  declare const runLoaderTransform: (ctx: {
301
2714
  filepath: string;
302
2715
  source: string;
@@ -328,7 +2741,28 @@ declare const BucketEngine: {
328
2741
  };
329
2742
  };
330
2743
  declare const classifyNode: (_node: unknown) => string;
331
- declare const detectConflicts: (classes: string[]) => string[];
2744
+ declare const detectConflicts: (_classes: string[]) => string[];
332
2745
  declare const bucketSort: (classes: string[]) => string[];
2746
+ interface TwStateConfigEntry {
2747
+ tag: string;
2748
+ componentName: string;
2749
+ statesJson: string;
2750
+ sourceFile: string;
2751
+ }
2752
+ interface StaticStateCssInput {
2753
+ tag: string;
2754
+ componentName: string;
2755
+ statesJson: string;
2756
+ }
2757
+ interface GeneratedStateRule {
2758
+ selector: string;
2759
+ declarations: string;
2760
+ cssRule: string;
2761
+ componentName: string;
2762
+ stateName: string;
2763
+ }
2764
+ declare const extractTwStateConfigs: (source: string, filename: string) => TwStateConfigEntry[];
2765
+ declare const generateStaticStateCss: (inputs: StaticStateCssInput[], resolvedCss?: string | null) => GeneratedStateRule[];
2766
+ declare const extractAndGenerateStateCss: (source: string, filename: string) => GeneratedStateRule[];
333
2767
 
334
- export { BucketEngine, type ClassExtractResult, type ComponentMetadata, IncrementalEngine, type LoaderOutput, type NativeBridge, type NativeRscResult, type NativeTransformResult, adaptNativeResult, analyzeClassUsage, analyzeClasses, analyzeFile, analyzeRsc, analyzeVariantUsage, astExtractClasses, batchExtractClasses, bucketSort, buildStyleTag, checkAgainstSafelist, classifyAndSortClasses, classifyNode, compileCssFromClasses, compileCssNative, compileVariantTable, compileVariants, detectConflicts, diffClassLists, eliminateDeadCss, extractAllClasses, extractClassesFromSource, extractComponentUsage, fileToRoute, findDeadVariants, generateCssForClasses, generateSafelist, getAllRoutes, getBucketEngine, getContentPaths, getIncrementalEngine, getNativeBridge, getRouteClasses, hasTwUsage, hoistComponents, injectClientDirective, injectServerOnlyComment, isAlreadyTransformed, loadSafelist, loadTailwindConfig, mergeClassesStatic, mergeCssDeclarations, normalizeAndDedupClasses, normalizeClasses, optimizeCss, parseClasses, registerFileClasses, registerGlobalClasses, resetBucketEngine, resetIncrementalEngine, resetNativeBridgeCache, runElimination, runLoaderTransform, scanProjectUsage, shouldProcess, shouldSkipFile, transformSource };
2768
+ export { type BatchExtractResult, BucketEngine, type CacheOptimizationHints, type CacheStatistics, type ClassExtractResult, type ClassUsageItem, type ClassifyResult, type CompiledAnimation, type CompiledCssRule, type CompiledTheme, type ComponentMetadata, type ConflictGroupInfo, type ContainerConfig, type CssCompileResult, type DeadCodeResult, type FileChangeEvent, type FileDiff, type FileFingerprint, type GeneratedStateCss, type GeneratedStateRule, type HoistResult, type IncrementalDiffResult, IncrementalEngine, type KeyExpiration, type LoaderOutput, type MergeResult, type NativeBridge, type NativeRscResult, type NativeTransformResult, type OptimalCacheConfig, type PoolInfo, type PrefilterFileResult, type ProcessedCssResult, type ProcessedFileChange, type PruneResult, type PubSubMessage, type RebuildWorkspaceResult, type RedisCacheConfig, type RedisClusterNode, type RedisClusterStatus, type RedisPoolStats, type RegistrySnapshot, type ResolvedClassName, type ResolvedVariantConfig, type SafelistCheckResult, type ScanFileResult, type ScanWorkspaceResult, type StateCssConfig, type StateInjectionResult, type StaticStateCssInput, type ThemeCascadeResult, type ThemeValidationResult, type TwMergeOptions, type TwStateConfigEntry, type VariantTableResult, type WatchEvent, type WatchHandle, type WatchStats, adaptNativeResult, analyzeClassUsage, analyzeClassUsageNative, analyzeClasses, analyzeClassesNative, analyzeFile, analyzeRsc, analyzeRscNative, analyzeVariantUsage, astExtractClasses, atomicRegistrySize, batchExtractClasses, batchExtractClassesNative, bucketSort, buildStyleTag, cachePriority, cacheRead, cacheWrite, checkAgainstSafelist, checkAgainstSafelistNative, classifyAndSortClasses, classifyAndSortClassesNative, classifyNode, clearAllCaches, clearAtomicRegistry, clearCompileCache, clearCssGenCache, clearParseCache, clearResolveCache, clearThemeCache, collectFiles, compileAnimation, compileClass, compileClasses, compileCssFromClasses, compileCssLightning, compileCssNative, compileCssNative2, compileKeyframes, compileTheme, compileToCss, compileToCssBatch, compileVariantTable, compileVariantTableNative, compileVariants, computeIncrementalDiff, createFingerprint, detectConflicts, detectDeadCode, diffClassLists, eliminateDeadCss, eliminateDeadCssNative, emitPluginHook, estimateOptimalCacheConfig, extractAllClasses, extractAndGenerateStateCss, extractAndGenerateStateCssNative, extractClassesFromSource, extractClassesFromSourceNative, extractComponentUsage, extractContainerCssFromSource, extractTwContainerConfigs, extractTwStateConfigs, extractTwStateConfigsNative, fileToRoute, findDeadVariants, generateAtomicCss, generateCssForClasses, generateCssNative, generateSafelist, generateStaticStateCss, generateStaticStateCssNative, generateSubComponentTypes, getAllRoutes, getBucketEngine, getCacheOptimizationHints, getCacheStatistics, getCacheStats, getCompilationMetrics, getCompilerDiagnostics, getContentPaths, getIncrementalEngine, getNativeBridge, getPluginHooks, getRouteClasses, getWatchStats, hasTwUsage, hashContent, hoistComponents, hoistComponentsNative, idRegistryActiveCount, idRegistryCreate, idRegistryDestroy, idRegistryExport, idRegistryGenerate, idRegistryImport, idRegistryLookup, idRegistryNext, idRegistryReset, idRegistrySnapshot, injectClientDirective, injectServerOnlyComment, injectStateHash, isAlreadyTransformed, isWatchRunning, layoutClassesToCss, loadSafelist, loadTailwindConfig, mergeClassesStatic, mergeCssDeclarations, mergeCssDeclarationsNative, minifyCss, normalizeAndDedupClasses, normalizeClasses, optimizeCss, optimizeCssNative, parseAtomicClass, parseClasses, pollWatchEvents, processFileChange, processTailwindCssLightning, propertyIdToString, pruneStaleCacheEntries, rebuildWorkspaceResult, redisCacheClear, redisCacheHitRate, redisCacheKeyCount, redisCacheSize, redisCacheSync, redisClusterStatus, redisDelete, redisDiagnose, redisDisableCacheWarming, redisDisableCluster, redisDisablePersistence, redisEnableCacheWarming, redisEnableCluster, redisEnablePersistence, redisExists, redisExpirationGet, redisExpirationSet, redisFlushAll, redisFlushDb, redisGet, redisGetEvictionPolicy, redisInfo, redisMemoryStats, redisMget, redisMonitor, redisMset, redisOptimizeMemory, redisPing, redisPoolConnect, redisPoolReconnect, redisPoolStats, redisPublish, redisReplicate, redisReplicationStatus, redisSet, redisSetEvictionPolicy, redisSnapshot, redisSubscribe, registerFileClasses, registerGlobalClasses, registerPluginHook, registerPropertyName, registerValueName, resetBucketEngine, resetCompilationMetrics, resetIncrementalEngine, resetNativeBridgeCache, resolveCascade, resolveClassNames, resolveConflictGroup, resolveSimpleVariants, resolveThemeValue, resolveVariants, reverseLookupProperty, reverseLookupValue, runElimination, runLoaderTransform, scanCacheOptimizations, scanFile, scanFileNative, scanFilesBatchNative, scanProjectUsage, scanWorkspace, shouldProcess, shouldSkipFile, startWatch, stopWatch, toAtomicClasses, transformSource, twMerge, twMergeMany, twMergeManyWithSeparator, twMergeRaw, twMergeWithSeparator, unregisterPluginHook, validateCssOutput, validateThemeConfig, valueIdToString, walkAndPrefilterSourceFiles, watchAddPattern, watchClearAll, watchEventTypeToString, watchGetActiveHandles, watchPause, watchRemovePattern, watchResume };