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/engine.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 fs3 = 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 fs3__namespace = /*#__PURE__*/_interopNamespace(fs3);
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 (fs3__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 (fs3__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 (fs3__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 (fs3__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,2479 @@ var init_observability = __esm({
1009
1009
  }
1010
1010
  });
1011
1011
 
1012
+ // packages/domain/compiler/src/nativeBridge.ts
1013
+ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
1014
+ var init_nativeBridge = __esm({
1015
+ "packages/domain/compiler/src/nativeBridge.ts"() {
1016
+ init_src2();
1017
+ _loadNative = (path16) => __require(path16);
1018
+ log = (...args) => {
1019
+ if (process.env.DEBUG?.includes("compiler:native")) {
1020
+ console.log("[compiler:native]", ...args);
1021
+ }
1022
+ };
1023
+ NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/compiler v5] Native binding is required but not available.\nThis package requires native Rust bindings. There is no JavaScript fallback.\nPlease ensure:\n 1. The native module is properly installed\n 2. You have run: npm run build:rust (or use prebuilt binary)\n\nFor help, see: https://tailwind-styled.dev/docs/install";
1024
+ nativeBridge = null;
1025
+ bridgeLoadAttempted = false;
1026
+ bridgeLoadError = null;
1027
+ isValidNativeBridge = (mod) => {
1028
+ const m = mod;
1029
+ return !!(typeof m.transformSource === "function" || typeof m.extractAllClasses === "function" || typeof m.hasTwUsage === "function");
1030
+ };
1031
+ getNativeBridge = () => {
1032
+ if (nativeBridge) {
1033
+ return nativeBridge;
1034
+ }
1035
+ if (bridgeLoadAttempted) {
1036
+ if (bridgeLoadError) {
1037
+ throw bridgeLoadError;
1038
+ }
1039
+ throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
1040
+ }
1041
+ bridgeLoadAttempted = true;
1042
+ try {
1043
+ const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
1044
+ const result = resolveNativeBinary(runtimeDir);
1045
+ if (result.path && result.path.endsWith(".node")) {
1046
+ try {
1047
+ const binding = _loadNative(result.path);
1048
+ if (isValidNativeBridge(binding)) {
1049
+ nativeBridge = binding;
1050
+ log("Native bridge loaded successfully from:", result.path);
1051
+ return nativeBridge;
1052
+ }
1053
+ } catch (e) {
1054
+ log("Failed to require native binding:", e);
1055
+ }
1056
+ }
1057
+ throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
1058
+
1059
+ Tried paths: ${result.tried.join("\n")}`);
1060
+ } catch (err) {
1061
+ bridgeLoadError = err instanceof Error ? err : new Error(String(err));
1062
+ log("Failed to load native bridge:", bridgeLoadError.message);
1063
+ throw bridgeLoadError;
1064
+ }
1065
+ };
1066
+ adaptNativeResult = (raw) => {
1067
+ return {
1068
+ code: raw.code ?? "",
1069
+ classes: raw.classes ?? [],
1070
+ changed: raw.changed ?? false,
1071
+ rsc: raw.rscJson ? JSON.parse(raw.rscJson) : void 0,
1072
+ metadata: raw.metadataJson ? JSON.parse(raw.metadataJson) : void 0
1073
+ };
1074
+ };
1075
+ if (typeof process !== "undefined" && !bridgeLoadAttempted) {
1076
+ try {
1077
+ getNativeBridge();
1078
+ } catch {
1079
+ }
1080
+ }
1081
+ }
1082
+ });
1083
+
1084
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
1085
+ async function generateCssNative(classes, options) {
1086
+ const { theme } = options;
1087
+ const native = getNativeBridge();
1088
+ if (!native?.generateCssNative) {
1089
+ throw new Error(
1090
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
1091
+ );
1092
+ }
1093
+ const themeJson = JSON.stringify(theme);
1094
+ const css = native.generateCssNative(classes, themeJson);
1095
+ return css;
1096
+ }
1097
+ function clearThemeCache() {
1098
+ try {
1099
+ const native = getNativeBridge();
1100
+ if (!native?.clearThemeCache) {
1101
+ return;
1102
+ }
1103
+ native.clearThemeCache();
1104
+ } catch {
1105
+ }
1106
+ }
1107
+ var init_cssGeneratorNative = __esm({
1108
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1109
+ init_nativeBridge();
1110
+ }
1111
+ });
1112
+
1113
+ // packages/domain/compiler/src/compiler/compilationNative.ts
1114
+ function compileCssNative2(classes, prefix) {
1115
+ const native = getNativeBridge();
1116
+ if (!native?.compileCss) throw new Error("compileCss not available");
1117
+ return native.compileCss(classes, prefix);
1118
+ }
1119
+ function compileCssLightning(classes) {
1120
+ const native = getNativeBridge();
1121
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
1122
+ return native.compileCssLightning(classes);
1123
+ }
1124
+ function extractTwStateConfigsNative(source, filename) {
1125
+ const native = getNativeBridge();
1126
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
1127
+ return native.extractTwStateConfigs(source, filename);
1128
+ }
1129
+ function generateStaticStateCssNative(inputs, resolvedCss) {
1130
+ const native = getNativeBridge();
1131
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
1132
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
1133
+ }
1134
+ function extractAndGenerateStateCssNative(source, filename) {
1135
+ const native = getNativeBridge();
1136
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
1137
+ return native.extractAndGenerateStateCss(source, filename);
1138
+ }
1139
+ function layoutClassesToCss(classes) {
1140
+ const native = getNativeBridge();
1141
+ if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
1142
+ return native.layoutClassesToCss(classes);
1143
+ }
1144
+ function hashContent(input, algorithm = "sha256", length = 8) {
1145
+ const native = getNativeBridge();
1146
+ if (!native?.hashContent) throw new Error("hashContent not available");
1147
+ return native.hashContent(input, algorithm, length);
1148
+ }
1149
+ function extractTwContainerConfigs(source) {
1150
+ const native = getNativeBridge();
1151
+ if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
1152
+ return native.extractTwContainerConfigs(source);
1153
+ }
1154
+ function parseAtomicClass(twClass) {
1155
+ const native = getNativeBridge();
1156
+ if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
1157
+ return native.parseAtomicClass(twClass);
1158
+ }
1159
+ function generateAtomicCss(rulesJson) {
1160
+ const native = getNativeBridge();
1161
+ if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
1162
+ return native.generateAtomicCss(rulesJson);
1163
+ }
1164
+ function toAtomicClasses(twClasses) {
1165
+ const native = getNativeBridge();
1166
+ if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
1167
+ return native.toAtomicClasses(twClasses);
1168
+ }
1169
+ function clearAtomicRegistry() {
1170
+ const native = getNativeBridge();
1171
+ if (!native?.clearAtomicRegistry) return;
1172
+ native.clearAtomicRegistry();
1173
+ }
1174
+ function atomicRegistrySize() {
1175
+ const native = getNativeBridge();
1176
+ if (!native?.atomicRegistrySize) return 0;
1177
+ return native.atomicRegistrySize();
1178
+ }
1179
+ var init_compilationNative = __esm({
1180
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1181
+ init_nativeBridge();
1182
+ }
1183
+ });
1184
+
1185
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
1186
+ function compileClass(input) {
1187
+ const native = getNativeBridge();
1188
+ if (!native?.compile_class) throw new Error("compile_class not available");
1189
+ const resultJson = native.compile_class(input);
1190
+ try {
1191
+ return JSON.parse(resultJson);
1192
+ } catch {
1193
+ return {
1194
+ selector: "",
1195
+ declarations: "",
1196
+ properties: [],
1197
+ specificity: 0
1198
+ };
1199
+ }
1200
+ }
1201
+ function compileClasses(inputs) {
1202
+ const native = getNativeBridge();
1203
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
1204
+ const resultJson = native.compile_classes(inputs);
1205
+ try {
1206
+ return JSON.parse(resultJson);
1207
+ } catch {
1208
+ return {
1209
+ css: "",
1210
+ resolved_classes: [],
1211
+ unknown_classes: [],
1212
+ size_bytes: 0,
1213
+ duration_ms: 0
1214
+ };
1215
+ }
1216
+ }
1217
+ function compileToCss(input, minify) {
1218
+ const native = getNativeBridge();
1219
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1220
+ return native.compile_to_css(input, minify ?? false);
1221
+ }
1222
+ function compileToCssBatch(inputs, minify) {
1223
+ const native = getNativeBridge();
1224
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1225
+ return native.compile_to_css_batch(inputs, minify ?? false);
1226
+ }
1227
+ function minifyCss(css) {
1228
+ const native = getNativeBridge();
1229
+ if (!native?.minify_css) throw new Error("minify_css not available");
1230
+ return native.minify_css(css);
1231
+ }
1232
+ function compileAnimation(animationName, from, to) {
1233
+ const native = getNativeBridge();
1234
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
1235
+ const resultJson = native.compile_animation(animationName, from, to);
1236
+ try {
1237
+ return JSON.parse(resultJson);
1238
+ } catch {
1239
+ return {
1240
+ animation_id: "",
1241
+ keyframes_css: "",
1242
+ animation_rule: "",
1243
+ duration_ms: 0
1244
+ };
1245
+ }
1246
+ }
1247
+ function compileKeyframes(name, stopsJson) {
1248
+ const native = getNativeBridge();
1249
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1250
+ const resultJson = native.compile_keyframes(name, stopsJson);
1251
+ try {
1252
+ return JSON.parse(resultJson);
1253
+ } catch {
1254
+ return {
1255
+ animation_id: "",
1256
+ keyframes_css: "",
1257
+ animation_rule: "",
1258
+ duration_ms: 0
1259
+ };
1260
+ }
1261
+ }
1262
+ function compileTheme(tokensJson, themeName, prefix) {
1263
+ const native = getNativeBridge();
1264
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
1265
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1266
+ try {
1267
+ return JSON.parse(resultJson);
1268
+ } catch {
1269
+ return {
1270
+ selector: ":root",
1271
+ variables: [],
1272
+ variables_css: "",
1273
+ theme_name: themeName
1274
+ };
1275
+ }
1276
+ }
1277
+ function twMerge(classString) {
1278
+ const native = getNativeBridge();
1279
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
1280
+ return native.tw_merge(classString);
1281
+ }
1282
+ function twMergeMany(classStrings) {
1283
+ const native = getNativeBridge();
1284
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1285
+ return native.tw_merge_many(classStrings);
1286
+ }
1287
+ function twMergeWithSeparator(classString, options) {
1288
+ const native = getNativeBridge();
1289
+ if (!native?.tw_merge_with_separator)
1290
+ throw new Error("tw_merge_with_separator not available");
1291
+ const opts = {
1292
+ separator: options.separator,
1293
+ debug: options.debug
1294
+ };
1295
+ return native.tw_merge_with_separator(classString, opts);
1296
+ }
1297
+ function twMergeManyWithSeparator(classStrings, options) {
1298
+ const native = getNativeBridge();
1299
+ if (!native?.tw_merge_many_with_separator)
1300
+ throw new Error("tw_merge_many_with_separator not available");
1301
+ const opts = {
1302
+ separator: options.separator,
1303
+ debug: options.debug
1304
+ };
1305
+ return native.tw_merge_many_with_separator(classStrings, opts);
1306
+ }
1307
+ function twMergeRaw(classLists) {
1308
+ const native = getNativeBridge();
1309
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1310
+ return native.tw_merge_raw(classLists);
1311
+ }
1312
+ var init_cssCompilationNative = __esm({
1313
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1314
+ init_nativeBridge();
1315
+ }
1316
+ });
1317
+
1318
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
1319
+ function idRegistryCreate() {
1320
+ const native = getNativeBridge();
1321
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1322
+ return native.id_registry_create();
1323
+ }
1324
+ function idRegistryGenerate(handle, name) {
1325
+ const native = getNativeBridge();
1326
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1327
+ return native.id_registry_generate(handle, name);
1328
+ }
1329
+ function idRegistryLookup(handle, name) {
1330
+ const native = getNativeBridge();
1331
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1332
+ return native.id_registry_lookup(handle, name);
1333
+ }
1334
+ function idRegistryNext(handle) {
1335
+ const native = getNativeBridge();
1336
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1337
+ return native.id_registry_next(handle);
1338
+ }
1339
+ function idRegistryDestroy(handle) {
1340
+ const native = getNativeBridge();
1341
+ if (!native?.id_registry_destroy) return;
1342
+ native.id_registry_destroy(handle);
1343
+ }
1344
+ function idRegistryReset(handle) {
1345
+ const native = getNativeBridge();
1346
+ if (!native?.id_registry_reset) return;
1347
+ native.id_registry_reset(handle);
1348
+ }
1349
+ function idRegistrySnapshot(handle) {
1350
+ const native = getNativeBridge();
1351
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1352
+ const snapshotJson = native.id_registry_snapshot(handle);
1353
+ try {
1354
+ return JSON.parse(snapshotJson);
1355
+ } catch {
1356
+ return {
1357
+ handle,
1358
+ next_id: 0,
1359
+ entries: [],
1360
+ total_entries: 0
1361
+ };
1362
+ }
1363
+ }
1364
+ function idRegistryActiveCount() {
1365
+ const native = getNativeBridge();
1366
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1367
+ return native.id_registry_active_count();
1368
+ }
1369
+ function registerPropertyName(propertyName) {
1370
+ const native = getNativeBridge();
1371
+ if (!native?.register_property_name)
1372
+ throw new Error("register_property_name not available");
1373
+ return native.register_property_name(propertyName);
1374
+ }
1375
+ function registerValueName(valueName) {
1376
+ const native = getNativeBridge();
1377
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
1378
+ return native.register_value_name(valueName);
1379
+ }
1380
+ function propertyIdToString(propertyId) {
1381
+ const native = getNativeBridge();
1382
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1383
+ return native.property_id_to_string(propertyId);
1384
+ }
1385
+ function valueIdToString(valueId) {
1386
+ const native = getNativeBridge();
1387
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1388
+ return native.value_id_to_string(valueId);
1389
+ }
1390
+ function reverseLookupProperty(propertyId) {
1391
+ const native = getNativeBridge();
1392
+ if (!native?.reverse_lookup_property)
1393
+ throw new Error("reverse_lookup_property not available");
1394
+ return native.reverse_lookup_property(propertyId);
1395
+ }
1396
+ function reverseLookupValue(valueId) {
1397
+ const native = getNativeBridge();
1398
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1399
+ return native.reverse_lookup_value(valueId);
1400
+ }
1401
+ function idRegistryExport(handle) {
1402
+ const native = getNativeBridge();
1403
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1404
+ return native.id_registry_export(handle);
1405
+ }
1406
+ function idRegistryImport(importedData) {
1407
+ const native = getNativeBridge();
1408
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1409
+ return native.id_registry_import(importedData);
1410
+ }
1411
+ var init_idRegistryNative = __esm({
1412
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1413
+ init_nativeBridge();
1414
+ }
1415
+ });
1416
+
1417
+ // packages/domain/compiler/src/compiler/streamingNative.ts
1418
+ function processFileChange(fileChangeJson) {
1419
+ const native = getNativeBridge();
1420
+ if (!native?.process_file_change) throw new Error("process_file_change not available");
1421
+ const resultJson = native.process_file_change(fileChangeJson);
1422
+ try {
1423
+ return JSON.parse(resultJson);
1424
+ } catch {
1425
+ return {
1426
+ file_path: "",
1427
+ status: "error",
1428
+ old_classes: [],
1429
+ new_classes: [],
1430
+ added_classes: [],
1431
+ removed_classes: [],
1432
+ changed: false,
1433
+ fingerprint: "",
1434
+ error: "Failed to parse result"
1435
+ };
1436
+ }
1437
+ }
1438
+ function computeIncrementalDiff(oldScanJson, newScanJson) {
1439
+ const native = getNativeBridge();
1440
+ if (!native?.compute_incremental_diff)
1441
+ throw new Error("compute_incremental_diff not available");
1442
+ const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
1443
+ try {
1444
+ return JSON.parse(resultJson);
1445
+ } catch {
1446
+ return {
1447
+ is_changed: false,
1448
+ changes_count: 0,
1449
+ diff: {
1450
+ added_files: [],
1451
+ removed_files: [],
1452
+ modified_files: [],
1453
+ added_classes: [],
1454
+ removed_classes: [],
1455
+ total_changes: 0
1456
+ },
1457
+ processing_time_ms: 0
1458
+ };
1459
+ }
1460
+ }
1461
+ function createFingerprint(filePath, fileContent) {
1462
+ const native = getNativeBridge();
1463
+ if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
1464
+ const fingerprintJson = native.create_fingerprint(filePath, fileContent);
1465
+ try {
1466
+ return JSON.parse(fingerprintJson);
1467
+ } catch {
1468
+ return {
1469
+ file_path: filePath,
1470
+ content_hash: "",
1471
+ size_bytes: fileContent.length,
1472
+ mtime_ms: Date.now(),
1473
+ class_hash: "",
1474
+ signature: ""
1475
+ };
1476
+ }
1477
+ }
1478
+ function injectStateHash(css, stateHash) {
1479
+ const native = getNativeBridge();
1480
+ if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
1481
+ const resultJson = native.inject_state_hash(css, stateHash);
1482
+ try {
1483
+ return JSON.parse(resultJson);
1484
+ } catch {
1485
+ return {
1486
+ injected: false,
1487
+ state_hash: stateHash,
1488
+ affected_files: 0,
1489
+ total_injected_bytes: 0
1490
+ };
1491
+ }
1492
+ }
1493
+ function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
1494
+ const native = getNativeBridge();
1495
+ if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
1496
+ const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
1497
+ try {
1498
+ return JSON.parse(resultJson);
1499
+ } catch {
1500
+ return {
1501
+ entries_before: 0,
1502
+ entries_after: 0,
1503
+ entries_removed: 0,
1504
+ freed_bytes: 0
1505
+ };
1506
+ }
1507
+ }
1508
+ function rebuildWorkspaceResult(rootDir, extensions) {
1509
+ const native = getNativeBridge();
1510
+ if (!native?.rebuild_workspace_result)
1511
+ throw new Error("rebuild_workspace_result not available");
1512
+ const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
1513
+ try {
1514
+ return JSON.parse(resultJson);
1515
+ } catch {
1516
+ return {
1517
+ total_files_scanned: 0,
1518
+ total_classes_found: 0,
1519
+ unique_classes: 0,
1520
+ build_time_ms: 0,
1521
+ files_with_changes: 0
1522
+ };
1523
+ }
1524
+ }
1525
+ function scanFileNative(filePath, fileContent) {
1526
+ const native = getNativeBridge();
1527
+ if (!native?.scan_file_native) throw new Error("scan_file_native not available");
1528
+ const resultJson = native.scan_file_native(filePath, fileContent);
1529
+ try {
1530
+ return JSON.parse(resultJson);
1531
+ } catch {
1532
+ return {
1533
+ file: filePath,
1534
+ classes: [],
1535
+ added_classes: [],
1536
+ removed_classes: [],
1537
+ changed: false
1538
+ };
1539
+ }
1540
+ }
1541
+ function scanFilesBatchNative(filesJson) {
1542
+ const native = getNativeBridge();
1543
+ if (!native?.scan_files_batch_native)
1544
+ throw new Error("scan_files_batch_native not available");
1545
+ const resultJson = native.scan_files_batch_native(filesJson);
1546
+ try {
1547
+ return JSON.parse(resultJson);
1548
+ } catch {
1549
+ return [];
1550
+ }
1551
+ }
1552
+ var init_streamingNative = __esm({
1553
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1554
+ init_nativeBridge();
1555
+ }
1556
+ });
1557
+
1558
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
1559
+ var tailwindEngine_exports = {};
1560
+ __export(tailwindEngine_exports, {
1561
+ clearCache: () => clearCache,
1562
+ getCacheStats: () => getCacheStats,
1563
+ processTailwindCssWithTargets: () => processTailwindCssWithTargets,
1564
+ runCssPipeline: () => runCssPipeline,
1565
+ runCssPipelineSync: () => runCssPipelineSync
1566
+ });
1567
+ function _getCacheKey(classes, minify, cssEntry, root) {
1568
+ const sorted = [...classes].sort().join(",");
1569
+ const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
1570
+ return `${sorted}|${flags}`;
1571
+ }
1572
+ function _evictOldestIfNeeded() {
1573
+ if (_cssCache.size >= MAX_CACHE_SIZE) {
1574
+ const firstKey = _cssCache.keys().next().value;
1575
+ if (firstKey !== void 0) {
1576
+ _cssCache.delete(firstKey);
1577
+ }
1578
+ }
1579
+ }
1580
+ function getCacheStats() {
1581
+ const total = _cacheHits + _cacheMisses;
1582
+ return {
1583
+ hits: _cacheHits,
1584
+ misses: _cacheMisses,
1585
+ hitRate: total > 0 ? _cacheHits / total : 0,
1586
+ size: _cssCache.size,
1587
+ maxSize: MAX_CACHE_SIZE
1588
+ };
1589
+ }
1590
+ function clearCache() {
1591
+ _cssCache.clear();
1592
+ _cacheHits = 0;
1593
+ _cacheMisses = 0;
1594
+ }
1595
+ function getThemeConfig() {
1596
+ return {
1597
+ colors: {
1598
+ slate: {
1599
+ "50": "#f8fafc",
1600
+ "100": "#f1f5f9",
1601
+ "200": "#e2e8f0",
1602
+ "300": "#cbd5e1",
1603
+ "400": "#94a3b8",
1604
+ "500": "#64748b",
1605
+ "600": "#475569",
1606
+ "700": "#334155",
1607
+ "800": "#1e293b",
1608
+ "900": "#0f172a"
1609
+ },
1610
+ gray: {
1611
+ "50": "#f9fafb",
1612
+ "100": "#f3f4f6",
1613
+ "200": "#e5e7eb",
1614
+ "300": "#d1d5db",
1615
+ "400": "#9ca3af",
1616
+ "500": "#6b7280",
1617
+ "600": "#4b5563",
1618
+ "700": "#374151",
1619
+ "800": "#1f2937",
1620
+ "900": "#111827"
1621
+ },
1622
+ white: "#ffffff",
1623
+ black: "#000000",
1624
+ red: {
1625
+ "500": "#ef4444",
1626
+ "600": "#dc2626"
1627
+ },
1628
+ blue: {
1629
+ "500": "#3b82f6",
1630
+ "600": "#1e40af"
1631
+ }
1632
+ },
1633
+ spacing: {
1634
+ "0": "0px",
1635
+ "1": "0.25rem",
1636
+ "2": "0.5rem",
1637
+ "3": "0.75rem",
1638
+ "4": "1rem",
1639
+ "5": "1.25rem",
1640
+ "6": "1.5rem",
1641
+ "8": "2rem",
1642
+ "10": "2.5rem",
1643
+ "12": "3rem",
1644
+ "16": "4rem",
1645
+ "20": "5rem",
1646
+ "24": "6rem"
1647
+ },
1648
+ breakpoints: {
1649
+ "sm": "640px",
1650
+ "md": "768px",
1651
+ "lg": "1024px",
1652
+ "xl": "1280px",
1653
+ "2xl": "1536px"
1654
+ }
1655
+ };
1656
+ }
1657
+ function postProcessWithLightning(rawCss) {
1658
+ if (!rawCss) return "";
1659
+ const native = getNativeBridge();
1660
+ if (!native?.processTailwindCssLightning) {
1661
+ throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
1662
+ }
1663
+ const result = native.processTailwindCssLightning(rawCss);
1664
+ if (!result?.css) {
1665
+ throw new Error("FATAL: processTailwindCssLightning returned null");
1666
+ }
1667
+ return result.css;
1668
+ }
1669
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1670
+ const filtered = classes.filter(Boolean);
1671
+ const uniqueMap = /* @__PURE__ */ new Map();
1672
+ filtered.forEach((cls) => uniqueMap.set(cls, cls));
1673
+ const unique = Array.from(uniqueMap.values());
1674
+ if (unique.length === 0) {
1675
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1676
+ }
1677
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
1678
+ const cached = _cssCache.get(cacheKey);
1679
+ if (cached) {
1680
+ _cacheHits++;
1681
+ if (process.env.DEBUG?.includes("compiler")) {
1682
+ console.log(
1683
+ `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
1684
+ );
1685
+ }
1686
+ return cached;
1687
+ }
1688
+ _cacheMisses++;
1689
+ let rawCss;
1690
+ let usedRustCompiler = false;
1691
+ const theme = getThemeConfig();
1692
+ rawCss = await generateCssNative(unique, { theme });
1693
+ usedRustCompiler = true;
1694
+ const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1695
+ if (process.env.DEBUG?.includes("compiler")) {
1696
+ console.log(
1697
+ `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
1698
+ `Size: ${finalCss.length} bytes`
1699
+ );
1700
+ }
1701
+ const result = {
1702
+ css: finalCss,
1703
+ classes: unique,
1704
+ sizeBytes: finalCss.length,
1705
+ optimized: minify
1706
+ };
1707
+ _evictOldestIfNeeded();
1708
+ _cssCache.set(cacheKey, result);
1709
+ return result;
1710
+ }
1711
+ function runCssPipelineSync(_classes) {
1712
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
1713
+ }
1714
+ function processTailwindCssWithTargets(css, targets) {
1715
+ const native = getNativeBridge();
1716
+ if (!native?.processTailwindCssWithTargets) {
1717
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
1718
+ }
1719
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
1720
+ if (!result?.css) {
1721
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
1722
+ }
1723
+ return result.css;
1724
+ }
1725
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1726
+ var init_tailwindEngine = __esm({
1727
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1728
+ init_nativeBridge();
1729
+ init_cssGeneratorNative();
1730
+ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
1731
+ _cssCache = /* @__PURE__ */ new Map();
1732
+ _cacheHits = 0;
1733
+ _cacheMisses = 0;
1734
+ MAX_CACHE_SIZE = 100;
1735
+ }
1736
+ });
1737
+
1738
+ // packages/domain/compiler/src/compiler/index.ts
1739
+ var init_compiler = __esm({
1740
+ "packages/domain/compiler/src/compiler/index.ts"() {
1741
+ init_cssGeneratorNative();
1742
+ init_compilationNative();
1743
+ init_cssCompilationNative();
1744
+ init_idRegistryNative();
1745
+ init_streamingNative();
1746
+ }
1747
+ });
1748
+
1749
+ // packages/domain/compiler/src/parser/index.ts
1750
+ var parser_exports = {};
1751
+ __export(parser_exports, {
1752
+ astExtractClasses: () => astExtractClasses,
1753
+ batchExtractClasses: () => batchExtractClasses,
1754
+ checkAgainstSafelist: () => checkAgainstSafelist,
1755
+ diffClassLists: () => diffClassLists,
1756
+ extractAllClasses: () => extractAllClasses,
1757
+ extractClassesFromSource: () => extractClassesFromSource,
1758
+ extractComponentUsage: () => extractComponentUsage,
1759
+ mergeClassesStatic: () => mergeClassesStatic,
1760
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1761
+ normalizeClasses: () => normalizeClasses,
1762
+ parseClasses: () => parseClasses
1763
+ });
1764
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1765
+ var init_parser = __esm({
1766
+ "packages/domain/compiler/src/parser/index.ts"() {
1767
+ init_nativeBridge();
1768
+ parseClasses = (raw) => {
1769
+ const native = getNativeBridge();
1770
+ if (!native?.parseClasses) {
1771
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1772
+ }
1773
+ return native.parseClasses(raw) || [];
1774
+ };
1775
+ extractAllClasses = (source) => {
1776
+ const native = getNativeBridge();
1777
+ if (!native?.extractAllClasses) {
1778
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1779
+ }
1780
+ return native.extractAllClasses(source) || [];
1781
+ };
1782
+ extractClassesFromSource = (source) => {
1783
+ const native = getNativeBridge();
1784
+ if (!native?.extractClassesFromSource) {
1785
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1786
+ }
1787
+ const result = native.extractClassesFromSource(source);
1788
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
1789
+ };
1790
+ astExtractClasses = (source, _filename) => {
1791
+ const native = getNativeBridge();
1792
+ if (!native?.extractClassesFromSource) {
1793
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1794
+ }
1795
+ return native.extractClassesFromSource(source) || [];
1796
+ };
1797
+ normalizeClasses = (raw) => {
1798
+ const result = normalizeAndDedupClasses(raw);
1799
+ return result?.normalized || "";
1800
+ };
1801
+ mergeClassesStatic = (classes) => {
1802
+ const result = normalizeAndDedupClasses(classes);
1803
+ return result?.normalized || "";
1804
+ };
1805
+ normalizeAndDedupClasses = (raw) => {
1806
+ const native = getNativeBridge();
1807
+ if (!native?.normalizeAndDedupClasses) {
1808
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1809
+ }
1810
+ const result = native.normalizeAndDedupClasses(raw);
1811
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1812
+ };
1813
+ extractComponentUsage = (source) => {
1814
+ const native = getNativeBridge();
1815
+ if (!native?.extractComponentUsage) {
1816
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1817
+ }
1818
+ return native.extractComponentUsage(source) || [];
1819
+ };
1820
+ batchExtractClasses = (filePaths) => {
1821
+ const native = getNativeBridge();
1822
+ if (!native?.batchExtractClasses) {
1823
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1824
+ }
1825
+ return native.batchExtractClasses(filePaths) || [];
1826
+ };
1827
+ checkAgainstSafelist = (classes, safelist) => {
1828
+ const native = getNativeBridge();
1829
+ if (!native?.checkAgainstSafelist) {
1830
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1831
+ }
1832
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1833
+ };
1834
+ diffClassLists = (previous, current) => {
1835
+ const native = getNativeBridge();
1836
+ if (!native?.diffClassLists) {
1837
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1838
+ }
1839
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1840
+ };
1841
+ }
1842
+ });
1843
+
1844
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
1845
+ function detectDeadCode(scanResultJson, css) {
1846
+ const native = getNativeBridge();
1847
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1848
+ return native.detectDeadCode(scanResultJson, css);
1849
+ }
1850
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1851
+ const native = getNativeBridge();
1852
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1853
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1854
+ }
1855
+ function analyzeClassesNative(filesJson, cwd, flags) {
1856
+ const native = getNativeBridge();
1857
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1858
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1859
+ }
1860
+ function analyzeRscNative(source, filename) {
1861
+ const native = getNativeBridge();
1862
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1863
+ return native.analyzeRsc(source, filename);
1864
+ }
1865
+ function optimizeCssNative(css) {
1866
+ const native = getNativeBridge();
1867
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1868
+ const result = native.processTailwindCssLightning(css);
1869
+ return {
1870
+ css: result.css,
1871
+ originalSize: css.length,
1872
+ optimizedSize: result.size_bytes,
1873
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1874
+ };
1875
+ }
1876
+ function processTailwindCssLightning(css) {
1877
+ const native = getNativeBridge();
1878
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1879
+ return native.processTailwindCssLightning(css);
1880
+ }
1881
+ function eliminateDeadCssNative(css, deadClasses) {
1882
+ const native = getNativeBridge();
1883
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1884
+ return native.eliminateDeadCss(css, deadClasses);
1885
+ }
1886
+ function hoistComponentsNative(source) {
1887
+ const native = getNativeBridge();
1888
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1889
+ return native.hoistComponents(source);
1890
+ }
1891
+ function compileVariantTableNative(configJson) {
1892
+ const native = getNativeBridge();
1893
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1894
+ return native.compileVariantTable(configJson);
1895
+ }
1896
+ function classifyAndSortClassesNative(classes) {
1897
+ const native = getNativeBridge();
1898
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1899
+ return native.classifyAndSortClasses(classes);
1900
+ }
1901
+ function mergeCssDeclarationsNative(cssChunks) {
1902
+ const native = getNativeBridge();
1903
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1904
+ return native.mergeCssDeclarations(cssChunks);
1905
+ }
1906
+ var init_analyzerNative = __esm({
1907
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1908
+ init_nativeBridge();
1909
+ }
1910
+ });
1911
+
1912
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1913
+ function resolveVariants(configJson) {
1914
+ const native = getNativeBridge();
1915
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1916
+ const resultJson = native.resolve_variants(configJson);
1917
+ try {
1918
+ return JSON.parse(resultJson);
1919
+ } catch {
1920
+ return {
1921
+ variants: [],
1922
+ supported: [],
1923
+ deprecated: [],
1924
+ conflicting: []
1925
+ };
1926
+ }
1927
+ }
1928
+ function validateThemeConfig(configJson) {
1929
+ const native = getNativeBridge();
1930
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1931
+ const resultJson = native.validate_variant_config(configJson);
1932
+ try {
1933
+ return JSON.parse(resultJson);
1934
+ } catch {
1935
+ return {
1936
+ is_valid: false,
1937
+ errors: ["Unable to parse configuration"],
1938
+ warnings: [],
1939
+ suggestions: []
1940
+ };
1941
+ }
1942
+ }
1943
+ function resolveCascade(baseThemeJson, overridesJson) {
1944
+ const native = getNativeBridge();
1945
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1946
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1947
+ try {
1948
+ return JSON.parse(resultJson);
1949
+ } catch {
1950
+ return {
1951
+ base_theme: {},
1952
+ user_overrides: {},
1953
+ merged_theme: {},
1954
+ conflict_resolutions: []
1955
+ };
1956
+ }
1957
+ }
1958
+ function resolveClassNames(classNames, themeJson) {
1959
+ const native = getNativeBridge();
1960
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1961
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1962
+ try {
1963
+ return JSON.parse(resultJson);
1964
+ } catch {
1965
+ return [];
1966
+ }
1967
+ }
1968
+ function resolveConflictGroup(groupName, themeJson) {
1969
+ const native = getNativeBridge();
1970
+ if (!native?.resolve_conflict_group)
1971
+ throw new Error("resolve_conflict_group not available");
1972
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1973
+ try {
1974
+ return JSON.parse(resultJson);
1975
+ } catch {
1976
+ return {
1977
+ group_name: groupName,
1978
+ conflicting_classes: [],
1979
+ description: "",
1980
+ resolution_strategy: "last-wins"
1981
+ };
1982
+ }
1983
+ }
1984
+ function resolveThemeValue(keyPath, themeJson) {
1985
+ const native = getNativeBridge();
1986
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1987
+ return native.resolve_theme_value(keyPath, themeJson);
1988
+ }
1989
+ function resolveSimpleVariants(configJson) {
1990
+ const native = getNativeBridge();
1991
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1992
+ const resultJson = native.resolve_simple_variants(configJson);
1993
+ try {
1994
+ return JSON.parse(resultJson);
1995
+ } catch {
1996
+ return [];
1997
+ }
1998
+ }
1999
+ var init_themeResolutionNative = __esm({
2000
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2001
+ init_nativeBridge();
2002
+ }
2003
+ });
2004
+
2005
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
2006
+ function scanWorkspace(root, extensions) {
2007
+ const native = getNativeBridge();
2008
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
2009
+ return native.scan_workspace(root, extensions);
2010
+ }
2011
+ function extractClassesFromSourceNative(source) {
2012
+ const native = getNativeBridge();
2013
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
2014
+ return native.extract_classes_from_source(source);
2015
+ }
2016
+ function batchExtractClassesNative(filePaths) {
2017
+ const native = getNativeBridge();
2018
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
2019
+ return native.batch_extract_classes(filePaths);
2020
+ }
2021
+ function checkAgainstSafelistNative(classes, safelist) {
2022
+ const native = getNativeBridge();
2023
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
2024
+ return native.check_against_safelist(classes, safelist);
2025
+ }
2026
+ function scanFile(filePath) {
2027
+ const native = getNativeBridge();
2028
+ if (!native?.scan_file) throw new Error("scan_file not available");
2029
+ return native.scan_file(filePath);
2030
+ }
2031
+ function collectFiles(root, extensions) {
2032
+ const native = getNativeBridge();
2033
+ if (!native?.collect_files) throw new Error("collect_files not available");
2034
+ return native.collect_files(root, extensions);
2035
+ }
2036
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
2037
+ const native = getNativeBridge();
2038
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
2039
+ return native.walk_and_prefilter_source_files(root, extensions);
2040
+ }
2041
+ function generateSubComponentTypes(root, outputPath) {
2042
+ const native = getNativeBridge();
2043
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
2044
+ return native.generate_sub_component_types(root, outputPath);
2045
+ }
2046
+ var init_scannerNative = __esm({
2047
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2048
+ init_nativeBridge();
2049
+ }
2050
+ });
2051
+
2052
+ // packages/domain/compiler/src/analyzer/index.ts
2053
+ var init_analyzer = __esm({
2054
+ "packages/domain/compiler/src/analyzer/index.ts"() {
2055
+ init_analyzerNative();
2056
+ init_themeResolutionNative();
2057
+ init_scannerNative();
2058
+ }
2059
+ });
2060
+
2061
+ // packages/domain/compiler/src/cache/cacheNative.ts
2062
+ function getCacheStatistics() {
2063
+ const native = getNativeBridge();
2064
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
2065
+ const statsJson = native.get_cache_statistics();
2066
+ try {
2067
+ return JSON.parse(statsJson);
2068
+ } catch {
2069
+ return {
2070
+ parse_cache: { hits: 0, misses: 0, size: 0 },
2071
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
2072
+ compile_cache: { hits: 0, misses: 0, size: 0 },
2073
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
2074
+ overall_hit_rate: 0,
2075
+ total_memory_bytes: 0
2076
+ };
2077
+ }
2078
+ }
2079
+ function clearAllCaches() {
2080
+ const native = getNativeBridge();
2081
+ if (!native?.clear_all_caches) return;
2082
+ try {
2083
+ native.clear_all_caches();
2084
+ } catch {
2085
+ }
2086
+ }
2087
+ function clearParseCache() {
2088
+ const native = getNativeBridge();
2089
+ if (!native?.clear_parse_cache) return;
2090
+ try {
2091
+ native.clear_parse_cache();
2092
+ } catch {
2093
+ }
2094
+ }
2095
+ function clearResolveCache() {
2096
+ const native = getNativeBridge();
2097
+ if (!native?.clear_resolve_cache) return;
2098
+ try {
2099
+ native.clear_resolve_cache();
2100
+ } catch {
2101
+ }
2102
+ }
2103
+ function clearCompileCache() {
2104
+ const native = getNativeBridge();
2105
+ if (!native?.clear_compile_cache) return;
2106
+ try {
2107
+ native.clear_compile_cache();
2108
+ } catch {
2109
+ }
2110
+ }
2111
+ function clearCssGenCache() {
2112
+ const native = getNativeBridge();
2113
+ if (!native?.clear_css_gen_cache) return;
2114
+ try {
2115
+ native.clear_css_gen_cache();
2116
+ } catch {
2117
+ }
2118
+ }
2119
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
2120
+ const native = getNativeBridge();
2121
+ if (!native?.get_cache_optimization_hints)
2122
+ throw new Error("get_cache_optimization_hints not available");
2123
+ const hintsJson = native.get_cache_optimization_hints(
2124
+ Math.min(100, Math.max(0, hitRatePercent)),
2125
+ Math.max(1, memoryUsedMb)
2126
+ );
2127
+ try {
2128
+ return JSON.parse(hintsJson);
2129
+ } catch {
2130
+ return {
2131
+ current_strategy: "unknown",
2132
+ recommended_strategy: "increase_size",
2133
+ estimated_improvement_percent: 0,
2134
+ suggested_memory_mb: 256,
2135
+ notes: ["Unable to analyze cache statistics"]
2136
+ };
2137
+ }
2138
+ }
2139
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
2140
+ const native = getNativeBridge();
2141
+ if (!native?.estimate_optimal_cache_config_native)
2142
+ throw new Error("estimate_optimal_cache_config_native not available");
2143
+ const configJson = native.estimate_optimal_cache_config_native(
2144
+ Math.max(64, totalBudgetMb),
2145
+ workloadType
2146
+ );
2147
+ try {
2148
+ return JSON.parse(configJson);
2149
+ } catch {
2150
+ return {
2151
+ parse_cache_size: 128,
2152
+ resolve_cache_size: 64,
2153
+ compile_cache_size: 256,
2154
+ css_gen_cache_size: 128,
2155
+ recommended_eviction_policy: "lru",
2156
+ ttl_seconds: 3600,
2157
+ expected_hit_rate_percent: 75
2158
+ };
2159
+ }
2160
+ }
2161
+ function cacheRead(cachePath) {
2162
+ const native = getNativeBridge();
2163
+ if (!native?.cache_read) throw new Error("cache_read not available");
2164
+ const result = native.cache_read(cachePath);
2165
+ try {
2166
+ return JSON.parse(result.entries_json || "[]");
2167
+ } catch {
2168
+ return [];
2169
+ }
2170
+ }
2171
+ function cacheWrite(cachePath, entries) {
2172
+ const native = getNativeBridge();
2173
+ if (!native?.cache_write) throw new Error("cache_write not available");
2174
+ try {
2175
+ const result = native.cache_write(
2176
+ cachePath,
2177
+ entries.map((e) => ({
2178
+ file: e.file,
2179
+ content_hash: e.contentHash,
2180
+ classes: e.classes,
2181
+ mtime_ms: e.mtimeMs,
2182
+ size_bytes: e.sizeBytes
2183
+ }))
2184
+ );
2185
+ return typeof result === "boolean" ? result : result === true;
2186
+ } catch {
2187
+ return false;
2188
+ }
2189
+ }
2190
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2191
+ const native = getNativeBridge();
2192
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
2193
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2194
+ }
2195
+ var init_cacheNative = __esm({
2196
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
2197
+ init_nativeBridge();
2198
+ }
2199
+ });
2200
+
2201
+ // packages/domain/compiler/src/cache/index.ts
2202
+ var init_cache = __esm({
2203
+ "packages/domain/compiler/src/cache/index.ts"() {
2204
+ init_cacheNative();
2205
+ }
2206
+ });
2207
+
2208
+ // packages/domain/compiler/src/redis/redisNative.ts
2209
+ function redisPing() {
2210
+ const native = getNativeBridge();
2211
+ if (!native?.redis_ping) throw new Error("redis_ping not available");
2212
+ return native.redis_ping();
2213
+ }
2214
+ function redisGet(key) {
2215
+ const native = getNativeBridge();
2216
+ if (!native?.redis_get) throw new Error("redis_get not available");
2217
+ const result = native.redis_get(key);
2218
+ return result === "nil" ? null : result;
2219
+ }
2220
+ function redisSet(key, value, ttl_seconds) {
2221
+ const native = getNativeBridge();
2222
+ if (!native?.redis_set) throw new Error("redis_set not available");
2223
+ return native.redis_set(key, value, ttl_seconds);
2224
+ }
2225
+ function redisDelete(key) {
2226
+ const native = getNativeBridge();
2227
+ if (!native?.redis_delete) throw new Error("redis_delete not available");
2228
+ return native.redis_delete(key);
2229
+ }
2230
+ function redisExists(key) {
2231
+ const native = getNativeBridge();
2232
+ if (!native?.redis_exists) throw new Error("redis_exists not available");
2233
+ return native.redis_exists(key);
2234
+ }
2235
+ function redisMget(keys) {
2236
+ const native = getNativeBridge();
2237
+ if (!native?.redis_mget) throw new Error("redis_mget not available");
2238
+ const result = native.redis_mget(keys);
2239
+ try {
2240
+ return JSON.parse(result);
2241
+ } catch {
2242
+ return keys.map(() => null);
2243
+ }
2244
+ }
2245
+ function redisMset(pairs) {
2246
+ const native = getNativeBridge();
2247
+ if (!native?.redis_mset) throw new Error("redis_mset not available");
2248
+ return native.redis_mset(pairs);
2249
+ }
2250
+ function redisFlushDb() {
2251
+ const native = getNativeBridge();
2252
+ if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
2253
+ return native.redis_flush_db();
2254
+ }
2255
+ function redisFlushAll() {
2256
+ const native = getNativeBridge();
2257
+ if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
2258
+ return native.redis_flush_all();
2259
+ }
2260
+ function redisPoolConnect(host, port, pool_size) {
2261
+ const native = getNativeBridge();
2262
+ if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
2263
+ return native.redis_pool_connect(host, port, pool_size);
2264
+ }
2265
+ function redisPoolStats() {
2266
+ const native = getNativeBridge();
2267
+ if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
2268
+ const result = native.redis_pool_stats();
2269
+ try {
2270
+ return JSON.parse(result);
2271
+ } catch {
2272
+ return {
2273
+ connected_count: 0,
2274
+ idle_count: 0,
2275
+ waiting_count: 0,
2276
+ total_requests: 0,
2277
+ total_errors: 0
2278
+ };
2279
+ }
2280
+ }
2281
+ function redisPoolReconnect() {
2282
+ const native = getNativeBridge();
2283
+ if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
2284
+ return native.redis_pool_reconnect();
2285
+ }
2286
+ function redisEnableCluster(initial_nodes) {
2287
+ const native = getNativeBridge();
2288
+ if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
2289
+ const result = native.redis_enable_cluster(initial_nodes);
2290
+ try {
2291
+ return JSON.parse(result);
2292
+ } catch {
2293
+ return {
2294
+ enabled: false,
2295
+ cluster_state: "error",
2296
+ nodes: [],
2297
+ slots_assigned: 0,
2298
+ slots_ok: 0,
2299
+ slots_fail: 0
2300
+ };
2301
+ }
2302
+ }
2303
+ function redisDisableCluster() {
2304
+ const native = getNativeBridge();
2305
+ if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
2306
+ return native.redis_disable_cluster();
2307
+ }
2308
+ function redisClusterStatus() {
2309
+ const native = getNativeBridge();
2310
+ if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
2311
+ const result = native.redis_cluster_status();
2312
+ try {
2313
+ return JSON.parse(result);
2314
+ } catch {
2315
+ return {
2316
+ enabled: false,
2317
+ cluster_state: "unknown",
2318
+ nodes: [],
2319
+ slots_assigned: 0,
2320
+ slots_ok: 0,
2321
+ slots_fail: 0
2322
+ };
2323
+ }
2324
+ }
2325
+ function redisSubscribe(channel) {
2326
+ const native = getNativeBridge();
2327
+ if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
2328
+ return native.redis_subscribe(channel);
2329
+ }
2330
+ function redisPublish(channel, message) {
2331
+ const native = getNativeBridge();
2332
+ if (!native?.redis_publish) throw new Error("redis_publish not available");
2333
+ return native.redis_publish(channel, message);
2334
+ }
2335
+ function redisExpirationSet(key, ttl_seconds) {
2336
+ const native = getNativeBridge();
2337
+ if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
2338
+ return native.redis_expiration_set(key, ttl_seconds);
2339
+ }
2340
+ function redisExpirationGet(key) {
2341
+ const native = getNativeBridge();
2342
+ if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
2343
+ const result = native.redis_expiration_get(key);
2344
+ try {
2345
+ return JSON.parse(result);
2346
+ } catch {
2347
+ return {
2348
+ key,
2349
+ ttl_seconds: -1,
2350
+ expiration_timestamp: 0,
2351
+ is_persistent: true
2352
+ };
2353
+ }
2354
+ }
2355
+ function redisInfo() {
2356
+ const native = getNativeBridge();
2357
+ if (!native?.redis_info) throw new Error("redis_info not available");
2358
+ return native.redis_info();
2359
+ }
2360
+ function redisMonitor() {
2361
+ const native = getNativeBridge();
2362
+ if (!native?.redis_monitor) throw new Error("redis_monitor not available");
2363
+ return native.redis_monitor();
2364
+ }
2365
+ function redisCacheSize() {
2366
+ const native = getNativeBridge();
2367
+ if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
2368
+ return native.redis_cache_size();
2369
+ }
2370
+ function redisCacheKeyCount() {
2371
+ const native = getNativeBridge();
2372
+ if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
2373
+ return native.redis_cache_key_count();
2374
+ }
2375
+ function redisCacheClear() {
2376
+ const native = getNativeBridge();
2377
+ if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
2378
+ return native.redis_cache_clear();
2379
+ }
2380
+ function redisCacheHitRate() {
2381
+ const native = getNativeBridge();
2382
+ if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
2383
+ return native.redis_cache_hit_rate();
2384
+ }
2385
+ function redisEnablePersistence(mode) {
2386
+ const native = getNativeBridge();
2387
+ if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
2388
+ return native.redis_enable_persistence(mode);
2389
+ }
2390
+ function redisDisablePersistence() {
2391
+ const native = getNativeBridge();
2392
+ if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
2393
+ return native.redis_disable_persistence();
2394
+ }
2395
+ function redisSnapshot() {
2396
+ const native = getNativeBridge();
2397
+ if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
2398
+ return native.redis_snapshot();
2399
+ }
2400
+ function redisMemoryStats() {
2401
+ const native = getNativeBridge();
2402
+ if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
2403
+ return native.redis_memory_stats();
2404
+ }
2405
+ function redisOptimizeMemory() {
2406
+ const native = getNativeBridge();
2407
+ if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
2408
+ return native.redis_optimize_memory();
2409
+ }
2410
+ function redisSetEvictionPolicy(policy) {
2411
+ const native = getNativeBridge();
2412
+ if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
2413
+ return native.redis_set_eviction_policy(policy);
2414
+ }
2415
+ function redisGetEvictionPolicy() {
2416
+ const native = getNativeBridge();
2417
+ if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
2418
+ return native.redis_get_eviction_policy();
2419
+ }
2420
+ function redisReplicate(target_host, target_port) {
2421
+ const native = getNativeBridge();
2422
+ if (!native?.redis_replicate) throw new Error("redis_replicate not available");
2423
+ return native.redis_replicate(target_host, target_port);
2424
+ }
2425
+ function redisReplicationStatus() {
2426
+ const native = getNativeBridge();
2427
+ if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
2428
+ return native.redis_replication_status();
2429
+ }
2430
+ function redisCacheSync(peers) {
2431
+ const native = getNativeBridge();
2432
+ if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
2433
+ return native.redis_cache_sync(peers);
2434
+ }
2435
+ function redisEnableCacheWarming(key_pattern) {
2436
+ const native = getNativeBridge();
2437
+ if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
2438
+ return native.redis_enable_cache_warming(key_pattern);
2439
+ }
2440
+ function redisDisableCacheWarming() {
2441
+ const native = getNativeBridge();
2442
+ if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
2443
+ return native.redis_disable_cache_warming();
2444
+ }
2445
+ function redisDiagnose() {
2446
+ const native = getNativeBridge();
2447
+ if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
2448
+ return native.redis_diagnose();
2449
+ }
2450
+ var init_redisNative = __esm({
2451
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
2452
+ init_nativeBridge();
2453
+ }
2454
+ });
2455
+
2456
+ // packages/domain/compiler/src/redis/index.ts
2457
+ var init_redis = __esm({
2458
+ "packages/domain/compiler/src/redis/index.ts"() {
2459
+ init_redisNative();
2460
+ }
2461
+ });
2462
+
2463
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
2464
+ function startWatch(root_path, patterns) {
2465
+ const native = getNativeBridge();
2466
+ if (!native?.start_watch) throw new Error("start_watch not available");
2467
+ return native.start_watch(root_path, patterns);
2468
+ }
2469
+ function pollWatchEvents(handle, timeout_ms) {
2470
+ const native = getNativeBridge();
2471
+ if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
2472
+ const result = native.poll_watch_events(handle, timeout_ms);
2473
+ try {
2474
+ return JSON.parse(result);
2475
+ } catch {
2476
+ return [];
2477
+ }
2478
+ }
2479
+ function stopWatch(handle) {
2480
+ const native = getNativeBridge();
2481
+ if (!native?.stop_watch) throw new Error("stop_watch not available");
2482
+ return native.stop_watch(handle);
2483
+ }
2484
+ function watchAddPattern(handle, pattern) {
2485
+ const native = getNativeBridge();
2486
+ if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
2487
+ return native.watch_add_pattern(handle, pattern);
2488
+ }
2489
+ function watchRemovePattern(handle, pattern) {
2490
+ const native = getNativeBridge();
2491
+ if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
2492
+ return native.watch_remove_pattern(handle, pattern);
2493
+ }
2494
+ function watchGetActiveHandles() {
2495
+ const native = getNativeBridge();
2496
+ if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
2497
+ const result = native.watch_get_active_handles();
2498
+ try {
2499
+ return JSON.parse(result);
2500
+ } catch {
2501
+ return [];
2502
+ }
2503
+ }
2504
+ function watchClearAll() {
2505
+ const native = getNativeBridge();
2506
+ if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
2507
+ return native.watch_clear_all();
2508
+ }
2509
+ function watchEventTypeToString(event_type_code) {
2510
+ const native = getNativeBridge();
2511
+ if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
2512
+ return native.watch_event_type_to_string(event_type_code);
2513
+ }
2514
+ function isWatchRunning(handle) {
2515
+ const native = getNativeBridge();
2516
+ if (!native?.is_watch_running) throw new Error("is_watch_running not available");
2517
+ return native.is_watch_running(handle);
2518
+ }
2519
+ function getWatchStats() {
2520
+ const native = getNativeBridge();
2521
+ if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
2522
+ const result = native.get_watch_stats();
2523
+ try {
2524
+ return JSON.parse(result);
2525
+ } catch {
2526
+ return {
2527
+ active_watchers: 0,
2528
+ total_events: 0,
2529
+ events_this_second: 0,
2530
+ average_latency_ms: 0,
2531
+ largest_batch_size: 0
2532
+ };
2533
+ }
2534
+ }
2535
+ function watchPause(handle) {
2536
+ const native = getNativeBridge();
2537
+ if (!native?.watch_pause) throw new Error("watch_pause not available");
2538
+ return native.watch_pause(handle);
2539
+ }
2540
+ function watchResume(handle) {
2541
+ const native = getNativeBridge();
2542
+ if (!native?.watch_resume) throw new Error("watch_resume not available");
2543
+ return native.watch_resume(handle);
2544
+ }
2545
+ function scanCacheOptimizations() {
2546
+ const native = getNativeBridge();
2547
+ if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
2548
+ return native.scan_cache_optimizations();
2549
+ }
2550
+ function getPluginHooks() {
2551
+ const native = getNativeBridge();
2552
+ if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
2553
+ const result = native.get_plugin_hooks();
2554
+ try {
2555
+ return JSON.parse(result);
2556
+ } catch {
2557
+ return [];
2558
+ }
2559
+ }
2560
+ function registerPluginHook(hook_name, handler_id) {
2561
+ const native = getNativeBridge();
2562
+ if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
2563
+ return native.register_plugin_hook(hook_name, handler_id);
2564
+ }
2565
+ function unregisterPluginHook(hook_name, handler_id) {
2566
+ const native = getNativeBridge();
2567
+ if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
2568
+ return native.unregister_plugin_hook(hook_name, handler_id);
2569
+ }
2570
+ function emitPluginHook(hook_name, data_json) {
2571
+ const native = getNativeBridge();
2572
+ if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
2573
+ return native.emit_plugin_hook(hook_name, data_json);
2574
+ }
2575
+ function getCompilationMetrics() {
2576
+ const native = getNativeBridge();
2577
+ if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
2578
+ return native.get_compilation_metrics();
2579
+ }
2580
+ function resetCompilationMetrics() {
2581
+ const native = getNativeBridge();
2582
+ if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
2583
+ return native.reset_compilation_metrics();
2584
+ }
2585
+ function validateCssOutput(css) {
2586
+ const native = getNativeBridge();
2587
+ if (!native?.validate_css_output) throw new Error("validate_css_output not available");
2588
+ return native.validate_css_output(css);
2589
+ }
2590
+ function getCompilerDiagnostics() {
2591
+ const native = getNativeBridge();
2592
+ if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
2593
+ return native.get_compiler_diagnostics();
2594
+ }
2595
+ var init_watchSystemNative = __esm({
2596
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
2597
+ init_nativeBridge();
2598
+ }
2599
+ });
2600
+
2601
+ // packages/domain/compiler/src/watch/index.ts
2602
+ var init_watch = __esm({
2603
+ "packages/domain/compiler/src/watch/index.ts"() {
2604
+ init_watchSystemNative();
2605
+ }
2606
+ });
2607
+ function _layoutClassesToCss(classes) {
2608
+ const native = getNativeBridge();
2609
+ if (!native?.layoutClassesToCss) {
2610
+ throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
2611
+ }
2612
+ return native.layoutClassesToCss(classes);
2613
+ }
2614
+ function _hashContainer(tag, containerJson, name) {
2615
+ const sortedKey = tag + (name ?? "") + containerJson;
2616
+ const native = getNativeBridge();
2617
+ if (!native?.hashContent) {
2618
+ throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
2619
+ }
2620
+ return `tw-cq-${native.hashContent(sortedKey, "fnv", 6)}`;
2621
+ }
2622
+ function extractContainerCssFromSource(source) {
2623
+ const native = getNativeBridge();
2624
+ if (!native?.extractTwContainerConfigs) {
2625
+ throw new Error("FATAL: Native binding 'extractTwContainerConfigs' is required but not available.");
2626
+ }
2627
+ const configs = native.extractTwContainerConfigs(source);
2628
+ const rules = [];
2629
+ for (const cfg of configs) {
2630
+ const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName);
2631
+ for (const { key, classes } of cfg.breakpoints) {
2632
+ const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key;
2633
+ const css = _layoutClassesToCss(classes);
2634
+ if (!css) continue;
2635
+ const query = cfg.containerName ? `@container ${cfg.containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
2636
+ rules.push(`${query}{.${id}{${css}}}`);
2637
+ }
2638
+ }
2639
+ return rules.join("\n");
2640
+ }
2641
+ var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2642
+ var init_src = __esm({
2643
+ "packages/domain/compiler/src/index.ts"() {
2644
+ init_nativeBridge();
2645
+ init_compiler();
2646
+ init_parser();
2647
+ init_analyzer();
2648
+ init_cache();
2649
+ init_redis();
2650
+ init_watch();
2651
+ transformSource = (source, opts) => {
2652
+ const native = getNativeBridge();
2653
+ if (!native?.transformSource) {
2654
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2655
+ }
2656
+ const result = native.transformSource(source, opts);
2657
+ if (!result) {
2658
+ throw new Error("FATAL: transformSource returned null");
2659
+ }
2660
+ return result;
2661
+ };
2662
+ hasTwUsage = (source) => {
2663
+ const native = getNativeBridge();
2664
+ if (!native?.hasTwUsage) {
2665
+ throw new Error("FATAL: Native binding 'hasTwUsage' is required but not available.");
2666
+ }
2667
+ return native.hasTwUsage(source);
2668
+ };
2669
+ isAlreadyTransformed = (source) => {
2670
+ const native = getNativeBridge();
2671
+ if (!native?.isAlreadyTransformed) {
2672
+ throw new Error("FATAL: Native binding 'isAlreadyTransformed' is required but not available.");
2673
+ }
2674
+ return native.isAlreadyTransformed(source);
2675
+ };
2676
+ shouldProcess = (source) => {
2677
+ return hasTwUsage(source) && !isAlreadyTransformed(source);
2678
+ };
2679
+ compileCssFromClasses = (classes, prefix) => {
2680
+ const native = getNativeBridge();
2681
+ if (!native?.transformSource) {
2682
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2683
+ }
2684
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
2685
+ if (!result) {
2686
+ throw new Error("FATAL: transformSource returned null");
2687
+ }
2688
+ return result;
2689
+ };
2690
+ buildStyleTag = (classes) => {
2691
+ const result = compileCssFromClasses(classes);
2692
+ return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
2693
+ };
2694
+ generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
2695
+ try {
2696
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
2697
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
2698
+ return result.css;
2699
+ } catch {
2700
+ const native = getNativeBridge();
2701
+ if (!native?.transformSource) {
2702
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
2703
+ }
2704
+ const result = native.transformSource(classes.join(" "), {});
2705
+ return result?.code || "";
2706
+ }
2707
+ };
2708
+ eliminateDeadCss = (css, deadClasses) => {
2709
+ const native = getNativeBridge();
2710
+ if (!native?.eliminateDeadCss) {
2711
+ throw new Error("FATAL: Native binding 'eliminateDeadCss' is required but not available.");
2712
+ }
2713
+ return native.eliminateDeadCss(css, Array.from(deadClasses));
2714
+ };
2715
+ findDeadVariants = (variantConfig, usage) => {
2716
+ const unused = [];
2717
+ const configs = Array.isArray(variantConfig) ? variantConfig : [{ name: "__root__", variants: variantConfig }];
2718
+ for (const component of configs) {
2719
+ const componentUsage = usage[component.name] ?? /* @__PURE__ */ new Set();
2720
+ const variants = component.variants;
2721
+ for (const [key, values] of Object.entries(variants)) {
2722
+ for (const [value] of Object.entries(values)) {
2723
+ if (!componentUsage.has(`${key}:${value}`)) {
2724
+ unused.push(`${component.name !== "__root__" ? `${component.name}/` : ""}${key}:${value}`);
2725
+ }
2726
+ }
2727
+ }
2728
+ }
2729
+ return { unusedCount: unused.length, unused };
2730
+ };
2731
+ runElimination = (css, scanResult) => {
2732
+ const native = getNativeBridge();
2733
+ if (!native?.detectDeadCode) {
2734
+ throw new Error("FATAL: Native binding 'detectDeadCode' is required but not available.");
2735
+ }
2736
+ const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
2737
+ return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
2738
+ };
2739
+ scanProjectUsage = (dirs, cwd) => {
2740
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
2741
+ const files = dirs.map((dir) => path9__namespace.default.resolve(cwd, dir));
2742
+ const results = batchExtractClasses2(files) || [];
2743
+ const combined = {};
2744
+ for (const result of results) {
2745
+ if (result.ok && result.classes) {
2746
+ for (const cls of result.classes) {
2747
+ if (!combined[cls]) combined[cls] = {};
2748
+ combined[cls][result.file] = /* @__PURE__ */ new Set([cls]);
2749
+ }
2750
+ }
2751
+ }
2752
+ return combined;
2753
+ };
2754
+ generateSafelist = (scanDirs, outputPath, cwd) => {
2755
+ const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
2756
+ const allClasses = Object.keys(classes).sort();
2757
+ if (outputPath) {
2758
+ fs3__namespace.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2759
+ }
2760
+ return allClasses;
2761
+ };
2762
+ loadSafelist = (safelistPath) => {
2763
+ try {
2764
+ const content = fs3__namespace.default.readFileSync(safelistPath, "utf-8");
2765
+ return JSON.parse(content);
2766
+ } catch {
2767
+ return [];
2768
+ }
2769
+ };
2770
+ loadTailwindConfig = (cwd = process.cwd()) => {
2771
+ const configFiles = [
2772
+ "tailwind.config.ts",
2773
+ "tailwind.config.js",
2774
+ "tailwind.config.mjs",
2775
+ "tailwind.config.cjs"
2776
+ ];
2777
+ for (const file of configFiles) {
2778
+ const fullPath = path9__namespace.default.join(cwd, file);
2779
+ if (fs3__namespace.default.existsSync(fullPath)) {
2780
+ const mod = __require(fullPath);
2781
+ return mod.default || mod;
2782
+ }
2783
+ }
2784
+ return {};
2785
+ };
2786
+ getContentPaths = (cwd = process.cwd()) => {
2787
+ return {
2788
+ content: [
2789
+ path9__namespace.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2790
+ path9__namespace.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2791
+ path9__namespace.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2792
+ ]
2793
+ };
2794
+ };
2795
+ _CONTAINER_BREAKPOINTS = {
2796
+ xs: "240px",
2797
+ sm: "320px",
2798
+ md: "640px",
2799
+ lg: "1024px",
2800
+ xl: "1280px",
2801
+ "2xl": "1536px"
2802
+ };
2803
+ runLoaderTransform = (ctx) => {
2804
+ const { filepath, source, options } = ctx;
2805
+ const result = transformSource(source, { filename: filepath, ...options });
2806
+ let staticCss;
2807
+ try {
2808
+ const cssChunks = [];
2809
+ const stateRules = extractAndGenerateStateCss(source, filepath);
2810
+ if (stateRules.length > 0) {
2811
+ cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
2812
+ }
2813
+ const containerCss = extractContainerCssFromSource(source);
2814
+ if (containerCss) cssChunks.push(containerCss);
2815
+ const combined = cssChunks.join("\n").trim();
2816
+ if (combined) staticCss = combined;
2817
+ } catch (err) {
2818
+ console.debug("Static CSS extraction warning:", err);
2819
+ }
2820
+ return {
2821
+ code: result?.code || "",
2822
+ changed: result?.changed || false,
2823
+ classes: result?.classes || [],
2824
+ staticCss
2825
+ };
2826
+ };
2827
+ shouldSkipFile = (filepath) => {
2828
+ const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
2829
+ const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
2830
+ for (const p of SKIP_PATHS) {
2831
+ if (filepath.includes(p)) return true;
2832
+ }
2833
+ for (const ext of skipExtensions) {
2834
+ if (filepath.endsWith(ext)) return true;
2835
+ }
2836
+ return false;
2837
+ };
2838
+ fileToRoute = (filepath) => {
2839
+ const normalized = filepath.replace(/\\/g, "/");
2840
+ if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
2841
+ return "__global";
2842
+ }
2843
+ const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2844
+ if (pageMatch) return `/${pageMatch[1]}`;
2845
+ const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2846
+ if (rootPage) return "/";
2847
+ return null;
2848
+ };
2849
+ getAllRoutes = () => {
2850
+ const native = getNativeBridge();
2851
+ if (!native?.analyzeClasses) {
2852
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2853
+ }
2854
+ return ["/", "__global"];
2855
+ };
2856
+ getRouteClasses = (_route) => /* @__PURE__ */ new Set();
2857
+ registerFileClasses = (_filepath, _classes) => {
2858
+ };
2859
+ registerGlobalClasses = (_classes) => {
2860
+ };
2861
+ _incrementalEngineInstance = null;
2862
+ getIncrementalEngine = () => {
2863
+ if (!_incrementalEngineInstance) {
2864
+ _incrementalEngineInstance = new IncrementalEngine();
2865
+ }
2866
+ return _incrementalEngineInstance;
2867
+ };
2868
+ resetIncrementalEngine = () => {
2869
+ _incrementalEngineInstance = null;
2870
+ };
2871
+ IncrementalEngine = class {
2872
+ compile(source) {
2873
+ return transformSource(source);
2874
+ }
2875
+ };
2876
+ getBucketEngine = () => {
2877
+ const native = getNativeBridge();
2878
+ if (!native?.classifyAndSortClasses) {
2879
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2880
+ }
2881
+ return {
2882
+ add: (className) => className,
2883
+ get: (_bucket) => []
2884
+ };
2885
+ };
2886
+ resetBucketEngine = () => {
2887
+ };
2888
+ classifyNode = (_node) => {
2889
+ const native = getNativeBridge();
2890
+ if (!native?.classifyAndSortClasses) {
2891
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2892
+ }
2893
+ return "unknown";
2894
+ };
2895
+ detectConflicts = (_classes) => {
2896
+ const native = getNativeBridge();
2897
+ if (!native?.analyzeClassUsage) {
2898
+ throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
2899
+ }
2900
+ return [];
2901
+ };
2902
+ bucketSort = (classes) => {
2903
+ const native = getNativeBridge();
2904
+ if (!native?.classifyAndSortClasses) {
2905
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2906
+ }
2907
+ const sorted = native.classifyAndSortClasses(classes);
2908
+ return sorted.map((c) => c.raw ?? c);
2909
+ };
2910
+ analyzeFile = (source, filename) => {
2911
+ const native = getNativeBridge();
2912
+ if (!native?.analyzeRsc) {
2913
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2914
+ }
2915
+ const rsc = native.analyzeRsc(source, filename);
2916
+ return {
2917
+ isServer: rsc?.isServer ?? true,
2918
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2919
+ clientReasons: rsc?.clientReasons ?? [],
2920
+ interactiveClasses: [],
2921
+ canStaticResolveVariants: true
2922
+ };
2923
+ };
2924
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2925
+ return { resolved: {}, dynamic: [] };
2926
+ };
2927
+ injectClientDirective = (source) => {
2928
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2929
+ return '"use client";\n' + source;
2930
+ }
2931
+ return source;
2932
+ };
2933
+ injectServerOnlyComment = (source) => {
2934
+ return `/* @server-only */
2935
+ ${source}`;
2936
+ };
2937
+ analyzeClasses = (filesJson, cwd, flags) => {
2938
+ const native = getNativeBridge();
2939
+ if (!native?.analyzeClasses) {
2940
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2941
+ }
2942
+ return native.analyzeClasses(filesJson, cwd, flags);
2943
+ };
2944
+ extractTwStateConfigs = (source, filename) => {
2945
+ const native = getNativeBridge();
2946
+ if (!native?.extractTwStateConfigs) {
2947
+ throw new Error("FATAL: Native binding 'extractTwStateConfigs' is required but not available.");
2948
+ }
2949
+ return native.extractTwStateConfigs(source, filename);
2950
+ };
2951
+ generateStaticStateCss = (entries, _themeConfig) => {
2952
+ const rules = [];
2953
+ for (const entry of entries) {
2954
+ const stateConfig = JSON.parse(entry.statesJson);
2955
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2956
+ rules.push({
2957
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2958
+ declarations: classes,
2959
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2960
+ componentName: entry.componentName,
2961
+ stateName
2962
+ });
2963
+ }
2964
+ }
2965
+ return rules;
2966
+ };
2967
+ extractAndGenerateStateCss = (source, filename) => {
2968
+ const entries = extractTwStateConfigs(source, filename);
2969
+ return generateStaticStateCss(entries);
2970
+ };
2971
+ }
2972
+ });
2973
+
2974
+ // packages/domain/compiler/src/internal.ts
2975
+ var internal_exports = {};
2976
+ __export(internal_exports, {
2977
+ adaptNativeResult: () => adaptNativeResult,
2978
+ analyzeClassUsageNative: () => analyzeClassUsageNative,
2979
+ analyzeClasses: () => analyzeClasses,
2980
+ analyzeClassesNative: () => analyzeClassesNative,
2981
+ analyzeFile: () => analyzeFile,
2982
+ analyzeRscNative: () => analyzeRscNative,
2983
+ analyzeVariantUsage: () => analyzeVariantUsage,
2984
+ astExtractClasses: () => astExtractClasses,
2985
+ atomicRegistrySize: () => atomicRegistrySize,
2986
+ batchExtractClasses: () => batchExtractClasses,
2987
+ batchExtractClassesNative: () => batchExtractClassesNative,
2988
+ bucketSort: () => bucketSort,
2989
+ buildStyleTag: () => buildStyleTag,
2990
+ cachePriority: () => cachePriority,
2991
+ cacheRead: () => cacheRead,
2992
+ cacheWrite: () => cacheWrite,
2993
+ checkAgainstSafelist: () => checkAgainstSafelist,
2994
+ checkAgainstSafelistNative: () => checkAgainstSafelistNative,
2995
+ classifyAndSortClassesNative: () => classifyAndSortClassesNative,
2996
+ classifyNode: () => classifyNode,
2997
+ clearAllCaches: () => clearAllCaches,
2998
+ clearAtomicRegistry: () => clearAtomicRegistry,
2999
+ clearCache: () => clearCache,
3000
+ clearCompileCache: () => clearCompileCache,
3001
+ clearCssGenCache: () => clearCssGenCache,
3002
+ clearParseCache: () => clearParseCache,
3003
+ clearResolveCache: () => clearResolveCache,
3004
+ clearThemeCache: () => clearThemeCache,
3005
+ collectFiles: () => collectFiles,
3006
+ compileAnimation: () => compileAnimation,
3007
+ compileClass: () => compileClass,
3008
+ compileClasses: () => compileClasses,
3009
+ compileCssFromClasses: () => compileCssFromClasses,
3010
+ compileCssLightning: () => compileCssLightning,
3011
+ compileCssNative2: () => compileCssNative2,
3012
+ compileKeyframes: () => compileKeyframes,
3013
+ compileTheme: () => compileTheme,
3014
+ compileToCss: () => compileToCss,
3015
+ compileToCssBatch: () => compileToCssBatch,
3016
+ compileVariantTableNative: () => compileVariantTableNative,
3017
+ computeIncrementalDiff: () => computeIncrementalDiff,
3018
+ createFingerprint: () => createFingerprint,
3019
+ detectConflicts: () => detectConflicts,
3020
+ detectDeadCode: () => detectDeadCode,
3021
+ diffClassLists: () => diffClassLists,
3022
+ eliminateDeadCss: () => eliminateDeadCss,
3023
+ eliminateDeadCssNative: () => eliminateDeadCssNative,
3024
+ emitPluginHook: () => emitPluginHook,
3025
+ estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
3026
+ extractAllClasses: () => extractAllClasses,
3027
+ extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3028
+ extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
3029
+ extractClassesFromSource: () => extractClassesFromSource,
3030
+ extractClassesFromSourceNative: () => extractClassesFromSourceNative,
3031
+ extractComponentUsage: () => extractComponentUsage,
3032
+ extractContainerCssFromSource: () => extractContainerCssFromSource,
3033
+ extractTwContainerConfigs: () => extractTwContainerConfigs,
3034
+ extractTwStateConfigs: () => extractTwStateConfigs,
3035
+ extractTwStateConfigsNative: () => extractTwStateConfigsNative,
3036
+ fileToRoute: () => fileToRoute,
3037
+ findDeadVariants: () => findDeadVariants,
3038
+ generateAtomicCss: () => generateAtomicCss,
3039
+ generateCssForClasses: () => generateCssForClasses,
3040
+ generateCssNative: () => generateCssNative,
3041
+ generateSafelist: () => generateSafelist,
3042
+ generateStaticStateCss: () => generateStaticStateCss,
3043
+ generateStaticStateCssNative: () => generateStaticStateCssNative,
3044
+ generateSubComponentTypes: () => generateSubComponentTypes,
3045
+ getAllRoutes: () => getAllRoutes,
3046
+ getBucketEngine: () => getBucketEngine,
3047
+ getCacheOptimizationHints: () => getCacheOptimizationHints,
3048
+ getCacheStatistics: () => getCacheStatistics,
3049
+ getCacheStats: () => getCacheStats,
3050
+ getCompilationMetrics: () => getCompilationMetrics,
3051
+ getCompilerDiagnostics: () => getCompilerDiagnostics,
3052
+ getContentPaths: () => getContentPaths,
3053
+ getIncrementalEngine: () => getIncrementalEngine,
3054
+ getNativeBridge: () => getNativeBridge,
3055
+ getPluginHooks: () => getPluginHooks,
3056
+ getRouteClasses: () => getRouteClasses,
3057
+ getWatchStats: () => getWatchStats,
3058
+ hasTwUsage: () => hasTwUsage,
3059
+ hashContent: () => hashContent,
3060
+ hoistComponentsNative: () => hoistComponentsNative,
3061
+ idRegistryActiveCount: () => idRegistryActiveCount,
3062
+ idRegistryCreate: () => idRegistryCreate,
3063
+ idRegistryDestroy: () => idRegistryDestroy,
3064
+ idRegistryExport: () => idRegistryExport,
3065
+ idRegistryGenerate: () => idRegistryGenerate,
3066
+ idRegistryImport: () => idRegistryImport,
3067
+ idRegistryLookup: () => idRegistryLookup,
3068
+ idRegistryNext: () => idRegistryNext,
3069
+ idRegistryReset: () => idRegistryReset,
3070
+ idRegistrySnapshot: () => idRegistrySnapshot,
3071
+ injectClientDirective: () => injectClientDirective,
3072
+ injectServerOnlyComment: () => injectServerOnlyComment,
3073
+ injectStateHash: () => injectStateHash,
3074
+ isAlreadyTransformed: () => isAlreadyTransformed,
3075
+ isWatchRunning: () => isWatchRunning,
3076
+ layoutClassesToCss: () => layoutClassesToCss,
3077
+ loadSafelist: () => loadSafelist,
3078
+ loadTailwindConfig: () => loadTailwindConfig,
3079
+ mergeClassesStatic: () => mergeClassesStatic,
3080
+ mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
3081
+ minifyCss: () => minifyCss,
3082
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
3083
+ normalizeClasses: () => normalizeClasses,
3084
+ optimizeCssNative: () => optimizeCssNative,
3085
+ parseAtomicClass: () => parseAtomicClass,
3086
+ parseClasses: () => parseClasses,
3087
+ pollWatchEvents: () => pollWatchEvents,
3088
+ processFileChange: () => processFileChange,
3089
+ processTailwindCssLightning: () => processTailwindCssLightning,
3090
+ propertyIdToString: () => propertyIdToString,
3091
+ pruneStaleCacheEntries: () => pruneStaleCacheEntries,
3092
+ rebuildWorkspaceResult: () => rebuildWorkspaceResult,
3093
+ redisCacheClear: () => redisCacheClear,
3094
+ redisCacheHitRate: () => redisCacheHitRate,
3095
+ redisCacheKeyCount: () => redisCacheKeyCount,
3096
+ redisCacheSize: () => redisCacheSize,
3097
+ redisCacheSync: () => redisCacheSync,
3098
+ redisClusterStatus: () => redisClusterStatus,
3099
+ redisDelete: () => redisDelete,
3100
+ redisDiagnose: () => redisDiagnose,
3101
+ redisDisableCacheWarming: () => redisDisableCacheWarming,
3102
+ redisDisableCluster: () => redisDisableCluster,
3103
+ redisDisablePersistence: () => redisDisablePersistence,
3104
+ redisEnableCacheWarming: () => redisEnableCacheWarming,
3105
+ redisEnableCluster: () => redisEnableCluster,
3106
+ redisEnablePersistence: () => redisEnablePersistence,
3107
+ redisExists: () => redisExists,
3108
+ redisExpirationGet: () => redisExpirationGet,
3109
+ redisExpirationSet: () => redisExpirationSet,
3110
+ redisFlushAll: () => redisFlushAll,
3111
+ redisFlushDb: () => redisFlushDb,
3112
+ redisGet: () => redisGet,
3113
+ redisGetEvictionPolicy: () => redisGetEvictionPolicy,
3114
+ redisInfo: () => redisInfo,
3115
+ redisMemoryStats: () => redisMemoryStats,
3116
+ redisMget: () => redisMget,
3117
+ redisMonitor: () => redisMonitor,
3118
+ redisMset: () => redisMset,
3119
+ redisOptimizeMemory: () => redisOptimizeMemory,
3120
+ redisPing: () => redisPing,
3121
+ redisPoolConnect: () => redisPoolConnect,
3122
+ redisPoolReconnect: () => redisPoolReconnect,
3123
+ redisPoolStats: () => redisPoolStats,
3124
+ redisPublish: () => redisPublish,
3125
+ redisReplicate: () => redisReplicate,
3126
+ redisReplicationStatus: () => redisReplicationStatus,
3127
+ redisSet: () => redisSet,
3128
+ redisSetEvictionPolicy: () => redisSetEvictionPolicy,
3129
+ redisSnapshot: () => redisSnapshot,
3130
+ redisSubscribe: () => redisSubscribe,
3131
+ registerFileClasses: () => registerFileClasses,
3132
+ registerGlobalClasses: () => registerGlobalClasses,
3133
+ registerPluginHook: () => registerPluginHook,
3134
+ registerPropertyName: () => registerPropertyName,
3135
+ registerValueName: () => registerValueName,
3136
+ resetBucketEngine: () => resetBucketEngine,
3137
+ resetCompilationMetrics: () => resetCompilationMetrics,
3138
+ resetIncrementalEngine: () => resetIncrementalEngine,
3139
+ resolveCascade: () => resolveCascade,
3140
+ resolveClassNames: () => resolveClassNames,
3141
+ resolveConflictGroup: () => resolveConflictGroup,
3142
+ resolveSimpleVariants: () => resolveSimpleVariants,
3143
+ resolveThemeValue: () => resolveThemeValue,
3144
+ resolveVariants: () => resolveVariants,
3145
+ reverseLookupProperty: () => reverseLookupProperty,
3146
+ reverseLookupValue: () => reverseLookupValue,
3147
+ runCssPipeline: () => runCssPipeline,
3148
+ runCssPipelineSync: () => runCssPipelineSync,
3149
+ runElimination: () => runElimination,
3150
+ runLoaderTransform: () => runLoaderTransform,
3151
+ scanCacheOptimizations: () => scanCacheOptimizations,
3152
+ scanFile: () => scanFile,
3153
+ scanFileNative: () => scanFileNative,
3154
+ scanFilesBatchNative: () => scanFilesBatchNative,
3155
+ scanProjectUsage: () => scanProjectUsage,
3156
+ scanWorkspace: () => scanWorkspace,
3157
+ shouldProcess: () => shouldProcess,
3158
+ shouldSkipFile: () => shouldSkipFile,
3159
+ startWatch: () => startWatch,
3160
+ stopWatch: () => stopWatch,
3161
+ toAtomicClasses: () => toAtomicClasses,
3162
+ transformSource: () => transformSource,
3163
+ twMerge: () => twMerge,
3164
+ twMergeMany: () => twMergeMany,
3165
+ twMergeManyWithSeparator: () => twMergeManyWithSeparator,
3166
+ twMergeRaw: () => twMergeRaw,
3167
+ twMergeWithSeparator: () => twMergeWithSeparator,
3168
+ unregisterPluginHook: () => unregisterPluginHook,
3169
+ validateCssOutput: () => validateCssOutput,
3170
+ validateThemeConfig: () => validateThemeConfig,
3171
+ valueIdToString: () => valueIdToString,
3172
+ walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
3173
+ watchAddPattern: () => watchAddPattern,
3174
+ watchClearAll: () => watchClearAll,
3175
+ watchEventTypeToString: () => watchEventTypeToString,
3176
+ watchGetActiveHandles: () => watchGetActiveHandles,
3177
+ watchPause: () => watchPause,
3178
+ watchRemovePattern: () => watchRemovePattern,
3179
+ watchResume: () => watchResume
3180
+ });
3181
+ var init_internal = __esm({
3182
+ "packages/domain/compiler/src/internal.ts"() {
3183
+ init_src();
3184
+ init_tailwindEngine();
3185
+ init_compiler();
3186
+ init_parser();
3187
+ init_analyzer();
3188
+ init_cache();
3189
+ init_redis();
3190
+ init_watch();
3191
+ }
3192
+ });
3193
+ function getNative() {
3194
+ if (_native) return _native;
3195
+ try {
3196
+ const mod = (init_internal(), __toCommonJS(internal_exports));
3197
+ if (typeof mod?.extractTwStateConfigs !== "function" || typeof mod?.generateStaticStateCss !== "function") {
3198
+ return null;
3199
+ }
3200
+ _native = {
3201
+ extractTwStateConfigs: mod.extractTwStateConfigs,
3202
+ generateStaticStateCss: mod.generateStaticStateCss,
3203
+ extractAndGenerateStateCss: mod.extractAndGenerateStateCss ?? // Fallback jika extractAndGenerateStateCss belum di-export
3204
+ ((source, filename) => {
3205
+ const configs = mod.extractTwStateConfigs(source, filename);
3206
+ if (configs.length === 0) return [];
3207
+ return mod.generateStaticStateCss(configs.map((c) => ({
3208
+ tag: c.tag,
3209
+ componentName: c.componentName,
3210
+ statesJson: c.statesJson
3211
+ })));
3212
+ })
3213
+ };
3214
+ return _native;
3215
+ } catch {
3216
+ return null;
3217
+ }
3218
+ }
3219
+ function* walkSourceFiles(dir) {
3220
+ let entries;
3221
+ try {
3222
+ entries = fs3__namespace.default.readdirSync(dir, { withFileTypes: true });
3223
+ } catch {
3224
+ return;
3225
+ }
3226
+ for (const entry of entries) {
3227
+ const fullPath = path9__namespace.default.join(dir, entry.name);
3228
+ if (entry.isDirectory()) {
3229
+ if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
3230
+ yield* walkSourceFiles(fullPath);
3231
+ } else if (entry.isFile()) {
3232
+ const ext = path9__namespace.default.extname(entry.name);
3233
+ if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
3234
+ }
3235
+ }
3236
+ }
3237
+ function buildCssHeader(result) {
3238
+ return [
3239
+ "/* \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",
3240
+ " * tw-state-static.css \u2014 Auto-generated by staticStateExtractor.ts",
3241
+ " * DO NOT EDIT. Re-generated on each build.",
3242
+ " *",
3243
+ ` * Files scanned: ${result.filesScanned}`,
3244
+ ` * Files with states: ${result.filesWithStates}`,
3245
+ ` * Components found: ${result.componentsFound}`,
3246
+ ` * Rules generated: ${result.rulesGenerated}`,
3247
+ ` * Rules skipped: ${result.rulesSkipped} (akan di-inject runtime sebagai fallback)`,
3248
+ " *",
3249
+ ' * Selector format: .tw-s-[hash][data-stateName="true"] { ... }',
3250
+ " * Hash identik dengan yang dibuat oleh stateEngine.ts di runtime.",
3251
+ " * \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 */",
3252
+ ""
3253
+ ].join("\n");
3254
+ }
3255
+ function extractStaticStateCss(srcDir, options = {}) {
3256
+ const { verbose = false, maxFiles = Infinity } = options;
3257
+ const native = getNative();
3258
+ if (!native) {
3259
+ if (verbose) {
3260
+ process.stderr.write(
3261
+ "[tw:static-state] native module tidak tersedia \u2014 skip static CSS pre-generation\n"
3262
+ );
3263
+ }
3264
+ return {
3265
+ filesScanned: 0,
3266
+ filesWithStates: 0,
3267
+ componentsFound: 0,
3268
+ rulesGenerated: 0,
3269
+ rulesSkipped: 0,
3270
+ generatedCss: "",
3271
+ rules: []
3272
+ };
3273
+ }
3274
+ const allConfigs = [];
3275
+ let filesScanned = 0;
3276
+ let filesWithStates = 0;
3277
+ if (native.walkAndPrefilterSourceFiles) {
3278
+ const prefiltered = native.walkAndPrefilterSourceFiles(
3279
+ srcDir,
3280
+ [".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"],
3281
+ ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"],
3282
+ // Required substrings — AND logic, identik dengan JS pre-filter di bawah
3283
+ ["states:", "tw."],
3284
+ maxFiles === Infinity ? null : maxFiles,
3285
+ null
3286
+ // sequential — parallel mode opsional untuk large monorepo
3287
+ );
3288
+ for (const { path: filePath, content: source } of prefiltered) {
3289
+ filesScanned++;
3290
+ const configs = native.extractTwStateConfigs(source, filePath);
3291
+ if (configs.length > 0) {
3292
+ filesWithStates++;
3293
+ allConfigs.push(...configs);
3294
+ if (verbose) {
3295
+ process.stderr.write(
3296
+ `[tw:static-state] ${path9__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
3297
+ `
3298
+ );
3299
+ }
3300
+ }
3301
+ }
3302
+ } else {
3303
+ for (const filePath of walkSourceFiles(srcDir)) {
3304
+ if (filesScanned >= maxFiles) break;
3305
+ let source;
3306
+ try {
3307
+ source = fs3__namespace.default.readFileSync(filePath, "utf-8");
3308
+ } catch {
3309
+ continue;
3310
+ }
3311
+ filesScanned++;
3312
+ if (!source.includes("states:") && !source.includes("states :")) continue;
3313
+ if (!source.includes("tw.") && !source.includes("tailwind-styled")) continue;
3314
+ const configs = native.extractTwStateConfigs(source, filePath);
3315
+ if (configs.length > 0) {
3316
+ filesWithStates++;
3317
+ allConfigs.push(...configs);
3318
+ if (verbose) {
3319
+ process.stderr.write(
3320
+ `[tw:static-state] ${path9__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
3321
+ `
3322
+ );
3323
+ }
3324
+ }
3325
+ }
3326
+ }
3327
+ if (allConfigs.length === 0) {
3328
+ return {
3329
+ filesScanned,
3330
+ filesWithStates: 0,
3331
+ componentsFound: 0,
3332
+ rulesGenerated: 0,
3333
+ rulesSkipped: 0,
3334
+ generatedCss: "",
3335
+ rules: []
3336
+ };
3337
+ }
3338
+ const seen = /* @__PURE__ */ new Set();
3339
+ const uniqueConfigs = [];
3340
+ for (const config of allConfigs) {
3341
+ const key = `${config.tag}::${config.statesJson}`;
3342
+ if (!seen.has(key)) {
3343
+ seen.add(key);
3344
+ uniqueConfigs.push({
3345
+ tag: config.tag,
3346
+ componentName: config.componentName,
3347
+ statesJson: config.statesJson
3348
+ });
3349
+ }
3350
+ }
3351
+ const allRules = native.generateStaticStateCss(uniqueConfigs, options.resolvedCss ?? null);
3352
+ const rulesSkipped = uniqueConfigs.reduce((total, cfg) => {
3353
+ try {
3354
+ const stateMap = JSON.parse(cfg.statesJson);
3355
+ return total + Object.keys(stateMap).length;
3356
+ } catch {
3357
+ return total;
3358
+ }
3359
+ }, 0) - allRules.length;
3360
+ const byComponent = /* @__PURE__ */ new Map();
3361
+ for (const rule of allRules) {
3362
+ const existing = byComponent.get(rule.componentName) ?? [];
3363
+ existing.push(rule);
3364
+ byComponent.set(rule.componentName, existing);
3365
+ }
3366
+ const cssBlocks = [];
3367
+ for (const [componentName, rules] of byComponent) {
3368
+ cssBlocks.push(`/* ${componentName} */`);
3369
+ for (const rule of rules) {
3370
+ cssBlocks.push(`/* state: ${rule.stateName} */`);
3371
+ cssBlocks.push(rule.cssRule);
3372
+ }
3373
+ cssBlocks.push("");
3374
+ }
3375
+ const result = {
3376
+ filesScanned,
3377
+ filesWithStates,
3378
+ componentsFound: allConfigs.length,
3379
+ rulesGenerated: allRules.length,
3380
+ rulesSkipped: Math.max(0, rulesSkipped),
3381
+ generatedCss: cssBlocks.join("\n"),
3382
+ rules: allRules
3383
+ };
3384
+ result.generatedCss = buildCssHeader(result) + result.generatedCss;
3385
+ return result;
3386
+ }
3387
+ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3388
+ const result = extractStaticStateCss(srcDir, options);
3389
+ const twClassesDir = path9__namespace.default.join(path9__namespace.default.dirname(safelistPath), "tw-classes");
3390
+ fs3__namespace.default.mkdirSync(twClassesDir, { recursive: true });
3391
+ const stateFilePath = path9__namespace.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3392
+ if (result.rulesGenerated === 0) {
3393
+ try {
3394
+ fs3__namespace.default.writeFileSync(
3395
+ stateFilePath,
3396
+ "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3397
+ "utf-8"
3398
+ );
3399
+ } catch {
3400
+ }
3401
+ return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3402
+ }
3403
+ try {
3404
+ fs3__namespace.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3405
+ return [
3406
+ `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3407
+ ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
3408
+ ` \u2192 ${result.componentsFound} components, ${result.rulesSkipped} rules skipped (fallback ke runtime)`,
3409
+ ` \u2192 ditulis ke tw-classes/${TW_STATE_STATIC_FILENAME}`
3410
+ ].join("\n");
3411
+ } catch (writeErr) {
3412
+ const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
3413
+ return `[tw:static-state] gagal tulis state CSS: ${msg}`;
3414
+ }
3415
+ }
3416
+ var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3417
+ var init_staticStateExtractor = __esm({
3418
+ "packages/domain/shared/src/staticStateExtractor.ts"() {
3419
+ SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
3420
+ IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
3421
+ _native = null;
3422
+ TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
3423
+ }
3424
+ });
3425
+ function getEnvLevel() {
3426
+ const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
3427
+ if (env && env in LEVELS) return env;
3428
+ return process.env.TWS_DEBUG_SCANNER === "1" ? "debug" : "info";
3429
+ }
3430
+ function setGlobalLogFile(filePath) {
3431
+ _globalLogFile = filePath;
3432
+ _logFileInitialized = false;
3433
+ try {
3434
+ fs3__namespace.default.mkdirSync(path9__namespace.default.dirname(filePath), { recursive: true });
3435
+ fs3__namespace.default.writeFileSync(
3436
+ filePath,
3437
+ `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3438
+ `,
3439
+ "utf-8"
3440
+ );
3441
+ _logFileInitialized = true;
3442
+ } catch {
3443
+ }
3444
+ }
3445
+ function writeToFile(line) {
3446
+ if (!_globalLogFile || !_logFileInitialized) return;
3447
+ try {
3448
+ fs3__namespace.default.appendFileSync(_globalLogFile, line);
3449
+ } catch {
3450
+ }
3451
+ }
3452
+ function createLogger(prefix, level) {
3453
+ const loggerState = {
3454
+ currentLevel: getEnvLevel(),
3455
+ setLevel(l) {
3456
+ this.currentLevel = l;
3457
+ }
3458
+ };
3459
+ const log8 = (msgLevel, stream, args) => {
3460
+ if (LEVELS[msgLevel] > LEVELS[loggerState.currentLevel]) return;
3461
+ const line = `[${prefix}] ${args.map(String).join(" ")}
3462
+ `;
3463
+ process[stream].write(line);
3464
+ writeToFile(line);
3465
+ };
3466
+ return {
3467
+ error: (...a) => log8("error", "stderr", a),
3468
+ warn: (...a) => log8("warn", "stderr", a),
3469
+ info: (...a) => log8("info", "stdout", a),
3470
+ debug: (...a) => log8("debug", "stderr", a),
3471
+ setLevel: loggerState.setLevel,
3472
+ setLogFile: (filePath) => setGlobalLogFile(filePath)
3473
+ };
3474
+ }
3475
+ var LEVELS, _globalLogFile, _logFileInitialized;
3476
+ var init_logger = __esm({
3477
+ "packages/domain/shared/src/logger.ts"() {
3478
+ LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3479
+ _globalLogFile = null;
3480
+ _logFileInitialized = false;
3481
+ createLogger("tailwind-styled");
3482
+ }
3483
+ });
3484
+
1012
3485
  // packages/domain/shared/src/index.ts
1013
3486
  var src_exports = {};
1014
3487
  __export(src_exports, {
@@ -1027,18 +3500,21 @@ __export(src_exports, {
1027
3500
  RegistryPluginEntrySchema: () => RegistryPluginEntrySchema,
1028
3501
  ScanCacheClassEntrySchema: () => ScanCacheClassEntrySchema,
1029
3502
  ScanCacheSchema: () => ScanCacheSchema,
3503
+ TW_STATE_STATIC_FILENAME: () => TW_STATE_STATIC_FILENAME,
1030
3504
  TailwindConfigSchema: () => TailwindConfigSchema,
1031
3505
  TelemetryCollector: () => TelemetryCollector,
1032
3506
  TwError: () => TwError,
3507
+ appendStaticStateCssToSafelist: () => appendStaticStateCssToSafelist,
1033
3508
  assertTailwindV4: () => assertTailwindV4,
1034
3509
  calculateHealth: () => calculateHealth,
1035
3510
  createBuildTimer: () => createBuildTimer,
1036
3511
  createDebugLogger: () => createDebugLogger,
1037
3512
  createEsmRequire: () => createEsmRequire,
1038
- createLogger: () => createLogger,
3513
+ createLogger: () => createLogger2,
1039
3514
  createObservabilityClient: () => createObservabilityClient,
1040
3515
  createTraceSnapshot: () => createTraceSnapshot,
1041
3516
  detectTailwind: () => detectTailwind,
3517
+ extractStaticStateCss: () => extractStaticStateCss,
1042
3518
  formatDuration: () => formatDuration,
1043
3519
  formatErrorCode: () => formatErrorCode,
1044
3520
  formatErrorMessage: () => formatErrorMessage,
@@ -1058,7 +3534,7 @@ __export(src_exports, {
1058
3534
  getPipelinePercentages: () => getPipelinePercentages,
1059
3535
  getSuggestion: () => getSuggestion,
1060
3536
  getTailwindVersion: () => getTailwindVersion,
1061
- hashContent: () => hashContent,
3537
+ hashContent: () => hashContent2,
1062
3538
  isTailwindV4: () => isTailwindV4,
1063
3539
  isTwError: () => isTwError,
1064
3540
  loadNativeBinding: () => loadNativeBinding,
@@ -1074,10 +3550,11 @@ __export(src_exports, {
1074
3550
  resolveRuntimeDir: () => resolveRuntimeDir,
1075
3551
  resolveWorkerPath: () => resolveWorkerPath,
1076
3552
  safeParseNative: () => safeParseNative,
3553
+ setGlobalLogFile: () => setGlobalLogFile,
1077
3554
  tryRequire: () => tryRequire,
1078
3555
  wrapUnknownError: () => wrapUnknownError
1079
3556
  });
1080
- function createLogger(namespace) {
3557
+ function createLogger2(namespace) {
1081
3558
  const prefix = `[${namespace}]`;
1082
3559
  return {
1083
3560
  warn(...args) {
@@ -1106,9 +3583,9 @@ function createDebugLogger(namespace, label) {
1106
3583
  }
1107
3584
  };
1108
3585
  }
1109
- function formatIssuePath(path13) {
1110
- if (!path13 || path13.length === 0) return "(root)";
1111
- return path13.map(
3586
+ function formatIssuePath(path16) {
3587
+ if (!path16 || path16.length === 0) return "(root)";
3588
+ return path16.map(
1112
3589
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
1113
3590
  ).join(".");
1114
3591
  }
@@ -1122,9 +3599,9 @@ function loadNativeBinding(options) {
1122
3599
  const { runtimeDir, candidates, isValid } = options;
1123
3600
  const loadErrors = [];
1124
3601
  for (const candidate of candidates) {
1125
- const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
3602
+ const candidatePath = path9__namespace.default.resolve(runtimeDir, candidate);
1126
3603
  try {
1127
- if (!fs5__namespace.default.existsSync(candidatePath) && !fs5__namespace.default.existsSync(candidatePath + ".node")) {
3604
+ if (!fs3__namespace.default.existsSync(candidatePath) && !fs3__namespace.default.existsSync(candidatePath + ".node")) {
1128
3605
  continue;
1129
3606
  }
1130
3607
  const mod = requireNativeModule(candidatePath);
@@ -1156,9 +3633,9 @@ function resolveNativeBindingCandidates(options) {
1156
3633
  }
1157
3634
  }
1158
3635
  if (!includeDefaultCandidates) return candidates;
1159
- if (fs5__namespace.default.existsSync(runtimeDir)) {
3636
+ if (fs3__namespace.default.existsSync(runtimeDir)) {
1160
3637
  try {
1161
- for (const entry of fs5__namespace.default.readdirSync(runtimeDir)) {
3638
+ for (const entry of fs3__namespace.default.readdirSync(runtimeDir)) {
1162
3639
  if (entry.endsWith(".node")) candidates.push(entry);
1163
3640
  }
1164
3641
  } catch {
@@ -1167,27 +3644,27 @@ function resolveNativeBindingCandidates(options) {
1167
3644
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
1168
3645
  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
3646
  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`));
