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/index.mjs CHANGED
@@ -860,27 +860,15 @@ function resolveNativeBinary(runtimeDir) {
860
860
  }
861
861
  tried.push(`env:${envPath} (not found)`);
862
862
  }
863
- const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
864
- for (const pkg of prebuiltPkgs) {
865
- try {
866
- const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
867
- if (fs3.existsSync(candidate)) {
868
- return { path: candidate, source: "prebuilt", platform, tried };
869
- }
870
- tried.push(`prebuilt:${pkg} (resolved but missing)`);
871
- } catch {
872
- tried.push(`prebuilt:${pkg} (not installed)`);
873
- }
874
- }
875
863
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
876
- const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
864
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
877
865
  if (runtimeDir) {
878
866
  for (const depth of ["..", path9.join("..", ".."), path9.join("..", "..", "..")]) {
879
867
  const pkgRoot = path9.resolve(runtimeDir, depth);
880
868
  for (const bin of BINARY_NAMES_SELF) {
881
869
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
882
870
  const candidate = path9.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
883
- tried.push(`self-bundled:${candidate}`);
871
+ tried.push(`native:${candidate}`);
884
872
  if (fs3.existsSync(candidate)) {
885
873
  return { path: candidate, source: "prebuilt", platform, tried };
886
874
  }
@@ -888,6 +876,18 @@ function resolveNativeBinary(runtimeDir) {
888
876
  }
889
877
  }
890
878
  }
879
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
880
+ for (const pkg of prebuiltPkgs) {
881
+ try {
882
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
883
+ if (fs3.existsSync(candidate)) {
884
+ return { path: candidate, source: "prebuilt", platform, tried };
885
+ }
886
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
887
+ } catch {
888
+ tried.push(`prebuilt:${pkg} (not installed)`);
889
+ }
890
+ }
891
891
  const cwd = process.cwd();
892
892
  const base = runtimeDir ?? cwd;
893
893
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
@@ -1060,11 +1060,484 @@ Tried paths: ${result.tried.join("\n")}`);
1060
1060
  }
1061
1061
  });
1062
1062
 
1063
- // packages/domain/compiler/src/tailwindEngine.ts
1063
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1064
+ async function generateCssNative(classes, options) {
1065
+ const { theme } = options;
1066
+ const native = getNativeBridge();
1067
+ if (!native?.generateCssNative) {
1068
+ throw new Error(
1069
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1070
+ );
1071
+ }
1072
+ const themeJson = JSON.stringify(theme);
1073
+ const css = native.generateCssNative(classes, themeJson);
1074
+ return css;
1075
+ }
1076
+ function clearThemeCache() {
1077
+ try {
1078
+ const native = getNativeBridge();
1079
+ if (!native?.clearThemeCache) {
1080
+ return;
1081
+ }
1082
+ native.clearThemeCache();
1083
+ } catch {
1084
+ }
1085
+ }
1086
+ var init_cssGeneratorNative = __esm({
1087
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1088
+ init_nativeBridge();
1089
+ }
1090
+ });
1091
+
1092
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1093
+ function compileCssNative2(classes, prefix) {
1094
+ const native = getNativeBridge();
1095
+ if (!native?.compileCss) throw new Error("compileCss not available");
1096
+ return native.compileCss(classes, prefix);
1097
+ }
1098
+ function compileCssLightning(classes) {
1099
+ const native = getNativeBridge();
1100
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1101
+ return native.compileCssLightning(classes);
1102
+ }
1103
+ function extractTwStateConfigsNative(source, filename) {
1104
+ const native = getNativeBridge();
1105
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1106
+ return native.extractTwStateConfigs(source, filename);
1107
+ }
1108
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1109
+ const native = getNativeBridge();
1110
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1111
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1112
+ }
1113
+ function extractAndGenerateStateCssNative(source, filename) {
1114
+ const native = getNativeBridge();
1115
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1116
+ return native.extractAndGenerateStateCss(source, filename);
1117
+ }
1118
+ function layoutClassesToCss(classes) {
1119
+ const native = getNativeBridge();
1120
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1121
+ return native.layoutClassesToCss(classes);
1122
+ }
1123
+ function hashContent(input, algorithm = "sha256", length = 8) {
1124
+ const native = getNativeBridge();
1125
+ if (!native?.hashContent) throw new Error("hashContent not available");
1126
+ return native.hashContent(input, algorithm, length);
1127
+ }
1128
+ function extractTwContainerConfigs(source) {
1129
+ const native = getNativeBridge();
1130
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1131
+ return native.extractTwContainerConfigs(source);
1132
+ }
1133
+ function parseAtomicClass(twClass) {
1134
+ const native = getNativeBridge();
1135
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1136
+ return native.parseAtomicClass(twClass);
1137
+ }
1138
+ function generateAtomicCss(rulesJson) {
1139
+ const native = getNativeBridge();
1140
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1141
+ return native.generateAtomicCss(rulesJson);
1142
+ }
1143
+ function toAtomicClasses(twClasses) {
1144
+ const native = getNativeBridge();
1145
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1146
+ return native.toAtomicClasses(twClasses);
1147
+ }
1148
+ function clearAtomicRegistry() {
1149
+ const native = getNativeBridge();
1150
+ if (!native?.clearAtomicRegistry) return;
1151
+ native.clearAtomicRegistry();
1152
+ }
1153
+ function atomicRegistrySize() {
1154
+ const native = getNativeBridge();
1155
+ if (!native?.atomicRegistrySize) return 0;
1156
+ return native.atomicRegistrySize();
1157
+ }
1158
+ var init_compilationNative = __esm({
1159
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1160
+ init_nativeBridge();
1161
+ }
1162
+ });
1163
+
1164
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1165
+ function compileClass(input) {
1166
+ const native = getNativeBridge();
1167
+ if (!native?.compile_class) throw new Error("compile_class not available");
1168
+ const resultJson = native.compile_class(input);
1169
+ try {
1170
+ return JSON.parse(resultJson);
1171
+ } catch {
1172
+ return {
1173
+ selector: "",
1174
+ declarations: "",
1175
+ properties: [],
1176
+ specificity: 0
1177
+ };
1178
+ }
1179
+ }
1180
+ function compileClasses(inputs) {
1181
+ const native = getNativeBridge();
1182
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1183
+ const resultJson = native.compile_classes(inputs);
1184
+ try {
1185
+ return JSON.parse(resultJson);
1186
+ } catch {
1187
+ return {
1188
+ css: "",
1189
+ resolved_classes: [],
1190
+ unknown_classes: [],
1191
+ size_bytes: 0,
1192
+ duration_ms: 0
1193
+ };
1194
+ }
1195
+ }
1196
+ function compileToCss(input, minify) {
1197
+ const native = getNativeBridge();
1198
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1199
+ return native.compile_to_css(input, minify ?? false);
1200
+ }
1201
+ function compileToCssBatch(inputs, minify) {
1202
+ const native = getNativeBridge();
1203
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1204
+ return native.compile_to_css_batch(inputs, minify ?? false);
1205
+ }
1206
+ function minifyCss(css) {
1207
+ const native = getNativeBridge();
1208
+ if (!native?.minify_css) throw new Error("minify_css not available");
1209
+ return native.minify_css(css);
1210
+ }
1211
+ function compileAnimation(animationName, from, to) {
1212
+ const native = getNativeBridge();
1213
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1214
+ const resultJson = native.compile_animation(animationName, from, to);
1215
+ try {
1216
+ return JSON.parse(resultJson);
1217
+ } catch {
1218
+ return {
1219
+ animation_id: "",
1220
+ keyframes_css: "",
1221
+ animation_rule: "",
1222
+ duration_ms: 0
1223
+ };
1224
+ }
1225
+ }
1226
+ function compileKeyframes(name, stopsJson) {
1227
+ const native = getNativeBridge();
1228
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1229
+ const resultJson = native.compile_keyframes(name, stopsJson);
1230
+ try {
1231
+ return JSON.parse(resultJson);
1232
+ } catch {
1233
+ return {
1234
+ animation_id: "",
1235
+ keyframes_css: "",
1236
+ animation_rule: "",
1237
+ duration_ms: 0
1238
+ };
1239
+ }
1240
+ }
1241
+ function compileTheme(tokensJson, themeName, prefix) {
1242
+ const native = getNativeBridge();
1243
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1244
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1245
+ try {
1246
+ return JSON.parse(resultJson);
1247
+ } catch {
1248
+ return {
1249
+ selector: ":root",
1250
+ variables: [],
1251
+ variables_css: "",
1252
+ theme_name: themeName
1253
+ };
1254
+ }
1255
+ }
1256
+ function twMerge(classString) {
1257
+ const native = getNativeBridge();
1258
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1259
+ return native.tw_merge(classString);
1260
+ }
1261
+ function twMergeMany(classStrings) {
1262
+ const native = getNativeBridge();
1263
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1264
+ return native.tw_merge_many(classStrings);
1265
+ }
1266
+ function twMergeWithSeparator(classString, options) {
1267
+ const native = getNativeBridge();
1268
+ if (!native?.tw_merge_with_separator)
1269
+ throw new Error("tw_merge_with_separator not available");
1270
+ const opts = {
1271
+ separator: options.separator,
1272
+ debug: options.debug
1273
+ };
1274
+ return native.tw_merge_with_separator(classString, opts);
1275
+ }
1276
+ function twMergeManyWithSeparator(classStrings, options) {
1277
+ const native = getNativeBridge();
1278
+ if (!native?.tw_merge_many_with_separator)
1279
+ throw new Error("tw_merge_many_with_separator not available");
1280
+ const opts = {
1281
+ separator: options.separator,
1282
+ debug: options.debug
1283
+ };
1284
+ return native.tw_merge_many_with_separator(classStrings, opts);
1285
+ }
1286
+ function twMergeRaw(classLists) {
1287
+ const native = getNativeBridge();
1288
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1289
+ return native.tw_merge_raw(classLists);
1290
+ }
1291
+ var init_cssCompilationNative = __esm({
1292
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1293
+ init_nativeBridge();
1294
+ }
1295
+ });
1296
+
1297
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1298
+ function idRegistryCreate() {
1299
+ const native = getNativeBridge();
1300
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1301
+ return native.id_registry_create();
1302
+ }
1303
+ function idRegistryGenerate(handle, name) {
1304
+ const native = getNativeBridge();
1305
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1306
+ return native.id_registry_generate(handle, name);
1307
+ }
1308
+ function idRegistryLookup(handle, name) {
1309
+ const native = getNativeBridge();
1310
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1311
+ return native.id_registry_lookup(handle, name);
1312
+ }
1313
+ function idRegistryNext(handle) {
1314
+ const native = getNativeBridge();
1315
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1316
+ return native.id_registry_next(handle);
1317
+ }
1318
+ function idRegistryDestroy(handle) {
1319
+ const native = getNativeBridge();
1320
+ if (!native?.id_registry_destroy) return;
1321
+ native.id_registry_destroy(handle);
1322
+ }
1323
+ function idRegistryReset(handle) {
1324
+ const native = getNativeBridge();
1325
+ if (!native?.id_registry_reset) return;
1326
+ native.id_registry_reset(handle);
1327
+ }
1328
+ function idRegistrySnapshot(handle) {
1329
+ const native = getNativeBridge();
1330
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1331
+ const snapshotJson = native.id_registry_snapshot(handle);
1332
+ try {
1333
+ return JSON.parse(snapshotJson);
1334
+ } catch {
1335
+ return {
1336
+ handle,
1337
+ next_id: 0,
1338
+ entries: [],
1339
+ total_entries: 0
1340
+ };
1341
+ }
1342
+ }
1343
+ function idRegistryActiveCount() {
1344
+ const native = getNativeBridge();
1345
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1346
+ return native.id_registry_active_count();
1347
+ }
1348
+ function registerPropertyName(propertyName) {
1349
+ const native = getNativeBridge();
1350
+ if (!native?.register_property_name)
1351
+ throw new Error("register_property_name not available");
1352
+ return native.register_property_name(propertyName);
1353
+ }
1354
+ function registerValueName(valueName) {
1355
+ const native = getNativeBridge();
1356
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1357
+ return native.register_value_name(valueName);
1358
+ }
1359
+ function propertyIdToString(propertyId) {
1360
+ const native = getNativeBridge();
1361
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1362
+ return native.property_id_to_string(propertyId);
1363
+ }
1364
+ function valueIdToString(valueId) {
1365
+ const native = getNativeBridge();
1366
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1367
+ return native.value_id_to_string(valueId);
1368
+ }
1369
+ function reverseLookupProperty(propertyId) {
1370
+ const native = getNativeBridge();
1371
+ if (!native?.reverse_lookup_property)
1372
+ throw new Error("reverse_lookup_property not available");
1373
+ return native.reverse_lookup_property(propertyId);
1374
+ }
1375
+ function reverseLookupValue(valueId) {
1376
+ const native = getNativeBridge();
1377
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1378
+ return native.reverse_lookup_value(valueId);
1379
+ }
1380
+ function idRegistryExport(handle) {
1381
+ const native = getNativeBridge();
1382
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1383
+ return native.id_registry_export(handle);
1384
+ }
1385
+ function idRegistryImport(importedData) {
1386
+ const native = getNativeBridge();
1387
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1388
+ return native.id_registry_import(importedData);
1389
+ }
1390
+ var init_idRegistryNative = __esm({
1391
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1392
+ init_nativeBridge();
1393
+ }
1394
+ });
1395
+
1396
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1397
+ function processFileChange(fileChangeJson) {
1398
+ const native = getNativeBridge();
1399
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1400
+ const resultJson = native.process_file_change(fileChangeJson);
1401
+ try {
1402
+ return JSON.parse(resultJson);
1403
+ } catch {
1404
+ return {
1405
+ file_path: "",
1406
+ status: "error",
1407
+ old_classes: [],
1408
+ new_classes: [],
1409
+ added_classes: [],
1410
+ removed_classes: [],
1411
+ changed: false,
1412
+ fingerprint: "",
1413
+ error: "Failed to parse result"
1414
+ };
1415
+ }
1416
+ }
1417
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1418
+ const native = getNativeBridge();
1419
+ if (!native?.compute_incremental_diff)
1420
+ throw new Error("compute_incremental_diff not available");
1421
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1422
+ try {
1423
+ return JSON.parse(resultJson);
1424
+ } catch {
1425
+ return {
1426
+ is_changed: false,
1427
+ changes_count: 0,
1428
+ diff: {
1429
+ added_files: [],
1430
+ removed_files: [],
1431
+ modified_files: [],
1432
+ added_classes: [],
1433
+ removed_classes: [],
1434
+ total_changes: 0
1435
+ },
1436
+ processing_time_ms: 0
1437
+ };
1438
+ }
1439
+ }
1440
+ function createFingerprint(filePath, fileContent) {
1441
+ const native = getNativeBridge();
1442
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1443
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1444
+ try {
1445
+ return JSON.parse(fingerprintJson);
1446
+ } catch {
1447
+ return {
1448
+ file_path: filePath,
1449
+ content_hash: "",
1450
+ size_bytes: fileContent.length,
1451
+ mtime_ms: Date.now(),
1452
+ class_hash: "",
1453
+ signature: ""
1454
+ };
1455
+ }
1456
+ }
1457
+ function injectStateHash(css, stateHash) {
1458
+ const native = getNativeBridge();
1459
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1460
+ const resultJson = native.inject_state_hash(css, stateHash);
1461
+ try {
1462
+ return JSON.parse(resultJson);
1463
+ } catch {
1464
+ return {
1465
+ injected: false,
1466
+ state_hash: stateHash,
1467
+ affected_files: 0,
1468
+ total_injected_bytes: 0
1469
+ };
1470
+ }
1471
+ }
1472
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1473
+ const native = getNativeBridge();
1474
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1475
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1476
+ try {
1477
+ return JSON.parse(resultJson);
1478
+ } catch {
1479
+ return {
1480
+ entries_before: 0,
1481
+ entries_after: 0,
1482
+ entries_removed: 0,
1483
+ freed_bytes: 0
1484
+ };
1485
+ }
1486
+ }
1487
+ function rebuildWorkspaceResult(rootDir, extensions) {
1488
+ const native = getNativeBridge();
1489
+ if (!native?.rebuild_workspace_result)
1490
+ throw new Error("rebuild_workspace_result not available");
1491
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1492
+ try {
1493
+ return JSON.parse(resultJson);
1494
+ } catch {
1495
+ return {
1496
+ total_files_scanned: 0,
1497
+ total_classes_found: 0,
1498
+ unique_classes: 0,
1499
+ build_time_ms: 0,
1500
+ files_with_changes: 0
1501
+ };
1502
+ }
1503
+ }
1504
+ function scanFileNative(filePath, fileContent) {
1505
+ const native = getNativeBridge();
1506
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1507
+ const resultJson = native.scan_file_native(filePath, fileContent);
1508
+ try {
1509
+ return JSON.parse(resultJson);
1510
+ } catch {
1511
+ return {
1512
+ file: filePath,
1513
+ classes: [],
1514
+ added_classes: [],
1515
+ removed_classes: [],
1516
+ changed: false
1517
+ };
1518
+ }
1519
+ }
1520
+ function scanFilesBatchNative(filesJson) {
1521
+ const native = getNativeBridge();
1522
+ if (!native?.scan_files_batch_native)
1523
+ throw new Error("scan_files_batch_native not available");
1524
+ const resultJson = native.scan_files_batch_native(filesJson);
1525
+ try {
1526
+ return JSON.parse(resultJson);
1527
+ } catch {
1528
+ return [];
1529
+ }
1530
+ }
1531
+ var init_streamingNative = __esm({
1532
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1533
+ init_nativeBridge();
1534
+ }
1535
+ });
1536
+
1537
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1064
1538
  var tailwindEngine_exports = {};
1065
1539
  __export(tailwindEngine_exports, {
1066
1540
  clearCache: () => clearCache,
1067
- generateRawCss: () => generateRawCss,
1068
1541
  getCacheStats: () => getCacheStats,
1069
1542
  processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1070
1543
  runCssPipeline: () => runCssPipeline,
@@ -1098,48 +1571,6 @@ function clearCache() {
1098
1571
  _cacheHits = 0;
1099
1572
  _cacheMisses = 0;
1100
1573
  }
1101
- function loadTailwindEngine() {
1102
- if (_twEngine) return _twEngine;
1103
- if (_twEngineError) throw _twEngineError;
1104
- try {
1105
- const tw2 = require2("tailwindcss");
1106
- if (typeof tw2.compile !== "function") {
1107
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
1108
- }
1109
- _twEngine = tw2;
1110
- return _twEngine;
1111
- } catch (e) {
1112
- _twEngineError = e instanceof Error ? e : new Error(String(e));
1113
- throw _twEngineError;
1114
- }
1115
- }
1116
- async function generateRawCss(classes, cssEntryContent, root) {
1117
- if (classes.length === 0) return "";
1118
- const tw2 = loadTailwindEngine();
1119
- const input = cssEntryContent ?? "@import 'tailwindcss';";
1120
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1121
- const { dirname: dirname2, resolve: resolve2 } = await import('path');
1122
- const projectRoot = root ?? process.cwd();
1123
- const req = createRequire(resolve2(projectRoot, "package.json"));
1124
- const loadStylesheet = async (id, base) => {
1125
- try {
1126
- 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;
1127
- const pkgPath = req.resolve(cssId);
1128
- return { content: readFileSync(pkgPath, "utf-8"), base: dirname2(pkgPath) };
1129
- } catch {
1130
- try {
1131
- const absPath = resolve2(base, id);
1132
- if (existsSync3(absPath)) {
1133
- return { content: readFileSync(absPath, "utf-8"), base: dirname2(absPath) };
1134
- }
1135
- } catch {
1136
- }
1137
- return { content: "", base };
1138
- }
1139
- };
1140
- const compiler = await Promise.resolve(tw2.compile(input, { loadStylesheet }));
1141
- return compiler.build(classes);
1142
- }
1143
1574
  function getThemeConfig() {
1144
1575
  return {
1145
1576
  colors: {
@@ -1236,20 +1667,9 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1236
1667
  _cacheMisses++;
1237
1668
  let rawCss;
1238
1669
  let usedRustCompiler = false;
1239
- try {
1240
- const theme = getThemeConfig();
1241
- rawCss = await generateCssNative(unique, {
1242
- theme,
1243
- fallbackToJs: true,
1244
- logFallback: process.env.DEBUG?.includes("compiler") === true
1245
- });
1246
- usedRustCompiler = true;
1247
- } catch (error) {
1248
- if (process.env.DEBUG?.includes("compiler")) {
1249
- console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
1250
- }
1251
- rawCss = await generateRawCss(unique, cssEntryContent, root);
1252
- }
1670
+ const theme = getThemeConfig();
1671
+ rawCss = await generateCssNative(unique, { theme });
1672
+ usedRustCompiler = true;
1253
1673
  const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1254
1674
  if (process.env.DEBUG?.includes("compiler")) {
1255
1675
  console.log(
@@ -1267,67 +1687,900 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1267
1687
  _cssCache.set(cacheKey, result);
1268
1688
  return result;
1269
1689
  }
1270
- function runCssPipelineSync(_classes) {
1271
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
1690
+ function runCssPipelineSync(_classes) {
1691
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1692
+ }
1693
+ function processTailwindCssWithTargets(css, targets) {
1694
+ const native = getNativeBridge();
1695
+ if (!native?.processTailwindCssWithTargets) {
1696
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1697
+ }
1698
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1699
+ if (!result?.css) {
1700
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1701
+ }
1702
+ return result.css;
1703
+ }
1704
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1705
+ var init_tailwindEngine = __esm({
1706
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1707
+ init_nativeBridge();
1708
+ init_cssGeneratorNative();
1709
+ createRequire(import.meta.url);
1710
+ _cssCache = /* @__PURE__ */ new Map();
1711
+ _cacheHits = 0;
1712
+ _cacheMisses = 0;
1713
+ MAX_CACHE_SIZE = 100;
1714
+ }
1715
+ });
1716
+
1717
+ // packages/domain/compiler/src/compiler/index.ts
1718
+ var init_compiler = __esm({
1719
+ "packages/domain/compiler/src/compiler/index.ts"() {
1720
+ init_cssGeneratorNative();
1721
+ init_compilationNative();
1722
+ init_cssCompilationNative();
1723
+ init_idRegistryNative();
1724
+ init_streamingNative();
1725
+ }
1726
+ });
1727
+
1728
+ // packages/domain/compiler/src/parser/index.ts
1729
+ var parser_exports = {};
1730
+ __export(parser_exports, {
1731
+ astExtractClasses: () => astExtractClasses,
1732
+ batchExtractClasses: () => batchExtractClasses,
1733
+ checkAgainstSafelist: () => checkAgainstSafelist,
1734
+ diffClassLists: () => diffClassLists,
1735
+ extractAllClasses: () => extractAllClasses,
1736
+ extractClassesFromSource: () => extractClassesFromSource,
1737
+ extractComponentUsage: () => extractComponentUsage,
1738
+ mergeClassesStatic: () => mergeClassesStatic,
1739
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1740
+ normalizeClasses: () => normalizeClasses,
1741
+ parseClasses: () => parseClasses
1742
+ });
1743
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1744
+ var init_parser = __esm({
1745
+ "packages/domain/compiler/src/parser/index.ts"() {
1746
+ init_nativeBridge();
1747
+ parseClasses = (raw) => {
1748
+ const native = getNativeBridge();
1749
+ if (!native?.parseClasses) {
1750
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1751
+ }
1752
+ return native.parseClasses(raw) || [];
1753
+ };
1754
+ extractAllClasses = (source) => {
1755
+ const native = getNativeBridge();
1756
+ if (!native?.extractAllClasses) {
1757
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1758
+ }
1759
+ return native.extractAllClasses(source) || [];
1760
+ };
1761
+ extractClassesFromSource = (source) => {
1762
+ const native = getNativeBridge();
1763
+ if (!native?.extractClassesFromSource) {
1764
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1765
+ }
1766
+ const result = native.extractClassesFromSource(source);
1767
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1768
+ };
1769
+ astExtractClasses = (source, _filename) => {
1770
+ const native = getNativeBridge();
1771
+ if (!native?.extractClassesFromSource) {
1772
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1773
+ }
1774
+ return native.extractClassesFromSource(source) || [];
1775
+ };
1776
+ normalizeClasses = (raw) => {
1777
+ const result = normalizeAndDedupClasses(raw);
1778
+ return result?.normalized || "";
1779
+ };
1780
+ mergeClassesStatic = (classes) => {
1781
+ const result = normalizeAndDedupClasses(classes);
1782
+ return result?.normalized || "";
1783
+ };
1784
+ normalizeAndDedupClasses = (raw) => {
1785
+ const native = getNativeBridge();
1786
+ if (!native?.normalizeAndDedupClasses) {
1787
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1788
+ }
1789
+ const result = native.normalizeAndDedupClasses(raw);
1790
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1791
+ };
1792
+ extractComponentUsage = (source) => {
1793
+ const native = getNativeBridge();
1794
+ if (!native?.extractComponentUsage) {
1795
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1796
+ }
1797
+ return native.extractComponentUsage(source) || [];
1798
+ };
1799
+ batchExtractClasses = (filePaths) => {
1800
+ const native = getNativeBridge();
1801
+ if (!native?.batchExtractClasses) {
1802
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1803
+ }
1804
+ return native.batchExtractClasses(filePaths) || [];
1805
+ };
1806
+ checkAgainstSafelist = (classes, safelist) => {
1807
+ const native = getNativeBridge();
1808
+ if (!native?.checkAgainstSafelist) {
1809
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1810
+ }
1811
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1812
+ };
1813
+ diffClassLists = (previous, current) => {
1814
+ const native = getNativeBridge();
1815
+ if (!native?.diffClassLists) {
1816
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1817
+ }
1818
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1819
+ };
1820
+ }
1821
+ });
1822
+
1823
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1824
+ function detectDeadCode(scanResultJson, css) {
1825
+ const native = getNativeBridge();
1826
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1827
+ return native.detectDeadCode(scanResultJson, css);
1828
+ }
1829
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1830
+ const native = getNativeBridge();
1831
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1832
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1833
+ }
1834
+ function analyzeClassesNative(filesJson, cwd, flags) {
1835
+ const native = getNativeBridge();
1836
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1837
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1838
+ }
1839
+ function analyzeRscNative(source, filename) {
1840
+ const native = getNativeBridge();
1841
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1842
+ return native.analyzeRsc(source, filename);
1843
+ }
1844
+ function optimizeCssNative(css) {
1845
+ const native = getNativeBridge();
1846
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1847
+ const result = native.processTailwindCssLightning(css);
1848
+ return {
1849
+ css: result.css,
1850
+ originalSize: css.length,
1851
+ optimizedSize: result.size_bytes,
1852
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1853
+ };
1854
+ }
1855
+ function processTailwindCssLightning(css) {
1856
+ const native = getNativeBridge();
1857
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1858
+ return native.processTailwindCssLightning(css);
1859
+ }
1860
+ function eliminateDeadCssNative(css, deadClasses) {
1861
+ const native = getNativeBridge();
1862
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1863
+ return native.eliminateDeadCss(css, deadClasses);
1864
+ }
1865
+ function hoistComponentsNative(source) {
1866
+ const native = getNativeBridge();
1867
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1868
+ return native.hoistComponents(source);
1869
+ }
1870
+ function compileVariantTableNative(configJson) {
1871
+ const native = getNativeBridge();
1872
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1873
+ return native.compileVariantTable(configJson);
1874
+ }
1875
+ function classifyAndSortClassesNative(classes) {
1876
+ const native = getNativeBridge();
1877
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1878
+ return native.classifyAndSortClasses(classes);
1879
+ }
1880
+ function mergeCssDeclarationsNative(cssChunks) {
1881
+ const native = getNativeBridge();
1882
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1883
+ return native.mergeCssDeclarations(cssChunks);
1884
+ }
1885
+ var init_analyzerNative = __esm({
1886
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1887
+ init_nativeBridge();
1888
+ }
1889
+ });
1890
+
1891
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1892
+ function resolveVariants(configJson) {
1893
+ const native = getNativeBridge();
1894
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1895
+ const resultJson = native.resolve_variants(configJson);
1896
+ try {
1897
+ return JSON.parse(resultJson);
1898
+ } catch {
1899
+ return {
1900
+ variants: [],
1901
+ supported: [],
1902
+ deprecated: [],
1903
+ conflicting: []
1904
+ };
1905
+ }
1906
+ }
1907
+ function validateThemeConfig(configJson) {
1908
+ const native = getNativeBridge();
1909
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1910
+ const resultJson = native.validate_variant_config(configJson);
1911
+ try {
1912
+ return JSON.parse(resultJson);
1913
+ } catch {
1914
+ return {
1915
+ is_valid: false,
1916
+ errors: ["Unable to parse configuration"],
1917
+ warnings: [],
1918
+ suggestions: []
1919
+ };
1920
+ }
1921
+ }
1922
+ function resolveCascade(baseThemeJson, overridesJson) {
1923
+ const native = getNativeBridge();
1924
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1925
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1926
+ try {
1927
+ return JSON.parse(resultJson);
1928
+ } catch {
1929
+ return {
1930
+ base_theme: {},
1931
+ user_overrides: {},
1932
+ merged_theme: {},
1933
+ conflict_resolutions: []
1934
+ };
1935
+ }
1936
+ }
1937
+ function resolveClassNames(classNames, themeJson) {
1938
+ const native = getNativeBridge();
1939
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1940
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1941
+ try {
1942
+ return JSON.parse(resultJson);
1943
+ } catch {
1944
+ return [];
1945
+ }
1946
+ }
1947
+ function resolveConflictGroup(groupName, themeJson) {
1948
+ const native = getNativeBridge();
1949
+ if (!native?.resolve_conflict_group)
1950
+ throw new Error("resolve_conflict_group not available");
1951
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1952
+ try {
1953
+ return JSON.parse(resultJson);
1954
+ } catch {
1955
+ return {
1956
+ group_name: groupName,
1957
+ conflicting_classes: [],
1958
+ description: "",
1959
+ resolution_strategy: "last-wins"
1960
+ };
1961
+ }
1962
+ }
1963
+ function resolveThemeValue(keyPath, themeJson) {
1964
+ const native = getNativeBridge();
1965
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1966
+ return native.resolve_theme_value(keyPath, themeJson);
1967
+ }
1968
+ function resolveSimpleVariants(configJson) {
1969
+ const native = getNativeBridge();
1970
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1971
+ const resultJson = native.resolve_simple_variants(configJson);
1972
+ try {
1973
+ return JSON.parse(resultJson);
1974
+ } catch {
1975
+ return [];
1976
+ }
1977
+ }
1978
+ var init_themeResolutionNative = __esm({
1979
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
1980
+ init_nativeBridge();
1981
+ }
1982
+ });
1983
+
1984
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
1985
+ function scanWorkspace(root, extensions) {
1986
+ const native = getNativeBridge();
1987
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
1988
+ return native.scan_workspace(root, extensions);
1989
+ }
1990
+ function extractClassesFromSourceNative(source) {
1991
+ const native = getNativeBridge();
1992
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
1993
+ return native.extract_classes_from_source(source);
1994
+ }
1995
+ function batchExtractClassesNative(filePaths) {
1996
+ const native = getNativeBridge();
1997
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
1998
+ return native.batch_extract_classes(filePaths);
1999
+ }
2000
+ function checkAgainstSafelistNative(classes, safelist) {
2001
+ const native = getNativeBridge();
2002
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
2003
+ return native.check_against_safelist(classes, safelist);
2004
+ }
2005
+ function scanFile(filePath) {
2006
+ const native = getNativeBridge();
2007
+ if (!native?.scan_file) throw new Error("scan_file not available");
2008
+ return native.scan_file(filePath);
2009
+ }
2010
+ function collectFiles(root, extensions) {
2011
+ const native = getNativeBridge();
2012
+ if (!native?.collect_files) throw new Error("collect_files not available");
2013
+ return native.collect_files(root, extensions);
2014
+ }
2015
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
2016
+ const native = getNativeBridge();
2017
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
2018
+ return native.walk_and_prefilter_source_files(root, extensions);
2019
+ }
2020
+ function generateSubComponentTypes(root, outputPath) {
2021
+ const native = getNativeBridge();
2022
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
2023
+ return native.generate_sub_component_types(root, outputPath);
2024
+ }
2025
+ var init_scannerNative = __esm({
2026
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2027
+ init_nativeBridge();
2028
+ }
2029
+ });
2030
+
2031
+ // packages/domain/compiler/src/analyzer/index.ts
2032
+ var init_analyzer = __esm({
2033
+ "packages/domain/compiler/src/analyzer/index.ts"() {
2034
+ init_analyzerNative();
2035
+ init_themeResolutionNative();
2036
+ init_scannerNative();
2037
+ }
2038
+ });
2039
+
2040
+ // packages/domain/compiler/src/cache/cacheNative.ts
2041
+ function getCacheStatistics() {
2042
+ const native = getNativeBridge();
2043
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
2044
+ const statsJson = native.get_cache_statistics();
2045
+ try {
2046
+ return JSON.parse(statsJson);
2047
+ } catch {
2048
+ return {
2049
+ parse_cache: { hits: 0, misses: 0, size: 0 },
2050
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2051
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2052
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2053
+ overall_hit_rate: 0,
2054
+ total_memory_bytes: 0
2055
+ };
2056
+ }
2057
+ }
2058
+ function clearAllCaches() {
2059
+ const native = getNativeBridge();
2060
+ if (!native?.clear_all_caches) return;
2061
+ try {
2062
+ native.clear_all_caches();
2063
+ } catch {
2064
+ }
2065
+ }
2066
+ function clearParseCache() {
2067
+ const native = getNativeBridge();
2068
+ if (!native?.clear_parse_cache) return;
2069
+ try {
2070
+ native.clear_parse_cache();
2071
+ } catch {
2072
+ }
2073
+ }
2074
+ function clearResolveCache() {
2075
+ const native = getNativeBridge();
2076
+ if (!native?.clear_resolve_cache) return;
2077
+ try {
2078
+ native.clear_resolve_cache();
2079
+ } catch {
2080
+ }
2081
+ }
2082
+ function clearCompileCache() {
2083
+ const native = getNativeBridge();
2084
+ if (!native?.clear_compile_cache) return;
2085
+ try {
2086
+ native.clear_compile_cache();
2087
+ } catch {
2088
+ }
2089
+ }
2090
+ function clearCssGenCache() {
2091
+ const native = getNativeBridge();
2092
+ if (!native?.clear_css_gen_cache) return;
2093
+ try {
2094
+ native.clear_css_gen_cache();
2095
+ } catch {
2096
+ }
2097
+ }
2098
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2099
+ const native = getNativeBridge();
2100
+ if (!native?.get_cache_optimization_hints)
2101
+ throw new Error("get_cache_optimization_hints not available");
2102
+ const hintsJson = native.get_cache_optimization_hints(
2103
+ Math.min(100, Math.max(0, hitRatePercent)),
2104
+ Math.max(1, memoryUsedMb)
2105
+ );
2106
+ try {
2107
+ return JSON.parse(hintsJson);
2108
+ } catch {
2109
+ return {
2110
+ current_strategy: "unknown",
2111
+ recommended_strategy: "increase_size",
2112
+ estimated_improvement_percent: 0,
2113
+ suggested_memory_mb: 256,
2114
+ notes: ["Unable to analyze cache statistics"]
2115
+ };
2116
+ }
2117
+ }
2118
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2119
+ const native = getNativeBridge();
2120
+ if (!native?.estimate_optimal_cache_config_native)
2121
+ throw new Error("estimate_optimal_cache_config_native not available");
2122
+ const configJson = native.estimate_optimal_cache_config_native(
2123
+ Math.max(64, totalBudgetMb),
2124
+ workloadType
2125
+ );
2126
+ try {
2127
+ return JSON.parse(configJson);
2128
+ } catch {
2129
+ return {
2130
+ parse_cache_size: 128,
2131
+ resolve_cache_size: 64,
2132
+ compile_cache_size: 256,
2133
+ css_gen_cache_size: 128,
2134
+ recommended_eviction_policy: "lru",
2135
+ ttl_seconds: 3600,
2136
+ expected_hit_rate_percent: 75
2137
+ };
2138
+ }
2139
+ }
2140
+ function cacheRead(cachePath) {
2141
+ const native = getNativeBridge();
2142
+ if (!native?.cache_read) throw new Error("cache_read not available");
2143
+ const result = native.cache_read(cachePath);
2144
+ try {
2145
+ return JSON.parse(result.entries_json || "[]");
2146
+ } catch {
2147
+ return [];
2148
+ }
2149
+ }
2150
+ function cacheWrite(cachePath, entries) {
2151
+ const native = getNativeBridge();
2152
+ if (!native?.cache_write) throw new Error("cache_write not available");
2153
+ try {
2154
+ const result = native.cache_write(
2155
+ cachePath,
2156
+ entries.map((e) => ({
2157
+ file: e.file,
2158
+ content_hash: e.contentHash,
2159
+ classes: e.classes,
2160
+ mtime_ms: e.mtimeMs,
2161
+ size_bytes: e.sizeBytes
2162
+ }))
2163
+ );
2164
+ return typeof result === "boolean" ? result : result === true;
2165
+ } catch {
2166
+ return false;
2167
+ }
2168
+ }
2169
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2170
+ const native = getNativeBridge();
2171
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2172
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2173
+ }
2174
+ var init_cacheNative = __esm({
2175
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2176
+ init_nativeBridge();
2177
+ }
2178
+ });
2179
+
2180
+ // packages/domain/compiler/src/cache/index.ts
2181
+ var init_cache = __esm({
2182
+ "packages/domain/compiler/src/cache/index.ts"() {
2183
+ init_cacheNative();
2184
+ }
2185
+ });
2186
+
2187
+ // packages/domain/compiler/src/redis/redisNative.ts
2188
+ function redisPing() {
2189
+ const native = getNativeBridge();
2190
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2191
+ return native.redis_ping();
2192
+ }
2193
+ function redisGet(key) {
2194
+ const native = getNativeBridge();
2195
+ if (!native?.redis_get) throw new Error("redis_get not available");
2196
+ const result = native.redis_get(key);
2197
+ return result === "nil" ? null : result;
2198
+ }
2199
+ function redisSet(key, value, ttl_seconds) {
2200
+ const native = getNativeBridge();
2201
+ if (!native?.redis_set) throw new Error("redis_set not available");
2202
+ return native.redis_set(key, value, ttl_seconds);
2203
+ }
2204
+ function redisDelete(key) {
2205
+ const native = getNativeBridge();
2206
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2207
+ return native.redis_delete(key);
2208
+ }
2209
+ function redisExists(key) {
2210
+ const native = getNativeBridge();
2211
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2212
+ return native.redis_exists(key);
2213
+ }
2214
+ function redisMget(keys) {
2215
+ const native = getNativeBridge();
2216
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2217
+ const result = native.redis_mget(keys);
2218
+ try {
2219
+ return JSON.parse(result);
2220
+ } catch {
2221
+ return keys.map(() => null);
2222
+ }
2223
+ }
2224
+ function redisMset(pairs) {
2225
+ const native = getNativeBridge();
2226
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2227
+ return native.redis_mset(pairs);
2228
+ }
2229
+ function redisFlushDb() {
2230
+ const native = getNativeBridge();
2231
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2232
+ return native.redis_flush_db();
2233
+ }
2234
+ function redisFlushAll() {
2235
+ const native = getNativeBridge();
2236
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2237
+ return native.redis_flush_all();
2238
+ }
2239
+ function redisPoolConnect(host, port, pool_size) {
2240
+ const native = getNativeBridge();
2241
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2242
+ return native.redis_pool_connect(host, port, pool_size);
2243
+ }
2244
+ function redisPoolStats() {
2245
+ const native = getNativeBridge();
2246
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2247
+ const result = native.redis_pool_stats();
2248
+ try {
2249
+ return JSON.parse(result);
2250
+ } catch {
2251
+ return {
2252
+ connected_count: 0,
2253
+ idle_count: 0,
2254
+ waiting_count: 0,
2255
+ total_requests: 0,
2256
+ total_errors: 0
2257
+ };
2258
+ }
2259
+ }
2260
+ function redisPoolReconnect() {
2261
+ const native = getNativeBridge();
2262
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2263
+ return native.redis_pool_reconnect();
2264
+ }
2265
+ function redisEnableCluster(initial_nodes) {
2266
+ const native = getNativeBridge();
2267
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2268
+ const result = native.redis_enable_cluster(initial_nodes);
2269
+ try {
2270
+ return JSON.parse(result);
2271
+ } catch {
2272
+ return {
2273
+ enabled: false,
2274
+ cluster_state: "error",
2275
+ nodes: [],
2276
+ slots_assigned: 0,
2277
+ slots_ok: 0,
2278
+ slots_fail: 0
2279
+ };
2280
+ }
2281
+ }
2282
+ function redisDisableCluster() {
2283
+ const native = getNativeBridge();
2284
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2285
+ return native.redis_disable_cluster();
2286
+ }
2287
+ function redisClusterStatus() {
2288
+ const native = getNativeBridge();
2289
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2290
+ const result = native.redis_cluster_status();
2291
+ try {
2292
+ return JSON.parse(result);
2293
+ } catch {
2294
+ return {
2295
+ enabled: false,
2296
+ cluster_state: "unknown",
2297
+ nodes: [],
2298
+ slots_assigned: 0,
2299
+ slots_ok: 0,
2300
+ slots_fail: 0
2301
+ };
2302
+ }
2303
+ }
2304
+ function redisSubscribe(channel) {
2305
+ const native = getNativeBridge();
2306
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2307
+ return native.redis_subscribe(channel);
2308
+ }
2309
+ function redisPublish(channel, message) {
2310
+ const native = getNativeBridge();
2311
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2312
+ return native.redis_publish(channel, message);
2313
+ }
2314
+ function redisExpirationSet(key, ttl_seconds) {
2315
+ const native = getNativeBridge();
2316
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2317
+ return native.redis_expiration_set(key, ttl_seconds);
2318
+ }
2319
+ function redisExpirationGet(key) {
2320
+ const native = getNativeBridge();
2321
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2322
+ const result = native.redis_expiration_get(key);
2323
+ try {
2324
+ return JSON.parse(result);
2325
+ } catch {
2326
+ return {
2327
+ key,
2328
+ ttl_seconds: -1,
2329
+ expiration_timestamp: 0,
2330
+ is_persistent: true
2331
+ };
2332
+ }
2333
+ }
2334
+ function redisInfo() {
2335
+ const native = getNativeBridge();
2336
+ if (!native?.redis_info) throw new Error("redis_info not available");
2337
+ return native.redis_info();
2338
+ }
2339
+ function redisMonitor() {
2340
+ const native = getNativeBridge();
2341
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2342
+ return native.redis_monitor();
2343
+ }
2344
+ function redisCacheSize() {
2345
+ const native = getNativeBridge();
2346
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2347
+ return native.redis_cache_size();
2348
+ }
2349
+ function redisCacheKeyCount() {
2350
+ const native = getNativeBridge();
2351
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2352
+ return native.redis_cache_key_count();
2353
+ }
2354
+ function redisCacheClear() {
2355
+ const native = getNativeBridge();
2356
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2357
+ return native.redis_cache_clear();
2358
+ }
2359
+ function redisCacheHitRate() {
2360
+ const native = getNativeBridge();
2361
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2362
+ return native.redis_cache_hit_rate();
2363
+ }
2364
+ function redisEnablePersistence(mode) {
2365
+ const native = getNativeBridge();
2366
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2367
+ return native.redis_enable_persistence(mode);
2368
+ }
2369
+ function redisDisablePersistence() {
2370
+ const native = getNativeBridge();
2371
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2372
+ return native.redis_disable_persistence();
2373
+ }
2374
+ function redisSnapshot() {
2375
+ const native = getNativeBridge();
2376
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2377
+ return native.redis_snapshot();
2378
+ }
2379
+ function redisMemoryStats() {
2380
+ const native = getNativeBridge();
2381
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2382
+ return native.redis_memory_stats();
2383
+ }
2384
+ function redisOptimizeMemory() {
2385
+ const native = getNativeBridge();
2386
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2387
+ return native.redis_optimize_memory();
2388
+ }
2389
+ function redisSetEvictionPolicy(policy) {
2390
+ const native = getNativeBridge();
2391
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2392
+ return native.redis_set_eviction_policy(policy);
2393
+ }
2394
+ function redisGetEvictionPolicy() {
2395
+ const native = getNativeBridge();
2396
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2397
+ return native.redis_get_eviction_policy();
2398
+ }
2399
+ function redisReplicate(target_host, target_port) {
2400
+ const native = getNativeBridge();
2401
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2402
+ return native.redis_replicate(target_host, target_port);
2403
+ }
2404
+ function redisReplicationStatus() {
2405
+ const native = getNativeBridge();
2406
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2407
+ return native.redis_replication_status();
2408
+ }
2409
+ function redisCacheSync(peers) {
2410
+ const native = getNativeBridge();
2411
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2412
+ return native.redis_cache_sync(peers);
2413
+ }
2414
+ function redisEnableCacheWarming(key_pattern) {
2415
+ const native = getNativeBridge();
2416
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2417
+ return native.redis_enable_cache_warming(key_pattern);
2418
+ }
2419
+ function redisDisableCacheWarming() {
2420
+ const native = getNativeBridge();
2421
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2422
+ return native.redis_disable_cache_warming();
2423
+ }
2424
+ function redisDiagnose() {
2425
+ const native = getNativeBridge();
2426
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2427
+ return native.redis_diagnose();
2428
+ }
2429
+ var init_redisNative = __esm({
2430
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2431
+ init_nativeBridge();
2432
+ }
2433
+ });
2434
+
2435
+ // packages/domain/compiler/src/redis/index.ts
2436
+ var init_redis = __esm({
2437
+ "packages/domain/compiler/src/redis/index.ts"() {
2438
+ init_redisNative();
2439
+ }
2440
+ });
2441
+
2442
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2443
+ function startWatch(root_path, patterns) {
2444
+ const native = getNativeBridge();
2445
+ if (!native?.start_watch) throw new Error("start_watch not available");
2446
+ return native.start_watch(root_path, patterns);
2447
+ }
2448
+ function pollWatchEvents(handle, timeout_ms) {
2449
+ const native = getNativeBridge();
2450
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2451
+ const result = native.poll_watch_events(handle, timeout_ms);
2452
+ try {
2453
+ return JSON.parse(result);
2454
+ } catch {
2455
+ return [];
2456
+ }
2457
+ }
2458
+ function stopWatch(handle) {
2459
+ const native = getNativeBridge();
2460
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2461
+ return native.stop_watch(handle);
2462
+ }
2463
+ function watchAddPattern(handle, pattern) {
2464
+ const native = getNativeBridge();
2465
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2466
+ return native.watch_add_pattern(handle, pattern);
2467
+ }
2468
+ function watchRemovePattern(handle, pattern) {
2469
+ const native = getNativeBridge();
2470
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2471
+ return native.watch_remove_pattern(handle, pattern);
2472
+ }
2473
+ function watchGetActiveHandles() {
2474
+ const native = getNativeBridge();
2475
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2476
+ const result = native.watch_get_active_handles();
2477
+ try {
2478
+ return JSON.parse(result);
2479
+ } catch {
2480
+ return [];
2481
+ }
2482
+ }
2483
+ function watchClearAll() {
2484
+ const native = getNativeBridge();
2485
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2486
+ return native.watch_clear_all();
2487
+ }
2488
+ function watchEventTypeToString(event_type_code) {
2489
+ const native = getNativeBridge();
2490
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2491
+ return native.watch_event_type_to_string(event_type_code);
2492
+ }
2493
+ function isWatchRunning(handle) {
2494
+ const native = getNativeBridge();
2495
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2496
+ return native.is_watch_running(handle);
2497
+ }
2498
+ function getWatchStats() {
2499
+ const native = getNativeBridge();
2500
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2501
+ const result = native.get_watch_stats();
2502
+ try {
2503
+ return JSON.parse(result);
2504
+ } catch {
2505
+ return {
2506
+ active_watchers: 0,
2507
+ total_events: 0,
2508
+ events_this_second: 0,
2509
+ average_latency_ms: 0,
2510
+ largest_batch_size: 0
2511
+ };
2512
+ }
2513
+ }
2514
+ function watchPause(handle) {
2515
+ const native = getNativeBridge();
2516
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2517
+ return native.watch_pause(handle);
2518
+ }
2519
+ function watchResume(handle) {
2520
+ const native = getNativeBridge();
2521
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2522
+ return native.watch_resume(handle);
1272
2523
  }
1273
- function processTailwindCssWithTargets(css, targets) {
2524
+ function scanCacheOptimizations() {
1274
2525
  const native = getNativeBridge();
1275
- if (!native?.processTailwindCssWithTargets) {
1276
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1277
- }
1278
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
1279
- if (!result?.css) {
1280
- throw new Error("FATAL: processTailwindCssWithTargets returned null");
2526
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2527
+ return native.scan_cache_optimizations();
2528
+ }
2529
+ function getPluginHooks() {
2530
+ const native = getNativeBridge();
2531
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2532
+ const result = native.get_plugin_hooks();
2533
+ try {
2534
+ return JSON.parse(result);
2535
+ } catch {
2536
+ return [];
1281
2537
  }
1282
- return result.css;
1283
2538
  }
1284
- var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
1285
- var init_tailwindEngine = __esm({
1286
- "packages/domain/compiler/src/tailwindEngine.ts"() {
2539
+ function registerPluginHook(hook_name, handler_id) {
2540
+ const native = getNativeBridge();
2541
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2542
+ return native.register_plugin_hook(hook_name, handler_id);
2543
+ }
2544
+ function unregisterPluginHook(hook_name, handler_id) {
2545
+ const native = getNativeBridge();
2546
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2547
+ return native.unregister_plugin_hook(hook_name, handler_id);
2548
+ }
2549
+ function emitPluginHook(hook_name, data_json) {
2550
+ const native = getNativeBridge();
2551
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2552
+ return native.emit_plugin_hook(hook_name, data_json);
2553
+ }
2554
+ function getCompilationMetrics() {
2555
+ const native = getNativeBridge();
2556
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2557
+ return native.get_compilation_metrics();
2558
+ }
2559
+ function resetCompilationMetrics() {
2560
+ const native = getNativeBridge();
2561
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2562
+ return native.reset_compilation_metrics();
2563
+ }
2564
+ function validateCssOutput(css) {
2565
+ const native = getNativeBridge();
2566
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2567
+ return native.validate_css_output(css);
2568
+ }
2569
+ function getCompilerDiagnostics() {
2570
+ const native = getNativeBridge();
2571
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2572
+ return native.get_compiler_diagnostics();
2573
+ }
2574
+ var init_watchSystemNative = __esm({
2575
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
1287
2576
  init_nativeBridge();
1288
- init_cssGeneratorNative();
1289
- require2 = createRequire(import.meta.url);
1290
- _cssCache = /* @__PURE__ */ new Map();
1291
- _cacheHits = 0;
1292
- _cacheMisses = 0;
1293
- MAX_CACHE_SIZE = 100;
1294
- _twEngine = null;
1295
- _twEngineError = null;
1296
2577
  }
1297
2578
  });
1298
2579
 
1299
- // packages/domain/compiler/src/cssGeneratorNative.ts
1300
- async function generateCssNative(classes, options) {
1301
- const {
1302
- theme,
1303
- fallbackToJs = true,
1304
- logFallback = false
1305
- } = options;
1306
- try {
1307
- const native = getNativeBridge();
1308
- if (!native?.generateCssNative) {
1309
- throw new Error("generateCssNative not available in native binding");
1310
- }
1311
- const themeJson = JSON.stringify(theme);
1312
- const css = native.generateCssNative(classes, themeJson);
1313
- return css;
1314
- } catch (error) {
1315
- if (!fallbackToJs) {
1316
- throw error;
1317
- }
1318
- if (logFallback) {
1319
- console.warn(
1320
- "[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
1321
- error instanceof Error ? error.message : String(error)
1322
- );
1323
- }
1324
- return generateRawCss(classes);
1325
- }
1326
- }
1327
- var init_cssGeneratorNative = __esm({
1328
- "packages/domain/compiler/src/cssGeneratorNative.ts"() {
1329
- init_nativeBridge();
1330
- init_tailwindEngine();
2580
+ // packages/domain/compiler/src/watch/index.ts
2581
+ var init_watch = __esm({
2582
+ "packages/domain/compiler/src/watch/index.ts"() {
2583
+ init_watchSystemNative();
1331
2584
  }
1332
2585
  });
1333
2586
  function _layoutClassesToCss(classes) {
@@ -1364,10 +2617,16 @@ function extractContainerCssFromSource(source) {
1364
2617
  }
1365
2618
  return rules.join("\n");
1366
2619
  }
1367
- 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;
2620
+ 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;
1368
2621
  var init_src = __esm({
1369
2622
  "packages/domain/compiler/src/index.ts"() {
1370
2623
  init_nativeBridge();
2624
+ init_compiler();
2625
+ init_parser();
2626
+ init_analyzer();
2627
+ init_cache();
2628
+ init_redis();
2629
+ init_watch();
1371
2630
  transformSource = (source, opts) => {
1372
2631
  const native = getNativeBridge();
1373
2632
  if (!native?.transformSource) {
@@ -1411,58 +2670,19 @@ var init_src = __esm({
1411
2670
  const result = compileCssFromClasses(classes);
1412
2671
  return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
1413
2672
  };
1414
- compileCssNative = (classes, prefix = null) => {
1415
- return compileCssFromClasses(classes, prefix);
1416
- };
1417
2673
  generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
1418
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1419
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1420
- return result.css;
1421
- };
1422
- extractAllClasses = (source) => {
1423
- const native = getNativeBridge();
1424
- if (!native?.extractAllClasses) {
1425
- throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1426
- }
1427
- return native.extractAllClasses(source) || [];
1428
- };
1429
- extractClassesFromSource = (source) => {
1430
- const native = getNativeBridge();
1431
- if (!native?.extractClassesFromSource) {
1432
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1433
- }
1434
- const result = native.extractClassesFromSource(source);
1435
- return Array.isArray(result) ? result.join(" ") : String(result || "");
1436
- };
1437
- astExtractClasses = (source, _filename) => {
1438
- const native = getNativeBridge();
1439
- if (!native?.extractClassesFromSource) {
1440
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1441
- }
1442
- return native.extractClassesFromSource(source) || [];
1443
- };
1444
- parseClasses = (raw) => {
1445
- const native = getNativeBridge();
1446
- if (!native?.parseClasses) {
1447
- throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1448
- }
1449
- return native.parseClasses(raw) || [];
1450
- };
1451
- normalizeClasses = (raw) => {
1452
- const result = normalizeAndDedupClasses(raw);
1453
- return result?.normalized || "";
1454
- };
1455
- mergeClassesStatic = (classes) => {
1456
- const result = normalizeAndDedupClasses(classes);
1457
- return result?.normalized || "";
1458
- };
1459
- normalizeAndDedupClasses = (raw) => {
1460
- const native = getNativeBridge();
1461
- if (!native?.normalizeAndDedupClasses) {
1462
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
2674
+ try {
2675
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2676
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2677
+ return result.css;
2678
+ } catch {
2679
+ const native = getNativeBridge();
2680
+ if (!native?.transformSource) {
2681
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2682
+ }
2683
+ const result = native.transformSource(classes.join(" "), {});
2684
+ return result?.code || "";
1463
2685
  }
1464
- const result = native.normalizeAndDedupClasses(raw);
1465
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1466
2686
  };
1467
2687
  eliminateDeadCss = (css, deadClasses) => {
1468
2688
  const native = getNativeBridge();
@@ -1495,16 +2715,10 @@ var init_src = __esm({
1495
2715
  const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
1496
2716
  return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
1497
2717
  };
1498
- optimizeCss = (css) => {
1499
- const native = getNativeBridge();
1500
- if (!native?.optimizeCss) {
1501
- throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
1502
- }
1503
- return native.optimizeCss(css);
1504
- };
1505
2718
  scanProjectUsage = (dirs, cwd) => {
2719
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
1506
2720
  const files = dirs.map((dir) => path9__default.resolve(cwd, dir));
1507
- const results = batchExtractClasses(files) || [];
2721
+ const results = batchExtractClasses2(files) || [];
1508
2722
  const combined = {};
1509
2723
  for (const result of results) {
1510
2724
  if (result.ok && result.classes) {
@@ -1516,109 +2730,6 @@ var init_src = __esm({
1516
2730
  }
1517
2731
  return combined;
1518
2732
  };
1519
- extractComponentUsage = (source) => {
1520
- const native = getNativeBridge();
1521
- if (!native?.extractComponentUsage) {
1522
- throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1523
- }
1524
- return native.extractComponentUsage(source) || [];
1525
- };
1526
- diffClassLists = (previous, current) => {
1527
- const native = getNativeBridge();
1528
- if (!native?.diffClassLists) {
1529
- throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1530
- }
1531
- return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1532
- };
1533
- batchExtractClasses = (filePaths) => {
1534
- const native = getNativeBridge();
1535
- if (!native?.batchExtractClasses) {
1536
- throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1537
- }
1538
- return native.batchExtractClasses(filePaths) || [];
1539
- };
1540
- checkAgainstSafelist = (classes, safelist) => {
1541
- const native = getNativeBridge();
1542
- if (!native?.checkAgainstSafelist) {
1543
- throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1544
- }
1545
- return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1546
- };
1547
- hoistComponents = (source) => {
1548
- const native = getNativeBridge();
1549
- if (!native?.hoistComponents) {
1550
- throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
1551
- }
1552
- return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
1553
- };
1554
- compileVariantTable = (configJson) => {
1555
- const native = getNativeBridge();
1556
- if (!native?.compileVariantTable) {
1557
- throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
1558
- }
1559
- return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
1560
- };
1561
- compileVariants = (componentId, config) => {
1562
- return compileVariantTable(JSON.stringify({ componentId, ...config }));
1563
- };
1564
- classifyAndSortClasses = (classes) => {
1565
- const native = getNativeBridge();
1566
- if (!native?.classifyAndSortClasses) {
1567
- throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
1568
- }
1569
- return native.classifyAndSortClasses(classes) || [];
1570
- };
1571
- mergeCssDeclarations = (cssChunks) => {
1572
- const native = getNativeBridge();
1573
- if (!native?.mergeCssDeclarations) {
1574
- throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
1575
- }
1576
- return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
1577
- };
1578
- analyzeClassUsage = (classes, scanResultJson, css) => {
1579
- const native = getNativeBridge();
1580
- if (!native?.analyzeClassUsage) {
1581
- throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
1582
- }
1583
- return native.analyzeClassUsage(classes, scanResultJson, css) || [];
1584
- };
1585
- analyzeRsc = (source, filename) => {
1586
- const native = getNativeBridge();
1587
- if (!native?.analyzeRsc) {
1588
- throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
1589
- }
1590
- return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
1591
- };
1592
- analyzeFile = (source, filename) => {
1593
- const rsc = analyzeRsc(source, filename);
1594
- return {
1595
- isServer: rsc?.isServer ?? true,
1596
- needsClientDirective: rsc?.needsClientDirective ?? false,
1597
- clientReasons: rsc?.clientReasons ?? [],
1598
- interactiveClasses: [],
1599
- canStaticResolveVariants: true
1600
- };
1601
- };
1602
- analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
1603
- return { resolved: {}, dynamic: [] };
1604
- };
1605
- injectClientDirective = (source) => {
1606
- if (!source.includes('"use client"') && !source.includes("'use client'")) {
1607
- return '"use client";\n' + source;
1608
- }
1609
- return source;
1610
- };
1611
- injectServerOnlyComment = (source) => {
1612
- return `/* @server-only */
1613
- ${source}`;
1614
- };
1615
- analyzeClasses = (filesJson, cwd, flags) => {
1616
- const native = getNativeBridge();
1617
- if (!native?.analyzeClasses) {
1618
- throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
1619
- }
1620
- return native.analyzeClasses(filesJson, cwd, flags);
1621
- };
1622
2733
  generateSafelist = (scanDirs, outputPath, cwd) => {
1623
2734
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
1624
2735
  const allClasses = Object.keys(classes).sort();
@@ -1682,7 +2793,8 @@ ${source}`;
1682
2793
  if (containerCss) cssChunks.push(containerCss);
1683
2794
  const combined = cssChunks.join("\n").trim();
1684
2795
  if (combined) staticCss = combined;
1685
- } catch {
2796
+ } catch (err) {
2797
+ console.debug("Static CSS extraction warning:", err);
1686
2798
  }
