tailwind-styled-v4 5.0.12 → 5.0.13

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 (60) 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 +42 -0
  9. package/dist/atomic.js.map +1 -1
  10. package/dist/atomic.mjs +42 -0
  11. package/dist/atomic.mjs.map +1 -1
  12. package/dist/cli.js +142 -0
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cli.mjs +142 -0
  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 +888 -922
  19. package/dist/compiler.js.map +1 -1
  20. package/dist/compiler.mjs +873 -908
  21. package/dist/compiler.mjs.map +1 -1
  22. package/dist/engine.js +1637 -340
  23. package/dist/engine.js.map +1 -1
  24. package/dist/engine.mjs +1636 -339
  25. package/dist/engine.mjs.map +1 -1
  26. package/dist/index.js +1636 -339
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +1636 -339
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/next.js +1060 -970
  31. package/dist/next.js.map +1 -1
  32. package/dist/next.mjs +1060 -970
  33. package/dist/next.mjs.map +1 -1
  34. package/dist/shared.js +1607 -310
  35. package/dist/shared.js.map +1 -1
  36. package/dist/shared.mjs +1607 -310
  37. package/dist/shared.mjs.map +1 -1
  38. package/dist/svelte.js.map +1 -1
  39. package/dist/svelte.mjs.map +1 -1
  40. package/dist/turbopackLoader.js +1610 -313
  41. package/dist/turbopackLoader.js.map +1 -1
  42. package/dist/turbopackLoader.mjs +1610 -313
  43. package/dist/turbopackLoader.mjs.map +1 -1
  44. package/dist/tw.js +142 -0
  45. package/dist/tw.js.map +1 -1
  46. package/dist/tw.mjs +142 -0
  47. package/dist/tw.mjs.map +1 -1
  48. package/dist/vite.js +1622 -325
  49. package/dist/vite.js.map +1 -1
  50. package/dist/vite.mjs +1622 -325
  51. package/dist/vite.mjs.map +1 -1
  52. package/dist/vue.js.map +1 -1
  53. package/dist/vue.mjs.map +1 -1
  54. package/dist/webpackLoader.js +66 -15
  55. package/dist/webpackLoader.js.map +1 -1
  56. package/dist/webpackLoader.mjs +66 -15
  57. package/dist/webpackLoader.mjs.map +1 -1
  58. package/native/tailwind-styled-native.node +0 -0
  59. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  60. package/package.json +1 -1
