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.js CHANGED
@@ -885,27 +885,15 @@ function resolveNativeBinary(runtimeDir) {
885
885
  }
886
886
  tried.push(`env:${envPath} (not found)`);
887
887
  }
888
- const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
889
- for (const pkg of prebuiltPkgs) {
890
- try {
891
- const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
892
- if (fs3__namespace.existsSync(candidate)) {
893
- return { path: candidate, source: "prebuilt", platform, tried };
894
- }
895
- tried.push(`prebuilt:${pkg} (resolved but missing)`);
896
- } catch {
897
- tried.push(`prebuilt:${pkg} (not installed)`);
898
- }
899
- }
900
888
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
901
- const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
889
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
902
890
  if (runtimeDir) {
903
891
  for (const depth of ["..", path9__namespace.join("..", ".."), path9__namespace.join("..", "..", "..")]) {
904
892
  const pkgRoot = path9__namespace.resolve(runtimeDir, depth);
905
893
  for (const bin of BINARY_NAMES_SELF) {
906
894
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
907
895
  const candidate = path9__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
908
- tried.push(`self-bundled:${candidate}`);
896
+ tried.push(`native:${candidate}`);
909
897
  if (fs3__namespace.existsSync(candidate)) {
910
898
  return { path: candidate, source: "prebuilt", platform, tried };
911
899
  }
@@ -913,6 +901,18 @@ function resolveNativeBinary(runtimeDir) {
913
901
  }
914
902
  }
915
903
  }
904
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
905
+ for (const pkg of prebuiltPkgs) {
906
+ try {
907
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
908
+ if (fs3__namespace.existsSync(candidate)) {
909
+ return { path: candidate, source: "prebuilt", platform, tried };
910
+ }
911
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
912
+ } catch {
913
+ tried.push(`prebuilt:${pkg} (not installed)`);
914
+ }
915
+ }
916
916
  const cwd = process.cwd();
917
917
  const base = runtimeDir ?? cwd;
918
918
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
@@ -1085,11 +1085,484 @@ Tried paths: ${result.tried.join("\n")}`);
1085
1085
  }
1086
1086
  });
1087
1087
 
1088
- // packages/domain/compiler/src/tailwindEngine.ts
1088
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1089
+ async function generateCssNative(classes, options) {
1090
+ const { theme } = options;
1091
+ const native = getNativeBridge();
1092
+ if (!native?.generateCssNative) {
1093
+ throw new Error(
1094
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1095
+ );
1096
+ }
1097
+ const themeJson = JSON.stringify(theme);
1098
+ const css = native.generateCssNative(classes, themeJson);
1099
+ return css;
1100
+ }
1101
+ function clearThemeCache() {
1102
+ try {
1103
+ const native = getNativeBridge();
1104
+ if (!native?.clearThemeCache) {
1105
+ return;
1106
+ }
1107
+ native.clearThemeCache();
1108
+ } catch {
1109
+ }
1110
+ }
1111
+ var init_cssGeneratorNative = __esm({
1112
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1113
+ init_nativeBridge();
1114
+ }
1115
+ });
1116
+
1117
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1118
+ function compileCssNative2(classes, prefix) {
1119
+ const native = getNativeBridge();
1120
+ if (!native?.compileCss) throw new Error("compileCss not available");
1121
+ return native.compileCss(classes, prefix);
1122
+ }
1123
+ function compileCssLightning(classes) {
1124
+ const native = getNativeBridge();
1125
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1126
+ return native.compileCssLightning(classes);
1127
+ }
1128
+ function extractTwStateConfigsNative(source, filename) {
1129
+ const native = getNativeBridge();
1130
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1131
+ return native.extractTwStateConfigs(source, filename);
1132
+ }
1133
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1134
+ const native = getNativeBridge();
1135
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1136
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1137
+ }
1138
+ function extractAndGenerateStateCssNative(source, filename) {
1139
+ const native = getNativeBridge();
1140
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1141
+ return native.extractAndGenerateStateCss(source, filename);
1142
+ }
1143
+ function layoutClassesToCss(classes) {
1144
+ const native = getNativeBridge();
1145
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1146
+ return native.layoutClassesToCss(classes);
1147
+ }
1148
+ function hashContent(input, algorithm = "sha256", length = 8) {
1149
+ const native = getNativeBridge();
1150
+ if (!native?.hashContent) throw new Error("hashContent not available");
1151
+ return native.hashContent(input, algorithm, length);
1152
+ }
1153
+ function extractTwContainerConfigs(source) {
1154
+ const native = getNativeBridge();
1155
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1156
+ return native.extractTwContainerConfigs(source);
1157
+ }
1158
+ function parseAtomicClass(twClass) {
1159
+ const native = getNativeBridge();
1160
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1161
+ return native.parseAtomicClass(twClass);
1162
+ }
1163
+ function generateAtomicCss(rulesJson) {
1164
+ const native = getNativeBridge();
1165
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1166
+ return native.generateAtomicCss(rulesJson);
1167
+ }
1168
+ function toAtomicClasses(twClasses) {
1169
+ const native = getNativeBridge();
1170
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1171
+ return native.toAtomicClasses(twClasses);
1172
+ }
1173
+ function clearAtomicRegistry() {
1174
+ const native = getNativeBridge();
1175
+ if (!native?.clearAtomicRegistry) return;
1176
+ native.clearAtomicRegistry();
1177
+ }
1178
+ function atomicRegistrySize() {
1179
+ const native = getNativeBridge();
1180
+ if (!native?.atomicRegistrySize) return 0;
1181
+ return native.atomicRegistrySize();
1182
+ }
1183
+ var init_compilationNative = __esm({
1184
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1185
+ init_nativeBridge();
1186
+ }
1187
+ });
1188
+
1189
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1190
+ function compileClass(input) {
1191
+ const native = getNativeBridge();
1192
+ if (!native?.compile_class) throw new Error("compile_class not available");
1193
+ const resultJson = native.compile_class(input);
1194
+ try {
1195
+ return JSON.parse(resultJson);
1196
+ } catch {
1197
+ return {
1198
+ selector: "",
1199
+ declarations: "",
1200
+ properties: [],
1201
+ specificity: 0
1202
+ };
1203
+ }
1204
+ }
1205
+ function compileClasses(inputs) {
1206
+ const native = getNativeBridge();
1207
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1208
+ const resultJson = native.compile_classes(inputs);
1209
+ try {
1210
+ return JSON.parse(resultJson);
1211
+ } catch {
1212
+ return {
1213
+ css: "",
1214
+ resolved_classes: [],
1215
+ unknown_classes: [],
1216
+ size_bytes: 0,
1217
+ duration_ms: 0
1218
+ };
1219
+ }
1220
+ }
1221
+ function compileToCss(input, minify) {
1222
+ const native = getNativeBridge();
1223
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1224
+ return native.compile_to_css(input, minify ?? false);
1225
+ }
1226
+ function compileToCssBatch(inputs, minify) {
1227
+ const native = getNativeBridge();
1228
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1229
+ return native.compile_to_css_batch(inputs, minify ?? false);
1230
+ }
1231
+ function minifyCss(css) {
1232
+ const native = getNativeBridge();
1233
+ if (!native?.minify_css) throw new Error("minify_css not available");
1234
+ return native.minify_css(css);
1235
+ }
1236
+ function compileAnimation(animationName, from, to) {
1237
+ const native = getNativeBridge();
1238
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1239
+ const resultJson = native.compile_animation(animationName, from, to);
1240
+ try {
1241
+ return JSON.parse(resultJson);
1242
+ } catch {
1243
+ return {
1244
+ animation_id: "",
1245
+ keyframes_css: "",
1246
+ animation_rule: "",
1247
+ duration_ms: 0
1248
+ };
1249
+ }
1250
+ }
1251
+ function compileKeyframes(name, stopsJson) {
1252
+ const native = getNativeBridge();
1253
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1254
+ const resultJson = native.compile_keyframes(name, stopsJson);
1255
+ try {
1256
+ return JSON.parse(resultJson);
1257
+ } catch {
1258
+ return {
1259
+ animation_id: "",
1260
+ keyframes_css: "",
1261
+ animation_rule: "",
1262
+ duration_ms: 0
1263
+ };
1264
+ }
1265
+ }
1266
+ function compileTheme(tokensJson, themeName, prefix) {
1267
+ const native = getNativeBridge();
1268
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1269
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1270
+ try {
1271
+ return JSON.parse(resultJson);
1272
+ } catch {
1273
+ return {
1274
+ selector: ":root",
1275
+ variables: [],
1276
+ variables_css: "",
1277
+ theme_name: themeName
1278
+ };
1279
+ }
1280
+ }
1281
+ function twMerge(classString) {
1282
+ const native = getNativeBridge();
1283
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1284
+ return native.tw_merge(classString);
1285
+ }
1286
+ function twMergeMany(classStrings) {
1287
+ const native = getNativeBridge();
1288
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1289
+ return native.tw_merge_many(classStrings);
1290
+ }
1291
+ function twMergeWithSeparator(classString, options) {
1292
+ const native = getNativeBridge();
1293
+ if (!native?.tw_merge_with_separator)
1294
+ throw new Error("tw_merge_with_separator not available");
1295
+ const opts = {
1296
+ separator: options.separator,
1297
+ debug: options.debug
1298
+ };
1299
+ return native.tw_merge_with_separator(classString, opts);
1300
+ }
1301
+ function twMergeManyWithSeparator(classStrings, options) {
1302
+ const native = getNativeBridge();
1303
+ if (!native?.tw_merge_many_with_separator)
1304
+ throw new Error("tw_merge_many_with_separator not available");
1305
+ const opts = {
1306
+ separator: options.separator,
1307
+ debug: options.debug
1308
+ };
1309
+ return native.tw_merge_many_with_separator(classStrings, opts);
1310
+ }
1311
+ function twMergeRaw(classLists) {
1312
+ const native = getNativeBridge();
1313
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1314
+ return native.tw_merge_raw(classLists);
1315
+ }
1316
+ var init_cssCompilationNative = __esm({
1317
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1318
+ init_nativeBridge();
1319
+ }
1320
+ });
1321
+
1322
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1323
+ function idRegistryCreate() {
1324
+ const native = getNativeBridge();
1325
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1326
+ return native.id_registry_create();
1327
+ }
1328
+ function idRegistryGenerate(handle, name) {
1329
+ const native = getNativeBridge();
1330
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1331
+ return native.id_registry_generate(handle, name);
1332
+ }
1333
+ function idRegistryLookup(handle, name) {
1334
+ const native = getNativeBridge();
1335
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1336
+ return native.id_registry_lookup(handle, name);
1337
+ }
1338
+ function idRegistryNext(handle) {
1339
+ const native = getNativeBridge();
1340
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1341
+ return native.id_registry_next(handle);
1342
+ }
1343
+ function idRegistryDestroy(handle) {
1344
+ const native = getNativeBridge();
1345
+ if (!native?.id_registry_destroy) return;
1346
+ native.id_registry_destroy(handle);
1347
+ }
1348
+ function idRegistryReset(handle) {
1349
+ const native = getNativeBridge();
1350
+ if (!native?.id_registry_reset) return;
1351
+ native.id_registry_reset(handle);
1352
+ }
1353
+ function idRegistrySnapshot(handle) {
1354
+ const native = getNativeBridge();
1355
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1356
+ const snapshotJson = native.id_registry_snapshot(handle);
1357
+ try {
1358
+ return JSON.parse(snapshotJson);
1359
+ } catch {
1360
+ return {
1361
+ handle,
1362
+ next_id: 0,
1363
+ entries: [],
1364
+ total_entries: 0
1365
+ };
1366
+ }
1367
+ }
1368
+ function idRegistryActiveCount() {
1369
+ const native = getNativeBridge();
1370
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1371
+ return native.id_registry_active_count();
1372
+ }
1373
+ function registerPropertyName(propertyName) {
1374
+ const native = getNativeBridge();
1375
+ if (!native?.register_property_name)
1376
+ throw new Error("register_property_name not available");
1377
+ return native.register_property_name(propertyName);
1378
+ }
1379
+ function registerValueName(valueName) {
1380
+ const native = getNativeBridge();
1381
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1382
+ return native.register_value_name(valueName);
1383
+ }
1384
+ function propertyIdToString(propertyId) {
1385
+ const native = getNativeBridge();
1386
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1387
+ return native.property_id_to_string(propertyId);
1388
+ }
1389
+ function valueIdToString(valueId) {
1390
+ const native = getNativeBridge();
1391
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1392
+ return native.value_id_to_string(valueId);
1393
+ }
1394
+ function reverseLookupProperty(propertyId) {
1395
+ const native = getNativeBridge();
1396
+ if (!native?.reverse_lookup_property)
1397
+ throw new Error("reverse_lookup_property not available");
1398
+ return native.reverse_lookup_property(propertyId);
1399
+ }
1400
+ function reverseLookupValue(valueId) {
1401
+ const native = getNativeBridge();
1402
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1403
+ return native.reverse_lookup_value(valueId);
1404
+ }
1405
+ function idRegistryExport(handle) {
1406
+ const native = getNativeBridge();
1407
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1408
+ return native.id_registry_export(handle);
1409
+ }
1410
+ function idRegistryImport(importedData) {
1411
+ const native = getNativeBridge();
1412
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1413
+ return native.id_registry_import(importedData);
1414
+ }
1415
+ var init_idRegistryNative = __esm({
1416
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1417
+ init_nativeBridge();
1418
+ }
1419
+ });
1420
+
1421
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1422
+ function processFileChange(fileChangeJson) {
1423
+ const native = getNativeBridge();
1424
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1425
+ const resultJson = native.process_file_change(fileChangeJson);
1426
+ try {
1427
+ return JSON.parse(resultJson);
1428
+ } catch {
1429
+ return {
1430
+ file_path: "",
1431
+ status: "error",
1432
+ old_classes: [],
1433
+ new_classes: [],
1434
+ added_classes: [],
1435
+ removed_classes: [],
1436
+ changed: false,
1437
+ fingerprint: "",
1438
+ error: "Failed to parse result"
1439
+ };
1440
+ }
1441
+ }
1442
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1443
+ const native = getNativeBridge();
1444
+ if (!native?.compute_incremental_diff)
1445
+ throw new Error("compute_incremental_diff not available");
1446
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1447
+ try {
1448
+ return JSON.parse(resultJson);
1449
+ } catch {
1450
+ return {
1451
+ is_changed: false,
1452
+ changes_count: 0,
1453
+ diff: {
1454
+ added_files: [],
1455
+ removed_files: [],
1456
+ modified_files: [],
1457
+ added_classes: [],
1458
+ removed_classes: [],
1459
+ total_changes: 0
1460
+ },
1461
+ processing_time_ms: 0
1462
+ };
1463
+ }
1464
+ }
1465
+ function createFingerprint(filePath, fileContent) {
1466
+ const native = getNativeBridge();
1467
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1468
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1469
+ try {
1470
+ return JSON.parse(fingerprintJson);
1471
+ } catch {
1472
+ return {
1473
+ file_path: filePath,
1474
+ content_hash: "",
1475
+ size_bytes: fileContent.length,
1476
+ mtime_ms: Date.now(),
1477
+ class_hash: "",
1478
+ signature: ""
1479
+ };
1480
+ }
1481
+ }
1482
+ function injectStateHash(css, stateHash) {
1483
+ const native = getNativeBridge();
1484
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1485
+ const resultJson = native.inject_state_hash(css, stateHash);
1486
+ try {
1487
+ return JSON.parse(resultJson);
1488
+ } catch {
1489
+ return {
1490
+ injected: false,
1491
+ state_hash: stateHash,
1492
+ affected_files: 0,
1493
+ total_injected_bytes: 0
1494
+ };
1495
+ }
1496
+ }
1497
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1498
+ const native = getNativeBridge();
1499
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1500
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1501
+ try {
1502
+ return JSON.parse(resultJson);
1503
+ } catch {
1504
+ return {
1505
+ entries_before: 0,
1506
+ entries_after: 0,
1507
+ entries_removed: 0,
1508
+ freed_bytes: 0
1509
+ };
1510
+ }
1511
+ }
1512
+ function rebuildWorkspaceResult(rootDir, extensions) {
1513
+ const native = getNativeBridge();
1514
+ if (!native?.rebuild_workspace_result)
1515
+ throw new Error("rebuild_workspace_result not available");
1516
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1517
+ try {
1518
+ return JSON.parse(resultJson);
1519
+ } catch {
1520
+ return {
1521
+ total_files_scanned: 0,
1522
+ total_classes_found: 0,
1523
+ unique_classes: 0,
1524
+ build_time_ms: 0,
1525
+ files_with_changes: 0
1526
+ };
1527
+ }
1528
+ }
1529
+ function scanFileNative(filePath, fileContent) {
1530
+ const native = getNativeBridge();
1531
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1532
+ const resultJson = native.scan_file_native(filePath, fileContent);
1533
+ try {
1534
+ return JSON.parse(resultJson);
1535
+ } catch {
1536
+ return {
1537
+ file: filePath,
1538
+ classes: [],
1539
+ added_classes: [],
1540
+ removed_classes: [],
1541
+ changed: false
1542
+ };
1543
+ }
1544
+ }
1545
+ function scanFilesBatchNative(filesJson) {
1546
+ const native = getNativeBridge();
1547
+ if (!native?.scan_files_batch_native)
1548
+ throw new Error("scan_files_batch_native not available");
1549
+ const resultJson = native.scan_files_batch_native(filesJson);
1550
+ try {
1551
+ return JSON.parse(resultJson);
1552
+ } catch {
1553
+ return [];
1554
+ }
1555
+ }
1556
+ var init_streamingNative = __esm({
1557
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1558
+ init_nativeBridge();
1559
+ }
1560
+ });
1561
+
1562
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1089
1563
  var tailwindEngine_exports = {};
1090
1564
  __export(tailwindEngine_exports, {
1091
1565
  clearCache: () => clearCache,
1092
- generateRawCss: () => generateRawCss,
1093
1566
  getCacheStats: () => getCacheStats,
1094
1567
  processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1095
1568
  runCssPipeline: () => runCssPipeline,
@@ -1123,48 +1596,6 @@ function clearCache() {
1123
1596
  _cacheHits = 0;
1124
1597
  _cacheMisses = 0;
1125
1598
  }
1126
- function loadTailwindEngine() {
1127
- if (_twEngine) return _twEngine;
1128
- if (_twEngineError) throw _twEngineError;
1129
- try {
1130
- const tw2 = require2("tailwindcss");
1131
- if (typeof tw2.compile !== "function") {
1132
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
1133
- }
1134
- _twEngine = tw2;
1135
- return _twEngine;
1136
- } catch (e) {
1137
- _twEngineError = e instanceof Error ? e : new Error(String(e));
1138
- throw _twEngineError;
1139
- }
1140
- }
1141
- async function generateRawCss(classes, cssEntryContent, root) {
1142
- if (classes.length === 0) return "";
1143
- const tw2 = loadTailwindEngine();
1144
- const input = cssEntryContent ?? "@import 'tailwindcss';";
1145
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1146
- const { dirname: dirname2, resolve: resolve2 } = await import('path');
1147
- const projectRoot = root ?? process.cwd();
1148
- const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
1149
- const loadStylesheet = async (id, base) => {
1150
- try {
1151
- 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;
1152
- const pkgPath = req.resolve(cssId);
1153
- return { content: readFileSync(pkgPath, "utf-8"), base: dirname2(pkgPath) };
1154
- } catch {
1155
- try {
1156
- const absPath = resolve2(base, id);
1157
- if (existsSync3(absPath)) {
1158
- return { content: readFileSync(absPath, "utf-8"), base: dirname2(absPath) };
1159
- }
1160
- } catch {
1161
- }
1162
- return { content: "", base };
1163
- }
1164
- };
1165
- const compiler = await Promise.resolve(tw2.compile(input, { loadStylesheet }));
1166
- return compiler.build(classes);
1167
- }
1168
1599
  function getThemeConfig() {
1169
1600
  return {
1170
1601
  colors: {
@@ -1261,20 +1692,9 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1261
1692
  _cacheMisses++;
1262
1693
  let rawCss;
1263
1694
  let usedRustCompiler = false;
1264
- try {
1265
- const theme = getThemeConfig();
1266
- rawCss = await generateCssNative(unique, {
1267
- theme,
1268
- fallbackToJs: true,
1269
- logFallback: process.env.DEBUG?.includes("compiler") === true
1270
- });
1271
- usedRustCompiler = true;
1272
- } catch (error) {
1273
- if (process.env.DEBUG?.includes("compiler")) {
1274
- console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
1275
- }
1276
- rawCss = await generateRawCss(unique, cssEntryContent, root);
1277
- }
1695
+ const theme = getThemeConfig();
1696
+ rawCss = await generateCssNative(unique, { theme });
1697
+ usedRustCompiler = true;
1278
1698
  const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1279
1699
  if (process.env.DEBUG?.includes("compiler")) {
1280
1700
  console.log(
@@ -1292,67 +1712,900 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1292
1712
  _cssCache.set(cacheKey, result);
1293
1713
  return result;
1294
1714
  }
1295
- function runCssPipelineSync(_classes) {
1296
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
1715
+ function runCssPipelineSync(_classes) {
1716
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1717
+ }
1718
+ function processTailwindCssWithTargets(css, targets) {
1719
+ const native = getNativeBridge();
1720
+ if (!native?.processTailwindCssWithTargets) {
1721
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1722
+ }
1723
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1724
+ if (!result?.css) {
1725
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1726
+ }
1727
+ return result.css;
1728
+ }
1729
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1730
+ var init_tailwindEngine = __esm({
1731
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1732
+ init_nativeBridge();
1733
+ init_cssGeneratorNative();
1734
+ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
1735
+ _cssCache = /* @__PURE__ */ new Map();
1736
+ _cacheHits = 0;
1737
+ _cacheMisses = 0;
1738
+ MAX_CACHE_SIZE = 100;
1739
+ }
1740
+ });
1741
+
1742
+ // packages/domain/compiler/src/compiler/index.ts
1743
+ var init_compiler = __esm({
1744
+ "packages/domain/compiler/src/compiler/index.ts"() {
1745
+ init_cssGeneratorNative();
1746
+ init_compilationNative();
1747
+ init_cssCompilationNative();
1748
+ init_idRegistryNative();
1749
+ init_streamingNative();
1750
+ }
1751
+ });
1752
+
1753
+ // packages/domain/compiler/src/parser/index.ts
1754
+ var parser_exports = {};
1755
+ __export(parser_exports, {
1756
+ astExtractClasses: () => astExtractClasses,
1757
+ batchExtractClasses: () => batchExtractClasses,
1758
+ checkAgainstSafelist: () => checkAgainstSafelist,
1759
+ diffClassLists: () => diffClassLists,
1760
+ extractAllClasses: () => extractAllClasses,
1761
+ extractClassesFromSource: () => extractClassesFromSource,
1762
+ extractComponentUsage: () => extractComponentUsage,
1763
+ mergeClassesStatic: () => mergeClassesStatic,
1764
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1765
+ normalizeClasses: () => normalizeClasses,
1766
+ parseClasses: () => parseClasses
1767
+ });
1768
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1769
+ var init_parser = __esm({
1770
+ "packages/domain/compiler/src/parser/index.ts"() {
1771
+ init_nativeBridge();
1772
+ parseClasses = (raw) => {
1773
+ const native = getNativeBridge();
1774
+ if (!native?.parseClasses) {
1775
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1776
+ }
1777
+ return native.parseClasses(raw) || [];
1778
+ };
1779
+ extractAllClasses = (source) => {
1780
+ const native = getNativeBridge();
1781
+ if (!native?.extractAllClasses) {
1782
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1783
+ }
1784
+ return native.extractAllClasses(source) || [];
1785
+ };
1786
+ extractClassesFromSource = (source) => {
1787
+ const native = getNativeBridge();
1788
+ if (!native?.extractClassesFromSource) {
1789
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1790
+ }
1791
+ const result = native.extractClassesFromSource(source);
1792
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1793
+ };
1794
+ astExtractClasses = (source, _filename) => {
1795
+ const native = getNativeBridge();
1796
+ if (!native?.extractClassesFromSource) {
1797
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1798
+ }
1799
+ return native.extractClassesFromSource(source) || [];
1800
+ };
1801
+ normalizeClasses = (raw) => {
1802
+ const result = normalizeAndDedupClasses(raw);
1803
+ return result?.normalized || "";
1804
+ };
1805
+ mergeClassesStatic = (classes) => {
1806
+ const result = normalizeAndDedupClasses(classes);
1807
+ return result?.normalized || "";
1808
+ };
1809
+ normalizeAndDedupClasses = (raw) => {
1810
+ const native = getNativeBridge();
1811
+ if (!native?.normalizeAndDedupClasses) {
1812
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1813
+ }
1814
+ const result = native.normalizeAndDedupClasses(raw);
1815
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1816
+ };
1817
+ extractComponentUsage = (source) => {
1818
+ const native = getNativeBridge();
1819
+ if (!native?.extractComponentUsage) {
1820
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1821
+ }
1822
+ return native.extractComponentUsage(source) || [];
1823
+ };
1824
+ batchExtractClasses = (filePaths) => {
1825
+ const native = getNativeBridge();
1826
+ if (!native?.batchExtractClasses) {
1827
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1828
+ }
1829
+ return native.batchExtractClasses(filePaths) || [];
1830
+ };
1831
+ checkAgainstSafelist = (classes, safelist) => {
1832
+ const native = getNativeBridge();
1833
+ if (!native?.checkAgainstSafelist) {
1834
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1835
+ }
1836
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1837
+ };
1838
+ diffClassLists = (previous, current) => {
1839
+ const native = getNativeBridge();
1840
+ if (!native?.diffClassLists) {
1841
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1842
+ }
1843
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1844
+ };
1845
+ }
1846
+ });
1847
+
1848
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1849
+ function detectDeadCode(scanResultJson, css) {
1850
+ const native = getNativeBridge();
1851
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1852
+ return native.detectDeadCode(scanResultJson, css);
1853
+ }
1854
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1855
+ const native = getNativeBridge();
1856
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1857
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1858
+ }
1859
+ function analyzeClassesNative(filesJson, cwd, flags) {
1860
+ const native = getNativeBridge();
1861
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1862
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1863
+ }
1864
+ function analyzeRscNative(source, filename) {
1865
+ const native = getNativeBridge();
1866
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1867
+ return native.analyzeRsc(source, filename);
1868
+ }
1869
+ function optimizeCssNative(css) {
1870
+ const native = getNativeBridge();
1871
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1872
+ const result = native.processTailwindCssLightning(css);
1873
+ return {
1874
+ css: result.css,
1875
+ originalSize: css.length,
1876
+ optimizedSize: result.size_bytes,
1877
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1878
+ };
1879
+ }
1880
+ function processTailwindCssLightning(css) {
1881
+ const native = getNativeBridge();
1882
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1883
+ return native.processTailwindCssLightning(css);
1884
+ }
1885
+ function eliminateDeadCssNative(css, deadClasses) {
1886
+ const native = getNativeBridge();
1887
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1888
+ return native.eliminateDeadCss(css, deadClasses);
1889
+ }
1890
+ function hoistComponentsNative(source) {
1891
+ const native = getNativeBridge();
1892
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1893
+ return native.hoistComponents(source);
1894
+ }
1895
+ function compileVariantTableNative(configJson) {
1896
+ const native = getNativeBridge();
1897
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1898
+ return native.compileVariantTable(configJson);
1899
+ }
1900
+ function classifyAndSortClassesNative(classes) {
1901
+ const native = getNativeBridge();
1902
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1903
+ return native.classifyAndSortClasses(classes);
1904
+ }
1905
+ function mergeCssDeclarationsNative(cssChunks) {
1906
+ const native = getNativeBridge();
1907
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1908
+ return native.mergeCssDeclarations(cssChunks);
1909
+ }
1910
+ var init_analyzerNative = __esm({
1911
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1912
+ init_nativeBridge();
1913
+ }
1914
+ });
1915
+
1916
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1917
+ function resolveVariants(configJson) {
1918
+ const native = getNativeBridge();
1919
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1920
+ const resultJson = native.resolve_variants(configJson);
1921
+ try {
1922
+ return JSON.parse(resultJson);
1923
+ } catch {
1924
+ return {
1925
+ variants: [],
1926
+ supported: [],
1927
+ deprecated: [],
1928
+ conflicting: []
1929
+ };
1930
+ }
1931
+ }
1932
+ function validateThemeConfig(configJson) {
1933
+ const native = getNativeBridge();
1934
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1935
+ const resultJson = native.validate_variant_config(configJson);
1936
+ try {
1937
+ return JSON.parse(resultJson);
1938
+ } catch {
1939
+ return {
1940
+ is_valid: false,
1941
+ errors: ["Unable to parse configuration"],
1942
+ warnings: [],
1943
+ suggestions: []
1944
+ };
1945
+ }
1946
+ }
1947
+ function resolveCascade(baseThemeJson, overridesJson) {
1948
+ const native = getNativeBridge();
1949
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1950
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1951
+ try {
1952
+ return JSON.parse(resultJson);
1953
+ } catch {
1954
+ return {
1955
+ base_theme: {},
1956
+ user_overrides: {},
1957
+ merged_theme: {},
1958
+ conflict_resolutions: []
1959
+ };
1960
+ }
1961
+ }
1962
+ function resolveClassNames(classNames, themeJson) {
1963
+ const native = getNativeBridge();
1964
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1965
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1966
+ try {
1967
+ return JSON.parse(resultJson);
1968
+ } catch {
1969
+ return [];
1970
+ }
1971
+ }
1972
+ function resolveConflictGroup(groupName, themeJson) {
1973
+ const native = getNativeBridge();
1974
+ if (!native?.resolve_conflict_group)
1975
+ throw new Error("resolve_conflict_group not available");
1976
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1977
+ try {
1978
+ return JSON.parse(resultJson);
1979
+ } catch {
1980
+ return {
1981
+ group_name: groupName,
1982
+ conflicting_classes: [],
1983
+ description: "",
1984
+ resolution_strategy: "last-wins"
1985
+ };
1986
+ }
1987
+ }
1988
+ function resolveThemeValue(keyPath, themeJson) {
1989
+ const native = getNativeBridge();
1990
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1991
+ return native.resolve_theme_value(keyPath, themeJson);
1992
+ }
1993
+ function resolveSimpleVariants(configJson) {
1994
+ const native = getNativeBridge();
1995
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1996
+ const resultJson = native.resolve_simple_variants(configJson);
1997
+ try {
1998
+ return JSON.parse(resultJson);
1999
+ } catch {
2000
+ return [];
2001
+ }
2002
+ }
2003
+ var init_themeResolutionNative = __esm({
2004
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2005
+ init_nativeBridge();
2006
+ }
2007
+ });
2008
+
2009
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
2010
+ function scanWorkspace(root, extensions) {
2011
+ const native = getNativeBridge();
2012
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
2013
+ return native.scan_workspace(root, extensions);
2014
+ }
2015
+ function extractClassesFromSourceNative(source) {
2016
+ const native = getNativeBridge();
2017
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
2018
+ return native.extract_classes_from_source(source);
2019
+ }
2020
+ function batchExtractClassesNative(filePaths) {
2021
+ const native = getNativeBridge();
2022
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
2023
+ return native.batch_extract_classes(filePaths);
2024
+ }
2025
+ function checkAgainstSafelistNative(classes, safelist) {
2026
+ const native = getNativeBridge();
2027
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
2028
+ return native.check_against_safelist(classes, safelist);
2029
+ }
2030
+ function scanFile(filePath) {
2031
+ const native = getNativeBridge();
2032
+ if (!native?.scan_file) throw new Error("scan_file not available");
2033
+ return native.scan_file(filePath);
2034
+ }
2035
+ function collectFiles(root, extensions) {
2036
+ const native = getNativeBridge();
2037
+ if (!native?.collect_files) throw new Error("collect_files not available");
2038
+ return native.collect_files(root, extensions);
2039
+ }
2040
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
2041
+ const native = getNativeBridge();
2042
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
2043
+ return native.walk_and_prefilter_source_files(root, extensions);
2044
+ }
2045
+ function generateSubComponentTypes(root, outputPath) {
2046
+ const native = getNativeBridge();
2047
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
2048
+ return native.generate_sub_component_types(root, outputPath);
2049
+ }
2050
+ var init_scannerNative = __esm({
2051
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2052
+ init_nativeBridge();
2053
+ }
2054
+ });
2055
+
2056
+ // packages/domain/compiler/src/analyzer/index.ts
2057
+ var init_analyzer = __esm({
2058
+ "packages/domain/compiler/src/analyzer/index.ts"() {
2059
+ init_analyzerNative();
2060
+ init_themeResolutionNative();
2061
+ init_scannerNative();
2062
+ }
2063
+ });
2064
+
2065
+ // packages/domain/compiler/src/cache/cacheNative.ts
2066
+ function getCacheStatistics() {
2067
+ const native = getNativeBridge();
2068
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
2069
+ const statsJson = native.get_cache_statistics();
2070
+ try {
2071
+ return JSON.parse(statsJson);
2072
+ } catch {
2073
+ return {
2074
+ parse_cache: { hits: 0, misses: 0, size: 0 },
2075
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2076
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2077
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2078
+ overall_hit_rate: 0,
2079
+ total_memory_bytes: 0
2080
+ };
2081
+ }
2082
+ }
2083
+ function clearAllCaches() {
2084
+ const native = getNativeBridge();
2085
+ if (!native?.clear_all_caches) return;
2086
+ try {
2087
+ native.clear_all_caches();
2088
+ } catch {
2089
+ }
2090
+ }
2091
+ function clearParseCache() {
2092
+ const native = getNativeBridge();
2093
+ if (!native?.clear_parse_cache) return;
2094
+ try {
2095
+ native.clear_parse_cache();
2096
+ } catch {
2097
+ }
2098
+ }
2099
+ function clearResolveCache() {
2100
+ const native = getNativeBridge();
2101
+ if (!native?.clear_resolve_cache) return;
2102
+ try {
2103
+ native.clear_resolve_cache();
2104
+ } catch {
2105
+ }
2106
+ }
2107
+ function clearCompileCache() {
2108
+ const native = getNativeBridge();
2109
+ if (!native?.clear_compile_cache) return;
2110
+ try {
2111
+ native.clear_compile_cache();
2112
+ } catch {
2113
+ }
2114
+ }
2115
+ function clearCssGenCache() {
2116
+ const native = getNativeBridge();
2117
+ if (!native?.clear_css_gen_cache) return;
2118
+ try {
2119
+ native.clear_css_gen_cache();
2120
+ } catch {
2121
+ }
2122
+ }
2123
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2124
+ const native = getNativeBridge();
2125
+ if (!native?.get_cache_optimization_hints)
2126
+ throw new Error("get_cache_optimization_hints not available");
2127
+ const hintsJson = native.get_cache_optimization_hints(
2128
+ Math.min(100, Math.max(0, hitRatePercent)),
2129
+ Math.max(1, memoryUsedMb)
2130
+ );
2131
+ try {
2132
+ return JSON.parse(hintsJson);
2133
+ } catch {
2134
+ return {
2135
+ current_strategy: "unknown",
2136
+ recommended_strategy: "increase_size",
2137
+ estimated_improvement_percent: 0,
2138
+ suggested_memory_mb: 256,
2139
+ notes: ["Unable to analyze cache statistics"]
2140
+ };
2141
+ }
2142
+ }
2143
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2144
+ const native = getNativeBridge();
2145
+ if (!native?.estimate_optimal_cache_config_native)
2146
+ throw new Error("estimate_optimal_cache_config_native not available");
2147
+ const configJson = native.estimate_optimal_cache_config_native(
2148
+ Math.max(64, totalBudgetMb),
2149
+ workloadType
2150
+ );
2151
+ try {
2152
+ return JSON.parse(configJson);
2153
+ } catch {
2154
+ return {
2155
+ parse_cache_size: 128,
2156
+ resolve_cache_size: 64,
2157
+ compile_cache_size: 256,
2158
+ css_gen_cache_size: 128,
2159
+ recommended_eviction_policy: "lru",
2160
+ ttl_seconds: 3600,
2161
+ expected_hit_rate_percent: 75
2162
+ };
2163
+ }
2164
+ }
2165
+ function cacheRead(cachePath) {
2166
+ const native = getNativeBridge();
2167
+ if (!native?.cache_read) throw new Error("cache_read not available");
2168
+ const result = native.cache_read(cachePath);
2169
+ try {
2170
+ return JSON.parse(result.entries_json || "[]");
2171
+ } catch {
2172
+ return [];
2173
+ }
2174
+ }
2175
+ function cacheWrite(cachePath, entries) {
2176
+ const native = getNativeBridge();
2177
+ if (!native?.cache_write) throw new Error("cache_write not available");
2178
+ try {
2179
+ const result = native.cache_write(
2180
+ cachePath,
2181
+ entries.map((e) => ({
2182
+ file: e.file,
2183
+ content_hash: e.contentHash,
2184
+ classes: e.classes,
2185
+ mtime_ms: e.mtimeMs,
2186
+ size_bytes: e.sizeBytes
2187
+ }))
2188
+ );
2189
+ return typeof result === "boolean" ? result : result === true;
2190
+ } catch {
2191
+ return false;
2192
+ }
2193
+ }
2194
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2195
+ const native = getNativeBridge();
2196
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2197
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2198
+ }
2199
+ var init_cacheNative = __esm({
2200
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2201
+ init_nativeBridge();
2202
+ }
2203
+ });
2204
+
2205
+ // packages/domain/compiler/src/cache/index.ts
2206
+ var init_cache = __esm({
2207
+ "packages/domain/compiler/src/cache/index.ts"() {
2208
+ init_cacheNative();
2209
+ }
2210
+ });
2211
+
2212
+ // packages/domain/compiler/src/redis/redisNative.ts
2213
+ function redisPing() {
2214
+ const native = getNativeBridge();
2215
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2216
+ return native.redis_ping();
2217
+ }
2218
+ function redisGet(key) {
2219
+ const native = getNativeBridge();
2220
+ if (!native?.redis_get) throw new Error("redis_get not available");
2221
+ const result = native.redis_get(key);
2222
+ return result === "nil" ? null : result;
2223
+ }
2224
+ function redisSet(key, value, ttl_seconds) {
2225
+ const native = getNativeBridge();
2226
+ if (!native?.redis_set) throw new Error("redis_set not available");
2227
+ return native.redis_set(key, value, ttl_seconds);
2228
+ }
2229
+ function redisDelete(key) {
2230
+ const native = getNativeBridge();
2231
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2232
+ return native.redis_delete(key);
2233
+ }
2234
+ function redisExists(key) {
2235
+ const native = getNativeBridge();
2236
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2237
+ return native.redis_exists(key);
2238
+ }
2239
+ function redisMget(keys) {
2240
+ const native = getNativeBridge();
2241
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2242
+ const result = native.redis_mget(keys);
2243
+ try {
2244
+ return JSON.parse(result);
2245
+ } catch {
2246
+ return keys.map(() => null);
2247
+ }
2248
+ }
2249
+ function redisMset(pairs) {
2250
+ const native = getNativeBridge();
2251
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2252
+ return native.redis_mset(pairs);
2253
+ }
2254
+ function redisFlushDb() {
2255
+ const native = getNativeBridge();
2256
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2257
+ return native.redis_flush_db();
2258
+ }
2259
+ function redisFlushAll() {
2260
+ const native = getNativeBridge();
2261
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2262
+ return native.redis_flush_all();
2263
+ }
2264
+ function redisPoolConnect(host, port, pool_size) {
2265
+ const native = getNativeBridge();
2266
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2267
+ return native.redis_pool_connect(host, port, pool_size);
2268
+ }
2269
+ function redisPoolStats() {
2270
+ const native = getNativeBridge();
2271
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2272
+ const result = native.redis_pool_stats();
2273
+ try {
2274
+ return JSON.parse(result);
2275
+ } catch {
2276
+ return {
2277
+ connected_count: 0,
2278
+ idle_count: 0,
2279
+ waiting_count: 0,
2280
+ total_requests: 0,
2281
+ total_errors: 0
2282
+ };
2283
+ }
2284
+ }
2285
+ function redisPoolReconnect() {
2286
+ const native = getNativeBridge();
2287
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2288
+ return native.redis_pool_reconnect();
2289
+ }
2290
+ function redisEnableCluster(initial_nodes) {
2291
+ const native = getNativeBridge();
2292
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2293
+ const result = native.redis_enable_cluster(initial_nodes);
2294
+ try {
2295
+ return JSON.parse(result);
2296
+ } catch {
2297
+ return {
2298
+ enabled: false,
2299
+ cluster_state: "error",
2300
+ nodes: [],
2301
+ slots_assigned: 0,
2302
+ slots_ok: 0,
2303
+ slots_fail: 0
2304
+ };
2305
+ }
2306
+ }
2307
+ function redisDisableCluster() {
2308
+ const native = getNativeBridge();
2309
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2310
+ return native.redis_disable_cluster();
2311
+ }
2312
+ function redisClusterStatus() {
2313
+ const native = getNativeBridge();
2314
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2315
+ const result = native.redis_cluster_status();
2316
+ try {
2317
+ return JSON.parse(result);
2318
+ } catch {
2319
+ return {
2320
+ enabled: false,
2321
+ cluster_state: "unknown",
2322
+ nodes: [],
2323
+ slots_assigned: 0,
2324
+ slots_ok: 0,
2325
+ slots_fail: 0
2326
+ };
2327
+ }
2328
+ }
2329
+ function redisSubscribe(channel) {
2330
+ const native = getNativeBridge();
2331
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2332
+ return native.redis_subscribe(channel);
2333
+ }
2334
+ function redisPublish(channel, message) {
2335
+ const native = getNativeBridge();
2336
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2337
+ return native.redis_publish(channel, message);
2338
+ }
2339
+ function redisExpirationSet(key, ttl_seconds) {
2340
+ const native = getNativeBridge();
2341
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2342
+ return native.redis_expiration_set(key, ttl_seconds);
2343
+ }
2344
+ function redisExpirationGet(key) {
2345
+ const native = getNativeBridge();
2346
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2347
+ const result = native.redis_expiration_get(key);
2348
+ try {
2349
+ return JSON.parse(result);
2350
+ } catch {
2351
+ return {
2352
+ key,
2353
+ ttl_seconds: -1,
2354
+ expiration_timestamp: 0,
2355
+ is_persistent: true
2356
+ };
2357
+ }
2358
+ }
2359
+ function redisInfo() {
2360
+ const native = getNativeBridge();
2361
+ if (!native?.redis_info) throw new Error("redis_info not available");
2362
+ return native.redis_info();
2363
+ }
2364
+ function redisMonitor() {
2365
+ const native = getNativeBridge();
2366
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2367
+ return native.redis_monitor();
2368
+ }
2369
+ function redisCacheSize() {
2370
+ const native = getNativeBridge();
2371
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2372
+ return native.redis_cache_size();
2373
+ }
2374
+ function redisCacheKeyCount() {
2375
+ const native = getNativeBridge();
2376
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2377
+ return native.redis_cache_key_count();
2378
+ }
2379
+ function redisCacheClear() {
2380
+ const native = getNativeBridge();
2381
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2382
+ return native.redis_cache_clear();
2383
+ }
2384
+ function redisCacheHitRate() {
2385
+ const native = getNativeBridge();
2386
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2387
+ return native.redis_cache_hit_rate();
2388
+ }
2389
+ function redisEnablePersistence(mode) {
2390
+ const native = getNativeBridge();
2391
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2392
+ return native.redis_enable_persistence(mode);
2393
+ }
2394
+ function redisDisablePersistence() {
2395
+ const native = getNativeBridge();
2396
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2397
+ return native.redis_disable_persistence();
2398
+ }
2399
+ function redisSnapshot() {
2400
+ const native = getNativeBridge();
2401
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2402
+ return native.redis_snapshot();
2403
+ }
2404
+ function redisMemoryStats() {
2405
+ const native = getNativeBridge();
2406
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2407
+ return native.redis_memory_stats();
2408
+ }
2409
+ function redisOptimizeMemory() {
2410
+ const native = getNativeBridge();
2411
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2412
+ return native.redis_optimize_memory();
2413
+ }
2414
+ function redisSetEvictionPolicy(policy) {
2415
+ const native = getNativeBridge();
2416
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2417
+ return native.redis_set_eviction_policy(policy);
2418
+ }
2419
+ function redisGetEvictionPolicy() {
2420
+ const native = getNativeBridge();
2421
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2422
+ return native.redis_get_eviction_policy();
2423
+ }
2424
+ function redisReplicate(target_host, target_port) {
2425
+ const native = getNativeBridge();
2426
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2427
+ return native.redis_replicate(target_host, target_port);
2428
+ }
2429
+ function redisReplicationStatus() {
2430
+ const native = getNativeBridge();
2431
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2432
+ return native.redis_replication_status();
2433
+ }
2434
+ function redisCacheSync(peers) {
2435
+ const native = getNativeBridge();
2436
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2437
+ return native.redis_cache_sync(peers);
2438
+ }
2439
+ function redisEnableCacheWarming(key_pattern) {
2440
+ const native = getNativeBridge();
2441
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2442
+ return native.redis_enable_cache_warming(key_pattern);
2443
+ }
2444
+ function redisDisableCacheWarming() {
2445
+ const native = getNativeBridge();
2446
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2447
+ return native.redis_disable_cache_warming();
2448
+ }
2449
+ function redisDiagnose() {
2450
+ const native = getNativeBridge();
2451
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2452
+ return native.redis_diagnose();
2453
+ }
2454
+ var init_redisNative = __esm({
2455
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2456
+ init_nativeBridge();
2457
+ }
2458
+ });
2459
+
2460
+ // packages/domain/compiler/src/redis/index.ts
2461
+ var init_redis = __esm({
2462
+ "packages/domain/compiler/src/redis/index.ts"() {
2463
+ init_redisNative();
2464
+ }
2465
+ });
2466
+
2467
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2468
+ function startWatch(root_path, patterns) {
2469
+ const native = getNativeBridge();
2470
+ if (!native?.start_watch) throw new Error("start_watch not available");
2471
+ return native.start_watch(root_path, patterns);
2472
+ }
2473
+ function pollWatchEvents(handle, timeout_ms) {
2474
+ const native = getNativeBridge();
2475
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2476
+ const result = native.poll_watch_events(handle, timeout_ms);
2477
+ try {
2478
+ return JSON.parse(result);
2479
+ } catch {
2480
+ return [];
2481
+ }
2482
+ }
2483
+ function stopWatch(handle) {
2484
+ const native = getNativeBridge();
2485
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2486
+ return native.stop_watch(handle);
2487
+ }
2488
+ function watchAddPattern(handle, pattern) {
2489
+ const native = getNativeBridge();
2490
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2491
+ return native.watch_add_pattern(handle, pattern);
2492
+ }
2493
+ function watchRemovePattern(handle, pattern) {
2494
+ const native = getNativeBridge();
2495
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2496
+ return native.watch_remove_pattern(handle, pattern);
2497
+ }
2498
+ function watchGetActiveHandles() {
2499
+ const native = getNativeBridge();
2500
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2501
+ const result = native.watch_get_active_handles();
2502
+ try {
2503
+ return JSON.parse(result);
2504
+ } catch {
2505
+ return [];
2506
+ }
2507
+ }
2508
+ function watchClearAll() {
2509
+ const native = getNativeBridge();
2510
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2511
+ return native.watch_clear_all();
2512
+ }
2513
+ function watchEventTypeToString(event_type_code) {
2514
+ const native = getNativeBridge();
2515
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2516
+ return native.watch_event_type_to_string(event_type_code);
2517
+ }
2518
+ function isWatchRunning(handle) {
2519
+ const native = getNativeBridge();
2520
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2521
+ return native.is_watch_running(handle);
2522
+ }
2523
+ function getWatchStats() {
2524
+ const native = getNativeBridge();
2525
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2526
+ const result = native.get_watch_stats();
2527
+ try {
2528
+ return JSON.parse(result);
2529
+ } catch {
2530
+ return {
2531
+ active_watchers: 0,
2532
+ total_events: 0,
2533
+ events_this_second: 0,
2534
+ average_latency_ms: 0,
2535
+ largest_batch_size: 0
2536
+ };
2537
+ }
2538
+ }
2539
+ function watchPause(handle) {
2540
+ const native = getNativeBridge();
2541
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2542
+ return native.watch_pause(handle);
2543
+ }
2544
+ function watchResume(handle) {
2545
+ const native = getNativeBridge();
2546
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2547
+ return native.watch_resume(handle);
1297
2548
  }
1298
- function processTailwindCssWithTargets(css, targets) {
2549
+ function scanCacheOptimizations() {
1299
2550
  const native = getNativeBridge();
1300
- if (!native?.processTailwindCssWithTargets) {
1301
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1302
- }
1303
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
1304
- if (!result?.css) {
1305
- throw new Error("FATAL: processTailwindCssWithTargets returned null");
2551
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2552
+ return native.scan_cache_optimizations();
2553
+ }
2554
+ function getPluginHooks() {
2555
+ const native = getNativeBridge();
2556
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2557
+ const result = native.get_plugin_hooks();
2558
+ try {
2559
+ return JSON.parse(result);
2560
+ } catch {
2561
+ return [];
1306
2562
  }
1307
- return result.css;
1308
2563
  }
1309
- var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
1310
- var init_tailwindEngine = __esm({
1311
- "packages/domain/compiler/src/tailwindEngine.ts"() {
2564
+ function registerPluginHook(hook_name, handler_id) {
2565
+ const native = getNativeBridge();
2566
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2567
+ return native.register_plugin_hook(hook_name, handler_id);
2568
+ }
2569
+ function unregisterPluginHook(hook_name, handler_id) {
2570
+ const native = getNativeBridge();
2571
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2572
+ return native.unregister_plugin_hook(hook_name, handler_id);
2573
+ }
2574
+ function emitPluginHook(hook_name, data_json) {
2575
+ const native = getNativeBridge();
2576
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2577
+ return native.emit_plugin_hook(hook_name, data_json);
2578
+ }
2579
+ function getCompilationMetrics() {
2580
+ const native = getNativeBridge();
2581
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2582
+ return native.get_compilation_metrics();
2583
+ }
2584
+ function resetCompilationMetrics() {
2585
+ const native = getNativeBridge();
2586
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2587
+ return native.reset_compilation_metrics();
2588
+ }
2589
+ function validateCssOutput(css) {
2590
+ const native = getNativeBridge();
2591
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2592
+ return native.validate_css_output(css);
2593
+ }
2594
+ function getCompilerDiagnostics() {
2595
+ const native = getNativeBridge();
2596
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2597
+ return native.get_compiler_diagnostics();
2598
+ }
2599
+ var init_watchSystemNative = __esm({
2600
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
1312
2601
  init_nativeBridge();
1313
- init_cssGeneratorNative();
1314
- require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
1315
- _cssCache = /* @__PURE__ */ new Map();
1316
- _cacheHits = 0;
1317
- _cacheMisses = 0;
1318
- MAX_CACHE_SIZE = 100;
1319
- _twEngine = null;
1320
- _twEngineError = null;
1321
2602
  }
1322
2603
  });
1323
2604
 
1324
- // packages/domain/compiler/src/cssGeneratorNative.ts
1325
- async function generateCssNative(classes, options) {
1326
- const {
1327
- theme,
1328
- fallbackToJs = true,
1329
- logFallback = false
1330
- } = options;
1331
- try {
1332
- const native = getNativeBridge();
1333
- if (!native?.generateCssNative) {
1334
- throw new Error("generateCssNative not available in native binding");
1335
- }
1336
- const themeJson = JSON.stringify(theme);
1337
- const css = native.generateCssNative(classes, themeJson);
1338
- return css;
1339
- } catch (error) {
1340
- if (!fallbackToJs) {
1341
- throw error;
1342
- }
1343
- if (logFallback) {
1344
- console.warn(
1345
- "[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
1346
- error instanceof Error ? error.message : String(error)
1347
- );
1348
- }
1349
- return generateRawCss(classes);
1350
- }
1351
- }
1352
- var init_cssGeneratorNative = __esm({
1353
- "packages/domain/compiler/src/cssGeneratorNative.ts"() {
1354
- init_nativeBridge();
1355
- init_tailwindEngine();
2605
+ // packages/domain/compiler/src/watch/index.ts
2606
+ var init_watch = __esm({
2607
+ "packages/domain/compiler/src/watch/index.ts"() {
2608
+ init_watchSystemNative();
1356
2609
  }
1357
2610
  });
1358
2611
  function _layoutClassesToCss(classes) {
@@ -1389,10 +2642,16 @@ function extractContainerCssFromSource(source) {
1389
2642
  }
1390
2643
  return rules.join("\n");
1391
2644
  }
1392
- 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;
2645
+ 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;
1393
2646
  var init_src = __esm({
1394
2647
  "packages/domain/compiler/src/index.ts"() {
1395
2648
  init_nativeBridge();
2649
+ init_compiler();
2650
+ init_parser();
2651
+ init_analyzer();
2652
+ init_cache();
2653
+ init_redis();
2654
+ init_watch();
1396
2655
  transformSource = (source, opts) => {
1397
2656
  const native = getNativeBridge();
1398
2657
  if (!native?.transformSource) {
@@ -1436,58 +2695,19 @@ var init_src = __esm({
1436
2695
  const result = compileCssFromClasses(classes);
1437
2696
  return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
1438
2697
  };
1439
- compileCssNative = (classes, prefix = null) => {
1440
- return compileCssFromClasses(classes, prefix);
1441
- };
1442
2698
  generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
1443
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1444
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1445
- return result.css;
1446
- };
1447
- extractAllClasses = (source) => {
1448
- const native = getNativeBridge();
1449
- if (!native?.extractAllClasses) {
1450
- throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1451
- }
1452
- return native.extractAllClasses(source) || [];
1453
- };
1454
- extractClassesFromSource = (source) => {
1455
- const native = getNativeBridge();
1456
- if (!native?.extractClassesFromSource) {
1457
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1458
- }
1459
- const result = native.extractClassesFromSource(source);
1460
- return Array.isArray(result) ? result.join(" ") : String(result || "");
1461
- };
1462
- astExtractClasses = (source, _filename) => {
1463
- const native = getNativeBridge();
1464
- if (!native?.extractClassesFromSource) {
1465
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1466
- }
1467
- return native.extractClassesFromSource(source) || [];
1468
- };
1469
- parseClasses = (raw) => {
1470
- const native = getNativeBridge();
1471
- if (!native?.parseClasses) {
1472
- throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1473
- }
1474
- return native.parseClasses(raw) || [];
1475
- };
1476
- normalizeClasses = (raw) => {
1477
- const result = normalizeAndDedupClasses(raw);
1478
- return result?.normalized || "";
1479
- };
1480
- mergeClassesStatic = (classes) => {
1481
- const result = normalizeAndDedupClasses(classes);
1482
- return result?.normalized || "";
1483
- };
1484
- normalizeAndDedupClasses = (raw) => {
1485
- const native = getNativeBridge();
1486
- if (!native?.normalizeAndDedupClasses) {
1487
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
2699
+ try {
2700
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2701
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2702
+ return result.css;
2703
+ } catch {
2704
+ const native = getNativeBridge();
2705
+ if (!native?.transformSource) {
2706
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2707
+ }
2708
+ const result = native.transformSource(classes.join(" "), {});
2709
+ return result?.code || "";
1488
2710
  }
1489
- const result = native.normalizeAndDedupClasses(raw);
1490
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1491
2711
  };
1492
2712
  eliminateDeadCss = (css, deadClasses) => {
1493
2713
  const native = getNativeBridge();
@@ -1520,16 +2740,10 @@ var init_src = __esm({
1520
2740
  const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
1521
2741
  return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
1522
2742
  };
1523
- optimizeCss = (css) => {
1524
- const native = getNativeBridge();
1525
- if (!native?.optimizeCss) {
1526
- throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
1527
- }
1528
- return native.optimizeCss(css);
1529
- };
1530
2743
  scanProjectUsage = (dirs, cwd) => {
2744
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
1531
2745
  const files = dirs.map((dir) => path9__namespace.default.resolve(cwd, dir));
1532
- const results = batchExtractClasses(files) || [];
2746
+ const results = batchExtractClasses2(files) || [];
1533
2747
  const combined = {};
1534
2748
  for (const result of results) {
1535
2749
  if (result.ok && result.classes) {
@@ -1541,109 +2755,6 @@ var init_src = __esm({
1541
2755
  }
1542
2756
  return combined;
1543
2757
  };
1544
- extractComponentUsage = (source) => {
1545
- const native = getNativeBridge();
1546
- if (!native?.extractComponentUsage) {
1547
- throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1548
- }
1549
- return native.extractComponentUsage(source) || [];
1550
- };
1551
- diffClassLists = (previous, current) => {
1552
- const native = getNativeBridge();
1553
- if (!native?.diffClassLists) {
1554
- throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1555
- }
1556
- return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1557
- };
1558
- batchExtractClasses = (filePaths) => {
1559
- const native = getNativeBridge();
1560
- if (!native?.batchExtractClasses) {
1561
- throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1562
- }
1563
- return native.batchExtractClasses(filePaths) || [];
1564
- };
1565
- checkAgainstSafelist = (classes, safelist) => {
1566
- const native = getNativeBridge();
1567
- if (!native?.checkAgainstSafelist) {
1568
- throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1569
- }
1570
- return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1571
- };
1572
- hoistComponents = (source) => {
1573
- const native = getNativeBridge();
1574
- if (!native?.hoistComponents) {
1575
- throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
1576
- }
1577
- return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
1578
- };
1579
- compileVariantTable = (configJson) => {
1580
- const native = getNativeBridge();
1581
- if (!native?.compileVariantTable) {
1582
- throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
1583
- }
1584
- return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
1585
- };
1586
- compileVariants = (componentId, config) => {
1587
- return compileVariantTable(JSON.stringify({ componentId, ...config }));
1588
- };
1589
- classifyAndSortClasses = (classes) => {
1590
- const native = getNativeBridge();
1591
- if (!native?.classifyAndSortClasses) {
1592
- throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
1593
- }
1594
- return native.classifyAndSortClasses(classes) || [];
1595
- };
1596
- mergeCssDeclarations = (cssChunks) => {
1597
- const native = getNativeBridge();
1598
- if (!native?.mergeCssDeclarations) {
1599
- throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
1600
- }
1601
- return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
1602
- };
1603
- analyzeClassUsage = (classes, scanResultJson, css) => {
1604
- const native = getNativeBridge();
1605
- if (!native?.analyzeClassUsage) {
1606
- throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
1607
- }
1608
- return native.analyzeClassUsage(classes, scanResultJson, css) || [];
1609
- };
1610
- analyzeRsc = (source, filename) => {
1611
- const native = getNativeBridge();
1612
- if (!native?.analyzeRsc) {
1613
- throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
1614
- }
1615
- return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
1616
- };
1617
- analyzeFile = (source, filename) => {
1618
- const rsc = analyzeRsc(source, filename);
1619
- return {
1620
- isServer: rsc?.isServer ?? true,
1621
- needsClientDirective: rsc?.needsClientDirective ?? false,
1622
- clientReasons: rsc?.clientReasons ?? [],
1623
- interactiveClasses: [],
1624
- canStaticResolveVariants: true
1625
- };
1626
- };
1627
- analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
1628
- return { resolved: {}, dynamic: [] };
1629
- };
1630
- injectClientDirective = (source) => {
1631
- if (!source.includes('"use client"') && !source.includes("'use client'")) {
1632
- return '"use client";\n' + source;
1633
- }
1634
- return source;
1635
- };
1636
- injectServerOnlyComment = (source) => {
1637
- return `/* @server-only */
1638
- ${source}`;
1639
- };
1640
- analyzeClasses = (filesJson, cwd, flags) => {
1641
- const native = getNativeBridge();
1642
- if (!native?.analyzeClasses) {
1643
- throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
1644
- }
1645
- return native.analyzeClasses(filesJson, cwd, flags);
1646
- };
1647
2758
  generateSafelist = (scanDirs, outputPath, cwd) => {
1648
2759
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
1649
2760
  const allClasses = Object.keys(classes).sort();
@@ -1707,7 +2818,8 @@ ${source}`;
1707
2818
  if (containerCss) cssChunks.push(containerCss);
1708
2819
  const combined = cssChunks.join("\n").trim();
1709
2820
  if (combined) staticCss = combined;
1710
- } catch {
2821
+ } catch (err) {
2822
+ console.debug("Static CSS extraction warning:", err);
1711
2823
  }