1687
2799
  return {
1688
2800
  code: result?.code || "",
@@ -1767,7 +2879,46 @@ ${source}`;
1767
2879
  return [];
1768
2880
  };
1769
2881
  bucketSort = (classes) => {
1770
- return classifyAndSortClasses(classes).map((c) => c.raw ?? c);
2882
+ const native = getNativeBridge();
2883
+ if (!native?.classifyAndSortClasses) {
2884
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2885
+ }
2886
+ const sorted = native.classifyAndSortClasses(classes);
2887
+ return sorted.map((c) => c.raw ?? c);
2888
+ };
2889
+ analyzeFile = (source, filename) => {
2890
+ const native = getNativeBridge();
2891
+ if (!native?.analyzeRsc) {
2892
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2893
+ }
2894
+ const rsc = native.analyzeRsc(source, filename);
2895
+ return {
2896
+ isServer: rsc?.isServer ?? true,
2897
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2898
+ clientReasons: rsc?.clientReasons ?? [],
2899
+ interactiveClasses: [],
2900
+ canStaticResolveVariants: true
2901
+ };
2902
+ };
2903
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2904
+ return { resolved: {}, dynamic: [] };
2905
+ };
2906
+ injectClientDirective = (source) => {
2907
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2908
+ return '"use client";\n' + source;
2909
+ }
2910
+ return source;
2911
+ };
2912
+ injectServerOnlyComment = (source) => {
2913
+ return `/* @server-only */
2914
+ ${source}`;
2915
+ };
2916
+ analyzeClasses = (filesJson, cwd, flags) => {
2917
+ const native = getNativeBridge();
2918
+ if (!native?.analyzeClasses) {
2919
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2920
+ }
2921
+ return native.analyzeClasses(filesJson, cwd, flags);
1771
2922
  };
1772
2923
  extractTwStateConfigs = (source, filename) => {
1773
2924
  const native = getNativeBridge();
@@ -1776,23 +2927,25 @@ ${source}`;
1776
2927
  }