package/dist/engine.mjs CHANGED
@@ -1059,11 +1059,484 @@ Tried paths: ${result.tried.join("\n")}`);
1059
1059
  }
1060
1060
  });
1061
1061
 
1062
- // packages/domain/compiler/src/tailwindEngine.ts
1062
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1063
+ async function generateCssNative(classes, options) {
1064
+ const { theme } = options;
1065
+ const native = getNativeBridge();
1066
+ if (!native?.generateCssNative) {
1067
+ throw new Error(
1068
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1069
+ );
1070
+ }
1071
+ const themeJson = JSON.stringify(theme);
1072
+ const css = native.generateCssNative(classes, themeJson);
1073
+ return css;
1074
+ }
1075
+ function clearThemeCache() {
1076
+ try {
1077
+ const native = getNativeBridge();
1078
+ if (!native?.clearThemeCache) {
1079
+ return;
1080
+ }
1081
+ native.clearThemeCache();
1082
+ } catch {
1083
+ }
1084
+ }
1085
+ var init_cssGeneratorNative = __esm({
1086
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1087
+ init_nativeBridge();
1088
+ }
1089
+ });
1090
+
1091
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1092
+ function compileCssNative2(classes, prefix) {
1093
+ const native = getNativeBridge();
1094
+ if (!native?.compileCss) throw new Error("compileCss not available");
1095
+ return native.compileCss(classes, prefix);
1096
+ }
1097
+ function compileCssLightning(classes) {
1098
+ const native = getNativeBridge();
1099
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1100
+ return native.compileCssLightning(classes);
1101
+ }
1102
+ function extractTwStateConfigsNative(source, filename) {
1103
+ const native = getNativeBridge();
1104
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1105
+ return native.extractTwStateConfigs(source, filename);
1106
+ }
1107
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1108
+ const native = getNativeBridge();
1109
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1110
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1111
+ }
1112
+ function extractAndGenerateStateCssNative(source, filename) {
1113
+ const native = getNativeBridge();
1114
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1115
+ return native.extractAndGenerateStateCss(source, filename);
1116
+ }
1117
+ function layoutClassesToCss(classes) {
1118
+ const native = getNativeBridge();
1119
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1120
+ return native.layoutClassesToCss(classes);
1121
+ }
1122
+ function hashContent(input, algorithm = "sha256", length = 8) {
1123
+ const native = getNativeBridge();
1124
+ if (!native?.hashContent) throw new Error("hashContent not available");
1125
+ return native.hashContent(input, algorithm, length);
1126
+ }
1127
+ function extractTwContainerConfigs(source) {
1128
+ const native = getNativeBridge();
1129
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1130
+ return native.extractTwContainerConfigs(source);
1131
+ }
1132
+ function parseAtomicClass(twClass) {
1133
+ const native = getNativeBridge();
1134
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1135
+ return native.parseAtomicClass(twClass);
1136
+ }
1137
+ function generateAtomicCss(rulesJson) {
1138
+ const native = getNativeBridge();
1139
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1140
+ return native.generateAtomicCss(rulesJson);
1141
+ }
1142
+ function toAtomicClasses(twClasses) {
1143
+ const native = getNativeBridge();
1144
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1145
+ return native.toAtomicClasses(twClasses);
1146
+ }
1147
+ function clearAtomicRegistry() {
1148
+ const native = getNativeBridge();
1149
+ if (!native?.clearAtomicRegistry) return;
1150
+ native.clearAtomicRegistry();
1151
+ }
1152
+ function atomicRegistrySize() {
1153
+ const native = getNativeBridge();
1154
+ if (!native?.atomicRegistrySize) return 0;
1155
+ return native.atomicRegistrySize();
1156
+ }
1157
+ var init_compilationNative = __esm({
1158
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1159
+ init_nativeBridge();
1160
+ }
1161
+ });
1162
+
1163
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1164
+ function compileClass(input) {
1165
+ const native = getNativeBridge();
1166
+ if (!native?.compile_class) throw new Error("compile_class not available");
1167
+ const resultJson = native.compile_class(input);
1168
+ try {
1169
+ return JSON.parse(resultJson);
1170
+ } catch {
1171
+ return {
1172
+ selector: "",
1173
+ declarations: "",
1174
+ properties: [],
1175
+ specificity: 0
1176
+ };
1177
+ }
1178
+ }
1179
+ function compileClasses(inputs) {
1180
+ const native = getNativeBridge();
1181
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1182
+ const resultJson = native.compile_classes(inputs);
1183
+ try {
1184
+ return JSON.parse(resultJson);
1185
+ } catch {
1186
+ return {
1187
+ css: "",
1188
+ resolved_classes: [],
1189
+ unknown_classes: [],
1190
+ size_bytes: 0,
1191
+ duration_ms: 0
1192
+ };
1193
+ }
1194
+ }
1195
+ function compileToCss(input, minify) {
1196
+ const native = getNativeBridge();
1197
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1198
+ return native.compile_to_css(input, minify ?? false);
1199
+ }
1200
+ function compileToCssBatch(inputs, minify) {
1201
+ const native = getNativeBridge();
1202
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1203
+ return native.compile_to_css_batch(inputs, minify ?? false);
1204
+ }
1205
+ function minifyCss(css) {
1206
+ const native = getNativeBridge();
1207
+ if (!native?.minify_css) throw new Error("minify_css not available");
1208
+ return native.minify_css(css);
1209
+ }
1210
+ function compileAnimation(animationName, from, to) {
1211
+ const native = getNativeBridge();
1212
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1213
+ const resultJson = native.compile_animation(animationName, from, to);
1214
+ try {
1215
+ return JSON.parse(resultJson);
1216
+ } catch {
1217
+ return {
1218
+ animation_id: "",
1219
+ keyframes_css: "",
1220
+ animation_rule: "",
1221
+ duration_ms: 0
1222
+ };
1223
+ }
1224
+ }
1225
+ function compileKeyframes(name, stopsJson) {
1226
+ const native = getNativeBridge();
1227
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1228
+ const resultJson = native.compile_keyframes(name, stopsJson);
1229
+ try {
1230
+ return JSON.parse(resultJson);
1231
+ } catch {
1232
+ return {
1233
+ animation_id: "",
1234
+ keyframes_css: "",
1235
+ animation_rule: "",
1236
+ duration_ms: 0
1237
+ };
1238
+ }
1239
+ }
1240
+ function compileTheme(tokensJson, themeName, prefix) {
1241
+ const native = getNativeBridge();
1242
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1243
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1244
+ try {
1245
+ return JSON.parse(resultJson);
1246
+ } catch {
1247
+ return {
1248
+ selector: ":root",
1249
+ variables: [],
1250
+ variables_css: "",
1251
+ theme_name: themeName
1252
+ };
1253
+ }
1254
+ }
1255
+ function twMerge(classString) {
1256
+ const native = getNativeBridge();
1257
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1258
+ return native.tw_merge(classString);
1259
+ }
1260
+ function twMergeMany(classStrings) {
1261
+ const native = getNativeBridge();
1262
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1263
+ return native.tw_merge_many(classStrings);
1264
+ }
1265
+ function twMergeWithSeparator(classString, options) {
1266
+ const native = getNativeBridge();
1267
+ if (!native?.tw_merge_with_separator)
1268
+ throw new Error("tw_merge_with_separator not available");
1269
+ const opts = {
1270
+ separator: options.separator,
1271
+ debug: options.debug
1272
+ };
1273
+ return native.tw_merge_with_separator(classString, opts);
1274
+ }
1275
+ function twMergeManyWithSeparator(classStrings, options) {
1276
+ const native = getNativeBridge();
1277
+ if (!native?.tw_merge_many_with_separator)
1278
+ throw new Error("tw_merge_many_with_separator not available");
1279
+ const opts = {
1280
+ separator: options.separator,
1281
+ debug: options.debug
1282
+ };
1283
+ return native.tw_merge_many_with_separator(classStrings, opts);
1284
+ }
1285
+ function twMergeRaw(classLists) {
1286
+ const native = getNativeBridge();
1287
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1288
+ return native.tw_merge_raw(classLists);
1289
+ }
1290
+ var init_cssCompilationNative = __esm({
1291
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1292
+ init_nativeBridge();
1293
+ }
1294
+ });
1295
+
1296
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1297
+ function idRegistryCreate() {
1298
+ const native = getNativeBridge();
1299
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1300
+ return native.id_registry_create();
1301
+ }
1302
+ function idRegistryGenerate(handle, name) {
1303
+ const native = getNativeBridge();
1304
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1305
+ return native.id_registry_generate(handle, name);
1306
+ }
1307
+ function idRegistryLookup(handle, name) {
1308
+ const native = getNativeBridge();
1309
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1310
+ return native.id_registry_lookup(handle, name);
1311
+ }
1312
+ function idRegistryNext(handle) {
1313
+ const native = getNativeBridge();
1314
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1315
+ return native.id_registry_next(handle);
1316
+ }
1317
+ function idRegistryDestroy(handle) {
1318
+ const native = getNativeBridge();
1319
+ if (!native?.id_registry_destroy) return;
1320
+ native.id_registry_destroy(handle);
1321
+ }
1322
+ function idRegistryReset(handle) {
1323
+ const native = getNativeBridge();
1324
+ if (!native?.id_registry_reset) return;
1325
+ native.id_registry_reset(handle);
1326
+ }
1327
+ function idRegistrySnapshot(handle) {
1328
+ const native = getNativeBridge();
1329
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1330
+ const snapshotJson = native.id_registry_snapshot(handle);
1331
+ try {
1332
+ return JSON.parse(snapshotJson);
1333
+ } catch {
1334
+ return {
1335
+ handle,
1336
+ next_id: 0,
1337
+ entries: [],
1338
+ total_entries: 0
1339
+ };
1340
+ }
1341
+ }
1342
+ function idRegistryActiveCount() {
1343
+ const native = getNativeBridge();
1344
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1345
+ return native.id_registry_active_count();
1346
+ }
1347
+ function registerPropertyName(propertyName) {
1348
+ const native = getNativeBridge();
1349
+ if (!native?.register_property_name)
1350
+ throw new Error("register_property_name not available");
1351
+ return native.register_property_name(propertyName);
1352
+ }
1353
+ function registerValueName(valueName) {
1354
+ const native = getNativeBridge();
1355
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1356
+ return native.register_value_name(valueName);
1357
+ }
1358
+ function propertyIdToString(propertyId) {
1359
+ const native = getNativeBridge();
1360
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1361
+ return native.property_id_to_string(propertyId);
1362
+ }
1363
+ function valueIdToString(valueId) {
1364
+ const native = getNativeBridge();
1365
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1366
+ return native.value_id_to_string(valueId);
1367
+ }
1368
+ function reverseLookupProperty(propertyId) {
1369
+ const native = getNativeBridge();
1370
+ if (!native?.reverse_lookup_property)
1371
+ throw new Error("reverse_lookup_property not available");
1372
+ return native.reverse_lookup_property(propertyId);
1373
+ }
1374
+ function reverseLookupValue(valueId) {
1375
+ const native = getNativeBridge();
1376
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1377
+ return native.reverse_lookup_value(valueId);
1378
+ }
1379
+ function idRegistryExport(handle) {
1380
+ const native = getNativeBridge();
1381
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1382
+ return native.id_registry_export(handle);
1383
+ }
1384
+ function idRegistryImport(importedData) {
1385
+ const native = getNativeBridge();
1386
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1387
+ return native.id_registry_import(importedData);
1388
+ }
1389
+ var init_idRegistryNative = __esm({
1390
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1391
+ init_nativeBridge();
1392
+ }
1393
+ });
1394
+
1395
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1396
+ function processFileChange(fileChangeJson) {
1397
+ const native = getNativeBridge();
1398
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1399
+ const resultJson = native.process_file_change(fileChangeJson);
1400
+ try {
1401
+ return JSON.parse(resultJson);
1402
+ } catch {
1403
+ return {
1404
+ file_path: "",
1405
+ status: "error",
1406
+ old_classes: [],
1407
+ new_classes: [],
1408
+ added_classes: [],
1409
+ removed_classes: [],
1410
+ changed: false,
1411
+ fingerprint: "",
1412
+ error: "Failed to parse result"
1413
+ };
1414
+ }
1415
+ }
1416
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1417
+ const native = getNativeBridge();
1418
+ if (!native?.compute_incremental_diff)
1419
+ throw new Error("compute_incremental_diff not available");
1420
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1421
+ try {
1422
+ return JSON.parse(resultJson);
1423
+ } catch {
1424
+ return {
1425
+ is_changed: false,
1426
+ changes_count: 0,
1427
+ diff: {
1428
+ added_files: [],
1429
+ removed_files: [],
1430
+ modified_files: [],
1431
+ added_classes: [],
1432
+ removed_classes: [],
1433
+ total_changes: 0
1434
+ },
1435
+ processing_time_ms: 0
1436
+ };
1437
+ }
1438
+ }
1439
+ function createFingerprint(filePath, fileContent) {
1440
+ const native = getNativeBridge();
1441
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1442
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1443
+ try {
1444
+ return JSON.parse(fingerprintJson);
1445
+ } catch {
1446
+ return {
1447
+ file_path: filePath,
1448
+ content_hash: "",
1449
+ size_bytes: fileContent.length,
1450
+ mtime_ms: Date.now(),
1451
+ class_hash: "",
1452
+ signature: ""
1453
+ };
1454
+ }
1455
+ }
1456
+ function injectStateHash(css, stateHash) {
1457
+ const native = getNativeBridge();
1458
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1459
+ const resultJson = native.inject_state_hash(css, stateHash);
1460
+ try {
1461
+ return JSON.parse(resultJson);
1462
+ } catch {
1463
+ return {
1464
+ injected: false,
1465
+ state_hash: stateHash,
1466
+ affected_files: 0,
1467
+ total_injected_bytes: 0
1468
+ };
1469
+ }
1470
+ }
1471
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1472
+ const native = getNativeBridge();
1473
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1474
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1475
+ try {
1476
+ return JSON.parse(resultJson);
1477
+ } catch {
1478
+ return {
1479
+ entries_before: 0,
1480
+ entries_after: 0,
1481
+ entries_removed: 0,
1482
+ freed_bytes: 0
1483
+ };
1484
+ }
1485
+ }
1486
+ function rebuildWorkspaceResult(rootDir, extensions) {
1487
+ const native = getNativeBridge();
1488
+ if (!native?.rebuild_workspace_result)
1489
+ throw new Error("rebuild_workspace_result not available");
1490
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1491
+ try {
1492
+ return JSON.parse(resultJson);
1493
+ } catch {
1494
+ return {
1495
+ total_files_scanned: 0,
1496
+ total_classes_found: 0,
1497
+ unique_classes: 0,
1498
+ build_time_ms: 0,
1499
+ files_with_changes: 0
1500
+ };
1501
+ }
1502
+ }
1503
+ function scanFileNative(filePath, fileContent) {
1504
+ const native = getNativeBridge();
1505
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1506
+ const resultJson = native.scan_file_native(filePath, fileContent);
1507
+ try {
1508
+ return JSON.parse(resultJson);
1509
+ } catch {
1510
+ return {
1511
+ file: filePath,
1512
+ classes: [],
1513
+ added_classes: [],
1514
+ removed_classes: [],
1515
+ changed: false
1516
+ };
1517
+ }
1518
+ }
1519
+ function scanFilesBatchNative(filesJson) {
1520
+ const native = getNativeBridge();
1521
+ if (!native?.scan_files_batch_native)
1522
+ throw new Error("scan_files_batch_native not available");
1523
+ const resultJson = native.scan_files_batch_native(filesJson);
1524
+ try {
1525
+ return JSON.parse(resultJson);
1526
+ } catch {
1527
+ return [];
1528
+ }
1529
+ }
1530
+ var init_streamingNative = __esm({
1531
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1532
+ init_nativeBridge();
1533
+ }
1534
+ });
1535
+
1536
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1063
1537
  var tailwindEngine_exports = {};
1064
1538
  __export(tailwindEngine_exports, {
1065
1539
  clearCache: () => clearCache,
1066
- generateRawCss: () => generateRawCss,
1067
1540
  getCacheStats: () => getCacheStats,
1068
1541
  processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1069
1542
  runCssPipeline: () => runCssPipeline,
@@ -1097,48 +1570,6 @@ function clearCache() {
1097
1570
  _cacheHits = 0;
1098
1571
  _cacheMisses = 0;
1099
1572
  }
1100
- function loadTailwindEngine() {
1101
- if (_twEngine) return _twEngine;
1102
- if (_twEngineError) throw _twEngineError;
1103
- try {
1104
- const tw = require2("tailwindcss");
1105
- if (typeof tw.compile !== "function") {
1106
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
1107
- }
1108
- _twEngine = tw;
1109
- return _twEngine;
1110
- } catch (e) {
1111
- _twEngineError = e instanceof Error ? e : new Error(String(e));
1112
- throw _twEngineError;
1113
- }
1114
- }
1115
- async function generateRawCss(classes, cssEntryContent, root) {
1116
- if (classes.length === 0) return "";
1117
- const tw = loadTailwindEngine();
1118
- const input = cssEntryContent ?? "@import 'tailwindcss';";
1119
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1120
- const { dirname, resolve: resolve2 } = await import('path');
1121
- const projectRoot = root ?? process.cwd();
1122
- const req = createRequire(resolve2(projectRoot, "package.json"));
1123
- const loadStylesheet = async (id, base) => {
1124
- try {
1125
- 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;
1126
- const pkgPath = req.resolve(cssId);
1127
- return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
1128
- } catch {
1129
- try {
1130
- const absPath = resolve2(base, id);
1131
- if (existsSync3(absPath)) {
1132
- return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
1133
- }
1134
- } catch {
1135
- }
1136
- return { content: "", base };
1137
- }
1138
- };
1139
- const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1140
- return compiler.build(classes);
1141
- }
1142
1573
  function getThemeConfig() {
1143
1574
  return {
1144
1575
  colors: {
@@ -1235,20 +1666,9 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1235
1666
  _cacheMisses++;
1236
1667
  let rawCss;
1237
1668
  let usedRustCompiler = false;
1238
- try {
1239
- const theme = getThemeConfig();
1240
- rawCss = await generateCssNative(unique, {
1241
- theme,
1242
- fallbackToJs: true,
1243
- logFallback: process.env.DEBUG?.includes("compiler") === true
1244
- });
1245
- usedRustCompiler = true;
1246
- } catch (error) {
1247
- if (process.env.DEBUG?.includes("compiler")) {
1248
- console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
1249
- }
1250
- rawCss = await generateRawCss(unique, cssEntryContent, root);
1251
- }
1669
+ const theme = getThemeConfig();
1670
+ rawCss = await generateCssNative(unique, { theme });
1671
+ usedRustCompiler = true;
1252
1672
  const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1253
1673
  if (process.env.DEBUG?.includes("compiler")) {
1254
1674
  console.log(
@@ -1266,67 +1686,900 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1266
1686
  _cssCache.set(cacheKey, result);
1267
1687
  return result;
1268
1688
  }
1269
- function runCssPipelineSync(_classes) {
1270
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
1689
+ function runCssPipelineSync(_classes) {
1690
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1691
+ }
1692
+ function processTailwindCssWithTargets(css, targets) {
1693
+ const native = getNativeBridge();
1694
+ if (!native?.processTailwindCssWithTargets) {
1695
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1696
+ }
1697
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1698
+ if (!result?.css) {
1699
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1700
+ }
1701
+ return result.css;
1702
+ }
1703
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1704
+ var init_tailwindEngine = __esm({
1705
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1706
+ init_nativeBridge();
1707
+ init_cssGeneratorNative();
1708
+ createRequire(import.meta.url);
1709
+ _cssCache = /* @__PURE__ */ new Map();
1710
+ _cacheHits = 0;
1711
+ _cacheMisses = 0;
1712
+ MAX_CACHE_SIZE = 100;
1713
+ }
1714
+ });
1715
+
1716
+ // packages/domain/compiler/src/compiler/index.ts
1717
+ var init_compiler = __esm({
1718
+ "packages/domain/compiler/src/compiler/index.ts"() {
1719
+ init_cssGeneratorNative();
1720
+ init_compilationNative();
1721
+ init_cssCompilationNative();
1722
+ init_idRegistryNative();
1723
+ init_streamingNative();
1724
+ }
1725
+ });
1726
+
1727
+ // packages/domain/compiler/src/parser/index.ts
1728
+ var parser_exports = {};
1729
+ __export(parser_exports, {
1730
+ astExtractClasses: () => astExtractClasses,
1731
+ batchExtractClasses: () => batchExtractClasses,
1732
+ checkAgainstSafelist: () => checkAgainstSafelist,
1733
+ diffClassLists: () => diffClassLists,
1734
+ extractAllClasses: () => extractAllClasses,
1735
+ extractClassesFromSource: () => extractClassesFromSource,
1736
+ extractComponentUsage: () => extractComponentUsage,
1737
+ mergeClassesStatic: () => mergeClassesStatic,
1738
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1739
+ normalizeClasses: () => normalizeClasses,
1740
+ parseClasses: () => parseClasses
1741
+ });
1742
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1743
+ var init_parser = __esm({
1744
+ "packages/domain/compiler/src/parser/index.ts"() {
1745
+ init_nativeBridge();
1746
+ parseClasses = (raw) => {
1747
+ const native = getNativeBridge();
1748
+ if (!native?.parseClasses) {
1749
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1750
+ }
1751
+ return native.parseClasses(raw) || [];
1752
+ };
1753
+ extractAllClasses = (source) => {
1754
+ const native = getNativeBridge();
1755
+ if (!native?.extractAllClasses) {
1756
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1757
+ }
1758
+ return native.extractAllClasses(source) || [];
1759
+ };
1760
+ extractClassesFromSource = (source) => {
1761
+ const native = getNativeBridge();
1762
+ if (!native?.extractClassesFromSource) {
1763
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1764
+ }
1765
+ const result = native.extractClassesFromSource(source);
1766
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1767
+ };
1768
+ astExtractClasses = (source, _filename) => {
1769
+ const native = getNativeBridge();
1770
+ if (!native?.extractClassesFromSource) {
1771
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1772
+ }
1773
+ return native.extractClassesFromSource(source) || [];
1774
+ };
1775
+ normalizeClasses = (raw) => {
1776
+ const result = normalizeAndDedupClasses(raw);
1777
+ return result?.normalized || "";
1778
+ };
1779
+ mergeClassesStatic = (classes) => {
1780
+ const result = normalizeAndDedupClasses(classes);
1781
+ return result?.normalized || "";
1782
+ };
1783
+ normalizeAndDedupClasses = (raw) => {
1784
+ const native = getNativeBridge();
1785
+ if (!native?.normalizeAndDedupClasses) {
1786
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1787
+ }
1788
+ const result = native.normalizeAndDedupClasses(raw);
1789
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1790
+ };
1791
+ extractComponentUsage = (source) => {
1792
+ const native = getNativeBridge();
1793
+ if (!native?.extractComponentUsage) {
1794
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1795
+ }
1796
+ return native.extractComponentUsage(source) || [];
1797
+ };
1798
+ batchExtractClasses = (filePaths) => {
1799
+ const native = getNativeBridge();
1800
+ if (!native?.batchExtractClasses) {
1801
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1802
+ }
1803
+ return native.batchExtractClasses(filePaths) || [];
1804
+ };
1805
+ checkAgainstSafelist = (classes, safelist) => {
1806
+ const native = getNativeBridge();
1807
+ if (!native?.checkAgainstSafelist) {
1808
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1809
+ }
1810
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1811
+ };
1812
+ diffClassLists = (previous, current) => {
1813
+ const native = getNativeBridge();
1814
+ if (!native?.diffClassLists) {
1815
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1816
+ }
1817
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1818
+ };
1819
+ }
1820
+ });
1821
+
1822
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1823
+ function detectDeadCode(scanResultJson, css) {
1824
+ const native = getNativeBridge();
1825
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1826
+ return native.detectDeadCode(scanResultJson, css);
1827
+ }
1828
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1829
+ const native = getNativeBridge();
1830
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1831
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1832
+ }
1833
+ function analyzeClassesNative(filesJson, cwd, flags) {
1834
+ const native = getNativeBridge();
1835
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1836
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1837
+ }
1838
+ function analyzeRscNative(source, filename) {
1839
+ const native = getNativeBridge();
1840
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1841
+ return native.analyzeRsc(source, filename);
1842
+ }
1843
+ function optimizeCssNative(css) {
1844
+ const native = getNativeBridge();
1845
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1846
+ const result = native.processTailwindCssLightning(css);
1847
+ return {
1848
+ css: result.css,
1849
+ originalSize: css.length,
1850
+ optimizedSize: result.size_bytes,
1851
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1852
+ };
1853
+ }
1854
+ function processTailwindCssLightning(css) {
1855
+ const native = getNativeBridge();
1856
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1857
+ return native.processTailwindCssLightning(css);
1858
+ }
1859
+ function eliminateDeadCssNative(css, deadClasses) {
1860
+ const native = getNativeBridge();
1861
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1862
+ return native.eliminateDeadCss(css, deadClasses);
1863
+ }
1864
+ function hoistComponentsNative(source) {
1865
+ const native = getNativeBridge();
1866
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1867
+ return native.hoistComponents(source);
1868
+ }
1869
+ function compileVariantTableNative(configJson) {
1870
+ const native = getNativeBridge();
1871
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1872
+ return native.compileVariantTable(configJson);
1873
+ }
1874
+ function classifyAndSortClassesNative(classes) {
1875
+ const native = getNativeBridge();
1876
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1877
+ return native.classifyAndSortClasses(classes);
1878
+ }
1879
+ function mergeCssDeclarationsNative(cssChunks) {
1880
+ const native = getNativeBridge();
1881
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1882
+ return native.mergeCssDeclarations(cssChunks);
1883
+ }
1884
+ var init_analyzerNative = __esm({
1885
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1886
+ init_nativeBridge();
1887
+ }
1888
+ });
1889
+
1890
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1891
+ function resolveVariants(configJson) {
1892
+ const native = getNativeBridge();
1893
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1894
+ const resultJson = native.resolve_variants(configJson);
1895
+ try {
1896
+ return JSON.parse(resultJson);
1897
+ } catch {
1898
+ return {
1899
+ variants: [],
1900
+ supported: [],
1901
+ deprecated: [],
1902
+ conflicting: []
1903
+ };
1904
+ }
1905
+ }
1906
+ function validateThemeConfig(configJson) {
1907
+ const native = getNativeBridge();
1908
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1909
+ const resultJson = native.validate_variant_config(configJson);
1910
+ try {
1911
+ return JSON.parse(resultJson);
1912
+ } catch {
1913
+ return {
1914
+ is_valid: false,
1915
+ errors: ["Unable to parse configuration"],
1916
+ warnings: [],
1917
+ suggestions: []
1918
+ };
1919
+ }
1920
+ }
1921
+ function resolveCascade(baseThemeJson, overridesJson) {
1922
+ const native = getNativeBridge();
1923
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1924
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1925
+ try {
1926
+ return JSON.parse(resultJson);
1927
+ } catch {
1928
+ return {
1929
+ base_theme: {},
1930
+ user_overrides: {},
1931
+ merged_theme: {},
1932
+ conflict_resolutions: []
1933
+ };
1934
+ }
1935
+ }
1936
+ function resolveClassNames(classNames, themeJson) {
1937
+ const native = getNativeBridge();
1938
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1939
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1940
+ try {
1941
+ return JSON.parse(resultJson);
1942
+ } catch {
1943
+ return [];
1944
+ }
1945
+ }
1946
+ function resolveConflictGroup(groupName, themeJson) {
1947
+ const native = getNativeBridge();
1948
+ if (!native?.resolve_conflict_group)
1949
+ throw new Error("resolve_conflict_group not available");
1950
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1951
+ try {
1952
+ return JSON.parse(resultJson);
1953
+ } catch {
1954
+ return {
1955
+ group_name: groupName,
1956
+ conflicting_classes: [],
1957
+ description: "",
1958
+ resolution_strategy: "last-wins"
1959
+ };
1960
+ }
1961
+ }
1962
+ function resolveThemeValue(keyPath, themeJson) {
1963
+ const native = getNativeBridge();
1964
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1965
+ return native.resolve_theme_value(keyPath, themeJson);
1966
+ }
1967
+ function resolveSimpleVariants(configJson) {
1968
+ const native = getNativeBridge();
1969
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1970
+ const resultJson = native.resolve_simple_variants(configJson);
1971
+ try {
1972
+ return JSON.parse(resultJson);
1973
+ } catch {
1974
+ return [];
1975
+ }
1976
+ }
1977
+ var init_themeResolutionNative = __esm({
1978
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
1979
+ init_nativeBridge();
1980
+ }
1981
+ });
1982
+
1983
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
1984
+ function scanWorkspace(root, extensions) {
1985
+ const native = getNativeBridge();
1986
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
1987
+ return native.scan_workspace(root, extensions);
1988
+ }
1989
+ function extractClassesFromSourceNative(source) {
1990
+ const native = getNativeBridge();
1991
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
1992
+ return native.extract_classes_from_source(source);
1993
+ }
1994
+ function batchExtractClassesNative(filePaths) {
1995
+ const native = getNativeBridge();
1996
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
1997
+ return native.batch_extract_classes(filePaths);
1998
+ }
1999
+ function checkAgainstSafelistNative(classes, safelist) {
2000
+ const native = getNativeBridge();
2001
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
2002
+ return native.check_against_safelist(classes, safelist);
2003
+ }
2004
+ function scanFile(filePath) {
2005
+ const native = getNativeBridge();
2006
+ if (!native?.scan_file) throw new Error("scan_file not available");
2007
+ return native.scan_file(filePath);
2008
+ }
2009
+ function collectFiles(root, extensions) {
2010
+ const native = getNativeBridge();
2011
+ if (!native?.collect_files) throw new Error("collect_files not available");
2012
+ return native.collect_files(root, extensions);
2013
+ }
2014
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
2015
+ const native = getNativeBridge();
2016
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
2017
+ return native.walk_and_prefilter_source_files(root, extensions);
2018
+ }
2019
+ function generateSubComponentTypes(root, outputPath) {
2020
+ const native = getNativeBridge();
2021
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
2022
+ return native.generate_sub_component_types(root, outputPath);
2023
+ }
2024
+ var init_scannerNative = __esm({
2025
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2026
+ init_nativeBridge();
2027
+ }
2028
+ });
2029
+
2030
+ // packages/domain/compiler/src/analyzer/index.ts
2031
+ var init_analyzer = __esm({
2032
+ "packages/domain/compiler/src/analyzer/index.ts"() {
2033
+ init_analyzerNative();
2034
+ init_themeResolutionNative();
2035
+ init_scannerNative();
2036
+ }
2037
+ });
2038
+
2039
+ // packages/domain/compiler/src/cache/cacheNative.ts
2040
+ function getCacheStatistics() {
2041
+ const native = getNativeBridge();
2042
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
2043
+ const statsJson = native.get_cache_statistics();
2044
+ try {
2045
+ return JSON.parse(statsJson);
2046
+ } catch {
2047
+ return {
2048
+ parse_cache: { hits: 0, misses: 0, size: 0 },
2049
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2050
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2051
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2052
+ overall_hit_rate: 0,
2053
+ total_memory_bytes: 0
2054
+ };
2055
+ }
2056
+ }
2057
+ function clearAllCaches() {
2058
+ const native = getNativeBridge();
2059
+ if (!native?.clear_all_caches) return;
2060
+ try {
2061
+ native.clear_all_caches();
2062
+ } catch {
2063
+ }
2064
+ }
2065
+ function clearParseCache() {
2066
+ const native = getNativeBridge();
2067
+ if (!native?.clear_parse_cache) return;
2068
+ try {
2069
+ native.clear_parse_cache();
2070
+ } catch {
2071
+ }
2072
+ }
2073
+ function clearResolveCache() {
2074
+ const native = getNativeBridge();
2075
+ if (!native?.clear_resolve_cache) return;
2076
+ try {
2077
+ native.clear_resolve_cache();
2078
+ } catch {
2079
+ }
2080
+ }
2081
+ function clearCompileCache() {
2082
+ const native = getNativeBridge();
2083
+ if (!native?.clear_compile_cache) return;
2084
+ try {
2085
+ native.clear_compile_cache();
2086
+ } catch {
2087
+ }
2088
+ }
2089
+ function clearCssGenCache() {
2090
+ const native = getNativeBridge();
2091
+ if (!native?.clear_css_gen_cache) return;
2092
+ try {
2093
+ native.clear_css_gen_cache();
2094
+ } catch {
2095
+ }
2096
+ }
2097
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2098
+ const native = getNativeBridge();
2099
+ if (!native?.get_cache_optimization_hints)
2100
+ throw new Error("get_cache_optimization_hints not available");
2101
+ const hintsJson = native.get_cache_optimization_hints(
2102
+ Math.min(100, Math.max(0, hitRatePercent)),
2103
+ Math.max(1, memoryUsedMb)
2104
+ );
2105
+ try {
2106
+ return JSON.parse(hintsJson);
2107
+ } catch {
2108
+ return {
2109
+ current_strategy: "unknown",
2110
+ recommended_strategy: "increase_size",
2111
+ estimated_improvement_percent: 0,
2112
+ suggested_memory_mb: 256,
2113
+ notes: ["Unable to analyze cache statistics"]
2114
+ };
2115
+ }
2116
+ }
2117
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2118
+ const native = getNativeBridge();
2119
+ if (!native?.estimate_optimal_cache_config_native)
2120
+ throw new Error("estimate_optimal_cache_config_native not available");
2121
+ const configJson = native.estimate_optimal_cache_config_native(
2122
+ Math.max(64, totalBudgetMb),
2123
+ workloadType
2124
+ );
2125
+ try {
2126
+ return JSON.parse(configJson);
2127
+ } catch {
2128
+ return {
2129
+ parse_cache_size: 128,
2130
+ resolve_cache_size: 64,
2131
+ compile_cache_size: 256,
2132
+ css_gen_cache_size: 128,
2133
+ recommended_eviction_policy: "lru",
2134
+ ttl_seconds: 3600,
2135
+ expected_hit_rate_percent: 75
2136
+ };
2137
+ }
2138
+ }
2139
+ function cacheRead(cachePath) {
2140
+ const native = getNativeBridge();
2141
+ if (!native?.cache_read) throw new Error("cache_read not available");
2142
+ const result = native.cache_read(cachePath);
2143
+ try {
2144
+ return JSON.parse(result.entries_json || "[]");
2145
+ } catch {
2146
+ return [];
2147
+ }
2148
+ }
2149
+ function cacheWrite(cachePath, entries) {
2150
+ const native = getNativeBridge();
2151
+ if (!native?.cache_write) throw new Error("cache_write not available");
2152
+ try {
2153
+ const result = native.cache_write(
2154
+ cachePath,
2155
+ entries.map((e) => ({
2156
+ file: e.file,
2157
+ content_hash: e.contentHash,
2158
+ classes: e.classes,
2159
+ mtime_ms: e.mtimeMs,
2160
+ size_bytes: e.sizeBytes
2161
+ }))
2162
+ );
2163
+ return typeof result === "boolean" ? result : result === true;
2164
+ } catch {
2165
+ return false;
2166
+ }
2167
+ }
2168
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2169
+ const native = getNativeBridge();
2170
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2171
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2172
+ }
2173
+ var init_cacheNative = __esm({
2174
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2175
+ init_nativeBridge();
2176
+ }
2177
+ });
2178
+
2179
+ // packages/domain/compiler/src/cache/index.ts
2180
+ var init_cache = __esm({
2181
+ "packages/domain/compiler/src/cache/index.ts"() {
2182
+ init_cacheNative();
2183
+ }
2184
+ });
2185
+
2186
+ // packages/domain/compiler/src/redis/redisNative.ts
2187
+ function redisPing() {
2188
+ const native = getNativeBridge();
2189
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2190
+ return native.redis_ping();
2191
+ }
2192
+ function redisGet(key) {
2193
+ const native = getNativeBridge();
2194
+ if (!native?.redis_get) throw new Error("redis_get not available");
2195
+ const result = native.redis_get(key);
2196
+ return result === "nil" ? null : result;
2197
+ }
2198
+ function redisSet(key, value, ttl_seconds) {
2199
+ const native = getNativeBridge();
2200
+ if (!native?.redis_set) throw new Error("redis_set not available");
2201
+ return native.redis_set(key, value, ttl_seconds);
2202
+ }
2203
+ function redisDelete(key) {
2204
+ const native = getNativeBridge();
2205
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2206
+ return native.redis_delete(key);
2207
+ }
2208
+ function redisExists(key) {
2209
+ const native = getNativeBridge();
2210
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2211
+ return native.redis_exists(key);
2212
+ }
2213
+ function redisMget(keys) {
2214
+ const native = getNativeBridge();
2215
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2216
+ const result = native.redis_mget(keys);
2217
+ try {
2218
+ return JSON.parse(result);
2219
+ } catch {
2220
+ return keys.map(() => null);
2221
+ }
2222
+ }
2223
+ function redisMset(pairs) {
2224
+ const native = getNativeBridge();
2225
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2226
+ return native.redis_mset(pairs);
2227
+ }
2228
+ function redisFlushDb() {
2229
+ const native = getNativeBridge();
2230
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2231
+ return native.redis_flush_db();
2232
+ }
2233
+ function redisFlushAll() {
2234
+ const native = getNativeBridge();
2235
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2236
+ return native.redis_flush_all();
2237
+ }
2238
+ function redisPoolConnect(host, port, pool_size) {
2239
+ const native = getNativeBridge();
2240
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2241
+ return native.redis_pool_connect(host, port, pool_size);
2242
+ }
2243
+ function redisPoolStats() {
2244
+ const native = getNativeBridge();
2245
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2246
+ const result = native.redis_pool_stats();
2247
+ try {
2248
+ return JSON.parse(result);
2249
+ } catch {
2250
+ return {
2251
+ connected_count: 0,
2252
+ idle_count: 0,
2253
+ waiting_count: 0,
2254
+ total_requests: 0,
2255
+ total_errors: 0
2256
+ };
2257
+ }
2258
+ }
2259
+ function redisPoolReconnect() {
2260
+ const native = getNativeBridge();
2261
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2262
+ return native.redis_pool_reconnect();
2263
+ }
2264
+ function redisEnableCluster(initial_nodes) {
2265
+ const native = getNativeBridge();
2266
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2267
+ const result = native.redis_enable_cluster(initial_nodes);
2268
+ try {
2269
+ return JSON.parse(result);
2270
+ } catch {
2271
+ return {
2272
+ enabled: false,
2273
+ cluster_state: "error",
2274
+ nodes: [],
2275
+ slots_assigned: 0,
2276
+ slots_ok: 0,
2277
+ slots_fail: 0
2278
+ };
2279
+ }
2280
+ }
2281
+ function redisDisableCluster() {
2282
+ const native = getNativeBridge();
2283
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2284
+ return native.redis_disable_cluster();
2285
+ }
2286
+ function redisClusterStatus() {
2287
+ const native = getNativeBridge();
2288
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2289
+ const result = native.redis_cluster_status();
2290
+ try {
2291
+ return JSON.parse(result);
2292
+ } catch {
2293
+ return {
2294
+ enabled: false,
2295
+ cluster_state: "unknown",
2296
+ nodes: [],
2297
+ slots_assigned: 0,
2298
+ slots_ok: 0,
2299
+ slots_fail: 0
2300
+ };
2301
+ }
2302
+ }
2303
+ function redisSubscribe(channel) {
2304
+ const native = getNativeBridge();
2305
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2306
+ return native.redis_subscribe(channel);
2307
+ }
2308
+ function redisPublish(channel, message) {
2309
+ const native = getNativeBridge();
2310
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2311
+ return native.redis_publish(channel, message);
2312
+ }
2313
+ function redisExpirationSet(key, ttl_seconds) {
2314
+ const native = getNativeBridge();
2315
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2316
+ return native.redis_expiration_set(key, ttl_seconds);
2317
+ }
2318
+ function redisExpirationGet(key) {
2319
+ const native = getNativeBridge();
2320
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2321
+ const result = native.redis_expiration_get(key);
2322
+ try {
2323
+ return JSON.parse(result);
2324
+ } catch {
2325
+ return {
2326
+ key,
2327
+ ttl_seconds: -1,
2328
+ expiration_timestamp: 0,
2329
+ is_persistent: true
2330
+ };
2331
+ }
2332
+ }
2333
+ function redisInfo() {
2334
+ const native = getNativeBridge();
2335
+ if (!native?.redis_info) throw new Error("redis_info not available");
2336
+ return native.redis_info();
2337
+ }
2338
+ function redisMonitor() {
2339
+ const native = getNativeBridge();
2340
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2341
+ return native.redis_monitor();
2342
+ }
2343
+ function redisCacheSize() {
2344
+ const native = getNativeBridge();
2345
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2346
+ return native.redis_cache_size();
2347
+ }
2348
+ function redisCacheKeyCount() {
2349
+ const native = getNativeBridge();
2350
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2351
+ return native.redis_cache_key_count();
2352
+ }
2353
+ function redisCacheClear() {
2354
+ const native = getNativeBridge();
2355
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2356
+ return native.redis_cache_clear();
2357
+ }
2358
+ function redisCacheHitRate() {
2359
+ const native = getNativeBridge();
2360
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2361
+ return native.redis_cache_hit_rate();
2362
+ }
2363
+ function redisEnablePersistence(mode) {
2364
+ const native = getNativeBridge();
2365
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2366
+ return native.redis_enable_persistence(mode);
2367
+ }
2368
+ function redisDisablePersistence() {
2369
+ const native = getNativeBridge();
2370
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2371
+ return native.redis_disable_persistence();
2372
+ }
2373
+ function redisSnapshot() {
2374
+ const native = getNativeBridge();
2375
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2376
+ return native.redis_snapshot();
2377
+ }
2378
+ function redisMemoryStats() {
2379
+ const native = getNativeBridge();
2380
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2381
+ return native.redis_memory_stats();
2382
+ }
2383
+ function redisOptimizeMemory() {
2384
+ const native = getNativeBridge();
2385
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2386
+ return native.redis_optimize_memory();
2387
+ }
2388
+ function redisSetEvictionPolicy(policy) {
2389
+ const native = getNativeBridge();
2390
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2391
+ return native.redis_set_eviction_policy(policy);
2392
+ }
2393
+ function redisGetEvictionPolicy() {
2394
+ const native = getNativeBridge();
2395
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2396
+ return native.redis_get_eviction_policy();
2397
+ }
2398
+ function redisReplicate(target_host, target_port) {
2399
+ const native = getNativeBridge();
2400
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2401
+ return native.redis_replicate(target_host, target_port);
2402
+ }
2403
+ function redisReplicationStatus() {
2404
+ const native = getNativeBridge();
2405
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2406
+ return native.redis_replication_status();
2407
+ }
2408
+ function redisCacheSync(peers) {
2409
+ const native = getNativeBridge();
2410
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2411
+ return native.redis_cache_sync(peers);
2412
+ }
2413
+ function redisEnableCacheWarming(key_pattern) {
2414
+ const native = getNativeBridge();
2415
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2416
+ return native.redis_enable_cache_warming(key_pattern);
2417
+ }
2418
+ function redisDisableCacheWarming() {
2419
+ const native = getNativeBridge();
2420
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2421
+ return native.redis_disable_cache_warming();
2422
+ }
2423
+ function redisDiagnose() {
2424
+ const native = getNativeBridge();
2425
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2426
+ return native.redis_diagnose();
2427
+ }
2428
+ var init_redisNative = __esm({
2429
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2430
+ init_nativeBridge();
2431
+ }
2432
+ });
2433
+
2434
+ // packages/domain/compiler/src/redis/index.ts
2435
+ var init_redis = __esm({
2436
+ "packages/domain/compiler/src/redis/index.ts"() {
2437
+ init_redisNative();
2438
+ }
2439
+ });
2440
+
2441
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2442
+ function startWatch(root_path, patterns) {
2443
+ const native = getNativeBridge();
2444
+ if (!native?.start_watch) throw new Error("start_watch not available");
2445
+ return native.start_watch(root_path, patterns);
2446
+ }
2447
+ function pollWatchEvents(handle, timeout_ms) {
2448
+ const native = getNativeBridge();
2449
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2450
+ const result = native.poll_watch_events(handle, timeout_ms);
2451
+ try {
2452
+ return JSON.parse(result);
2453
+ } catch {
2454
+ return [];
2455
+ }
2456
+ }
2457
+ function stopWatch(handle) {
2458
+ const native = getNativeBridge();
2459
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2460
+ return native.stop_watch(handle);
2461
+ }
2462
+ function watchAddPattern(handle, pattern) {
2463
+ const native = getNativeBridge();
2464
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2465
+ return native.watch_add_pattern(handle, pattern);
2466
+ }
2467
+ function watchRemovePattern(handle, pattern) {
2468
+ const native = getNativeBridge();
2469
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2470
+ return native.watch_remove_pattern(handle, pattern);
2471
+ }
2472
+ function watchGetActiveHandles() {
2473
+ const native = getNativeBridge();
2474
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2475
+ const result = native.watch_get_active_handles();
2476
+ try {
2477
+ return JSON.parse(result);
2478
+ } catch {
2479
+ return [];
2480
+ }
2481
+ }
2482
+ function watchClearAll() {
2483
+ const native = getNativeBridge();
2484
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2485
+ return native.watch_clear_all();
2486
+ }
2487
+ function watchEventTypeToString(event_type_code) {
2488
+ const native = getNativeBridge();
2489
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2490
+ return native.watch_event_type_to_string(event_type_code);
1271
2491
  }
1272
- function processTailwindCssWithTargets(css, targets) {
2492
+ function isWatchRunning(handle) {
1273
2493
  const native = getNativeBridge();
1274
- if (!native?.processTailwindCssWithTargets) {
1275
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
2494
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2495
+ return native.is_watch_running(handle);
2496
+ }
2497
+ function getWatchStats() {
2498
+ const native = getNativeBridge();
2499
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2500
+ const result = native.get_watch_stats();
2501
+ try {
2502
+ return JSON.parse(result);
2503
+ } catch {
2504
+ return {
2505
+ active_watchers: 0,
2506
+ total_events: 0,
2507
+ events_this_second: 0,
2508
+ average_latency_ms: 0,
2509
+ largest_batch_size: 0
2510
+ };
1276
2511
  }
1277
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
1278
- if (!result?.css) {
1279
- throw new Error("FATAL: processTailwindCssWithTargets returned null");
2512
+ }
2513
+ function watchPause(handle) {
2514
+ const native = getNativeBridge();
2515
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2516
+ return native.watch_pause(handle);
2517
+ }
2518
+ function watchResume(handle) {
2519
+ const native = getNativeBridge();
2520
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2521
+ return native.watch_resume(handle);
2522
+ }
2523
+ function scanCacheOptimizations() {
2524
+ const native = getNativeBridge();
2525
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2526
+ return native.scan_cache_optimizations();
2527
+ }
2528
+ function getPluginHooks() {
2529
+ const native = getNativeBridge();
2530
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2531
+ const result = native.get_plugin_hooks();
2532
+ try {
2533
+ return JSON.parse(result);
2534
+ } catch {
2535
+ return [];
1280
2536
  }
1281
- return result.css;
1282
2537
  }
1283
- var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
1284
- var init_tailwindEngine = __esm({
1285
- "packages/domain/compiler/src/tailwindEngine.ts"() {
2538
+ function registerPluginHook(hook_name, handler_id) {
2539
+ const native = getNativeBridge();
2540
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2541
+ return native.register_plugin_hook(hook_name, handler_id);
2542
+ }
2543
+ function unregisterPluginHook(hook_name, handler_id) {
2544
+ const native = getNativeBridge();
2545
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2546
+ return native.unregister_plugin_hook(hook_name, handler_id);
2547
+ }
2548
+ function emitPluginHook(hook_name, data_json) {
2549
+ const native = getNativeBridge();
2550
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2551
+ return native.emit_plugin_hook(hook_name, data_json);
2552
+ }
2553
+ function getCompilationMetrics() {
2554
+ const native = getNativeBridge();
2555
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2556
+ return native.get_compilation_metrics();
2557
+ }
2558
+ function resetCompilationMetrics() {
2559
+ const native = getNativeBridge();
2560
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2561
+ return native.reset_compilation_metrics();
2562
+ }
2563
+ function validateCssOutput(css) {
2564
+ const native = getNativeBridge();
2565
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2566
+ return native.validate_css_output(css);
2567
+ }
2568
+ function getCompilerDiagnostics() {
2569
+ const native = getNativeBridge();
2570
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2571
+ return native.get_compiler_diagnostics();
2572
+ }
2573
+ var init_watchSystemNative = __esm({
2574
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
1286
2575
  init_nativeBridge();
1287
- init_cssGeneratorNative();
1288
- require2 = createRequire(import.meta.url);
1289
- _cssCache = /* @__PURE__ */ new Map();
1290
- _cacheHits = 0;
1291
- _cacheMisses = 0;
1292
- MAX_CACHE_SIZE = 100;
1293
- _twEngine = null;
1294
- _twEngineError = null;
1295
2576
  }
1296
2577
  });
1297
2578
 
1298
- // packages/domain/compiler/src/cssGeneratorNative.ts
1299
- async function generateCssNative(classes, options) {
1300
- const {
1301
- theme,
1302
- fallbackToJs = true,
1303
- logFallback = false
1304
- } = options;
1305
- try {
1306
- const native = getNativeBridge();
1307
- if (!native?.generateCssNative) {
1308
- throw new Error("generateCssNative not available in native binding");
1309
- }
1310
- const themeJson = JSON.stringify(theme);
1311
- const css = native.generateCssNative(classes, themeJson);
1312
- return css;
1313
- } catch (error) {
1314
- if (!fallbackToJs) {
1315
- throw error;
1316
- }
1317
- if (logFallback) {
1318
- console.warn(
1319
- "[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
1320
- error instanceof Error ? error.message : String(error)
1321
- );
1322
- }
1323
- return generateRawCss(classes);
1324
- }
1325
- }
1326
- var init_cssGeneratorNative = __esm({
1327
- "packages/domain/compiler/src/cssGeneratorNative.ts"() {
1328
- init_nativeBridge();
1329
- init_tailwindEngine();
2579
+ // packages/domain/compiler/src/watch/index.ts
2580
+ var init_watch = __esm({
2581
+ "packages/domain/compiler/src/watch/index.ts"() {
2582
+ init_watchSystemNative();
1330
2583
  }
1331
2584
  });
1332
2585
  function _layoutClassesToCss(classes) {
@@ -1363,10 +2616,16 @@ function extractContainerCssFromSource(source) {
1363
2616
  }
1364
2617
  return rules.join("\n");
1365
2618
  }
1366
- 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;
2619
+ 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;
1367
2620
  var init_src = __esm({
1368
2621
  "packages/domain/compiler/src/index.ts"() {
1369
2622
  init_nativeBridge();
2623
+ init_compiler();
2624
+ init_parser();
2625
+ init_analyzer();
2626
+ init_cache();
2627
+ init_redis();
2628
+ init_watch();
1370
2629
  transformSource = (source, opts) => {
1371
2630
  const native = getNativeBridge();
1372
2631
  if (!native?.transformSource) {
@@ -1410,58 +2669,19 @@ var init_src = __esm({
1410
2669
  const result = compileCssFromClasses(classes);
1411
2670
  return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
1412
2671
  };
1413
- compileCssNative = (classes, prefix = null) => {
1414
- return compileCssFromClasses(classes, prefix);
1415
- };
1416
2672
  generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
1417
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1418
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1419
- return result.css;
1420
- };
1421
- extractAllClasses = (source) => {
1422
- const native = getNativeBridge();
1423
- if (!native?.extractAllClasses) {
1424
- throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1425
- }
1426
- return native.extractAllClasses(source) || [];
1427
- };
1428
- extractClassesFromSource = (source) => {
1429
- const native = getNativeBridge();
1430
- if (!native?.extractClassesFromSource) {
1431
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1432
- }
1433
- const result = native.extractClassesFromSource(source);
1434
- return Array.isArray(result) ? result.join(" ") : String(result || "");
1435
- };
1436
- astExtractClasses = (source, _filename) => {
1437
- const native = getNativeBridge();
1438
- if (!native?.extractClassesFromSource) {
1439
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1440
- }
1441
- return native.extractClassesFromSource(source) || [];
1442
- };
1443
- parseClasses = (raw) => {
1444
- const native = getNativeBridge();
1445
- if (!native?.parseClasses) {
1446
- throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1447
- }
1448
- return native.parseClasses(raw) || [];
1449
- };
1450
- normalizeClasses = (raw) => {
1451
- const result = normalizeAndDedupClasses(raw);
1452
- return result?.normalized || "";
1453
- };
1454
- mergeClassesStatic = (classes) => {
1455
- const result = normalizeAndDedupClasses(classes);
1456
- return result?.normalized || "";
1457
- };
1458
- normalizeAndDedupClasses = (raw) => {
1459
- const native = getNativeBridge();
1460
- if (!native?.normalizeAndDedupClasses) {
1461
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
2673
+ try {
2674
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2675
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2676
+ return result.css;
2677
+ } catch {
2678
+ const native = getNativeBridge();
2679
+ if (!native?.transformSource) {
2680
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2681
+ }
2682
+ const result = native.transformSource(classes.join(" "), {});
2683
+ return result?.code || "";
1462
2684
  }
1463
- const result = native.normalizeAndDedupClasses(raw);
1464
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1465
2685
  };
1466
2686
  eliminateDeadCss = (css, deadClasses) => {
1467
2687
  const native = getNativeBridge();
@@ -1494,16 +2714,10 @@ var init_src = __esm({
1494
2714
  const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
1495
2715
  return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
1496
2716
  };
1497
- optimizeCss = (css) => {
1498
- const native = getNativeBridge();
1499
- if (!native?.optimizeCss) {
1500
- throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
1501
- }
1502
- return native.optimizeCss(css);
1503
- };
1504
2717
  scanProjectUsage = (dirs, cwd) => {
2718
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
1505
2719
  const files = dirs.map((dir) => path9__default.resolve(cwd, dir));
1506
- const results = batchExtractClasses(files) || [];
2720
+ const results = batchExtractClasses2(files) || [];
1507
2721
  const combined = {};
1508
2722
  for (const result of results) {
1509
2723
  if (result.ok && result.classes) {
@@ -1515,109 +2729,6 @@ var init_src = __esm({
1515
2729
  }
1516
2730
  return combined;
1517
2731
  };
1518
- extractComponentUsage = (source) => {
1519
- const native = getNativeBridge();
1520
- if (!native?.extractComponentUsage) {
1521
- throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1522
- }
1523
- return native.extractComponentUsage(source) || [];
1524
- };
1525
- diffClassLists = (previous, current) => {
1526
- const native = getNativeBridge();
1527
- if (!native?.diffClassLists) {
1528
- throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1529
- }
1530
- return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1531
- };
1532
- batchExtractClasses = (filePaths) => {
1533
- const native = getNativeBridge();
1534
- if (!native?.batchExtractClasses) {
1535
- throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1536
- }
1537
- return native.batchExtractClasses(filePaths) || [];
1538
- };
1539
- checkAgainstSafelist = (classes, safelist) => {
1540
- const native = getNativeBridge();
1541
- if (!native?.checkAgainstSafelist) {
1542
- throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1543
- }
1544
- return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1545
- };
1546
- hoistComponents = (source) => {
1547
- const native = getNativeBridge();
1548
- if (!native?.hoistComponents) {
1549
- throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
1550
- }
1551
- return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
1552
- };
1553
- compileVariantTable = (configJson) => {
1554
- const native = getNativeBridge();
1555
- if (!native?.compileVariantTable) {
1556
- throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
1557
- }
1558
- return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
1559
- };
1560
- compileVariants = (componentId, config) => {
1561
- return compileVariantTable(JSON.stringify({ componentId, ...config }));
1562
- };
1563
- classifyAndSortClasses = (classes) => {
1564
- const native = getNativeBridge();
1565
- if (!native?.classifyAndSortClasses) {
1566
- throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
1567
- }
1568
- return native.classifyAndSortClasses(classes) || [];
1569
- };
1570
- mergeCssDeclarations = (cssChunks) => {
1571
- const native = getNativeBridge();
1572
- if (!native?.mergeCssDeclarations) {
1573
- throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
1574
- }
1575
- return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
1576
- };
1577
- analyzeClassUsage = (classes, scanResultJson, css) => {
1578
- const native = getNativeBridge();
1579
- if (!native?.analyzeClassUsage) {
1580
- throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
1581
- }
1582
- return native.analyzeClassUsage(classes, scanResultJson, css) || [];
1583
- };
1584
- analyzeRsc = (source, filename) => {
1585
- const native = getNativeBridge();
1586
- if (!native?.analyzeRsc) {
1587
- throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
1588
- }
1589
- return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
1590
- };
1591
- analyzeFile = (source, filename) => {
1592
- const rsc = analyzeRsc(source, filename);
1593
- return {
1594
- isServer: rsc?.isServer ?? true,
1595
- needsClientDirective: rsc?.needsClientDirective ?? false,
1596
- clientReasons: rsc?.clientReasons ?? [],
1597
- interactiveClasses: [],
1598
- canStaticResolveVariants: true
1599
- };
1600
- };
1601
- analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
1602
- return { resolved: {}, dynamic: [] };
1603
- };
1604
- injectClientDirective = (source) => {
1605
- if (!source.includes('"use client"') && !source.includes("'use client'")) {
1606
- return '"use client";\n' + source;
1607
- }
1608
- return source;
1609
- };
1610
- injectServerOnlyComment = (source) => {
1611
- return `/* @server-only */
1612
- ${source}`;
1613
- };
1614
- analyzeClasses = (filesJson, cwd, flags) => {
1615
- const native = getNativeBridge();
1616
- if (!native?.analyzeClasses) {
1617
- throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
1618
- }
1619
- return native.analyzeClasses(filesJson, cwd, flags);
1620
- };
1621
2732
  generateSafelist = (scanDirs, outputPath, cwd) => {
1622
2733
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
1623
2734
  const allClasses = Object.keys(classes).sort();
@@ -1681,7 +2792,8 @@ ${source}`;
1681
2792
  if (containerCss) cssChunks.push(containerCss);
