tailwind-styled-v4 5.0.12 → 5.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +100 -4
  2. package/dist/animate.d.mts +4 -0
  3. package/dist/animate.d.ts +4 -0
  4. package/dist/animate.js +22 -0
  5. package/dist/animate.js.map +1 -1
  6. package/dist/animate.mjs +22 -0
  7. package/dist/animate.mjs.map +1 -1
  8. package/dist/atomic.js +56 -14
  9. package/dist/atomic.js.map +1 -1
  10. package/dist/atomic.mjs +56 -14
  11. package/dist/atomic.mjs.map +1 -1
  12. package/dist/cli.js +156 -14
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cli.mjs +156 -14
  15. package/dist/cli.mjs.map +1 -1
  16. package/dist/compiler.d.mts +1045 -991
  17. package/dist/compiler.d.ts +1045 -991
  18. package/dist/compiler.js +891 -925
  19. package/dist/compiler.js.map +1 -1
  20. package/dist/compiler.mjs +890 -925
  21. package/dist/compiler.mjs.map +1 -1
  22. package/dist/engine.js +1651 -354
  23. package/dist/engine.js.map +1 -1
  24. package/dist/engine.mjs +1650 -353
  25. package/dist/engine.mjs.map +1 -1
  26. package/dist/index.browser.mjs +3 -1
  27. package/dist/index.browser.mjs.map +1 -1
  28. package/dist/index.js +1682 -365
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +1682 -365
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/next.js +1076 -986
  33. package/dist/next.js.map +1 -1
  34. package/dist/next.mjs +1076 -986
  35. package/dist/next.mjs.map +1 -1
  36. package/dist/shared.d.mts +3 -2
  37. package/dist/shared.d.ts +3 -2
  38. package/dist/shared.js +1595 -298
  39. package/dist/shared.js.map +1 -1
  40. package/dist/shared.mjs +1595 -298
  41. package/dist/shared.mjs.map +1 -1
  42. package/dist/svelte.js +42 -24
  43. package/dist/svelte.js.map +1 -1
  44. package/dist/svelte.mjs +42 -24
  45. package/dist/svelte.mjs.map +1 -1
  46. package/dist/turbopackLoader.js +1606 -309
  47. package/dist/turbopackLoader.js.map +1 -1
  48. package/dist/turbopackLoader.mjs +1606 -309
  49. package/dist/turbopackLoader.mjs.map +1 -1
  50. package/dist/tw.js +156 -14
  51. package/dist/tw.js.map +1 -1
  52. package/dist/tw.mjs +156 -14
  53. package/dist/tw.mjs.map +1 -1
  54. package/dist/vite.js +1636 -339
  55. package/dist/vite.js.map +1 -1
  56. package/dist/vite.mjs +1636 -339
  57. package/dist/vite.mjs.map +1 -1
  58. package/dist/vue.js +42 -24
  59. package/dist/vue.js.map +1 -1
  60. package/dist/vue.mjs +42 -24
  61. package/dist/vue.mjs.map +1 -1
  62. package/dist/webpackLoader.js +80 -29
  63. package/dist/webpackLoader.js.map +1 -1
  64. package/dist/webpackLoader.mjs +80 -29
  65. package/dist/webpackLoader.mjs.map +1 -1
  66. package/native/tailwind-styled-native.node +0 -0
  67. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  68. package/package.json +3 -2
  69. package/native/index.node +0 -0
package/dist/engine.js CHANGED
@@ -881,27 +881,15 @@ function resolveNativeBinary(runtimeDir) {
881
881
  }
882
882
  tried.push(`env:${envPath} (not found)`);
883
883
  }