3647
+ candidates.push(path9__namespace.default.resolve(runtimeDir, `${bin}.node`));
3648
+ candidates.push(path9__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3649
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3650
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3651
+ candidates.push(path9__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
3652
+ candidates.push(path9__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3653
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3654
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3655
+ candidates.push(path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
1179
3656
  }
1180
3657
  return Array.from(new Set(candidates));
1181
3658
  }
1182
3659
  function resolveRuntimeDir(dir, importMetaUrl) {
1183
- if (dir) return path6__namespace.default.resolve(dir);
3660
+ if (dir) return path9__namespace.default.resolve(dir);
1184
3661
  try {
1185
- return path6__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
3662
+ return path9__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
1186
3663
  } catch {
1187
3664
  return process.cwd();
1188
3665
  }
1189
3666
  }
1190
- function hashContent(content, algorithm = "md5", length) {
3667
+ function hashContent2(content, algorithm = "md5", length) {
1191
3668
  const hash = crypto.createHash(algorithm).update(content).digest("hex");
1192
3669
  return length ? hash.slice(0, length) : hash;
1193
3670
  }
@@ -1197,7 +3674,7 @@ function formatErrorMessage(error) {
1197
3674
  return String(error);
1198
3675
  }
1199
3676
  var TwError, _require2, LRUCache;
1200
- var init_src = __esm({
3677
+ var init_src2 = __esm({
1201
3678
  "packages/domain/shared/src/index.ts"() {
1202
3679
  init_trace();
1203
3680
  init_error_codes();
@@ -1210,6 +3687,8 @@ var init_src = __esm({
1210
3687
  init_codegen();
1211
3688
  init_native_resolution();
1212
3689
  init_observability();
3690
+ init_staticStateExtractor();
3691
+ init_logger();
1213
3692
  TwError = class _TwError extends Error {
1214
3693
  /** @deprecated Gunakan source */
1215
3694
  domain;
@@ -1243,8 +3722,8 @@ var init_src = __esm({
1243
3722
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
1244
3723
  static fromZod(err) {
1245
3724
  const first = err.issues?.[0] ?? err.errors?.[0];
1246
- const path13 = formatIssuePath(first?.path);
1247
- const message = first ? `${path13}: ${first.message}` : "Schema validation failed";
3725
+ const path16 = formatIssuePath(first?.path);
3726
+ const message = first ? `${path16}: ${first.message}` : "Schema validation failed";
1248
3727
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
1249
3728
  }
1250
3729
  static wrap(source, code, err) {
@@ -1310,7 +3789,7 @@ var init_src = __esm({
1310
3789
  // packages/domain/scanner/src/native-bridge.ts
1311
3790
  var native_bridge_exports = {};
1312
3791
  __export(native_bridge_exports, {
1313
- batchExtractClassesNative: () => batchExtractClassesNative,
3792
+ batchExtractClassesNative: () => batchExtractClassesNative2,
1314
3793
  cachePriorityNative: () => cachePriorityNative,
1315
3794
  cacheReadNative: () => cacheReadNative,
1316
3795
  cacheWriteNative: () => cacheWriteNative,
@@ -1330,8 +3809,8 @@ __export(native_bridge_exports, {
1330
3809
  scanCacheInvalidate: () => scanCacheInvalidate,
1331
3810
  scanCachePut: () => scanCachePut,
1332
3811
  scanCacheStats: () => scanCacheStats,
1333
- scanFileNative: () => scanFileNative,
1334
- scanFilesBatchNative: () => scanFilesBatchNative,
3812
+ scanFileNative: () => scanFileNative2,
3813
+ scanFilesBatchNative: () => scanFilesBatchNative2,
1335
3814
  scanWorkspaceNative: () => scanWorkspaceNative,
1336
3815
  startWatchNative: () => startWatchNative,
1337
3816
  stopWatchNative: () => stopWatchNative
@@ -1341,7 +3820,7 @@ function getDirname2() {
1341
3820
  return __dirname;
1342
3821
  }
1343
3822
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href))) {
1344
- 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('engine.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('engine.js', document.baseURI).href))));
1345
3824
  }
1346
3825
  return process.cwd();
1347
3826
  }
@@ -1422,7 +3901,7 @@ function cachePriorityNative(mtimeMs, size, cachedMtimeMs, cachedSize, cachedHit
1422
3901
  }
1423
3902
  return result;
1424
3903
  }
1425
- function batchExtractClassesNative(filePaths) {
3904
+ function batchExtractClassesNative2(filePaths) {
1426
3905
  const binding = scannerGetBinding();
1427
3906
  if (!binding.batchExtractClasses) {
1428
3907
  throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
@@ -1457,7 +3936,7 @@ function scanCacheStats() {
1457
3936
  }
1458
3937
  return binding.scanCacheStats();
1459
3938
  }
1460
- function scanFileNative(filePath) {
3939
+ function scanFileNative2(filePath) {
1461
3940
  const binding = scannerGetBinding();
1462
3941
  if (!binding.scanFile) {
1463
3942
  throw new Error("FATAL: Native binding 'scanFile' is required but not available.");
@@ -1469,7 +3948,7 @@ function collectFilesNative(root, extensions, ignoreDirs) {
1469
3948
  if (!binding.collectFiles) return null;
1470
3949
  return binding.collectFiles(root, extensions, ignoreDirs);
1471
3950
  }
1472
- function scanFilesBatchNative(filePaths) {
3951
+ function scanFilesBatchNative2(filePaths) {
1473
3952
  const binding = scannerGetBinding();
1474
3953
  if (!binding.scanFilesBatch) {
1475
3954
  return filePaths.map((fp) => {
@@ -1546,11 +4025,11 @@ function hasNativeWatchBinding() {
1546
4025
  return false;
1547
4026
  }
1548
4027
  }
1549
- var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
4028
+ var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
1550
4029
  var init_native_bridge = __esm({
1551
4030
  "packages/domain/scanner/src/native-bridge.ts"() {
1552
- init_src();
1553
- log = createDebugLogger("scanner:native");
4031
+ init_src2();
4032
+ log2 = createDebugLogger("scanner:native");
1554
4033
  isValidScannerBinding = (module) => {
1555
4034
  const candidate = module;
1556
4035
  return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
@@ -1604,7 +4083,7 @@ var init_native_bridge = __esm({
1604
4083
  invalidExportMessage: "Module loaded but missing expected scanner binding functions"
1605
4084
  });
1606
4085
  if (binding) {
1607
- log(`scanner native binding loaded successfully`);
4086
+ log2(`scanner native binding loaded successfully`);
1608
4087
  _state.binding = binding;
1609
4088
  return _state.binding;
1610
4089
  }
@@ -1630,12 +4109,12 @@ var init_native_bridge = __esm({
1630
4109
  }
1631
4110
  });
1632
4111
  function defaultCachePath(rootDir, cacheDir) {
1633
- const dir = cacheDir ? path6__namespace.default.resolve(rootDir, cacheDir) : path6__namespace.default.join(process.cwd(), ".cache", "tailwind-styled");
1634
- 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");
1635
4114
  }
1636
4115
  function readCache(rootDir, cacheDir) {
1637
4116
  const cachePath = defaultCachePath(rootDir, cacheDir);
1638
- fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
4117
+ fs3__namespace.default.mkdirSync(path9__namespace.default.dirname(cachePath), { recursive: true });
1639
4118
  const result = cacheReadNative(cachePath);
1640
4119
  if (!result) return [];
1641
4120
  return result.entries.map((e) => ({
@@ -1650,7 +4129,7 @@ function readCache(rootDir, cacheDir) {
1650
4129
  }
1651
4130
  function writeCache(rootDir, entries, cacheDir) {
1652
4131
  const cachePath = defaultCachePath(rootDir, cacheDir);
1653
- fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
4132
+ fs3__namespace.default.mkdirSync(path9__namespace.default.dirname(cachePath), { recursive: true });
1654
4133
  const success = cacheWriteNative(cachePath, entries);
1655
4134
  if (!success) {
1656
4135
  throw new Error(
@@ -1674,30 +4153,10 @@ var init_cache_native = __esm({
1674
4153
  init_native_bridge();
1675
4154
  }
1676
4155
  });
1677
- function collectFiles(rootDir, extensions, ignoreDirs) {
4156
+ function collectFiles2(rootDir, extensions, ignoreDirs) {
1678
4157
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
1679
4158
  if (native !== null) return native;
1680
- const files = [];
1681
- function walk(dir) {
1682
- let entries;
1683
- try {
1684
- entries = fs5__namespace.default.readdirSync(dir, { withFileTypes: true });
1685
- } catch {
1686
- return;
1687
- }
1688
- for (const entry of entries) {
1689
- const fullPath = path6__namespace.default.join(dir, entry.name);
1690
- const rel = path6__namespace.default.relative(rootDir, fullPath);
1691
- if (entry.isDirectory()) {
1692
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__namespace.default.sep));
1693
- if (!ignored) walk(fullPath);
1694
- } else if (isScannableFile(entry.name, extensions)) {
1695
- files.push(fullPath);
1696
- }
1697
- }
1698
- }
1699
- walk(rootDir);
1700
- return files;
4159
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
1701
4160
  }
1702
4161
  function mergeResults(batchResults) {
1703
4162
  const files = batchResults.map((r) => ({
@@ -1707,8 +4166,7 @@ function mergeResults(batchResults) {
1707
4166
  }));
1708
4167
  const native = rebuildWorkspaceResultNative(files);
1709
4168
  if (native) return native;
1710
- const unique = new Set(files.flatMap((f) => f.classes));
1711
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
4169
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
1712
4170
  }
1713
4171
  function runChunkInWorker(filePaths) {
1714
4172
  return new Promise((resolve2, reject) => {
@@ -1735,9 +4193,9 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
1735
4193
  maxWorkers = Math.max(1, os.availableParallelism() - 1),
1736
4194
  chunkSize = DEFAULT_CHUNK_SIZE
1737
4195
  } = options;
1738
- const files = collectFiles(path6__namespace.default.resolve(rootDir), extensions, ignoreDirs);
4196
+ const files = collectFiles2(path9__namespace.default.resolve(rootDir), extensions, ignoreDirs);
1739
4197
  if (files.length < PARALLEL_THRESHOLD) {
1740
- return mergeResults(batchExtractClassesNative(files));
4198
+ return mergeResults(batchExtractClassesNative2(files));
1741
4199
  }
1742
4200
  const chunks = [];
1743
4201
  for (let i = 0; i < files.length; i += chunkSize) {
@@ -1754,14 +4212,14 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
1754
4212
  var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
1755
4213
  var init_parallel_scanner = __esm({
1756
4214
  "packages/domain/scanner/src/parallel-scanner.ts"() {
1757
- init_src2();
4215
+ init_src3();
1758
4216
  init_native_bridge();
1759
4217
  PARALLEL_THRESHOLD = 50;
1760
4218
  DEFAULT_CHUNK_SIZE = 150;
1761
4219
  if (!worker_threads.isMainThread && worker_threads.parentPort) {
1762
4220
  const { filePaths } = worker_threads.workerData;
1763
4221
  try {
1764
- const results = batchExtractClassesNative(filePaths);
4222
+ const results = batchExtractClassesNative2(filePaths);
1765
4223
  const msg = { ok: true, results };
1766
4224
  worker_threads.parentPort.postMessage(msg);
1767
4225
  } catch (error) {
@@ -1778,13 +4236,13 @@ var init_parallel_scanner = __esm({
1778
4236
  var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
1779
4237
  var init_schemas = __esm({
1780
4238
  "packages/domain/scanner/src/schemas.ts"() {
1781
- init_src();
1782
- formatIssuePath2 = (path13) => path13.length > 0 ? path13.map(
4239
+ init_src2();
4240
+ formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
1783
4241
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
1784
4242
  ).join(".") : "<root>";
1785
4243
  formatIssues = (error) => error.issues.map((issue) => {
1786
- const path13 = formatIssuePath2(issue.path);
1787
- return `${path13}: ${issue.message}`;
4244
+ const path16 = formatIssuePath2(issue.path);
4245
+ return `${path16}: ${issue.message}`;
1788
4246
  }).join("; ");
1789
4247
  parseWithSchema = (schema, data, label) => {
1790
4248
  const parsed = schema.safeParse(data);
@@ -1845,15 +4303,15 @@ var src_exports2 = {};
1845
4303
  __export(src_exports2, {
1846
4304
  DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
1847
4305
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
1848
- batchExtractClassesNative: () => batchExtractClassesNative,
4306
+ batchExtractClassesNative: () => batchExtractClassesNative2,
1849
4307
  extractClassesNative: () => extractClassesNative,
1850
- isScannableFile: () => isScannableFile,
4308
+ isScannableFile: () => isScannableFile2,
1851
4309
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
1852
4310
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
1853
4311
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
1854
- scanFile: () => scanFile,
4312
+ scanFile: () => scanFile2,
1855
4313
  scanSource: () => scanSource,
1856
- scanWorkspace: () => scanWorkspace,
4314
+ scanWorkspace: () => scanWorkspace2,
1857
4315
  scanWorkspaceAsync: () => scanWorkspaceAsync
1858
4316
  });
1859
4317
  function getRuntimeDir() {
@@ -1861,7 +4319,7 @@ function getRuntimeDir() {
1861
4319
  return __dirname;
1862
4320
  }
1863
4321
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href))) {
1864
- 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('engine.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('engine.js', document.baseURI).href))));
1865
4323
  }
1866
4324
  return process.cwd();
1867
4325
  }
@@ -1871,17 +4329,17 @@ function resolveScannerWorkerModulePath() {
1871
4329
  return __dirname;
1872
4330
  }
1873
4331
  if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href))) {
1874
- 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('engine.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('engine.js', document.baseURI).href))));
1875
4333
  }
1876
4334
  return process.cwd();
1877
4335
  })();
1878
4336
  const candidates = [
1879
- path6__namespace.default.resolve(runtimeDir, "worker.cjs"),
1880
- path6__namespace.default.resolve(runtimeDir, "worker.js"),
1881
- 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")
1882
4340
  ];
1883
4341
  for (const candidate of candidates) {
1884
- if (fs5__namespace.default.existsSync(candidate)) return candidate;
4342
+ if (fs3__namespace.default.existsSync(candidate)) return candidate;
1885
4343
  }
1886
4344
  return null;
1887
4345
  }
@@ -1938,19 +4396,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
1938
4396
  if (!currentDir) continue;
1939
4397
  const entries = (() => {
1940
4398
  try {
1941
- return fs5__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4399
+ return fs3__namespace.default.readdirSync(currentDir, { withFileTypes: true });
1942
4400
  } catch {
1943
4401
  return [];
1944
4402
  }
1945
4403
  })();
1946
4404
  for (const entry of entries) {
1947
- const fullPath = path6__namespace.default.join(currentDir, entry.name);
4405
+ const fullPath = path9__namespace.default.join(currentDir, entry.name);
1948
4406
  if (entry.isDirectory()) {
1949
4407
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
1950
4408
  continue;
1951
4409
  }
1952
4410
  if (!entry.isFile()) continue;
1953
- if (!extensionSet.has(path6__namespace.default.extname(entry.name))) continue;
4411
+ if (!extensionSet.has(path9__namespace.default.extname(entry.name))) continue;
1954
4412
  candidates.push(fullPath);
1955
4413
  }
1956
4414
  }
@@ -1976,12 +4434,12 @@ function scanSource(source) {
1976
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"
1977
4435
  );
1978
4436
  }
1979
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
1980
- return includeExtensions.includes(path6__namespace.default.extname(filePath));
4437
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4438
+ return includeExtensions.includes(path9__namespace.default.extname(filePath));
1981
4439
  }
1982
- function scanFile(filePath) {
1983
- const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
1984
- const result = scanFileNative2(filePath);
4440
+ function scanFile2(filePath) {
4441
+ const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
4442
+ const result = scanFileNative3(filePath);
1985
4443
  if (!result.ok) {
1986
4444
  throw new Error(`scanFile failed for ${filePath}: ${result.error ?? "unknown error"}`);
1987
4445
  }
@@ -1991,7 +4449,7 @@ function scanFile(filePath) {
1991
4449
  ...result.hash ? { hash: result.hash } : {}
1992
4450
  };
1993
4451
  }
1994
- function scanWorkspace(rootDir, options = {}) {
4452
+ function scanWorkspace2(rootDir, options = {}) {
1995
4453
  const normalizedOptions = parseScanWorkspaceOptions(options);
1996
4454
  const includeExtensions = normalizedOptions.includeExtensions ?? DEFAULT_EXTENSIONS;
1997
4455
  const extensionSet = buildExtensionSet(includeExtensions);
@@ -2025,7 +4483,7 @@ function scanWorkspace(rootDir, options = {}) {
2025
4483
  try {
2026
4484
  return readCache(rootDir, normalizedOptions.cacheDir);
2027
4485
  } catch (error) {
2028
- log2.debug(
4486
+ log3.debug(
2029
4487
  `cache read failed, continuing without persisted cache: ${error instanceof Error ? error.message : String(error)}`
2030
4488
  );
2031
4489
  return [];
@@ -2037,7 +4495,7 @@ function scanWorkspace(rootDir, options = {}) {
2037
4495
  for (const filePath of candidates) {
2038
4496
  const stat = (() => {
2039
4497
  try {
2040
- return fs5__namespace.default.statSync(filePath);
4498
+ return fs3__namespace.default.statSync(filePath);
2041
4499
  } catch {
2042
4500
  return null;
2043
4501
  }
@@ -2063,7 +4521,7 @@ function scanWorkspace(rootDir, options = {}) {
2063
4521
  for (const { filePath, stat, size, cached } of ranked) {
2064
4522
  const content = (() => {
2065
4523
  try {
2066
- return fs5__namespace.default.readFileSync(filePath, "utf8");
4524
+ return fs3__namespace.default.readFileSync(filePath, "utf8");
2067
4525
  } catch {
2068
4526
  return null;
2069
4527
  }
@@ -2071,7 +4529,7 @@ function scanWorkspace(rootDir, options = {}) {
2071
4529
  if (!content) continue;
2072
4530
  const hash = hashContentNative(content);
2073
4531
  if (cached && cached.hash === hash && cached.mtimeMs === stat.mtimeMs && cached.size === size) {
2074
- log2.debug(`cache HIT ${filePath}`);
4532
+ log3.debug(`cache HIT ${filePath}`);
2075
4533
  processResult({ file: filePath, classes: cached.classes });
2076
4534
  updatedEntries.push({
2077
4535
  file: filePath,
@@ -2083,7 +4541,7 @@ function scanWorkspace(rootDir, options = {}) {
2083
4541
  });
2084
4542
  continue;
2085
4543
  }
2086
- log2.debug(`cache MISS ${filePath}`);
4544
+ log3.debug(`cache MISS ${filePath}`);
2087
4545
  const classes = scanSource(content);
2088
4546
  processResult({ file: filePath, classes });
2089
4547
  updatedEntries.push({
@@ -2098,7 +4556,7 @@ function scanWorkspace(rootDir, options = {}) {
2098
4556
  try {
2099
4557
  writeCache(rootDir, updatedEntries, normalizedOptions.cacheDir);
2100
4558
  } catch (error) {
2101
- log2.debug(`cache write failed: ${error instanceof Error ? error.message : String(error)}`);
4559
+ log3.debug(`cache write failed: ${error instanceof Error ? error.message : String(error)}`);
2102
4560
  }
2103
4561
  return parseScanWorkspaceResult({
2104
4562
  files,
@@ -2114,7 +4572,7 @@ function scanWorkspace(rootDir, options = {}) {
2114
4572
  }
2115
4573
  } else {
2116
4574
  for (const filePath of candidates) {
2117
- processResult(scanFile(filePath));
4575
+ processResult(scanFile2(filePath));
2118
4576
  }
2119
4577
  }
2120
4578
  return parseScanWorkspaceResult({
@@ -2131,30 +4589,30 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
2131
4589
  ignoreDirs: normalizedOptions.ignoreDirectories
2132
4590
  });
2133
4591
  } catch (parallelError) {
2134
- log2.debug(
4592
+ log3.debug(
2135
4593
  `parallel scan failed, retrying with single worker: ${parallelError instanceof Error ? parallelError.message : String(parallelError)}`
2136
4594
  );
2137
4595
  }
2138
4596
  try {
2139
4597
  return await scanWorkspaceInWorker(rootDir, normalizedOptions);
2140
4598
  } catch (error) {
2141
- log2.debug(
4599
+ log3.debug(
2142
4600
  `worker scan failed, retrying with sync native scanner: ${error instanceof Error ? error.message : String(error)}`
2143
4601
  );
2144
- return scanWorkspace(rootDir, normalizedOptions);
4602
+ return scanWorkspace2(rootDir, normalizedOptions);
2145
4603
  }
2146
4604
  }
2147
- var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
2148
- var init_src2 = __esm({
4605
+ var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
4606
+ var init_src3 = __esm({
2149
4607
  "packages/domain/scanner/src/index.ts"() {
2150
- init_src();
4608
+ init_src2();
2151
4609
  init_cache_native();
2152
4610
  init_native_bridge();
2153
4611
  init_parallel_scanner();
2154
4612
  init_schemas();
2155
4613
  init_schemas();
2156
4614
  init_native_bridge();
2157
- log2 = createLogger("scanner");
4615
+ log3 = createLogger2("scanner");
2158
4616
  SCAN_WORKER_TIMEOUT_MS = 12e4;
2159
4617
  createNativeParserLoader = () => {
2160
4618
  const _state = {
@@ -2162,12 +4620,12 @@ var init_src2 = __esm({
2162
4620
  initError: null
2163
4621
  };
2164
4622
  const debugNative = (message) => {
2165
- log2.debug(`[native] ${message}`);
4623
+ log3.debug(`[native] ${message}`);
2166
4624
  };
2167
4625
  const loadNativeParserBinding = () => {
2168
4626
  if (_state.binding !== void 0) return _state.binding;
2169
4627
  const runtimeDir = getRuntimeDir();
2170
- 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"));
2171
4629
  const _platform = process.platform;
2172
4630
  const _arch = process.arch;
2173
4631
  const _platformArch = `${_platform}-${_arch}`;
@@ -2175,27 +4633,27 @@ var init_src2 = __esm({
2175
4633
  const candidates = [
2176
4634
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
2177
4635
  // cwd = repo root saat run dari root, atau package dir saat workspaces
2178
- path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
2179
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
2180
- 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`),
2181
4639
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
2182
4640
  // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
2183
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
2184
- path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
2185
- 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`),
2186
4644
  // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
2187
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
2188
- 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`),
2189
4647
  // 3 level fallback (jika package di-nest lebih dangkal)
2190
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
2191
- 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`),
2192
4650
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
2193
- path6__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
2194
- path6__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
2195
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
2196
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
2197
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
2198
- 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(
2199
4657
  runtimeDir,
2200
4658
  "..",
2201
4659
  "..",
@@ -2207,7 +4665,7 @@ var init_src2 = __esm({
2207
4665
  )
2208
4666
  ];
2209
4667
  for (const fullPath of candidates) {
2210
- if (!fs5__namespace.default.existsSync(fullPath)) continue;
4668
+ if (!fs3__namespace.default.existsSync(fullPath)) continue;
2211
4669
  try {
2212
4670
  const required = req(fullPath);
2213
4671
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -2240,168 +4698,6 @@ var init_src2 = __esm({
2240
4698
  }
2241
4699
  });
2242
4700
 
2243
- // packages/domain/compiler/src/nativeBridge.ts
2244
- var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
2245
- var init_nativeBridge = __esm({
2246
- "packages/domain/compiler/src/nativeBridge.ts"() {
2247
- init_src();
2248
- _loadNative = (path13) => __require(path13);
2249
- log3 = (...args) => {
2250
- if (process.env.DEBUG?.includes("compiler:native")) {
2251
- console.log("[compiler:native]", ...args);
2252
- }
2253
- };
2254
- NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/compiler v5] Native binding is required but not available.\nThis package requires native Rust bindings. There is no JavaScript fallback.\nPlease ensure:\n 1. The native module is properly installed\n 2. You have run: npm run build:rust (or use prebuilt binary)\n\nFor help, see: https://tailwind-styled.dev/docs/install";
2255
- nativeBridge = null;
2256
- bridgeLoadAttempted = false;
2257
- bridgeLoadError = null;
2258
- isValidNativeBridge = (mod) => {
2259
- const m = mod;
2260
- return !!(typeof m.transformSource === "function" || typeof m.extractAllClasses === "function" || typeof m.hasTwUsage === "function");
2261
- };
2262
- getNativeBridge = () => {
2263
- if (nativeBridge) {
2264
- return nativeBridge;
2265
- }
2266
- if (bridgeLoadAttempted) {
2267
- if (bridgeLoadError) {
2268
- throw bridgeLoadError;
2269
- }
2270
- throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
2271
- }
2272
- bridgeLoadAttempted = true;
2273
- try {
2274
- const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
2275
- const result = resolveNativeBinary(runtimeDir);
2276
- if (result.path && result.path.endsWith(".node")) {
2277
- try {
2278
- const binding = _loadNative(result.path);
2279
- if (isValidNativeBridge(binding)) {
2280
- nativeBridge = binding;
2281
- log3("Native bridge loaded successfully from:", result.path);
2282
- return nativeBridge;
2283
- }
2284
- } catch (e) {
2285
- log3("Failed to require native binding:", e);
2286
- }
2287
- }
2288
- throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
2289
-
2290
- Tried paths: ${result.tried.join("\n")}`);
2291
- } catch (err) {
2292
- bridgeLoadError = err instanceof Error ? err : new Error(String(err));
2293
- log3("Failed to load native bridge:", bridgeLoadError.message);
2294
- throw bridgeLoadError;
2295
- }
2296
- };
2297
- if (typeof process !== "undefined" && !bridgeLoadAttempted) {
2298
- try {
2299
- getNativeBridge();
2300
- } catch {
2301
- }
2302
- }
2303
- }
2304
- });
2305
-
2306
- // packages/domain/compiler/src/tailwindEngine.ts
2307
- var tailwindEngine_exports = {};
2308
- __export(tailwindEngine_exports, {
2309
- generateRawCss: () => generateRawCss,
2310
- processTailwindCssWithTargets: () => processTailwindCssWithTargets,
2311
- runCssPipeline: () => runCssPipeline,
2312
- runCssPipelineSync: () => runCssPipelineSync
2313
- });
2314
- function loadTailwindEngine() {
2315
- if (_twEngine) return _twEngine;
2316
- if (_twEngineError) throw _twEngineError;
2317
- try {
2318
- const tw = require2("tailwindcss");
2319
- if (typeof tw.compile !== "function") {
2320
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
2321
- }
2322
- _twEngine = tw;
2323
- return _twEngine;
2324
- } catch (e) {
2325
- _twEngineError = e instanceof Error ? e : new Error(String(e));
2326
- throw _twEngineError;
2327
- }
2328
- }
2329
- async function generateRawCss(classes, cssEntryContent, root) {
2330
- if (classes.length === 0) return "";
2331
- const tw = loadTailwindEngine();
2332
- const input = cssEntryContent ?? "@import 'tailwindcss';";
2333
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
2334
- const { dirname, resolve: resolve2 } = await import('path');
2335
- const projectRoot = root ?? process.cwd();
2336
- const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
2337
- const loadStylesheet = async (id, base) => {
2338
- try {
2339
- 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;
2340
- const pkgPath = req.resolve(cssId);
2341
- return {
2342
- content: readFileSync(pkgPath, "utf-8"),
2343
- base: dirname(pkgPath)
2344
- };
2345
- } catch {
2346
- try {
2347
- const absPath = resolve2(base, id);
2348
- if (existsSync3(absPath)) {
2349
- return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
2350
- }
2351
- } catch {
2352
- }
2353
- return { content: "", base };
2354
- }
2355
- };
2356
- const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
2357
- return compiler.build(classes);
2358
- }
2359
- function postProcessWithLightning(rawCss) {
2360
- if (!rawCss) return "";
2361
- const native = getNativeBridge();
2362
- if (typeof native.processTailwindCssLightning !== "function") {
2363
- throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
2364
- }
2365
- const result = native.processTailwindCssLightning(rawCss);
2366
- return result?.css ?? rawCss;
2367
- }
2368
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
2369
- const unique = [...new Set(classes.filter(Boolean))];
2370
- if (unique.length === 0) {
2371
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
2372
- }
2373
- const rawCss = await generateRawCss(unique, cssEntryContent, root);
2374
- const native = getNativeBridge();
2375
- const hasLightning = minify && typeof native.processTailwindCssLightning === "function";
2376
- const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
2377
- return {
2378
- css: finalCss,
2379
- classes: unique,
2380
- sizeBytes: finalCss.length,
2381
- optimized: hasLightning
2382
- };
2383
- }
2384
- function runCssPipelineSync(_classes) {
2385
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
2386
- }
2387
- function processTailwindCssWithTargets(css, targets) {
2388
- const native = getNativeBridge();
2389
- if (!native?.processTailwindCssWithTargets) {
2390
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
2391
- }
2392
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
2393
- return (result?.css ?? css).trim();
2394
- }
2395
- var require2, _twEngine, _twEngineError;
2396
- var init_tailwindEngine = __esm({
2397
- "packages/domain/compiler/src/tailwindEngine.ts"() {
2398
- init_nativeBridge();
2399
- require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
2400
- _twEngine = null;
2401
- _twEngineError = null;
2402
- }
2403
- });
2404
-
2405
4701
  // packages/domain/engine/src/native-bridge.ts
2406
4702
  function getDirname3() {
2407
4703
  if (typeof __dirname !== "undefined") return __dirname;
@@ -2416,7 +4712,7 @@ function getNativeEngineBinding() {
2416
4712
  var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
2417
4713
  var init_native_bridge2 = __esm({
2418
4714
  "packages/domain/engine/src/native-bridge.ts"() {
2419
- init_src();
4715
+ init_src2();
2420
4716
  log4 = createDebugLogger("engine:native");
2421
4717
  isValidEngineBinding = (module) => {
2422
4718
  const candidate = module;
@@ -2495,49 +4791,40 @@ var init_native_bridge2 = __esm({
2495
4791
  });
2496
4792
 
2497
4793
  // packages/domain/engine/src/ir.ts
2498
- function registerPropertyName(id, name) {
4794
+ function registerPropertyName2(id, name) {
2499
4795
  const native = getNativeEngineBinding();
2500
- if (native?.registerPropertyName) {
2501
- native.registerPropertyName(id.value, name);
2502
- return;
4796
+ if (!native?.registerPropertyName) {
4797
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
2503
4798
  }
2504
- _propertyNamesFallback.set(id.value, name);
4799
+ native.registerPropertyName(id.value, name);
2505
4800
  }
2506
- function registerValueName(id, name) {
4801
+ function registerValueName2(id, name) {
2507
4802
  const native = getNativeEngineBinding();
2508
- if (native?.registerValueName) {
2509
- native.registerValueName(id.value, name);
2510
- return;
4803
+ if (!native?.registerValueName) {
4804
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
2511
4805
  }
2512
- _valueNamesFallback.set(id.value, name);
4806
+ native.registerValueName(id.value, name);
2513
4807
  }
2514
- function propertyIdToString(id) {
4808
+ function propertyIdToString2(id) {
2515
4809
  const native = getNativeEngineBinding();
2516
- if (native?.propertyIdToString) {
2517
- return native.propertyIdToString(id.value);
4810
+ if (!native?.propertyIdToString) {
4811
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
2518
4812
  }
2519
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
4813
+ return native.propertyIdToString(id.value);
2520
4814
  }
2521
- function valueIdToString(id) {
4815
+ function valueIdToString2(id) {
2522
4816
  const native = getNativeEngineBinding();
2523
- if (native?.valueIdToString) {
2524
- return native.valueIdToString(id.value);
4817
+ if (!native?.valueIdToString) {
4818
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
2525
4819
  }
2526
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
4820
+ return native.valueIdToString(id.value);
2527
4821
  }
2528
- function createFingerprintFallback(parts) {
2529
- const hash = parts.reduce(
2530
- (acc, part) => part.split("").reduce((h, char) => (h << 5) - h + char.charCodeAt(0) & h, acc),
2531
- 0
2532
- );
2533
- return Math.abs(hash).toString(36);
2534
- }
2535
- function createFingerprint(parts) {
4822
+ function createFingerprint2(parts) {
2536
4823
  const native = getNativeEngineBinding();
2537
- if (native?.createFingerprint) {
2538
- return native.createFingerprint(parts);
4824
+ if (!native?.createFingerprint) {
4825
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
2539
4826
  }
2540
- return createFingerprintFallback(parts);
4827
+ return native.createFingerprint(parts);
2541
4828
  }
2542
4829
  function createResolutionReason(causes, finalDecision) {
2543
4830
  return {
@@ -2545,7 +4832,7 @@ function createResolutionReason(causes, finalDecision) {
2545
4832
  finalDecision
2546
4833
  };
2547
4834
  }
2548
- exports.RuleId = void 0; exports.SelectorId = void 0; exports.VariantChainId = void 0; exports.PropertyId = void 0; exports.ValueId = void 0; exports.LayerId = void 0; exports.ConditionId = void 0; exports.CascadeResolutionId = void 0; var _propertyNamesFallback, _valueNamesFallback; exports.Origin = void 0; exports.Importance = void 0; exports.ConditionResult = void 0; exports.CascadeStage = void 0;
4835
+ exports.RuleId = void 0; exports.SelectorId = void 0; exports.VariantChainId = void 0; exports.PropertyId = void 0; exports.ValueId = void 0; exports.LayerId = void 0; exports.ConditionId = void 0; exports.CascadeResolutionId = void 0; exports.Origin = void 0; exports.Importance = void 0; exports.ConditionResult = void 0; exports.CascadeStage = void 0;
2549
4836
  var init_ir = __esm({
2550
4837
  "packages/domain/engine/src/ir.ts"() {
2551
4838
  init_native_bridge2();
@@ -2588,7 +4875,7 @@ var init_ir = __esm({
2588
4875
  if (typeof name === "string" && name.length > 0) {
2589
4876
  return name;
2590
4877
  }
2591
- return propertyIdToString(this);
4878
+ return propertyIdToString2(this);
2592
4879
  }
2593
4880
  };
2594
4881
  exports.ValueId = class {
@@ -2603,7 +4890,7 @@ var init_ir = __esm({
2603
4890
  if (typeof name === "string" && name.length > 0) {
2604
4891
  return name;
2605
4892
  }
2606
- return valueIdToString(this);
4893
+ return valueIdToString2(this);
2607
4894
  }
2608
4895
  };
2609
4896
  exports.LayerId = class {
@@ -2633,8 +4920,6 @@ var init_ir = __esm({
2633
4920
  return `R${this.value}`;
2634
4921
  }
2635
4922
  };
2636
- _propertyNamesFallback = /* @__PURE__ */ new Map();
2637
- _valueNamesFallback = /* @__PURE__ */ new Map();
2638
4923
  exports.Origin = /* @__PURE__ */ ((Origin2) => {
2639
4924
  Origin2[Origin2["UserAgent"] = 0] = "UserAgent";
2640
4925
  Origin2[Origin2["UserNormal"] = 1] = "UserNormal";
@@ -2813,12 +5098,12 @@ function createIdGenerator() {
2813
5098
  generateSelectorId: () => new exports.SelectorId(state.selectorIdCounter++),
2814
5099
  generatePropertyId: (name) => {
2815
5100
  const id = new exports.PropertyId(state.propertyIdCounter++);
2816
- registerPropertyName(id, name);
5101
+ registerPropertyName2(id, name);
2817
5102
  return id;
2818
5103
  },
2819
5104
  generateValueId: (name) => {
2820
5105
  const id = new exports.ValueId(state.valueIdCounter++);
2821
- registerValueName(id, name);
5106
+ registerValueName2(id, name);
2822
5107
  return id;
2823
5108
  },
2824
5109
  generateLayerId: () => new exports.LayerId(state.layerIdCounter++),
@@ -2848,14 +5133,68 @@ function detectLayerFromClassName(className) {
2848
5133
  return null;
2849
5134
  }
2850
5135
  function parseCssToIr(css, options = {}) {
2851
- resetIdGenerator();
5136
+ const native = getNativeEngineBinding();
5137
+ const prefix = options.prefix ?? "";
5138
+ if (native?.assembleCssIr) {
5139
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
5140
+ }
5141
+ return _parseCssToIrFallback(css, prefix, native);
5142
+ }
5143
+ function _parseCssToIrFast(assembled) {
5144
+ const native = getNativeEngineBinding();
2852
5145
  layerMap.clear();
2853
5146
  layerOrderMap.clear();
2854
- const native = getNativeEngineBinding();
5147
+ for (const le of assembled.layers) {
5148
+ const lid = new exports.LayerId(le.layerId);
5149
+ layerMap.set(le.name, lid);
5150
+ layerOrderMap.set(le.name, le.order);
5151
+ }
5152
+ const rules = assembled.rules.map((r) => {
5153
+ const propertyId = new exports.PropertyId(r.propertyId);
5154
+ const valueId = new exports.ValueId(r.valueId);
5155
+ if (native?.registerPropertyName) {
5156
+ native.registerPropertyName(r.propertyId, r.propertyName);
5157
+ } else {
5158
+ registerPropertyName2(propertyId, r.propertyName);
5159
+ }
5160
+ if (native?.registerValueName) {
5161
+ native.registerValueName(r.valueId, r.valueName);
5162
+ } else {
5163
+ registerValueName2(valueId, r.valueName);
5164
+ }
5165
+ return {
5166
+ id: new exports.RuleId(r.ruleId),
5167
+ selector: new exports.SelectorId(r.selectorId),
5168
+ variantChain: new exports.VariantChainId(0),
5169
+ property: propertyId,
5170
+ value: valueId,
5171
+ origin: r.origin,
5172
+ importance: r.importance,
5173
+ layer: r.layerId >= 0 ? new exports.LayerId(r.layerId) : null,
5174
+ layerOrder: r.layerOrder,
5175
+ specificity: r.specificity,
5176
+ condition: r.conditionId >= 0 ? new exports.ConditionId(r.conditionId) : null,
5177
+ conditionResult: r.conditionResult,
5178
+ insertionOrder: r.insertionOrder,
5179
+ fingerprint: r.fingerprint,
5180
+ source: { file: "", line: 1, column: 1 }
5181
+ };
5182
+ });
5183
+ const classToRuleIds = new Map(
5184
+ assembled.classToRuleIds.map((m) => [
5185
+ m.className,
5186
+ m.ruleIds.map((id) => new exports.RuleId(id))
5187
+ ])
5188
+ );
5189
+ return { rules, classToRuleIds };
5190
+ }
5191
+ function _parseCssToIrFallback(css, prefix, native) {
2855
5192
  if (!native?.parseCssRules) {
2856
5193
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
2857
5194
  }
2858
- const prefix = options.prefix ?? "";
5195
+ resetIdGenerator();
5196
+ layerMap.clear();
5197
+ layerOrderMap.clear();
2859
5198
  const rules = [];
2860
5199
  const classToRuleIds = /* @__PURE__ */ new Map();
2861
5200
  const parsed = native.parseCssRules(css);
@@ -2870,9 +5209,9 @@ function parseCssToIr(css, options = {}) {
2870
5209
  const valueId = generateValueId(r.value);
2871
5210
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
2872
5211
  const conditionId = hasMedia ? generateConditionId() : null;
2873
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
5212
+ const conditionResult = 2 /* Unknown */;
2874
5213
  const ruleId = generateRuleId();
2875
- const fingerprint = createFingerprint([className, r.property, r.value]);
5214
+ const fingerprint = createFingerprint2([className, r.property, r.value]);
2876
5215
  const rule = {
2877
5216
  id: ruleId,
2878
5217
  selector: selectorId,
@@ -2884,7 +5223,6 @@ function parseCssToIr(css, options = {}) {
2884
5223
  layer,
2885
5224
  layerOrder,
2886
5225
  specificity: r.specificity,
2887
- // from native — no JS recalculation
2888
5226
  condition: conditionId,
2889
5227
  conditionResult,
2890
5228
  insertionOrder: getNextInsertionOrder(),
@@ -3038,13 +5376,13 @@ var init_trace2 = __esm({
3038
5376
  });
3039
5377
 
3040
5378
  // packages/domain/analyzer/src/analyzeWorkspace.ts
3041
- init_src2();
5379
+ init_src3();
3042
5380
 
3043
5381
  // packages/domain/analyzer/src/binding.ts
3044
- init_src();
5382
+ init_src2();
3045
5383
 
3046
5384
  // packages/domain/analyzer/src/utils.ts
3047
- init_src();
5385
+ init_src2();
3048
5386
  var DEFAULT_TOP_LIMIT = 10;
3049
5387
  var DEFAULT_FREQUENT_THRESHOLD = 2;
3050
5388
  var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
@@ -3058,7 +5396,7 @@ function isRecord(value) {
3058
5396
  }
3059
5397
  async function pathExists(filePath) {
3060
5398
  try {
3061
- await fs5__namespace.default.promises.access(filePath, fs5__namespace.default.constants.F_OK);
5399
+ await fs3__namespace.default.promises.access(filePath, fs3__namespace.default.constants.F_OK);
3062
5400
  return true;
3063
5401
  } catch {
3064
5402
  return false;
@@ -3156,8 +5494,8 @@ async function requireNativeBinding() {
3156
5494
  }
3157
5495
 
3158
5496
  // packages/domain/analyzer/src/schemas.ts
3159
- init_src();
3160
- var formatIssuePath3 = (path13) => path13.length > 0 ? path13.map(
5497
+ init_src2();
5498
+ var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
3161
5499
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3162
5500
  ).join(".") : "<root>";
3163
5501
  var isPlainObject = (value) => {
@@ -3166,8 +5504,8 @@ var isPlainObject = (value) => {
3166
5504
  return proto === Object.prototype || proto === null;
3167
5505
  };
3168
5506
  var formatIssues2 = (error) => error.issues.map((issue) => {
3169
- const path13 = formatIssuePath3(issue.path);
3170
- return `${path13}: ${issue.message}`;
5507
+ const path16 = formatIssuePath3(issue.path);
5508
+ return `${path16}: ${issue.message}`;
3171
5509
  }).join("; ");
3172
5510
  var parseWithSchema2 = (schema, data, label) => {
3173
5511
  const parsed = schema.safeParse(data);
@@ -3257,7 +5595,7 @@ var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema,
3257
5595
  var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
3258
5596
  var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
3259
5597
  var tailwindConfigCache = /* @__PURE__ */ new Map();
3260
- var detectConflicts = async (usages) => {
5598
+ var detectConflicts2 = async (usages) => {
3261
5599
  const native = await getNativeBinding();
3262
5600
  if (!native?.detectClassConflicts) {
3263
5601
  throw new Error("FATAL: Native binding 'detectClassConflicts' is required but not available.");
@@ -3274,11 +5612,11 @@ var detectConflicts = async (usages) => {
3274
5612
  };
3275
5613
  };
3276
5614
  var isSupportedTailwindConfigPath = (configPath) => {
3277
- return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path6__namespace.default.extname(configPath).toLowerCase());
5615
+ return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path9__namespace.default.extname(configPath).toLowerCase());
3278
5616
  };
3279
5617
  var resolveTailwindConfigPath = async (root, explicitPath) => {
3280
5618
  if (explicitPath) {
3281
- const resolved = path6__namespace.default.resolve(root, explicitPath);
5619
+ const resolved = path9__namespace.default.resolve(root, explicitPath);
3282
5620
  if (!await pathExists(resolved)) return null;
3283
5621
  return resolved;
3284
5622
  }
@@ -3289,7 +5627,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
3289
5627
  "tailwind.config.mjs"
3290
5628
  ];
3291
5629
  for (const candidate of candidates) {
3292
- const fullPath = path6__namespace.default.resolve(root, candidate);
5630
+ const fullPath = path9__namespace.default.resolve(root, candidate);
3293
5631
  if (await pathExists(fullPath)) return fullPath;
3294
5632
  }
3295
5633
  return null;
@@ -3343,8 +5681,8 @@ var collectCustomUtilities = (config) => {
3343
5681
  return out;
3344
5682
  };
3345
5683
  var collectSafelistFromSource = async (configPath) => {
3346
- const source = await fs5__namespace.default.promises.readFile(configPath, "utf8");
3347
- const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
5684
+ const source = await fs3__namespace.default.promises.readFile(configPath, "utf8");
5685
+ const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
3348
5686
  const allTokens = extractClassesNative2(source);
3349
5687
  const hasSafelist = source.includes("safelist");
3350
5688
  if (!hasSafelist) return [];
@@ -3357,7 +5695,7 @@ var collectSafelistFromSource = async (configPath) => {
3357
5695
  }
3358
5696
  return allTokens.filter((t) => safelistSet.has(t));
3359
5697
  };
3360
- var loadTailwindConfig = async (root, semanticOption) => {
5698
+ var loadTailwindConfig2 = async (root, semanticOption) => {
3361
5699
  const startMs = Date.now();
3362
5700
  const configPath = await resolveTailwindConfigPath(root, semanticOption?.tailwindConfigPath);
3363
5701
  if (!configPath) return null;
@@ -3370,7 +5708,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
3370
5708
  customUtilities: /* @__PURE__ */ new Set()
3371
5709
  };
3372
5710
  }
3373
- const configStat = await fs5__namespace.default.promises.stat(configPath).catch(() => null);
5711
+ const configStat = await fs3__namespace.default.promises.stat(configPath).catch(() => null);
3374
5712
  if (configStat) {
3375
5713
  const cached = tailwindConfigCache.get(configPath);
3376
5714
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -3438,7 +5776,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
3438
5776
  return loaded;
3439
5777
  };
3440
5778
  var buildSemanticReport = async (usages, root, semanticOption) => {
3441
- const loadedConfig = await loadTailwindConfig(root, semanticOption);
5779
+ const loadedConfig = await loadTailwindConfig2(root, semanticOption);
3442
5780
  const safelist = loadedConfig?.safelist ?? /* @__PURE__ */ new Set();
3443
5781
  const customUtilities = loadedConfig?.customUtilities ?? /* @__PURE__ */ new Set();
3444
5782
  const usageNames = new Set(usages.map((usage) => usage.name));
@@ -3457,7 +5795,7 @@ var buildSemanticReport = async (usages, root, semanticOption) => {
3457
5795
  results.filter((r) => !r.isKnown).map((r) => r.className)
3458
5796
  );
3459
5797
  const unknownClasses = usages.filter((usage) => unknownSet.has(usage.name)).map((usage) => ({ ...usage, isUnused: true }));
3460
- const { conflicts } = await detectConflicts(usages);
5798
+ const { conflicts } = await detectConflicts2(usages);
3461
5799
  return {
3462
5800
  unusedClasses,
3463
5801
  unknownClasses,
@@ -3529,7 +5867,7 @@ async function buildDistribution(usages, native) {
3529
5867
  }
3530
5868
  async function analyzeWorkspace(root, options = {}) {
3531
5869
  const startedAtMs = Date.now();
3532
- const resolvedRoot = path6__namespace.default.resolve(root);
5870
+ const resolvedRoot = path9__namespace.default.resolve(root);
3533
5871
  const normalizedOptions = parseAnalyzerOptions(options);
3534
5872
  const scan = await (async () => {
3535
5873
  const scanStartedAtMs = Date.now();
@@ -3631,37 +5969,18 @@ async function analyzeWorkspace(root, options = {}) {
3631
5969
  };
3632
5970
  }
3633
5971
 
3634
- // packages/domain/compiler/src/index.ts
3635
- init_nativeBridge();
3636
- var generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
3637
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
3638
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
3639
- return result.css;
3640
- };
3641
- var mergeClassesStatic = (classes) => {
3642
- const result = normalizeAndDedupClasses(classes);
3643
- return result?.normalized || "";
3644
- };
3645
- var normalizeAndDedupClasses = (raw) => {
3646
- const native = getNativeBridge();
3647
- if (!native?.normalizeAndDedupClasses) {
3648
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
3649
- }
3650
- const result = native.normalizeAndDedupClasses(raw);
3651
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
3652
- };
3653
-
3654
5972
  // packages/domain/engine/src/index.ts
5973
+ init_internal();
5974
+ init_src3();
3655
5975
  init_src2();
3656
- init_src();
3657
5976
 
3658
5977
  // packages/domain/engine/src/incremental.ts
5978
+ init_src3();
3659
5979
  init_src2();
3660
- init_src();
3661
5980
  init_native_bridge2();
3662
5981
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
3663
- var log5 = createLogger("engine:incremental");
3664
- function rebuildWorkspaceResult(byFile) {
5982
+ var log5 = createLogger2("engine:incremental");
5983
+ function rebuildWorkspaceResult2(byFile) {
3665
5984
  const files = Array.from(byFile.values());
3666
5985
  const native = getNativeEngineBinding();
3667
5986
  if (native?.rebuildWorkspaceResult) {
@@ -3690,9 +6009,9 @@ function areClassSetsEqual(a, b) {
3690
6009
  }
3691
6010
  function applyIncrementalChange(previous, filePath, type, scanner) {
3692
6011
  const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
3693
- if (!isScannableFile(filePath, includeExtensions)) return previous;
3694
- const byFile = new Map(previous.files.map((f) => [path6__namespace.default.resolve(f.file), f]));
3695
- const normalizedPath = path6__namespace.default.resolve(filePath);
6012
+ if (!isScannableFile2(filePath, includeExtensions)) return previous;
6013
+ const byFile = new Map(previous.files.map((f) => [path9__namespace.default.resolve(f.file), f]));
6014
+ const normalizedPath = path9__namespace.default.resolve(filePath);
3696
6015
  const native = getNativeEngineBinding();
3697
6016
  if (!native?.processFileChange) {
3698
6017
  throw new Error(
@@ -3704,11 +6023,11 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
3704
6023
  log5.debug(`native unlink ${normalizedPath}`);
3705
6024
  native.processFileChange(normalizedPath, existing2?.classes ?? [], null);
3706
6025
  byFile.delete(normalizedPath);
3707
- return rebuildWorkspaceResult(byFile);
6026
+ return rebuildWorkspaceResult2(byFile);
3708
6027
  }
3709
6028
  log5.debug(`native change ${normalizedPath}`);
3710
- const scanned = scanFile(normalizedPath);
3711
- const content = fs5__namespace.default.readFileSync(normalizedPath, "utf8");
6029
+ const scanned = scanFile2(normalizedPath);
6030
+ const content = fs3__namespace.default.readFileSync(normalizedPath, "utf8");
3712
6031
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
3713
6032
  const existing = byFile.get(normalizedPath);
3714
6033
  if (diff && existing) {
@@ -3720,7 +6039,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
3720
6039
  log5.debug(`native diff cold-sync ${normalizedPath}`);
3721
6040
  byFile.set(normalizedPath, { file: normalizedPath, classes: scanned.classes });
3722
6041
  }
3723
- return rebuildWorkspaceResult(byFile);
6042
+ return rebuildWorkspaceResult2(byFile);
3724
6043
  }
3725
6044
 
3726
6045
  // packages/domain/engine/src/impactTracker.ts
@@ -4053,13 +6372,13 @@ var EngineMetricsCollector = class {
4053
6372
  };
4054
6373
 
4055
6374
  // packages/domain/engine/src/metricsWriter.ts
4056
- init_src();
6375
+ init_src2();
4057
6376
  var METRICS_FILE_NAME = "metrics.json";
4058
6377
  var CACHE_DIR = ".tw-cache";
4059
6378
  function writeMetrics(metrics, cwd = process.cwd()) {
4060
6379
  try {
4061
- const cacheDir = path6__namespace.default.join(cwd, CACHE_DIR);
4062
- fs5__namespace.default.mkdirSync(cacheDir, { recursive: true });
6380
+ const cacheDir = path9__namespace.default.join(cwd, CACHE_DIR);
6381
+ fs3__namespace.default.mkdirSync(cacheDir, { recursive: true });
4063
6382
  const mem = process.memoryUsage();
4064
6383
  const data = {
4065
6384
  ...metrics,
@@ -4070,7 +6389,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
4070
6389
  },
4071
6390
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
4072
6391
  };
4073
- fs5__namespace.default.writeFileSync(path6__namespace.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
6392
+ fs3__namespace.default.writeFileSync(path9__namespace.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
4074
6393
  } catch {
4075
6394
  }
4076
6395
  }
@@ -4177,19 +6496,19 @@ var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, opti
4177
6496
  var parseEngineWatchOptions = (options) => parseWithSchema3(EngineWatchOptionsSchema, options ?? {}, "engine watch options are invalid");
4178
6497
 
4179
6498
  // packages/domain/engine/src/watch.ts
4180
- var _native = null;
6499
+ var _native2 = null;
4181
6500
  function getNativeWatcher() {
4182
- if (_native !== null) return _native;
6501
+ if (_native2 !== null) return _native2;
4183
6502
  try {
4184
- const { resolveNativeBinary: resolveNativeBinary2 } = (init_src(), __toCommonJS(src_exports));
6503
+ const { resolveNativeBinary: resolveNativeBinary2 } = (init_src2(), __toCommonJS(src_exports));
4185
6504
  const { path: binPath } = resolveNativeBinary2(__dirname);
4186
6505
  if (binPath) {
4187
- _native = __require(binPath);
6506
+ _native2 = __require(binPath);
4188
6507
  }
4189
6508
  } catch {
4190
- _native = {};
6509
+ _native2 = {};
4191
6510
  }
4192
- return _native;
6511
+ return _native2;
4193
6512
  }
4194
6513
  function watchWorkspaceNative(rootDir, onEvent, options) {
4195
6514
  const native = getNativeWatcher();
@@ -4253,7 +6572,7 @@ init_ir();
4253
6572
 
4254
6573
  // packages/domain/engine/src/reverseLookup.ts
4255
6574
  init_native_bridge2();
4256
- function getNative() {
6575
+ function getNative2() {
4257
6576
  const native = getNativeEngineBinding();
4258
6577
  if (!native?.reverseLookupFromCss || !native?.reverseLookupByProperty || !native?.reverseLookupFindDependents) {
4259
6578
  throw new Error(
@@ -4278,15 +6597,15 @@ function normaliseNativeResults(raw) {
4278
6597
  var ReverseLookup = class {
4279
6598
  fromCSS(cssProperty, cssValue, css) {
4280
6599
  if (!css || !cssProperty) return [];
4281
- return normaliseNativeResults(getNative().reverseLookupFromCss(css, cssProperty, cssValue));
6600
+ return normaliseNativeResults(getNative2().reverseLookupFromCss(css, cssProperty, cssValue));
4282
6601
  }
4283
6602
  findByProperty(property, css) {
4284
6603
  if (!css || !property) return [];
4285
- return normaliseNativeResults(getNative().reverseLookupByProperty(css, property));
6604
+ return normaliseNativeResults(getNative2().reverseLookupByProperty(css, property));
4286
6605
  }
4287
6606
  findDependents(className, css) {
4288
6607
  if (!css || !className) return [];
4289
- return getNative().reverseLookupFindDependents(css, className);
6608
+ return getNative2().reverseLookupFindDependents(css, className);
4290
6609
  }
4291
6610
  fromBundle(className, css) {
4292
6611
  if (!css || !className) return [];
@@ -4331,7 +6650,7 @@ init_resolver();
4331
6650
  init_cssToIr();
4332
6651
 
4333
6652
  // packages/domain/engine/src/watch-native.ts
4334
- init_src();
6653
+ init_src2();
4335
6654
  var watchBindingState = {
4336
6655
  binding: void 0
4337
6656
  };
@@ -4350,22 +6669,22 @@ var getBinding = () => {
4350
6669
  const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
4351
6670
  const candidates = [
4352
6671
  // new binary name: tailwind-styled-native
4353
- path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4354
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
6672
+ path9__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
6673
+ path9__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
4355
6674
  // npm install case: dist/../native/
4356
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4357
- path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
4358
- path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6675
+ path9__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
6676
+ path9__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
6677
+ path9__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
4359
6678
  // monorepo dev: 4-level up
4360
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4361
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6679
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
6680
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
4362
6681
  // 3-level fallback
4363
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
6682
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4364
6683
  // backward compat: tailwind_styled_parser
4365
- path6__namespace.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
4366
- path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4367
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4368
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
6684
+ path9__namespace.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
6685
+ path9__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
6686
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
6687
+ path9__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
4369
6688
  ];
4370
6689
  for (const c of candidates) {
4371
6690
  try {
@@ -4382,11 +6701,11 @@ var getBinding = () => {
4382
6701
  "FATAL: Native watch binding not found in any candidate path.\nThis package requires native Rust bindings.\n\nCandidates checked:\n" + candidates.map((p) => ` - ${p}`).join("\n") + "\n\nResolution steps:\n1. Build the native Rust module: npm run build:rust"
4383
6702
  );
4384
6703
  };
4385
- var log6 = createLogger("engine:watch-native");
6704
+ var log6 = createLogger2("engine:watch-native");
4386
6705
  function watchWorkspace2(rootDir, callback, options = {}) {
4387
6706
  const binding = getBinding();
4388
6707
  const pollMs = options.pollIntervalMs ?? 500;
4389
- const resolvedRoot = path6__namespace.default.resolve(rootDir);
6708
+ const resolvedRoot = path9__namespace.default.resolve(rootDir);
4390
6709
  const result = (() => {
4391
6710
  try {
4392
6711
  return binding.startWatch(resolvedRoot);
@@ -4423,7 +6742,7 @@ This package requires native Rust bindings.`
4423
6742
  const deduped = /* @__PURE__ */ new Set();
4424
6743
  const events = [];
4425
6744
  for (const e of raw) {
4426
- const absPath = path6__namespace.default.isAbsolute(e.path) ? path6__namespace.default.normalize(e.path) : path6__namespace.default.resolve(resolvedRoot, e.path);
6745
+ const absPath = path9__namespace.default.isAbsolute(e.path) ? path9__namespace.default.normalize(e.path) : path9__namespace.default.resolve(resolvedRoot, e.path);
4427
6746
  const kind = e.kind;
4428
6747
  const key = `${kind}:${absPath}`;
4429
6748
  if (deduped.has(key)) continue;
@@ -4460,11 +6779,11 @@ var configState = {
4460
6779
  return this.tailwindConfigLoaded;
4461
6780
  }
4462
6781
  };
4463
- var log7 = createLogger("engine");
6782
+ var log7 = createLogger2("engine");
4464
6783
  async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
4465
6784
  if (!tailwindConfigPath) return void 0;
4466
- const configPath = path6__namespace.default.resolve(root, tailwindConfigPath);
4467
- if (!fs5__namespace.default.existsSync(configPath)) {
6785
+ const configPath = path9__namespace.default.resolve(root, tailwindConfigPath);
6786
+ if (!fs3__namespace.default.existsSync(configPath)) {
4468
6787
  throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
4469
6788
  }
4470
6789
  const imported = await import(url.pathToFileURL(configPath).href);
@@ -4530,13 +6849,14 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
4530
6849
  };
4531
6850
  }
4532
6851
  function countWorkspacePackages(root) {
4533
- const packagesDir = path6__namespace.default.join(root, "packages");
4534
- if (!fs5__namespace.default.existsSync(packagesDir)) return 0;
6852
+ const packagesDir = path9__namespace.default.join(root, "packages");
6853
+ if (!fs3__namespace.default.existsSync(packagesDir)) return 0;
4535
6854
  try {
4536
- return fs5__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
4537
- (entry) => entry.isDirectory() && fs5__namespace.default.existsSync(path6__namespace.default.join(packagesDir, entry.name, "package.json"))
6855
+ return fs3__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
6856
+ (entry) => entry.isDirectory() && fs3__namespace.default.existsSync(path9__namespace.default.join(packagesDir, entry.name, "package.json"))
4538
6857
  ).length;
4539
- } catch {
6858
+ } catch (err) {
6859
+ log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
4540
6860
  return 0;
4541
6861
  }
4542
6862
  }
@@ -4570,7 +6890,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
4570
6890
  async function createEngine(rawOptions = {}) {
4571
6891
  const options = parseEngineOptions(rawOptions);
4572
6892
  const root = options.root ?? process.cwd();
4573
- const resolvedRoot = path6__namespace.default.resolve(root);
6893
+ const resolvedRoot = path9__namespace.default.resolve(root);
4574
6894
  const plugins = rawOptions.plugins ?? [];
4575
6895
  const getTailwindConfig = async () => {
4576
6896
  if (configState.isLoaded()) return configState.getConfig();
@@ -4717,12 +7037,13 @@ async function createEngine(rawOptions = {}) {
4717
7037
  const shouldForceFullRescan = (event) => {
4718
7038
  if (event.type === "unlink") return false;
4719
7039
  try {
4720
- const stat = fs5__namespace.default.statSync(event.filePath);
7040
+ const stat = fs3__namespace.default.statSync(event.filePath);
4721
7041
  if (stat.size > largeFileThreshold) {
4722
7042
  metrics.markSkippedLargeFile();
4723
7043
  return true;
4724
7044
  }
4725
- } catch {
7045
+ } catch (statErr) {
7046
+ log7.debug(`stat failed for ${event.filePath}: ${statErr instanceof Error ? statErr.message : String(statErr)}`);
4726
7047
  return false;
4727
7048
  }
4728
7049
  return false;
@@ -4833,21 +7154,21 @@ async function createEngine(rawOptions = {}) {
4833
7154
  }
4834
7155
  };
4835
7156
  }
4836
- async function scanWorkspace2(opts = {}) {
4837
- const root = path6__namespace.default.resolve(opts.root ?? process.cwd());
7157
+ async function scanWorkspace3(opts = {}) {
7158
+ const root = path9__namespace.default.resolve(opts.root ?? process.cwd());
4838
7159
  return scanWorkspaceAsync(root, {
4839
7160
  includeExtensions: opts.extensions,
4840
7161
  ignoreDirectories: opts.ignoreDirectories
4841
7162
  });
4842
7163
  }
4843
7164
  async function analyzeWorkspace2(opts = {}) {
4844
- const root = path6__namespace.default.resolve(opts.root ?? process.cwd());
7165
+ const root = path9__namespace.default.resolve(opts.root ?? process.cwd());
4845
7166
  return analyzeWorkspace(root, {
4846
7167
  classStats: { top: opts.top ?? 20 }
4847
7168
  });
4848
7169
  }
4849
7170
  async function generateSafelist2(opts = {}) {
4850
- const scan = await scanWorkspace2(opts);
7171
+ const scan = await scanWorkspace3(opts);
4851
7172
  return scan.uniqueClasses;
4852
7173
  }
4853
7174
  async function build(opts = {}) {
@@ -4872,7 +7193,8 @@ async function traceClass(className, scanResult, css) {
4872
7193
  resolver.registerClass(registeredClassName, ruleIds);
4873
7194
  }
4874
7195
  return trace2(className, resolver);
4875
- } catch {
7196
+ } catch (traceErr) {
7197
+ log7.debug(`traceClass("${className}"): ${traceErr instanceof Error ? traceErr.message : String(traceErr)}`);
4876
7198
  return null;
4877
7199
  }
4878
7200
  }
@@ -4925,7 +7247,7 @@ exports.applyIncrementalChange = applyIncrementalChange;
4925
7247
  exports.build = build;
4926
7248
  exports.buildProvenanceChain = buildProvenanceChain;
4927
7249
  exports.createEngine = createEngine;
4928
- exports.createFingerprint = createFingerprint;
7250
+ exports.createFingerprint = createFingerprint2;
4929
7251
  exports.createResolutionReason = createResolutionReason;
4930
7252
  exports.generateSafelist = generateSafelist2;
4931
7253
  exports.inspectClass = inspectClass;
@@ -4940,7 +7262,7 @@ exports.runBeforeScan = runBeforeScan;
4940
7262
  exports.runBeforeWatch = runBeforeWatch;
4941
7263
  exports.runOnError = runOnError;
4942
7264
  exports.runTransformClasses = runTransformClasses;
4943
- exports.scanWorkspace = scanWorkspace2;
7265
+ exports.scanWorkspace = scanWorkspace3;
4944
7266
  exports.trace = trace;
4945
7267
  exports.traceClass = traceClass;
4946
7268
  exports.traceClasses = traceClasses;