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