884
- const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
885
- for (const pkg of prebuiltPkgs) {
886
- try {
887
- const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
888
- if (fs3__namespace.existsSync(candidate)) {
889
- return { path: candidate, source: "prebuilt", platform, tried };
890
- }
891
- tried.push(`prebuilt:${pkg} (resolved but missing)`);
892
- } catch {
893
- tried.push(`prebuilt:${pkg} (not installed)`);
894
- }
895
- }
896
884
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
897
- const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
885
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
898
886
  if (runtimeDir) {
899
887
  for (const depth of ["..", path9__namespace.join("..", ".."), path9__namespace.join("..", "..", "..")]) {
900
888
  const pkgRoot = path9__namespace.resolve(runtimeDir, depth);
901
889
  for (const bin of BINARY_NAMES_SELF) {
902
890
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
903
891
  const candidate = path9__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
904
- tried.push(`self-bundled:${candidate}`);
892
+ tried.push(`native:${candidate}`);
905
893
  if (fs3__namespace.existsSync(candidate)) {
906
894
  return { path: candidate, source: "prebuilt", platform, tried };
907
895
  }
@@ -909,6 +897,18 @@ function resolveNativeBinary(runtimeDir) {
909
897
  }
910
898
  }
911
899
  }
900
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
901
+ for (const pkg of prebuiltPkgs) {
902
+ try {
903
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
904
+ if (fs3__namespace.existsSync(candidate)) {
905
+ return { path: candidate, source: "prebuilt", platform, tried };
906
+ }
907
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
908
+ } catch {
909
+ tried.push(`prebuilt:${pkg} (not installed)`);
910
+ }
911
+ }
912
912
  const cwd = process.cwd();
913
913
  const base = runtimeDir ?? cwd;
914
914
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
@@ -1081,11 +1081,484 @@ Tried paths: ${result.tried.join("\n")}`);
1081
1081
  }
1082
1082
  });
1083
1083
 
1084
- // packages/domain/compiler/src/tailwindEngine.ts
1084
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1085
+ async function generateCssNative(classes, options) {
1086
+ const { theme } = options;
1087
+ const native = getNativeBridge();
1088
+ if (!native?.generateCssNative) {
1089
+ throw new Error(
1090
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1091
+ );
1092
+ }
1093
+ const themeJson = JSON.stringify(theme);
1094
+ const css = native.generateCssNative(classes, themeJson);
1095
+ return css;
1096
+ }
1097
+ function clearThemeCache() {
1098
+ try {
1099
+ const native = getNativeBridge();
1100
+ if (!native?.clearThemeCache) {
1101
+ return;
1102
+ }
1103
+ native.clearThemeCache();
1104
+ } catch {
1105
+ }
1106
+ }
1107
+ var init_cssGeneratorNative = __esm({
1108
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1109
+ init_nativeBridge();
1110
+ }
1111
+ });
1112
+
1113
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1114
+ function compileCssNative2(classes, prefix) {
1115
+ const native = getNativeBridge();
1116
+ if (!native?.compileCss) throw new Error("compileCss not available");
1117
+ return native.compileCss(classes, prefix);
1118
+ }
1119
+ function compileCssLightning(classes) {
1120
+ const native = getNativeBridge();
1121
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1122
+ return native.compileCssLightning(classes);
1123
+ }
1124
+ function extractTwStateConfigsNative(source, filename) {
1125
+ const native = getNativeBridge();
1126
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1127
+ return native.extractTwStateConfigs(source, filename);
1128
+ }
1129
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1130
+ const native = getNativeBridge();
1131
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1132
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1133
+ }
1134
+ function extractAndGenerateStateCssNative(source, filename) {
1135
+ const native = getNativeBridge();
1136
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1137
+ return native.extractAndGenerateStateCss(source, filename);
1138
+ }
1139
+ function layoutClassesToCss(classes) {
1140
+ const native = getNativeBridge();
1141
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1142
+ return native.layoutClassesToCss(classes);
1143
+ }
1144
+ function hashContent(input, algorithm = "sha256", length = 8) {
1145
+ const native = getNativeBridge();
1146
+ if (!native?.hashContent) throw new Error("hashContent not available");
1147
+ return native.hashContent(input, algorithm, length);
1148
+ }
1149
+ function extractTwContainerConfigs(source) {
1150
+ const native = getNativeBridge();
1151
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1152
+ return native.extractTwContainerConfigs(source);
1153
+ }
1154
+ function parseAtomicClass(twClass) {
1155
+ const native = getNativeBridge();
1156
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1157
+ return native.parseAtomicClass(twClass);
1158
+ }
1159
+ function generateAtomicCss(rulesJson) {
1160
+ const native = getNativeBridge();
1161
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1162
+ return native.generateAtomicCss(rulesJson);
1163
+ }
1164
+ function toAtomicClasses(twClasses) {
1165
+ const native = getNativeBridge();
1166
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1167
+ return native.toAtomicClasses(twClasses);
1168
+ }
1169
+ function clearAtomicRegistry() {
1170
+ const native = getNativeBridge();
1171
+ if (!native?.clearAtomicRegistry) return;
1172
+ native.clearAtomicRegistry();
1173
+ }
1174
+ function atomicRegistrySize() {
1175
+ const native = getNativeBridge();
1176
+ if (!native?.atomicRegistrySize) return 0;
1177
+ return native.atomicRegistrySize();
1178
+ }
1179
+ var init_compilationNative = __esm({
1180
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1181
+ init_nativeBridge();
1182
+ }
1183
+ });
1184
+
1185
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1186
+ function compileClass(input) {
1187
+ const native = getNativeBridge();
1188
+ if (!native?.compile_class) throw new Error("compile_class not available");
1189
+ const resultJson = native.compile_class(input);
1190
+ try {
1191
+ return JSON.parse(resultJson);
1192
+ } catch {
1193
+ return {
1194
+ selector: "",
1195
+ declarations: "",
1196
+ properties: [],
1197
+ specificity: 0
1198
+ };
1199
+ }
1200
+ }
1201
+ function compileClasses(inputs) {
1202
+ const native = getNativeBridge();
1203
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1204
+ const resultJson = native.compile_classes(inputs);
1205
+ try {
1206
+ return JSON.parse(resultJson);
1207
+ } catch {
1208
+ return {
1209
+ css: "",
1210
+ resolved_classes: [],
1211
+ unknown_classes: [],
1212
+ size_bytes: 0,
1213
+ duration_ms: 0
1214
+ };
1215
+ }
1216
+ }
1217
+ function compileToCss(input, minify) {
1218
+ const native = getNativeBridge();
1219
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1220
+ return native.compile_to_css(input, minify ?? false);
1221
+ }
1222
+ function compileToCssBatch(inputs, minify) {
1223
+ const native = getNativeBridge();
1224
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1225
+ return native.compile_to_css_batch(inputs, minify ?? false);
1226
+ }
1227
+ function minifyCss(css) {
1228
+ const native = getNativeBridge();
1229
+ if (!native?.minify_css) throw new Error("minify_css not available");
1230
+ return native.minify_css(css);
1231
+ }
1232
+ function compileAnimation(animationName, from, to) {
1233
+ const native = getNativeBridge();
1234
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1235
+ const resultJson = native.compile_animation(animationName, from, to);
1236
+ try {
1237
+ return JSON.parse(resultJson);
1238
+ } catch {
1239
+ return {
1240
+ animation_id: "",
1241
+ keyframes_css: "",
1242
+ animation_rule: "",
1243
+ duration_ms: 0
1244
+ };
1245
+ }
1246
+ }
1247
+ function compileKeyframes(name, stopsJson) {
1248
+ const native = getNativeBridge();
1249
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1250
+ const resultJson = native.compile_keyframes(name, stopsJson);
1251
+ try {
1252
+ return JSON.parse(resultJson);
1253
+ } catch {
1254
+ return {
1255
+ animation_id: "",
1256
+ keyframes_css: "",
1257
+ animation_rule: "",
1258
+ duration_ms: 0
1259
+ };
1260
+ }
1261
+ }
1262
+ function compileTheme(tokensJson, themeName, prefix) {
1263
+ const native = getNativeBridge();
1264
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1265
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1266
+ try {
1267
+ return JSON.parse(resultJson);
1268
+ } catch {
1269
+ return {
1270
+ selector: ":root",
1271
+ variables: [],
1272
+ variables_css: "",
1273
+ theme_name: themeName
1274
+ };
1275
+ }
1276
+ }
1277
+ function twMerge(classString) {
1278
+ const native = getNativeBridge();
1279
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1280
+ return native.tw_merge(classString);
1281
+ }
1282
+ function twMergeMany(classStrings) {
1283
+ const native = getNativeBridge();
1284
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1285
+ return native.tw_merge_many(classStrings);
1286
+ }
1287
+ function twMergeWithSeparator(classString, options) {
1288
+ const native = getNativeBridge();
1289
+ if (!native?.tw_merge_with_separator)
1290
+ throw new Error("tw_merge_with_separator not available");
1291
+ const opts = {
1292
+ separator: options.separator,
1293
+ debug: options.debug
1294
+ };
1295
+ return native.tw_merge_with_separator(classString, opts);
1296
+ }
1297
+ function twMergeManyWithSeparator(classStrings, options) {
1298
+ const native = getNativeBridge();
1299
+ if (!native?.tw_merge_many_with_separator)
1300
+ throw new Error("tw_merge_many_with_separator not available");
1301
+ const opts = {
1302
+ separator: options.separator,
1303
+ debug: options.debug
1304
+ };
1305
+ return native.tw_merge_many_with_separator(classStrings, opts);
1306
+ }
1307
+ function twMergeRaw(classLists) {
1308
+ const native = getNativeBridge();
1309
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1310
+ return native.tw_merge_raw(classLists);
1311
+ }
1312
+ var init_cssCompilationNative = __esm({
1313
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1314
+ init_nativeBridge();
1315
+ }
1316
+ });
1317
+
1318
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1319
+ function idRegistryCreate() {
1320
+ const native = getNativeBridge();
1321
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1322
+ return native.id_registry_create();
1323
+ }
1324
+ function idRegistryGenerate(handle, name) {
1325
+ const native = getNativeBridge();
1326
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1327
+ return native.id_registry_generate(handle, name);
1328
+ }
1329
+ function idRegistryLookup(handle, name) {
1330
+ const native = getNativeBridge();
1331
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1332
+ return native.id_registry_lookup(handle, name);
1333
+ }
1334
+ function idRegistryNext(handle) {
1335
+ const native = getNativeBridge();
1336
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1337
+ return native.id_registry_next(handle);
1338
+ }
1339
+ function idRegistryDestroy(handle) {
1340
+ const native = getNativeBridge();
1341
+ if (!native?.id_registry_destroy) return;
1342
+ native.id_registry_destroy(handle);
1343
+ }
1344
+ function idRegistryReset(handle) {
1345
+ const native = getNativeBridge();
1346
+ if (!native?.id_registry_reset) return;
1347
+ native.id_registry_reset(handle);
1348
+ }
1349
+ function idRegistrySnapshot(handle) {
1350
+ const native = getNativeBridge();
1351
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1352
+ const snapshotJson = native.id_registry_snapshot(handle);
1353
+ try {
1354
+ return JSON.parse(snapshotJson);
1355
+ } catch {
1356
+ return {
1357
+ handle,
1358
+ next_id: 0,
1359
+ entries: [],
1360
+ total_entries: 0
1361
+ };
1362
+ }
1363
+ }
1364
+ function idRegistryActiveCount() {
1365
+ const native = getNativeBridge();
1366
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1367
+ return native.id_registry_active_count();
1368
+ }
1369
+ function registerPropertyName(propertyName) {
1370
+ const native = getNativeBridge();
1371
+ if (!native?.register_property_name)
1372
+ throw new Error("register_property_name not available");
1373
+ return native.register_property_name(propertyName);
1374
+ }
1375
+ function registerValueName(valueName) {
1376
+ const native = getNativeBridge();
1377
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1378
+ return native.register_value_name(valueName);
1379
+ }
1380
+ function propertyIdToString(propertyId) {
1381
+ const native = getNativeBridge();
1382
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1383
+ return native.property_id_to_string(propertyId);
1384
+ }
1385
+ function valueIdToString(valueId) {
1386
+ const native = getNativeBridge();
1387
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1388
+ return native.value_id_to_string(valueId);
1389
+ }
1390
+ function reverseLookupProperty(propertyId) {
1391
+ const native = getNativeBridge();
1392
+ if (!native?.reverse_lookup_property)
1393
+ throw new Error("reverse_lookup_property not available");
1394
+ return native.reverse_lookup_property(propertyId);
1395
+ }
1396
+ function reverseLookupValue(valueId) {
1397
+ const native = getNativeBridge();
1398
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1399
+ return native.reverse_lookup_value(valueId);
1400
+ }
1401
+ function idRegistryExport(handle) {
1402
+ const native = getNativeBridge();
1403
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1404
+ return native.id_registry_export(handle);
1405
+ }
1406
+ function idRegistryImport(importedData) {
1407
+ const native = getNativeBridge();
1408
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1409
+ return native.id_registry_import(importedData);
1410
+ }
1411
+ var init_idRegistryNative = __esm({
1412
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1413
+ init_nativeBridge();
1414
+ }
1415
+ });
1416
+
1417
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1418
+ function processFileChange(fileChangeJson) {
1419
+ const native = getNativeBridge();
1420
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1421
+ const resultJson = native.process_file_change(fileChangeJson);
1422
+ try {
1423
+ return JSON.parse(resultJson);
1424
+ } catch {
1425
+ return {
1426
+ file_path: "",
1427
+ status: "error",
1428
+ old_classes: [],
1429
+ new_classes: [],
1430
+ added_classes: [],
1431
+ removed_classes: [],
1432
+ changed: false,
1433
+ fingerprint: "",
1434
+ error: "Failed to parse result"
1435
+ };
1436
+ }
1437
+ }
1438
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1439
+ const native = getNativeBridge();
1440
+ if (!native?.compute_incremental_diff)
1441
+ throw new Error("compute_incremental_diff not available");
1442
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1443
+ try {
1444
+ return JSON.parse(resultJson);
1445
+ } catch {
1446
+ return {
1447
+ is_changed: false,
1448
+ changes_count: 0,
1449
+ diff: {
1450
+ added_files: [],
1451
+ removed_files: [],
1452
+ modified_files: [],
1453
+ added_classes: [],
1454
+ removed_classes: [],
1455
+ total_changes: 0
1456
+ },
1457
+ processing_time_ms: 0
1458
+ };
1459
+ }
1460
+ }
1461
+ function createFingerprint(filePath, fileContent) {
1462
+ const native = getNativeBridge();
1463
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1464
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1465
+ try {
1466
+ return JSON.parse(fingerprintJson);
1467
+ } catch {
1468
+ return {
1469
+ file_path: filePath,
1470
+ content_hash: "",
1471
+ size_bytes: fileContent.length,
1472
+ mtime_ms: Date.now(),
1473
+ class_hash: "",
1474
+ signature: ""
1475
+ };
1476
+ }
1477
+ }
1478
+ function injectStateHash(css, stateHash) {
1479
+ const native = getNativeBridge();
1480
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1481
+ const resultJson = native.inject_state_hash(css, stateHash);
1482
+ try {
1483
+ return JSON.parse(resultJson);
1484
+ } catch {
1485
+ return {
1486
+ injected: false,
1487
+ state_hash: stateHash,
1488
+ affected_files: 0,
1489
+ total_injected_bytes: 0
1490
+ };
1491
+ }
1492
+ }
1493
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1494
+ const native = getNativeBridge();
1495
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1496
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1497
+ try {
1498
+ return JSON.parse(resultJson);
1499
+ } catch {
1500
+ return {
1501
+ entries_before: 0,
1502
+ entries_after: 0,
1503
+ entries_removed: 0,
1504
+ freed_bytes: 0
1505
+ };
1506
+ }
1507
+ }
1508
+ function rebuildWorkspaceResult(rootDir, extensions) {
1509
+ const native = getNativeBridge();
1510
+ if (!native?.rebuild_workspace_result)
1511
+ throw new Error("rebuild_workspace_result not available");
1512
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1513
+ try {
1514
+ return JSON.parse(resultJson);
1515
+ } catch {
1516
+ return {
1517
+ total_files_scanned: 0,
1518
+ total_classes_found: 0,
1519
+ unique_classes: 0,
1520
+ build_time_ms: 0,
1521
+ files_with_changes: 0
1522
+ };
1523
+ }
1524
+ }
1525
+ function scanFileNative(filePath, fileContent) {
1526
+ const native = getNativeBridge();
1527
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1528
+ const resultJson = native.scan_file_native(filePath, fileContent);
1529
+ try {
1530
+ return JSON.parse(resultJson);
1531
+ } catch {
1532
+ return {
1533
+ file: filePath,
1534
+ classes: [],
1535
+ added_classes: [],
1536
+ removed_classes: [],
1537
+ changed: false
1538
+ };
1539
+ }
1540
+ }
1541
+ function scanFilesBatchNative(filesJson) {
1542
+ const native = getNativeBridge();
1543
+ if (!native?.scan_files_batch_native)
1544
+ throw new Error("scan_files_batch_native not available");
1545
+ const resultJson = native.scan_files_batch_native(filesJson);
1546
+ try {
1547
+ return JSON.parse(resultJson);
1548
+ } catch {
1549
+ return [];
1550
+ }
1551
+ }
1552
+ var init_streamingNative = __esm({
1553
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1554
+ init_nativeBridge();
1555
+ }
1556
+ });
1557
+
1558
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1085
1559
  var tailwindEngine_exports = {};
1086
1560
  __export(tailwindEngine_exports, {
1087
1561
  clearCache: () => clearCache,
1088
- generateRawCss: () => generateRawCss,
1089
1562
  getCacheStats: () => getCacheStats,
1090
1563
  processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1091
1564
  runCssPipeline: () => runCssPipeline,
@@ -1119,48 +1592,6 @@ function clearCache() {
1119
1592
  _cacheHits = 0;
1120
1593
  _cacheMisses = 0;
1121
1594
  }
1122
- function loadTailwindEngine() {
1123
- if (_twEngine) return _twEngine;
1124
- if (_twEngineError) throw _twEngineError;
1125
- try {
1126
- const tw = require2("tailwindcss");
1127
- if (typeof tw.compile !== "function") {
1128
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
1129
- }
1130
- _twEngine = tw;
1131
- return _twEngine;
1132
- } catch (e) {
1133
- _twEngineError = e instanceof Error ? e : new Error(String(e));
1134
- throw _twEngineError;
1135
- }
1136
- }
1137
- async function generateRawCss(classes, cssEntryContent, root) {
1138
- if (classes.length === 0) return "";
1139
- const tw = loadTailwindEngine();
1140
- const input = cssEntryContent ?? "@import 'tailwindcss';";
1141
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1142
- const { dirname, resolve: resolve2 } = await import('path');
1143
- const projectRoot = root ?? process.cwd();
1144
- const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
1145
- const loadStylesheet = async (id, base) => {
1146
- try {
1147
- const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
1148
- const pkgPath = req.resolve(cssId);
1149
- return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
1150
- } catch {
1151
- try {
1152
- const absPath = resolve2(base, id);
1153
- if (existsSync3(absPath)) {
1154
- return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
1155
- }
1156
- } catch {
1157
- }
1158
- return { content: "", base };
1159
- }
1160
- };
1161
- const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1162
- return compiler.build(classes);
1163
- }
1164
1595
  function getThemeConfig() {
1165
1596
  return {
1166
1597
  colors: {
@@ -1257,20 +1688,9 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1257
1688
  _cacheMisses++;
1258
1689
  let rawCss;
1259
1690
  let usedRustCompiler = false;
1260
- try {
1261
- const theme = getThemeConfig();
1262
- rawCss = await generateCssNative(unique, {
1263
- theme,
1264
- fallbackToJs: true,
1265
- logFallback: process.env.DEBUG?.includes("compiler") === true
1266
- });
1267
- usedRustCompiler = true;
1268
- } catch (error) {
1269
- if (process.env.DEBUG?.includes("compiler")) {
1270
- console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
1271
- }
1272
- rawCss = await generateRawCss(unique, cssEntryContent, root);
1273
- }
1691
+ const theme = getThemeConfig();
1692
+ rawCss = await generateCssNative(unique, { theme });
1693
+ usedRustCompiler = true;
1274
1694
  const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1275
1695
  if (process.env.DEBUG?.includes("compiler")) {
1276
1696
  console.log(
@@ -1288,67 +1708,900 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1288
1708
  _cssCache.set(cacheKey, result);
1289
1709
  return result;
1290
1710
  }
1291
- function runCssPipelineSync(_classes) {
1292
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
1711
+ function runCssPipelineSync(_classes) {
1712
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1713
+ }
1714
+ function processTailwindCssWithTargets(css, targets) {
1715
+ const native = getNativeBridge();
1716
+ if (!native?.processTailwindCssWithTargets) {
1717
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1718
+ }
1719
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1720
+ if (!result?.css) {
1721
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1722
+ }
1723
+ return result.css;
1724
+ }
1725
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1726
+ var init_tailwindEngine = __esm({
1727
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1728
+ init_nativeBridge();
1729
+ init_cssGeneratorNative();
1730
+ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
1731
+ _cssCache = /* @__PURE__ */ new Map();
1732
+ _cacheHits = 0;
1733
+ _cacheMisses = 0;
1734
+ MAX_CACHE_SIZE = 100;
1735
+ }
1736
+ });
1737
+
1738
+ // packages/domain/compiler/src/compiler/index.ts
1739
+ var init_compiler = __esm({
1740
+ "packages/domain/compiler/src/compiler/index.ts"() {
1741
+ init_cssGeneratorNative();
1742
+ init_compilationNative();
1743
+ init_cssCompilationNative();
1744
+ init_idRegistryNative();
1745
+ init_streamingNative();
1746
+ }
1747
+ });
1748
+
1749
+ // packages/domain/compiler/src/parser/index.ts
1750
+ var parser_exports = {};
1751
+ __export(parser_exports, {
1752
+ astExtractClasses: () => astExtractClasses,
1753
+ batchExtractClasses: () => batchExtractClasses,
1754
+ checkAgainstSafelist: () => checkAgainstSafelist,
1755
+ diffClassLists: () => diffClassLists,
1756
+ extractAllClasses: () => extractAllClasses,
1757
+ extractClassesFromSource: () => extractClassesFromSource,
1758
+ extractComponentUsage: () => extractComponentUsage,
1759
+ mergeClassesStatic: () => mergeClassesStatic,
1760
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1761
+ normalizeClasses: () => normalizeClasses,
1762
+ parseClasses: () => parseClasses
1763
+ });
1764
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1765
+ var init_parser = __esm({
1766
+ "packages/domain/compiler/src/parser/index.ts"() {
1767
+ init_nativeBridge();
1768
+ parseClasses = (raw) => {
1769
+ const native = getNativeBridge();
1770
+ if (!native?.parseClasses) {
1771
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1772
+ }
1773
+ return native.parseClasses(raw) || [];
1774
+ };
1775
+ extractAllClasses = (source) => {
1776
+ const native = getNativeBridge();
1777
+ if (!native?.extractAllClasses) {
1778
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1779
+ }
1780
+ return native.extractAllClasses(source) || [];
1781
+ };
1782
+ extractClassesFromSource = (source) => {
1783
+ const native = getNativeBridge();
1784
+ if (!native?.extractClassesFromSource) {
1785
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1786
+ }
1787
+ const result = native.extractClassesFromSource(source);
1788
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1789
+ };
1790
+ astExtractClasses = (source, _filename) => {
1791
+ const native = getNativeBridge();
1792
+ if (!native?.extractClassesFromSource) {
1793
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1794
+ }
1795
+ return native.extractClassesFromSource(source) || [];
1796
+ };
1797
+ normalizeClasses = (raw) => {
1798
+ const result = normalizeAndDedupClasses(raw);
1799
+ return result?.normalized || "";
1800
+ };
1801
+ mergeClassesStatic = (classes) => {
1802
+ const result = normalizeAndDedupClasses(classes);
1803
+ return result?.normalized || "";
1804
+ };
1805
+ normalizeAndDedupClasses = (raw) => {
1806
+ const native = getNativeBridge();
1807
+ if (!native?.normalizeAndDedupClasses) {
1808
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1809
+ }
1810
+ const result = native.normalizeAndDedupClasses(raw);
1811
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1812
+ };
1813
+ extractComponentUsage = (source) => {
1814
+ const native = getNativeBridge();
1815
+ if (!native?.extractComponentUsage) {
1816
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1817
+ }
1818
+ return native.extractComponentUsage(source) || [];
1819
+ };
1820
+ batchExtractClasses = (filePaths) => {
1821
+ const native = getNativeBridge();
1822
+ if (!native?.batchExtractClasses) {
1823
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1824
+ }
1825
+ return native.batchExtractClasses(filePaths) || [];
1826
+ };
1827
+ checkAgainstSafelist = (classes, safelist) => {
1828
+ const native = getNativeBridge();
1829
+ if (!native?.checkAgainstSafelist) {
1830
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1831
+ }
1832
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1833
+ };
1834
+ diffClassLists = (previous, current) => {
1835
+ const native = getNativeBridge();
1836
+ if (!native?.diffClassLists) {
1837
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1838
+ }
1839
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1840
+ };
1841
+ }
1842
+ });
1843
+
1844
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1845
+ function detectDeadCode(scanResultJson, css) {
1846
+ const native = getNativeBridge();
1847
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1848
+ return native.detectDeadCode(scanResultJson, css);
1849
+ }
1850
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1851
+ const native = getNativeBridge();
1852
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1853
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1854
+ }
1855
+ function analyzeClassesNative(filesJson, cwd, flags) {
1856
+ const native = getNativeBridge();
1857
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1858
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1859
+ }
1860
+ function analyzeRscNative(source, filename) {
1861
+ const native = getNativeBridge();
1862
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1863
+ return native.analyzeRsc(source, filename);
1864
+ }
1865
+ function optimizeCssNative(css) {
1866
+ const native = getNativeBridge();
1867
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1868
+ const result = native.processTailwindCssLightning(css);
1869
+ return {
1870
+ css: result.css,
1871
+ originalSize: css.length,
1872
+ optimizedSize: result.size_bytes,
1873
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1874
+ };
1875
+ }
1876
+ function processTailwindCssLightning(css) {
1877
+ const native = getNativeBridge();
1878
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1879
+ return native.processTailwindCssLightning(css);
1880
+ }
1881
+ function eliminateDeadCssNative(css, deadClasses) {
1882
+ const native = getNativeBridge();
1883
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1884
+ return native.eliminateDeadCss(css, deadClasses);
1885
+ }
1886
+ function hoistComponentsNative(source) {
1887
+ const native = getNativeBridge();
1888
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1889
+ return native.hoistComponents(source);
1890
+ }
1891
+ function compileVariantTableNative(configJson) {
1892
+ const native = getNativeBridge();
1893
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1894
+ return native.compileVariantTable(configJson);
1895
+ }
1896
+ function classifyAndSortClassesNative(classes) {
1897
+ const native = getNativeBridge();
1898
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1899
+ return native.classifyAndSortClasses(classes);
1900
+ }
1901
+ function mergeCssDeclarationsNative(cssChunks) {
1902
+ const native = getNativeBridge();
1903
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1904
+ return native.mergeCssDeclarations(cssChunks);
1905
+ }
1906
+ var init_analyzerNative = __esm({
1907
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1908
+ init_nativeBridge();
1909
+ }
1910
+ });
1911
+
1912
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1913
+ function resolveVariants(configJson) {
1914
+ const native = getNativeBridge();
1915
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1916
+ const resultJson = native.resolve_variants(configJson);
1917
+ try {
1918
+ return JSON.parse(resultJson);
1919
+ } catch {
1920
+ return {
1921
+ variants: [],
1922
+ supported: [],
1923
+ deprecated: [],
1924
+ conflicting: []
1925
+ };
1926
+ }
1927
+ }
1928
+ function validateThemeConfig(configJson) {
1929
+ const native = getNativeBridge();
1930
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1931
+ const resultJson = native.validate_variant_config(configJson);
1932
+ try {
1933
+ return JSON.parse(resultJson);
1934
+ } catch {
1935
+ return {
1936
+ is_valid: false,
1937
+ errors: ["Unable to parse configuration"],
1938
+ warnings: [],
1939
+ suggestions: []
1940
+ };
1941
+ }
1942
+ }
1943
+ function resolveCascade(baseThemeJson, overridesJson) {
1944
+ const native = getNativeBridge();
1945
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1946
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1947
+ try {
1948
+ return JSON.parse(resultJson);
1949
+ } catch {
1950
+ return {
1951
+ base_theme: {},
1952
+ user_overrides: {},
1953
+ merged_theme: {},
1954
+ conflict_resolutions: []
1955
+ };
1956
+ }
1957
+ }
1958
+ function resolveClassNames(classNames, themeJson) {
1959
+ const native = getNativeBridge();
1960
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1961
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1962
+ try {
1963
+ return JSON.parse(resultJson);
1964
+ } catch {
1965
+ return [];
1966
+ }
1967
+ }
1968
+ function resolveConflictGroup(groupName, themeJson) {
1969
+ const native = getNativeBridge();
1970
+ if (!native?.resolve_conflict_group)
1971
+ throw new Error("resolve_conflict_group not available");
1972
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1973
+ try {
1974
+ return JSON.parse(resultJson);
1975
+ } catch {
1976
+ return {
1977
+ group_name: groupName,
1978
+ conflicting_classes: [],
1979
+ description: "",
1980
+ resolution_strategy: "last-wins"
1981
+ };
1982
+ }
1983
+ }
1984
+ function resolveThemeValue(keyPath, themeJson) {
1985
+ const native = getNativeBridge();
1986
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1987
+ return native.resolve_theme_value(keyPath, themeJson);
1988
+ }
1989
+ function resolveSimpleVariants(configJson) {
1990
+ const native = getNativeBridge();
1991
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1992
+ const resultJson = native.resolve_simple_variants(configJson);
1993
+ try {
1994
+ return JSON.parse(resultJson);
1995
+ } catch {
1996
+ return [];
1997
+ }
1998
+ }
1999
+ var init_themeResolutionNative = __esm({
2000
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2001
+ init_nativeBridge();
2002
+ }
2003
+ });
2004
+
2005
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
2006
+ function scanWorkspace(root, extensions) {
2007
+ const native = getNativeBridge();
2008
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
2009
+ return native.scan_workspace(root, extensions);
2010
+ }
2011
+ function extractClassesFromSourceNative(source) {
2012
+ const native = getNativeBridge();
2013
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
2014
+ return native.extract_classes_from_source(source);
2015
+ }
2016
+ function batchExtractClassesNative(filePaths) {
2017
+ const native = getNativeBridge();
2018
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
2019
+ return native.batch_extract_classes(filePaths);
2020
+ }
2021
+ function checkAgainstSafelistNative(classes, safelist) {
2022
+ const native = getNativeBridge();
2023
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
2024
+ return native.check_against_safelist(classes, safelist);
2025
+ }
2026
+ function scanFile(filePath) {
2027
+ const native = getNativeBridge();
2028
+ if (!native?.scan_file) throw new Error("scan_file not available");
2029
+ return native.scan_file(filePath);
2030
+ }
2031
+ function collectFiles(root, extensions) {
2032
+ const native = getNativeBridge();
2033
+ if (!native?.collect_files) throw new Error("collect_files not available");
2034
+ return native.collect_files(root, extensions);
2035
+ }
2036
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
2037
+ const native = getNativeBridge();
2038
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
2039
+ return native.walk_and_prefilter_source_files(root, extensions);
2040
+ }
2041
+ function generateSubComponentTypes(root, outputPath) {
2042
+ const native = getNativeBridge();
2043
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
2044
+ return native.generate_sub_component_types(root, outputPath);
2045
+ }
2046
+ var init_scannerNative = __esm({
2047
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2048
+ init_nativeBridge();
2049
+ }
2050
+ });
2051
+
2052
+ // packages/domain/compiler/src/analyzer/index.ts
2053
+ var init_analyzer = __esm({
2054
+ "packages/domain/compiler/src/analyzer/index.ts"() {
2055
+ init_analyzerNative();
2056
+ init_themeResolutionNative();
2057
+ init_scannerNative();
2058
+ }
2059
+ });
2060
+
2061
+ // packages/domain/compiler/src/cache/cacheNative.ts
2062
+ function getCacheStatistics() {
2063
+ const native = getNativeBridge();
2064
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
2065
+ const statsJson = native.get_cache_statistics();
2066
+ try {
2067
+ return JSON.parse(statsJson);
2068
+ } catch {
2069
+ return {
2070
+ parse_cache: { hits: 0, misses: 0, size: 0 },
2071
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2072
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2073
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2074
+ overall_hit_rate: 0,
2075
+ total_memory_bytes: 0
2076
+ };
2077
+ }
2078
+ }
2079
+ function clearAllCaches() {
2080
+ const native = getNativeBridge();
2081
+ if (!native?.clear_all_caches) return;
2082
+ try {
2083
+ native.clear_all_caches();
2084
+ } catch {
2085
+ }
2086
+ }
2087
+ function clearParseCache() {
2088
+ const native = getNativeBridge();
2089
+ if (!native?.clear_parse_cache) return;
2090
+ try {
2091
+ native.clear_parse_cache();
2092
+ } catch {
2093
+ }
2094
+ }
2095
+ function clearResolveCache() {
2096
+ const native = getNativeBridge();
2097
+ if (!native?.clear_resolve_cache) return;
2098
+ try {
2099
+ native.clear_resolve_cache();
2100
+ } catch {
2101
+ }
2102
+ }
2103
+ function clearCompileCache() {
2104
+ const native = getNativeBridge();
2105
+ if (!native?.clear_compile_cache) return;
2106
+ try {
2107
+ native.clear_compile_cache();
2108
+ } catch {
2109
+ }
2110
+ }
2111
+ function clearCssGenCache() {
2112
+ const native = getNativeBridge();
2113
+ if (!native?.clear_css_gen_cache) return;
2114
+ try {
2115
+ native.clear_css_gen_cache();
2116
+ } catch {
2117
+ }
2118
+ }
2119
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2120
+ const native = getNativeBridge();
2121
+ if (!native?.get_cache_optimization_hints)
2122
+ throw new Error("get_cache_optimization_hints not available");
2123
+ const hintsJson = native.get_cache_optimization_hints(
2124
+ Math.min(100, Math.max(0, hitRatePercent)),
2125
+ Math.max(1, memoryUsedMb)
2126
+ );
2127
+ try {
2128
+ return JSON.parse(hintsJson);
2129
+ } catch {
2130
+ return {
2131
+ current_strategy: "unknown",
2132
+ recommended_strategy: "increase_size",
2133
+ estimated_improvement_percent: 0,
2134
+ suggested_memory_mb: 256,
2135
+ notes: ["Unable to analyze cache statistics"]
2136
+ };
2137
+ }
2138
+ }
2139
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2140
+ const native = getNativeBridge();
2141
+ if (!native?.estimate_optimal_cache_config_native)
2142
+ throw new Error("estimate_optimal_cache_config_native not available");
2143
+ const configJson = native.estimate_optimal_cache_config_native(
2144
+ Math.max(64, totalBudgetMb),
2145
+ workloadType
2146
+ );
2147
+ try {
2148
+ return JSON.parse(configJson);
2149
+ } catch {
2150
+ return {
2151
+ parse_cache_size: 128,
2152
+ resolve_cache_size: 64,
2153
+ compile_cache_size: 256,
2154
+ css_gen_cache_size: 128,
2155
+ recommended_eviction_policy: "lru",
2156
+ ttl_seconds: 3600,
2157
+ expected_hit_rate_percent: 75
2158
+ };
2159
+ }
2160
+ }
2161
+ function cacheRead(cachePath) {
2162
+ const native = getNativeBridge();
2163
+ if (!native?.cache_read) throw new Error("cache_read not available");
2164
+ const result = native.cache_read(cachePath);
2165
+ try {
2166
+ return JSON.parse(result.entries_json || "[]");
2167
+ } catch {
2168
+ return [];
2169
+ }
2170
+ }
2171
+ function cacheWrite(cachePath, entries) {
2172
+ const native = getNativeBridge();
2173
+ if (!native?.cache_write) throw new Error("cache_write not available");
2174
+ try {
2175
+ const result = native.cache_write(
2176
+ cachePath,
2177
+ entries.map((e) => ({
2178
+ file: e.file,
2179
+ content_hash: e.contentHash,
2180
+ classes: e.classes,
2181
+ mtime_ms: e.mtimeMs,
2182
+ size_bytes: e.sizeBytes
2183
+ }))
2184
+ );
2185
+ return typeof result === "boolean" ? result : result === true;
2186
+ } catch {
2187
+ return false;
2188
+ }
2189
+ }
2190
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2191
+ const native = getNativeBridge();
2192
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2193
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2194
+ }
2195
+ var init_cacheNative = __esm({
2196
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2197
+ init_nativeBridge();
2198
+ }
2199
+ });
2200
+
2201
+ // packages/domain/compiler/src/cache/index.ts
2202
+ var init_cache = __esm({
2203
+ "packages/domain/compiler/src/cache/index.ts"() {
2204
+ init_cacheNative();
2205
+ }
2206
+ });
2207
+
2208
+ // packages/domain/compiler/src/redis/redisNative.ts
2209
+ function redisPing() {
2210
+ const native = getNativeBridge();
2211
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2212
+ return native.redis_ping();
2213
+ }
2214
+ function redisGet(key) {
2215
+ const native = getNativeBridge();
2216
+ if (!native?.redis_get) throw new Error("redis_get not available");
2217
+ const result = native.redis_get(key);
2218
+ return result === "nil" ? null : result;
2219
+ }
2220
+ function redisSet(key, value, ttl_seconds) {
2221
+ const native = getNativeBridge();
2222
+ if (!native?.redis_set) throw new Error("redis_set not available");
2223
+ return native.redis_set(key, value, ttl_seconds);
2224
+ }
2225
+ function redisDelete(key) {
2226
+ const native = getNativeBridge();
2227
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2228
+ return native.redis_delete(key);
2229
+ }
2230
+ function redisExists(key) {
2231
+ const native = getNativeBridge();
2232
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2233
+ return native.redis_exists(key);
2234
+ }
2235
+ function redisMget(keys) {
2236
+ const native = getNativeBridge();
2237
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2238
+ const result = native.redis_mget(keys);
2239
+ try {
2240
+ return JSON.parse(result);
2241
+ } catch {
2242
+ return keys.map(() => null);
2243
+ }
2244
+ }
2245
+ function redisMset(pairs) {
2246
+ const native = getNativeBridge();
2247
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2248
+ return native.redis_mset(pairs);
2249
+ }
2250
+ function redisFlushDb() {
2251
+ const native = getNativeBridge();
2252
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2253
+ return native.redis_flush_db();
2254
+ }
2255
+ function redisFlushAll() {
2256
+ const native = getNativeBridge();
2257
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2258
+ return native.redis_flush_all();
2259
+ }
2260
+ function redisPoolConnect(host, port, pool_size) {
2261
+ const native = getNativeBridge();
2262
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2263
+ return native.redis_pool_connect(host, port, pool_size);
2264
+ }
2265
+ function redisPoolStats() {
2266
+ const native = getNativeBridge();
2267
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2268
+ const result = native.redis_pool_stats();
2269
+ try {
2270
+ return JSON.parse(result);
2271
+ } catch {
2272
+ return {
2273
+ connected_count: 0,
2274
+ idle_count: 0,
2275
+ waiting_count: 0,
2276
+ total_requests: 0,
2277
+ total_errors: 0
2278
+ };
2279
+ }
2280
+ }
2281
+ function redisPoolReconnect() {
2282
+ const native = getNativeBridge();
2283
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2284
+ return native.redis_pool_reconnect();
2285
+ }
2286
+ function redisEnableCluster(initial_nodes) {
2287
+ const native = getNativeBridge();
2288
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2289
+ const result = native.redis_enable_cluster(initial_nodes);
2290
+ try {
2291
+ return JSON.parse(result);
2292
+ } catch {
2293
+ return {
2294
+ enabled: false,
2295
+ cluster_state: "error",
2296
+ nodes: [],
2297
+ slots_assigned: 0,
2298
+ slots_ok: 0,
2299
+ slots_fail: 0
2300
+ };
2301
+ }
2302
+ }
2303
+ function redisDisableCluster() {
2304
+ const native = getNativeBridge();
2305
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2306
+ return native.redis_disable_cluster();
2307
+ }
2308
+ function redisClusterStatus() {
2309
+ const native = getNativeBridge();
2310
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2311
+ const result = native.redis_cluster_status();
2312
+ try {
2313
+ return JSON.parse(result);
2314
+ } catch {
2315
+ return {
2316
+ enabled: false,
2317
+ cluster_state: "unknown",
2318
+ nodes: [],
2319
+ slots_assigned: 0,
2320
+ slots_ok: 0,
2321
+ slots_fail: 0
2322
+ };
2323
+ }
2324
+ }
2325
+ function redisSubscribe(channel) {
2326
+ const native = getNativeBridge();
2327
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2328
+ return native.redis_subscribe(channel);
2329
+ }
2330
+ function redisPublish(channel, message) {
2331
+ const native = getNativeBridge();
2332
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2333
+ return native.redis_publish(channel, message);
2334
+ }
2335
+ function redisExpirationSet(key, ttl_seconds) {
2336
+ const native = getNativeBridge();
2337
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2338
+ return native.redis_expiration_set(key, ttl_seconds);
2339
+ }
2340
+ function redisExpirationGet(key) {
2341
+ const native = getNativeBridge();
2342
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2343
+ const result = native.redis_expiration_get(key);
2344
+ try {
2345
+ return JSON.parse(result);
2346
+ } catch {
2347
+ return {
2348
+ key,
2349
+ ttl_seconds: -1,
2350
+ expiration_timestamp: 0,
2351
+ is_persistent: true
2352
+ };
2353
+ }
2354
+ }
2355
+ function redisInfo() {
2356
+ const native = getNativeBridge();
2357
+ if (!native?.redis_info) throw new Error("redis_info not available");
2358
+ return native.redis_info();
2359
+ }
2360
+ function redisMonitor() {
2361
+ const native = getNativeBridge();
2362
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2363
+ return native.redis_monitor();
2364
+ }
2365
+ function redisCacheSize() {
2366
+ const native = getNativeBridge();
2367
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2368
+ return native.redis_cache_size();
2369
+ }
2370
+ function redisCacheKeyCount() {
2371
+ const native = getNativeBridge();
2372
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2373
+ return native.redis_cache_key_count();
2374
+ }
2375
+ function redisCacheClear() {
2376
+ const native = getNativeBridge();
2377
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2378
+ return native.redis_cache_clear();
2379
+ }
2380
+ function redisCacheHitRate() {
2381
+ const native = getNativeBridge();
2382
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2383
+ return native.redis_cache_hit_rate();
2384
+ }
2385
+ function redisEnablePersistence(mode) {
2386
+ const native = getNativeBridge();
2387
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2388
+ return native.redis_enable_persistence(mode);
2389
+ }
2390
+ function redisDisablePersistence() {
2391
+ const native = getNativeBridge();
2392
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2393
+ return native.redis_disable_persistence();
2394
+ }
2395
+ function redisSnapshot() {
2396
+ const native = getNativeBridge();
2397
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2398
+ return native.redis_snapshot();
2399
+ }
2400
+ function redisMemoryStats() {
2401
+ const native = getNativeBridge();
2402
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2403
+ return native.redis_memory_stats();
2404
+ }
2405
+ function redisOptimizeMemory() {
2406
+ const native = getNativeBridge();
2407
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2408
+ return native.redis_optimize_memory();
2409
+ }
2410
+ function redisSetEvictionPolicy(policy) {
2411
+ const native = getNativeBridge();
2412
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2413
+ return native.redis_set_eviction_policy(policy);
2414
+ }
2415
+ function redisGetEvictionPolicy() {
2416
+ const native = getNativeBridge();
2417
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2418
+ return native.redis_get_eviction_policy();
2419
+ }
2420
+ function redisReplicate(target_host, target_port) {
2421
+ const native = getNativeBridge();
2422
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2423
+ return native.redis_replicate(target_host, target_port);
2424
+ }
2425
+ function redisReplicationStatus() {
2426
+ const native = getNativeBridge();
2427
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2428
+ return native.redis_replication_status();
2429
+ }
2430
+ function redisCacheSync(peers) {
2431
+ const native = getNativeBridge();
2432
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2433
+ return native.redis_cache_sync(peers);
2434
+ }
2435
+ function redisEnableCacheWarming(key_pattern) {
2436
+ const native = getNativeBridge();
2437
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2438
+ return native.redis_enable_cache_warming(key_pattern);
2439
+ }
2440
+ function redisDisableCacheWarming() {
2441
+ const native = getNativeBridge();
2442
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2443
+ return native.redis_disable_cache_warming();
2444
+ }
2445
+ function redisDiagnose() {
2446
+ const native = getNativeBridge();
2447
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2448
+ return native.redis_diagnose();
2449
+ }
2450
+ var init_redisNative = __esm({
2451
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2452
+ init_nativeBridge();
2453
+ }
2454
+ });
2455
+
2456
+ // packages/domain/compiler/src/redis/index.ts
2457
+ var init_redis = __esm({
2458
+ "packages/domain/compiler/src/redis/index.ts"() {
2459
+ init_redisNative();
2460
+ }
2461
+ });
2462
+
2463
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2464
+ function startWatch(root_path, patterns) {
2465
+ const native = getNativeBridge();
2466
+ if (!native?.start_watch) throw new Error("start_watch not available");
2467
+ return native.start_watch(root_path, patterns);
2468
+ }
2469
+ function pollWatchEvents(handle, timeout_ms) {
2470
+ const native = getNativeBridge();
2471
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2472
+ const result = native.poll_watch_events(handle, timeout_ms);
2473
+ try {
2474
+ return JSON.parse(result);
2475
+ } catch {
2476
+ return [];
2477
+ }
2478
+ }
2479
+ function stopWatch(handle) {
2480
+ const native = getNativeBridge();
2481
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2482
+ return native.stop_watch(handle);
2483
+ }
2484
+ function watchAddPattern(handle, pattern) {
2485
+ const native = getNativeBridge();
2486
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2487
+ return native.watch_add_pattern(handle, pattern);
2488
+ }
2489
+ function watchRemovePattern(handle, pattern) {
2490
+ const native = getNativeBridge();
2491
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2492
+ return native.watch_remove_pattern(handle, pattern);
2493
+ }
2494
+ function watchGetActiveHandles() {
2495
+ const native = getNativeBridge();
2496
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2497
+ const result = native.watch_get_active_handles();
2498
+ try {
2499
+ return JSON.parse(result);
2500
+ } catch {
2501
+ return [];
2502
+ }
2503
+ }
2504
+ function watchClearAll() {
2505
+ const native = getNativeBridge();
2506
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2507
+ return native.watch_clear_all();
2508
+ }
2509
+ function watchEventTypeToString(event_type_code) {
2510
+ const native = getNativeBridge();
2511
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2512
+ return native.watch_event_type_to_string(event_type_code);
1293
2513
  }
1294
- function processTailwindCssWithTargets(css, targets) {
2514
+ function isWatchRunning(handle) {
1295
2515
  const native = getNativeBridge();
1296
- if (!native?.processTailwindCssWithTargets) {
1297
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
2516
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2517
+ return native.is_watch_running(handle);
2518
+ }
2519
+ function getWatchStats() {
2520
+ const native = getNativeBridge();
2521
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2522
+ const result = native.get_watch_stats();
2523
+ try {
2524
+ return JSON.parse(result);
2525
+ } catch {
2526
+ return {
2527
+ active_watchers: 0,
2528
+ total_events: 0,
2529
+ events_this_second: 0,
2530
+ average_latency_ms: 0,
2531
+ largest_batch_size: 0
2532
+ };
1298
2533
  }
1299
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
1300
- if (!result?.css) {
1301
- throw new Error("FATAL: processTailwindCssWithTargets returned null");
2534
+ }
2535
+ function watchPause(handle) {
2536
+ const native = getNativeBridge();
2537
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2538
+ return native.watch_pause(handle);
2539
+ }
2540
+ function watchResume(handle) {
2541
+ const native = getNativeBridge();
2542
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2543
+ return native.watch_resume(handle);
2544
+ }
2545
+ function scanCacheOptimizations() {
2546
+ const native = getNativeBridge();
2547
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2548
+ return native.scan_cache_optimizations();
2549
+ }
2550
+ function getPluginHooks() {
2551
+ const native = getNativeBridge();
2552
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2553
+ const result = native.get_plugin_hooks();
2554
+ try {
2555
+ return JSON.parse(result);
2556
+ } catch {
2557
+ return [];
1302
2558
  }
1303
- return result.css;
1304
2559
  }
1305
- var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
1306
- var init_tailwindEngine = __esm({
1307
- "packages/domain/compiler/src/tailwindEngine.ts"() {
2560
+ function registerPluginHook(hook_name, handler_id) {
2561
+ const native = getNativeBridge();
2562
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2563
+ return native.register_plugin_hook(hook_name, handler_id);
2564
+ }
2565
+ function unregisterPluginHook(hook_name, handler_id) {
2566
+ const native = getNativeBridge();
2567
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2568
+ return native.unregister_plugin_hook(hook_name, handler_id);
2569
+ }
2570
+ function emitPluginHook(hook_name, data_json) {
2571
+ const native = getNativeBridge();
2572
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2573
+ return native.emit_plugin_hook(hook_name, data_json);
2574
+ }
2575
+ function getCompilationMetrics() {
2576
+ const native = getNativeBridge();
2577
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2578
+ return native.get_compilation_metrics();
2579
+ }
2580
+ function resetCompilationMetrics() {
2581
+ const native = getNativeBridge();
2582
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2583
+ return native.reset_compilation_metrics();
2584
+ }
2585
+ function validateCssOutput(css) {
2586
+ const native = getNativeBridge();
2587
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2588
+ return native.validate_css_output(css);
2589
+ }
2590
+ function getCompilerDiagnostics() {
2591
+ const native = getNativeBridge();
2592
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2593
+ return native.get_compiler_diagnostics();
2594
+ }
2595
+ var init_watchSystemNative = __esm({
2596
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
1308
2597
  init_nativeBridge();
1309
- init_cssGeneratorNative();
1310
- require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
1311
- _cssCache = /* @__PURE__ */ new Map();
1312
- _cacheHits = 0;
1313
- _cacheMisses = 0;
1314
- MAX_CACHE_SIZE = 100;
1315
- _twEngine = null;
1316
- _twEngineError = null;
1317
2598
  }
1318
2599
  });
1319
2600
 
1320
- // packages/domain/compiler/src/cssGeneratorNative.ts
1321
- async function generateCssNative(classes, options) {
1322
- const {
1323
- theme,
1324
- fallbackToJs = true,
1325
- logFallback = false
1326
- } = options;
1327
- try {
1328
- const native = getNativeBridge();
1329
- if (!native?.generateCssNative) {
1330
- throw new Error("generateCssNative not available in native binding");
1331
- }
1332
- const themeJson = JSON.stringify(theme);
1333
- const css = native.generateCssNative(classes, themeJson);
1334
- return css;
1335
- } catch (error) {
1336
- if (!fallbackToJs) {
1337
- throw error;
1338
- }
1339
- if (logFallback) {
1340
- console.warn(
1341
- "[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
1342
- error instanceof Error ? error.message : String(error)
1343
- );
1344
- }
1345
- return generateRawCss(classes);
1346
- }
1347
- }
1348
- var init_cssGeneratorNative = __esm({
1349
- "packages/domain/compiler/src/cssGeneratorNative.ts"() {
1350
- init_nativeBridge();
1351
- init_tailwindEngine();
2601
+ // packages/domain/compiler/src/watch/index.ts
2602
+ var init_watch = __esm({
2603
+ "packages/domain/compiler/src/watch/index.ts"() {
2604
+ init_watchSystemNative();
1352
2605
  }
1353
2606
  });
1354
2607
  function _layoutClassesToCss(classes) {
@@ -1385,10 +2638,16 @@ function extractContainerCssFromSource(source) {
1385
2638
  }
1386
2639
  return rules.join("\n");
1387
2640
  }
1388
- var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, compileCssNative, generateCssForClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, parseClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, eliminateDeadCss, findDeadVariants, runElimination, optimizeCss, scanProjectUsage, extractComponentUsage, diffClassLists, batchExtractClasses, checkAgainstSafelist, hoistComponents, compileVariantTable, compileVariants, classifyAndSortClasses, mergeCssDeclarations, analyzeClassUsage, analyzeRsc, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2641
+ var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
1389
2642
  var init_src = __esm({
1390
2643
  "packages/domain/compiler/src/index.ts"() {
1391
2644
  init_nativeBridge();
2645
+ init_compiler();
2646
+ init_parser();
2647
+ init_analyzer();
2648
+ init_cache();
2649
+ init_redis();
2650
+ init_watch();
1392
2651
  transformSource = (source, opts) => {
1393
2652
  const native = getNativeBridge();
1394
2653
  if (!native?.transformSource) {
@@ -1432,58 +2691,19 @@ var init_src = __esm({
1432
2691
  const result = compileCssFromClasses(classes);
1433
2692
  return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
1434
2693
  };
1435
- compileCssNative = (classes, prefix = null) => {
1436
- return compileCssFromClasses(classes, prefix);
1437
- };
1438
2694
  generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
1439
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1440
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1441
- return result.css;
1442
- };
1443
- extractAllClasses = (source) => {
1444
- const native = getNativeBridge();
1445
- if (!native?.extractAllClasses) {
1446
- throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1447
- }
1448
- return native.extractAllClasses(source) || [];
1449
- };
1450
- extractClassesFromSource = (source) => {
1451
- const native = getNativeBridge();
1452
- if (!native?.extractClassesFromSource) {
1453
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1454
- }
1455
- const result = native.extractClassesFromSource(source);
1456
- return Array.isArray(result) ? result.join(" ") : String(result || "");
1457
- };
1458
- astExtractClasses = (source, _filename) => {
1459
- const native = getNativeBridge();
1460
- if (!native?.extractClassesFromSource) {
1461
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1462
- }
1463
- return native.extractClassesFromSource(source) || [];
1464
- };
1465
- parseClasses = (raw) => {
1466
- const native = getNativeBridge();
1467
- if (!native?.parseClasses) {
1468
- throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1469
- }
1470
- return native.parseClasses(raw) || [];
1471
- };
1472
- normalizeClasses = (raw) => {
1473
- const result = normalizeAndDedupClasses(raw);
1474
- return result?.normalized || "";
1475
- };
1476
- mergeClassesStatic = (classes) => {
1477
- const result = normalizeAndDedupClasses(classes);
1478
- return result?.normalized || "";
1479
- };
1480
- normalizeAndDedupClasses = (raw) => {
1481
- const native = getNativeBridge();
1482
- if (!native?.normalizeAndDedupClasses) {
1483
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
2695
+ try {
2696
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2697
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2698
+ return result.css;
2699
+ } catch {
2700
+ const native = getNativeBridge();
2701
+ if (!native?.transformSource) {
2702
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2703
+ }
2704
+ const result = native.transformSource(classes.join(" "), {});
2705
+ return result?.code || "";
1484
2706
  }
1485
- const result = native.normalizeAndDedupClasses(raw);
1486
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1487
2707
  };
1488
2708
  eliminateDeadCss = (css, deadClasses) => {
1489
2709
  const native = getNativeBridge();
@@ -1516,16 +2736,10 @@ var init_src = __esm({
1516
2736
  const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
1517
2737
  return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
1518
2738
  };
1519
- optimizeCss = (css) => {
1520
- const native = getNativeBridge();
1521
- if (!native?.optimizeCss) {
1522
- throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
1523
- }
1524
- return native.optimizeCss(css);
1525
- };
1526
2739
  scanProjectUsage = (dirs, cwd) => {
2740
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
1527
2741
  const files = dirs.map((dir) => path9__namespace.default.resolve(cwd, dir));
1528
- const results = batchExtractClasses(files) || [];
2742
+ const results = batchExtractClasses2(files) || [];
1529
2743
  const combined = {};
1530
2744
  for (const result of results) {
1531
2745
  if (result.ok && result.classes) {
@@ -1537,109 +2751,6 @@ var init_src = __esm({
1537
2751
  }
1538
2752
  return combined;
1539
2753
  };
1540
- extractComponentUsage = (source) => {
1541
- const native = getNativeBridge();
1542
- if (!native?.extractComponentUsage) {
1543
- throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1544
- }
1545
- return native.extractComponentUsage(source) || [];
1546
- };
1547
- diffClassLists = (previous, current) => {
1548
- const native = getNativeBridge();
1549
- if (!native?.diffClassLists) {
1550
- throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1551
- }
1552
- return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1553
- };
1554
- batchExtractClasses = (filePaths) => {
1555
- const native = getNativeBridge();
1556
- if (!native?.batchExtractClasses) {
1557
- throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1558
- }
1559
- return native.batchExtractClasses(filePaths) || [];
1560
- };
1561
- checkAgainstSafelist = (classes, safelist) => {
1562
- const native = getNativeBridge();
1563
- if (!native?.checkAgainstSafelist) {
1564
- throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1565
- }
1566
- return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1567
- };
1568
- hoistComponents = (source) => {
1569
- const native = getNativeBridge();
1570
- if (!native?.hoistComponents) {
1571
- throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
1572
- }
1573
- return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
1574
- };
1575
- compileVariantTable = (configJson) => {
1576
- const native = getNativeBridge();
1577
- if (!native?.compileVariantTable) {
1578
- throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
1579
- }
1580
- return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
1581
- };
1582
- compileVariants = (componentId, config) => {
1583
- return compileVariantTable(JSON.stringify({ componentId, ...config }));
1584
- };
1585
- classifyAndSortClasses = (classes) => {
1586
- const native = getNativeBridge();
1587
- if (!native?.classifyAndSortClasses) {
1588
- throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
1589
- }
1590
- return native.classifyAndSortClasses(classes) || [];
1591
- };
1592
- mergeCssDeclarations = (cssChunks) => {
1593
- const native = getNativeBridge();
1594
- if (!native?.mergeCssDeclarations) {
1595
- throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
1596
- }
1597
- return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
1598
- };
1599
- analyzeClassUsage = (classes, scanResultJson, css) => {
1600
- const native = getNativeBridge();
1601
- if (!native?.analyzeClassUsage) {
1602
- throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
1603
- }
1604
- return native.analyzeClassUsage(classes, scanResultJson, css) || [];
1605
- };
1606
- analyzeRsc = (source, filename) => {
1607
- const native = getNativeBridge();
1608
- if (!native?.analyzeRsc) {
1609
- throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
1610
- }
1611
- return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
1612
- };
1613
- analyzeFile = (source, filename) => {
1614
- const rsc = analyzeRsc(source, filename);
1615
- return {
1616
- isServer: rsc?.isServer ?? true,
1617
- needsClientDirective: rsc?.needsClientDirective ?? false,
1618
- clientReasons: rsc?.clientReasons ?? [],
1619
- interactiveClasses: [],
1620
- canStaticResolveVariants: true
1621
- };
1622
- };
1623
- analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
1624
- return { resolved: {}, dynamic: [] };
1625
- };
1626
- injectClientDirective = (source) => {
1627
- if (!source.includes('"use client"') && !source.includes("'use client'")) {
1628
- return '"use client";\n' + source;
1629
- }
1630
- return source;
1631
- };
1632
- injectServerOnlyComment = (source) => {
1633
- return `/* @server-only */
1634
- ${source}`;
1635
- };
1636
- analyzeClasses = (filesJson, cwd, flags) => {
1637
- const native = getNativeBridge();
1638
- if (!native?.analyzeClasses) {
1639
- throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
1640
- }
1641
- return native.analyzeClasses(filesJson, cwd, flags);
1642
- };
1643
2754
  generateSafelist = (scanDirs, outputPath, cwd) => {
1644
2755
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
1645
2756
  const allClasses = Object.keys(classes).sort();
@@ -1703,7 +2814,8 @@ ${source}`;
1703
2814
  if (containerCss) cssChunks.push(containerCss);
1704
2815
  const combined = cssChunks.join("\n").trim();
1705
2816
  if (combined) staticCss = combined;
1706
- } catch {
2817
+ } catch (err) {
2818
+ console.debug("Static CSS extraction warning:", err);
1707
2819
  }