1682
2793
  const combined = cssChunks.join("\n").trim();
1683
2794
  if (combined) staticCss = combined;
1684
- } catch {
2795
+ } catch (err) {
2796
+ console.debug("Static CSS extraction warning:", err);
1685
2797
  }
1686
2798
  return {
1687
2799
  code: result?.code || "",
@@ -1766,7 +2878,46 @@ ${source}`;
1766
2878
  return [];
1767
2879
  };
1768
2880
  bucketSort = (classes) => {
1769
- return classifyAndSortClasses(classes).map((c) => c.raw ?? c);
2881
+ const native = getNativeBridge();
2882
+ if (!native?.classifyAndSortClasses) {
2883
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2884
+ }
2885
+ const sorted = native.classifyAndSortClasses(classes);
2886
+ return sorted.map((c) => c.raw ?? c);
2887
+ };
2888
+ analyzeFile = (source, filename) => {
2889
+ const native = getNativeBridge();
2890
+ if (!native?.analyzeRsc) {
2891
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2892
+ }
2893
+ const rsc = native.analyzeRsc(source, filename);
2894
+ return {
2895
+ isServer: rsc?.isServer ?? true,
2896
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2897
+ clientReasons: rsc?.clientReasons ?? [],
2898
+ interactiveClasses: [],
2899
+ canStaticResolveVariants: true
2900
+ };
2901
+ };
2902
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2903
+ return { resolved: {}, dynamic: [] };
2904
+ };
2905
+ injectClientDirective = (source) => {
2906
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2907
+ return '"use client";\n' + source;
2908
+ }
2909
+ return source;
2910
+ };
2911
+ injectServerOnlyComment = (source) => {
2912
+ return `/* @server-only */
2913
+ ${source}`;
2914
+ };
2915
+ analyzeClasses = (filesJson, cwd, flags) => {
2916
+ const native = getNativeBridge();
2917
+ if (!native?.analyzeClasses) {
2918
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2919
+ }
2920
+ return native.analyzeClasses(filesJson, cwd, flags);
1770
2921
  };
1771
2922
  extractTwStateConfigs = (source, filename) => {
1772
2923
  const native = getNativeBridge();
@@ -1775,23 +2926,25 @@ ${source}`;
1775
2926
  }