1777
2928
  return native.extractTwStateConfigs(source, filename);
1778
2929
  };
1779
- generateStaticStateCss = (inputs, resolvedCss = null) => {
1780
- const native = getNativeBridge();
1781
- if (!native?.generateStaticStateCss) {
1782
- throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2930
+ generateStaticStateCss = (entries, _themeConfig) => {
2931
+ const rules = [];
2932
+ for (const entry of entries) {
2933
+ const stateConfig = JSON.parse(entry.statesJson);
2934
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2935
+ rules.push({
2936
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2937
+ declarations: classes,
2938
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2939
+ componentName: entry.componentName,
2940
+ stateName
2941
+ });
2942
+ }
1783
2943
  }
1784
- return native.generateStaticStateCss(inputs, resolvedCss);
2944
+ return rules;
1785
2945
  };
1786
2946
  extractAndGenerateStateCss = (source, filename) => {
1787
- const native = getNativeBridge();
1788
- if (!native?.extractAndGenerateStateCss) {
1789
- const configs = extractTwStateConfigs(source, filename);
1790
- if (configs.length === 0) return [];
1791
- return generateStaticStateCss(
1792
- configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
1793
- );
1794
- }
1795
- return native.extractAndGenerateStateCss(source, filename);
2947
+ const entries = extractTwStateConfigs(source, filename);
2948
+ return generateStaticStateCss(entries);
1796
2949
  };
1797
2950
  }