1708
2820
  return {
1709
2821
  code: result?.code || "",
@@ -1788,7 +2900,46 @@ ${source}`;
1788
2900
  return [];
1789
2901
  };
1790
2902
  bucketSort = (classes) => {
1791
- return classifyAndSortClasses(classes).map((c) => c.raw ?? c);
2903
+ const native = getNativeBridge();
2904
+ if (!native?.classifyAndSortClasses) {
2905
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2906
+ }
2907
+ const sorted = native.classifyAndSortClasses(classes);
2908
+ return sorted.map((c) => c.raw ?? c);
2909
+ };
2910
+ analyzeFile = (source, filename) => {
2911
+ const native = getNativeBridge();
2912
+ if (!native?.analyzeRsc) {
2913
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2914
+ }
2915
+ const rsc = native.analyzeRsc(source, filename);
2916
+ return {
2917
+ isServer: rsc?.isServer ?? true,
2918
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2919
+ clientReasons: rsc?.clientReasons ?? [],
2920
+ interactiveClasses: [],
2921
+ canStaticResolveVariants: true
2922
+ };
2923
+ };
2924
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2925
+ return { resolved: {}, dynamic: [] };
2926
+ };
2927
+ injectClientDirective = (source) => {
2928
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2929
+ return '"use client";\n' + source;
2930
+ }
2931
+ return source;
2932
+ };
2933
+ injectServerOnlyComment = (source) => {
2934
+ return `/* @server-only */
2935
+ ${source}`;
2936
+ };
2937
+ analyzeClasses = (filesJson, cwd, flags) => {
2938
+ const native = getNativeBridge();
2939
+ if (!native?.analyzeClasses) {
2940
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2941
+ }
2942
+ return native.analyzeClasses(filesJson, cwd, flags);
1792
2943
  };
1793
2944
  extractTwStateConfigs = (source, filename) => {
1794
2945
  const native = getNativeBridge();
@@ -1797,23 +2948,25 @@ ${source}`;
1797
2948
  }