1776
2927
  return native.extractTwStateConfigs(source, filename);
1777
2928
  };
1778
- generateStaticStateCss = (inputs, resolvedCss = null) => {
1779
- const native = getNativeBridge();
1780
- if (!native?.generateStaticStateCss) {
1781
- throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2929
+ generateStaticStateCss = (entries, _themeConfig) => {
2930
+ const rules = [];
2931
+ for (const entry of entries) {
2932
+ const stateConfig = JSON.parse(entry.statesJson);
2933
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2934
+ rules.push({
2935
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2936
+ declarations: classes,
2937
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2938
+ componentName: entry.componentName,
2939
+ stateName
2940
+ });
2941
+ }
1782
2942
  }
1783
- return native.generateStaticStateCss(inputs, resolvedCss);
2943
+ return rules;
1784
2944
  };
1785
2945
  extractAndGenerateStateCss = (source, filename) => {
1786
- const native = getNativeBridge();
1787
- if (!native?.extractAndGenerateStateCss) {
1788
- const configs = extractTwStateConfigs(source, filename);
1789
- if (configs.length === 0) return [];
1790
- return generateStaticStateCss(
1791
- configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
1792
- );
1793
- }
1794
- return native.extractAndGenerateStateCss(source, filename);
2946
+ const entries = extractTwStateConfigs(source, filename);
2947
+ return generateStaticStateCss(entries);
1795
2948
  };
1796
2949
  }