1798
2951
  });
@@ -1801,75 +2954,219 @@ ${source}`;
1801
2954
  var internal_exports = {};
1802
2955
  __export(internal_exports, {
1803
2956
  adaptNativeResult: () => adaptNativeResult,
1804
- analyzeClassUsage: () => analyzeClassUsage,
2957
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
1805
2958
  analyzeClasses: () => analyzeClasses,
2959
+ analyzeClassesNative: () => analyzeClassesNative,
1806
2960
  analyzeFile: () => analyzeFile,
1807
- analyzeRsc: () => analyzeRsc,
2961
+ analyzeRscNative: () => analyzeRscNative,
1808
2962
  analyzeVariantUsage: () => analyzeVariantUsage,
1809
2963
  astExtractClasses: () => astExtractClasses,
2964
+ atomicRegistrySize: () => atomicRegistrySize,
1810
2965
  batchExtractClasses: () => batchExtractClasses,
2966
+ batchExtractClassesNative: () => batchExtractClassesNative,
1811
2967
  bucketSort: () => bucketSort,
1812
2968
  buildStyleTag: () => buildStyleTag,
2969
+ cachePriority: () => cachePriority,
2970
+ cacheRead: () => cacheRead,
2971
+ cacheWrite: () => cacheWrite,
1813
2972
  checkAgainstSafelist: () => checkAgainstSafelist,
1814
- classifyAndSortClasses: () => classifyAndSortClasses,
2973
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2974
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
1815
2975
  classifyNode: () => classifyNode,
2976
+ clearAllCaches: () => clearAllCaches,
2977
+ clearAtomicRegistry: () => clearAtomicRegistry,
1816
2978
  clearCache: () => clearCache,
2979
+ clearCompileCache: () => clearCompileCache,
2980
+ clearCssGenCache: () => clearCssGenCache,
2981
+ clearParseCache: () => clearParseCache,
2982
+ clearResolveCache: () => clearResolveCache,
2983
+ clearThemeCache: () => clearThemeCache,
2984
+ collectFiles: () => collectFiles,
2985
+ compileAnimation: () => compileAnimation,
2986
+ compileClass: () => compileClass,
2987
+ compileClasses: () => compileClasses,
1817
2988
  compileCssFromClasses: () => compileCssFromClasses,
1818
- compileCssNative: () => compileCssNative,
1819
- compileVariantTable: () => compileVariantTable,
1820
- compileVariants: () => compileVariants,
2989
+ compileCssLightning: () => compileCssLightning,
2990
+ compileCssNative2: () => compileCssNative2,
2991
+ compileKeyframes: () => compileKeyframes,
2992
+ compileTheme: () => compileTheme,
2993
+ compileToCss: () => compileToCss,
2994
+ compileToCssBatch: () => compileToCssBatch,
2995
+ compileVariantTableNative: () => compileVariantTableNative,
2996
+ computeIncrementalDiff: () => computeIncrementalDiff,
2997
+ createFingerprint: () => createFingerprint,
1821
2998
  detectConflicts: () => detectConflicts,
2999
+ detectDeadCode: () => detectDeadCode,
1822
3000
  diffClassLists: () => diffClassLists,
1823
3001
  eliminateDeadCss: () => eliminateDeadCss,
3002
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
3003
+ emitPluginHook: () => emitPluginHook,
3004
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
1824
3005
  extractAllClasses: () => extractAllClasses,
1825
3006
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3007
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
1826
3008
  extractClassesFromSource: () => extractClassesFromSource,
3009
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
1827
3010
  extractComponentUsage: () => extractComponentUsage,
1828
3011
  extractContainerCssFromSource: () => extractContainerCssFromSource,
3012
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
1829
3013
  extractTwStateConfigs: () => extractTwStateConfigs,
3014
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
1830
3015
  fileToRoute: () => fileToRoute,
1831
3016
  findDeadVariants: () => findDeadVariants,
3017
+ generateAtomicCss: () => generateAtomicCss,
1832
3018
  generateCssForClasses: () => generateCssForClasses,
1833
- generateRawCss: () => generateRawCss,
3019
+ generateCssNative: () => generateCssNative,
1834
3020
  generateSafelist: () => generateSafelist,
1835
3021
  generateStaticStateCss: () => generateStaticStateCss,
3022
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
3023
+ generateSubComponentTypes: () => generateSubComponentTypes,
1836
3024
  getAllRoutes: () => getAllRoutes,
1837
3025
  getBucketEngine: () => getBucketEngine,
3026
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
3027
+ getCacheStatistics: () => getCacheStatistics,
1838
3028
  getCacheStats: () => getCacheStats,
3029
+ getCompilationMetrics: () => getCompilationMetrics,
3030
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
1839
3031
  getContentPaths: () => getContentPaths,
1840
3032
  getIncrementalEngine: () => getIncrementalEngine,
1841
3033
  getNativeBridge: () => getNativeBridge,
3034
+ getPluginHooks: () => getPluginHooks,
1842
3035
  getRouteClasses: () => getRouteClasses,
3036
+ getWatchStats: () => getWatchStats,
1843
3037
  hasTwUsage: () => hasTwUsage,
1844
- hoistComponents: () => hoistComponents,
3038
+ hashContent: () => hashContent,
3039
+ hoistComponentsNative: () => hoistComponentsNative,
3040
+ idRegistryActiveCount: () => idRegistryActiveCount,
3041
+ idRegistryCreate: () => idRegistryCreate,
3042
+ idRegistryDestroy: () => idRegistryDestroy,
3043
+ idRegistryExport: () => idRegistryExport,
3044
+ idRegistryGenerate: () => idRegistryGenerate,
3045
+ idRegistryImport: () => idRegistryImport,
3046
+ idRegistryLookup: () => idRegistryLookup,
3047
+ idRegistryNext: () => idRegistryNext,
3048
+ idRegistryReset: () => idRegistryReset,
3049
+ idRegistrySnapshot: () => idRegistrySnapshot,
1845
3050
  injectClientDirective: () => injectClientDirective,
1846
3051
  injectServerOnlyComment: () => injectServerOnlyComment,
3052
+ injectStateHash: () => injectStateHash,
1847
3053
  isAlreadyTransformed: () => isAlreadyTransformed,
3054
+ isWatchRunning: () => isWatchRunning,
3055
+ layoutClassesToCss: () => layoutClassesToCss,
1848
3056
  loadSafelist: () => loadSafelist,
1849
3057
  loadTailwindConfig: () => loadTailwindConfig,
1850
3058
  mergeClassesStatic: () => mergeClassesStatic,
1851
- mergeCssDeclarations: () => mergeCssDeclarations,
3059
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
3060
+ minifyCss: () => minifyCss,
1852
3061
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1853
3062
  normalizeClasses: () => normalizeClasses,
1854
- optimizeCss: () => optimizeCss,
3063
+ optimizeCssNative: () => optimizeCssNative,
3064
+ parseAtomicClass: () => parseAtomicClass,
1855
3065
  parseClasses: () => parseClasses,
3066
+ pollWatchEvents: () => pollWatchEvents,
3067
+ processFileChange: () => processFileChange,
3068
+ processTailwindCssLightning: () => processTailwindCssLightning,
3069
+ propertyIdToString: () => propertyIdToString,
3070
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
3071
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
3072
+ redisCacheClear: () => redisCacheClear,
3073
+ redisCacheHitRate: () => redisCacheHitRate,
3074
+ redisCacheKeyCount: () => redisCacheKeyCount,
3075
+ redisCacheSize: () => redisCacheSize,
3076
+ redisCacheSync: () => redisCacheSync,
3077
+ redisClusterStatus: () => redisClusterStatus,
3078
+ redisDelete: () => redisDelete,
3079
+ redisDiagnose: () => redisDiagnose,
3080
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
3081
+ redisDisableCluster: () => redisDisableCluster,
3082
+ redisDisablePersistence: () => redisDisablePersistence,
3083
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
3084
+ redisEnableCluster: () => redisEnableCluster,
3085
+ redisEnablePersistence: () => redisEnablePersistence,
3086
+ redisExists: () => redisExists,
3087
+ redisExpirationGet: () => redisExpirationGet,
3088
+ redisExpirationSet: () => redisExpirationSet,
3089
+ redisFlushAll: () => redisFlushAll,
3090
+ redisFlushDb: () => redisFlushDb,
3091
+ redisGet: () => redisGet,
3092
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
3093
+ redisInfo: () => redisInfo,
3094
+ redisMemoryStats: () => redisMemoryStats,
3095
+ redisMget: () => redisMget,
3096
+ redisMonitor: () => redisMonitor,
3097
+ redisMset: () => redisMset,
3098
+ redisOptimizeMemory: () => redisOptimizeMemory,
3099
+ redisPing: () => redisPing,
3100
+ redisPoolConnect: () => redisPoolConnect,
3101
+ redisPoolReconnect: () => redisPoolReconnect,
3102
+ redisPoolStats: () => redisPoolStats,
3103
+ redisPublish: () => redisPublish,
3104
+ redisReplicate: () => redisReplicate,
3105
+ redisReplicationStatus: () => redisReplicationStatus,
3106
+ redisSet: () => redisSet,
3107
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
3108
+ redisSnapshot: () => redisSnapshot,
3109
+ redisSubscribe: () => redisSubscribe,
1856
3110
  registerFileClasses: () => registerFileClasses,
1857
3111
  registerGlobalClasses: () => registerGlobalClasses,
3112
+ registerPluginHook: () => registerPluginHook,
3113
+ registerPropertyName: () => registerPropertyName,
3114
+ registerValueName: () => registerValueName,
1858
3115
  resetBucketEngine: () => resetBucketEngine,
3116
+ resetCompilationMetrics: () => resetCompilationMetrics,
1859
3117
  resetIncrementalEngine: () => resetIncrementalEngine,
3118
+ resolveCascade: () => resolveCascade,
3119
+ resolveClassNames: () => resolveClassNames,
3120
+ resolveConflictGroup: () => resolveConflictGroup,
3121
+ resolveSimpleVariants: () => resolveSimpleVariants,
3122
+ resolveThemeValue: () => resolveThemeValue,
3123
+ resolveVariants: () => resolveVariants,
3124
+ reverseLookupProperty: () => reverseLookupProperty,
3125
+ reverseLookupValue: () => reverseLookupValue,
1860
3126
  runCssPipeline: () => runCssPipeline,
1861
3127
  runCssPipelineSync: () => runCssPipelineSync,
1862
3128
  runElimination: () => runElimination,
1863
3129
  runLoaderTransform: () => runLoaderTransform,
3130
+ scanCacheOptimizations: () => scanCacheOptimizations,
3131
+ scanFile: () => scanFile,
3132
+ scanFileNative: () => scanFileNative,
3133
+ scanFilesBatchNative: () => scanFilesBatchNative,
1864
3134
  scanProjectUsage: () => scanProjectUsage,
3135
+ scanWorkspace: () => scanWorkspace,
1865
3136
  shouldProcess: () => shouldProcess,
1866
3137
  shouldSkipFile: () => shouldSkipFile,
1867
- transformSource: () => transformSource
3138
+ startWatch: () => startWatch,
3139
+ stopWatch: () => stopWatch,
3140
+ toAtomicClasses: () => toAtomicClasses,
3141
+ transformSource: () => transformSource,
3142
+ twMerge: () => twMerge,
3143
+ twMergeMany: () => twMergeMany,
3144
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
3145
+ twMergeRaw: () => twMergeRaw,
3146
+ twMergeWithSeparator: () => twMergeWithSeparator,
3147
+ unregisterPluginHook: () => unregisterPluginHook,
3148
+ validateCssOutput: () => validateCssOutput,
3149
+ validateThemeConfig: () => validateThemeConfig,
3150
+ valueIdToString: () => valueIdToString,
3151
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
3152
+ watchAddPattern: () => watchAddPattern,
3153
+ watchClearAll: () => watchClearAll,
3154
+ watchEventTypeToString: () => watchEventTypeToString,
3155
+ watchGetActiveHandles: () => watchGetActiveHandles,
3156
+ watchPause: () => watchPause,
3157
+ watchRemovePattern: () => watchRemovePattern,
3158
+ watchResume: () => watchResume
1868
3159
  });
1869
3160
  var init_internal = __esm({
1870
3161
  "packages/domain/compiler/src/internal.ts"() {
1871
3162
  init_src();
1872
3163
  init_tailwindEngine();
3164
+ init_compiler();
3165
+ init_parser();
3166
+ init_analyzer();
3167
+ init_cache();
3168
+ init_redis();
3169
+ init_watch();
1873
3170
  }
1874
3171
  });
1875
3172
  function getNative() {
@@ -2216,7 +3513,7 @@ __export(src_exports, {
2216
3513
  getPipelinePercentages: () => getPipelinePercentages,
2217
3514
  getSuggestion: () => getSuggestion,
2218
3515
  getTailwindVersion: () => getTailwindVersion,
2219
- hashContent: () => hashContent,
3516
+ hashContent: () => hashContent2,
2220
3517
  isTailwindV4: () => isTailwindV4,
2221
3518
  isTwError: () => isTwError,
2222
3519
  loadNativeBinding: () => loadNativeBinding,
@@ -2346,7 +3643,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
2346
3643
  return process.cwd();
2347
3644
  }
2348
3645
  }
2349
- function hashContent(content, algorithm = "md5", length) {
3646
+ function hashContent2(content, algorithm = "md5", length) {
2350
3647
  const hash = createHash(algorithm).update(content).digest("hex");
2351
3648
  return length ? hash.slice(0, length) : hash;
2352
3649
  }
@@ -2471,7 +3768,7 @@ var init_src2 = __esm({
2471
3768
  // packages/domain/scanner/src/native-bridge.ts
2472
3769
  var native_bridge_exports = {};
2473
3770
  __export(native_bridge_exports, {
2474
- batchExtractClassesNative: () => batchExtractClassesNative,
3771
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2475
3772
  cachePriorityNative: () => cachePriorityNative,
2476
3773
  cacheReadNative: () => cacheReadNative,
2477
3774
  cacheWriteNative: () => cacheWriteNative,
@@ -2491,8 +3788,8 @@ __export(native_bridge_exports, {
2491
3788
  scanCacheInvalidate: () => scanCacheInvalidate,
2492
3789
  scanCachePut: () => scanCachePut,
2493
3790
  scanCacheStats: () => scanCacheStats,
2494
- scanFileNative: () => scanFileNative,
2495
- scanFilesBatchNative: () => scanFilesBatchNative,
3791
+ scanFileNative: () => scanFileNative2,
3792
+ scanFilesBatchNative: () => scanFilesBatchNative2,
2496
3793
  scanWorkspaceNative: () => scanWorkspaceNative,
2497
3794
  startWatchNative: () => startWatchNative,
2498
3795
  stopWatchNative: () => stopWatchNative
@@ -2583,7 +3880,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
2583
3880
  }
2584
3881
  return result;
2585
3882
  }
2586
- function batchExtractClassesNative(filePaths) {
3883
+ function batchExtractClassesNative2(filePaths) {
2587
3884
  const binding = scannerGetBinding();
2588
3885
  if (!binding.batchExtractClasses) {
2589
3886
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -2618,7 +3915,7 @@ function scanCacheStats() {
2618
3915
  }
2619
3916
  return binding.scanCacheStats();
2620
3917
  }
2621
- function scanFileNative(filePath) {
3918
+ function scanFileNative2(filePath) {
2622
3919
  const binding = scannerGetBinding();
2623
3920
  if (!binding.scanFile) {
2624
3921
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -2630,7 +3927,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
2630
3927
  if (!binding.collectFiles) return null;
2631
3928
  return binding.collectFiles(root, extensions, ignoreDirs);
2632
3929
  }
2633
- function scanFilesBatchNative(filePaths) {
3930
+ function scanFilesBatchNative2(filePaths) {
2634
3931
  const binding = scannerGetBinding();
2635
3932
  if (!binding.scanFilesBatch) {
2636
3933
  return filePaths.map((fp) => {
@@ -2835,7 +4132,7 @@ var init_cache_native = __esm({
2835
4132
  init_native_bridge();
2836
4133
  }
2837
4134
  });
2838
- function collectFiles(rootDir, extensions, ignoreDirs) {
4135
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
2839
4136
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
2840
4137
  if (native !== null) return native;
2841
4138
  throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
@@ -2875,9 +4172,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
2875
4172
  maxWorkers = Math.max(1, availableParallelism() - 1),
2876
4173
  chunkSize = DEFAULT_CHUNK_SIZE
2877
4174
  } = options;
2878
- const files = collectFiles(path9__default.resolve(rootDir), extensions, ignoreDirs);
4175
+ const files = collectFiles2(path9__default.resolve(rootDir), extensions, ignoreDirs);
2879
4176
  if (files.length < PARALLEL_THRESHOLD) {
2880
- return mergeResults(batchExtractClassesNative(files));
4177
+ return mergeResults(batchExtractClassesNative2(files));
2881
4178
  }
2882
4179
  const chunks = [];
2883
4180
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -2901,7 +4198,7 @@ var init_parallel_scanner = __esm({
2901
4198
  if (!isMainThread && parentPort) {
2902
4199
  const { filePaths } = workerData;
2903
4200
  try {
2904
- const results = batchExtractClassesNative(filePaths);
4201
+ const results = batchExtractClassesNative2(filePaths);
2905
4202
  const msg = { ok: true, results };
2906
4203
  parentPort.postMessage(msg);
2907
4204
  } catch (error) {
@@ -2985,15 +4282,15 @@ var src_exports2 = {};
2985
4282
  __export(src_exports2, {
2986
4283
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
2987
4284
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
2988
- batchExtractClassesNative: () => batchExtractClassesNative,
4285
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2989
4286
  extractClassesNative: () => extractClassesNative,
2990
4287
  isScannableFile: () => isScannableFile2,
2991
4288
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
2992
4289
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
2993
4290
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
2994
- scanFile: () => scanFile,
4291
+ scanFile: () => scanFile2,
2995
4292
  scanSource: () => scanSource,
2996
- scanWorkspace: () => scanWorkspace,
4293
+ scanWorkspace: () => scanWorkspace2,
2997
4294
  scanWorkspaceAsync: () => scanWorkspaceAsync
2998
4295
  });
2999
4296
  function getRuntimeDir() {
@@ -3119,9 +4416,9 @@ function scanSource(source) {
3119
4416
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
3120
4417
  return includeExtensions.includes(path9__default.extname(filePath));
3121
4418
  }
3122
- function scanFile(filePath) {
3123
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
3124
- const result = scanFileNative2(filePath);
4419
+ function scanFile2(filePath) {
4420
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4421
+ const result = scanFileNative3(filePath);
3125
4422
  if (!result.ok) {
3126
4423
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
3127
4424
  }
@@ -3131,7 +4428,7 @@ function scanFile(filePath) {
3131
4428
  ...result.hash ? { hash: result.hash } : {}
3132
4429
  };
3133
4430
  }
3134
- function scanWorkspace(rootDir, options = {}) {
4431
+ function scanWorkspace2(rootDir, options = {}) {
3135
4432
  const normalizedOptions = parseScanWorkspaceOptions(options);
3136
4433
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
3137
4434
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -3254,7 +4551,7 @@ function scanWorkspace(rootDir, options = {}) {
3254
4551
  }
3255
4552
  } else {
3256
4553
  for (const filePath of candidates) {
3257
- processResult(scanFile(filePath));
4554
+ processResult(scanFile2(filePath));
3258
4555
  }
3259
4556
  }
3260
4557
  return parseScanWorkspaceResult({
@@ -3281,7 +4578,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
3281
4578
  log3.debug(
3282
4579
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
3283
4580
  );
3284
- return scanWorkspace(rootDir, normalizedOptions);
4581
+ return scanWorkspace2(rootDir, normalizedOptions);
3285
4582
  }
3286
4583
  }
3287
4584
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
@@ -3474,24 +4771,31 @@ var init_native_bridge2 = __esm({
3474
4771
 
3475
4772
  // packages/domain/core/src/native.ts
3476
4773
  init_src2();
3477
- var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
3478
- var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
4774
+ var isBrowser4 = typeof window !== "undefined" && typeof document !== "undefined";
4775
+ var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nMake sure:\n 1. .node files were copied to dist/ during build\n 2. You installed the correct native package for your platform\n 3. npm run build:rust was executed successfully";
3479
4776
  var _nodeRequire = createRequire(import.meta.url);
3480
4777
  var _loadNative2 = (path15) => _nodeRequire(path15);
3481
4778
  var nativeBinding = null;
3482
4779
  var bindingLoadAttempted = false;
4780
+ var bindingError = null;
3483
4781
  var getBinding = () => {
3484
- if (isBrowser4) {
3485
- throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
3486
- }
3487
4782
  if (nativeBinding) return nativeBinding;
4783
+ if (bindingError) {
4784
+ throw bindingError;
4785
+ }
3488
4786
  if (bindingLoadAttempted) {
3489
4787
  throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
3490
4788
  }
3491
4789
  bindingLoadAttempted = true;
3492
4790
  try {
3493
- const runtimeDir = isBrowser4 ? "" : dirname(fileURLToPath(import.meta.url));
3494
- const result = isBrowser4 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
4791
+ if (isBrowser4) {
4792
+ bindingError = new Error(
4793
+ "[tailwind-styled/core] Cannot use template literals (tw`...`) in browser environment.\n\nTemplate literal parsing requires native Rust bindings compiled to WebAssembly,\nwhich is not currently supported.\n\nSolutions:\n1. Use object config only: tw.button({ base: '...', variants: {...} })\n2. Pre-compile components on the server (Next.js Server Components)\n3. Use @tailwind-styled browser-safe packages if available\n\nFor more info: https://github.com/Dictionar32/css-in-rust/discussions"
4794
+ );
4795
+ throw bindingError;
4796
+ }
4797
+ const runtimeDir = dirname(fileURLToPath(import.meta.url));
4798
+ const result = resolveNativeBinary(runtimeDir);
3495
4799
  if (result.path && result.path.endsWith(".node")) {
3496
4800
  const mod = _loadNative2(result.path);
3497
4801
  if (mod?.batchSplitClasses) {
@@ -3499,11 +4803,22 @@ var getBinding = () => {
3499
4803
  return nativeBinding;
3500
4804
  }
3501
4805
  }
3502
- throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE2}
4806
+ bindingError = new Error(
4807
+ `${NATIVE_UNAVAILABLE_MESSAGE2}
4808
+
4809
+ Resolution Attempts:
4810
+ ${result.tried.map((t2) => ` - ${t2}`).join("\n")}
3503
4811
 
