tailwind-styled-v4 5.0.11 → 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 (110) hide show
  1. package/README.md +100 -4
  2. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  3. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  4. package/dist/analyzer.d.mts +4 -4
  5. package/dist/analyzer.d.ts +4 -4
  6. package/dist/analyzer.js +34 -69
  7. package/dist/analyzer.js.map +1 -1
  8. package/dist/analyzer.mjs +33 -68
  9. package/dist/analyzer.mjs.map +1 -1
  10. package/dist/animate.d.mts +4 -0
  11. package/dist/animate.d.ts +4 -0
  12. package/dist/animate.js +33 -11
  13. package/dist/animate.js.map +1 -1
  14. package/dist/animate.mjs +33 -11
  15. package/dist/animate.mjs.map +1 -1
  16. package/dist/atomic.js +57 -6
  17. package/dist/atomic.js.map +1 -1
  18. package/dist/atomic.mjs +57 -6
  19. package/dist/atomic.mjs.map +1 -1
  20. package/dist/cli.js +404 -190
  21. package/dist/cli.js.map +1 -1
  22. package/dist/cli.mjs +401 -187
  23. package/dist/cli.mjs.map +1 -1
  24. package/dist/compiler.d.mts +2700 -212
  25. package/dist/compiler.d.ts +2700 -212
  26. package/dist/compiler.js +1996 -503
  27. package/dist/compiler.js.map +1 -1
  28. package/dist/compiler.mjs +1847 -448
  29. package/dist/compiler.mjs.map +1 -1
  30. package/dist/devtools.js +17 -4
  31. package/dist/devtools.js.map +1 -1
  32. package/dist/devtools.mjs +17 -4
  33. package/dist/devtools.mjs.map +1 -1
  34. package/dist/engine.d.mts +11 -470
  35. package/dist/engine.d.ts +11 -470
  36. package/dist/engine.js +2777 -455
  37. package/dist/engine.js.map +1 -1
  38. package/dist/engine.mjs +2776 -454
  39. package/dist/engine.mjs.map +1 -1
  40. package/dist/index-BDQw13kn.d.ts +464 -0
  41. package/dist/index-DJv28Uzq.d.mts +464 -0
  42. package/dist/index.browser.mjs +143 -255
  43. package/dist/index.browser.mjs.map +1 -1
  44. package/dist/index.d.mts +23 -39
  45. package/dist/index.d.ts +23 -39
  46. package/dist/index.js +7234 -1400
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +7234 -1400
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/next.d.mts +44 -1
  51. package/dist/next.d.ts +44 -1
  52. package/dist/next.js +3224 -1065
  53. package/dist/next.js.map +1 -1
  54. package/dist/next.mjs +3223 -1066
  55. package/dist/next.mjs.map +1 -1
  56. package/dist/rspack.d.mts +9 -0
  57. package/dist/rspack.d.ts +9 -0
  58. package/dist/rspack.js +99 -61
  59. package/dist/rspack.js.map +1 -1
  60. package/dist/rspack.mjs +99 -61
  61. package/dist/rspack.mjs.map +1 -1
  62. package/dist/runtime-css.d.mts +8 -0
  63. package/dist/runtime-css.d.ts +8 -0
  64. package/dist/runtime-css.js +23 -7
  65. package/dist/runtime-css.js.map +1 -1
  66. package/dist/runtime-css.mjs +23 -7
  67. package/dist/runtime-css.mjs.map +1 -1
  68. package/dist/scanner.js +16 -37
  69. package/dist/scanner.js.map +1 -1
  70. package/dist/scanner.mjs +15 -36
  71. package/dist/scanner.mjs.map +1 -1
  72. package/dist/shared.d.mts +107 -1
  73. package/dist/shared.d.ts +107 -1
  74. package/dist/shared.js +3014 -466
  75. package/dist/shared.js.map +1 -1
  76. package/dist/shared.mjs +3008 -445
  77. package/dist/shared.mjs.map +1 -1
  78. package/dist/svelte.js +39 -35
  79. package/dist/svelte.js.map +1 -1
  80. package/dist/svelte.mjs +38 -34
  81. package/dist/svelte.mjs.map +1 -1
  82. package/dist/theme.js +85 -76
  83. package/dist/theme.js.map +1 -1
  84. package/dist/theme.mjs +83 -74
  85. package/dist/theme.mjs.map +1 -1
  86. package/dist/turbopackLoader.js +2351 -187
  87. package/dist/turbopackLoader.js.map +1 -1
  88. package/dist/turbopackLoader.mjs +2351 -187
  89. package/dist/turbopackLoader.mjs.map +1 -1
  90. package/dist/tw.js +404 -190
  91. package/dist/tw.js.map +1 -1
  92. package/dist/tw.mjs +401 -187
  93. package/dist/tw.mjs.map +1 -1
  94. package/dist/vite.js +2657 -320
  95. package/dist/vite.js.map +1 -1
  96. package/dist/vite.mjs +2657 -320
  97. package/dist/vite.mjs.map +1 -1
  98. package/dist/vue.js +39 -35
  99. package/dist/vue.js.map +1 -1
  100. package/dist/vue.mjs +38 -34
  101. package/dist/vue.mjs.map +1 -1
  102. package/dist/webpackLoader.js +190 -33
  103. package/dist/webpackLoader.js.map +1 -1
  104. package/dist/webpackLoader.mjs +190 -33
  105. package/dist/webpackLoader.mjs.map +1 -1
  106. package/native/index.node +0 -0
  107. package/native/tailwind-styled-native.node +0 -0
  108. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  109. package/package.json +9 -4
  110. package/CHANGELOG.md +0 -285
package/dist/vite.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  var zod = require('zod');
4
4
  var module$1 = require('module');
5
- var fs5 = require('fs');
6
- var path6 = require('path');
5
+ var fs13 = require('fs');
6
+ var path9 = require('path');
7
7
  var crypto = require('crypto');
8
8
  var url = require('url');
9
9
  var worker_threads = require('worker_threads');
@@ -29,8 +29,8 @@ function _interopNamespace(e) {
29
29
  return Object.freeze(n);
30
30
  }
31
31
 
32
- var fs5__namespace = /*#__PURE__*/_interopNamespace(fs5);
33
- var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
32
+ var fs13__namespace = /*#__PURE__*/_interopNamespace(fs13);
33
+ var path9__namespace = /*#__PURE__*/_interopNamespace(path9);
34
34
 
35
35
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
36
36
  var __defProp = Object.defineProperty;
@@ -242,9 +242,9 @@ function parseNative(schema, data, context) {
242
242
  const result = schema.safeParse(data);
243
243
  if (!result.success) {
244
244
  const first = result.error.issues[0];
245
- const path13 = first?.path?.join(".") ?? "(root)";
245
+ const path16 = first?.path?.join(".") ?? "(root)";
246
246
  throw new Error(
247
- `[${context}] Native binding returned unexpected data: ${path13}: ${first?.message ?? "validation failed"}`
247
+ `[${context}] Native binding returned unexpected data: ${path16}: ${first?.message ?? "validation failed"}`
248
248
  );
249
249
  }
250
250
  return result.data;
@@ -637,11 +637,11 @@ function resolvePath(...segments) {
637
637
  return segments.join("/").replace(/\/+/g, "/");
638
638
  }
639
639
  }
