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/tw.js CHANGED
@@ -2,14 +2,14 @@
2
2
  'use strict';
3
3
 
4
4
  var module$1 = require('module');
5
- var fs12 = require('fs');
5
+ var fs11 = require('fs');
6
6
  var path6 = require('path');
7
7
  require('crypto');
8
8
  var url = require('url');
9
9
  var worker_threads = require('worker_threads');
10
10
  var os = require('os');
11
11
  var zod = require('zod');
12
- var fs8 = require('fs/promises');
12
+ var fs7 = require('fs/promises');
13
13
  var prompts = require('@clack/prompts');
14
14
  var util = require('util');
15
15
  var child_process = require('child_process');
@@ -35,9 +35,9 @@ function _interopNamespace(e) {
35
35
  return Object.freeze(n);
36
36
  }
37
37
 
38
- var fs12__namespace = /*#__PURE__*/_interopNamespace(fs12);
38
+ var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
39
39
  var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
40
- var fs8__default = /*#__PURE__*/_interopDefault(fs8);
40
+ var fs7__default = /*#__PURE__*/_interopDefault(fs7);
41
41
 
42
42
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
43
43
  var __create = Object.create;
@@ -1013,7 +1013,7 @@ var require_command = __commonJS({
1013
1013
  "packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports$1) {
1014
1014
  var EventEmitter = __require("events").EventEmitter;
1015
1015
  var childProcess = __require("child_process");
1016
- var path29 = __require("path");
1016
+ var path30 = __require("path");
1017
1017
  var fs16 = __require("fs");
1018
1018
  var process2 = __require("process");
1019
1019
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1945,9 +1945,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1945
1945
  let launchWithNode = false;
1946
1946
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1947
1947
  function findFile(baseDir, baseName) {
1948
- const localBin = path29.resolve(baseDir, baseName);
1948
+ const localBin = path30.resolve(baseDir, baseName);
1949
1949
  if (fs16.existsSync(localBin)) return localBin;
1950
- if (sourceExt.includes(path29.extname(baseName))) return void 0;
1950
+ if (sourceExt.includes(path30.extname(baseName))) return void 0;
1951
1951
  const foundExt = sourceExt.find(
1952
1952
  (ext) => fs16.existsSync(`${localBin}${ext}`)
1953
1953
  );
@@ -1965,17 +1965,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1965
1965
  } catch (err) {
1966
1966
  resolvedScriptPath = this._scriptPath;
1967
1967
  }
1968
- executableDir = path29.resolve(
1969
- path29.dirname(resolvedScriptPath),
1968
+ executableDir = path30.resolve(
1969
+ path30.dirname(resolvedScriptPath),
1970
1970
  executableDir
1971
1971
  );
1972
1972
  }
1973
1973
  if (executableDir) {
1974
1974
  let localFile = findFile(executableDir, executableFile);
1975
1975
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1976
- const legacyName = path29.basename(
1976
+ const legacyName = path30.basename(
1977
1977
  this._scriptPath,
1978
- path29.extname(this._scriptPath)
1978
+ path30.extname(this._scriptPath)
1979
1979
  );
1980
1980
  if (legacyName !== this._name) {
1981
1981
  localFile = findFile(
@@ -1986,7 +1986,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1986
1986
  }
1987
1987
  executableFile = localFile || executableFile;
1988
1988
  }
1989
- launchWithNode = sourceExt.includes(path29.extname(executableFile));
1989
+ launchWithNode = sourceExt.includes(path30.extname(executableFile));
1990
1990
  let proc;
1991
1991
  if (process2.platform !== "win32") {
1992
1992
  if (launchWithNode) {
@@ -2826,7 +2826,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2826
2826
  * @return {Command}
2827
2827
  */
2828
2828
  nameFromFilename(filename) {
2829
- this._name = path29.basename(filename, path29.extname(filename));
2829
+ this._name = path30.basename(filename, path30.extname(filename));
2830
2830
  return this;
2831
2831
  }
2832
2832
  /**
@@ -2840,9 +2840,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2840
2840
  * @param {string} [path]
2841
2841
  * @return {(string|null|Command)}
2842
2842
  */
2843
- executableDir(path30) {
2844
- if (path30 === void 0) return this._executableDir;
2845
- this._executableDir = path30;
2843
+ executableDir(path31) {
2844
+ if (path31 === void 0) return this._executableDir;
2845
+ this._executableDir = path31;
2846
2846
  return this;
2847
2847
  }
2848
2848
  /**
@@ -3192,12 +3192,12 @@ function resolveNativeBinary(runtimeDir) {
3192
3192
  if (isBrowser2) {
3193
3193
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
3194
3194
  }
3195
- if (process.env.TWS_DISABLE_NATIVE === "1") {
3195
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
3196
3196
  return { path: null, source: "not-found", platform, tried: [] };
3197
3197
  }
3198
3198
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3199
3199
  if (envPath) {
3200
- if (fs12__namespace.existsSync(envPath)) {
3200
+ if (fs11__namespace.existsSync(envPath)) {
3201
3201
  return { path: envPath, source: "env", platform, tried };
3202
3202
  }
3203
3203
  tried.push(`env:${envPath} (not found)`);
@@ -3206,7 +3206,7 @@ function resolveNativeBinary(runtimeDir) {
3206
3206
  for (const pkg of prebuiltPkgs) {
3207
3207
  try {
3208
3208
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
3209
- if (fs12__namespace.existsSync(candidate)) {
3209
+ if (fs11__namespace.existsSync(candidate)) {
3210
3210
  return { path: candidate, source: "prebuilt", platform, tried };
3211
3211
  }
3212
3212
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3223,7 +3223,7 @@ function resolveNativeBinary(runtimeDir) {
3223
3223
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3224
3224
  const candidate = path6__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3225
3225
  tried.push(`self-bundled:${candidate}`);
3226
- if (fs12__namespace.existsSync(candidate)) {
3226
+ if (fs11__namespace.existsSync(candidate)) {
3227
3227
  return { path: candidate, source: "prebuilt", platform, tried };
3228
3228
  }
3229
3229
  }
@@ -3257,7 +3257,7 @@ function resolveNativeBinary(runtimeDir) {
3257
3257
  }
3258
3258
  for (const candidate of localCandidates) {
3259
3259
  tried.push(`local:${candidate}`);
3260
- if (fs12__namespace.existsSync(candidate)) {
3260
+ if (fs11__namespace.existsSync(candidate)) {
3261
3261
  return { path: candidate, source: "local", platform, tried };
3262
3262
  }
3263
3263
  }
@@ -3307,9 +3307,9 @@ function createDebugLogger(namespace, label) {
3307
3307
  }
3308
3308
  };
3309
3309
  }
3310
- function formatIssuePath(path29) {
3311
- if (!path29 || path29.length === 0) return "(root)";
3312
- return path29.map(
3310
+ function formatIssuePath(path30) {
3311
+ if (!path30 || path30.length === 0) return "(root)";
3312
+ return path30.map(
3313
3313
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3314
3314
  ).join(".");
3315
3315
  }
@@ -3322,7 +3322,7 @@ function loadNativeBinding(options) {
3322
3322
  for (const candidate of candidates) {
3323
3323
  const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
3324
3324
  try {
3325
- if (!fs12__namespace.default.existsSync(candidatePath) && !fs12__namespace.default.existsSync(candidatePath + ".node")) {
3325
+ if (!fs11__namespace.default.existsSync(candidatePath) && !fs11__namespace.default.existsSync(candidatePath + ".node")) {
3326
3326
  continue;
3327
3327
  }
3328
3328
  const mod = requireNativeModule(candidatePath);
@@ -3354,9 +3354,9 @@ function resolveNativeBindingCandidates(options) {
3354
3354
  }
3355
3355
  }
3356
3356
  if (!includeDefaultCandidates) return candidates;
3357
- if (fs12__namespace.default.existsSync(runtimeDir)) {
3357
+ if (fs11__namespace.default.existsSync(runtimeDir)) {
3358
3358
  try {
3359
- for (const entry of fs12__namespace.default.readdirSync(runtimeDir)) {
3359
+ for (const entry of fs11__namespace.default.readdirSync(runtimeDir)) {
3360
3360
  if (entry.endsWith(".node")) candidates.push(entry);
3361
3361
  }
3362
3362
  } catch {
@@ -3423,8 +3423,8 @@ var init_src = __esm({
3423
3423
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3424
3424
  static fromZod(err) {
3425
3425
  const first = err.issues?.[0] ?? err.errors?.[0];
3426
- const path29 = formatIssuePath(first?.path);
3427
- const message = first ? `${path29}: ${first.message}` : "Schema validation failed";
3426
+ const path30 = formatIssuePath(first?.path);
3427
+ const message = first ? `${path30}: ${first.message}` : "Schema validation failed";
3428
3428
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3429
3429
  }
3430
3430
  static wrap(source, code, err) {
@@ -3774,7 +3774,7 @@ function defaultCachePath(rootDir, cacheDir) {
3774
3774
  }
3775
3775
  function readCache(rootDir, cacheDir) {
3776
3776
  const cachePath = defaultCachePath(rootDir, cacheDir);
3777
- fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3777
+ fs11__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3778
3778
  const result = cacheReadNative(cachePath);
3779
3779
  if (!result) return [];
3780
3780
  return result.entries.map((e) => ({
@@ -3789,7 +3789,7 @@ function readCache(rootDir, cacheDir) {
3789
3789
  }
3790
3790
  function writeCache(rootDir, entries, cacheDir) {
3791
3791
  const cachePath = defaultCachePath(rootDir, cacheDir);
3792
- fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3792
+ fs11__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3793
3793
  const success = cacheWriteNative(cachePath, entries);
3794
3794
  if (!success) {
3795
3795
  throw new Error(
@@ -3816,27 +3816,7 @@ var init_cache_native = __esm({
3816
3816
  function collectFiles(rootDir, extensions, ignoreDirs) {
3817
3817
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
3818
3818
  if (native !== null) return native;
3819
- const files = [];
3820
- function walk(dir) {
3821
- let entries;
3822
- try {
3823
- entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
3824
- } catch {
3825
- return;
3826
- }
3827
- for (const entry of entries) {
3828
- const fullPath = path6__namespace.default.join(dir, entry.name);
3829
- const rel = path6__namespace.default.relative(rootDir, fullPath);
3830
- if (entry.isDirectory()) {
3831
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__namespace.default.sep));
3832
- if (!ignored) walk(fullPath);
3833
- } else if (isScannableFile(entry.name, extensions)) {
3834
- files.push(fullPath);
3835
- }
3836
- }
3837
- }
3838
- walk(rootDir);
3839
- return files;
3819
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
3840
3820
  }
3841
3821
  function mergeResults(batchResults) {
3842
3822
  const files = batchResults.map((r) => ({
@@ -3846,8 +3826,7 @@ function mergeResults(batchResults) {
3846
3826
  }));
3847
3827
  const native = rebuildWorkspaceResultNative(files);
3848
3828
  if (native) return native;
3849
- const unique = new Set(files.flatMap((f) => f.classes));
3850
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
3829
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
3851
3830
  }
3852
3831
  function runChunkInWorker(filePaths) {
3853
3832
  return new Promise((resolve2, reject) => {
@@ -3918,12 +3897,12 @@ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, S
3918
3897
  var init_schemas = __esm({
3919
3898
  "packages/domain/scanner/src/schemas.ts"() {
3920
3899
  init_src();
3921
- formatIssuePath2 = (path29) => path29.length > 0 ? path29.map(
3900
+ formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
3922
3901
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3923
3902
  ).join(".") : "<root>";
3924
3903
  formatIssues = (error) => error.issues.map((issue) => {
3925
- const path29 = formatIssuePath2(issue.path);
3926
- return `${path29}: ${issue.message}`;
3904
+ const path30 = formatIssuePath2(issue.path);
3905
+ return `${path30}: ${issue.message}`;
3927
3906
  }).join("; ");
3928
3907
  parseWithSchema = (schema, data, label) => {
3929
3908
  const parsed = schema.safeParse(data);
@@ -3986,7 +3965,7 @@ __export(src_exports, {
3986
3965
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3987
3966
  batchExtractClassesNative: () => batchExtractClassesNative,
3988
3967
  extractClassesNative: () => extractClassesNative,
3989
- isScannableFile: () => isScannableFile,
3968
+ isScannableFile: () => isScannableFile2,
3990
3969
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3991
3970
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3992
3971
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
@@ -4020,7 +3999,7 @@ function resolveScannerWorkerModulePath() {
4020
3999
  path6__namespace.default.resolve(runtimeDir, "worker.ts")
4021
4000
  ];
4022
4001
  for (const candidate of candidates) {
4023
- if (fs12__namespace.default.existsSync(candidate)) return candidate;
4002
+ if (fs11__namespace.default.existsSync(candidate)) return candidate;
4024
4003
  }
4025
4004
  return null;
4026
4005
  }
@@ -4077,7 +4056,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4077
4056
  if (!currentDir) continue;
4078
4057
  const entries = (() => {
4079
4058
  try {
4080
- return fs12__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4059
+ return fs11__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4081
4060
  } catch {
4082
4061
  return [];
4083
4062
  }
@@ -4115,7 +4094,7 @@ function scanSource(source) {
4115
4094
  "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"
4116
4095
  );
4117
4096
  }
4118
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4097
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4119
4098
  return includeExtensions.includes(path6__namespace.default.extname(filePath));
4120
4099
  }
4121
4100
  function scanFile(filePath) {
@@ -4176,7 +4155,7 @@ function scanWorkspace(rootDir, options = {}) {
4176
4155
  for (const filePath of candidates) {
4177
4156
  const stat = (() => {
4178
4157
  try {
4179
- return fs12__namespace.default.statSync(filePath);
4158
+ return fs11__namespace.default.statSync(filePath);
4180
4159
  } catch {
4181
4160
  return null;
4182
4161
  }
@@ -4202,7 +4181,7 @@ function scanWorkspace(rootDir, options = {}) {
4202
4181
  for (const { filePath, stat, size, cached } of ranked) {
4203
4182
  const content = (() => {
4204
4183
  try {
4205
- return fs12__namespace.default.readFileSync(filePath, "utf8");
4184
+ return fs11__namespace.default.readFileSync(filePath, "utf8");
4206
4185
  } catch {
4207
4186
  return null;
4208
4187
  }
@@ -4346,7 +4325,7 @@ var init_src2 = __esm({
4346
4325
  )
4347
4326
  ];
4348
4327
  for (const fullPath of candidates) {
4349
- if (!fs12__namespace.default.existsSync(fullPath)) continue;
4328
+ if (!fs11__namespace.default.existsSync(fullPath)) continue;
4350
4329
  try {
4351
4330
  const required = req(fullPath);
4352
4331
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4388,7 +4367,7 @@ function isRecord(value) {
4388
4367
  }
4389
4368
  async function pathExists(filePath) {
4390
4369
  try {
4391
- await fs12__namespace.default.promises.access(filePath, fs12__namespace.default.constants.F_OK);
4370
+ await fs11__namespace.default.promises.access(filePath, fs11__namespace.default.constants.F_OK);
4392
4371
  return true;
4393
4372
  } catch {
4394
4373
  return false;
@@ -4509,7 +4488,7 @@ var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchem
4509
4488
  var init_schemas2 = __esm({
4510
4489
  "packages/domain/analyzer/src/schemas.ts"() {
4511
4490
  init_src();
4512
- formatIssuePath3 = (path29) => path29.length > 0 ? path29.map(
4491
+ formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
4513
4492
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
4514
4493
  ).join(".") : "<root>";
4515
4494
  isPlainObject = (value) => {
@@ -4518,8 +4497,8 @@ var init_schemas2 = __esm({
4518
4497
  return proto === Object.prototype || proto === null;
4519
4498
  };
4520
4499
  formatIssues2 = (error) => error.issues.map((issue) => {
4521
- const path29 = formatIssuePath3(issue.path);
4522
- return `${path29}: ${issue.message}`;
4500
+ const path30 = formatIssuePath3(issue.path);
4501
+ return `${path30}: ${issue.message}`;
4523
4502
  }).join("; ");
4524
4503
  parseWithSchema2 = (schema, data, label) => {
4525
4504
  const parsed = schema.safeParse(data);
@@ -4615,7 +4594,7 @@ var init_schemas2 = __esm({
4615
4594
  parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
4616
4595
  }
4617
4596
  });
4618
- var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, isArbitraryUtility, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4597
+ var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4619
4598
  var init_semantic = __esm({
4620
4599
  "packages/domain/analyzer/src/semantic.ts"() {
4621
4600
  init_binding();
@@ -4628,27 +4607,13 @@ var init_semantic = __esm({
4628
4607
  const base = parts.pop() ?? className;
4629
4608
  return { variantKey: parts.join(":"), base };
4630
4609
  };
4631
- isArbitraryUtility = (baseClass) => {
4632
- return baseClass.includes("[") && baseClass.includes("]");
4633
- };
4634
- resolveConflictGroup = (base) => {
4635
- if (isArbitraryUtility(base)) return null;
4636
- if (["block", "inline", "inline-block", "inline-flex", "flex", "grid", "hidden"].includes(base))
4637
- return "display";
4638
- if (base.startsWith("bg-")) return "bg";
4639
- if (base.startsWith("text-")) return "text";
4640
- if (base.startsWith("font-")) return "font";
4641
- if (base.startsWith("rounded")) return "rounded";
4642
- if (base.startsWith("shadow")) return "shadow";
4643
- if (base.startsWith("border-")) return "border";
4644
- if (base.startsWith("opacity-")) return "opacity";
4645
- if (base.startsWith("w-") || base.startsWith("min-w-") || base.startsWith("max-w-"))
4646
- return "width";
4647
- if (base.startsWith("h-") || base.startsWith("min-h-") || base.startsWith("max-h-"))
4648
- return "height";
4649
- if (base.startsWith("p-") || base.startsWith("px-") || base.startsWith("py-")) return "padding";
4650
- if (base.startsWith("m-") || base.startsWith("mx-") || base.startsWith("my-")) return "margin";
4651
- return null;
4610
+ resolveConflictGroup = async (base) => {
4611
+ const native = await getNativeBinding();
4612
+ if (!native?.resolveConflictGroup) {
4613
+ throw new Error("Native binding 'resolveConflictGroup' is required but not available.");
4614
+ }
4615
+ const result = native.resolveConflictGroup(base);
4616
+ return result.length > 0 ? result : null;
4652
4617
  };
4653
4618
  detectConflicts = async (usages) => {
4654
4619
  const native = await getNativeBinding();
@@ -4736,7 +4701,7 @@ var init_semantic = __esm({
4736
4701
  return out;
4737
4702
  };
4738
4703
  collectSafelistFromSource = async (configPath) => {
4739
- const source = await fs12__namespace.default.promises.readFile(configPath, "utf8");
4704
+ const source = await fs11__namespace.default.promises.readFile(configPath, "utf8");
4740
4705
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4741
4706
  const allTokens = extractClassesNative2(source);
4742
4707
  const hasSafelist = source.includes("safelist");
@@ -4763,7 +4728,7 @@ var init_semantic = __esm({
4763
4728
  customUtilities: /* @__PURE__ */ new Set()
4764
4729
  };
4765
4730
  }
4766
- const configStat = await fs12__namespace.default.promises.stat(configPath).catch(() => null);
4731
+ const configStat = await fs11__namespace.default.promises.stat(configPath).catch(() => null);
4767
4732
  if (configStat) {
4768
4733
  const cached = tailwindConfigCache.get(configPath);
4769
4734
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5059,12 +5024,12 @@ var init_classToCss = __esm({
5059
5024
  init_binding();
5060
5025
  init_schemas2();
5061
5026
  init_utils();
5062
- normalizeClassInput = (input, _binding) => {
5027
+ normalizeClassInput = (input, binding) => {
5063
5028
  if (typeof input === "string") {
5064
- if (_binding?.normalizeClassInput) {
5065
- return _binding.normalizeClassInput(input);
5029
+ if (!binding.normalizeClassInput) {
5030
+ throw new Error("FATAL: Native binding 'normalizeClassInput' is required but not available.");
5066
5031
  }
5067
- return input.split(/\s+/).map((item) => item.trim()).filter((item) => item.length > 0);
5032
+ return binding.normalizeClassInput(input);
5068
5033
  }
5069
5034
  if (!Array.isArray(input)) {
5070
5035
  throw new TypeError("classToCss input must be a string or an array of strings.");
@@ -5096,11 +5061,11 @@ var init_classToCss = __esm({
5096
5061
  }
5097
5062
  };
5098
5063
  declarationMapToString = (declarationMap, binding) => {
5099
- const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5100
- if (binding?.declarationMapToString) {
5101
- return binding.declarationMapToString(entries);
5064
+ if (!binding.declarationMapToString) {
5065
+ throw new Error("FATAL: Native binding 'declarationMapToString' is required but not available.");
5102
5066
  }
5103
- return entries.map(({ property, value }) => `${property}: ${value}`).join("; ");
5067
+ const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5068
+ return binding.declarationMapToString(entries);
5104
5069
  };
5105
5070
  classToCss = async (input, options = {}) => {
5106
5071
  const binding = await requireNativeCssCompiler();
@@ -5196,7 +5161,7 @@ var init_src3 = __esm({
5196
5161
  });
5197
5162
  async function pathExists2(filePath) {
5198
5163
  try {
5199
- await fs8__default.default.access(filePath);
5164
+ await fs7__default.default.access(filePath);
5200
5165
  return true;
5201
5166
  } catch {
5202
5167
  return false;
@@ -5204,7 +5169,7 @@ async function pathExists2(filePath) {
5204
5169
  }
5205
5170
  async function readFileSafe(filePath) {
5206
5171
  try {
5207
- return await fs8__default.default.readFile(filePath, "utf8");
5172
+ return await fs7__default.default.readFile(filePath, "utf8");
5208
5173
  } catch {
5209
5174
  return null;
5210
5175
  }
@@ -5223,8 +5188,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5223
5188
  options.onDryRun?.(`write ${filePath}`);
5224
5189
  return;
5225
5190
  }
5226
- await fs8__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5227
- await fs8__default.default.writeFile(filePath, content, "utf8");
5191
+ await fs7__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5192
+ await fs7__default.default.writeFile(filePath, content, "utf8");
5228
5193
  }
5229
5194
  async function ensureFileSafe(filePath, content, options = {}) {
5230
5195
  if (await pathExists2(filePath)) return "skipped";
@@ -6097,7 +6062,7 @@ var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttem
6097
6062
  var init_nativeBridge = __esm({
6098
6063
  "packages/domain/compiler/src/nativeBridge.ts"() {
6099
6064
  init_src();
6100
- _loadNative = (path29) => __require(path29);
6065
+ _loadNative = (path30) => __require(path30);
6101
6066
  log3 = (...args) => {
6102
6067
  if (process.env.DEBUG?.includes("compiler:native")) {
6103
6068
  console.log("[compiler:native]", ...args);
@@ -6155,6 +6120,78 @@ Tried paths: ${result.tried.join("\n")}`);
6155
6120
  }
6156
6121
  });
6157
6122
 
6123
+ // packages/domain/compiler/src/compiler/index.ts
6124
+ var init_compiler = __esm({
6125
+ "packages/domain/compiler/src/compiler/index.ts"() {
6126
+ }
6127
+ });
6128
+
6129
+ // packages/domain/compiler/src/parser/index.ts
6130
+ var init_parser = __esm({
6131
+ "packages/domain/compiler/src/parser/index.ts"() {
6132
+ }
6133
+ });
6134
+
6135
+ // packages/domain/compiler/src/analyzer/index.ts
6136
+ var init_analyzer = __esm({
6137
+ "packages/domain/compiler/src/analyzer/index.ts"() {
6138
+ }
6139
+ });
6140
+
6141
+ // packages/domain/compiler/src/cache/index.ts
6142
+ var init_cache = __esm({
6143
+ "packages/domain/compiler/src/cache/index.ts"() {
6144
+ }
6145
+ });
6146
+
6147
+ // packages/domain/compiler/src/redis/index.ts
6148
+ var init_redis = __esm({
6149
+ "packages/domain/compiler/src/redis/index.ts"() {
6150
+ }
6151
+ });
6152
+
6153
+ // packages/domain/compiler/src/watch/index.ts
6154
+ var init_watch = __esm({
6155
+ "packages/domain/compiler/src/watch/index.ts"() {
6156
+ }
6157
+ });
6158
+ var compileCssFromClasses;
6159
+ var init_src4 = __esm({
6160
+ "packages/domain/compiler/src/index.ts"() {
6161
+ init_nativeBridge();
6162
+ init_compiler();
6163
+ init_parser();
6164
+ init_analyzer();
6165
+ init_cache();
6166
+ init_redis();
6167
+ init_watch();
6168
+ compileCssFromClasses = (classes, prefix) => {
6169
+ const native = getNativeBridge();
6170
+ if (!native?.transformSource) {
6171
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
6172
+ }
6173
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
6174
+ if (!result) {
6175
+ throw new Error("FATAL: transformSource returned null");
6176
+ }
6177
+ return result;
6178
+ };
6179
+ }
6180
+ });
6181
+
6182
+ // packages/domain/compiler/src/internal.ts
6183
+ var init_internal = __esm({
6184
+ "packages/domain/compiler/src/internal.ts"() {
6185
+ init_src4();
6186
+ init_compiler();
6187
+ init_parser();
6188
+ init_analyzer();
6189
+ init_cache();
6190
+ init_redis();
6191
+ init_watch();
6192
+ }
6193
+ });
6194
+
6158
6195
  // packages/infrastructure/cli/src/commands/program.ts
6159
6196
  init_esm();
6160
6197
 
@@ -6452,7 +6489,7 @@ async function findSourceFiles(dir) {
6452
6489
  const out = [];
6453
6490
  async function walk(currentDir) {
6454
6491
  if (!await pathExists2(currentDir)) return;
6455
- const entries = await fs8__default.default.readdir(currentDir, { withFileTypes: true });
6492
+ const entries = await fs7__default.default.readdir(currentDir, { withFileTypes: true });
6456
6493
  for (const entry of entries) {
6457
6494
  const fullPath = path6__namespace.default.join(currentDir, entry.name);
6458
6495
  if (entry.isDirectory()) {
@@ -6518,12 +6555,12 @@ async function runMigrateCli(rawArgs) {
6518
6555
  report.configWrites += await migrateConfig(root, dryRun);
6519
6556
  }
6520
6557
  for (const filePath of files) {
6521
- const source = await fs8__default.default.readFile(filePath, "utf8");
6558
+ const source = await fs7__default.default.readFile(filePath, "utf8");
6522
6559
  const migrated = migrateSource(source, { includeImports, includeClasses });
6523
6560
  if (migrated.output !== source) {
6524
6561
  report.updatedFiles++;
6525
6562
  if (!dryRun) {
6526
- await fs8__default.default.writeFile(filePath, migrated.output, "utf8");
6563
+ await fs7__default.default.writeFile(filePath, migrated.output, "utf8");
6527
6564
  }
6528
6565
  }
6529
6566
  report.classRenames += migrated.classRenames;
@@ -6589,8 +6626,8 @@ function buildClassNames(files, uniqueClasses) {
6589
6626
  function writeScanCache(root, cacheData) {
6590
6627
  const cacheDir = path6__namespace.default.join(root, ".tailwind-styled");
6591
6628
  const cachePath = path6__namespace.default.join(cacheDir, "scan-cache.json");
6592
- fs12__namespace.default.mkdirSync(cacheDir, { recursive: true });
6593
- fs12__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6629
+ fs11__namespace.default.mkdirSync(cacheDir, { recursive: true });
6630
+ fs11__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6594
6631
  return cachePath;
6595
6632
  }
6596
6633
  async function runScanCli(rawArgs) {
@@ -6764,26 +6801,62 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
6764
6801
  return `${ups}/.next/tw-classes/**`;
6765
6802
  }
6766
6803
  }
6804
+ function computeStateStaticImportPath(cssFilePath, cwd2) {
6805
+ try {
6806
+ const nodePath = __require("path");
6807
+ const cssAbs = nodePath.resolve(cwd2, cssFilePath);
6808
+ const cssDir = nodePath.dirname(cssAbs);
6809
+ const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
6810
+ const rel = nodePath.relative(cssDir, stateStaticAbs).replace(/\\/g, "/");
6811
+ return rel.startsWith(".") ? rel : `./${rel}`;
6812
+ } catch {
6813
+ const depth = cssFilePath.split("/").length - 1;
6814
+ const ups = Array(depth).fill("..").join("/");
6815
+ return `${ups}/.next/_tw-state-static.css`;
6816
+ }
6817
+ }
6767
6818
  function patchTailwindCssImpl(src, bundler, cssFilePath, cwd2) {
6768
6819
  const hasTailwindImport = src.includes('@import "tailwindcss"') || src.includes("@import 'tailwindcss'");
6769
- const hasSafelistSource2 = src.includes("tailwind-styled-safelist.css");
6820
+ const hasSafelistSource2 = src.includes("tw-classes");
6821
+ const hasStateImport = src.includes("_tw-state-static.css");
6770
6822
  const needsSafelistSource = bundler === "next" && !hasSafelistSource2;
6771
- const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tailwind-styled-safelist.css";
6823
+ const needsStateImport = bundler === "next" && !hasStateImport;
6824
+ const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tw-classes/**";
6825
+ const stateImportRelPath = needsStateImport && cssFilePath && cwd2 ? computeStateStaticImportPath(cssFilePath, cwd2) : "../.next/_tw-state-static.css";
6772
6826
  const safelistSource = `@source "${safelistRelPath}";`;
6827
+ const stateImport = `@import "${stateImportRelPath}";`;
6773
6828
  if (hasTailwindImport) {
6774
- if (!needsSafelistSource) return null;
6775
- const patched = src.replace(
6776
- /(@import\s+['"]tailwindcss['"];?)/,
6777
- `$1
6829
+ if (!needsSafelistSource && !needsStateImport) return null;
6830
+ let patched = src;
6831
+ if (needsSafelistSource) {
6832
+ patched = patched.replace(
6833
+ /(@import\s+['"]tailwindcss['"];?)/,
6834
+ `$1
6778
6835
  ${safelistSource}`
6779
- );
6836
+ );
6837
+ }
6838
+ if (needsStateImport) {
6839
+ if (patched.includes("tw-classes")) {
6840
+ patched = patched.replace(
6841
+ /(@source\s+["'][^"']+["'];?)/,
6842
+ `$1
6843
+ ${stateImport}`
6844
+ );
6845
+ } else {
6846
+ patched = patched.replace(
6847
+ /(@import\s+['"]tailwindcss['"];?)/,
6848
+ `$1
6849
+ ${stateImport}`
6850
+ );
6851
+ }
6852
+ }
6780
6853
  return patched === src ? null : patched;
6781
6854
  }
6782
- const base = `@import "tailwindcss";
6783
- ${needsSafelistSource ? `${safelistSource}
6784
- ` : ""}
6785
- ${src}`;
6786
- return base;
6855
+ const lines = [`@import "tailwindcss";`];
6856
+ if (needsSafelistSource) lines.push(safelistSource);
6857
+ if (needsStateImport) lines.push(stateImport);
6858
+ lines.push("", src);
6859
+ return lines.join("\n");
6787
6860
  }
6788
6861
  function patchTsConfigImpl(src) {
6789
6862
  try {
@@ -7407,7 +7480,7 @@ async function runStatsCli(args) {
7407
7480
  init_runtime();
7408
7481
  function collectTsFiles(dir, extensions) {
7409
7482
  const files = [];
7410
- const entries = fs12.readdirSync(dir, { withFileTypes: true });
7483
+ const entries = fs11.readdirSync(dir, { withFileTypes: true });
7411
7484
  for (const entry of entries) {
7412
7485
  const full = path6.join(dir, entry.name);
7413
7486
  if (entry.isDirectory()) {
@@ -7490,7 +7563,7 @@ async function runBoundaryCli(args, context) {
7490
7563
  for (const file of files) {
7491
7564
  let source;
7492
7565
  try {
7493
- source = fs12.readFileSync(file, "utf8");
7566
+ source = fs11.readFileSync(file, "utf8");
7494
7567
  } catch {
7495
7568
  continue;
7496
7569
  }
@@ -7585,7 +7658,7 @@ async function loadRegistry(context) {
7585
7658
  if (!registryPath) {
7586
7659
  throw new CliUsageError("Plugin registry file not found.");
7587
7660
  }
7588
- const raw = await fs8__default.default.readFile(registryPath, "utf8");
7661
+ const raw = await fs7__default.default.readFile(registryPath, "utf8");
7589
7662
  const data = JSON.parse(raw);
7590
7663
  return [
7591
7664
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7720,8 +7793,8 @@ var deployCommand = {
7720
7793
  return;
7721
7794
  }
7722
7795
  const cacheDir = path6__namespace.default.join(process.cwd(), ".tw-cache");
7723
- await fs8__default.default.mkdir(cacheDir, { recursive: true });
7724
- await fs8__default.default.writeFile(
7796
+ await fs7__default.default.mkdir(cacheDir, { recursive: true });
7797
+ await fs7__default.default.writeFile(
7725
7798
  path6__namespace.default.join(cacheDir, "deploy-manifest.json"),
7726
7799
  JSON.stringify(manifest, null, 2)
7727
7800
  );
@@ -7822,22 +7895,27 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7822
7895
  issues.push({ severity, type, message, suggestion, location });
7823
7896
  }
7824
7897
  function readJsonFile(filePath) {
7825
- if (!fs12__namespace.default.existsSync(filePath)) return null;
7898
+ if (!fs11__namespace.default.existsSync(filePath)) return null;
7826
7899
  try {
7827
- return JSON.parse(fs12__namespace.default.readFileSync(filePath, "utf8"));
7828
- } catch {
7900
+ return JSON.parse(fs11__namespace.default.readFileSync(filePath, "utf8"));
7901
+ } catch (parseErr) {
7902
+ if (process.env.TWS_DEBUG === "1") {
7903
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
7904
+ process.stderr.write(`[tw:doctor] malformed JSON: ${filePath} \u2014 ${msg}
7905
+ `);
7906
+ }
7829
7907
  return null;
7830
7908
  }
7831
7909
  }
7832
7910
  function findWorkspacePackageJsonFiles(root) {
7833
7911
  const packagesDir = path6__namespace.default.join(root, "packages");
7834
- if (!fs12__namespace.default.existsSync(packagesDir)) return [];
7835
- return fs12__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__namespace.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs12__namespace.default.existsSync(filePath));
7912
+ if (!fs11__namespace.default.existsSync(packagesDir)) return [];
7913
+ return fs11__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__namespace.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11__namespace.default.existsSync(filePath));
7836
7914
  }
7837
7915
  function findFiles(dir, ext) {
7838
7916
  const files = [];
7839
7917
  try {
7840
- const entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
7918
+ const entries = fs11__namespace.default.readdirSync(dir, { withFileTypes: true });
7841
7919
  for (const entry of entries) {
7842
7920
  const fullPath = path6__namespace.default.join(dir, entry.name);
7843
7921
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7846,7 +7924,12 @@ function findFiles(dir, ext) {
7846
7924
  files.push(fullPath);
7847
7925
  }
7848
7926
  }
7849
- } catch {
7927
+ } catch (dirErr) {
7928
+ if (process.env.TWS_DEBUG === "1") {
7929
+ const msg = dirErr instanceof Error ? dirErr.message : String(dirErr);
7930
+ process.stderr.write(`[tw:doctor] findFiles error in ${dir}: ${msg}
7931
+ `);
7932
+ }
7850
7933
  return files;
7851
7934
  }
7852
7935
  return files;
@@ -7999,7 +8082,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7999
8082
  const cssFiles = findFiles(root, ".css");
8000
8083
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
8001
8084
  try {
8002
- const content = fs12__namespace.default.readFileSync(filePath, "utf8");
8085
+ const content = fs11__namespace.default.readFileSync(filePath, "utf8");
8003
8086
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
8004
8087
  } catch {
8005
8088
  return false;
@@ -8023,7 +8106,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
8023
8106
  );
8024
8107
  }
8025
8108
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
8026
- const hasConfig = configFiles.some((name) => fs12__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8109
+ const hasConfig = configFiles.some((name) => fs11__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8027
8110
  addCheck(
8028
8111
  checks,
8029
8112
  "tailwind",
@@ -8683,6 +8766,7 @@ init_args();
8683
8766
  init_errors();
8684
8767
  init_fs();
8685
8768
  init_json();
8769
+ init_src4();
8686
8770
  var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
8687
8771
  var DEFAULT_TW_CONFIG = `${JSON.stringify(
8688
8772
  {
@@ -8697,6 +8781,89 @@ var DEFAULT_TW_CONFIG = `${JSON.stringify(
8697
8781
  function pkgHasDep(pkg, name) {
8698
8782
  return Boolean(pkg.dependencies?.[name] || pkg.devDependencies?.[name]);
8699
8783
  }
8784
+ async function validateThemeConfig(cwd2) {
8785
+ const results = [];
8786
+ try {
8787
+ const native = getNativeBridge();
8788
+ if (!native) {
8789
+ results.push({ type: "theme", valid: false, message: "Native binding not available" });
8790
+ return results;
8791
+ }
8792
+ const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
8793
+ let configPath = null;
8794
+ for (const file of twConfigFiles) {
8795
+ if (await pathExists2(path6__namespace.default.join(cwd2, file))) {
8796
+ configPath = path6__namespace.default.join(cwd2, file);
8797
+ break;
8798
+ }
8799
+ }
8800
+ if (!configPath) {
8801
+ results.push({ type: "theme-config-missing", valid: false, message: "No tailwind.config found" });
8802
+ return results;
8803
+ }
8804
+ try {
8805
+ const configUrl = url.pathToFileURL(configPath);
8806
+ const configModule = await import(configUrl.href);
8807
+ const config = configModule.default || configModule;
8808
+ const theme = config.theme || {};
8809
+ if (theme.colors && native.validateColorsNapi) {
8810
+ try {
8811
+ const colorsJson = JSON.stringify(theme.colors);
8812
+ const isValid = native.validateColorsNapi(colorsJson);
8813
+ results.push({
8814
+ type: "theme-colors",
8815
+ valid: isValid,
8816
+ message: isValid ? "Colors theme validated OK" : "Invalid colors in theme"
8817
+ });
8818
+ } catch (err) {
8819
+ results.push({
8820
+ type: "theme-colors",
8821
+ valid: false,
8822
+ message: `Color validation error: ${err instanceof Error ? err.message : String(err)}`
8823
+ });
8824
+ }
8825
+ }
8826
+ if (theme.screens && native.validateBreakpointsNapi) {
8827
+ try {
8828
+ const screensJson = JSON.stringify(theme.screens);
8829
+ const isValid = native.validateBreakpointsNapi(screensJson);
8830
+ results.push({
8831
+ type: "theme-breakpoints",
8832
+ valid: isValid,
8833
+ message: isValid ? "Breakpoints validated OK" : "Invalid breakpoints in theme"
8834
+ });
8835
+ } catch (err) {
8836
+ results.push({
8837
+ type: "theme-breakpoints",
8838
+ valid: false,
8839
+ message: `Breakpoints validation error: ${err instanceof Error ? err.message : String(err)}`
8840
+ });
8841
+ }
8842
+ }
8843
+ if (native.runHealthCheck) {
8844
+ try {
8845
+ native.runHealthCheck();
8846
+ results.push({ type: "theme-integrity", valid: true, message: "Theme integrity check passed" });
8847
+ } catch {
8848
+ results.push({ type: "theme-integrity", valid: false, message: "Theme integrity check failed" });
8849
+ }
8850
+ }
8851
+ } catch (err) {
8852
+ results.push({
8853
+ type: "theme-load",
8854
+ valid: false,
8855
+ message: `Failed to load theme config: ${err instanceof Error ? err.message : String(err)}`
8856
+ });
8857
+ }
8858
+ } catch (err) {
8859
+ results.push({
8860
+ type: "theme-validation",
8861
+ valid: false,
8862
+ message: `Theme validation failed: ${err instanceof Error ? err.message : String(err)}`
8863
+ });
8864
+ }
8865
+ return results;
8866
+ }
8700
8867
  function nodeVersion() {
8701
8868
  const full = process.version.replace("v", "");
8702
8869
  const major = parseInt(full.split(".")[0], 10);
@@ -8821,6 +8988,16 @@ async function runPreflightCli(rawArgs) {
8821
8988
  "Run: tw migrate --dry-run to see migration steps"
8822
8989
  );
8823
8990
  }
8991
+ const themeValidation = await validateThemeConfig(cwd2);
8992
+ for (const validation of themeValidation) {
8993
+ check(
8994
+ results,
8995
+ `theme-${validation.type}`,
8996
+ `Theme ${validation.type}`,
8997
+ validation.valid,
8998
+ validation.message
8999
+ );
9000
+ }
8824
9001
  const hasTsConfig = await pathExists2(path6__namespace.default.join(cwd2, "tsconfig.json"));
8825
9002
  check(
8826
9003
  results,
@@ -9308,19 +9485,8 @@ var syncCommand = {
9308
9485
  var import_picocolors5 = __toESM(require_picocolors());
9309
9486
  init_errors();
9310
9487
 
9311
- // packages/domain/compiler/src/index.ts
9312
- init_nativeBridge();
9313
- var compileCssFromClasses = (classes, prefix) => {
9314
- const native = getNativeBridge();
9315
- if (!native?.transformSource) {
9316
- throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
9317
- }
9318
- const result = native.transformSource(classes.join(" "), { prefix: prefix });
9319
- if (!result) {
9320
- throw new Error("FATAL: transformSource returned null");
9321
- }
9322
- return result;
9323
- };
9488
+ // packages/infrastructure/cli/src/utils/traceService.ts
9489
+ init_internal();
9324
9490
 
9325
9491
  // packages/domain/engine/src/native-bridge.ts
9326
9492
  init_src();
@@ -9771,37 +9937,33 @@ var CascadeResolutionId = class {
9771
9937
  return `R${this.value}`;
9772
9938
  }
9773
9939
  };
9774
- var _propertyNamesFallback = /* @__PURE__ */ new Map();
9775
- var _valueNamesFallback = /* @__PURE__ */ new Map();
9776
9940
  function registerPropertyName(id, name) {
9777
9941
  const native = getNativeEngineBinding();
9778
- if (native?.registerPropertyName) {
9779
- native.registerPropertyName(id.value, name);
9780
- return;
9942
+ if (!native?.registerPropertyName) {
9943
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
9781
9944
  }
9782
- _propertyNamesFallback.set(id.value, name);
9945
+ native.registerPropertyName(id.value, name);
9783
9946
  }
9784
9947
  function registerValueName(id, name) {
9785
9948
  const native = getNativeEngineBinding();
9786
- if (native?.registerValueName) {
9787
- native.registerValueName(id.value, name);
9788
- return;
9949
+ if (!native?.registerValueName) {
9950
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
9789
9951
  }
9790
- _valueNamesFallback.set(id.value, name);
9952
+ native.registerValueName(id.value, name);
9791
9953
  }
9792
9954
  function propertyIdToString(id) {
9793
9955
  const native = getNativeEngineBinding();
9794
- if (native?.propertyIdToString) {
9795
- return native.propertyIdToString(id.value);
9956
+ if (!native?.propertyIdToString) {
9957
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
9796
9958
  }
9797
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
9959
+ return native.propertyIdToString(id.value);
9798
9960
  }
9799
9961
  function valueIdToString(id) {
9800
9962
  const native = getNativeEngineBinding();
9801
- if (native?.valueIdToString) {
9802
- return native.valueIdToString(id.value);
9963
+ if (!native?.valueIdToString) {
9964
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
9803
9965
  }
9804
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
9966
+ return native.valueIdToString(id.value);
9805
9967
  }
9806
9968
  var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9807
9969
  CascadeStage2[CascadeStage2["Origin"] = 0] = "Origin";
@@ -9811,19 +9973,12 @@ var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9811
9973
  CascadeStage2[CascadeStage2["Order"] = 4] = "Order";
9812
9974
  return CascadeStage2;
9813
9975
  })(CascadeStage || {});
9814
- function createFingerprintFallback(parts) {
9815
- const hash = parts.reduce(
9816
- (acc, part) => part.split("").reduce((h, char) => (h << 5) - h + char.charCodeAt(0) & h, acc),
9817
- 0
9818
- );
9819
- return Math.abs(hash).toString(36);
9820
- }
9821
9976
  function createFingerprint(parts) {
9822
9977
  const native = getNativeEngineBinding();
9823
- if (native?.createFingerprint) {
9824
- return native.createFingerprint(parts);
9978
+ if (!native?.createFingerprint) {
9979
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
9825
9980
  }
9826
- return createFingerprintFallback(parts);
9981
+ return native.createFingerprint(parts);
9827
9982
  }
9828
9983
 
9829
9984
  // packages/domain/engine/src/reverseLookup.ts
@@ -10085,14 +10240,68 @@ function detectLayerFromClassName(className) {
10085
10240
  return null;
10086
10241
  }
10087
10242
  function parseCssToIr(css, options = {}) {
10088
- resetIdGenerator();
10243
+ const native = getNativeEngineBinding();
10244
+ const prefix = options.prefix ?? "";
10245
+ if (native?.assembleCssIr) {
10246
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
10247
+ }
10248
+ return _parseCssToIrFallback(css, prefix, native);
10249
+ }
10250
+ function _parseCssToIrFast(assembled) {
10251
+ const native = getNativeEngineBinding();
10089
10252
  layerMap.clear();
10090
10253
  layerOrderMap.clear();
10091
- const native = getNativeEngineBinding();
10254
+ for (const le of assembled.layers) {
10255
+ const lid = new LayerId(le.layerId);
10256
+ layerMap.set(le.name, lid);
10257
+ layerOrderMap.set(le.name, le.order);
10258
+ }
10259
+ const rules = assembled.rules.map((r) => {
10260
+ const propertyId = new PropertyId(r.propertyId);
10261
+ const valueId = new ValueId(r.valueId);
10262
+ if (native?.registerPropertyName) {
10263
+ native.registerPropertyName(r.propertyId, r.propertyName);
10264
+ } else {
10265
+ registerPropertyName(propertyId, r.propertyName);
10266
+ }
10267
+ if (native?.registerValueName) {
10268
+ native.registerValueName(r.valueId, r.valueName);
10269
+ } else {
10270
+ registerValueName(valueId, r.valueName);
10271
+ }
10272
+ return {
10273
+ id: new RuleId(r.ruleId),
10274
+ selector: new SelectorId(r.selectorId),
10275
+ variantChain: new VariantChainId(0),
10276
+ property: propertyId,
10277
+ value: valueId,
10278
+ origin: r.origin,
10279
+ importance: r.importance,
10280
+ layer: r.layerId >= 0 ? new LayerId(r.layerId) : null,
10281
+ layerOrder: r.layerOrder,
10282
+ specificity: r.specificity,
10283
+ condition: r.conditionId >= 0 ? new ConditionId(r.conditionId) : null,
10284
+ conditionResult: r.conditionResult,
10285
+ insertionOrder: r.insertionOrder,
10286
+ fingerprint: r.fingerprint,
10287
+ source: { file: "", line: 1, column: 1 }
10288
+ };
10289
+ });
10290
+ const classToRuleIds = new Map(
10291
+ assembled.classToRuleIds.map((m) => [
10292
+ m.className,
10293
+ m.ruleIds.map((id) => new RuleId(id))
10294
+ ])
10295
+ );
10296
+ return { rules, classToRuleIds };
10297
+ }
10298
+ function _parseCssToIrFallback(css, prefix, native) {
10092
10299
  if (!native?.parseCssRules) {
10093
10300
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
10094
10301
  }
10095
- const prefix = options.prefix ?? "";
10302
+ resetIdGenerator();
10303
+ layerMap.clear();
10304
+ layerOrderMap.clear();
10096
10305
  const rules = [];
10097
10306
  const classToRuleIds = /* @__PURE__ */ new Map();
10098
10307
  const parsed = native.parseCssRules(css);
@@ -10107,7 +10316,7 @@ function parseCssToIr(css, options = {}) {
10107
10316
  const valueId = generateValueId(r.value);
10108
10317
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
10109
10318
  const conditionId = hasMedia ? generateConditionId() : null;
10110
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
10319
+ const conditionResult = 2 /* Unknown */;
10111
10320
  const ruleId = generateRuleId();
10112
10321
  const fingerprint = createFingerprint([className, r.property, r.value]);
10113
10322
  const rule = {
@@ -10121,7 +10330,6 @@ function parseCssToIr(css, options = {}) {
10121
10330
  layer,
10122
10331
  layerOrder,
10123
10332
  specificity: r.specificity,
10124
- // from native — no JS recalculation
10125
10333
  condition: conditionId,
10126
10334
  conditionResult,
10127
10335
  insertionOrder: getNextInsertionOrder(),
@@ -10347,6 +10555,9 @@ async function traceClass(className, options) {
10347
10555
  };
10348
10556
  return result;
10349
10557
  }
10558
+
10559
+ // packages/infrastructure/cli/src/utils/traceTargetService.ts
10560
+ init_internal();
10350
10561
  init_src2();
10351
10562
  function toRelativePath(root, value) {
10352
10563
  const relative = path6__namespace.default.relative(root, value);
@@ -10418,7 +10629,7 @@ function tryCompileClasses(classes) {
10418
10629
  }
10419
10630
  }
10420
10631
  function traceSingleFile(filePath, root) {
10421
- const source = fs12__namespace.default.readFileSync(filePath, "utf8");
10632
+ const source = fs11__namespace.default.readFileSync(filePath, "utf8");
10422
10633
  const classes = uniqueSorted(scanSource(source));
10423
10634
  const imports = extractImports(source);
10424
10635
  const compiled = tryCompileClasses(classes);
@@ -10448,8 +10659,8 @@ function traceDirectory(targetDir, root) {
10448
10659
  });
10449
10660
  const imports = [];
10450
10661
  const importKeys = /* @__PURE__ */ new Set();
10451
- const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10452
- const source = fs12__namespace.default.readFileSync(entry.file, "utf8");
10662
+ const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10663
+ const source = fs11__namespace.default.readFileSync(entry.file, "utf8");
10453
10664
  const fileImports = extractImports(source);
10454
10665
  for (const fileImport of fileImports) {
10455
10666
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10482,10 +10693,10 @@ function traceDirectory(targetDir, root) {
10482
10693
  async function traceTarget(target, options = {}) {
10483
10694
  const root = path6__namespace.default.resolve(options.root ?? process.cwd());
10484
10695
  const resolvedTarget = path6__namespace.default.resolve(root, target);
10485
- if (!fs12__namespace.default.existsSync(resolvedTarget)) {
10696
+ if (!fs11__namespace.default.existsSync(resolvedTarget)) {
10486
10697
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10487
10698
  }
10488
- const stat = fs12__namespace.default.statSync(resolvedTarget);
10699
+ const stat = fs11__namespace.default.statSync(resolvedTarget);
10489
10700
  if (stat.isDirectory()) {
10490
10701
  return traceDirectory(resolvedTarget, root);
10491
10702
  }
@@ -10691,10 +10902,10 @@ async function runGenerateTypesCli(rawArgs) {
10691
10902
  output.writeText("");
10692
10903
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10693
10904
  const outDir = path6__namespace.default.dirname(outPath);
10694
- if (!fs12__namespace.default.existsSync(outDir)) {
10695
- fs12__namespace.default.mkdirSync(outDir, { recursive: true });
10905
+ if (!fs11__namespace.default.existsSync(outDir)) {
10906
+ fs11__namespace.default.mkdirSync(outDir, { recursive: true });
10696
10907
  }
10697
- fs12__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10908
+ fs11__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10698
10909
  logger.ok(path6__namespace.default.relative(cwd2, outPath));
10699
10910
  output.writeText("");
10700
10911
  output.writeText(import_picocolors6.default.dim(" \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"));
@@ -10710,7 +10921,7 @@ async function loadNativeBinding2(cwd2) {
10710
10921
  path6__namespace.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10711
10922
  ];
10712
10923
  for (const candidate of candidates) {
10713
- if (fs12__namespace.default.existsSync(candidate)) {
10924
+ if (fs11__namespace.default.existsSync(candidate)) {
10714
10925
  try {
10715
10926
  return __require(candidate);
10716
10927
  } catch {
@@ -10722,6 +10933,9 @@ async function loadNativeBinding2(cwd2) {
10722
10933
 
10723
10934
  // packages/infrastructure/cli/src/commands/why.ts
10724
10935
  init_errors();
10936
+
10937
+ // packages/infrastructure/cli/src/utils/whyService.ts
10938
+ init_internal();
10725
10939
  init_src2();
10726
10940
  function extractVariantChain(usage) {
10727
10941
  const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
@@ -10769,7 +10983,7 @@ async function whyClass(className, options) {
10769
10983
  for (const file of scanResult.files) {
10770
10984
  const source = (() => {
10771
10985
  try {
10772
- return fs12__namespace.default.readFileSync(file.file, "utf8");
10986
+ return fs11__namespace.default.readFileSync(file.file, "utf8");
10773
10987
  } catch {
10774
10988
  return "";
10775
10989
  }