3504
- Tried: ${result.tried.join("\n")}`);
4812
+ Quick fixes:
4813
+ 1. npm run build:rust # Build native binaries
4814
+ 2. npm install # Reinstall with pre-built binaries
4815
+ 3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
4816
+ );
4817
+ throw bindingError;
3505
4818
  } catch (err) {
3506
- throw err instanceof Error ? err : new Error(String(err));
4819
+ const error = err instanceof Error ? err : new Error(String(err));
4820
+ bindingError = error;
4821
+ throw error;
3507
4822
  }
3508
4823
  };
3509
4824
  var getNativeBinding = getBinding;
@@ -3534,7 +4849,7 @@ function hashContainer(tag, container, name) {
3534
4849
  _hashContainerCache.set(sortedKey, id);
3535
4850
  return id;
3536
4851
  }
3537
- function layoutClassesToCss(classes) {
4852
+ function layoutClassesToCss2(classes) {
3538
4853
  const native = getNativeBinding();
3539
4854
  if (!native?.layoutClassesToCss) {
3540
4855
  throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
@@ -3545,7 +4860,7 @@ function buildContainerRules(id, container, containerName) {
3545
4860
  const rules = Object.entries(container).map(([key, value]) => {
3546
4861
  const minWidth = typeof value === "string" ? CONTAINER_BREAKPOINTS[key] ?? key : value.minWidth ?? CONTAINER_BREAKPOINTS[key] ?? key;
3547
4862
  const classes = typeof value === "string" ? value : value.classes;
3548
- const css = layoutClassesToCss(classes);
4863
+ const css = layoutClassesToCss2(classes);
3549
4864
  if (!css) return null;
3550
4865
  const query = containerName ? `@container ${containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
3551
4866
  return `${query}{.${id}{${css}}}`;
@@ -3630,7 +4945,7 @@ function getContainerRegistry() {
3630
4945
 
3631
4946
  // packages/domain/core/src/merge.ts
3632
4947
  function createTwMerge(_options = {}) {
3633
- return function twMerge2(...classLists) {
4948
+ return function twMerge3(...classLists) {
3634
4949
  const inputs = [];
3635
4950
  for (let i = 0; i < classLists.length; i++) {
3636
4951
  const v = classLists[i];
@@ -3644,11 +4959,11 @@ function createTwMerge(_options = {}) {
3644
4959
  return native.twMergeRaw(inputs);
3645
4960
  };
3646
4961
  }
3647
- var twMerge = createTwMerge();
4962
+ var twMerge2 = createTwMerge();
3648
4963
  function mergeWithRules(rules, ...classLists) {
3649
- const base = twMerge(...classLists);
4964
+ const base = twMerge2(...classLists);
3650
4965
  const classes = Object.values(rules).reduce(
3651
- (acc, rule) => twMerge(rule(acc)).split(/\s+/).filter(Boolean),
4966
+ (acc, rule) => twMerge2(rule(acc)).split(/\s+/).filter(Boolean),
3652
4967
  base.split(/\s+/).filter(Boolean)
3653
4968
  );
3654
4969
  return classes.join(" ");
@@ -3913,7 +5228,7 @@ function makeFilterProps(variantKeys, stateKeys = /* @__PURE__ */ new Set()) {
3913
5228
  return out;
3914
5229
  };
3915
5230
  }
3916
- function resolveVariants(variants, props, defaults) {
5231
+ function resolveVariants2(variants, props, defaults) {
3917
5232
  const variantKeys = Object.keys(variants);
3918
5233
  const cleanProps = {};
3919
5234
  for (const k of variantKeys) {
@@ -3964,7 +5279,7 @@ function attachExtend(component, originalTag, base, config) {
3964
5279
  function extendWithClasses(stringsOrConfig) {
3965
5280
  if (Array.isArray(stringsOrConfig) && "raw" in stringsOrConfig) {
3966
5281
  const rawExtra = stringsOrConfig.raw.join("").trim().replace(/\s+/g, " ");
3967
- const merged2 = twMerge(extractBaseClasses(base), extractBaseClasses(rawExtra));
5282
+ const merged2 = twMerge2(extractBaseClasses(base), extractBaseClasses(rawExtra));
3968
5283
  const extended2 = createComponent(
3969
5284
  originalTag,
3970
5285
  typeof config === "string" ? merged2 : { ...config, base: merged2 }
@@ -3982,7 +5297,7 @@ function attachExtend(component, originalTag, base, config) {
3982
5297
  }
3983
5298
  const extCfg = stringsOrConfig;
3984
5299
  const extraClasses = extCfg.classes ?? "";
3985
- const merged = twMerge(extractBaseClasses(base), extraClasses);
5300
+ const merged = twMerge2(extractBaseClasses(base), extraClasses);
3986
5301
  const existing = typeof config === "object" ? config : {};
3987
5302
  const extended = createComponent(originalTag, {
3988
5303
  ...existing,
@@ -4076,7 +5391,7 @@ function createComponent(tag, config) {
4076
5391
  const { className, ...rest } = props;
4077
5392
  const runtimeClassName = normalizeClassName(className);
4078
5393
  const statesClasses = statesConfig ? resolveStates(statesConfig, stateKeys, statesLookup, props) : "";
4079
- const mergedBase = twMerge(extractBaseClasses(base), engineClasses, runtimeClassName);
5394
+ const mergedBase = twMerge2(extractBaseClasses(base), engineClasses, runtimeClassName);
4080
5395
  const className2 = statesClasses ? `${mergedBase} ${statesClasses}`.trim() : mergedBase;
4081
5396
  return React3.createElement(tag, {
4082
5397
  ref,
@@ -4093,10 +5408,10 @@ function createComponent(tag, config) {
4093
5408
  const baseComponent = React3.forwardRef((props, ref) => {
4094
5409
  const { className, ...rest } = props;
4095
5410
  const runtimeClassName = normalizeClassName(className);
4096
- const variantClasses = resolveVariants(variants, props, defaultVariants);
5411
+ const variantClasses = resolveVariants2(variants, props, defaultVariants);
4097
5412
  const compoundClasses = resolveCompound(compoundVariants, props);
4098
5413
  const statesClasses = statesConfig ? resolveStates(statesConfig, stateKeys, statesLookup, props) : "";
4099
- const mergedBase = twMerge(extractBaseClasses(base), variantClasses, compoundClasses, engineClasses, runtimeClassName);
5414
+ const mergedBase = twMerge2(extractBaseClasses(base), variantClasses, compoundClasses, engineClasses, runtimeClassName);
4100
5415
  const className2 = statesClasses ? `${mergedBase} ${statesClasses}`.trim() : mergedBase;
4101
5416
  return React3.createElement(tag, {
4102
5417
  ref,
@@ -4258,7 +5573,7 @@ function cv(config, componentId) {
4258
5573
  } else {
4259
5574
  result = resolveVariantsNative(config, props);
4260
5575
  }
4261
- return props.className ? twMerge(result, props.className) : result;
5576
+ return props.className ? twMerge2(result, props.className) : result;
4262
5577
  };
4263
5578
  }
4264
5579
 
@@ -4561,7 +5876,7 @@ function resolveVariantClass(options, props) {
4561
5876
  }
4562
5877
  function resolveStyledClassName(options, props = {}) {
4563
5878
  const parts = [options.base ?? "", ...resolveVariantClass(options, props), props.className ?? ""];
4564
- return twMerge(...parts);
5879
+ return twMerge2(...parts);
4565
5880
  }
4566
5881
  function styled(options) {
4567
5882
  return function getClassName(props = {}) {
@@ -4727,7 +6042,9 @@ function parseTemplate(strings, exprs) {
4727
6042
  if (cached) return cached;
4728
6043
  const binding = getNativeBinding();
4729
6044
  if (!binding?.parseTemplate) {
4730
- throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
6045
+ throw new Error(
6046
+ "FATAL: Native binding 'parseTemplate' is required but not available in this environment.\n\nThis function is only available on Node.js with native bindings loaded.\nFor browser environments, use object config instead:\n tw.button({ base: '...', variants: {...} })"
6047
+ );
4731
6048
  }
4732
6049
  const r = binding.parseTemplate(raw);
4733
6050
  const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
@@ -5562,7 +6879,7 @@ init_src2();
5562
6879
  init_native_bridge2();
5563
6880
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
5564
6881
  var log5 = createLogger2("engine:incremental");
5565
- function rebuildWorkspaceResult(byFile) {
6882
+ function rebuildWorkspaceResult2(byFile) {
5566
6883
  const files = Array.from(byFile.values());
5567
6884
  const native = getNativeEngineBinding();
5568
6885
  if (native?.rebuildWorkspaceResult) {
@@ -5605,10 +6922,10 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
5605
6922
  log5.debug(`native unlink ${normalizedPath}`);
5606
6923
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
5607
6924
  byFile.delete(normalizedPath);
5608
- return rebuildWorkspaceResult(byFile);
6925
+ return rebuildWorkspaceResult2(byFile);
5609
6926
  }
5610
6927
  log5.debug(`native change ${normalizedPath}`);
5611
- const scanned = scanFile(normalizedPath);
6928
+ const scanned = scanFile2(normalizedPath);
5612
6929
  const content = fs3__default.readFileSync(normalizedPath, "utf8");
5613
6930
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
5614
6931
  const existing = byFile.get(normalizedPath);
@@ -5621,7 +6938,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
5621
6938
  log5.debug(`native diff cold-sync ${normalizedPath}`);
5622
6939
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
5623
6940
  }
5624
- return rebuildWorkspaceResult(byFile);
6941
+ return rebuildWorkspaceResult2(byFile);
5625
6942
  }
5626
6943
 
5627
6944
  // packages/domain/engine/src/metrics.ts
@@ -6262,6 +7579,6 @@ async function createEngine(rawOptions = {}) {
6262
7579
  };
6263
7580
  }
6264
7581
 
6265
- export { applyTokenSet, cn, tokenRef as containerRef, createComponent, createEngine, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens, withSubComponents };
7582
+ export { applyTokenSet, cn, tokenRef as containerRef, createComponent, createEngine, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge2 as twMerge, twVar, v4Tokens, withSubComponents };
6266
7583
  //# sourceMappingURL=index.mjs.map
6267
7584
  //# sourceMappingURL=index.mjs.map