1712
2824
  return {
1713
2825
  code: result?.code || "",
@@ -1792,7 +2904,46 @@ ${source}`;
1792
2904
  return [];
1793
2905
  };
1794
2906
  bucketSort = (classes) => {
1795
- return classifyAndSortClasses(classes).map((c) => c.raw ?? c);
2907
+ const native = getNativeBridge();
2908
+ if (!native?.classifyAndSortClasses) {
2909
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2910
+ }
2911
+ const sorted = native.classifyAndSortClasses(classes);
2912
+ return sorted.map((c) => c.raw ?? c);
2913
+ };
2914
+ analyzeFile = (source, filename) => {
2915
+ const native = getNativeBridge();
2916
+ if (!native?.analyzeRsc) {
2917
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2918
+ }
2919
+ const rsc = native.analyzeRsc(source, filename);
2920
+ return {
2921
+ isServer: rsc?.isServer ?? true,
2922
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2923
+ clientReasons: rsc?.clientReasons ?? [],
2924
+ interactiveClasses: [],
2925
+ canStaticResolveVariants: true
2926
+ };
2927
+ };
2928
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2929
+ return { resolved: {}, dynamic: [] };
2930
+ };
2931
+ injectClientDirective = (source) => {
2932
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2933
+ return '"use client";\n' + source;
2934
+ }
2935
+ return source;
2936
+ };
2937
+ injectServerOnlyComment = (source) => {
2938
+ return `/* @server-only */
2939
+ ${source}`;
2940
+ };
2941
+ analyzeClasses = (filesJson, cwd, flags) => {
2942
+ const native = getNativeBridge();
2943
+ if (!native?.analyzeClasses) {
2944
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2945
+ }
2946
+ return native.analyzeClasses(filesJson, cwd, flags);
1796
2947
  };
1797
2948
  extractTwStateConfigs = (source, filename) => {
1798
2949
  const native = getNativeBridge();
@@ -1801,23 +2952,25 @@ ${source}`;
1801
2952
  }