1798
2949
  return native.extractTwStateConfigs(source, filename);
1799
2950
  };
1800
- generateStaticStateCss = (inputs, resolvedCss = null) => {
1801
- const native = getNativeBridge();
1802
- if (!native?.generateStaticStateCss) {
1803
- throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2951
+ generateStaticStateCss = (entries, _themeConfig) => {
2952
+ const rules = [];
2953
+ for (const entry of entries) {
2954
+ const stateConfig = JSON.parse(entry.statesJson);
2955
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2956
+ rules.push({
2957
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2958
+ declarations: classes,
2959
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2960
+ componentName: entry.componentName,
2961
+ stateName
2962
+ });
2963
+ }
1804
2964
  }
1805
- return native.generateStaticStateCss(inputs, resolvedCss);
2965
+ return rules;
1806
2966
  };
1807
2967
  extractAndGenerateStateCss = (source, filename) => {
1808
- const native = getNativeBridge();
1809
- if (!native?.extractAndGenerateStateCss) {
1810
- const configs = extractTwStateConfigs(source, filename);
1811
- if (configs.length === 0) return [];
1812
- return generateStaticStateCss(
1813
- configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
1814
- );
1815
- }
1816
- return native.extractAndGenerateStateCss(source, filename);
2968
+ const entries = extractTwStateConfigs(source, filename);
2969
+ return generateStaticStateCss(entries);
1817
2970
  };
1818
2971
  }