1797
2950
  });
@@ -1800,75 +2953,219 @@ ${source}`;
1800
2953
  var internal_exports = {};
1801
2954
  __export(internal_exports, {
1802
2955
  adaptNativeResult: () => adaptNativeResult,
1803
- analyzeClassUsage: () => analyzeClassUsage,
2956
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
1804
2957
  analyzeClasses: () => analyzeClasses,
2958
+ analyzeClassesNative: () => analyzeClassesNative,
1805
2959
  analyzeFile: () => analyzeFile,
1806
- analyzeRsc: () => analyzeRsc,
2960
+ analyzeRscNative: () => analyzeRscNative,
1807
2961
  analyzeVariantUsage: () => analyzeVariantUsage,
1808
2962
  astExtractClasses: () => astExtractClasses,
2963
+ atomicRegistrySize: () => atomicRegistrySize,
1809
2964
  batchExtractClasses: () => batchExtractClasses,
2965
+ batchExtractClassesNative: () => batchExtractClassesNative,
1810
2966
  bucketSort: () => bucketSort,
1811
2967
  buildStyleTag: () => buildStyleTag,
2968
+ cachePriority: () => cachePriority,
2969
+ cacheRead: () => cacheRead,
2970
+ cacheWrite: () => cacheWrite,
1812
2971
  checkAgainstSafelist: () => checkAgainstSafelist,
1813
- classifyAndSortClasses: () => classifyAndSortClasses,
2972
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2973
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
1814
2974
  classifyNode: () => classifyNode,
2975
+ clearAllCaches: () => clearAllCaches,
2976
+ clearAtomicRegistry: () => clearAtomicRegistry,
1815
2977
  clearCache: () => clearCache,
2978
+ clearCompileCache: () => clearCompileCache,
2979
+ clearCssGenCache: () => clearCssGenCache,
2980
+ clearParseCache: () => clearParseCache,
2981
+ clearResolveCache: () => clearResolveCache,
2982
+ clearThemeCache: () => clearThemeCache,
2983
+ collectFiles: () => collectFiles,
2984
+ compileAnimation: () => compileAnimation,
2985
+ compileClass: () => compileClass,
2986
+ compileClasses: () => compileClasses,
1816
2987
  compileCssFromClasses: () => compileCssFromClasses,
1817
- compileCssNative: () => compileCssNative,
1818
- compileVariantTable: () => compileVariantTable,
1819
- compileVariants: () => compileVariants,
2988
+ compileCssLightning: () => compileCssLightning,
2989
+ compileCssNative2: () => compileCssNative2,
2990
+ compileKeyframes: () => compileKeyframes,
2991
+ compileTheme: () => compileTheme,
2992
+ compileToCss: () => compileToCss,
2993
+ compileToCssBatch: () => compileToCssBatch,
2994
+ compileVariantTableNative: () => compileVariantTableNative,
2995
+ computeIncrementalDiff: () => computeIncrementalDiff,
2996
+ createFingerprint: () => createFingerprint,
1820
2997
  detectConflicts: () => detectConflicts,
2998
+ detectDeadCode: () => detectDeadCode,
1821
2999
  diffClassLists: () => diffClassLists,
1822
3000
  eliminateDeadCss: () => eliminateDeadCss,
3001
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
3002
+ emitPluginHook: () => emitPluginHook,
3003
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
1823
3004
  extractAllClasses: () => extractAllClasses,
1824
3005
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3006
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
1825
3007
  extractClassesFromSource: () => extractClassesFromSource,
3008
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
1826
3009
  extractComponentUsage: () => extractComponentUsage,
1827
3010
  extractContainerCssFromSource: () => extractContainerCssFromSource,
3011
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
1828
3012
  extractTwStateConfigs: () => extractTwStateConfigs,
3013
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
1829
3014
  fileToRoute: () => fileToRoute,
1830
3015
  findDeadVariants: () => findDeadVariants,
3016
+ generateAtomicCss: () => generateAtomicCss,
1831
3017
  generateCssForClasses: () => generateCssForClasses,
1832
- generateRawCss: () => generateRawCss,
3018
+ generateCssNative: () => generateCssNative,
1833
3019
  generateSafelist: () => generateSafelist,
1834
3020
  generateStaticStateCss: () => generateStaticStateCss,
3021
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
3022
+ generateSubComponentTypes: () => generateSubComponentTypes,
1835
3023
  getAllRoutes: () => getAllRoutes,
1836
3024
  getBucketEngine: () => getBucketEngine,
3025
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
3026
+ getCacheStatistics: () => getCacheStatistics,
1837
3027
  getCacheStats: () => getCacheStats,
3028
+ getCompilationMetrics: () => getCompilationMetrics,
3029
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
1838
3030
  getContentPaths: () => getContentPaths,
1839
3031
  getIncrementalEngine: () => getIncrementalEngine,
1840
3032
  getNativeBridge: () => getNativeBridge,
3033
+ getPluginHooks: () => getPluginHooks,
1841
3034
  getRouteClasses: () => getRouteClasses,
3035
+ getWatchStats: () => getWatchStats,
1842
3036
  hasTwUsage: () => hasTwUsage,
1843
- hoistComponents: () => hoistComponents,
3037
+ hashContent: () => hashContent,
3038
+ hoistComponentsNative: () => hoistComponentsNative,
3039
+ idRegistryActiveCount: () => idRegistryActiveCount,
3040
+ idRegistryCreate: () => idRegistryCreate,
3041
+ idRegistryDestroy: () => idRegistryDestroy,
3042
+ idRegistryExport: () => idRegistryExport,
3043
+ idRegistryGenerate: () => idRegistryGenerate,
3044
+ idRegistryImport: () => idRegistryImport,
3045
+ idRegistryLookup: () => idRegistryLookup,
3046
+ idRegistryNext: () => idRegistryNext,
3047
+ idRegistryReset: () => idRegistryReset,
3048
+ idRegistrySnapshot: () => idRegistrySnapshot,
1844
3049
  injectClientDirective: () => injectClientDirective,
1845
3050
  injectServerOnlyComment: () => injectServerOnlyComment,
3051
+ injectStateHash: () => injectStateHash,
1846
3052
  isAlreadyTransformed: () => isAlreadyTransformed,
3053
+ isWatchRunning: () => isWatchRunning,
3054
+ layoutClassesToCss: () => layoutClassesToCss,
1847
3055
  loadSafelist: () => loadSafelist,
1848
3056
  loadTailwindConfig: () => loadTailwindConfig,
1849
3057
  mergeClassesStatic: () => mergeClassesStatic,
1850
- mergeCssDeclarations: () => mergeCssDeclarations,
3058
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
3059
+ minifyCss: () => minifyCss,
1851
3060
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1852
3061
  normalizeClasses: () => normalizeClasses,
1853
- optimizeCss: () => optimizeCss,
3062
+ optimizeCssNative: () => optimizeCssNative,
3063
+ parseAtomicClass: () => parseAtomicClass,
1854
3064
  parseClasses: () => parseClasses,
3065
+ pollWatchEvents: () => pollWatchEvents,
3066
+ processFileChange: () => processFileChange,
3067
+ processTailwindCssLightning: () => processTailwindCssLightning,
3068
+ propertyIdToString: () => propertyIdToString,
3069
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
3070
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
3071
+ redisCacheClear: () => redisCacheClear,
3072
+ redisCacheHitRate: () => redisCacheHitRate,
3073
+ redisCacheKeyCount: () => redisCacheKeyCount,
3074
+ redisCacheSize: () => redisCacheSize,
3075
+ redisCacheSync: () => redisCacheSync,
3076
+ redisClusterStatus: () => redisClusterStatus,
3077
+ redisDelete: () => redisDelete,
3078
+ redisDiagnose: () => redisDiagnose,
3079
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
3080
+ redisDisableCluster: () => redisDisableCluster,
3081
+ redisDisablePersistence: () => redisDisablePersistence,
3082
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
3083
+ redisEnableCluster: () => redisEnableCluster,
3084
+ redisEnablePersistence: () => redisEnablePersistence,
3085
+ redisExists: () => redisExists,
3086
+ redisExpirationGet: () => redisExpirationGet,
3087
+ redisExpirationSet: () => redisExpirationSet,
3088
+ redisFlushAll: () => redisFlushAll,
3089
+ redisFlushDb: () => redisFlushDb,
3090
+ redisGet: () => redisGet,
3091
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
3092
+ redisInfo: () => redisInfo,
3093
+ redisMemoryStats: () => redisMemoryStats,
3094
+ redisMget: () => redisMget,
3095
+ redisMonitor: () => redisMonitor,
3096
+ redisMset: () => redisMset,
3097
+ redisOptimizeMemory: () => redisOptimizeMemory,
3098
+ redisPing: () => redisPing,
3099
+ redisPoolConnect: () => redisPoolConnect,
3100
+ redisPoolReconnect: () => redisPoolReconnect,
3101
+ redisPoolStats: () => redisPoolStats,
3102
+ redisPublish: () => redisPublish,
3103
+ redisReplicate: () => redisReplicate,
3104
+ redisReplicationStatus: () => redisReplicationStatus,
3105
+ redisSet: () => redisSet,
3106
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
3107
+ redisSnapshot: () => redisSnapshot,
3108
+ redisSubscribe: () => redisSubscribe,
1855
3109
  registerFileClasses: () => registerFileClasses,
1856
3110
  registerGlobalClasses: () => registerGlobalClasses,
3111
+ registerPluginHook: () => registerPluginHook,
3112
+ registerPropertyName: () => registerPropertyName,
3113
+ registerValueName: () => registerValueName,
1857
3114
  resetBucketEngine: () => resetBucketEngine,
3115
+ resetCompilationMetrics: () => resetCompilationMetrics,
1858
3116
  resetIncrementalEngine: () => resetIncrementalEngine,
3117
+ resolveCascade: () => resolveCascade,
3118
+ resolveClassNames: () => resolveClassNames,
3119
+ resolveConflictGroup: () => resolveConflictGroup,
3120
+ resolveSimpleVariants: () => resolveSimpleVariants,
3121
+ resolveThemeValue: () => resolveThemeValue,
3122
+ resolveVariants: () => resolveVariants,
3123
+ reverseLookupProperty: () => reverseLookupProperty,
3124
+ reverseLookupValue: () => reverseLookupValue,
1859
3125
  runCssPipeline: () => runCssPipeline,
1860
3126
  runCssPipelineSync: () => runCssPipelineSync,
1861
3127
  runElimination: () => runElimination,
1862
3128
  runLoaderTransform: () => runLoaderTransform,
3129
+ scanCacheOptimizations: () => scanCacheOptimizations,
3130
+ scanFile: () => scanFile,
3131
+ scanFileNative: () => scanFileNative,
3132
+ scanFilesBatchNative: () => scanFilesBatchNative,
1863
3133
  scanProjectUsage: () => scanProjectUsage,
3134
+ scanWorkspace: () => scanWorkspace,
1864
3135
  shouldProcess: () => shouldProcess,
1865
3136
  shouldSkipFile: () => shouldSkipFile,
1866
- transformSource: () => transformSource
3137
+ startWatch: () => startWatch,
3138
+ stopWatch: () => stopWatch,
3139
+ toAtomicClasses: () => toAtomicClasses,
3140
+ transformSource: () => transformSource,
3141
+ twMerge: () => twMerge,
3142
+ twMergeMany: () => twMergeMany,
3143
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
3144
+ twMergeRaw: () => twMergeRaw,
3145
+ twMergeWithSeparator: () => twMergeWithSeparator,
3146
+ unregisterPluginHook: () => unregisterPluginHook,
3147
+ validateCssOutput: () => validateCssOutput,
3148
+ validateThemeConfig: () => validateThemeConfig,
3149
+ valueIdToString: () => valueIdToString,
3150
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
3151
+ watchAddPattern: () => watchAddPattern,
3152
+ watchClearAll: () => watchClearAll,
3153
+ watchEventTypeToString: () => watchEventTypeToString,
3154
+ watchGetActiveHandles: () => watchGetActiveHandles,
3155
+ watchPause: () => watchPause,
3156
+ watchRemovePattern: () => watchRemovePattern,
3157
+ watchResume: () => watchResume
1867
3158
  });
1868
3159
  var init_internal = __esm({
1869
3160
  "packages/domain/compiler/src/internal.ts"() {
1870
3161
  init_src();
1871
3162
  init_tailwindEngine();
3163
+ init_compiler();
3164
+ init_parser();
3165
+ init_analyzer();
3166
+ init_cache();
3167
+ init_redis();
3168
+ init_watch();
1872
3169
  }
1873
3170
  });
1874
3171
  function getNative() {
@@ -2215,7 +3512,7 @@ __export(src_exports, {
2215
3512
  getPipelinePercentages: () => getPipelinePercentages,
2216
3513
  getSuggestion: () => getSuggestion,
2217
3514
  getTailwindVersion: () => getTailwindVersion,
2218
- hashContent: () => hashContent,
3515
+ hashContent: () => hashContent2,
2219
3516
  isTailwindV4: () => isTailwindV4,
2220
3517
  isTwError: () => isTwError,
2221
3518
  loadNativeBinding: () => loadNativeBinding,
@@ -2345,7 +3642,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
2345
3642
  return process.cwd();
2346
3643
  }
2347
3644
  }
2348
- function hashContent(content, algorithm = "md5", length) {
3645
+ function hashContent2(content, algorithm = "md5", length) {
2349
3646
  const hash = createHash(algorithm).update(content).digest("hex");
2350
3647
  return length ? hash.slice(0, length) : hash;
2351
3648
  }
@@ -2470,7 +3767,7 @@ var init_src2 = __esm({
2470
3767
  // packages/domain/scanner/src/native-bridge.ts
2471
3768
  var native_bridge_exports = {};
2472
3769
  __export(native_bridge_exports, {
2473
- batchExtractClassesNative: () => batchExtractClassesNative,
3770
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2474
3771
  cachePriorityNative: () => cachePriorityNative,
2475
3772
  cacheReadNative: () => cacheReadNative,
2476
3773
  cacheWriteNative: () => cacheWriteNative,
@@ -2490,8 +3787,8 @@ __export(native_bridge_exports, {
2490
3787
  scanCacheInvalidate: () => scanCacheInvalidate,
2491
3788
  scanCachePut: () => scanCachePut,
2492
3789
  scanCacheStats: () => scanCacheStats,
2493
- scanFileNative: () => scanFileNative,
2494
- scanFilesBatchNative: () => scanFilesBatchNative,
3790
+ scanFileNative: () => scanFileNative2,
3791
+ scanFilesBatchNative: () => scanFilesBatchNative2,
2495
3792
  scanWorkspaceNative: () => scanWorkspaceNative,
2496
3793
  startWatchNative: () => startWatchNative,
2497
3794
  stopWatchNative: () => stopWatchNative
@@ -2582,7 +3879,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
2582
3879
  }
2583
3880
  return result;
2584
3881
  }
2585
- function batchExtractClassesNative(filePaths) {
3882
+ function batchExtractClassesNative2(filePaths) {
2586
3883
  const binding = scannerGetBinding();
2587
3884
  if (!binding.batchExtractClasses) {
2588
3885
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -2617,7 +3914,7 @@ function scanCacheStats() {
2617
3914
  }
2618
3915
  return binding.scanCacheStats();
2619
3916
  }
2620
- function scanFileNative(filePath) {
3917
+ function scanFileNative2(filePath) {
2621
3918
  const binding = scannerGetBinding();
2622
3919
  if (!binding.scanFile) {
2623
3920
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -2629,7 +3926,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
2629
3926
  if (!binding.collectFiles) return null;
2630
3927
  return binding.collectFiles(root, extensions, ignoreDirs);
2631
3928
  }
2632
- function scanFilesBatchNative(filePaths) {
3929
+ function scanFilesBatchNative2(filePaths) {
2633
3930
  const binding = scannerGetBinding();
2634
3931
  if (!binding.scanFilesBatch) {
2635
3932
  return filePaths.map((fp) => {
@@ -2834,7 +4131,7 @@ var init_cache_native = __esm({
2834
4131
  init_native_bridge();
2835
4132
  }
2836
4133
  });
2837
- function collectFiles(rootDir, extensions, ignoreDirs) {
4134
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
2838
4135
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
2839
4136
  if (native !== null) return native;
2840
4137
  throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
@@ -2874,9 +4171,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
2874
4171
  maxWorkers = Math.max(1, availableParallelism() - 1),
2875
4172
  chunkSize = DEFAULT_CHUNK_SIZE
2876
4173
  } = options;
2877
- const files = collectFiles(path9__default.resolve(rootDir), extensions, ignoreDirs);
4174
+ const files = collectFiles2(path9__default.resolve(rootDir), extensions, ignoreDirs);
2878
4175
  if (files.length < PARALLEL_THRESHOLD) {
2879
- return mergeResults(batchExtractClassesNative(files));
4176
+ return mergeResults(batchExtractClassesNative2(files));
2880
4177
  }
2881
4178
  const chunks = [];
2882
4179
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -2900,7 +4197,7 @@ var init_parallel_scanner = __esm({
2900
4197
  if (!isMainThread && parentPort) {
2901
4198
  const { filePaths } = workerData;
2902
4199
  try {
2903
- const results = batchExtractClassesNative(filePaths);
4200
+ const results = batchExtractClassesNative2(filePaths);
2904
4201
  const msg = { ok: true, results };
2905
4202
  parentPort.postMessage(msg);
2906
4203
  } catch (error) {
@@ -2984,15 +4281,15 @@ var src_exports2 = {};
2984
4281
  __export(src_exports2, {
2985
4282
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
2986
4283
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
2987
- batchExtractClassesNative: () => batchExtractClassesNative,
4284
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2988
4285
  extractClassesNative: () => extractClassesNative,
2989
4286
  isScannableFile: () => isScannableFile2,
2990
4287
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
2991
4288
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
2992
4289
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
2993
- scanFile: () => scanFile,
4290
+ scanFile: () => scanFile2,
2994
4291
  scanSource: () => scanSource,
2995
- scanWorkspace: () => scanWorkspace,
4292
+ scanWorkspace: () => scanWorkspace2,
2996
4293
  scanWorkspaceAsync: () => scanWorkspaceAsync
2997
4294
  });
2998
4295
  function getRuntimeDir() {
@@ -3118,9 +4415,9 @@ function scanSource(source) {
3118
4415
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
3119
4416
  return includeExtensions.includes(path9__default.extname(filePath));
3120
4417
  }
3121
- function scanFile(filePath) {
3122
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
3123
- const result = scanFileNative2(filePath);
4418
+ function scanFile2(filePath) {
4419
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4420
+ const result = scanFileNative3(filePath);
3124
4421
  if (!result.ok) {
3125
4422
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
3126
4423
  }
@@ -3130,7 +4427,7 @@ function scanFile(filePath) {
3130
4427
  ...result.hash ? { hash: result.hash } : {}
3131
4428
  };
3132
4429
  }
3133
- function scanWorkspace(rootDir, options = {}) {
4430
+ function scanWorkspace2(rootDir, options = {}) {
3134
4431
  const normalizedOptions = parseScanWorkspaceOptions(options);
3135
4432
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
3136
4433
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -3253,7 +4550,7 @@ function scanWorkspace(rootDir, options = {}) {
3253
4550
  }
3254
4551
  } else {
3255
4552
  for (const filePath of candidates) {
3256
- processResult(scanFile(filePath));
4553
+ processResult(scanFile2(filePath));
3257
4554
  }
3258
4555
  }
3259
4556
  return parseScanWorkspaceResult({
@@ -3280,7 +4577,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
3280
4577
  log3.debug(
3281
4578
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
3282
4579
  );
3283
- return scanWorkspace(rootDir, normalizedOptions);
4580
+ return scanWorkspace2(rootDir, normalizedOptions);
3284
4581
  }
3285
4582
  }
3286
4583
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
@@ -3472,35 +4769,35 @@ var init_native_bridge2 = __esm({
3472
4769
  });
3473
4770
 
3474
4771
  // packages/domain/engine/src/ir.ts
3475
- function registerPropertyName(id, name) {
4772
+ function registerPropertyName2(id, name) {
3476
4773
  const native = getNativeEngineBinding();
3477
4774
  if (!native?.registerPropertyName) {
3478
4775
  throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
3479
4776
  }
3480
4777
  native.registerPropertyName(id.value, name);
3481
4778
  }
3482
- function registerValueName(id, name) {
4779
+ function registerValueName2(id, name) {
3483
4780
  const native = getNativeEngineBinding();
3484
4781
  if (!native?.registerValueName) {
3485
4782
  throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
3486
4783
  }
3487
4784
  native.registerValueName(id.value, name);
3488
4785
  }
3489
- function propertyIdToString(id) {
4786
+ function propertyIdToString2(id) {
3490
4787
  const native = getNativeEngineBinding();
3491
4788
  if (!native?.propertyIdToString) {
3492
4789
  throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
3493
4790
  }
3494
4791
  return native.propertyIdToString(id.value);
3495
4792
  }
3496
- function valueIdToString(id) {
4793
+ function valueIdToString2(id) {
3497
4794
  const native = getNativeEngineBinding();
3498
4795
  if (!native?.valueIdToString) {
3499
4796
  throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
3500
4797
  }
3501
4798
  return native.valueIdToString(id.value);
3502
4799
  }
3503
- function createFingerprint(parts) {
4800
+ function createFingerprint2(parts) {
3504
4801
  const native = getNativeEngineBinding();
3505
4802
  if (!native?.createFingerprint) {
3506
4803
  throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
@@ -3556,7 +4853,7 @@ var init_ir = __esm({
3556
4853
  if (typeof name === "string" && name.length > 0) {
3557
4854
  return name;
3558
4855
  }
3559
- return propertyIdToString(this);
4856
+ return propertyIdToString2(this);
3560
4857
  }
3561
4858
  };
3562
4859
  ValueId = class {
@@ -3571,7 +4868,7 @@ var init_ir = __esm({
3571
4868
  if (typeof name === "string" && name.length > 0) {
3572
4869
  return name;
3573
4870
  }
3574
- return valueIdToString(this);
4871
+ return valueIdToString2(this);
3575
4872
  }
3576
4873
  };
3577
4874
  LayerId = class {
@@ -3779,12 +5076,12 @@ function createIdGenerator() {
3779
5076
  generateSelectorId: () => new SelectorId(state.selectorIdCounter++),
3780
5077
  generatePropertyId: (name) => {
3781
5078
  const id = new PropertyId(state.propertyIdCounter++);
3782
- registerPropertyName(id, name);
5079
+ registerPropertyName2(id, name);
3783
5080
  return id;
3784
5081
  },
3785
5082
  generateValueId: (name) => {
3786
5083
  const id = new ValueId(state.valueIdCounter++);
3787
- registerValueName(id, name);
5084
+ registerValueName2(id, name);
3788
5085
  return id;
3789
5086
  },
3790
5087
  generateLayerId: () => new LayerId(state.layerIdCounter++),
@@ -3836,12 +5133,12 @@ function _parseCssToIrFast(assembled) {
3836
5133
  if (native?.registerPropertyName) {
3837
5134
  native.registerPropertyName(r.propertyId, r.propertyName);
3838
5135
  } else {
3839
- registerPropertyName(propertyId, r.propertyName);
5136
+ registerPropertyName2(propertyId, r.propertyName);
3840
5137
  }
3841
5138
  if (native?.registerValueName) {
3842
5139
  native.registerValueName(r.valueId, r.valueName);
3843
5140
  } else {
3844
- registerValueName(valueId, r.valueName);
5141
+ registerValueName2(valueId, r.valueName);
3845
5142
  }
3846
5143
  return {
3847
5144
  id: new RuleId(r.ruleId),
@@ -3892,7 +5189,7 @@ function _parseCssToIrFallback(css, prefix, native) {
3892
5189
  const conditionId = hasMedia ? generateConditionId() : null;
3893
5190
  const conditionResult = 2 /* Unknown */;
3894
5191
  const ruleId = generateRuleId();
3895
- const fingerprint = createFingerprint([className, r.property, r.value]);
5192
+ const fingerprint = createFingerprint2([className, r.property, r.value]);
3896
5193
  const rule = {
3897
5194
  id: ruleId,
3898
5195
  selector: selectorId,
@@ -4661,7 +5958,7 @@ init_src2();
4661
5958
  init_native_bridge2();
4662
5959
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
4663
5960
  var log5 = createLogger2("engine:incremental");
4664
- function rebuildWorkspaceResult(byFile) {
5961
+ function rebuildWorkspaceResult2(byFile) {
4665
5962
  const files = Array.from(byFile.values());
4666
5963
  const native = getNativeEngineBinding();
4667
5964
  if (native?.rebuildWorkspaceResult) {
@@ -4704,10 +6001,10 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
4704
6001
  log5.debug(`native unlink ${normalizedPath}`);
4705
6002
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
4706
6003
  byFile.delete(normalizedPath);
4707
- return rebuildWorkspaceResult(byFile);
6004
+ return rebuildWorkspaceResult2(byFile);
4708
6005
  }
4709
6006
  log5.debug(`native change ${normalizedPath}`);
4710
- const scanned = scanFile(normalizedPath);
6007
+ const scanned = scanFile2(normalizedPath);
4711
6008
  const content = fs3__default.readFileSync(normalizedPath, "utf8");
4712
6009
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
4713
6010
  const existing = byFile.get(normalizedPath);
@@ -4720,7 +6017,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
4720
6017
  log5.debug(`native diff cold-sync ${normalizedPath}`);
4721
6018
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
4722
6019
  }
4723
- return rebuildWorkspaceResult(byFile);
6020
+ return rebuildWorkspaceResult2(byFile);
4724
6021
  }
4725
6022
 
4726
6023
  // packages/domain/engine/src/impactTracker.ts
@@ -5835,7 +7132,7 @@ async function createEngine(rawOptions = {}) {
5835
7132
  }
5836
7133
  };
5837
7134
  }
5838
- async function scanWorkspace2(opts = {}) {
7135
+ async function scanWorkspace3(opts = {}) {
5839
7136
  const root = path9__default.resolve(opts.root ?? process.cwd());
5840
7137
  return scanWorkspaceAsync(root, {
5841
7138
  includeExtensions: opts.extensions,
@@ -5849,7 +7146,7 @@ async function analyzeWorkspace2(opts = {}) {
5849
7146
  });
5850
7147
  }
5851
7148
  async function generateSafelist2(opts = {}) {
5852
- const scan = await scanWorkspace2(opts);
7149
+ const scan = await scanWorkspace3(opts);
5853
7150
  return scan.uniqueClasses;
5854
7151
  }
5855
7152
  async function build(opts = {}) {
@@ -5916,6 +7213,6 @@ async function inspectClass(className, scanResult, css = "") {
5916
7213
  };
5917
7214
  }
5918
7215
 
5919
- export { BuildResultSchema, BundleAnalyzer, CascadeResolutionId, CascadeResolver, CascadeStage, ConditionId, ConditionResult, EngineMetricsCollector, EngineOptionsSchema, EngineWatchOptionsSchema, ImpactTracker, Importance, LayerId, Origin, PropertyId, ReverseLookup, RuleId, SelectorId, ValueId, VariantChainId, analyzeWorkspace2 as analyzeWorkspace, applyIncrementalChange, build, buildProvenanceChain, createEngine, createFingerprint, createResolutionReason, generateSafelist2 as generateSafelist, inspectClass, parseCssToIr, parseEngineOptions, parseEngineWatchOptions, runAfterBuild, runAfterScan, runAfterWatch, runBeforeBuild, runBeforeScan, runBeforeWatch, runOnError, runTransformClasses, scanWorkspace2 as scanWorkspace, trace, traceClass, traceClasses, watchWorkspace as watchWorkspaceLegacy, watchWorkspace2 as watchWorkspaceNative };
7216
+ export { BuildResultSchema, BundleAnalyzer, CascadeResolutionId, CascadeResolver, CascadeStage, ConditionId, ConditionResult, EngineMetricsCollector, EngineOptionsSchema, EngineWatchOptionsSchema, ImpactTracker, Importance, LayerId, Origin, PropertyId, ReverseLookup, RuleId, SelectorId, ValueId, VariantChainId, analyzeWorkspace2 as analyzeWorkspace, applyIncrementalChange, build, buildProvenanceChain, createEngine, createFingerprint2 as createFingerprint, createResolutionReason, generateSafelist2 as generateSafelist, inspectClass, parseCssToIr, parseEngineOptions, parseEngineWatchOptions, runAfterBuild, runAfterScan, runAfterWatch, runBeforeBuild, runBeforeScan, runBeforeWatch, runOnError, runTransformClasses, scanWorkspace3 as scanWorkspace, trace, traceClass, traceClasses, watchWorkspace as watchWorkspaceLegacy, watchWorkspace2 as watchWorkspaceNative };
5920
7217
  //# sourceMappingURL=engine.mjs.map
5921
7218
  //# sourceMappingURL=engine.mjs.map