640
- function existsSync(path13) {
640
+ function existsSync(path16) {
641
641
  if (isBrowser2) return false;
642
642
  try {
643
643
  const nodeFs = __require(NODE_FS);
644
- return nodeFs.existsSync(path13);
644
+ return nodeFs.existsSync(path16);
645
645
  } catch {
646
646
  return false;
647
647
  }
@@ -871,12 +871,12 @@ function resolveNativeBinary(runtimeDir) {
871
871
  if (isBrowser3) {
872
872
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
873
873
  }
874
- if (process.env.TWS_DISABLE_NATIVE === "1") {
874
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
875
875
  return { path: null, source: "not-found", platform, tried: [] };
876
876
  }
877
877
  const envPath = process.env.TW_NATIVE_PATH?.trim();
878
878
  if (envPath) {
879
- if (fs5__namespace.existsSync(envPath)) {
879
+ if (fs13__namespace.existsSync(envPath)) {
880
880
  return { path: envPath, source: "env", platform, tried };
881
881
  }
882
882
  tried.push(`env:${envPath} (not found)`);
@@ -885,7 +885,7 @@ function resolveNativeBinary(runtimeDir) {
885
885
  for (const pkg of prebuiltPkgs) {
886
886
  try {
887
887
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
888
- if (fs5__namespace.existsSync(candidate)) {
888
+ if (fs13__namespace.existsSync(candidate)) {
889
889
  return { path: candidate, source: "prebuilt", platform, tried };
890
890
  }
891
891
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -896,13 +896,13 @@ function resolveNativeBinary(runtimeDir) {
896
896
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
897
897
  const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
898
898
  if (runtimeDir) {
899
- for (const depth of ["..", path6__namespace.join("..", ".."), path6__namespace.join("..", "..", "..")]) {
900
- const pkgRoot = path6__namespace.resolve(runtimeDir, depth);
899
+ for (const depth of ["..", path9__namespace.join("..", ".."), path9__namespace.join("..", "..", "..")]) {
900
+ const pkgRoot = path9__namespace.resolve(runtimeDir, depth);
901
901
  for (const bin of BINARY_NAMES_SELF) {
902
902
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
903
- const candidate = path6__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
903
+ const candidate = path9__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
904
904
  tried.push(`self-bundled:${candidate}`);
905
- if (fs5__namespace.existsSync(candidate)) {
905
+ if (fs13__namespace.existsSync(candidate)) {
906
906
  return { path: candidate, source: "prebuilt", platform, tried };
907
907
  }
908
908
  }
@@ -914,29 +914,29 @@ function resolveNativeBinary(runtimeDir) {
914
914
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
915
915
  const localCandidates = [];
916
916
  for (const bin of BINARY_NAMES) {
917
- localCandidates.push(path6__namespace.resolve(base, `${bin}.node`));
918
- localCandidates.push(path6__namespace.resolve(base, "..", `${bin}.node`));
919
- localCandidates.push(path6__namespace.resolve(base, `${bin}.${platform}.node`));
920
- localCandidates.push(path6__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
917
+ localCandidates.push(path9__namespace.resolve(base, `${bin}.node`));
918
+ localCandidates.push(path9__namespace.resolve(base, "..", `${bin}.node`));
919
+ localCandidates.push(path9__namespace.resolve(base, `${bin}.${platform}.node`));
920
+ localCandidates.push(path9__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
921
921
  }
922
922
  for (const startDir of [cwd, base]) {
923
923
  let dir = startDir;
924
924
  for (let i = 0; i < 6; i++) {
925
- const nativeDir = path6__namespace.resolve(dir, "native");
925
+ const nativeDir = path9__namespace.resolve(dir, "native");
926
926
  for (const bin of BINARY_NAMES) {
927
- localCandidates.push(path6__namespace.resolve(nativeDir, `${bin}.node`));
928
- localCandidates.push(path6__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
929
- localCandidates.push(path6__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
930
- localCandidates.push(path6__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
927
+ localCandidates.push(path9__namespace.resolve(nativeDir, `${bin}.node`));
928
+ localCandidates.push(path9__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
929
+ localCandidates.push(path9__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
930
+ localCandidates.push(path9__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
931
931
  }
932
- const parent = path6__namespace.resolve(dir, "..");
932
+ const parent = path9__namespace.resolve(dir, "..");
933
933
  if (parent === dir) break;
934
934
  dir = parent;
935
935
  }
936
936
  }
937
937
  for (const candidate of localCandidates) {
938
938
  tried.push(`local:${candidate}`);
939
- if (fs5__namespace.existsSync(candidate)) {
939
+ if (fs13__namespace.existsSync(candidate)) {
940
940
  return { path: candidate, source: "local", platform, tried };
941
941
  }
942
942
  }
@@ -975,9 +975,9 @@ var init_native_resolution = __esm({
975
975
  // packages/domain/shared/src/observability.ts
976
976
  function createObservabilityClient(opts = {}) {
977
977
  const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
978
- async function fetchJson(path13) {
978
+ async function fetchJson(path16) {
979
979
  try {
980
- const res = await fetch(`${baseUrl}${path13}`, {
980
+ const res = await fetch(`${baseUrl}${path16}`, {
981
981
  signal: AbortSignal.timeout(timeoutMs)
982
982
  });
983
983
  if (!res.ok) return null;
@@ -1009,6 +1009,2041 @@ var init_observability = __esm({
1009
1009
  }
1010
1010
  });
1011
1011
 
1012
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1013
+ async function generateCssNative(classes, options) {
1014
+ const { theme } = options;
1015
+ const native = getNativeBridge();
1016
+ if (!native?.generateCssNative) {
1017
+ throw new Error(
1018
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1019
+ );
1020
+ }
1021
+ const themeJson = JSON.stringify(theme);
1022
+ const css = native.generateCssNative(classes, themeJson);
1023
+ return css;
1024
+ }
1025
+ function clearThemeCache() {
1026
+ try {
1027
+ const native = getNativeBridge();
1028
+ if (!native?.clearThemeCache) {
1029
+ return;
1030
+ }
1031
+ native.clearThemeCache();
1032
+ } catch {
1033
+ }
1034
+ }
1035
+ var init_cssGeneratorNative = __esm({
1036
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1037
+ init_nativeBridge();
1038
+ }
1039
+ });
1040
+
1041
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1042
+ var tailwindEngine_exports = {};
1043
+ __export(tailwindEngine_exports, {
1044
+ clearCache: () => clearCache,
1045
+ getCacheStats: () => getCacheStats,
1046
+ processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1047
+ runCssPipeline: () => runCssPipeline,
1048
+ runCssPipelineSync: () => runCssPipelineSync
1049
+ });
1050
+ function _getCacheKey(classes, minify, cssEntry, root) {
1051
+ const sorted = [...classes].sort().join(",");
1052
+ const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
1053
+ return `${sorted}|${flags}`;
1054
+ }
1055
+ function _evictOldestIfNeeded() {
1056
+ if (_cssCache.size >= MAX_CACHE_SIZE) {
1057
+ const firstKey = _cssCache.keys().next().value;
1058
+ if (firstKey !== void 0) {
1059
+ _cssCache.delete(firstKey);
1060
+ }
1061
+ }
1062
+ }
1063
+ function getCacheStats() {
1064
+ const total = _cacheHits + _cacheMisses;
1065
+ return {
1066
+ hits: _cacheHits,
1067
+ misses: _cacheMisses,
1068
+ hitRate: total > 0 ? _cacheHits / total : 0,
1069
+ size: _cssCache.size,
1070
+ maxSize: MAX_CACHE_SIZE
1071
+ };
1072
+ }
1073
+ function clearCache() {
1074
+ _cssCache.clear();
1075
+ _cacheHits = 0;
1076
+ _cacheMisses = 0;
1077
+ }
1078
+ function getThemeConfig() {
1079
+ return {
1080
+ colors: {
1081
+ slate: {
1082
+ "50": "#f8fafc",
1083
+ "100": "#f1f5f9",
1084
+ "200": "#e2e8f0",
1085
+ "300": "#cbd5e1",
1086
+ "400": "#94a3b8",
1087
+ "500": "#64748b",
1088
+ "600": "#475569",
1089
+ "700": "#334155",
1090
+ "800": "#1e293b",
1091
+ "900": "#0f172a"
1092
+ },
1093
+ gray: {
1094
+ "50": "#f9fafb",
1095
+ "100": "#f3f4f6",
1096
+ "200": "#e5e7eb",
1097
+ "300": "#d1d5db",
1098
+ "400": "#9ca3af",
1099
+ "500": "#6b7280",
1100
+ "600": "#4b5563",
1101
+ "700": "#374151",
1102
+ "800": "#1f2937",
1103
+ "900": "#111827"
1104
+ },
1105
+ white: "#ffffff",
1106
+ black: "#000000",
1107
+ red: {
1108
+ "500": "#ef4444",
1109
+ "600": "#dc2626"
1110
+ },
1111
+ blue: {
1112
+ "500": "#3b82f6",
1113
+ "600": "#1e40af"
1114
+ }
1115
+ },
1116
+ spacing: {
1117
+ "0": "0px",
1118
+ "1": "0.25rem",
1119
+ "2": "0.5rem",
1120
+ "3": "0.75rem",
1121
+ "4": "1rem",
1122
+ "5": "1.25rem",
1123
+ "6": "1.5rem",
1124
+ "8": "2rem",
1125
+ "10": "2.5rem",
1126
+ "12": "3rem",
1127
+ "16": "4rem",
1128
+ "20": "5rem",
1129
+ "24": "6rem"
1130
+ },
1131
+ breakpoints: {
1132
+ "sm": "640px",
1133
+ "md": "768px",
1134
+ "lg": "1024px",
1135
+ "xl": "1280px",
1136
+ "2xl": "1536px"
1137
+ }
1138
+ };
1139
+ }
1140
+ function postProcessWithLightning(rawCss) {
1141
+ if (!rawCss) return "";
1142
+ const native = getNativeBridge();
1143
+ if (!native?.processTailwindCssLightning) {
1144
+ throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
1145
+ }
1146
+ const result = native.processTailwindCssLightning(rawCss);
1147
+ if (!result?.css) {
1148
+ throw new Error("FATAL: processTailwindCssLightning returned null");
1149
+ }
1150
+ return result.css;
1151
+ }
1152
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1153
+ const filtered = classes.filter(Boolean);
1154
+ const uniqueMap = /* @__PURE__ */ new Map();
1155
+ filtered.forEach((cls) => uniqueMap.set(cls, cls));
1156
+ const unique = Array.from(uniqueMap.values());
1157
+ if (unique.length === 0) {
1158
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1159
+ }
1160
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
1161
+ const cached = _cssCache.get(cacheKey);
1162
+ if (cached) {
1163
+ _cacheHits++;
1164
+ if (process.env.DEBUG?.includes("compiler")) {
1165
+ console.log(
1166
+ `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
1167
+ );
1168
+ }
1169
+ return cached;
1170
+ }
1171
+ _cacheMisses++;
1172
+ let rawCss;
1173
+ let usedRustCompiler = false;
1174
+ const theme = getThemeConfig();
1175
+ rawCss = await generateCssNative(unique, { theme });
1176
+ usedRustCompiler = true;
1177
+ const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1178
+ if (process.env.DEBUG?.includes("compiler")) {
1179
+ console.log(
1180
+ `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
1181
+ `Size: ${finalCss.length} bytes`
1182
+ );
1183
+ }
1184
+ const result = {
1185
+ css: finalCss,
1186
+ classes: unique,
1187
+ sizeBytes: finalCss.length,
1188
+ optimized: minify
1189
+ };
1190
+ _evictOldestIfNeeded();
1191
+ _cssCache.set(cacheKey, result);
1192
+ return result;
1193
+ }
1194
+ function runCssPipelineSync(_classes) {
1195
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1196
+ }
1197
+ function processTailwindCssWithTargets(css, targets) {
1198
+ const native = getNativeBridge();
1199
+ if (!native?.processTailwindCssWithTargets) {
1200
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1201
+ }
1202
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1203
+ if (!result?.css) {
1204
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1205
+ }
1206
+ return result.css;
1207
+ }
1208
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1209
+ var init_tailwindEngine = __esm({
1210
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1211
+ init_nativeBridge();
1212
+ init_cssGeneratorNative();
1213
+ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href)));
1214
+ _cssCache = /* @__PURE__ */ new Map();
1215
+ _cacheHits = 0;
1216
+ _cacheMisses = 0;
1217
+ MAX_CACHE_SIZE = 100;
1218
+ }
1219
+ });
1220
+
1221
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1222
+ function compileCssNative2(classes, prefix) {
1223
+ const native = getNativeBridge();
1224
+ if (!native?.compileCss) throw new Error("compileCss not available");
1225
+ return native.compileCss(classes, prefix);
1226
+ }
1227
+ function compileCssLightning(classes) {
1228
+ const native = getNativeBridge();
1229
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1230
+ return native.compileCssLightning(classes);
1231
+ }
1232
+ function extractTwStateConfigsNative(source, filename) {
1233
+ const native = getNativeBridge();
1234
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1235
+ return native.extractTwStateConfigs(source, filename);
1236
+ }
1237
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1238
+ const native = getNativeBridge();
1239
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1240
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1241
+ }
1242
+ function extractAndGenerateStateCssNative(source, filename) {
1243
+ const native = getNativeBridge();
1244
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1245
+ return native.extractAndGenerateStateCss(source, filename);
1246
+ }
1247
+ function layoutClassesToCss(classes) {
1248
+ const native = getNativeBridge();
1249
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1250
+ return native.layoutClassesToCss(classes);
1251
+ }
1252
+ function hashContent(input, algorithm = "sha256", length = 8) {
1253
+ const native = getNativeBridge();
1254
+ if (!native?.hashContent) throw new Error("hashContent not available");
1255
+ return native.hashContent(input, algorithm, length);
1256
+ }
1257
+ function extractTwContainerConfigs(source) {
1258
+ const native = getNativeBridge();
1259
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1260
+ return native.extractTwContainerConfigs(source);
1261
+ }
1262
+ function parseAtomicClass(twClass) {
1263
+ const native = getNativeBridge();
1264
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1265
+ return native.parseAtomicClass(twClass);
1266
+ }
1267
+ function generateAtomicCss(rulesJson) {
1268
+ const native = getNativeBridge();
1269
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1270
+ return native.generateAtomicCss(rulesJson);
1271
+ }
1272
+ function toAtomicClasses(twClasses) {
1273
+ const native = getNativeBridge();
1274
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1275
+ return native.toAtomicClasses(twClasses);
1276
+ }
1277
+ function clearAtomicRegistry() {
1278
+ const native = getNativeBridge();
1279
+ if (!native?.clearAtomicRegistry) return;
1280
+ native.clearAtomicRegistry();
1281
+ }
1282
+ function atomicRegistrySize() {
1283
+ const native = getNativeBridge();
1284
+ if (!native?.atomicRegistrySize) return 0;
1285
+ return native.atomicRegistrySize();
1286
+ }
1287
+ var init_compilationNative = __esm({
1288
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1289
+ init_nativeBridge();
1290
+ }
1291
+ });
1292
+
1293
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1294
+ function compileClass(input) {
1295
+ const native = getNativeBridge();
1296
+ if (!native?.compile_class) throw new Error("compile_class not available");
1297
+ const resultJson = native.compile_class(input);
1298
+ try {
1299
+ return JSON.parse(resultJson);
1300
+ } catch {
1301
+ return {
1302
+ selector: "",
1303
+ declarations: "",
1304
+ properties: [],
1305
+ specificity: 0
1306
+ };
1307
+ }
1308
+ }
1309
+ function compileClasses(inputs) {
1310
+ const native = getNativeBridge();
1311
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1312
+ const resultJson = native.compile_classes(inputs);
1313
+ try {
1314
+ return JSON.parse(resultJson);
1315
+ } catch {
1316
+ return {
1317
+ css: "",
1318
+ resolved_classes: [],
1319
+ unknown_classes: [],
1320
+ size_bytes: 0,
1321
+ duration_ms: 0
1322
+ };
1323
+ }
1324
+ }
1325
+ function compileToCss(input, minify) {
1326
+ const native = getNativeBridge();
1327
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1328
+ return native.compile_to_css(input, minify ?? false);
1329
+ }
1330
+ function compileToCssBatch(inputs, minify) {
1331
+ const native = getNativeBridge();
1332
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1333
+ return native.compile_to_css_batch(inputs, minify ?? false);
1334
+ }
1335
+ function minifyCss(css) {
1336
+ const native = getNativeBridge();
1337
+ if (!native?.minify_css) throw new Error("minify_css not available");
1338
+ return native.minify_css(css);
1339
+ }
1340
+ function compileAnimation(animationName, from, to) {
1341
+ const native = getNativeBridge();
1342
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1343
+ const resultJson = native.compile_animation(animationName, from, to);
1344
+ try {
1345
+ return JSON.parse(resultJson);
1346
+ } catch {
1347
+ return {
1348
+ animation_id: "",
1349
+ keyframes_css: "",
1350
+ animation_rule: "",
1351
+ duration_ms: 0
1352
+ };
1353
+ }
1354
+ }
1355
+ function compileKeyframes(name, stopsJson) {
1356
+ const native = getNativeBridge();
1357
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1358
+ const resultJson = native.compile_keyframes(name, stopsJson);
1359
+ try {
1360
+ return JSON.parse(resultJson);
1361
+ } catch {
1362
+ return {
1363
+ animation_id: "",
1364
+ keyframes_css: "",
1365
+ animation_rule: "",
1366
+ duration_ms: 0
1367
+ };
1368
+ }
1369
+ }
1370
+ function compileTheme(tokensJson, themeName, prefix) {
1371
+ const native = getNativeBridge();
1372
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1373
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1374
+ try {
1375
+ return JSON.parse(resultJson);
1376
+ } catch {
1377
+ return {
1378
+ selector: ":root",
1379
+ variables: [],
1380
+ variables_css: "",
1381
+ theme_name: themeName
1382
+ };
1383
+ }
1384
+ }
1385
+ function twMerge(classString) {
1386
+ const native = getNativeBridge();
1387
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1388
+ return native.tw_merge(classString);
1389
+ }
1390
+ function twMergeMany(classStrings) {
1391
+ const native = getNativeBridge();
1392
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1393
+ return native.tw_merge_many(classStrings);
1394
+ }
1395
+ function twMergeWithSeparator(classString, options) {
1396
+ const native = getNativeBridge();
1397
+ if (!native?.tw_merge_with_separator)
1398
+ throw new Error("tw_merge_with_separator not available");
1399
+ const opts = {
1400
+ separator: options.separator,
1401
+ debug: options.debug
1402
+ };
1403
+ return native.tw_merge_with_separator(classString, opts);
1404
+ }
1405
+ function twMergeManyWithSeparator(classStrings, options) {
1406
+ const native = getNativeBridge();
1407
+ if (!native?.tw_merge_many_with_separator)
1408
+ throw new Error("tw_merge_many_with_separator not available");
1409
+ const opts = {
1410
+ separator: options.separator,
1411
+ debug: options.debug
1412
+ };
1413
+ return native.tw_merge_many_with_separator(classStrings, opts);
1414
+ }
1415
+ function twMergeRaw(classLists) {
1416
+ const native = getNativeBridge();
1417
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1418
+ return native.tw_merge_raw(classLists);
1419
+ }
1420
+ var init_cssCompilationNative = __esm({
1421
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1422
+ init_nativeBridge();
1423
+ }
1424
+ });
1425
+
1426
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1427
+ function idRegistryCreate() {
1428
+ const native = getNativeBridge();
1429
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1430
+ return native.id_registry_create();
1431
+ }
1432
+ function idRegistryGenerate(handle, name) {
1433
+ const native = getNativeBridge();
1434
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1435
+ return native.id_registry_generate(handle, name);
1436
+ }
1437
+ function idRegistryLookup(handle, name) {
1438
+ const native = getNativeBridge();
1439
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1440
+ return native.id_registry_lookup(handle, name);
1441
+ }
1442
+ function idRegistryNext(handle) {
1443
+ const native = getNativeBridge();
1444
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1445
+ return native.id_registry_next(handle);
1446
+ }
1447
+ function idRegistryDestroy(handle) {
1448
+ const native = getNativeBridge();
1449
+ if (!native?.id_registry_destroy) return;
1450
+ native.id_registry_destroy(handle);
1451
+ }
1452
+ function idRegistryReset(handle) {
1453
+ const native = getNativeBridge();
1454
+ if (!native?.id_registry_reset) return;
1455
+ native.id_registry_reset(handle);
1456
+ }
1457
+ function idRegistrySnapshot(handle) {
1458
+ const native = getNativeBridge();
1459
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1460
+ const snapshotJson = native.id_registry_snapshot(handle);
1461
+ try {
1462
+ return JSON.parse(snapshotJson);
1463
+ } catch {
1464
+ return {
1465
+ handle,
1466
+ next_id: 0,
1467
+ entries: [],
1468
+ total_entries: 0
1469
+ };
1470
+ }
1471
+ }
1472
+ function idRegistryActiveCount() {
1473
+ const native = getNativeBridge();
1474
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1475
+ return native.id_registry_active_count();
1476
+ }
1477
+ function registerPropertyName(propertyName) {
1478
+ const native = getNativeBridge();
1479
+ if (!native?.register_property_name)
1480
+ throw new Error("register_property_name not available");
1481
+ return native.register_property_name(propertyName);
1482
+ }
1483
+ function registerValueName(valueName) {
1484
+ const native = getNativeBridge();
1485
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1486
+ return native.register_value_name(valueName);
1487
+ }
1488
+ function propertyIdToString(propertyId) {
1489
+ const native = getNativeBridge();
1490
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1491
+ return native.property_id_to_string(propertyId);
1492
+ }
1493
+ function valueIdToString(valueId) {
1494
+ const native = getNativeBridge();
1495
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1496
+ return native.value_id_to_string(valueId);
1497
+ }
1498
+ function reverseLookupProperty(propertyId) {
1499
+ const native = getNativeBridge();
1500
+ if (!native?.reverse_lookup_property)
1501
+ throw new Error("reverse_lookup_property not available");
1502
+ return native.reverse_lookup_property(propertyId);
1503
+ }
1504
+ function reverseLookupValue(valueId) {
1505
+ const native = getNativeBridge();
1506
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1507
+ return native.reverse_lookup_value(valueId);
1508
+ }
1509
+ function idRegistryExport(handle) {
1510
+ const native = getNativeBridge();
1511
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1512
+ return native.id_registry_export(handle);
1513
+ }
1514
+ function idRegistryImport(importedData) {
1515
+ const native = getNativeBridge();
1516
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1517
+ return native.id_registry_import(importedData);
1518
+ }
1519
+ var init_idRegistryNative = __esm({
1520
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1521
+ init_nativeBridge();
1522
+ }
1523
+ });
1524
+
1525
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1526
+ function processFileChange(fileChangeJson) {
1527
+ const native = getNativeBridge();
1528
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1529
+ const resultJson = native.process_file_change(fileChangeJson);
1530
+ try {
1531
+ return JSON.parse(resultJson);
1532
+ } catch {
1533
+ return {
1534
+ file_path: "",
1535
+ status: "error",
1536
+ old_classes: [],
1537
+ new_classes: [],
1538
+ added_classes: [],
1539
+ removed_classes: [],
1540
+ changed: false,
1541
+ fingerprint: "",
1542
+ error: "Failed to parse result"
1543
+ };
1544
+ }
1545
+ }
1546
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1547
+ const native = getNativeBridge();
1548
+ if (!native?.compute_incremental_diff)
1549
+ throw new Error("compute_incremental_diff not available");
1550
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1551
+ try {
1552
+ return JSON.parse(resultJson);
1553
+ } catch {
1554
+ return {
1555
+ is_changed: false,
1556
+ changes_count: 0,
1557
+ diff: {
1558
+ added_files: [],
1559
+ removed_files: [],
1560
+ modified_files: [],
1561
+ added_classes: [],
1562
+ removed_classes: [],
1563
+ total_changes: 0
1564
+ },
1565
+ processing_time_ms: 0
1566
+ };
1567
+ }
1568
+ }
1569
+ function createFingerprint(filePath, fileContent) {
1570
+ const native = getNativeBridge();
1571
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1572
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1573
+ try {
1574
+ return JSON.parse(fingerprintJson);
1575
+ } catch {
1576
+ return {
1577
+ file_path: filePath,
1578
+ content_hash: "",
1579
+ size_bytes: fileContent.length,
1580
+ mtime_ms: Date.now(),
1581
+ class_hash: "",
1582
+ signature: ""
1583
+ };
1584
+ }
1585
+ }
1586
+ function injectStateHash(css, stateHash) {
1587
+ const native = getNativeBridge();
1588
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1589
+ const resultJson = native.inject_state_hash(css, stateHash);
1590
+ try {
1591
+ return JSON.parse(resultJson);
1592
+ } catch {
1593
+ return {
1594
+ injected: false,
1595
+ state_hash: stateHash,
1596
+ affected_files: 0,
1597
+ total_injected_bytes: 0
1598
+ };
1599
+ }
1600
+ }
1601
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1602
+ const native = getNativeBridge();
1603
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1604
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1605
+ try {
1606
+ return JSON.parse(resultJson);
1607
+ } catch {
1608
+ return {
1609
+ entries_before: 0,
1610
+ entries_after: 0,
1611
+ entries_removed: 0,
1612
+ freed_bytes: 0
1613
+ };
1614
+ }
1615
+ }
1616
+ function rebuildWorkspaceResult(rootDir, extensions) {
1617
+ const native = getNativeBridge();
1618
+ if (!native?.rebuild_workspace_result)
1619
+ throw new Error("rebuild_workspace_result not available");
1620
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1621
+ try {
1622
+ return JSON.parse(resultJson);
1623
+ } catch {
1624
+ return {
1625
+ total_files_scanned: 0,
1626
+ total_classes_found: 0,
1627
+ unique_classes: 0,
1628
+ build_time_ms: 0,
1629
+ files_with_changes: 0
1630
+ };
1631
+ }
1632
+ }
1633
+ function scanFileNative(filePath, fileContent) {
1634
+ const native = getNativeBridge();
1635
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1636
+ const resultJson = native.scan_file_native(filePath, fileContent);
1637
+ try {
1638
+ return JSON.parse(resultJson);
1639
+ } catch {
1640
+ return {
1641
+ file: filePath,
1642
+ classes: [],
1643
+ added_classes: [],
1644
+ removed_classes: [],
1645
+ changed: false
1646
+ };
1647
+ }
1648
+ }
1649
+ function scanFilesBatchNative(filesJson) {
1650
+ const native = getNativeBridge();
1651
+ if (!native?.scan_files_batch_native)
1652
+ throw new Error("scan_files_batch_native not available");
1653
+ const resultJson = native.scan_files_batch_native(filesJson);
1654
+ try {
1655
+ return JSON.parse(resultJson);
1656
+ } catch {
1657
+ return [];
1658
+ }
1659
+ }
1660
+ var init_streamingNative = __esm({
1661
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1662
+ init_nativeBridge();
1663
+ }
1664
+ });
1665
+
1666
+ // packages/domain/compiler/src/compiler/index.ts
1667
+ var init_compiler = __esm({
1668
+ "packages/domain/compiler/src/compiler/index.ts"() {
1669
+ init_cssGeneratorNative();
1670
+ init_compilationNative();
1671
+ init_cssCompilationNative();
1672
+ init_idRegistryNative();
1673
+ init_streamingNative();
1674
+ }
1675
+ });
1676
+
1677
+ // packages/domain/compiler/src/parser/index.ts
1678
+ var parser_exports = {};
1679
+ __export(parser_exports, {
1680
+ astExtractClasses: () => astExtractClasses,
1681
+ batchExtractClasses: () => batchExtractClasses,
1682
+ checkAgainstSafelist: () => checkAgainstSafelist,
1683
+ diffClassLists: () => diffClassLists,
1684
+ extractAllClasses: () => extractAllClasses,
1685
+ extractClassesFromSource: () => extractClassesFromSource,
1686
+ extractComponentUsage: () => extractComponentUsage,
1687
+ mergeClassesStatic: () => mergeClassesStatic,
1688
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1689
+ normalizeClasses: () => normalizeClasses,
1690
+ parseClasses: () => parseClasses
1691
+ });
1692
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1693
+ var init_parser = __esm({
1694
+ "packages/domain/compiler/src/parser/index.ts"() {
1695
+ init_nativeBridge();
1696
+ parseClasses = (raw) => {
1697
+ const native = getNativeBridge();
1698
+ if (!native?.parseClasses) {
1699
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1700
+ }
1701
+ return native.parseClasses(raw) || [];
1702
+ };
1703
+ extractAllClasses = (source) => {
1704
+ const native = getNativeBridge();
1705
+ if (!native?.extractAllClasses) {
1706
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1707
+ }
1708
+ return native.extractAllClasses(source) || [];
1709
+ };
1710
+ extractClassesFromSource = (source) => {
1711
+ const native = getNativeBridge();
1712
+ if (!native?.extractClassesFromSource) {
1713
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1714
+ }
1715
+ const result = native.extractClassesFromSource(source);
1716
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1717
+ };
1718
+ astExtractClasses = (source, _filename) => {
1719
+ const native = getNativeBridge();
1720
+ if (!native?.extractClassesFromSource) {
1721
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1722
+ }
1723
+ return native.extractClassesFromSource(source) || [];
1724
+ };
1725
+ normalizeClasses = (raw) => {
1726
+ const result = normalizeAndDedupClasses(raw);
1727
+ return result?.normalized || "";
1728
+ };
1729
+ mergeClassesStatic = (classes) => {
1730
+ const result = normalizeAndDedupClasses(classes);
1731
+ return result?.normalized || "";
1732
+ };
1733
+ normalizeAndDedupClasses = (raw) => {
1734
+ const native = getNativeBridge();
1735
+ if (!native?.normalizeAndDedupClasses) {
1736
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1737
+ }
1738
+ const result = native.normalizeAndDedupClasses(raw);
1739
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1740
+ };
1741
+ extractComponentUsage = (source) => {
1742
+ const native = getNativeBridge();
1743
+ if (!native?.extractComponentUsage) {
1744
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1745
+ }
1746
+ return native.extractComponentUsage(source) || [];
1747
+ };
1748
+ batchExtractClasses = (filePaths) => {
1749
+ const native = getNativeBridge();
1750
+ if (!native?.batchExtractClasses) {
1751
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1752
+ }
1753
+ return native.batchExtractClasses(filePaths) || [];
1754
+ };
1755
+ checkAgainstSafelist = (classes, safelist) => {
1756
+ const native = getNativeBridge();
1757
+ if (!native?.checkAgainstSafelist) {
1758
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1759
+ }
1760
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1761
+ };
1762
+ diffClassLists = (previous, current) => {
1763
+ const native = getNativeBridge();
1764
+ if (!native?.diffClassLists) {
1765
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1766
+ }
1767
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1768
+ };
1769
+ }
1770
+ });
1771
+
1772
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1773
+ function detectDeadCode(scanResultJson, css) {
1774
+ const native = getNativeBridge();
1775
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1776
+ return native.detectDeadCode(scanResultJson, css);
1777
+ }
1778
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1779
+ const native = getNativeBridge();
1780
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1781
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1782
+ }
1783
+ function analyzeClassesNative(filesJson, cwd, flags) {
1784
+ const native = getNativeBridge();
1785
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1786
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1787
+ }
1788
+ function analyzeRscNative(source, filename) {
1789
+ const native = getNativeBridge();
1790
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1791
+ return native.analyzeRsc(source, filename);
1792
+ }
1793
+ function optimizeCssNative(css) {
1794
+ const native = getNativeBridge();
1795
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1796
+ const result = native.processTailwindCssLightning(css);
1797
+ return {
1798
+ css: result.css,
1799
+ originalSize: css.length,
1800
+ optimizedSize: result.size_bytes,
1801
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1802
+ };
1803
+ }
1804
+ function processTailwindCssLightning(css) {
1805
+ const native = getNativeBridge();
1806
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1807
+ return native.processTailwindCssLightning(css);
1808
+ }
1809
+ function eliminateDeadCssNative(css, deadClasses) {
1810
+ const native = getNativeBridge();
1811
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1812
+ return native.eliminateDeadCss(css, deadClasses);
1813
+ }
1814
+ function hoistComponentsNative(source) {
1815
+ const native = getNativeBridge();
1816
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1817
+ return native.hoistComponents(source);
1818
+ }
1819
+ function compileVariantTableNative(configJson) {
1820
+ const native = getNativeBridge();
1821
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1822
+ return native.compileVariantTable(configJson);
1823
+ }
1824
+ function classifyAndSortClassesNative(classes) {
1825
+ const native = getNativeBridge();
1826
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1827
+ return native.classifyAndSortClasses(classes);
1828
+ }
1829
+ function mergeCssDeclarationsNative(cssChunks) {
1830
+ const native = getNativeBridge();
1831
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1832
+ return native.mergeCssDeclarations(cssChunks);
1833
+ }
1834
+ var init_analyzerNative = __esm({
1835
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1836
+ init_nativeBridge();
1837
+ }
1838
+ });
1839
+
1840
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1841
+ function resolveVariants(configJson) {
1842
+ const native = getNativeBridge();
1843
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1844
+ const resultJson = native.resolve_variants(configJson);
1845
+ try {
1846
+ return JSON.parse(resultJson);
1847
+ } catch {
1848
+ return {
1849
+ variants: [],
1850
+ supported: [],
1851
+ deprecated: [],
1852
+ conflicting: []
1853
+ };
1854
+ }
1855
+ }
1856
+ function validateThemeConfig(configJson) {
1857
+ const native = getNativeBridge();
1858
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1859
+ const resultJson = native.validate_variant_config(configJson);
1860
+ try {
1861
+ return JSON.parse(resultJson);
1862
+ } catch {
1863
+ return {
1864
+ is_valid: false,
1865
+ errors: ["Unable to parse configuration"],
1866
+ warnings: [],
1867
+ suggestions: []
1868
+ };
1869
+ }
1870
+ }
1871
+ function resolveCascade(baseThemeJson, overridesJson) {
1872
+ const native = getNativeBridge();
1873
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1874
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1875
+ try {
1876
+ return JSON.parse(resultJson);
1877
+ } catch {
1878
+ return {
1879
+ base_theme: {},
1880
+ user_overrides: {},
1881
+ merged_theme: {},
1882
+ conflict_resolutions: []
1883
+ };
1884
+ }
1885
+ }
1886
+ function resolveClassNames(classNames, themeJson) {
1887
+ const native = getNativeBridge();
1888
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1889
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1890
+ try {
1891
+ return JSON.parse(resultJson);
1892
+ } catch {
1893
+ return [];
1894
+ }
1895
+ }
1896
+ function resolveConflictGroup(groupName, themeJson) {
1897
+ const native = getNativeBridge();
1898
+ if (!native?.resolve_conflict_group)
1899
+ throw new Error("resolve_conflict_group not available");
1900
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1901
+ try {
1902
+ return JSON.parse(resultJson);
1903
+ } catch {
1904
+ return {
1905
+ group_name: groupName,
1906
+ conflicting_classes: [],
1907
+ description: "",
1908
+ resolution_strategy: "last-wins"
1909
+ };
1910
+ }
1911
+ }
1912
+ function resolveThemeValue(keyPath, themeJson) {
1913
+ const native = getNativeBridge();
1914
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1915
+ return native.resolve_theme_value(keyPath, themeJson);
1916
+ }
1917
+ function resolveSimpleVariants(configJson) {
1918
+ const native = getNativeBridge();
1919
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1920
+ const resultJson = native.resolve_simple_variants(configJson);
1921
+ try {
1922
+ return JSON.parse(resultJson);
1923
+ } catch {
1924
+ return [];
1925
+ }
1926
+ }
1927
+ var init_themeResolutionNative = __esm({
1928
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
1929
+ init_nativeBridge();
1930
+ }
1931
+ });
1932
+
1933
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
1934
+ function scanWorkspace(root, extensions) {
1935
+ const native = getNativeBridge();
1936
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
1937
+ return native.scan_workspace(root, extensions);
1938
+ }
1939
+ function extractClassesFromSourceNative(source) {
1940
+ const native = getNativeBridge();
1941
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
1942
+ return native.extract_classes_from_source(source);
1943
+ }
1944
+ function batchExtractClassesNative(filePaths) {
1945
+ const native = getNativeBridge();
1946
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
1947
+ return native.batch_extract_classes(filePaths);
1948
+ }
1949
+ function checkAgainstSafelistNative(classes, safelist) {
1950
+ const native = getNativeBridge();
1951
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
1952
+ return native.check_against_safelist(classes, safelist);
1953
+ }
1954
+ function scanFile(filePath) {
1955
+ const native = getNativeBridge();
1956
+ if (!native?.scan_file) throw new Error("scan_file not available");
1957
+ return native.scan_file(filePath);
1958
+ }
1959
+ function collectFiles(root, extensions) {
1960
+ const native = getNativeBridge();
1961
+ if (!native?.collect_files) throw new Error("collect_files not available");
1962
+ return native.collect_files(root, extensions);
1963
+ }
1964
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
1965
+ const native = getNativeBridge();
1966
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
1967
+ return native.walk_and_prefilter_source_files(root, extensions);
1968
+ }
1969
+ function generateSubComponentTypes(root, outputPath) {
1970
+ const native = getNativeBridge();
1971
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
1972
+ return native.generate_sub_component_types(root, outputPath);
1973
+ }
1974
+ var init_scannerNative = __esm({
1975
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
1976
+ init_nativeBridge();
1977
+ }
1978
+ });
1979
+
1980
+ // packages/domain/compiler/src/analyzer/index.ts
1981
+ var init_analyzer = __esm({
1982
+ "packages/domain/compiler/src/analyzer/index.ts"() {
1983
+ init_analyzerNative();
1984
+ init_themeResolutionNative();
1985
+ init_scannerNative();
1986
+ }
1987
+ });
1988
+
1989
+ // packages/domain/compiler/src/cache/cacheNative.ts
1990
+ function getCacheStatistics() {
1991
+ const native = getNativeBridge();
1992
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
1993
+ const statsJson = native.get_cache_statistics();
1994
+ try {
1995
+ return JSON.parse(statsJson);
1996
+ } catch {
1997
+ return {
1998
+ parse_cache: { hits: 0, misses: 0, size: 0 },
1999
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2000
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2001
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2002
+ overall_hit_rate: 0,
2003
+ total_memory_bytes: 0
2004
+ };
2005
+ }
2006
+ }
2007
+ function clearAllCaches() {
2008
+ const native = getNativeBridge();
2009
+ if (!native?.clear_all_caches) return;
2010
+ try {
2011
+ native.clear_all_caches();
2012
+ } catch {
2013
+ }
2014
+ }
2015
+ function clearParseCache() {
2016
+ const native = getNativeBridge();
2017
+ if (!native?.clear_parse_cache) return;
2018
+ try {
2019
+ native.clear_parse_cache();
2020
+ } catch {
2021
+ }
2022
+ }
2023
+ function clearResolveCache() {
2024
+ const native = getNativeBridge();
2025
+ if (!native?.clear_resolve_cache) return;
2026
+ try {
2027
+ native.clear_resolve_cache();
2028
+ } catch {
2029
+ }
2030
+ }
2031
+ function clearCompileCache() {
2032
+ const native = getNativeBridge();
2033
+ if (!native?.clear_compile_cache) return;
2034
+ try {
2035
+ native.clear_compile_cache();
2036
+ } catch {
2037
+ }
2038
+ }
2039
+ function clearCssGenCache() {
2040
+ const native = getNativeBridge();
2041
+ if (!native?.clear_css_gen_cache) return;
2042
+ try {
2043
+ native.clear_css_gen_cache();
2044
+ } catch {
2045
+ }
2046
+ }
2047
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2048
+ const native = getNativeBridge();
2049
+ if (!native?.get_cache_optimization_hints)
2050
+ throw new Error("get_cache_optimization_hints not available");
2051
+ const hintsJson = native.get_cache_optimization_hints(
2052
+ Math.min(100, Math.max(0, hitRatePercent)),
2053
+ Math.max(1, memoryUsedMb)
2054
+ );
2055
+ try {
2056
+ return JSON.parse(hintsJson);
2057
+ } catch {
2058
+ return {
2059
+ current_strategy: "unknown",
2060
+ recommended_strategy: "increase_size",
2061
+ estimated_improvement_percent: 0,
2062
+ suggested_memory_mb: 256,
2063
+ notes: ["Unable to analyze cache statistics"]
2064
+ };
2065
+ }
2066
+ }
2067
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2068
+ const native = getNativeBridge();
2069
+ if (!native?.estimate_optimal_cache_config_native)
2070
+ throw new Error("estimate_optimal_cache_config_native not available");
2071
+ const configJson = native.estimate_optimal_cache_config_native(
2072
+ Math.max(64, totalBudgetMb),
2073
+ workloadType
2074
+ );
2075
+ try {
2076
+ return JSON.parse(configJson);
2077
+ } catch {
2078
+ return {
2079
+ parse_cache_size: 128,
2080
+ resolve_cache_size: 64,
2081
+ compile_cache_size: 256,
2082
+ css_gen_cache_size: 128,
2083
+ recommended_eviction_policy: "lru",
2084
+ ttl_seconds: 3600,
2085
+ expected_hit_rate_percent: 75
2086
+ };
2087
+ }
2088
+ }
2089
+ function cacheRead(cachePath) {
2090
+ const native = getNativeBridge();
2091
+ if (!native?.cache_read) throw new Error("cache_read not available");
2092
+ const result = native.cache_read(cachePath);
2093
+ try {
2094
+ return JSON.parse(result.entries_json || "[]");
2095
+ } catch {
2096
+ return [];
2097
+ }
2098
+ }
2099
+ function cacheWrite(cachePath, entries) {
2100
+ const native = getNativeBridge();
2101
+ if (!native?.cache_write) throw new Error("cache_write not available");
2102
+ try {
2103
+ const result = native.cache_write(
2104
+ cachePath,
2105
+ entries.map((e) => ({
2106
+ file: e.file,
2107
+ content_hash: e.contentHash,
2108
+ classes: e.classes,
2109
+ mtime_ms: e.mtimeMs,
2110
+ size_bytes: e.sizeBytes
2111
+ }))
2112
+ );
2113
+ return typeof result === "boolean" ? result : result === true;
2114
+ } catch {
2115
+ return false;
2116
+ }
2117
+ }
2118
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2119
+ const native = getNativeBridge();
2120
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2121
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2122
+ }
2123
+ var init_cacheNative = __esm({
2124
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2125
+ init_nativeBridge();
2126
+ }
2127
+ });
2128
+
2129
+ // packages/domain/compiler/src/cache/index.ts
2130
+ var init_cache = __esm({
2131
+ "packages/domain/compiler/src/cache/index.ts"() {
2132
+ init_cacheNative();
2133
+ }
2134
+ });
2135
+
2136
+ // packages/domain/compiler/src/redis/redisNative.ts
2137
+ function redisPing() {
2138
+ const native = getNativeBridge();
2139
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2140
+ return native.redis_ping();
2141
+ }
2142
+ function redisGet(key) {
2143
+ const native = getNativeBridge();
2144
+ if (!native?.redis_get) throw new Error("redis_get not available");
2145
+ const result = native.redis_get(key);
2146
+ return result === "nil" ? null : result;
2147
+ }
2148
+ function redisSet(key, value, ttl_seconds) {
2149
+ const native = getNativeBridge();
2150
+ if (!native?.redis_set) throw new Error("redis_set not available");
2151
+ return native.redis_set(key, value, ttl_seconds);
2152
+ }
2153
+ function redisDelete(key) {
2154
+ const native = getNativeBridge();
2155
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2156
+ return native.redis_delete(key);
2157
+ }
2158
+ function redisExists(key) {
2159
+ const native = getNativeBridge();
2160
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2161
+ return native.redis_exists(key);
2162
+ }
2163
+ function redisMget(keys) {
2164
+ const native = getNativeBridge();
2165
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2166
+ const result = native.redis_mget(keys);
2167
+ try {
2168
+ return JSON.parse(result);
2169
+ } catch {
2170
+ return keys.map(() => null);
2171
+ }
2172
+ }
2173
+ function redisMset(pairs) {
2174
+ const native = getNativeBridge();
2175
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2176
+ return native.redis_mset(pairs);
2177
+ }
2178
+ function redisFlushDb() {
2179
+ const native = getNativeBridge();
2180
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2181
+ return native.redis_flush_db();
2182
+ }
2183
+ function redisFlushAll() {
2184
+ const native = getNativeBridge();
2185
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2186
+ return native.redis_flush_all();
2187
+ }
2188
+ function redisPoolConnect(host, port, pool_size) {
2189
+ const native = getNativeBridge();
2190
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2191
+ return native.redis_pool_connect(host, port, pool_size);
2192
+ }
2193
+ function redisPoolStats() {
2194
+ const native = getNativeBridge();
2195
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2196
+ const result = native.redis_pool_stats();
2197
+ try {
2198
+ return JSON.parse(result);
2199
+ } catch {
2200
+ return {
2201
+ connected_count: 0,
2202
+ idle_count: 0,
2203
+ waiting_count: 0,
2204
+ total_requests: 0,
2205
+ total_errors: 0
2206
+ };
2207
+ }
2208
+ }
2209
+ function redisPoolReconnect() {
2210
+ const native = getNativeBridge();
2211
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2212
+ return native.redis_pool_reconnect();
2213
+ }
2214
+ function redisEnableCluster(initial_nodes) {
2215
+ const native = getNativeBridge();
2216
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2217
+ const result = native.redis_enable_cluster(initial_nodes);
2218
+ try {
2219
+ return JSON.parse(result);
2220
+ } catch {
2221
+ return {
2222
+ enabled: false,
2223
+ cluster_state: "error",
2224
+ nodes: [],
2225
+ slots_assigned: 0,
2226
+ slots_ok: 0,
2227
+ slots_fail: 0
2228
+ };
2229
+ }
2230
+ }
2231
+ function redisDisableCluster() {
2232
+ const native = getNativeBridge();
2233
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2234
+ return native.redis_disable_cluster();
2235
+ }
2236
+ function redisClusterStatus() {
2237
+ const native = getNativeBridge();
2238
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2239
+ const result = native.redis_cluster_status();
2240
+ try {
2241
+ return JSON.parse(result);
2242
+ } catch {
2243
+ return {
2244
+ enabled: false,
2245
+ cluster_state: "unknown",
2246
+ nodes: [],
2247
+ slots_assigned: 0,
2248
+ slots_ok: 0,
2249
+ slots_fail: 0
2250
+ };
2251
+ }
2252
+ }
2253
+ function redisSubscribe(channel) {
2254
+ const native = getNativeBridge();
2255
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2256
+ return native.redis_subscribe(channel);
2257
+ }
2258
+ function redisPublish(channel, message) {
2259
+ const native = getNativeBridge();
2260
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2261
+ return native.redis_publish(channel, message);
2262
+ }
2263
+ function redisExpirationSet(key, ttl_seconds) {
2264
+ const native = getNativeBridge();
2265
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2266
+ return native.redis_expiration_set(key, ttl_seconds);
2267
+ }
2268
+ function redisExpirationGet(key) {
2269
+ const native = getNativeBridge();
2270
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2271
+ const result = native.redis_expiration_get(key);
2272
+ try {
2273
+ return JSON.parse(result);
2274
+ } catch {
2275
+ return {
2276
+ key,
2277
+ ttl_seconds: -1,
2278
+ expiration_timestamp: 0,
2279
+ is_persistent: true
2280
+ };
2281
+ }
2282
+ }
2283
+ function redisInfo() {
2284
+ const native = getNativeBridge();
2285
+ if (!native?.redis_info) throw new Error("redis_info not available");
2286
+ return native.redis_info();
2287
+ }
2288
+ function redisMonitor() {
2289
+ const native = getNativeBridge();
2290
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2291
+ return native.redis_monitor();
2292
+ }
2293
+ function redisCacheSize() {
2294
+ const native = getNativeBridge();
2295
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2296
+ return native.redis_cache_size();
2297
+ }
2298
+ function redisCacheKeyCount() {
2299
+ const native = getNativeBridge();
2300
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2301
+ return native.redis_cache_key_count();
2302
+ }
2303
+ function redisCacheClear() {
2304
+ const native = getNativeBridge();
2305
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2306
+ return native.redis_cache_clear();
2307
+ }
2308
+ function redisCacheHitRate() {
2309
+ const native = getNativeBridge();
2310
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2311
+ return native.redis_cache_hit_rate();
2312
+ }
2313
+ function redisEnablePersistence(mode) {
2314
+ const native = getNativeBridge();
2315
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2316
+ return native.redis_enable_persistence(mode);
2317
+ }
2318
+ function redisDisablePersistence() {
2319
+ const native = getNativeBridge();
2320
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2321
+ return native.redis_disable_persistence();
2322
+ }
2323
+ function redisSnapshot() {
2324
+ const native = getNativeBridge();
2325
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2326
+ return native.redis_snapshot();
2327
+ }
2328
+ function redisMemoryStats() {
2329
+ const native = getNativeBridge();
2330
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2331
+ return native.redis_memory_stats();
2332
+ }
2333
+ function redisOptimizeMemory() {
2334
+ const native = getNativeBridge();
2335
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2336
+ return native.redis_optimize_memory();
2337
+ }
2338
+ function redisSetEvictionPolicy(policy) {
2339
+ const native = getNativeBridge();
2340
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2341
+ return native.redis_set_eviction_policy(policy);
2342
+ }
2343
+ function redisGetEvictionPolicy() {
2344
+ const native = getNativeBridge();
2345
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2346
+ return native.redis_get_eviction_policy();
2347
+ }
2348
+ function redisReplicate(target_host, target_port) {
2349
+ const native = getNativeBridge();
2350
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2351
+ return native.redis_replicate(target_host, target_port);
2352
+ }
2353
+ function redisReplicationStatus() {
2354
+ const native = getNativeBridge();
2355
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2356
+ return native.redis_replication_status();
2357
+ }
2358
+ function redisCacheSync(peers) {
2359
+ const native = getNativeBridge();
2360
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2361
+ return native.redis_cache_sync(peers);
2362
+ }
2363
+ function redisEnableCacheWarming(key_pattern) {
2364
+ const native = getNativeBridge();
2365
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2366
+ return native.redis_enable_cache_warming(key_pattern);
2367
+ }
2368
+ function redisDisableCacheWarming() {
2369
+ const native = getNativeBridge();
2370
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2371
+ return native.redis_disable_cache_warming();
2372
+ }
2373
+ function redisDiagnose() {
2374
+ const native = getNativeBridge();
2375
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2376
+ return native.redis_diagnose();
2377
+ }
2378
+ var init_redisNative = __esm({
2379
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2380
+ init_nativeBridge();
2381
+ }
2382
+ });
2383
+
2384
+ // packages/domain/compiler/src/redis/index.ts
2385
+ var init_redis = __esm({
2386
+ "packages/domain/compiler/src/redis/index.ts"() {
2387
+ init_redisNative();
2388
+ }
2389
+ });
2390
+
2391
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2392
+ function startWatch(root_path, patterns) {
2393
+ const native = getNativeBridge();
2394
+ if (!native?.start_watch) throw new Error("start_watch not available");
2395
+ return native.start_watch(root_path, patterns);
2396
+ }
2397
+ function pollWatchEvents(handle, timeout_ms) {
2398
+ const native = getNativeBridge();
2399
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2400
+ const result = native.poll_watch_events(handle, timeout_ms);
2401
+ try {
2402
+ return JSON.parse(result);
2403
+ } catch {
2404
+ return [];
2405
+ }
2406
+ }
2407
+ function stopWatch(handle) {
2408
+ const native = getNativeBridge();
2409
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2410
+ return native.stop_watch(handle);
2411
+ }
2412
+ function watchAddPattern(handle, pattern) {
2413
+ const native = getNativeBridge();
2414
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2415
+ return native.watch_add_pattern(handle, pattern);
2416
+ }
2417
+ function watchRemovePattern(handle, pattern) {
2418
+ const native = getNativeBridge();
2419
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2420
+ return native.watch_remove_pattern(handle, pattern);
2421
+ }
2422
+ function watchGetActiveHandles() {
2423
+ const native = getNativeBridge();
2424
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2425
+ const result = native.watch_get_active_handles();
2426
+ try {
2427
+ return JSON.parse(result);
2428
+ } catch {
2429
+ return [];
2430
+ }
2431
+ }
2432
+ function watchClearAll() {
2433
+ const native = getNativeBridge();
2434
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2435
+ return native.watch_clear_all();
2436
+ }
2437
+ function watchEventTypeToString(event_type_code) {
2438
+ const native = getNativeBridge();
2439
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2440
+ return native.watch_event_type_to_string(event_type_code);
2441
+ }
2442
+ function isWatchRunning(handle) {
2443
+ const native = getNativeBridge();
2444
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2445
+ return native.is_watch_running(handle);
2446
+ }
2447
+ function getWatchStats() {
2448
+ const native = getNativeBridge();
2449
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2450
+ const result = native.get_watch_stats();
2451
+ try {
2452
+ return JSON.parse(result);
2453
+ } catch {
2454
+ return {
2455
+ active_watchers: 0,
2456
+ total_events: 0,
2457
+ events_this_second: 0,
2458
+ average_latency_ms: 0,
2459
+ largest_batch_size: 0
2460
+ };
2461
+ }
2462
+ }
2463
+ function watchPause(handle) {
2464
+ const native = getNativeBridge();
2465
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2466
+ return native.watch_pause(handle);
2467
+ }
2468
+ function watchResume(handle) {
2469
+ const native = getNativeBridge();
2470
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2471
+ return native.watch_resume(handle);
2472
+ }
2473
+ function scanCacheOptimizations() {
2474
+ const native = getNativeBridge();
2475
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2476
+ return native.scan_cache_optimizations();
2477
+ }
2478
+ function getPluginHooks() {
2479
+ const native = getNativeBridge();
2480
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2481
+ const result = native.get_plugin_hooks();
2482
+ try {
2483
+ return JSON.parse(result);
2484
+ } catch {
2485
+ return [];
2486
+ }
2487
+ }
2488
+ function registerPluginHook(hook_name, handler_id) {
2489
+ const native = getNativeBridge();
2490
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2491
+ return native.register_plugin_hook(hook_name, handler_id);
2492
+ }
2493
+ function unregisterPluginHook(hook_name, handler_id) {
2494
+ const native = getNativeBridge();
2495
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2496
+ return native.unregister_plugin_hook(hook_name, handler_id);
2497
+ }
2498
+ function emitPluginHook(hook_name, data_json) {
2499
+ const native = getNativeBridge();
2500
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2501
+ return native.emit_plugin_hook(hook_name, data_json);
2502
+ }
2503
+ function getCompilationMetrics() {
2504
+ const native = getNativeBridge();
2505
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2506
+ return native.get_compilation_metrics();
2507
+ }
2508
+ function resetCompilationMetrics() {
2509
+ const native = getNativeBridge();
2510
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2511
+ return native.reset_compilation_metrics();
2512
+ }
2513
+ function validateCssOutput(css) {
2514
+ const native = getNativeBridge();
2515
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2516
+ return native.validate_css_output(css);
2517
+ }
2518
+ function getCompilerDiagnostics() {
2519
+ const native = getNativeBridge();
2520
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2521
+ return native.get_compiler_diagnostics();
2522
+ }
2523
+ var init_watchSystemNative = __esm({
2524
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
2525
+ init_nativeBridge();
2526
+ }
2527
+ });
2528
+
2529
+ // packages/domain/compiler/src/watch/index.ts
2530
+ var init_watch = __esm({
2531
+ "packages/domain/compiler/src/watch/index.ts"() {
2532
+ init_watchSystemNative();
2533
+ }
2534
+ });
2535
+
2536
+ // packages/domain/compiler/src/internal.ts
2537
+ var internal_exports = {};
2538
+ __export(internal_exports, {
2539
+ adaptNativeResult: () => adaptNativeResult,
2540
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
2541
+ analyzeClasses: () => analyzeClasses,
2542
+ analyzeClassesNative: () => analyzeClassesNative,
2543
+ analyzeFile: () => analyzeFile,
2544
+ analyzeRscNative: () => analyzeRscNative,
2545
+ analyzeVariantUsage: () => analyzeVariantUsage,
2546
+ astExtractClasses: () => astExtractClasses,
2547
+ atomicRegistrySize: () => atomicRegistrySize,
2548
+ batchExtractClasses: () => batchExtractClasses,
2549
+ batchExtractClassesNative: () => batchExtractClassesNative,
2550
+ bucketSort: () => bucketSort,
2551
+ buildStyleTag: () => buildStyleTag,
2552
+ cachePriority: () => cachePriority,
2553
+ cacheRead: () => cacheRead,
2554
+ cacheWrite: () => cacheWrite,
2555
+ checkAgainstSafelist: () => checkAgainstSafelist,
2556
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2557
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
2558
+ classifyNode: () => classifyNode,
2559
+ clearAllCaches: () => clearAllCaches,
2560
+ clearAtomicRegistry: () => clearAtomicRegistry,
2561
+ clearCache: () => clearCache,
2562
+ clearCompileCache: () => clearCompileCache,
2563
+ clearCssGenCache: () => clearCssGenCache,
2564
+ clearParseCache: () => clearParseCache,
2565
+ clearResolveCache: () => clearResolveCache,
2566
+ clearThemeCache: () => clearThemeCache,
2567
+ collectFiles: () => collectFiles,
2568
+ compileAnimation: () => compileAnimation,
2569
+ compileClass: () => compileClass,
2570
+ compileClasses: () => compileClasses,
2571
+ compileCssFromClasses: () => compileCssFromClasses,
2572
+ compileCssLightning: () => compileCssLightning,
2573
+ compileCssNative2: () => compileCssNative2,
2574
+ compileKeyframes: () => compileKeyframes,
2575
+ compileTheme: () => compileTheme,
2576
+ compileToCss: () => compileToCss,
2577
+ compileToCssBatch: () => compileToCssBatch,
2578
+ compileVariantTableNative: () => compileVariantTableNative,
2579
+ computeIncrementalDiff: () => computeIncrementalDiff,
2580
+ createFingerprint: () => createFingerprint,
2581
+ detectConflicts: () => detectConflicts,
2582
+ detectDeadCode: () => detectDeadCode,
2583
+ diffClassLists: () => diffClassLists,
2584
+ eliminateDeadCss: () => eliminateDeadCss,
2585
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
2586
+ emitPluginHook: () => emitPluginHook,
2587
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
2588
+ extractAllClasses: () => extractAllClasses,
2589
+ extractAndGenerateStateCss: () => extractAndGenerateStateCss,
2590
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
2591
+ extractClassesFromSource: () => extractClassesFromSource,
2592
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
2593
+ extractComponentUsage: () => extractComponentUsage,
2594
+ extractContainerCssFromSource: () => extractContainerCssFromSource,
2595
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
2596
+ extractTwStateConfigs: () => extractTwStateConfigs,
2597
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
2598
+ fileToRoute: () => fileToRoute,
2599
+ findDeadVariants: () => findDeadVariants,
2600
+ generateAtomicCss: () => generateAtomicCss,
2601
+ generateCssForClasses: () => generateCssForClasses,
2602
+ generateCssNative: () => generateCssNative,
2603
+ generateSafelist: () => generateSafelist,
2604
+ generateStaticStateCss: () => generateStaticStateCss,
2605
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
2606
+ generateSubComponentTypes: () => generateSubComponentTypes,
2607
+ getAllRoutes: () => getAllRoutes,
2608
+ getBucketEngine: () => getBucketEngine,
2609
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
2610
+ getCacheStatistics: () => getCacheStatistics,
2611
+ getCacheStats: () => getCacheStats,
2612
+ getCompilationMetrics: () => getCompilationMetrics,
2613
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
2614
+ getContentPaths: () => getContentPaths,
2615
+ getIncrementalEngine: () => getIncrementalEngine,
2616
+ getNativeBridge: () => getNativeBridge,
2617
+ getPluginHooks: () => getPluginHooks,
2618
+ getRouteClasses: () => getRouteClasses,
2619
+ getWatchStats: () => getWatchStats,
2620
+ hasTwUsage: () => hasTwUsage,
2621
+ hashContent: () => hashContent,
2622
+ hoistComponentsNative: () => hoistComponentsNative,
2623
+ idRegistryActiveCount: () => idRegistryActiveCount,
2624
+ idRegistryCreate: () => idRegistryCreate,
2625
+ idRegistryDestroy: () => idRegistryDestroy,
2626
+ idRegistryExport: () => idRegistryExport,
2627
+ idRegistryGenerate: () => idRegistryGenerate,
2628
+ idRegistryImport: () => idRegistryImport,
2629
+ idRegistryLookup: () => idRegistryLookup,
2630
+ idRegistryNext: () => idRegistryNext,
2631
+ idRegistryReset: () => idRegistryReset,
2632
+ idRegistrySnapshot: () => idRegistrySnapshot,
2633
+ injectClientDirective: () => injectClientDirective,
2634
+ injectServerOnlyComment: () => injectServerOnlyComment,
2635
+ injectStateHash: () => injectStateHash,
2636
+ isAlreadyTransformed: () => isAlreadyTransformed,
2637
+ isWatchRunning: () => isWatchRunning,
2638
+ layoutClassesToCss: () => layoutClassesToCss,
2639
+ loadSafelist: () => loadSafelist,
2640
+ loadTailwindConfig: () => loadTailwindConfig,
2641
+ mergeClassesStatic: () => mergeClassesStatic,
2642
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
2643
+ minifyCss: () => minifyCss,
2644
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
2645
+ normalizeClasses: () => normalizeClasses,
2646
+ optimizeCssNative: () => optimizeCssNative,
2647
+ parseAtomicClass: () => parseAtomicClass,
2648
+ parseClasses: () => parseClasses,
2649
+ pollWatchEvents: () => pollWatchEvents,
2650
+ processFileChange: () => processFileChange,
2651
+ processTailwindCssLightning: () => processTailwindCssLightning,
2652
+ propertyIdToString: () => propertyIdToString,
2653
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
2654
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
2655
+ redisCacheClear: () => redisCacheClear,
2656
+ redisCacheHitRate: () => redisCacheHitRate,
2657
+ redisCacheKeyCount: () => redisCacheKeyCount,
2658
+ redisCacheSize: () => redisCacheSize,
2659
+ redisCacheSync: () => redisCacheSync,
2660
+ redisClusterStatus: () => redisClusterStatus,
2661
+ redisDelete: () => redisDelete,
2662
+ redisDiagnose: () => redisDiagnose,
2663
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
2664
+ redisDisableCluster: () => redisDisableCluster,
2665
+ redisDisablePersistence: () => redisDisablePersistence,
2666
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
2667
+ redisEnableCluster: () => redisEnableCluster,
2668
+ redisEnablePersistence: () => redisEnablePersistence,
2669
+ redisExists: () => redisExists,
2670
+ redisExpirationGet: () => redisExpirationGet,
2671
+ redisExpirationSet: () => redisExpirationSet,
2672
+ redisFlushAll: () => redisFlushAll,
2673
+ redisFlushDb: () => redisFlushDb,
2674
+ redisGet: () => redisGet,
2675
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
2676
+ redisInfo: () => redisInfo,
2677
+ redisMemoryStats: () => redisMemoryStats,
2678
+ redisMget: () => redisMget,
2679
+ redisMonitor: () => redisMonitor,
2680
+ redisMset: () => redisMset,
2681
+ redisOptimizeMemory: () => redisOptimizeMemory,
2682
+ redisPing: () => redisPing,
2683
+ redisPoolConnect: () => redisPoolConnect,
2684
+ redisPoolReconnect: () => redisPoolReconnect,
2685
+ redisPoolStats: () => redisPoolStats,
2686
+ redisPublish: () => redisPublish,
2687
+ redisReplicate: () => redisReplicate,
2688
+ redisReplicationStatus: () => redisReplicationStatus,
2689
+ redisSet: () => redisSet,
2690
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
2691
+ redisSnapshot: () => redisSnapshot,
2692
+ redisSubscribe: () => redisSubscribe,
2693
+ registerFileClasses: () => registerFileClasses,
2694
+ registerGlobalClasses: () => registerGlobalClasses,
2695
+ registerPluginHook: () => registerPluginHook,
2696
+ registerPropertyName: () => registerPropertyName,
2697
+ registerValueName: () => registerValueName,
2698
+ resetBucketEngine: () => resetBucketEngine,
2699
+ resetCompilationMetrics: () => resetCompilationMetrics,
2700
+ resetIncrementalEngine: () => resetIncrementalEngine,
2701
+ resolveCascade: () => resolveCascade,
2702
+ resolveClassNames: () => resolveClassNames,
2703
+ resolveConflictGroup: () => resolveConflictGroup,
2704
+ resolveSimpleVariants: () => resolveSimpleVariants,
2705
+ resolveThemeValue: () => resolveThemeValue,
2706
+ resolveVariants: () => resolveVariants,
2707
+ reverseLookupProperty: () => reverseLookupProperty,
2708
+ reverseLookupValue: () => reverseLookupValue,
2709
+ runCssPipeline: () => runCssPipeline,
2710
+ runCssPipelineSync: () => runCssPipelineSync,
2711
+ runElimination: () => runElimination,
2712
+ runLoaderTransform: () => runLoaderTransform,
2713
+ scanCacheOptimizations: () => scanCacheOptimizations,
2714
+ scanFile: () => scanFile,
2715
+ scanFileNative: () => scanFileNative,
2716
+ scanFilesBatchNative: () => scanFilesBatchNative,
2717
+ scanProjectUsage: () => scanProjectUsage,
2718
+ scanWorkspace: () => scanWorkspace,
2719
+ shouldProcess: () => shouldProcess,
2720
+ shouldSkipFile: () => shouldSkipFile,
2721
+ startWatch: () => startWatch,
2722
+ stopWatch: () => stopWatch,
2723
+ toAtomicClasses: () => toAtomicClasses,
2724
+ transformSource: () => transformSource,
2725
+ twMerge: () => twMerge,
2726
+ twMergeMany: () => twMergeMany,
2727
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
2728
+ twMergeRaw: () => twMergeRaw,
2729
+ twMergeWithSeparator: () => twMergeWithSeparator,
2730
+ unregisterPluginHook: () => unregisterPluginHook,
2731
+ validateCssOutput: () => validateCssOutput,
2732
+ validateThemeConfig: () => validateThemeConfig,
2733
+ valueIdToString: () => valueIdToString,
2734
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
2735
+ watchAddPattern: () => watchAddPattern,
2736
+ watchClearAll: () => watchClearAll,
2737
+ watchEventTypeToString: () => watchEventTypeToString,
2738
+ watchGetActiveHandles: () => watchGetActiveHandles,
2739
+ watchPause: () => watchPause,
2740
+ watchRemovePattern: () => watchRemovePattern,
2741
+ watchResume: () => watchResume
2742
+ });
2743
+ var init_internal = __esm({
2744
+ "packages/domain/compiler/src/internal.ts"() {
2745
+ init_src2();
2746
+ init_tailwindEngine();
2747
+ init_compiler();
2748
+ init_parser();
2749
+ init_analyzer();
2750
+ init_cache();
2751
+ init_redis();
2752
+ init_watch();
2753
+ }
2754
+ });
2755
+ function getNative() {
2756
+ if (_native) return _native;
2757
+ try {
2758
+ const mod = (init_internal(), __toCommonJS(internal_exports));
2759
+ if (typeof mod?.extractTwStateConfigs !== "function" || typeof mod?.generateStaticStateCss !== "function") {
2760
+ return null;
2761
+ }
2762
+ _native = {
2763
+ extractTwStateConfigs: mod.extractTwStateConfigs,
2764
+ generateStaticStateCss: mod.generateStaticStateCss,
2765
+ extractAndGenerateStateCss: mod.extractAndGenerateStateCss ?? // Fallback jika extractAndGenerateStateCss belum di-export
2766
+ ((source, filename) => {
2767
+ const configs = mod.extractTwStateConfigs(source, filename);
2768
+ if (configs.length === 0) return [];
2769
+ return mod.generateStaticStateCss(configs.map((c) => ({
2770
+ tag: c.tag,
2771
+ componentName: c.componentName,
2772
+ statesJson: c.statesJson
2773
+ })));
2774
+ })
2775
+ };
2776
+ return _native;
2777
+ } catch {
2778
+ return null;
2779
+ }
2780
+ }
2781
+ function* walkSourceFiles(dir) {
2782
+ let entries;
2783
+ try {
2784
+ entries = fs13__namespace.default.readdirSync(dir, { withFileTypes: true });
2785
+ } catch {
2786
+ return;
2787
+ }
2788
+ for (const entry of entries) {
2789
+ const fullPath = path9__namespace.default.join(dir, entry.name);
2790
+ if (entry.isDirectory()) {
2791
+ if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
2792
+ yield* walkSourceFiles(fullPath);
2793
+ } else if (entry.isFile()) {
2794
+ const ext = path9__namespace.default.extname(entry.name);
2795
+ if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
2796
+ }
2797
+ }
2798
+ }
2799
+ function buildCssHeader(result) {
2800
+ return [
2801
+ "/* \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
2802
+ " * tw-state-static.css \u2014 Auto-generated by staticStateExtractor.ts",
2803
+ " * DO NOT EDIT. Re-generated on each build.",
2804
+ " *",
2805
+ ` * Files scanned: ${result.filesScanned}`,
2806
+ ` * Files with states: ${result.filesWithStates}`,
2807
+ ` * Components found: ${result.componentsFound}`,
2808
+ ` * Rules generated: ${result.rulesGenerated}`,
2809
+ ` * Rules skipped: ${result.rulesSkipped} (akan di-inject runtime sebagai fallback)`,
2810
+ " *",
2811
+ ' * Selector format: .tw-s-[hash][data-stateName="true"] { ... }',
2812
+ " * Hash identik dengan yang dibuat oleh stateEngine.ts di runtime.",
2813
+ " * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */",
2814
+ ""
2815
+ ].join("\n");
2816
+ }
2817
+ function extractStaticStateCss(srcDir, options = {}) {
2818
+ const { verbose = false, maxFiles = Infinity } = options;
2819
+ const native = getNative();
2820
+ if (!native) {
2821
+ if (verbose) {
2822
+ process.stderr.write(
2823
+ "[tw:static-state] native module tidak tersedia \u2014 skip static CSS pre-generation\n"
2824
+ );
2825
+ }
2826
+ return {
2827
+ filesScanned: 0,
2828
+ filesWithStates: 0,
2829
+ componentsFound: 0,
2830
+ rulesGenerated: 0,
2831
+ rulesSkipped: 0,
2832
+ generatedCss: "",
2833
+ rules: []
2834
+ };
2835
+ }
2836
+ const allConfigs = [];
2837
+ let filesScanned = 0;
2838
+ let filesWithStates = 0;
2839
+ if (native.walkAndPrefilterSourceFiles) {
2840
+ const prefiltered = native.walkAndPrefilterSourceFiles(
2841
+ srcDir,
2842
+ [".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"],
2843
+ ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"],
2844
+ // Required substrings — AND logic, identik dengan JS pre-filter di bawah
2845
+ ["states:", "tw."],
2846
+ maxFiles === Infinity ? null : maxFiles,
2847
+ null
2848
+ // sequential — parallel mode opsional untuk large monorepo
2849
+ );
2850
+ for (const { path: filePath, content: source } of prefiltered) {
2851
+ filesScanned++;
2852
+ const configs = native.extractTwStateConfigs(source, filePath);
2853
+ if (configs.length > 0) {
2854
+ filesWithStates++;
2855
+ allConfigs.push(...configs);
2856
+ if (verbose) {
2857
+ process.stderr.write(
2858
+ `[tw:static-state] ${path9__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
2859
+ `
2860
+ );
2861
+ }
2862
+ }
2863
+ }
2864
+ } else {
2865
+ for (const filePath of walkSourceFiles(srcDir)) {
2866
+ if (filesScanned >= maxFiles) break;
2867
+ let source;
2868
+ try {
2869
+ source = fs13__namespace.default.readFileSync(filePath, "utf-8");
2870
+ } catch {
2871
+ continue;
2872
+ }
2873
+ filesScanned++;
2874
+ if (!source.includes("states:") && !source.includes("states :")) continue;
2875
+ if (!source.includes("tw.") && !source.includes("tailwind-styled")) continue;
2876
+ const configs = native.extractTwStateConfigs(source, filePath);
2877
+ if (configs.length > 0) {
2878
+ filesWithStates++;
2879
+ allConfigs.push(...configs);
2880
+ if (verbose) {
2881
+ process.stderr.write(
2882
+ `[tw:static-state] ${path9__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
2883
+ `
2884
+ );
2885
+ }
2886
+ }
2887
+ }
2888
+ }
2889
+ if (allConfigs.length === 0) {
2890
+ return {
2891
+ filesScanned,
2892
+ filesWithStates: 0,
2893
+ componentsFound: 0,
2894
+ rulesGenerated: 0,
2895
+ rulesSkipped: 0,
2896
+ generatedCss: "",
2897
+ rules: []
2898
+ };
2899
+ }
2900
+ const seen = /* @__PURE__ */ new Set();
2901
+ const uniqueConfigs = [];
2902
+ for (const config of allConfigs) {
2903
+ const key = `${config.tag}::${config.statesJson}`;
2904
+ if (!seen.has(key)) {
2905
+ seen.add(key);
2906
+ uniqueConfigs.push({
2907
+ tag: config.tag,
2908
+ componentName: config.componentName,
2909
+ statesJson: config.statesJson
2910
+ });
2911
+ }
2912
+ }
2913
+ const allRules = native.generateStaticStateCss(uniqueConfigs, options.resolvedCss ?? null);
2914
+ const rulesSkipped = uniqueConfigs.reduce((total, cfg) => {
2915
+ try {
2916
+ const stateMap = JSON.parse(cfg.statesJson);
2917
+ return total + Object.keys(stateMap).length;
2918
+ } catch {
2919
+ return total;
2920
+ }
2921
+ }, 0) - allRules.length;
2922
+ const byComponent = /* @__PURE__ */ new Map();
2923
+ for (const rule of allRules) {
2924
+ const existing = byComponent.get(rule.componentName) ?? [];
2925
+ existing.push(rule);
2926
+ byComponent.set(rule.componentName, existing);
2927
+ }
2928
+ const cssBlocks = [];
2929
+ for (const [componentName, rules] of byComponent) {
2930
+ cssBlocks.push(`/* ${componentName} */`);
2931
+ for (const rule of rules) {
2932
+ cssBlocks.push(`/* state: ${rule.stateName} */`);
2933
+ cssBlocks.push(rule.cssRule);
2934
+ }
2935
+ cssBlocks.push("");
2936
+ }
2937
+ const result = {
2938
+ filesScanned,
2939
+ filesWithStates,
2940
+ componentsFound: allConfigs.length,
2941
+ rulesGenerated: allRules.length,
2942
+ rulesSkipped: Math.max(0, rulesSkipped),
2943
+ generatedCss: cssBlocks.join("\n"),
2944
+ rules: allRules
2945
+ };
2946
+ result.generatedCss = buildCssHeader(result) + result.generatedCss;
2947
+ return result;
2948
+ }
2949
+ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
2950
+ const result = extractStaticStateCss(srcDir, options);
2951
+ const twClassesDir = path9__namespace.default.join(path9__namespace.default.dirname(safelistPath), "tw-classes");
2952
+ fs13__namespace.default.mkdirSync(twClassesDir, { recursive: true });
2953
+ const stateFilePath = path9__namespace.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
2954
+ if (result.rulesGenerated === 0) {
2955
+ try {
2956
+ fs13__namespace.default.writeFileSync(
2957
+ stateFilePath,
2958
+ "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
2959
+ "utf-8"
2960
+ );
2961
+ } catch {
2962
+ }
2963
+ return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
2964
+ }
2965
+ try {
2966
+ fs13__namespace.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
2967
+ return [
2968
+ `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
2969
+ ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
2970
+ ` \u2192 ${result.componentsFound} components, ${result.rulesSkipped} rules skipped (fallback ke runtime)`,
2971
+ ` \u2192 ditulis ke tw-classes/${TW_STATE_STATIC_FILENAME}`
2972
+ ].join("\n");
2973
+ } catch (writeErr) {
2974
+ const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
2975
+ return `[tw:static-state] gagal tulis state CSS: ${msg}`;
2976
+ }
2977
+ }
2978
+ var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
2979
+ var init_staticStateExtractor = __esm({
2980
+ "packages/domain/shared/src/staticStateExtractor.ts"() {
2981
+ SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
2982
+ IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
2983
+ _native = null;
2984
+ TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
2985
+ }
2986
+ });
2987
+ function getEnvLevel() {
2988
+ const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
2989
+ if (env && env in LEVELS) return env;
2990
+ return process.env.TWS_DEBUG_SCANNER === "1" ? "debug" : "info";
2991
+ }
2992
+ function setGlobalLogFile(filePath) {
2993
+ _globalLogFile = filePath;
2994
+ _logFileInitialized = false;
2995
+ try {
2996
+ fs13__namespace.default.mkdirSync(path9__namespace.default.dirname(filePath), { recursive: true });
2997
+ fs13__namespace.default.writeFileSync(
2998
+ filePath,
2999
+ `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3000
+ `,
3001
+ "utf-8"
3002
+ );
3003
+ _logFileInitialized = true;
3004
+ } catch {
3005
+ }
3006
+ }
3007
+ function writeToFile(line) {
3008
+ if (!_globalLogFile || !_logFileInitialized) return;
3009
+ try {
3010
+ fs13__namespace.default.appendFileSync(_globalLogFile, line);
3011
+ } catch {
3012
+ }
3013
+ }
3014
+ function createLogger(prefix, level) {
3015
+ const loggerState = {
3016
+ currentLevel: getEnvLevel(),
3017
+ setLevel(l) {
3018
+ this.currentLevel = l;
3019
+ }
3020
+ };
3021
+ const log7 = (msgLevel, stream, args) => {
3022
+ if (LEVELS[msgLevel] > LEVELS[loggerState.currentLevel]) return;
3023
+ const line = `[${prefix}] ${args.map(String).join(" ")}
3024
+ `;
3025
+ process[stream].write(line);
3026
+ writeToFile(line);
3027
+ };
3028
+ return {
3029
+ error: (...a) => log7("error", "stderr", a),
3030
+ warn: (...a) => log7("warn", "stderr", a),
3031
+ info: (...a) => log7("info", "stdout", a),
3032
+ debug: (...a) => log7("debug", "stderr", a),
3033
+ setLevel: loggerState.setLevel,
3034
+ setLogFile: (filePath) => setGlobalLogFile(filePath)
3035
+ };
3036
+ }
3037
+ var LEVELS, _globalLogFile, _logFileInitialized;
3038
+ var init_logger = __esm({
3039
+ "packages/domain/shared/src/logger.ts"() {
3040
+ LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3041
+ _globalLogFile = null;
3042
+ _logFileInitialized = false;
3043
+ createLogger("tailwind-styled");
3044
+ }
3045
+ });
3046
+
1012
3047
  // packages/domain/shared/src/index.ts
1013
3048
  var src_exports = {};
1014
3049
  __export(src_exports, {
@@ -1027,18 +3062,21 @@ __export(src_exports, {
1027
3062
  RegistryPluginEntrySchema: () => RegistryPluginEntrySchema,
1028
3063
  ScanCacheClassEntrySchema: () => ScanCacheClassEntrySchema,
1029
3064
  ScanCacheSchema: () => ScanCacheSchema,
3065
+ TW_STATE_STATIC_FILENAME: () => TW_STATE_STATIC_FILENAME,
1030
3066
  TailwindConfigSchema: () => TailwindConfigSchema,
1031
3067
  TelemetryCollector: () => TelemetryCollector,
1032
3068
  TwError: () => TwError,
3069
+ appendStaticStateCssToSafelist: () => appendStaticStateCssToSafelist,
1033
3070
  assertTailwindV4: () => assertTailwindV4,
1034
3071
  calculateHealth: () => calculateHealth,
1035
3072
  createBuildTimer: () => createBuildTimer,
1036
3073
  createDebugLogger: () => createDebugLogger,
1037
3074
  createEsmRequire: () => createEsmRequire,
1038
- createLogger: () => createLogger,
3075
+ createLogger: () => createLogger2,
1039
3076
  createObservabilityClient: () => createObservabilityClient,
1040
3077
  createTraceSnapshot: () => createTraceSnapshot,
1041
3078
  detectTailwind: () => detectTailwind,
3079
+ extractStaticStateCss: () => extractStaticStateCss,
1042
3080
  formatDuration: () => formatDuration,
1043
3081
  formatErrorCode: () => formatErrorCode,
1044
3082
  formatErrorMessage: () => formatErrorMessage,
@@ -1058,7 +3096,7 @@ __export(src_exports, {
1058
3096
  getPipelinePercentages: () => getPipelinePercentages,
1059
3097
  getSuggestion: () => getSuggestion,
1060
3098
  getTailwindVersion: () => getTailwindVersion,
1061
- hashContent: () => hashContent,
3099
+ hashContent: () => hashContent2,
1062
3100
  isTailwindV4: () => isTailwindV4,
1063
3101
  isTwError: () => isTwError,
1064
3102
  loadNativeBinding: () => loadNativeBinding,
@@ -1074,10 +3112,11 @@ __export(src_exports, {
1074
3112
  resolveRuntimeDir: () => resolveRuntimeDir,
1075
3113
  resolveWorkerPath: () => resolveWorkerPath,
1076
3114
  safeParseNative: () => safeParseNative,
3115
+ setGlobalLogFile: () => setGlobalLogFile,
1077
3116
  tryRequire: () => tryRequire,
1078
3117
  wrapUnknownError: () => wrapUnknownError
1079
3118
  });
1080
- function createLogger(namespace) {
3119
+ function createLogger2(namespace) {
1081
3120
  const prefix = `[${namespace}]`;
1082
3121
  return {
1083
3122
  warn(...args) {
@@ -1106,9 +3145,9 @@ function createDebugLogger(namespace, label) {
1106
3145
  }
1107
3146
  };
1108
3147
  }
1109
- function formatIssuePath(path13) {
1110
- if (!path13 || path13.length === 0) return "(root)";
1111
- return path13.map(
3148
+ function formatIssuePath(path16) {
3149
+ if (!path16 || path16.length === 0) return "(root)";
3150
+ return path16.map(
1112
3151
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
1113
3152
  ).join(".");
1114
3153
  }
@@ -1122,9 +3161,9 @@ function loadNativeBinding(options) {
1122
3161
  const { runtimeDir, candidates, isValid } = options;
1123
3162
  const loadErrors = [];
1124
3163
  for (const candidate of candidates) {
1125
- const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
3164
+ const candidatePath = path9__namespace.default.resolve(runtimeDir, candidate);
1126
3165
  try {
1127
- if (!fs5__namespace.default.existsSync(candidatePath) && !fs5__namespace.default.existsSync(candidatePath + ".node")) {
3166
+ if (!fs13__namespace.default.existsSync(candidatePath) && !fs13__namespace.default.existsSync(candidatePath + ".node")) {
1128
3167
  continue;
1129
3168
  }
1130
3169
  const mod = requireNativeModule(candidatePath);
@@ -1156,9 +3195,9 @@ function resolveNativeBindingCandidates(options) {
1156
3195
  }
1157
3196
  }
1158
3197
  if (!includeDefaultCandidates) return candidates;
1159
- if (fs5__namespace.default.existsSync(runtimeDir)) {
3198
+ if (fs13__namespace.default.existsSync(runtimeDir)) {
1160
3199
  try {
1161
- for (const entry of fs5__namespace.default.readdirSync(runtimeDir)) {
3200
+ for (const entry of fs13__namespace.default.readdirSync(runtimeDir)) {
1162
3201
  if (entry.endsWith(".node")) candidates.push(entry);
1163
3202
  }
1164
3203
  } catch {
@@ -1167,27 +3206,27 @@ function resolveNativeBindingCandidates(options) {
1167
3206
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
1168
3207
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
1169
3208
  for (const bin of BINARY_NAMES) {
1170
- candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.node`));
1171
- candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
1172
- candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
1173
- candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
1174
- candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
1175
- candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
1176
- candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
1177
- candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
1178
- candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3209
+ candidates.push(path9__namespace.default.resolve(runtimeDir, `${bin}.node`));
3210
+ candidates.push(path9__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3211
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3212
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3213
+ candidates.push(path9__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
3214
+ candidates.push(path9__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3215
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3216
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3217
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
1179
3218
  }
1180
3219
  return Array.from(new Set(candidates));
1181
3220
  }
1182
3221
  function resolveRuntimeDir(dir, importMetaUrl) {
1183
- if (dir) return path6__namespace.default.resolve(dir);
3222
+ if (dir) return path9__namespace.default.resolve(dir);
1184
3223
  try {
1185
- return path6__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
3224
+ return path9__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
1186
3225
  } catch {
1187
3226
  return process.cwd();
1188
3227
  }
1189
3228
  }
1190
- function hashContent(content, algorithm = "md5", length) {
3229
+ function hashContent2(content, algorithm = "md5", length) {
1191
3230
  const hash = crypto.createHash(algorithm).update(content).digest("hex");
1192
3231
  return length ? hash.slice(0, length) : hash;
1193
3232
  }
@@ -1210,6 +3249,8 @@ var init_src = __esm({
1210
3249
  init_codegen();
1211
3250
  init_native_resolution();
1212
3251
  init_observability();
3252
+ init_staticStateExtractor();
3253
+ init_logger();
1213
3254
  TwError = class _TwError extends Error {
1214
3255
  /** @deprecated Gunakan source */
1215
3256
  domain;
@@ -1243,8 +3284,8 @@ var init_src = __esm({
1243
3284
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
1244
3285
  static fromZod(err) {
1245
3286
  const first = err.issues?.[0] ?? err.errors?.[0];
1246
- const path13 = formatIssuePath(first?.path);
1247
- const message = first ? `${path13}: ${first.message}` : "Schema validation failed";
3287
+ const path16 = formatIssuePath(first?.path);
3288
+ const message = first ? `${path16}: ${first.message}` : "Schema validation failed";
1248
3289
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
1249
3290
  }
1250
3291
  static wrap(source, code, err) {
@@ -1308,11 +3349,11 @@ var init_src = __esm({
1308
3349
  });
1309
3350
 
1310
3351
  // packages/domain/compiler/src/nativeBridge.ts
1311
- var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
3352
+ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
1312
3353
  var init_nativeBridge = __esm({
1313
3354
  "packages/domain/compiler/src/nativeBridge.ts"() {
1314
3355
  init_src();
1315
- _loadNative = (path13) => __require(path13);
3356
+ _loadNative = (path16) => __require(path16);
1316
3357
  log = (...args) => {
1317
3358
  if (process.env.DEBUG?.includes("compiler:native")) {
1318
3359
  console.log("[compiler:native]", ...args);
@@ -1361,6 +3402,15 @@ Tried paths: ${result.tried.join("\n")}`);
1361
3402
  throw bridgeLoadError;
1362
3403
  }
1363
3404
  };
3405
+ adaptNativeResult = (raw) => {
3406
+ return {
3407
+ code: raw.code ?? "",
3408
+ classes: raw.classes ?? [],
3409
+ changed: raw.changed ?? false,
3410
+ rsc: raw.rscJson ? JSON.parse(raw.rscJson) : void 0,
3411
+ metadata: raw.metadataJson ? JSON.parse(raw.metadataJson) : void 0
3412
+ };
3413
+ };
1364
3414
  if (typeof process !== "undefined" && !bridgeLoadAttempted) {
1365
3415
  try {
1366
3416
  getNativeBridge();
@@ -1369,110 +3419,377 @@ Tried paths: ${result.tried.join("\n")}`);
1369
3419
  }
1370
3420
  }
1371
3421
  });
1372
-
1373
- // packages/domain/compiler/src/tailwindEngine.ts
1374
- var tailwindEngine_exports = {};
1375
- __export(tailwindEngine_exports, {
1376
- generateRawCss: () => generateRawCss,
1377
- processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1378
- runCssPipeline: () => runCssPipeline,
1379
- runCssPipelineSync: () => runCssPipelineSync
1380
- });
1381
- function loadTailwindEngine() {
1382
- if (_twEngine) return _twEngine;
1383
- if (_twEngineError) throw _twEngineError;
1384
- try {
1385
- const tw = require2("tailwindcss");
1386
- if (typeof tw.compile !== "function") {
1387
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
1388
- }
1389
- _twEngine = tw;
1390
- return _twEngine;
1391
- } catch (e) {
1392
- _twEngineError = e instanceof Error ? e : new Error(String(e));
1393
- throw _twEngineError;
1394
- }
1395
- }
1396
- async function generateRawCss(classes, cssEntryContent, root) {
1397
- if (classes.length === 0) return "";
1398
- const tw = loadTailwindEngine();
1399
- const input = cssEntryContent ?? "@import 'tailwindcss';";
1400
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1401
- const { dirname, resolve: resolve2 } = await import('path');
1402
- const projectRoot = root ?? process.cwd();
1403
- const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
1404
- const loadStylesheet = async (id, base) => {
1405
- try {
1406
- 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;
1407
- const pkgPath = req.resolve(cssId);
1408
- return {
1409
- content: readFileSync(pkgPath, "utf-8"),
1410
- base: dirname(pkgPath)
1411
- };
1412
- } catch {
1413
- try {
1414
- const absPath = resolve2(base, id);
1415
- if (existsSync3(absPath)) {
1416
- return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
1417
- }
1418
- } catch {
1419
- }
1420
- return { content: "", base };
1421
- }
1422
- };
1423
- const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1424
- return compiler.build(classes);
1425
- }
1426
- function postProcessWithLightning(rawCss) {
1427
- if (!rawCss) return "";
3422
+ function _layoutClassesToCss(classes) {
1428
3423
  const native = getNativeBridge();
1429
- if (typeof native.processTailwindCssLightning !== "function") {
1430
- throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
3424
+ if (!native?.layoutClassesToCss) {
3425
+ throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
1431
3426
  }
1432
- const result = native.processTailwindCssLightning(rawCss);
1433
- return result?.css ?? rawCss;
3427
+ return native.layoutClassesToCss(classes);
1434
3428
  }
1435
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1436
- const unique = [...new Set(classes.filter(Boolean))];
1437
- if (unique.length === 0) {
1438
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
1439
- }
1440
- const rawCss = await generateRawCss(unique, cssEntryContent, root);
3429
+ function _hashContainer(tag, containerJson, name) {
3430
+ const sortedKey = tag + (name ?? "") + containerJson;
1441
3431
  const native = getNativeBridge();
1442
- const hasLightning = minify && typeof native.processTailwindCssLightning === "function";
1443
- const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
1444
- return {
1445
- css: finalCss,
1446
- classes: unique,
1447
- sizeBytes: finalCss.length,
1448
- optimized: hasLightning
1449
- };
1450
- }
1451
- function runCssPipelineSync(_classes) {
1452
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
3432
+ if (!native?.hashContent) {
3433
+ throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
3434
+ }
3435
+ return `tw-cq-${native.hashContent(sortedKey, "fnv", 6)}`;
1453
3436
  }
1454
- function processTailwindCssWithTargets(css, targets) {
3437
+ function extractContainerCssFromSource(source) {
1455
3438
  const native = getNativeBridge();
1456
- if (!native?.processTailwindCssWithTargets) {
1457
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
3439
+ if (!native?.extractTwContainerConfigs) {
3440
+ throw new Error("FATAL: Native binding 'extractTwContainerConfigs' is required but not available.");
3441
+ }
3442
+ const configs = native.extractTwContainerConfigs(source);
3443
+ const rules = [];
3444
+ for (const cfg of configs) {
3445
+ const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName);
3446
+ for (const { key, classes } of cfg.breakpoints) {
3447
+ const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key;
3448
+ const css = _layoutClassesToCss(classes);
3449
+ if (!css) continue;
3450
+ const query = cfg.containerName ? `@container ${cfg.containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
3451
+ rules.push(`${query}{.${id}{${css}}}`);
3452
+ }
1458
3453
  }
1459
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
1460
- return (result?.css ?? css).trim();
3454
+ return rules.join("\n");
1461
3455
  }
1462
- var require2, _twEngine, _twEngineError;
1463
- var init_tailwindEngine = __esm({
1464
- "packages/domain/compiler/src/tailwindEngine.ts"() {
3456
+ 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;
3457
+ var init_src2 = __esm({
3458
+ "packages/domain/compiler/src/index.ts"() {
1465
3459
  init_nativeBridge();
1466
- require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href)));
1467
- _twEngine = null;
1468
- _twEngineError = null;
3460
+ init_compiler();
3461
+ init_parser();
3462
+ init_analyzer();
3463
+ init_cache();
3464
+ init_redis();
3465
+ init_watch();
3466
+ transformSource = (source, opts) => {
3467
+ const native = getNativeBridge();
3468
+ if (!native?.transformSource) {
3469
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
3470
+ }
3471
+ const result = native.transformSource(source, opts);
3472
+ if (!result) {
3473
+ throw new Error("FATAL: transformSource returned null");
3474
+ }
3475
+ return result;
3476
+ };
3477
+ hasTwUsage = (source) => {
3478
+ const native = getNativeBridge();
3479
+ if (!native?.hasTwUsage) {
3480
+ throw new Error("FATAL: Native binding 'hasTwUsage' is required but not available.");
3481
+ }
3482
+ return native.hasTwUsage(source);
3483
+ };
3484
+ isAlreadyTransformed = (source) => {
3485
+ const native = getNativeBridge();
3486
+ if (!native?.isAlreadyTransformed) {
3487
+ throw new Error("FATAL: Native binding 'isAlreadyTransformed' is required but not available.");
3488
+ }
3489
+ return native.isAlreadyTransformed(source);
3490
+ };
3491
+ shouldProcess = (source) => {
3492
+ return hasTwUsage(source) && !isAlreadyTransformed(source);
3493
+ };
3494
+ compileCssFromClasses = (classes, prefix) => {
3495
+ const native = getNativeBridge();
3496
+ if (!native?.transformSource) {
3497
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
3498
+ }
3499
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
3500
+ if (!result) {
3501
+ throw new Error("FATAL: transformSource returned null");
3502
+ }
3503
+ return result;
3504
+ };
3505
+ buildStyleTag = (classes) => {
3506
+ const result = compileCssFromClasses(classes);
3507
+ return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
3508
+ };
3509
+ generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
3510
+ try {
3511
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
3512
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
3513
+ return result.css;
3514
+ } catch {
3515
+ const native = getNativeBridge();
3516
+ if (!native?.transformSource) {
3517
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
3518
+ }
3519
+ const result = native.transformSource(classes.join(" "), {});
3520
+ return result?.code || "";
3521
+ }
3522
+ };
3523
+ eliminateDeadCss = (css, deadClasses) => {
3524
+ const native = getNativeBridge();
3525
+ if (!native?.eliminateDeadCss) {
3526
+ throw new Error("FATAL: Native binding 'eliminateDeadCss' is required but not available.");
3527
+ }
3528
+ return native.eliminateDeadCss(css, Array.from(deadClasses));
3529
+ };
3530
+ findDeadVariants = (variantConfig, usage) => {
3531
+ const unused = [];
3532
+ const configs = Array.isArray(variantConfig) ? variantConfig : [{ name: "__root__", variants: variantConfig }];
3533
+ for (const component of configs) {
3534
+ const componentUsage = usage[component.name] ?? /* @__PURE__ */ new Set();
3535
+ const variants = component.variants;
3536
+ for (const [key, values] of Object.entries(variants)) {
3537
+ for (const [value] of Object.entries(values)) {
3538
+ if (!componentUsage.has(`${key}:${value}`)) {
3539
+ unused.push(`${component.name !== "__root__" ? `${component.name}/` : ""}${key}:${value}`);
3540
+ }
3541
+ }
3542
+ }
3543
+ }
3544
+ return { unusedCount: unused.length, unused };
3545
+ };
3546
+ runElimination = (css, scanResult) => {
3547
+ const native = getNativeBridge();
3548
+ if (!native?.detectDeadCode) {
3549
+ throw new Error("FATAL: Native binding 'detectDeadCode' is required but not available.");
3550
+ }
3551
+ const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
3552
+ return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
3553
+ };
3554
+ scanProjectUsage = (dirs, cwd) => {
3555
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
3556
+ const files = dirs.map((dir) => path9__namespace.default.resolve(cwd, dir));
3557
+ const results = batchExtractClasses2(files) || [];
3558
+ const combined = {};
3559
+ for (const result of results) {
3560
+ if (result.ok && result.classes) {
3561
+ for (const cls of result.classes) {
3562
+ if (!combined[cls]) combined[cls] = {};
3563
+ combined[cls][result.file] = /* @__PURE__ */ new Set([cls]);
3564
+ }
3565
+ }
3566
+ }
3567
+ return combined;
3568
+ };
3569
+ generateSafelist = (scanDirs, outputPath, cwd) => {
3570
+ const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
3571
+ const allClasses = Object.keys(classes).sort();
3572
+ if (outputPath) {
3573
+ fs13__namespace.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3574
+ }
3575
+ return allClasses;
3576
+ };
3577
+ loadSafelist = (safelistPath) => {
3578
+ try {
3579
+ const content = fs13__namespace.default.readFileSync(safelistPath, "utf-8");
3580
+ return JSON.parse(content);
3581
+ } catch {
3582
+ return [];
3583
+ }
3584
+ };
3585
+ loadTailwindConfig = (cwd = process.cwd()) => {
3586
+ const configFiles = [
3587
+ "tailwind.config.ts",
3588
+ "tailwind.config.js",
3589
+ "tailwind.config.mjs",
3590
+ "tailwind.config.cjs"
3591
+ ];
3592
+ for (const file of configFiles) {
3593
+ const fullPath = path9__namespace.default.join(cwd, file);
3594
+ if (fs13__namespace.default.existsSync(fullPath)) {
3595
+ const mod = __require(fullPath);
3596
+ return mod.default || mod;
3597
+ }
3598
+ }
3599
+ return {};
3600
+ };
3601
+ getContentPaths = (cwd = process.cwd()) => {
3602
+ return {
3603
+ content: [
3604
+ path9__namespace.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3605
+ path9__namespace.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3606
+ path9__namespace.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
3607
+ ]
3608
+ };
3609
+ };
3610
+ _CONTAINER_BREAKPOINTS = {
3611
+ xs: "240px",
3612
+ sm: "320px",
3613
+ md: "640px",
3614
+ lg: "1024px",
3615
+ xl: "1280px",
3616
+ "2xl": "1536px"
3617
+ };
3618
+ runLoaderTransform = (ctx) => {
3619
+ const { filepath, source, options } = ctx;
3620
+ const result = transformSource(source, { filename: filepath, ...options });
3621
+ let staticCss;
3622
+ try {
3623
+ const cssChunks = [];
3624
+ const stateRules = extractAndGenerateStateCss(source, filepath);
3625
+ if (stateRules.length > 0) {
3626
+ cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
3627
+ }
3628
+ const containerCss = extractContainerCssFromSource(source);
3629
+ if (containerCss) cssChunks.push(containerCss);
3630
+ const combined = cssChunks.join("\n").trim();
3631
+ if (combined) staticCss = combined;
3632
+ } catch (err) {
3633
+ console.debug("Static CSS extraction warning:", err);
3634
+ }
3635
+ return {
3636
+ code: result?.code || "",
3637
+ changed: result?.changed || false,
3638
+ classes: result?.classes || [],
3639
+ staticCss
3640
+ };
3641
+ };
3642
+ shouldSkipFile = (filepath) => {
3643
+ const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
3644
+ const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
3645
+ for (const p of SKIP_PATHS) {
3646
+ if (filepath.includes(p)) return true;
3647
+ }
3648
+ for (const ext of skipExtensions) {
3649
+ if (filepath.endsWith(ext)) return true;
3650
+ }
3651
+ return false;
3652
+ };
3653
+ fileToRoute = (filepath) => {
3654
+ const normalized = filepath.replace(/\\/g, "/");
3655
+ if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
3656
+ return "__global";
3657
+ }
3658
+ const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
3659
+ if (pageMatch) return `/${pageMatch[1]}`;
3660
+ const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
3661
+ if (rootPage) return "/";
3662
+ return null;
3663
+ };
3664
+ getAllRoutes = () => {
3665
+ const native = getNativeBridge();
3666
+ if (!native?.analyzeClasses) {
3667
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
3668
+ }
3669
+ return ["/", "__global"];
3670
+ };
3671
+ getRouteClasses = (_route) => /* @__PURE__ */ new Set();
3672
+ registerFileClasses = (_filepath, _classes) => {
3673
+ };
3674
+ registerGlobalClasses = (_classes) => {
3675
+ };
3676
+ _incrementalEngineInstance = null;
3677
+ getIncrementalEngine = () => {
3678
+ if (!_incrementalEngineInstance) {
3679
+ _incrementalEngineInstance = new IncrementalEngine();
3680
+ }
3681
+ return _incrementalEngineInstance;
3682
+ };
3683
+ resetIncrementalEngine = () => {
3684
+ _incrementalEngineInstance = null;
3685
+ };
3686
+ IncrementalEngine = class {
3687
+ compile(source) {
3688
+ return transformSource(source);
3689
+ }
3690
+ };
3691
+ getBucketEngine = () => {
3692
+ const native = getNativeBridge();
3693
+ if (!native?.classifyAndSortClasses) {
3694
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
3695
+ }
3696
+ return {
3697
+ add: (className) => className,
3698
+ get: (_bucket) => []
3699
+ };
3700
+ };
3701
+ resetBucketEngine = () => {
3702
+ };
3703
+ classifyNode = (_node) => {
3704
+ const native = getNativeBridge();
3705
+ if (!native?.classifyAndSortClasses) {
3706
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
3707
+ }
3708
+ return "unknown";
3709
+ };
3710
+ detectConflicts = (_classes) => {
3711
+ const native = getNativeBridge();
3712
+ if (!native?.analyzeClassUsage) {
3713
+ throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
3714
+ }
3715
+ return [];
3716
+ };
3717
+ bucketSort = (classes) => {
3718
+ const native = getNativeBridge();
3719
+ if (!native?.classifyAndSortClasses) {
3720
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
3721
+ }
3722
+ const sorted = native.classifyAndSortClasses(classes);
3723
+ return sorted.map((c) => c.raw ?? c);
3724
+ };
3725
+ analyzeFile = (source, filename) => {
3726
+ const native = getNativeBridge();
3727
+ if (!native?.analyzeRsc) {
3728
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
3729
+ }
3730
+ const rsc = native.analyzeRsc(source, filename);
3731
+ return {
3732
+ isServer: rsc?.isServer ?? true,
3733
+ needsClientDirective: rsc?.needsClientDirective ?? false,
3734
+ clientReasons: rsc?.clientReasons ?? [],
3735
+ interactiveClasses: [],
3736
+ canStaticResolveVariants: true
3737
+ };
3738
+ };
3739
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
3740
+ return { resolved: {}, dynamic: [] };
3741
+ };
3742
+ injectClientDirective = (source) => {
3743
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
3744
+ return '"use client";\n' + source;
3745
+ }
3746
+ return source;
3747
+ };
3748
+ injectServerOnlyComment = (source) => {
3749
+ return `/* @server-only */
3750
+ ${source}`;
3751
+ };
3752
+ analyzeClasses = (filesJson, cwd, flags) => {
3753
+ const native = getNativeBridge();
3754
+ if (!native?.analyzeClasses) {
3755
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
3756
+ }
3757
+ return native.analyzeClasses(filesJson, cwd, flags);
3758
+ };
3759
+ extractTwStateConfigs = (source, filename) => {
3760
+ const native = getNativeBridge();
3761
+ if (!native?.extractTwStateConfigs) {
3762
+ throw new Error("FATAL: Native binding 'extractTwStateConfigs' is required but not available.");
3763
+ }
3764
+ return native.extractTwStateConfigs(source, filename);
3765
+ };
3766
+ generateStaticStateCss = (entries, _themeConfig) => {
3767
+ const rules = [];
3768
+ for (const entry of entries) {
3769
+ const stateConfig = JSON.parse(entry.statesJson);
3770
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
3771
+ rules.push({
3772
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
3773
+ declarations: classes,
3774
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
3775
+ componentName: entry.componentName,
3776
+ stateName
3777
+ });
3778
+ }
3779
+ }
3780
+ return rules;
3781
+ };
3782
+ extractAndGenerateStateCss = (source, filename) => {
3783
+ const entries = extractTwStateConfigs(source, filename);
3784
+ return generateStaticStateCss(entries);
3785
+ };
1469
3786
  }
1470
3787
  });
1471
3788
 
1472
3789
  // packages/domain/scanner/src/native-bridge.ts
1473
3790
  var native_bridge_exports = {};
1474
3791
  __export(native_bridge_exports, {
1475
- batchExtractClassesNative: () => batchExtractClassesNative,
3792
+ batchExtractClassesNative: () => batchExtractClassesNative2,
1476
3793
  cachePriorityNative: () => cachePriorityNative,
1477
3794
  cacheReadNative: () => cacheReadNative,
1478
3795
  cacheWriteNative: () => cacheWriteNative,
@@ -1492,8 +3809,8 @@ __export(native_bridge_exports, {
1492
3809
  scanCacheInvalidate: () => scanCacheInvalidate,
1493
3810
  scanCachePut: () => scanCachePut,
1494
3811
  scanCacheStats: () => scanCacheStats,
1495
- scanFileNative: () => scanFileNative,
1496
- scanFilesBatchNative: () => scanFilesBatchNative,
3812
+ scanFileNative: () => scanFileNative2,
3813
+ scanFilesBatchNative: () => scanFilesBatchNative2,
1497
3814
  scanWorkspaceNative: () => scanWorkspaceNative,
1498
3815
  startWatchNative: () => startWatchNative,
1499
3816
  stopWatchNative: () => stopWatchNative
@@ -1503,7 +3820,7 @@ function getDirname2() {
1503
3820
  return __dirname;
1504
3821
  }
1505
3822
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))) {
1506
- return path6__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
3823
+ return path9__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
1507
3824
  }
1508
3825
  return process.cwd();
1509
3826
  }
@@ -1584,7 +3901,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
1584
3901
  }
1585
3902
  return result;
1586
3903
  }
1587
- function batchExtractClassesNative(filePaths) {
3904
+ function batchExtractClassesNative2(filePaths) {
1588
3905
  const binding = scannerGetBinding();
1589
3906
  if (!binding.batchExtractClasses) {
1590
3907
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -1619,7 +3936,7 @@ function scanCacheStats() {
1619
3936
  }
1620
3937
  return binding.scanCacheStats();
1621
3938
  }
1622
- function scanFileNative(filePath) {
3939
+ function scanFileNative2(filePath) {
1623
3940
  const binding = scannerGetBinding();
1624
3941
  if (!binding.scanFile) {
1625
3942
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -1631,7 +3948,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
1631
3948
  if (!binding.collectFiles) return null;
1632
3949
  return binding.collectFiles(root, extensions, ignoreDirs);
1633
3950
  }
1634
- function scanFilesBatchNative(filePaths) {
3951
+ function scanFilesBatchNative2(filePaths) {
1635
3952
  const binding = scannerGetBinding();
1636
3953
  if (!binding.scanFilesBatch) {
1637
3954
  return filePaths.map((fp) => {
@@ -1792,12 +4109,12 @@ var init_native_bridge = __esm({
1792
4109
  }
1793
4110
  });
1794
4111
  function defaultCachePath(rootDir, cacheDir) {
1795
- const dir = cacheDir ? path6__namespace.default.resolve(rootDir, cacheDir) : path6__namespace.default.join(process.cwd(), ".cache", "tailwind-styled");
1796
- return path6__namespace.default.join(dir, "scanner-cache.json");
4112
+ const dir = cacheDir ? path9__namespace.default.resolve(rootDir, cacheDir) : path9__namespace.default.join(process.cwd(), ".cache", "tailwind-styled");
4113
+ return path9__namespace.default.join(dir, "scanner-cache.json");
1797
4114
  }
1798
4115
  function readCache(rootDir, cacheDir) {
1799
4116
  const cachePath = defaultCachePath(rootDir, cacheDir);
1800
- fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
4117
+ fs13__namespace.default.mkdirSync(path9__namespace.default.dirname(cachePath), { recursive: true });
1801
4118
  const result = cacheReadNative(cachePath);
1802
4119
  if (!result) return [];
1803
4120
  return result.entries.map((e) => ({
@@ -1812,7 +4129,7 @@ function readCache(rootDir, cacheDir) {
1812
4129
  }
1813
4130
  function writeCache(rootDir, entries, cacheDir) {
1814
4131
  const cachePath = defaultCachePath(rootDir, cacheDir);
1815
- fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
4132
+ fs13__namespace.default.mkdirSync(path9__namespace.default.dirname(cachePath), { recursive: true });
1816
4133
  const success = cacheWriteNative(cachePath, entries);
1817
4134
  if (!success) {
1818
4135
  throw new Error(
@@ -1836,30 +4153,10 @@ var init_cache_native = __esm({
1836
4153
  init_native_bridge();
1837
4154
  }
1838
4155
  });
1839
- function collectFiles(rootDir, extensions, ignoreDirs) {
4156
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
1840
4157
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
1841
4158
  if (native !== null) return native;
1842
- const files = [];
1843
- function walk(dir) {
1844
- let entries;
1845
- try {
1846
- entries = fs5__namespace.default.readdirSync(dir, { withFileTypes: true });
1847
- } catch {
1848
- return;
1849
- }
1850
- for (const entry of entries) {
1851
- const fullPath = path6__namespace.default.join(dir, entry.name);
1852
- const rel = path6__namespace.default.relative(rootDir, fullPath);
1853
- if (entry.isDirectory()) {
1854
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__namespace.default.sep));
1855
- if (!ignored) walk(fullPath);
1856
- } else if (isScannableFile(entry.name, extensions)) {
1857
- files.push(fullPath);
1858
- }
1859
- }
1860
- }
1861
- walk(rootDir);
1862
- return files;
4159
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
1863
4160
  }
1864
4161
  function mergeResults(batchResults) {
1865
4162
  const files = batchResults.map((r) => ({
@@ -1869,8 +4166,7 @@ function mergeResults(batchResults) {
1869
4166
  }));
1870
4167
  const native = rebuildWorkspaceResultNative(files);
1871
4168
  if (native) return native;
1872
- const unique = new Set(files.flatMap((f) => f.classes));
1873
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
4169
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
1874
4170
  }
1875
4171
  function runChunkInWorker(filePaths) {
1876
4172
  return new Promise((resolve2, reject) => {
@@ -1897,9 +4193,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
1897
4193
  maxWorkers = Math.max(1, os.availableParallelism() - 1),
1898
4194
  chunkSize = DEFAULT_CHUNK_SIZE
1899
4195
  } = options;
1900
- const files = collectFiles(path6__namespace.default.resolve(rootDir), extensions, ignoreDirs);
4196
+ const files = collectFiles2(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
1901
4197
  if (files.length < PARALLEL_THRESHOLD) {
1902
- return mergeResults(batchExtractClassesNative(files));
4198
+ return mergeResults(batchExtractClassesNative2(files));
1903
4199
  }
1904
4200
  const chunks = [];
1905
4201
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -1916,14 +4212,14 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
1916
4212
  var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
1917
4213
  var init_parallel_scanner = __esm({
1918
4214
  "packages/domain/scanner/src/parallel-scanner.ts"() {
1919
- init_src2();
4215
+ init_src3();
1920
4216
  init_native_bridge();
1921
4217
  PARALLEL_THRESHOLD = 50;
1922
4218
  DEFAULT_CHUNK_SIZE = 150;
1923
4219
  if (!worker_threads.isMainThread && worker_threads.parentPort) {
1924
4220
  const { filePaths } = worker_threads.workerData;
1925
4221
  try {
1926
- const results = batchExtractClassesNative(filePaths);
4222
+ const results = batchExtractClassesNative2(filePaths);
1927
4223
  const msg = { ok: true, results };
1928
4224
  worker_threads.parentPort.postMessage(msg);
1929
4225
  } catch (error) {
@@ -1941,12 +4237,12 @@ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, S
1941
4237
  var init_schemas = __esm({
1942
4238
  "packages/domain/scanner/src/schemas.ts"() {
1943
4239
  init_src();
1944
- formatIssuePath2 = (path13) => path13.length > 0 ? path13.map(
4240
+ formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
1945
4241
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
1946
4242
  ).join(".") : "<root>";
1947
4243
  formatIssues = (error) => error.issues.map((issue) => {
1948
- const path13 = formatIssuePath2(issue.path);
1949
- return `${path13}: ${issue.message}`;
4244
+ const path16 = formatIssuePath2(issue.path);
4245
+ return `${path16}: ${issue.message}`;
1950
4246
  }).join("; ");
1951
4247
  parseWithSchema = (schema, data, label) => {
1952
4248
  const parsed = schema.safeParse(data);
@@ -2007,15 +4303,15 @@ var src_exports2 = {};
2007
4303
  __export(src_exports2, {
2008
4304
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
2009
4305
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
2010
- batchExtractClassesNative: () => batchExtractClassesNative,
4306
+ batchExtractClassesNative: () => batchExtractClassesNative2,
2011
4307
  extractClassesNative: () => extractClassesNative,
2012
- isScannableFile: () => isScannableFile,
4308
+ isScannableFile: () => isScannableFile2,
2013
4309
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
2014
4310
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
2015
4311
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
2016
- scanFile: () => scanFile,
4312
+ scanFile: () => scanFile2,
2017
4313
  scanSource: () => scanSource,
2018
- scanWorkspace: () => scanWorkspace,
4314
+ scanWorkspace: () => scanWorkspace2,
2019
4315
  scanWorkspaceAsync: () => scanWorkspaceAsync
2020
4316
  });
2021
4317
  function getRuntimeDir() {
@@ -2023,7 +4319,7 @@ function getRuntimeDir() {
2023
4319
  return __dirname;
2024
4320
  }
2025
4321
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))) {
2026
- return path6__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
4322
+ return path9__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
2027
4323
  }
2028
4324
  return process.cwd();
2029
4325
  }
@@ -2033,17 +4329,17 @@ function resolveScannerWorkerModulePath() {
2033
4329
  return __dirname;
2034
4330
  }
2035
4331
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))) {
2036
- return path6__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
4332
+ return path9__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.js', document.baseURI).href))));
2037
4333
  }
2038
4334
  return process.cwd();
2039
4335
  })();
2040
4336
  const candidates = [
2041
- path6__namespace.default.resolve(runtimeDir, "worker.cjs"),
2042
- path6__namespace.default.resolve(runtimeDir, "worker.js"),
2043
- path6__namespace.default.resolve(runtimeDir, "worker.ts")
4337
+ path9__namespace.default.resolve(runtimeDir, "worker.cjs"),
4338
+ path9__namespace.default.resolve(runtimeDir, "worker.js"),
4339
+ path9__namespace.default.resolve(runtimeDir, "worker.ts")
2044
4340
  ];
2045
4341
  for (const candidate of candidates) {
2046
- if (fs5__namespace.default.existsSync(candidate)) return candidate;
4342
+ if (fs13__namespace.default.existsSync(candidate)) return candidate;
2047
4343
  }
2048
4344
  return null;
2049
4345
  }
@@ -2100,19 +4396,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
2100
4396
  if (!currentDir) continue;
2101
4397
  const entries = (() => {
2102
4398
  try {
2103
- return fs5__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4399
+ return fs13__namespace.default.readdirSync(currentDir, { withFileTypes: true });
2104
4400
  } catch {
2105
4401
  return [];
2106
4402
  }
2107
4403
  })();
2108
4404
  for (const entry of entries) {
2109
- const fullPath = path6__namespace.default.join(currentDir, entry.name);
4405
+ const fullPath = path9__namespace.default.join(currentDir, entry.name);
2110
4406
  if (entry.isDirectory()) {
2111
4407
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
2112
4408
  continue;
2113
4409
  }
2114
4410
  if (!entry.isFile()) continue;
2115
- if (!extensionSet.has(path6__namespace.default.extname(entry.name))) continue;
4411
+ if (!extensionSet.has(path9__namespace.default.extname(entry.name))) continue;
2116
4412
  candidates.push(fullPath);
2117
4413
  }
2118
4414
  }
@@ -2138,12 +4434,12 @@ function scanSource(source) {
2138
4434
  "FATAL: Native parser binding is required but not available.\nThis package requires native Rust bindings.\n\nResolution steps:\n1. Build the native Rust module: npm run build:rust"
2139
4435
  );
2140
4436
  }
2141
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
2142
- return includeExtensions.includes(path6__namespace.default.extname(filePath));
4437
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4438
+ return includeExtensions.includes(path9__namespace.default.extname(filePath));
2143
4439
  }
2144
- function scanFile(filePath) {
2145
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
2146
- const result = scanFileNative2(filePath);
4440
+ function scanFile2(filePath) {
4441
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4442
+ const result = scanFileNative3(filePath);
2147
4443
  if (!result.ok) {
2148
4444
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
2149
4445
  }
@@ -2153,7 +4449,7 @@ function scanFile(filePath) {
2153
4449
  ...result.hash ? { hash: result.hash } : {}
2154
4450
  };
2155
4451
  }
2156
- function scanWorkspace(rootDir, options = {}) {
4452
+ function scanWorkspace2(rootDir, options = {}) {
2157
4453
  const normalizedOptions = parseScanWorkspaceOptions(options);
2158
4454
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
2159
4455
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -2199,7 +4495,7 @@ function scanWorkspace(rootDir, options = {}) {
2199
4495
  for (const filePath of candidates) {
2200
4496
  const stat = (() => {
2201
4497
  try {
2202
- return fs5__namespace.default.statSync(filePath);
4498
+ return fs13__namespace.default.statSync(filePath);
2203
4499
  } catch {
2204
4500
  return null;
2205
4501
  }
@@ -2225,7 +4521,7 @@ function scanWorkspace(rootDir, options = {}) {
2225
4521
  for (const { filePath, stat, size, cached } of ranked) {
2226
4522
  const content = (() => {
2227
4523
  try {
2228
- return fs5__namespace.default.readFileSync(filePath, "utf8");
4524
+ return fs13__namespace.default.readFileSync(filePath, "utf8");
2229
4525
  } catch {
2230
4526
  return null;
2231
4527
  }
@@ -2276,7 +4572,7 @@ function scanWorkspace(rootDir, options = {}) {
2276
4572
  }
2277
4573
  } else {
2278
4574
  for (const filePath of candidates) {
2279
- processResult(scanFile(filePath));
4575
+ processResult(scanFile2(filePath));
2280
4576
  }
2281
4577
  }
2282
4578
  return parseScanWorkspaceResult({
@@ -2303,11 +4599,11 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
2303
4599
  log3.debug(
2304
4600
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
2305
4601
  );
2306
- return scanWorkspace(rootDir, normalizedOptions);
4602
+ return scanWorkspace2(rootDir, normalizedOptions);
2307
4603
  }
2308
4604
  }
2309
4605
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
2310
- var init_src2 = __esm({
4606
+ var init_src3 = __esm({
2311
4607
  "packages/domain/scanner/src/index.ts"() {
2312
4608
  init_src();
2313
4609
  init_cache_native();
@@ -2316,7 +4612,7 @@ var init_src2 = __esm({
2316
4612
  init_schemas();
2317
4613
  init_schemas();
2318
4614
  init_native_bridge();
2319
- log3 = createLogger("scanner");
4615
+ log3 = createLogger2("scanner");
2320
4616
  SCAN_WORKER_TIMEOUT_MS = 12e4;
2321
4617
  createNativeParserLoader = () => {
2322
4618
  const _state = {
@@ -2329,7 +4625,7 @@ var init_src2 = __esm({
2329
4625
  const loadNativeParserBinding = () => {
2330
4626
  if (_state.binding !== void 0) return _state.binding;
2331
4627
  const runtimeDir = getRuntimeDir();
2332
- const req = module$1.createRequire(path6__namespace.default.join(runtimeDir, "noop.cjs"));
4628
+ const req = module$1.createRequire(path9__namespace.default.join(runtimeDir, "noop.cjs"));
2333
4629
  const _platform = process.platform;
2334
4630
  const _arch = process.arch;
2335
4631
  const _platformArch = `${_platform}-${_arch}`;
@@ -2337,27 +4633,27 @@ var init_src2 = __esm({
2337
4633
  const candidates = [
2338
4634
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
2339
4635
  // cwd = repo root saat run dari root, atau package dir saat workspaces
2340
- path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
2341
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
2342
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4636
+ path9__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4637
+ path9__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4638
+ path9__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
2343
4639
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
2344
4640
  // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
2345
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
2346
- path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
2347
- path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4641
+ path9__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4642
+ path9__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4643
+ path9__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
2348
4644
  // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
2349
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
2350
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4645
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4646
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
2351
4647
  // 3 level fallback (jika package di-nest lebih dangkal)
2352
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
2353
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4648
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4649
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
2354
4650
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
2355
- path6__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
2356
- path6__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
2357
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
2358
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
2359
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
2360
- path6__namespace.default.resolve(
4651
+ path9__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4652
+ path9__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4653
+ path9__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4654
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4655
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4656
+ path9__namespace.default.resolve(
2361
4657
  runtimeDir,
2362
4658
  "..",
2363
4659
  "..",
@@ -2369,7 +4665,7 @@ var init_src2 = __esm({
2369
4665
  )
2370
4666
  ];
2371
4667
  for (const fullPath of candidates) {
2372
- if (!fs5__namespace.default.existsSync(fullPath)) continue;
4668
+ if (!fs13__namespace.default.existsSync(fullPath)) continue;
2373
4669
  try {
2374
4670
  const required = req(fullPath);
2375
4671
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -2494,48 +4790,11 @@ var init_native_bridge2 = __esm({
2494
4790
  }
2495
4791
  });
2496
4792
 
2497
- // packages/domain/compiler/src/index.ts
2498
- init_nativeBridge();
2499
- var transformSource = (source, opts) => {
2500
- const native = getNativeBridge();
2501
- if (!native?.transformSource) {
2502
- throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2503
- }
2504
- const result = native.transformSource(source, opts);
2505
- if (!result) {
2506
- throw new Error("FATAL: transformSource returned null");
2507
- }
2508
- return result;
2509
- };
2510
- var generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
2511
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2512
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2513
- return result.css;
2514
- };
2515
- var mergeClassesStatic = (classes) => {
2516
- const result = normalizeAndDedupClasses(classes);
2517
- return result?.normalized || "";
2518
- };
2519
- var normalizeAndDedupClasses = (raw) => {
2520
- const native = getNativeBridge();
2521
- if (!native?.normalizeAndDedupClasses) {
2522
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
2523
- }
2524
- const result = native.normalizeAndDedupClasses(raw);
2525
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
2526
- };
2527
- var runLoaderTransform = (ctx) => {
2528
- const { filepath, source, options } = ctx;
2529
- const result = transformSource(source, { filename: filepath, ...options });
2530
- return {
2531
- code: result?.code || "",
2532
- changed: result?.changed || false,
2533
- classes: result?.classes || []
2534
- };
2535
- };
4793
+ // packages/presentation/vite/src/plugin.ts
4794
+ init_src2();
2536
4795
 
2537
4796
  // packages/domain/analyzer/src/analyzeWorkspace.ts
2538
- init_src2();
4797
+ init_src3();
2539
4798
 
2540
4799
  // packages/domain/analyzer/src/binding.ts
2541
4800
  init_src();
@@ -2555,7 +4814,7 @@ function isRecord(value) {
2555
4814
  }
2556
4815
  async function pathExists(filePath) {
2557
4816
  try {
2558
- await fs5__namespace.default.promises.access(filePath, fs5__namespace.default.constants.F_OK);
4817
+ await fs13__namespace.default.promises.access(filePath, fs13__namespace.default.constants.F_OK);
2559
4818
  return true;
2560
4819
  } catch {
2561
4820
  return false;
@@ -2654,7 +4913,7 @@ async function requireNativeBinding() {
2654
4913
 
2655
4914
  // packages/domain/analyzer/src/schemas.ts
2656
4915
  init_src();
2657
- var formatIssuePath3 = (path13) => path13.length > 0 ? path13.map(
4916
+ var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
2658
4917
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
2659
4918
  ).join(".") : "<root>";
2660
4919
  var isPlainObject = (value) => {
@@ -2663,8 +4922,8 @@ var isPlainObject = (value) => {
2663
4922
  return proto === Object.prototype || proto === null;
2664
4923
  };
2665
4924
  var formatIssues2 = (error) => error.issues.map((issue) => {
2666
- const path13 = formatIssuePath3(issue.path);
2667
- return `${path13}: ${issue.message}`;
4925
+ const path16 = formatIssuePath3(issue.path);
4926
+ return `${path16}: ${issue.message}`;
2668
4927
  }).join("; ");
2669
4928
  var parseWithSchema2 = (schema, data, label) => {
2670
4929
  const parsed = schema.safeParse(data);
@@ -2754,7 +5013,7 @@ var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema,
2754
5013
  var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
2755
5014
  var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
2756
5015
  var tailwindConfigCache = /* @__PURE__ */ new Map();
2757
- var detectConflicts = async (usages) => {
5016
+ var detectConflicts2 = async (usages) => {
2758
5017
  const native = await getNativeBinding();
2759
5018
  if (!native?.detectClassConflicts) {
2760
5019
  throw new Error("FATAL: Native binding 'detectClassConflicts' is required but not available.");
@@ -2771,11 +5030,11 @@ var detectConflicts = async (usages) => {
2771
5030
  };
2772
5031
  };
2773
5032
  var isSupportedTailwindConfigPath = (configPath) => {
2774
- return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path6__namespace.default.extname(configPath).toLowerCase());
5033
+ return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path9__namespace.default.extname(configPath).toLowerCase());
2775
5034
  };
2776
5035
  var resolveTailwindConfigPath = async (root, explicitPath) => {
2777
5036
  if (explicitPath) {
2778
- const resolved = path6__namespace.default.resolve(root, explicitPath);
5037
+ const resolved = path9__namespace.default.resolve(root, explicitPath);
2779
5038
  if (!await pathExists(resolved)) return null;
2780
5039
  return resolved;
2781
5040
  }
@@ -2786,7 +5045,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
2786
5045
  "tailwind.config.mjs"
2787
5046
  ];
2788
5047
  for (const candidate of candidates) {
2789
- const fullPath = path6__namespace.default.resolve(root, candidate);
5048
+ const fullPath = path9__namespace.default.resolve(root, candidate);
2790
5049
  if (await pathExists(fullPath)) return fullPath;
2791
5050
  }
2792
5051
  return null;
@@ -2840,8 +5099,8 @@ var collectCustomUtilities = (config) => {
2840
5099
  return out;
2841
5100
  };
2842
5101
  var collectSafelistFromSource = async (configPath) => {
2843
- const source = await fs5__namespace.default.promises.readFile(configPath, "utf8");
2844
- const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
5102
+ const source = await fs13__namespace.default.promises.readFile(configPath, "utf8");
5103
+ const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
2845
5104
  const allTokens = extractClassesNative2(source);
2846
5105
  const hasSafelist = source.includes("safelist");
2847
5106
  if (!hasSafelist) return [];
@@ -2854,7 +5113,7 @@ var collectSafelistFromSource = async (configPath) => {
2854
5113
  }
2855
5114
  return allTokens.filter((t) => safelistSet.has(t));
2856
5115
  };
2857
- var loadTailwindConfig = async (root, semanticOption) => {
5116
+ var loadTailwindConfig2 = async (root, semanticOption) => {
2858
5117
  const startMs = Date.now();
2859
5118
  const configPath = await resolveTailwindConfigPath(root, semanticOption?.tailwindConfigPath);
2860
5119
  if (!configPath) return null;
@@ -2867,7 +5126,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
2867
5126
  customUtilities: /* @__PURE__ */ new Set()
2868
5127
  };
2869
5128
  }
2870
- const configStat = await fs5__namespace.default.promises.stat(configPath).catch(() => null);
5129
+ const configStat = await fs13__namespace.default.promises.stat(configPath).catch(() => null);
2871
5130
  if (configStat) {
2872
5131
  const cached = tailwindConfigCache.get(configPath);
2873
5132
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -2935,7 +5194,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
2935
5194
  return loaded;
2936
5195
  };
2937
5196
  var buildSemanticReport = async (usages, root, semanticOption) => {
2938
- const loadedConfig = await loadTailwindConfig(root, semanticOption);
5197
+ const loadedConfig = await loadTailwindConfig2(root, semanticOption);
2939
5198
  const safelist = loadedConfig?.safelist ?? /* @__PURE__ */ new Set();
2940
5199
  const customUtilities = loadedConfig?.customUtilities ?? /* @__PURE__ */ new Set();
2941
5200
  const usageNames = new Set(usages.map((usage) => usage.name));
@@ -2954,7 +5213,7 @@ var buildSemanticReport = async (usages, root, semanticOption) => {
2954
5213
  results.filter((r) => !r.isKnown).map((r) => r.className)
2955
5214
  );
2956
5215
  const unknownClasses = usages.filter((usage) => unknownSet.has(usage.name)).map((usage) => ({ ...usage, isUnused: true }));
2957
- const { conflicts } = await detectConflicts(usages);
5216
+ const { conflicts } = await detectConflicts2(usages);
2958
5217
  return {
2959
5218
  unusedClasses,
2960
5219
  unknownClasses,
@@ -3026,7 +5285,7 @@ async function buildDistribution(usages, native) {
3026
5285
  }
3027
5286
  async function analyzeWorkspace(root, options = {}) {
3028
5287
  const startedAtMs = Date.now();
3029
- const resolvedRoot = path6__namespace.default.resolve(root);
5288
+ const resolvedRoot = path9__namespace.default.resolve(root);
3030
5289
  const normalizedOptions = parseAnalyzerOptions(options);
3031
5290
  const scan = await (async () => {
3032
5291
  const scanStartedAtMs = Date.now();
@@ -3129,16 +5388,17 @@ async function analyzeWorkspace(root, options = {}) {
3129
5388
  }
3130
5389
 
3131
5390
  // packages/domain/engine/src/index.ts
3132
- init_src2();
5391
+ init_internal();
5392
+ init_src3();
3133
5393
  init_src();
3134
5394
 
3135
5395
  // packages/domain/engine/src/incremental.ts
3136
- init_src2();
5396
+ init_src3();
3137
5397
  init_src();
3138
5398
  init_native_bridge2();
3139
5399
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
3140
- var log5 = createLogger("engine:incremental");
3141
- function rebuildWorkspaceResult(byFile) {
5400
+ var log5 = createLogger2("engine:incremental");
5401
+ function rebuildWorkspaceResult2(byFile) {
3142
5402
  const files = Array.from(byFile.values());
3143
5403
  const native = getNativeEngineBinding();
3144
5404
  if (native?.rebuildWorkspaceResult) {
@@ -3167,9 +5427,9 @@ function areClassSetsEqual(a, b) {
3167
5427
  }
3168
5428
  function applyIncrementalChange(previous, filePath, type, scanner) {
3169
5429
  const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
3170
- if (!isScannableFile(filePath, includeExtensions)) return previous;
3171
- const byFile = new Map(previous.files.map((f) => [path6__namespace.default.resolve(f.file), f]));
3172
- const normalizedPath = path6__namespace.default.resolve(filePath);
5430
+ if (!isScannableFile2(filePath, includeExtensions)) return previous;
5431
+ const byFile = new Map(previous.files.map((f) => [path9__namespace.default.resolve(f.file), f]));
5432
+ const normalizedPath = path9__namespace.default.resolve(filePath);
3173
5433
  const native = getNativeEngineBinding();
3174
5434
  if (!native?.processFileChange) {
3175
5435
  throw new Error(
@@ -3181,11 +5441,11 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
3181
5441
  log5.debug(`native unlink ${normalizedPath}`);
3182
5442
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
3183
5443
  byFile.delete(normalizedPath);
3184
- return rebuildWorkspaceResult(byFile);
5444
+ return rebuildWorkspaceResult2(byFile);
3185
5445
  }
3186
5446
  log5.debug(`native change ${normalizedPath}`);
3187
- const scanned = scanFile(normalizedPath);
3188
- const content = fs5__namespace.default.readFileSync(normalizedPath, "utf8");
5447
+ const scanned = scanFile2(normalizedPath);
5448
+ const content = fs13__namespace.default.readFileSync(normalizedPath, "utf8");
3189
5449
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
3190
5450
  const existing = byFile.get(normalizedPath);
3191
5451
  if (diff && existing) {
@@ -3197,7 +5457,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
3197
5457
  log5.debug(`native diff cold-sync ${normalizedPath}`);
3198
5458
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
3199
5459
  }
3200
- return rebuildWorkspaceResult(byFile);
5460
+ return rebuildWorkspaceResult2(byFile);
3201
5461
  }
3202
5462
 
3203
5463
  // packages/domain/engine/src/metrics.ts
@@ -3254,8 +5514,8 @@ var METRICS_FILE_NAME = "metrics.json";
3254
5514
  var CACHE_DIR = ".tw-cache";
3255
5515
  function writeMetrics(metrics, cwd = process.cwd()) {
3256
5516
  try {
3257
- const cacheDir = path6__namespace.default.join(cwd, CACHE_DIR);
3258
- fs5__namespace.default.mkdirSync(cacheDir, { recursive: true });
5517
+ const cacheDir = path9__namespace.default.join(cwd, CACHE_DIR);
5518
+ fs13__namespace.default.mkdirSync(cacheDir, { recursive: true });
3259
5519
  const mem = process.memoryUsage();
3260
5520
  const data = {
3261
5521
  ...metrics,
@@ -3266,7 +5526,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
3266
5526
  },
3267
5527
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
3268
5528
  };
3269
- fs5__namespace.default.writeFileSync(path6__namespace.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
5529
+ fs13__namespace.default.writeFileSync(path9__namespace.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
3270
5530
  } catch {
3271
5531
  }
3272
5532
  }
@@ -3373,19 +5633,19 @@ var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, opti
3373
5633
  var parseEngineWatchOptions = (options) => parseWithSchema3(EngineWatchOptionsSchema, options ?? {}, "engine watch options are invalid");
3374
5634
 
3375
5635
  // packages/domain/engine/src/watch.ts
3376
- var _native = null;
5636
+ var _native2 = null;
3377
5637
  function getNativeWatcher() {
3378
- if (_native !== null) return _native;
5638
+ if (_native2 !== null) return _native2;
3379
5639
  try {
3380
5640
  const { resolveNativeBinary: resolveNativeBinary2 } = (init_src(), __toCommonJS(src_exports));
3381
5641
  const { path: binPath } = resolveNativeBinary2(__dirname);
3382
5642
  if (binPath) {
3383
- _native = __require(binPath);
5643
+ _native2 = __require(binPath);
3384
5644
  }
3385
5645
  } catch {
3386
- _native = {};
5646
+ _native2 = {};
3387
5647
  }
3388
- return _native;
5648
+ return _native2;
3389
5649
  }
3390
5650
  function watchWorkspaceNative(rootDir, onEvent, options) {
3391
5651
  const native = getNativeWatcher();
@@ -3462,11 +5722,11 @@ var configState = {
3462
5722
  return this.tailwindConfigLoaded;
3463
5723
  }
3464
5724
  };
3465
- var log6 = createLogger("engine");
5725
+ var log6 = createLogger2("engine");
3466
5726
  async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
3467
5727
  if (!tailwindConfigPath) return void 0;
3468
- const configPath = path6__namespace.default.resolve(root, tailwindConfigPath);
3469
- if (!fs5__namespace.default.existsSync(configPath)) {
5728
+ const configPath = path9__namespace.default.resolve(root, tailwindConfigPath);
5729
+ if (!fs13__namespace.default.existsSync(configPath)) {
3470
5730
  throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
3471
5731
  }
3472
5732
  const imported = await import(url.pathToFileURL(configPath).href);
@@ -3532,13 +5792,14 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
3532
5792
  };
3533
5793
  }
3534
5794
  function countWorkspacePackages(root) {
3535
- const packagesDir = path6__namespace.default.join(root, "packages");
3536
- if (!fs5__namespace.default.existsSync(packagesDir)) return 0;
5795
+ const packagesDir = path9__namespace.default.join(root, "packages");
5796
+ if (!fs13__namespace.default.existsSync(packagesDir)) return 0;
3537
5797
  try {
3538
- return fs5__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
3539
- (entry) => entry.isDirectory() && fs5__namespace.default.existsSync(path6__namespace.default.join(packagesDir, entry.name, "package.json"))
5798
+ return fs13__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
5799
+ (entry) => entry.isDirectory() && fs13__namespace.default.existsSync(path9__namespace.default.join(packagesDir, entry.name, "package.json"))
3540
5800
  ).length;
3541
- } catch {
5801
+ } catch (err) {
5802
+ log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
3542
5803
  return 0;
3543
5804
  }
3544
5805
  }
@@ -3572,7 +5833,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
3572
5833
  async function createEngine(rawOptions = {}) {
3573
5834
  const options = parseEngineOptions(rawOptions);
3574
5835
  const root = options.root ?? process.cwd();
3575
- const resolvedRoot = path6__namespace.default.resolve(root);
5836
+ const resolvedRoot = path9__namespace.default.resolve(root);
3576
5837
  const plugins = rawOptions.plugins ?? [];
3577
5838
  const getTailwindConfig = async () => {
3578
5839
  if (configState.isLoaded()) return configState.getConfig();
@@ -3719,12 +5980,13 @@ async function createEngine(rawOptions = {}) {
3719
5980
  const shouldForceFullRescan = (event) => {
3720
5981
  if (event.type === "unlink") return false;
3721
5982
  try {
3722
- const stat = fs5__namespace.default.statSync(event.filePath);
5983
+ const stat = fs13__namespace.default.statSync(event.filePath);
3723
5984
  if (stat.size > largeFileThreshold) {
3724
5985
  metrics.markSkippedLargeFile();
3725
5986
  return true;
3726
5987
  }
3727
- } catch {
5988
+ } catch (statErr) {
5989
+ log6.debug(`stat failed for ${event.filePath}: ${statErr instanceof Error ? statErr.message : String(statErr)}`);
3728
5990
  return false;
3729
5991
  }
3730
5992
  return false;
@@ -3838,7 +6100,7 @@ async function createEngine(rawOptions = {}) {
3838
6100
 
3839
6101
  // packages/presentation/vite/src/schemas.ts
3840
6102
  init_src();
3841
- var formatIssuePath4 = (path13) => path13.length > 0 ? path13.map(
6103
+ var formatIssuePath4 = (path16) => path16.length > 0 ? path16.map(
3842
6104
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3843
6105
  ).join(".") : "<root>";
3844
6106
  var formatIssues4 = (error) => error.issues.map((issue) => {
@@ -3884,14 +6146,14 @@ function warnDeprecated(options, key, message) {
3884
6146
  }
3885
6147
  }
3886
6148
  function isInsideDirectory(filePath, directory) {
3887
- const relative = path6__namespace.default.relative(directory, filePath);
3888
- return relative === "" || !relative.startsWith("..") && !path6__namespace.default.isAbsolute(relative);
6149
+ const relative = path9__namespace.default.relative(directory, filePath);
6150
+ return relative === "" || !relative.startsWith("..") && !path9__namespace.default.isAbsolute(relative);
3889
6151
  }
3890
6152
  function filterScanToDirs(scan, root, scanDirs) {
3891
- const resolvedDirs = scanDirs.map((dir) => path6__namespace.default.resolve(root, dir));
6153
+ const resolvedDirs = scanDirs.map((dir) => path9__namespace.default.resolve(root, dir));
3892
6154
  if (resolvedDirs.length === 0) return scan;
3893
6155
  const files = scan.files.filter((file) => {
3894
- const absoluteFile = path6__namespace.default.resolve(file.file);
6156
+ const absoluteFile = path9__namespace.default.resolve(file.file);
3895
6157
  return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
3896
6158
  });
3897
6159
  const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
@@ -3902,9 +6164,9 @@ function filterScanToDirs(scan, root, scanDirs) {
3902
6164
  };
3903
6165
  }
3904
6166
  function writeJsonArtifact(root, relativePath, value) {
3905
- const outputPath = path6__namespace.default.resolve(root, relativePath);
3906
- fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(outputPath), { recursive: true });
3907
- fs5__namespace.default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
6167
+ const outputPath = path9__namespace.default.resolve(root, relativePath);
6168
+ fs13__namespace.default.mkdirSync(path9__namespace.default.dirname(outputPath), { recursive: true });
6169
+ fs13__namespace.default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
3908
6170
  `);
3909
6171
  }
3910
6172
  function tailwindStyledPlugin(opts = {}) {
@@ -3931,12 +6193,77 @@ function tailwindStyledPlugin(opts = {}) {
3931
6193
  const transformRunner = rawOptions.__internalTransformRunner ?? runLoaderTransform;
3932
6194
  const engineFactory = rawOptions.__internalCreateEngine ?? createEngine;
3933
6195
  const pluginState = { root: process.cwd(), isDev: true };
6196
+ const staticCssPerFile = /* @__PURE__ */ new Map();
6197
+ function deduplicateStaticCss(css) {
6198
+ const seen = /* @__PURE__ */ new Set();
6199
+ const rules = [];
6200
+ for (const chunk of css.split(/(?<=\})\s*/)) {
6201
+ const rule = chunk.trim();
6202
+ if (rule && !seen.has(rule)) {
6203
+ seen.add(rule);
6204
+ rules.push(rule);
6205
+ }
6206
+ }
6207
+ return rules.join("\n");
6208
+ }
6209
+ function getStaticCssOutputPath(root, safelistOutputPath) {
6210
+ return path9__namespace.default.resolve(root, path9__namespace.default.dirname(safelistOutputPath), "_tw-state-static.css");
6211
+ }
6212
+ function flushStaticCss(root) {
6213
+ if (staticCssPerFile.size === 0) return;
6214
+ const combined = Array.from(staticCssPerFile.values()).join("\n");
6215
+ const deduped = deduplicateStaticCss(combined);
6216
+ if (!deduped.trim()) return;
6217
+ const outPath = getStaticCssOutputPath(root, safelistOutput);
6218
+ try {
6219
+ fs13__namespace.default.mkdirSync(path9__namespace.default.dirname(outPath), { recursive: true });
6220
+ fs13__namespace.default.writeFileSync(
6221
+ outPath,
6222
+ `/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
6223
+ * Import this in globals.css: @import "./_tw-state-static.css";
6224
+ * Contains: state CSS (.tw-s-*[data-*="true"]) + container queries (@container .tw-cq-*).
6225
+ */
6226
+
6227
+ ${deduped}
6228
+ `
6229
+ );
6230
+ } catch (e) {
6231
+ console.warn("[tailwind-styled-v4] Could not write _tw-state-static.css:", e);
6232
+ }
6233
+ }
3934
6234
  return {
3935
6235
  name: "tailwind-styled-v4",
3936
6236
  enforce: "pre",
3937
6237
  configResolved(config) {
3938
6238
  pluginState.root = config.root;
3939
6239
  pluginState.isDev = config.command === "serve";
6240
+ try {
6241
+ const outPath = getStaticCssOutputPath(config.root, safelistOutput);
6242
+ const CSS_CANDIDATES = [
6243
+ "src/index.css",
6244
+ "src/main.css",
6245
+ "src/App.css",
6246
+ "src/styles/index.css",
6247
+ "src/styles/main.css",
6248
+ "src/globals.css",
6249
+ "src/style.css"
6250
+ ];
6251
+ for (const candidate of CSS_CANDIDATES) {
6252
+ const candidatePath = path9__namespace.default.resolve(config.root, candidate);
6253
+ if (!fs13__namespace.default.existsSync(candidatePath)) continue;
6254
+ const content = fs13__namespace.default.readFileSync(candidatePath, "utf-8");
6255
+ if (content.includes("_tw-state-static.css")) break;
6256
+ const rel = path9__namespace.default.relative(path9__namespace.default.dirname(candidatePath), outPath).replace(/\\/g, "/");
6257
+ const importLine = `@import "./${rel}";`;
6258
+ const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
6259
+ const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
6260
+ `) : `${importLine}
6261
+ ${content}`;
6262
+ fs13__namespace.default.writeFileSync(candidatePath, updated, "utf-8");
6263
+ break;
6264
+ }
6265
+ } catch {
6266
+ }
3940
6267
  },
3941
6268
  transform(source, id) {
3942
6269
  const filepath = id.split("?")[0];
@@ -3962,6 +6289,12 @@ function tailwindStyledPlugin(opts = {}) {
3962
6289
  return null;
3963
6290
  }
3964
6291
  if (!output.changed) return null;
6292
+ if (output.staticCss) {
6293
+ staticCssPerFile.set(filepath, output.staticCss);
6294
+ if (pluginState.isDev) {
6295
+ flushStaticCss(pluginState.root);
6296
+ }
6297
+ }
3965
6298
  return { code: output.code, map: null };
3966
6299
  },
3967
6300
  async buildEnd() {
@@ -3979,6 +6312,10 @@ function tailwindStyledPlugin(opts = {}) {
3979
6312
  if (doSafelist) {
3980
6313
  writeJsonArtifact(pluginState.root, safelistOutput, scan.uniqueClasses);
3981
6314
  }
6315
+ flushStaticCss(pluginState.root);
6316
+ console.log(
6317
+ `[tailwind-styled-v4] Static CSS: ${staticCssPerFile.size} files \u2192 _tw-state-static.css`
6318
+ );
3982
6319
  writeJsonArtifact(pluginState.root, scanReportOutput, {
3983
6320
  root: pluginState.root,
3984
6321
  totalFiles: scan.totalFiles,