1819
2972
  });
@@ -1822,75 +2975,219 @@ ${source}`;
1822
2975
  var internal_exports = {};
1823
2976
  __export(internal_exports, {
1824
2977
  adaptNativeResult: () => adaptNativeResult,
1825
- analyzeClassUsage: () => analyzeClassUsage,
2978
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
1826
2979
  analyzeClasses: () => analyzeClasses,
2980
+ analyzeClassesNative: () => analyzeClassesNative,
1827
2981
  analyzeFile: () => analyzeFile,
1828
- analyzeRsc: () => analyzeRsc,
2982
+ analyzeRscNative: () => analyzeRscNative,
1829
2983
  analyzeVariantUsage: () => analyzeVariantUsage,
1830
2984
  astExtractClasses: () => astExtractClasses,
2985
+ atomicRegistrySize: () => atomicRegistrySize,
1831
2986
  batchExtractClasses: () => batchExtractClasses,
2987
+ batchExtractClassesNative: () => batchExtractClassesNative,
1832
2988
  bucketSort: () => bucketSort,
1833
2989
  buildStyleTag: () => buildStyleTag,
2990
+ cachePriority: () => cachePriority,
2991
+ cacheRead: () => cacheRead,
2992
+ cacheWrite: () => cacheWrite,
1834
2993
  checkAgainstSafelist: () => checkAgainstSafelist,
1835
- classifyAndSortClasses: () => classifyAndSortClasses,
2994
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2995
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
1836
2996
  classifyNode: () => classifyNode,
2997
+ clearAllCaches: () => clearAllCaches,
2998
+ clearAtomicRegistry: () => clearAtomicRegistry,
1837
2999
  clearCache: () => clearCache,
3000
+ clearCompileCache: () => clearCompileCache,
3001
+ clearCssGenCache: () => clearCssGenCache,
3002
+ clearParseCache: () => clearParseCache,
3003
+ clearResolveCache: () => clearResolveCache,
3004
+ clearThemeCache: () => clearThemeCache,
3005
+ collectFiles: () => collectFiles,
3006
+ compileAnimation: () => compileAnimation,
3007
+ compileClass: () => compileClass,
3008
+ compileClasses: () => compileClasses,
1838
3009
  compileCssFromClasses: () => compileCssFromClasses,
1839
- compileCssNative: () => compileCssNative,
1840
- compileVariantTable: () => compileVariantTable,
1841
- compileVariants: () => compileVariants,
3010
+ compileCssLightning: () => compileCssLightning,
3011
+ compileCssNative2: () => compileCssNative2,
3012
+ compileKeyframes: () => compileKeyframes,
3013
+ compileTheme: () => compileTheme,
3014
+ compileToCss: () => compileToCss,
3015
+ compileToCssBatch: () => compileToCssBatch,
3016
+ compileVariantTableNative: () => compileVariantTableNative,
3017
+ computeIncrementalDiff: () => computeIncrementalDiff,
3018
+ createFingerprint: () => createFingerprint,
1842
3019
  detectConflicts: () => detectConflicts,
3020
+ detectDeadCode: () => detectDeadCode,
1843
3021
  diffClassLists: () => diffClassLists,
1844
3022
  eliminateDeadCss: () => eliminateDeadCss,
3023
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
3024
+ emitPluginHook: () => emitPluginHook,
3025
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
1845
3026
  extractAllClasses: () => extractAllClasses,
1846
3027
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3028
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
1847
3029
  extractClassesFromSource: () => extractClassesFromSource,
3030
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
1848
3031
  extractComponentUsage: () => extractComponentUsage,
1849
3032
  extractContainerCssFromSource: () => extractContainerCssFromSource,
3033
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
1850
3034
  extractTwStateConfigs: () => extractTwStateConfigs,
3035
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
1851
3036
  fileToRoute: () => fileToRoute,
1852
3037
  findDeadVariants: () => findDeadVariants,
3038
+ generateAtomicCss: () => generateAtomicCss,
1853
3039
  generateCssForClasses: () => generateCssForClasses,
1854
- generateRawCss: () => generateRawCss,
3040
+ generateCssNative: () => generateCssNative,
1855
3041
  generateSafelist: () => generateSafelist,
1856
3042
  generateStaticStateCss: () => generateStaticStateCss,
3043
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
3044
+ generateSubComponentTypes: () => generateSubComponentTypes,
1857
3045
  getAllRoutes: () => getAllRoutes,
1858
3046
  getBucketEngine: () => getBucketEngine,
3047
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
3048
+ getCacheStatistics: () => getCacheStatistics,
1859
3049
  getCacheStats: () => getCacheStats,
3050
+ getCompilationMetrics: () => getCompilationMetrics,
3051
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
1860
3052
  getContentPaths: () => getContentPaths,
1861
3053
  getIncrementalEngine: () => getIncrementalEngine,
1862
3054
  getNativeBridge: () => getNativeBridge,
3055
+ getPluginHooks: () => getPluginHooks,
1863
3056
  getRouteClasses: () => getRouteClasses,
3057
+ getWatchStats: () => getWatchStats,
1864
3058
  hasTwUsage: () => hasTwUsage,
1865
- hoistComponents: () => hoistComponents,
3059
+ hashContent: () => hashContent,
3060
+ hoistComponentsNative: () => hoistComponentsNative,
3061
+ idRegistryActiveCount: () => idRegistryActiveCount,
3062
+ idRegistryCreate: () => idRegistryCreate,
3063
+ idRegistryDestroy: () => idRegistryDestroy,
3064
+ idRegistryExport: () => idRegistryExport,
3065
+ idRegistryGenerate: () => idRegistryGenerate,
3066
+ idRegistryImport: () => idRegistryImport,
3067
+ idRegistryLookup: () => idRegistryLookup,
3068
+ idRegistryNext: () => idRegistryNext,
3069
+ idRegistryReset: () => idRegistryReset,
3070
+ idRegistrySnapshot: () => idRegistrySnapshot,
1866
3071
  injectClientDirective: () => injectClientDirective,
1867
3072
  injectServerOnlyComment: () => injectServerOnlyComment,
3073
+ injectStateHash: () => injectStateHash,
1868
3074
  isAlreadyTransformed: () => isAlreadyTransformed,
3075
+ isWatchRunning: () => isWatchRunning,
3076
+ layoutClassesToCss: () => layoutClassesToCss,
1869
3077
  loadSafelist: () => loadSafelist,
1870
3078
  loadTailwindConfig: () => loadTailwindConfig,
1871
3079
  mergeClassesStatic: () => mergeClassesStatic,
1872
- mergeCssDeclarations: () => mergeCssDeclarations,
3080
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
3081
+ minifyCss: () => minifyCss,
1873
3082
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1874
3083
  normalizeClasses: () => normalizeClasses,
1875
- optimizeCss: () => optimizeCss,
3084
+ optimizeCssNative: () => optimizeCssNative,
3085
+ parseAtomicClass: () => parseAtomicClass,
1876
3086
  parseClasses: () => parseClasses,
3087
+ pollWatchEvents: () => pollWatchEvents,
3088
+ processFileChange: () => processFileChange,
3089
+ processTailwindCssLightning: () => processTailwindCssLightning,
3090
+ propertyIdToString: () => propertyIdToString,
3091
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
3092
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
3093
+ redisCacheClear: () => redisCacheClear,
3094
+ redisCacheHitRate: () => redisCacheHitRate,
3095
+ redisCacheKeyCount: () => redisCacheKeyCount,
3096
+ redisCacheSize: () => redisCacheSize,
3097
+ redisCacheSync: () => redisCacheSync,
3098
+ redisClusterStatus: () => redisClusterStatus,
3099
+ redisDelete: () => redisDelete,
3100
+ redisDiagnose: () => redisDiagnose,
3101
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
3102
+ redisDisableCluster: () => redisDisableCluster,
3103
+ redisDisablePersistence: () => redisDisablePersistence,
3104
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
3105
+ redisEnableCluster: () => redisEnableCluster,
3106
+ redisEnablePersistence: () => redisEnablePersistence,
3107
+ redisExists: () => redisExists,
3108
+ redisExpirationGet: () => redisExpirationGet,
3109
+ redisExpirationSet: () => redisExpirationSet,
3110
+ redisFlushAll: () => redisFlushAll,
3111
+ redisFlushDb: () => redisFlushDb,
3112
+ redisGet: () => redisGet,
3113
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
3114
+ redisInfo: () => redisInfo,
3115
+ redisMemoryStats: () => redisMemoryStats,
3116
+ redisMget: () => redisMget,
3117
+ redisMonitor: () => redisMonitor,
3118
+ redisMset: () => redisMset,
3119
+ redisOptimizeMemory: () => redisOptimizeMemory,
3120
+ redisPing: () => redisPing,
3121
+ redisPoolConnect: () => redisPoolConnect,
3122
+ redisPoolReconnect: () => redisPoolReconnect,
3123
+ redisPoolStats: () => redisPoolStats,
3124
+ redisPublish: () => redisPublish,
3125
+ redisReplicate: () => redisReplicate,
3126
+ redisReplicationStatus: () => redisReplicationStatus,
3127
+ redisSet: () => redisSet,
3128
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
3129
+ redisSnapshot: () => redisSnapshot,
3130
+ redisSubscribe: () => redisSubscribe,
1877
3131
  registerFileClasses: () => registerFileClasses,
1878
3132
  registerGlobalClasses: () => registerGlobalClasses,
3133
+ registerPluginHook: () => registerPluginHook,
3134
+ registerPropertyName: () => registerPropertyName,
3135
+ registerValueName: () => registerValueName,
1879
3136
  resetBucketEngine: () => resetBucketEngine,
3137
+ resetCompilationMetrics: () => resetCompilationMetrics,
1880
3138
  resetIncrementalEngine: () => resetIncrementalEngine,
3139
+ resolveCascade: () => resolveCascade,
3140
+ resolveClassNames: () => resolveClassNames,
3141
+ resolveConflictGroup: () => resolveConflictGroup,
3142
+ resolveSimpleVariants: () => resolveSimpleVariants,
3143
+ resolveThemeValue: () => resolveThemeValue,
3144
+ resolveVariants: () => resolveVariants,
3145
+ reverseLookupProperty: () => reverseLookupProperty,
3146
+ reverseLookupValue: () => reverseLookupValue,
1881
3147
  runCssPipeline: () => runCssPipeline,
1882
3148
  runCssPipelineSync: () => runCssPipelineSync,
1883
3149
  runElimination: () => runElimination,
1884
3150
  runLoaderTransform: () => runLoaderTransform,
3151
+ scanCacheOptimizations: () => scanCacheOptimizations,
3152
+ scanFile: () => scanFile,
3153
+ scanFileNative: () => scanFileNative,
3154
+ scanFilesBatchNative: () => scanFilesBatchNative,
1885
3155
  scanProjectUsage: () => scanProjectUsage,
3156
+ scanWorkspace: () => scanWorkspace,
1886
3157
  shouldProcess: () => shouldProcess,
1887
3158
  shouldSkipFile: () => shouldSkipFile,
1888
- transformSource: () => transformSource
3159
+ startWatch: () => startWatch,
3160
+ stopWatch: () => stopWatch,
3161
+ toAtomicClasses: () => toAtomicClasses,
3162
+ transformSource: () => transformSource,
3163
+ twMerge: () => twMerge,
3164
+ twMergeMany: () => twMergeMany,
3165
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
3166
+ twMergeRaw: () => twMergeRaw,
3167
+ twMergeWithSeparator: () => twMergeWithSeparator,
3168
+ unregisterPluginHook: () => unregisterPluginHook,
3169
+ validateCssOutput: () => validateCssOutput,
3170
+ validateThemeConfig: () => validateThemeConfig,
3171
+ valueIdToString: () => valueIdToString,
3172
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
3173
+ watchAddPattern: () => watchAddPattern,
3174
+ watchClearAll: () => watchClearAll,
3175
+ watchEventTypeToString: () => watchEventTypeToString,
3176
+ watchGetActiveHandles: () => watchGetActiveHandles,
3177
+ watchPause: () => watchPause,
3178
+ watchRemovePattern: () => watchRemovePattern,
3179
+ watchResume: () => watchResume
1889
3180
  });
1890
3181
  var init_internal = __esm({
1891
3182
  "packages/domain/compiler/src/internal.ts"() {
1892
3183
  init_src();
1893
3184
  init_tailwindEngine();
3185
+ init_compiler();
3186
+ init_parser();
3187
+ init_analyzer();
3188
+ init_cache();
3189
+ init_redis();
3190
+ init_watch();
1894
3191
  }
1895
3192
  });
1896
3193
  function getNative() {
@@ -2237,7 +3534,7 @@ __export(src_exports, {
2237
3534
  getPipelinePercentages: () => getPipelinePercentages,
2238
3535
  getSuggestion: () => getSuggestion,
2239
3536
  getTailwindVersion: () => getTailwindVersion,
2240
- hashContent: () => hashContent,
3537
+ hashContent: () => hashContent2,
2241
3538
  isTailwindV4: () => isTailwindV4,
2242
3539
  isTwError: () => isTwError,
2243
3540
  loadNativeBinding: () => loadNativeBinding,
@@ -2367,7 +3664,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
2367
3664
  return process.cwd();
2368
3665
  }
2369
3666
  }
2370
- function hashContent(content, algorithm = "md5", length) {
3667
+ function hashContent2(content, algorithm = "md5", length) {
2371
3668
  const hash = crypto.createHash(algorithm).update(content).digest("hex");
2372
3669
  return length ? hash.slice(0, length) : hash;
2373
3670
  }
@@ -2492,7 +3789,7 @@ var init_src2 = __esm({
2492
3789
  // packages/domain/scanner/src/native-bridge.ts
2493
3790
  var native_bridge_exports = {};
2494
3791
  __export(native_bridge_exports, {
2495
- batchExtractClassesNative: () => batchExtractClassesNative,
3792
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2496
3793
  cachePriorityNative: () => cachePriorityNative,
2497
3794
  cacheReadNative: () => cacheReadNative,
2498
3795
  cacheWriteNative: () => cacheWriteNative,
@@ -2512,8 +3809,8 @@ __export(native_bridge_exports, {
2512
3809
  scanCacheInvalidate: () => scanCacheInvalidate,
2513
3810
  scanCachePut: () => scanCachePut,
2514
3811
  scanCacheStats: () => scanCacheStats,
2515
- scanFileNative: () => scanFileNative,
2516
- scanFilesBatchNative: () => scanFilesBatchNative,
3812
+ scanFileNative: () => scanFileNative2,
3813
+ scanFilesBatchNative: () => scanFilesBatchNative2,
2517
3814
  scanWorkspaceNative: () => scanWorkspaceNative,
2518
3815
  startWatchNative: () => startWatchNative,
2519
3816
  stopWatchNative: () => stopWatchNative
@@ -2604,7 +3901,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
2604
3901
  }
2605
3902
  return result;
2606
3903
  }
2607
- function batchExtractClassesNative(filePaths) {
3904
+ function batchExtractClassesNative2(filePaths) {
2608
3905
  const binding = scannerGetBinding();
2609
3906
  if (!binding.batchExtractClasses) {
2610
3907
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -2639,7 +3936,7 @@ function scanCacheStats() {
2639
3936
  }
2640
3937
  return binding.scanCacheStats();
2641
3938
  }
2642
- function scanFileNative(filePath) {
3939
+ function scanFileNative2(filePath) {
2643
3940
  const binding = scannerGetBinding();
2644
3941
  if (!binding.scanFile) {
2645
3942
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -2651,7 +3948,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
2651
3948
  if (!binding.collectFiles) return null;
2652
3949
  return binding.collectFiles(root, extensions, ignoreDirs);
2653
3950
  }
2654
- function scanFilesBatchNative(filePaths) {
3951
+ function scanFilesBatchNative2(filePaths) {
2655
3952
  const binding = scannerGetBinding();
2656
3953
  if (!binding.scanFilesBatch) {
2657
3954
  return filePaths.map((fp) => {
@@ -2856,7 +4153,7 @@ var init_cache_native = __esm({
2856
4153
  init_native_bridge();
2857
4154
  }
2858
4155
  });
2859
- function collectFiles(rootDir, extensions, ignoreDirs) {
4156
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
2860
4157
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
2861
4158
  if (native !== null) return native;
2862
4159
  throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
@@ -2896,9 +4193,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
2896
4193
  maxWorkers = Math.max(1, os.availableParallelism() - 1),
2897
4194
  chunkSize = DEFAULT_CHUNK_SIZE
2898
4195
  } = options;
2899
- const files = collectFiles(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
4196
+ const files = collectFiles2(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
2900
4197
  if (files.length < PARALLEL_THRESHOLD) {
2901
- return mergeResults(batchExtractClassesNative(files));
4198
+ return mergeResults(batchExtractClassesNative2(files));
2902
4199
  }
2903
4200
  const chunks = [];
2904
4201
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -2922,7 +4219,7 @@ var init_parallel_scanner = __esm({
2922
4219
  if (!worker_threads.isMainThread && worker_threads.parentPort) {
2923
4220
  const { filePaths } = worker_threads.workerData;
2924
4221
  try {
2925
- const results = batchExtractClassesNative(filePaths);
4222
+ const results = batchExtractClassesNative2(filePaths);
2926
4223
  const msg = { ok: true, results };
2927
4224
  worker_threads.parentPort.postMessage(msg);
2928
4225
  } catch (error) {
@@ -3006,15 +4303,15 @@ var src_exports2 = {};
3006
4303
  __export(src_exports2, {
3007
4304
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
3008
4305
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3009
- batchExtractClassesNative: () => batchExtractClassesNative,
4306
+ batchExtractClassesNative: () => batchExtractClassesNative2,
3010
4307
  extractClassesNative: () => extractClassesNative,
3011
4308
  isScannableFile: () => isScannableFile2,
3012
4309
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3013
4310
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3014
4311
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
3015
- scanFile: () => scanFile,
4312
+ scanFile: () => scanFile2,
3016
4313
  scanSource: () => scanSource,
3017
- scanWorkspace: () => scanWorkspace,
4314
+ scanWorkspace: () => scanWorkspace2,
3018
4315
  scanWorkspaceAsync: () => scanWorkspaceAsync
3019
4316
  });
3020
4317
  function getRuntimeDir() {
@@ -3140,9 +4437,9 @@ function scanSource(source) {
3140
4437
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
3141
4438
  return includeExtensions.includes(path9__namespace.default.extname(filePath));
3142
4439
  }
3143
- function scanFile(filePath) {
3144
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
3145
- const result = scanFileNative2(filePath);
4440
+ function scanFile2(filePath) {
4441
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4442
+ const result = scanFileNative3(filePath);
3146
4443
  if (!result.ok) {
3147
4444
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
3148
4445
  }
@@ -3152,7 +4449,7 @@ function scanFile(filePath) {
3152
4449
  ...result.hash ? { hash: result.hash } : {}
3153
4450
  };
3154
4451
  }
3155
- function scanWorkspace(rootDir, options = {}) {
4452
+ function scanWorkspace2(rootDir, options = {}) {
3156
4453
  const normalizedOptions = parseScanWorkspaceOptions(options);
3157
4454
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
3158
4455
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -3275,7 +4572,7 @@ function scanWorkspace(rootDir, options = {}) {
3275
4572
  }
3276
4573
  } else {
3277
4574
  for (const filePath of candidates) {
3278
- processResult(scanFile(filePath));
4575
+ processResult(scanFile2(filePath));
3279
4576
  }
3280
4577
  }
3281
4578
  return parseScanWorkspaceResult({
@@ -3302,7 +4599,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
3302
4599
  log3.debug(
3303
4600
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
3304
4601
  );
3305
- return scanWorkspace(rootDir, normalizedOptions);
4602
+ return scanWorkspace2(rootDir, normalizedOptions);
3306
4603
  }
3307
4604
  }
3308
4605
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
@@ -3494,35 +4791,35 @@ var init_native_bridge2 = __esm({
3494
4791
  });
3495
4792
 
3496
4793
  // packages/domain/engine/src/ir.ts
3497
- function registerPropertyName(id, name) {
4794
+ function registerPropertyName2(id, name) {
3498
4795
  const native = getNativeEngineBinding();
3499
4796
  if (!native?.registerPropertyName) {
3500
4797
  throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
3501
4798
  }
3502
4799
  native.registerPropertyName(id.value, name);
3503
4800
  }
3504
- function registerValueName(id, name) {
4801
+ function registerValueName2(id, name) {
3505
4802
  const native = getNativeEngineBinding();
3506
4803
  if (!native?.registerValueName) {
3507
4804
  throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
3508
4805
  }
3509
4806
  native.registerValueName(id.value, name);
3510
4807
  }
3511
- function propertyIdToString(id) {
4808
+ function propertyIdToString2(id) {
3512
4809
  const native = getNativeEngineBinding();
3513
4810
  if (!native?.propertyIdToString) {
3514
4811
  throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
3515
4812
  }
3516
4813
  return native.propertyIdToString(id.value);
3517
4814
  }
3518
- function valueIdToString(id) {
4815
+ function valueIdToString2(id) {
3519
4816
  const native = getNativeEngineBinding();
3520
4817
  if (!native?.valueIdToString) {
3521
4818
  throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
3522
4819
  }
3523
4820
  return native.valueIdToString(id.value);
3524
4821
  }
3525
- function createFingerprint(parts) {
4822
+ function createFingerprint2(parts) {
3526
4823
  const native = getNativeEngineBinding();
3527
4824
  if (!native?.createFingerprint) {
3528
4825
  throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
@@ -3578,7 +4875,7 @@ var init_ir = __esm({
3578
4875
  if (typeof name === "string" && name.length > 0) {
3579
4876
  return name;
3580
4877
  }
3581
- return propertyIdToString(this);
4878
+ return propertyIdToString2(this);
3582
4879
  }
3583
4880
  };
3584
4881
  exports.ValueId = class {
@@ -3593,7 +4890,7 @@ var init_ir = __esm({
3593
4890
  if (typeof name === "string" && name.length > 0) {
3594
4891
  return name;
3595
4892
  }
3596
- return valueIdToString(this);
4893
+ return valueIdToString2(this);
3597
4894
  }
3598
4895
  };
3599
4896
  exports.LayerId = class {
@@ -3801,12 +5098,12 @@ function createIdGenerator() {
3801
5098
  generateSelectorId: () => new exports.SelectorId(state.selectorIdCounter++),
3802
5099
  generatePropertyId: (name) => {
3803
5100
  const id = new exports.PropertyId(state.propertyIdCounter++);
3804
- registerPropertyName(id, name);
5101
+ registerPropertyName2(id, name);
3805
5102
  return id;
3806
5103
  },
3807
5104
  generateValueId: (name) => {
3808
5105
  const id = new exports.ValueId(state.valueIdCounter++);
3809
- registerValueName(id, name);
5106
+ registerValueName2(id, name);
3810
5107
  return id;
3811
5108
  },
3812
5109
  generateLayerId: () => new exports.LayerId(state.layerIdCounter++),
@@ -3858,12 +5155,12 @@ function _parseCssToIrFast(assembled) {
3858
5155
  if (native?.registerPropertyName) {
3859
5156
  native.registerPropertyName(r.propertyId, r.propertyName);
3860
5157
  } else {
3861
- registerPropertyName(propertyId, r.propertyName);
5158
+ registerPropertyName2(propertyId, r.propertyName);
3862
5159
  }
3863
5160
  if (native?.registerValueName) {
3864
5161
  native.registerValueName(r.valueId, r.valueName);
3865
5162
  } else {
3866
- registerValueName(valueId, r.valueName);
5163
+ registerValueName2(valueId, r.valueName);
3867
5164
  }
3868
5165
  return {
3869
5166
  id: new exports.RuleId(r.ruleId),
@@ -3914,7 +5211,7 @@ function _parseCssToIrFallback(css, prefix, native) {
3914
5211
  const conditionId = hasMedia ? generateConditionId() : null;
3915
5212
  const conditionResult = 2 /* Unknown */;
3916
5213
  const ruleId = generateRuleId();
3917
- const fingerprint = createFingerprint([className, r.property, r.value]);
5214
+ const fingerprint = createFingerprint2([className, r.property, r.value]);
3918
5215
  const rule = {
3919
5216
  id: ruleId,
3920
5217
  selector: selectorId,
@@ -4683,7 +5980,7 @@ init_src2();
4683
5980
  init_native_bridge2();
4684
5981
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
4685
5982
  var log5 = createLogger2("engine:incremental");
4686
- function rebuildWorkspaceResult(byFile) {
5983
+ function rebuildWorkspaceResult2(byFile) {
4687
5984
  const files = Array.from(byFile.values());
4688
5985
  const native = getNativeEngineBinding();
4689
5986
  if (native?.rebuildWorkspaceResult) {
@@ -4726,10 +6023,10 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
4726
6023
  log5.debug(`native unlink ${normalizedPath}`);
4727
6024
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
4728
6025
  byFile.delete(normalizedPath);
4729
- return rebuildWorkspaceResult(byFile);
6026
+ return rebuildWorkspaceResult2(byFile);
4730
6027
  }
4731
6028
  log5.debug(`native change ${normalizedPath}`);
4732
- const scanned = scanFile(normalizedPath);
6029
+ const scanned = scanFile2(normalizedPath);
4733
6030
  const content = fs3__namespace.default.readFileSync(normalizedPath, "utf8");
4734
6031
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
4735
6032
  const existing = byFile.get(normalizedPath);
@@ -4742,7 +6039,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
4742
6039
  log5.debug(`native diff cold-sync ${normalizedPath}`);
4743
6040
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
4744
6041
  }
4745
- return rebuildWorkspaceResult(byFile);
6042
+ return rebuildWorkspaceResult2(byFile);
4746
6043
  }
4747
6044
 
4748
6045
  // packages/domain/engine/src/impactTracker.ts
@@ -5857,7 +7154,7 @@ async function createEngine(rawOptions = {}) {
5857
7154
  }
5858
7155
  };
5859
7156
  }
5860
- async function scanWorkspace2(opts = {}) {
7157
+ async function scanWorkspace3(opts = {}) {
5861
7158
  const root = path9__namespace.default.resolve(opts.root ?? process.cwd());
5862
7159
  return scanWorkspaceAsync(root, {
5863
7160
  includeExtensions: opts.extensions,
@@ -5871,7 +7168,7 @@ async function analyzeWorkspace2(opts = {}) {
5871
7168
  });
5872
7169
  }
5873
7170
  async function generateSafelist2(opts = {}) {
5874
- const scan = await scanWorkspace2(opts);
7171
+ const scan = await scanWorkspace3(opts);
5875
7172
  return scan.uniqueClasses;
5876
7173
  }
5877
7174
  async function build(opts = {}) {
@@ -5950,7 +7247,7 @@ exports.applyIncrementalChange = applyIncrementalChange;
5950
7247
  exports.build = build;
5951
7248
  exports.buildProvenanceChain = buildProvenanceChain;
5952
7249
  exports.createEngine = createEngine;
5953
- exports.createFingerprint = createFingerprint;
7250
+ exports.createFingerprint = createFingerprint2;
5954
7251
  exports.createResolutionReason = createResolutionReason;
5955
7252
  exports.generateSafelist = generateSafelist2;
5956
7253
  exports.inspectClass = inspectClass;
@@ -5965,7 +7262,7 @@ exports.runBeforeScan = runBeforeScan;
5965
7262
  exports.runBeforeWatch = runBeforeWatch;
5966
7263
  exports.runOnError = runOnError;
5967
7264
  exports.runTransformClasses = runTransformClasses;
5968
- exports.scanWorkspace = scanWorkspace2;
7265
+ exports.scanWorkspace = scanWorkspace3;
5969
7266
  exports.trace = trace;
5970
7267
  exports.traceClass = traceClass;
5971
7268
  exports.traceClasses = traceClasses;