1802
2953
  return native.extractTwStateConfigs(source, filename);
1803
2954
  };
1804
- generateStaticStateCss = (inputs, resolvedCss = null) => {
1805
- const native = getNativeBridge();
1806
- if (!native?.generateStaticStateCss) {
1807
- throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2955
+ generateStaticStateCss = (entries, _themeConfig) => {
2956
+ const rules = [];
2957
+ for (const entry of entries) {
2958
+ const stateConfig = JSON.parse(entry.statesJson);
2959
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2960
+ rules.push({
2961
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2962
+ declarations: classes,
2963
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2964
+ componentName: entry.componentName,
2965
+ stateName
2966
+ });
2967
+ }
1808
2968
  }
1809
- return native.generateStaticStateCss(inputs, resolvedCss);
2969
+ return rules;
1810
2970
  };
1811
2971
  extractAndGenerateStateCss = (source, filename) => {
1812
- const native = getNativeBridge();
1813
- if (!native?.extractAndGenerateStateCss) {
1814
- const configs = extractTwStateConfigs(source, filename);
1815
- if (configs.length === 0) return [];
1816
- return generateStaticStateCss(
1817
- configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
1818
- );
1819
- }
1820
- return native.extractAndGenerateStateCss(source, filename);
2972
+ const entries = extractTwStateConfigs(source, filename);
2973
+ return generateStaticStateCss(entries);
1821
2974
  };
1822
2975
  }
1823
2976
  });
@@ -1826,75 +2979,219 @@ ${source}`;
1826
2979
  var internal_exports = {};
1827
2980
  __export(internal_exports, {
1828
2981
  adaptNativeResult: () => adaptNativeResult,
1829
- analyzeClassUsage: () => analyzeClassUsage,
2982
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
1830
2983
  analyzeClasses: () => analyzeClasses,
2984
+ analyzeClassesNative: () => analyzeClassesNative,
1831
2985
  analyzeFile: () => analyzeFile,
1832
- analyzeRsc: () => analyzeRsc,
2986
+ analyzeRscNative: () => analyzeRscNative,
1833
2987
  analyzeVariantUsage: () => analyzeVariantUsage,
1834
2988
  astExtractClasses: () => astExtractClasses,
2989
+ atomicRegistrySize: () => atomicRegistrySize,
1835
2990
  batchExtractClasses: () => batchExtractClasses,
2991
+ batchExtractClassesNative: () => batchExtractClassesNative,
1836
2992
  bucketSort: () => bucketSort,
1837
2993
  buildStyleTag: () => buildStyleTag,
2994
+ cachePriority: () => cachePriority,
2995
+ cacheRead: () => cacheRead,
2996
+ cacheWrite: () => cacheWrite,
1838
2997
  checkAgainstSafelist: () => checkAgainstSafelist,
1839
- classifyAndSortClasses: () => classifyAndSortClasses,
2998
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2999
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
1840
3000
  classifyNode: () => classifyNode,
3001
+ clearAllCaches: () => clearAllCaches,
3002
+ clearAtomicRegistry: () => clearAtomicRegistry,
1841
3003
  clearCache: () => clearCache,
3004
+ clearCompileCache: () => clearCompileCache,
3005
+ clearCssGenCache: () => clearCssGenCache,
3006
+ clearParseCache: () => clearParseCache,
3007
+ clearResolveCache: () => clearResolveCache,
3008
+ clearThemeCache: () => clearThemeCache,
3009
+ collectFiles: () => collectFiles,
3010
+ compileAnimation: () => compileAnimation,
3011
+ compileClass: () => compileClass,
3012
+ compileClasses: () => compileClasses,
1842
3013
  compileCssFromClasses: () => compileCssFromClasses,
1843
- compileCssNative: () => compileCssNative,
1844
- compileVariantTable: () => compileVariantTable,
1845
- compileVariants: () => compileVariants,
3014
+ compileCssLightning: () => compileCssLightning,
3015
+ compileCssNative2: () => compileCssNative2,
3016
+ compileKeyframes: () => compileKeyframes,
3017
+ compileTheme: () => compileTheme,
3018
+ compileToCss: () => compileToCss,
3019
+ compileToCssBatch: () => compileToCssBatch,
3020
+ compileVariantTableNative: () => compileVariantTableNative,
3021
+ computeIncrementalDiff: () => computeIncrementalDiff,
3022
+ createFingerprint: () => createFingerprint,
1846
3023
  detectConflicts: () => detectConflicts,
3024
+ detectDeadCode: () => detectDeadCode,
1847
3025
  diffClassLists: () => diffClassLists,
1848
3026
  eliminateDeadCss: () => eliminateDeadCss,
3027
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
3028
+ emitPluginHook: () => emitPluginHook,
3029
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
1849
3030
  extractAllClasses: () => extractAllClasses,
1850
3031
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3032
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
1851
3033
  extractClassesFromSource: () => extractClassesFromSource,
3034
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
1852
3035
  extractComponentUsage: () => extractComponentUsage,
1853
3036
  extractContainerCssFromSource: () => extractContainerCssFromSource,
3037
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
1854
3038
  extractTwStateConfigs: () => extractTwStateConfigs,
3039
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
1855
3040
  fileToRoute: () => fileToRoute,
1856
3041
  findDeadVariants: () => findDeadVariants,
3042
+ generateAtomicCss: () => generateAtomicCss,
1857
3043
  generateCssForClasses: () => generateCssForClasses,
1858
- generateRawCss: () => generateRawCss,
3044
+ generateCssNative: () => generateCssNative,
1859
3045
  generateSafelist: () => generateSafelist,
1860
3046
  generateStaticStateCss: () => generateStaticStateCss,
3047
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
3048
+ generateSubComponentTypes: () => generateSubComponentTypes,
1861
3049
  getAllRoutes: () => getAllRoutes,
1862
3050
  getBucketEngine: () => getBucketEngine,
3051
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
3052
+ getCacheStatistics: () => getCacheStatistics,
1863
3053
  getCacheStats: () => getCacheStats,
3054
+ getCompilationMetrics: () => getCompilationMetrics,
3055
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
1864
3056
  getContentPaths: () => getContentPaths,
1865
3057
  getIncrementalEngine: () => getIncrementalEngine,
1866
3058
  getNativeBridge: () => getNativeBridge,
3059
+ getPluginHooks: () => getPluginHooks,
1867
3060
  getRouteClasses: () => getRouteClasses,
3061
+ getWatchStats: () => getWatchStats,
1868
3062
  hasTwUsage: () => hasTwUsage,
1869
- hoistComponents: () => hoistComponents,
3063
+ hashContent: () => hashContent,
3064
+ hoistComponentsNative: () => hoistComponentsNative,
3065
+ idRegistryActiveCount: () => idRegistryActiveCount,
3066
+ idRegistryCreate: () => idRegistryCreate,
3067
+ idRegistryDestroy: () => idRegistryDestroy,
3068
+ idRegistryExport: () => idRegistryExport,
3069
+ idRegistryGenerate: () => idRegistryGenerate,
3070
+ idRegistryImport: () => idRegistryImport,
3071
+ idRegistryLookup: () => idRegistryLookup,
3072
+ idRegistryNext: () => idRegistryNext,
3073
+ idRegistryReset: () => idRegistryReset,
3074
+ idRegistrySnapshot: () => idRegistrySnapshot,
1870
3075
  injectClientDirective: () => injectClientDirective,
1871
3076
  injectServerOnlyComment: () => injectServerOnlyComment,
3077
+ injectStateHash: () => injectStateHash,
1872
3078
  isAlreadyTransformed: () => isAlreadyTransformed,
3079
+ isWatchRunning: () => isWatchRunning,
3080
+ layoutClassesToCss: () => layoutClassesToCss,
1873
3081
  loadSafelist: () => loadSafelist,
1874
3082
  loadTailwindConfig: () => loadTailwindConfig,
1875
3083
  mergeClassesStatic: () => mergeClassesStatic,
1876
- mergeCssDeclarations: () => mergeCssDeclarations,
3084
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
3085
+ minifyCss: () => minifyCss,
1877
3086
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1878
3087
  normalizeClasses: () => normalizeClasses,
1879
- optimizeCss: () => optimizeCss,
3088
+ optimizeCssNative: () => optimizeCssNative,
3089
+ parseAtomicClass: () => parseAtomicClass,
1880
3090
  parseClasses: () => parseClasses,
3091
+ pollWatchEvents: () => pollWatchEvents,
3092
+ processFileChange: () => processFileChange,
3093
+ processTailwindCssLightning: () => processTailwindCssLightning,
3094
+ propertyIdToString: () => propertyIdToString,
3095
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
3096
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
3097
+ redisCacheClear: () => redisCacheClear,
3098
+ redisCacheHitRate: () => redisCacheHitRate,
3099
+ redisCacheKeyCount: () => redisCacheKeyCount,
3100
+ redisCacheSize: () => redisCacheSize,
3101
+ redisCacheSync: () => redisCacheSync,
3102
+ redisClusterStatus: () => redisClusterStatus,
3103
+ redisDelete: () => redisDelete,
3104
+ redisDiagnose: () => redisDiagnose,
3105
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
3106
+ redisDisableCluster: () => redisDisableCluster,
3107
+ redisDisablePersistence: () => redisDisablePersistence,
3108
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
3109
+ redisEnableCluster: () => redisEnableCluster,
3110
+ redisEnablePersistence: () => redisEnablePersistence,
3111
+ redisExists: () => redisExists,
3112
+ redisExpirationGet: () => redisExpirationGet,
3113
+ redisExpirationSet: () => redisExpirationSet,
3114
+ redisFlushAll: () => redisFlushAll,
3115
+ redisFlushDb: () => redisFlushDb,
3116
+ redisGet: () => redisGet,
3117
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
3118
+ redisInfo: () => redisInfo,
3119
+ redisMemoryStats: () => redisMemoryStats,
3120
+ redisMget: () => redisMget,
3121
+ redisMonitor: () => redisMonitor,
3122
+ redisMset: () => redisMset,
3123
+ redisOptimizeMemory: () => redisOptimizeMemory,
3124
+ redisPing: () => redisPing,
3125
+ redisPoolConnect: () => redisPoolConnect,
3126
+ redisPoolReconnect: () => redisPoolReconnect,
3127
+ redisPoolStats: () => redisPoolStats,
3128
+ redisPublish: () => redisPublish,
3129
+ redisReplicate: () => redisReplicate,
3130
+ redisReplicationStatus: () => redisReplicationStatus,
3131
+ redisSet: () => redisSet,
3132
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
3133
+ redisSnapshot: () => redisSnapshot,
3134
+ redisSubscribe: () => redisSubscribe,
1881
3135
  registerFileClasses: () => registerFileClasses,
1882
3136
  registerGlobalClasses: () => registerGlobalClasses,
3137
+ registerPluginHook: () => registerPluginHook,
3138
+ registerPropertyName: () => registerPropertyName,
3139
+ registerValueName: () => registerValueName,
1883
3140
  resetBucketEngine: () => resetBucketEngine,
3141
+ resetCompilationMetrics: () => resetCompilationMetrics,
1884
3142
  resetIncrementalEngine: () => resetIncrementalEngine,
3143
+ resolveCascade: () => resolveCascade,
3144
+ resolveClassNames: () => resolveClassNames,
3145
+ resolveConflictGroup: () => resolveConflictGroup,
3146
+ resolveSimpleVariants: () => resolveSimpleVariants,
3147
+ resolveThemeValue: () => resolveThemeValue,
3148
+ resolveVariants: () => resolveVariants,
3149
+ reverseLookupProperty: () => reverseLookupProperty,
3150
+ reverseLookupValue: () => reverseLookupValue,
1885
3151
  runCssPipeline: () => runCssPipeline,
1886
3152
  runCssPipelineSync: () => runCssPipelineSync,
1887
3153
  runElimination: () => runElimination,
1888
3154
  runLoaderTransform: () => runLoaderTransform,
3155
+ scanCacheOptimizations: () => scanCacheOptimizations,
3156
+ scanFile: () => scanFile,
3157
+ scanFileNative: () => scanFileNative,
3158
+ scanFilesBatchNative: () => scanFilesBatchNative,
1889
3159
  scanProjectUsage: () => scanProjectUsage,
3160
+ scanWorkspace: () => scanWorkspace,
1890
3161
  shouldProcess: () => shouldProcess,
1891
3162
  shouldSkipFile: () => shouldSkipFile,
1892
- transformSource: () => transformSource
3163
+ startWatch: () => startWatch,
3164
+ stopWatch: () => stopWatch,
3165
+ toAtomicClasses: () => toAtomicClasses,
3166
+ transformSource: () => transformSource,
3167
+ twMerge: () => twMerge,
3168
+ twMergeMany: () => twMergeMany,
3169
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
3170
+ twMergeRaw: () => twMergeRaw,
3171
+ twMergeWithSeparator: () => twMergeWithSeparator,
3172
+ unregisterPluginHook: () => unregisterPluginHook,
3173
+ validateCssOutput: () => validateCssOutput,
3174
+ validateThemeConfig: () => validateThemeConfig,
3175
+ valueIdToString: () => valueIdToString,
3176
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
3177
+ watchAddPattern: () => watchAddPattern,
3178
+ watchClearAll: () => watchClearAll,
3179
+ watchEventTypeToString: () => watchEventTypeToString,
3180
+ watchGetActiveHandles: () => watchGetActiveHandles,
3181
+ watchPause: () => watchPause,
3182
+ watchRemovePattern: () => watchRemovePattern,
3183
+ watchResume: () => watchResume
1893
3184
  });
1894
3185
  var init_internal = __esm({
1895
3186
  "packages/domain/compiler/src/internal.ts"() {
1896
3187
  init_src();
1897
3188
  init_tailwindEngine();
3189
+ init_compiler();
3190
+ init_parser();
3191
+ init_analyzer();
3192
+ init_cache();
3193
+ init_redis();
3194
+ init_watch();
1898
3195
  }
1899
3196
  });
1900
3197
  function getNative() {
@@ -2241,7 +3538,7 @@ __export(src_exports, {
2241
3538
  getPipelinePercentages: () => getPipelinePercentages,
2242
3539
  getSuggestion: () => getSuggestion,
2243
3540
  getTailwindVersion: () => getTailwindVersion,
2244
- hashContent: () => hashContent,
3541
+ hashContent: () => hashContent2,
2245
3542
  isTailwindV4: () => isTailwindV4,
2246
3543
  isTwError: () => isTwError,
2247
3544
  loadNativeBinding: () => loadNativeBinding,
@@ -2371,7 +3668,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
2371
3668
  return process.cwd();
2372
3669
  }
2373
3670
  }
2374
- function hashContent(content, algorithm = "md5", length) {
3671
+ function hashContent2(content, algorithm = "md5", length) {
2375
3672
  const hash = crypto.createHash(algorithm).update(content).digest("hex");
2376
3673
  return length ? hash.slice(0, length) : hash;
2377
3674
  }
@@ -2496,7 +3793,7 @@ var init_src2 = __esm({
2496
3793
  // packages/domain/scanner/src/native-bridge.ts
2497
3794
  var native_bridge_exports = {};
2498
3795
  __export(native_bridge_exports, {
2499
- batchExtractClassesNative: () => batchExtractClassesNative,
3796
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2500
3797
  cachePriorityNative: () => cachePriorityNative,
2501
3798
  cacheReadNative: () => cacheReadNative,
2502
3799
  cacheWriteNative: () => cacheWriteNative,
@@ -2516,8 +3813,8 @@ __export(native_bridge_exports, {
2516
3813
  scanCacheInvalidate: () => scanCacheInvalidate,
2517
3814
  scanCachePut: () => scanCachePut,
2518
3815
  scanCacheStats: () => scanCacheStats,
2519
- scanFileNative: () => scanFileNative,
2520
- scanFilesBatchNative: () => scanFilesBatchNative,
3816
+ scanFileNative: () => scanFileNative2,
3817
+ scanFilesBatchNative: () => scanFilesBatchNative2,
2521
3818
  scanWorkspaceNative: () => scanWorkspaceNative,
2522
3819
  startWatchNative: () => startWatchNative,
2523
3820
  stopWatchNative: () => stopWatchNative
@@ -2608,7 +3905,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
2608
3905
  }
2609
3906
  return result;
2610
3907
  }
2611
- function batchExtractClassesNative(filePaths) {
3908
+ function batchExtractClassesNative2(filePaths) {
2612
3909
  const binding = scannerGetBinding();
2613
3910
  if (!binding.batchExtractClasses) {
2614
3911
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -2643,7 +3940,7 @@ function scanCacheStats() {
2643
3940
  }
2644
3941
  return binding.scanCacheStats();
2645
3942
  }
2646
- function scanFileNative(filePath) {
3943
+ function scanFileNative2(filePath) {
2647
3944
  const binding = scannerGetBinding();
2648
3945
  if (!binding.scanFile) {
2649
3946
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -2655,7 +3952,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
2655
3952
  if (!binding.collectFiles) return null;
2656
3953
  return binding.collectFiles(root, extensions, ignoreDirs);
2657
3954
  }
2658
- function scanFilesBatchNative(filePaths) {
3955
+ function scanFilesBatchNative2(filePaths) {
2659
3956
  const binding = scannerGetBinding();
2660
3957
  if (!binding.scanFilesBatch) {
2661
3958
  return filePaths.map((fp) => {
@@ -2860,7 +4157,7 @@ var init_cache_native = __esm({
2860
4157
  init_native_bridge();
2861
4158
  }
2862
4159
  });
2863
- function collectFiles(rootDir, extensions, ignoreDirs) {
4160
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
2864
4161
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
2865
4162
  if (native !== null) return native;
2866
4163
  throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
@@ -2900,9 +4197,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
2900
4197
  maxWorkers = Math.max(1, os.availableParallelism() - 1),
2901
4198
  chunkSize = DEFAULT_CHUNK_SIZE
2902
4199
  } = options;
2903
- const files = collectFiles(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
4200
+ const files = collectFiles2(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
2904
4201
  if (files.length < PARALLEL_THRESHOLD) {
2905
- return mergeResults(batchExtractClassesNative(files));
4202
+ return mergeResults(batchExtractClassesNative2(files));
2906
4203
  }
2907
4204
  const chunks = [];
2908
4205
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -2926,7 +4223,7 @@ var init_parallel_scanner = __esm({
2926
4223
  if (!worker_threads.isMainThread && worker_threads.parentPort) {
2927
4224
  const { filePaths } = worker_threads.workerData;
2928
4225
  try {
2929
- const results = batchExtractClassesNative(filePaths);
4226
+ const results = batchExtractClassesNative2(filePaths);
2930
4227
  const msg = { ok: true, results };
2931
4228
  worker_threads.parentPort.postMessage(msg);
2932
4229
  } catch (error) {
@@ -3010,15 +4307,15 @@ var src_exports2 = {};
3010
4307
  __export(src_exports2, {
3011
4308
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
3012
4309
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3013
- batchExtractClassesNative: () => batchExtractClassesNative,
4310
+ batchExtractClassesNative: () => batchExtractClassesNative2,
3014
4311
  extractClassesNative: () => extractClassesNative,
3015
4312
  isScannableFile: () => isScannableFile2,
3016
4313
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3017
4314
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3018
4315
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
3019
- scanFile: () => scanFile,
4316
+ scanFile: () => scanFile2,
3020
4317
  scanSource: () => scanSource,
3021
- scanWorkspace: () => scanWorkspace,
4318
+ scanWorkspace: () => scanWorkspace2,
3022
4319
  scanWorkspaceAsync: () => scanWorkspaceAsync
3023
4320
  });
3024
4321
  function getRuntimeDir() {
@@ -3144,9 +4441,9 @@ function scanSource(source) {
3144
4441
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
3145
4442
  return includeExtensions.includes(path9__namespace.default.extname(filePath));
3146
4443
  }
3147
- function scanFile(filePath) {
3148
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
3149
- const result = scanFileNative2(filePath);
4444
+ function scanFile2(filePath) {
4445
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4446
+ const result = scanFileNative3(filePath);
3150
4447
  if (!result.ok) {
3151
4448
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
3152
4449
  }
@@ -3156,7 +4453,7 @@ function scanFile(filePath) {
3156
4453
  ...result.hash ? { hash: result.hash } : {}
3157
4454
  };
3158
4455
  }
3159
- function scanWorkspace(rootDir, options = {}) {
4456
+ function scanWorkspace2(rootDir, options = {}) {
3160
4457
  const normalizedOptions = parseScanWorkspaceOptions(options);
3161
4458
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
3162
4459
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -3279,7 +4576,7 @@ function scanWorkspace(rootDir, options = {}) {
3279
4576
  }
3280
4577
  } else {
3281
4578
  for (const filePath of candidates) {
3282
- processResult(scanFile(filePath));
4579
+ processResult(scanFile2(filePath));
3283
4580
  }
3284
4581
  }
3285
4582
  return parseScanWorkspaceResult({
@@ -3306,7 +4603,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
3306
4603
  log3.debug(
3307
4604
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
3308
4605
  );
3309
- return scanWorkspace(rootDir, normalizedOptions);
4606
+ return scanWorkspace2(rootDir, normalizedOptions);
3310
4607
  }
3311
4608
  }
3312
4609
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
@@ -3499,24 +4796,31 @@ var init_native_bridge2 = __esm({
3499
4796
 
3500
4797
  // packages/domain/core/src/native.ts
3501
4798
  init_src2();
3502
- var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
3503
- var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
4799
+ var isBrowser4 = typeof window !== "undefined" && typeof document !== "undefined";
4800
+ 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";
3504
4801
  var _nodeRequire = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
3505
4802
  var _loadNative2 = (path15) => _nodeRequire(path15);
3506
4803
  var nativeBinding = null;
3507
4804
  var bindingLoadAttempted = false;
4805
+ var bindingError = null;
3508
4806
  var getBinding = () => {
3509
- if (isBrowser4) {
3510
- throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
3511
- }
3512
4807
  if (nativeBinding) return nativeBinding;
4808
+ if (bindingError) {
4809
+ throw bindingError;
4810
+ }
3513
4811
  if (bindingLoadAttempted) {
3514
4812
  throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
3515
4813
  }
3516
4814
  bindingLoadAttempted = true;
3517
4815
  try {
3518
- const runtimeDir = isBrowser4 ? "" : path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
3519
- const result = isBrowser4 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
4816
+ if (isBrowser4) {
4817
+ bindingError = new Error(
4818
+ "[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"
4819
+ );
4820
+ throw bindingError;
4821
+ }
4822
+ const runtimeDir = path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
4823
+ const result = resolveNativeBinary(runtimeDir);
3520
4824
  if (result.path && result.path.endsWith(".node")) {
3521
4825
  const mod = _loadNative2(result.path);
3522
4826
  if (mod?.batchSplitClasses) {
@@ -3524,11 +4828,22 @@ var getBinding = () => {
3524
4828
  return nativeBinding;
3525
4829
  }
3526
4830
  }
3527
- throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE2}
4831
+ bindingError = new Error(
4832
+ `${NATIVE_UNAVAILABLE_MESSAGE2}
4833
+
4834
+ Resolution Attempts:
4835
+ ${result.tried.map((t2) => ` - ${t2}`).join("\n")}
3528
4836
 
3529
- Tried: ${result.tried.join("\n")}`);
4837
+ Quick fixes:
4838
+ 1. npm run build:rust # Build native binaries
4839
+ 2. npm install # Reinstall with pre-built binaries
4840
+ 3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
4841
+ );
4842
+ throw bindingError;
3530
4843
  } catch (err) {
3531
- throw err instanceof Error ? err : new Error(String(err));
4844
+ const error = err instanceof Error ? err : new Error(String(err));
4845
+ bindingError = error;
4846
+ throw error;
3532
4847
  }
3533
4848
  };
3534
4849
  var getNativeBinding = getBinding;
@@ -3559,7 +4874,7 @@ function hashContainer(tag, container, name) {
3559
4874
  _hashContainerCache.set(sortedKey, id);
3560
4875
  return id;
3561
4876
  }
3562
- function layoutClassesToCss(classes) {
4877
+ function layoutClassesToCss2(classes) {
3563
4878
  const native = getNativeBinding();
3564
4879
  if (!native?.layoutClassesToCss) {
3565
4880
  throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
@@ -3570,7 +4885,7 @@ function buildContainerRules(id, container, containerName) {
3570
4885
  const rules = Object.entries(container).map(([key, value]) => {
3571
4886
  const minWidth = typeof value === "string" ? CONTAINER_BREAKPOINTS[key] ?? key : value.minWidth ?? CONTAINER_BREAKPOINTS[key] ?? key;
3572
4887
  const classes = typeof value === "string" ? value : value.classes;
3573
- const css = layoutClassesToCss(classes);
4888
+ const css = layoutClassesToCss2(classes);
3574
4889
  if (!css) return null;
3575
4890
  const query = containerName ? `@container ${containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
3576
4891
  return `${query}{.${id}{${css}}}`;
@@ -3655,7 +4970,7 @@ function getContainerRegistry() {
3655
4970
 
3656
4971
  // packages/domain/core/src/merge.ts
3657
4972
  function createTwMerge(_options = {}) {
3658
- return function twMerge2(...classLists) {
4973
+ return function twMerge3(...classLists) {
3659
4974
  const inputs = [];
3660
4975
  for (let i = 0; i < classLists.length; i++) {
3661
4976
  const v = classLists[i];
@@ -3669,11 +4984,11 @@ function createTwMerge(_options = {}) {
3669
4984
  return native.twMergeRaw(inputs);
3670
4985
  };
3671
4986
  }
3672
- var twMerge = createTwMerge();
4987
+ var twMerge2 = createTwMerge();
3673
4988
  function mergeWithRules(rules, ...classLists) {
3674
- const base = twMerge(...classLists);
4989
+ const base = twMerge2(...classLists);
3675
4990
  const classes = Object.values(rules).reduce(
3676
- (acc, rule) => twMerge(rule(acc)).split(/\s+/).filter(Boolean),
4991
+ (acc, rule) => twMerge2(rule(acc)).split(/\s+/).filter(Boolean),
3677
4992
  base.split(/\s+/).filter(Boolean)
3678
4993
  );
3679
4994
  return classes.join(" ");
@@ -3938,7 +5253,7 @@ function makeFilterProps(variantKeys, stateKeys = /* @__PURE__ */ new Set()) {
3938
5253
  return out;
3939
5254
  };
3940
5255
  }
3941
- function resolveVariants(variants, props, defaults) {
5256
+ function resolveVariants2(variants, props, defaults) {
3942
5257
  const variantKeys = Object.keys(variants);
3943
5258
  const cleanProps = {};
3944
5259
  for (const k of variantKeys) {
@@ -3989,7 +5304,7 @@ function attachExtend(component, originalTag, base, config) {
3989
5304
  function extendWithClasses(stringsOrConfig) {
3990
5305
  if (Array.isArray(stringsOrConfig) && "raw" in stringsOrConfig) {
3991
5306
  const rawExtra = stringsOrConfig.raw.join("").trim().replace(/\s+/g, " ");
3992
- const merged2 = twMerge(extractBaseClasses(base), extractBaseClasses(rawExtra));
5307
+ const merged2 = twMerge2(extractBaseClasses(base), extractBaseClasses(rawExtra));
3993
5308
  const extended2 = createComponent(
3994
5309
  originalTag,
3995
5310
  typeof config === "string" ? merged2 : { ...config, base: merged2 }
@@ -4007,7 +5322,7 @@ function attachExtend(component, originalTag, base, config) {
4007
5322
  }
4008
5323
  const extCfg = stringsOrConfig;
4009
5324
  const extraClasses = extCfg.classes ?? "";
4010
- const merged = twMerge(extractBaseClasses(base), extraClasses);
5325
+ const merged = twMerge2(extractBaseClasses(base), extraClasses);
4011
5326
  const existing = typeof config === "object" ? config : {};
4012
5327
  const extended = createComponent(originalTag, {
4013
5328
  ...existing,
@@ -4101,7 +5416,7 @@ function createComponent(tag, config) {
4101
5416
  const { className, ...rest } = props;
4102
5417
  const runtimeClassName = normalizeClassName(className);
4103
5418
  const statesClasses = statesConfig ? resolveStates(statesConfig, stateKeys, statesLookup, props) : "";
4104
- const mergedBase = twMerge(extractBaseClasses(base), engineClasses, runtimeClassName);
5419
+ const mergedBase = twMerge2(extractBaseClasses(base), engineClasses, runtimeClassName);
4105
5420
  const className2 = statesClasses ? `${mergedBase} ${statesClasses}`.trim() : mergedBase;
4106
5421
  return React3__default.default.createElement(tag, {
4107
5422
  ref,
@@ -4118,10 +5433,10 @@ function createComponent(tag, config) {
4118
5433
  const baseComponent = React3__default.default.forwardRef((props, ref) => {
4119
5434
  const { className, ...rest } = props;
4120
5435
  const runtimeClassName = normalizeClassName(className);
4121
- const variantClasses = resolveVariants(variants, props, defaultVariants);
5436
+ const variantClasses = resolveVariants2(variants, props, defaultVariants);
4122
5437
  const compoundClasses = resolveCompound(compoundVariants, props);
4123
5438
  const statesClasses = statesConfig ? resolveStates(statesConfig, stateKeys, statesLookup, props) : "";
4124
- const mergedBase = twMerge(extractBaseClasses(base), variantClasses, compoundClasses, engineClasses, runtimeClassName);
5439
+ const mergedBase = twMerge2(extractBaseClasses(base), variantClasses, compoundClasses, engineClasses, runtimeClassName);
4125
5440
  const className2 = statesClasses ? `${mergedBase} ${statesClasses}`.trim() : mergedBase;
4126
5441
  return React3__default.default.createElement(tag, {
4127
5442
  ref,
@@ -4283,7 +5598,7 @@ function cv(config, componentId) {
4283
5598
  } else {
4284
5599
  result = resolveVariantsNative(config, props);
4285
5600
  }
4286
- return props.className ? twMerge(result, props.className) : result;
5601
+ return props.className ? twMerge2(result, props.className) : result;
4287
5602
  };
4288
5603
  }
4289
5604
 
@@ -4586,7 +5901,7 @@ function resolveVariantClass(options, props) {
4586
5901
  }
4587
5902
  function resolveStyledClassName(options, props = {}) {
4588
5903
  const parts = [options.base ?? "", ...resolveVariantClass(options, props), props.className ?? ""];
4589
- return twMerge(...parts);
5904
+ return twMerge2(...parts);
4590
5905
  }
4591
5906
  function styled(options) {
4592
5907
  return function getClassName(props = {}) {
@@ -4752,7 +6067,9 @@ function parseTemplate(strings, exprs) {
4752
6067
  if (cached) return cached;
4753
6068
  const binding = getNativeBinding();
4754
6069
  if (!binding?.parseTemplate) {
4755
- throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
6070
+ throw new Error(
6071
+ "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: {...} })"
6072
+ );
4756
6073
  }
4757
6074
  const r = binding.parseTemplate(raw);
4758
6075
  const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
@@ -5587,7 +6904,7 @@ init_src2();
5587
6904
  init_native_bridge2();
5588
6905
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
5589
6906
  var log5 = createLogger2("engine:incremental");
5590
- function rebuildWorkspaceResult(byFile) {
6907
+ function rebuildWorkspaceResult2(byFile) {
5591
6908
  const files = Array.from(byFile.values());
5592
6909
  const native = getNativeEngineBinding();
5593
6910
  if (native?.rebuildWorkspaceResult) {
@@ -5630,10 +6947,10 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
5630
6947
  log5.debug(`native unlink ${normalizedPath}`);
5631
6948
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
5632
6949
  byFile.delete(normalizedPath);
5633
- return rebuildWorkspaceResult(byFile);
6950
+ return rebuildWorkspaceResult2(byFile);
5634
6951
  }
5635
6952
  log5.debug(`native change ${normalizedPath}`);
5636
- const scanned = scanFile(normalizedPath);
6953
+ const scanned = scanFile2(normalizedPath);
5637
6954
  const content = fs3__namespace.default.readFileSync(normalizedPath, "utf8");
5638
6955
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
5639
6956
  const existing = byFile.get(normalizedPath);
@@ -5646,7 +6963,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
5646
6963
  log5.debug(`native diff cold-sync ${normalizedPath}`);
5647
6964
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
5648
6965
  }
5649
- return rebuildWorkspaceResult(byFile);
6966
+ return rebuildWorkspaceResult2(byFile);
5650
6967
  }
5651
6968
 
5652
6969
  // packages/domain/engine/src/metrics.ts
@@ -6324,7 +7641,7 @@ exports.t = t;
6324
7641
  exports.tokenRef = tokenRef;
6325
7642
  exports.tokenVar = tokenVar;
6326
7643
  exports.tw = tw;
6327
- exports.twMerge = twMerge;
7644
+ exports.twMerge = twMerge2;
6328
7645
  exports.twVar = twVar;
6329
7646
  exports.v4Tokens = v4Tokens;
6330
7647
  exports.withSubComponents = withSubComponents;