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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module';
2
- import * as fs12 from 'fs';
3
- import fs12__default, { readFileSync, readdirSync } from 'fs';
2
+ import * as fs11 from 'fs';
3
+ import fs11__default, { readFileSync, readdirSync } from 'fs';
4
4
  import * as path6 from 'path';
5
5
  import path6__default, { join, extname } from 'path';
6
6
  import 'crypto';
@@ -8,7 +8,7 @@ import { fileURLToPath, pathToFileURL } from 'url';
8
8
  import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
9
9
  import { availableParallelism } from 'os';
10
10
  import { z } from 'zod';
11
- import fs8 from 'fs/promises';
11
+ import fs7 from 'fs/promises';
12
12
  import { isTTY, spinner, note, outro, intro, text, isCancel, select, confirm } from '@clack/prompts';
13
13
  import { parseArgs } from 'util';
14
14
  import { spawn } from 'child_process';
@@ -987,7 +987,7 @@ var require_command = __commonJS({
987
987
  "packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports$1) {
988
988
  var EventEmitter = __require("events").EventEmitter;
989
989
  var childProcess = __require("child_process");
990
- var path29 = __require("path");
990
+ var path30 = __require("path");
991
991
  var fs16 = __require("fs");
992
992
  var process2 = __require("process");
993
993
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1919,9 +1919,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1919
1919
  let launchWithNode = false;
1920
1920
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1921
1921
  function findFile(baseDir, baseName) {
1922
- const localBin = path29.resolve(baseDir, baseName);
1922
+ const localBin = path30.resolve(baseDir, baseName);
1923
1923
  if (fs16.existsSync(localBin)) return localBin;
1924
- if (sourceExt.includes(path29.extname(baseName))) return void 0;
1924
+ if (sourceExt.includes(path30.extname(baseName))) return void 0;
1925
1925
  const foundExt = sourceExt.find(
1926
1926
  (ext) => fs16.existsSync(`${localBin}${ext}`)
1927
1927
  );
@@ -1939,17 +1939,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1939
1939
  } catch (err) {
1940
1940
  resolvedScriptPath = this._scriptPath;
1941
1941
  }
1942
- executableDir = path29.resolve(
1943
- path29.dirname(resolvedScriptPath),
1942
+ executableDir = path30.resolve(
1943
+ path30.dirname(resolvedScriptPath),
1944
1944
  executableDir
1945
1945
  );
1946
1946
  }
1947
1947
  if (executableDir) {
1948
1948
  let localFile = findFile(executableDir, executableFile);
1949
1949
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1950
- const legacyName = path29.basename(
1950
+ const legacyName = path30.basename(
1951
1951
  this._scriptPath,
1952
- path29.extname(this._scriptPath)
1952
+ path30.extname(this._scriptPath)
1953
1953
  );
1954
1954
  if (legacyName !== this._name) {
1955
1955
  localFile = findFile(
@@ -1960,7 +1960,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1960
1960
  }
1961
1961
  executableFile = localFile || executableFile;
1962
1962
  }
1963
- launchWithNode = sourceExt.includes(path29.extname(executableFile));
1963
+ launchWithNode = sourceExt.includes(path30.extname(executableFile));
1964
1964
  let proc;
1965
1965
  if (process2.platform !== "win32") {
1966
1966
  if (launchWithNode) {
@@ -2800,7 +2800,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2800
2800
  * @return {Command}
2801
2801
  */
2802
2802
  nameFromFilename(filename) {
2803
- this._name = path29.basename(filename, path29.extname(filename));
2803
+ this._name = path30.basename(filename, path30.extname(filename));
2804
2804
  return this;
2805
2805
  }
2806
2806
  /**
@@ -2814,9 +2814,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2814
2814
  * @param {string} [path]
2815
2815
  * @return {(string|null|Command)}
2816
2816
  */
2817
- executableDir(path30) {
2818
- if (path30 === void 0) return this._executableDir;
2819
- this._executableDir = path30;
2817
+ executableDir(path31) {
2818
+ if (path31 === void 0) return this._executableDir;
2819
+ this._executableDir = path31;
2820
2820
  return this;
2821
2821
  }
2822
2822
  /**
@@ -3166,12 +3166,12 @@ function resolveNativeBinary(runtimeDir) {
3166
3166
  if (isBrowser2) {
3167
3167
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
3168
3168
  }
3169
- if (process.env.TWS_DISABLE_NATIVE === "1") {
3169
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
3170
3170
  return { path: null, source: "not-found", platform, tried: [] };
3171
3171
  }
3172
3172
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3173
3173
  if (envPath) {
3174
- if (fs12.existsSync(envPath)) {
3174
+ if (fs11.existsSync(envPath)) {
3175
3175
  return { path: envPath, source: "env", platform, tried };
3176
3176
  }
3177
3177
  tried.push(`env:${envPath} (not found)`);
@@ -3180,7 +3180,7 @@ function resolveNativeBinary(runtimeDir) {
3180
3180
  for (const pkg of prebuiltPkgs) {
3181
3181
  try {
3182
3182
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
3183
- if (fs12.existsSync(candidate)) {
3183
+ if (fs11.existsSync(candidate)) {
3184
3184
  return { path: candidate, source: "prebuilt", platform, tried };
3185
3185
  }
3186
3186
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3197,7 +3197,7 @@ function resolveNativeBinary(runtimeDir) {
3197
3197
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3198
3198
  const candidate = path6.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3199
3199
  tried.push(`self-bundled:${candidate}`);
3200
- if (fs12.existsSync(candidate)) {
3200
+ if (fs11.existsSync(candidate)) {
3201
3201
  return { path: candidate, source: "prebuilt", platform, tried };
3202
3202
  }
3203
3203
  }
@@ -3231,7 +3231,7 @@ function resolveNativeBinary(runtimeDir) {
3231
3231
  }
3232
3232
  for (const candidate of localCandidates) {
3233
3233
  tried.push(`local:${candidate}`);
3234
- if (fs12.existsSync(candidate)) {
3234
+ if (fs11.existsSync(candidate)) {
3235
3235
  return { path: candidate, source: "local", platform, tried };
3236
3236
  }
3237
3237
  }
@@ -3281,9 +3281,9 @@ function createDebugLogger(namespace, label) {
3281
3281
  }
3282
3282
  };
3283
3283
  }
3284
- function formatIssuePath(path29) {
3285
- if (!path29 || path29.length === 0) return "(root)";
3286
- return path29.map(
3284
+ function formatIssuePath(path30) {
3285
+ if (!path30 || path30.length === 0) return "(root)";
3286
+ return path30.map(
3287
3287
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3288
3288
  ).join(".");
3289
3289
  }
@@ -3296,7 +3296,7 @@ function loadNativeBinding(options) {
3296
3296
  for (const candidate of candidates) {
3297
3297
  const candidatePath = path6__default.resolve(runtimeDir, candidate);
3298
3298
  try {
3299
- if (!fs12__default.existsSync(candidatePath) && !fs12__default.existsSync(candidatePath + ".node")) {
3299
+ if (!fs11__default.existsSync(candidatePath) && !fs11__default.existsSync(candidatePath + ".node")) {
3300
3300
  continue;
3301
3301
  }
3302
3302
  const mod = requireNativeModule(candidatePath);
@@ -3328,9 +3328,9 @@ function resolveNativeBindingCandidates(options) {
3328
3328
  }
3329
3329
  }
3330
3330
  if (!includeDefaultCandidates) return candidates;
3331
- if (fs12__default.existsSync(runtimeDir)) {
3331
+ if (fs11__default.existsSync(runtimeDir)) {
3332
3332
  try {
3333
- for (const entry of fs12__default.readdirSync(runtimeDir)) {
3333
+ for (const entry of fs11__default.readdirSync(runtimeDir)) {
3334
3334
  if (entry.endsWith(".node")) candidates.push(entry);
3335
3335
  }
3336
3336
  } catch {
@@ -3397,8 +3397,8 @@ var init_src = __esm({
3397
3397
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3398
3398
  static fromZod(err) {
3399
3399
  const first = err.issues?.[0] ?? err.errors?.[0];
3400
- const path29 = formatIssuePath(first?.path);
3401
- const message = first ? `${path29}: ${first.message}` : "Schema validation failed";
3400
+ const path30 = formatIssuePath(first?.path);
3401
+ const message = first ? `${path30}: ${first.message}` : "Schema validation failed";
3402
3402
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3403
3403
  }
3404
3404
  static wrap(source, code, err) {
@@ -3748,7 +3748,7 @@ function defaultCachePath(rootDir, cacheDir) {
3748
3748
  }
3749
3749
  function readCache(rootDir, cacheDir) {
3750
3750
  const cachePath = defaultCachePath(rootDir, cacheDir);
3751
- fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3751
+ fs11__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3752
3752
  const result = cacheReadNative(cachePath);
3753
3753
  if (!result) return [];
3754
3754
  return result.entries.map((e) => ({
@@ -3763,7 +3763,7 @@ function readCache(rootDir, cacheDir) {
3763
3763
  }
3764
3764
  function writeCache(rootDir, entries, cacheDir) {
3765
3765
  const cachePath = defaultCachePath(rootDir, cacheDir);
3766
- fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3766
+ fs11__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3767
3767
  const success = cacheWriteNative(cachePath, entries);
3768
3768
  if (!success) {
3769
3769
  throw new Error(
@@ -3790,27 +3790,7 @@ var init_cache_native = __esm({
3790
3790
  function collectFiles(rootDir, extensions, ignoreDirs) {
3791
3791
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
3792
3792
  if (native !== null) return native;
3793
- const files = [];
3794
- function walk(dir) {
3795
- let entries;
3796
- try {
3797
- entries = fs12__default.readdirSync(dir, { withFileTypes: true });
3798
- } catch {
3799
- return;
3800
- }
3801
- for (const entry of entries) {
3802
- const fullPath = path6__default.join(dir, entry.name);
3803
- const rel = path6__default.relative(rootDir, fullPath);
3804
- if (entry.isDirectory()) {
3805
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__default.sep));
3806
- if (!ignored) walk(fullPath);
3807
- } else if (isScannableFile(entry.name, extensions)) {
3808
- files.push(fullPath);
3809
- }
3810
- }
3811
- }
3812
- walk(rootDir);
3813
- return files;
3793
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
3814
3794
  }
3815
3795
  function mergeResults(batchResults) {
3816
3796
  const files = batchResults.map((r) => ({
@@ -3820,8 +3800,7 @@ function mergeResults(batchResults) {
3820
3800
  }));
3821
3801
  const native = rebuildWorkspaceResultNative(files);
3822
3802
  if (native) return native;
3823
- const unique = new Set(files.flatMap((f) => f.classes));
3824
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
3803
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
3825
3804
  }
3826
3805
  function runChunkInWorker(filePaths) {
3827
3806
  return new Promise((resolve2, reject) => {
@@ -3892,12 +3871,12 @@ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, S
3892
3871
  var init_schemas = __esm({
3893
3872
  "packages/domain/scanner/src/schemas.ts"() {
3894
3873
  init_src();
3895
- formatIssuePath2 = (path29) => path29.length > 0 ? path29.map(
3874
+ formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
3896
3875
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3897
3876
  ).join(".") : "<root>";
3898
3877
  formatIssues = (error) => error.issues.map((issue) => {
3899
- const path29 = formatIssuePath2(issue.path);
3900
- return `${path29}: ${issue.message}`;
3878
+ const path30 = formatIssuePath2(issue.path);
3879
+ return `${path30}: ${issue.message}`;
3901
3880
  }).join("; ");
3902
3881
  parseWithSchema = (schema, data, label) => {
3903
3882
  const parsed = schema.safeParse(data);
@@ -3960,7 +3939,7 @@ __export(src_exports, {
3960
3939
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3961
3940
  batchExtractClassesNative: () => batchExtractClassesNative,
3962
3941
  extractClassesNative: () => extractClassesNative,
3963
- isScannableFile: () => isScannableFile,
3942
+ isScannableFile: () => isScannableFile2,
3964
3943
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3965
3944
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3966
3945
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
@@ -3994,7 +3973,7 @@ function resolveScannerWorkerModulePath() {
3994
3973
  path6__default.resolve(runtimeDir, "worker.ts")
3995
3974
  ];
3996
3975
  for (const candidate of candidates) {
3997
- if (fs12__default.existsSync(candidate)) return candidate;
3976
+ if (fs11__default.existsSync(candidate)) return candidate;
3998
3977
  }
3999
3978
  return null;
4000
3979
  }
@@ -4051,7 +4030,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4051
4030
  if (!currentDir) continue;
4052
4031
  const entries = (() => {
4053
4032
  try {
4054
- return fs12__default.readdirSync(currentDir, { withFileTypes: true });
4033
+ return fs11__default.readdirSync(currentDir, { withFileTypes: true });
4055
4034
  } catch {
4056
4035
  return [];
4057
4036
  }
@@ -4089,7 +4068,7 @@ function scanSource(source) {
4089
4068
  "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"
4090
4069
  );
4091
4070
  }
4092
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4071
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4093
4072
  return includeExtensions.includes(path6__default.extname(filePath));
4094
4073
  }
4095
4074
  function scanFile(filePath) {
@@ -4150,7 +4129,7 @@ function scanWorkspace(rootDir, options = {}) {
4150
4129
  for (const filePath of candidates) {
4151
4130
  const stat = (() => {
4152
4131
  try {
4153
- return fs12__default.statSync(filePath);
4132
+ return fs11__default.statSync(filePath);
4154
4133
  } catch {
4155
4134
  return null;
4156
4135
  }
@@ -4176,7 +4155,7 @@ function scanWorkspace(rootDir, options = {}) {
4176
4155
  for (const { filePath, stat, size, cached } of ranked) {
4177
4156
  const content = (() => {
4178
4157
  try {
4179
- return fs12__default.readFileSync(filePath, "utf8");
4158
+ return fs11__default.readFileSync(filePath, "utf8");
4180
4159
  } catch {
4181
4160
  return null;
4182
4161
  }
@@ -4320,7 +4299,7 @@ var init_src2 = __esm({
4320
4299
  )
4321
4300
  ];
4322
4301
  for (const fullPath of candidates) {
4323
- if (!fs12__default.existsSync(fullPath)) continue;
4302
+ if (!fs11__default.existsSync(fullPath)) continue;
4324
4303
  try {
4325
4304
  const required = req(fullPath);
4326
4305
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4362,7 +4341,7 @@ function isRecord(value) {
4362
4341
  }
4363
4342
  async function pathExists(filePath) {
4364
4343
  try {
4365
- await fs12__default.promises.access(filePath, fs12__default.constants.F_OK);
4344
+ await fs11__default.promises.access(filePath, fs11__default.constants.F_OK);
4366
4345
  return true;
4367
4346
  } catch {
4368
4347
  return false;
@@ -4483,7 +4462,7 @@ var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchem
4483
4462
  var init_schemas2 = __esm({
4484
4463
  "packages/domain/analyzer/src/schemas.ts"() {
4485
4464
  init_src();
4486
- formatIssuePath3 = (path29) => path29.length > 0 ? path29.map(
4465
+ formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
4487
4466
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
4488
4467
  ).join(".") : "<root>";
4489
4468
  isPlainObject = (value) => {
@@ -4492,8 +4471,8 @@ var init_schemas2 = __esm({
4492
4471
  return proto === Object.prototype || proto === null;
4493
4472
  };
4494
4473
  formatIssues2 = (error) => error.issues.map((issue) => {
4495
- const path29 = formatIssuePath3(issue.path);
4496
- return `${path29}: ${issue.message}`;
4474
+ const path30 = formatIssuePath3(issue.path);
4475
+ return `${path30}: ${issue.message}`;
4497
4476
  }).join("; ");
4498
4477
  parseWithSchema2 = (schema, data, label) => {
4499
4478
  const parsed = schema.safeParse(data);
@@ -4589,7 +4568,7 @@ var init_schemas2 = __esm({
4589
4568
  parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
4590
4569
  }
4591
4570
  });
4592
- var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, isArbitraryUtility, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4571
+ var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4593
4572
  var init_semantic = __esm({
4594
4573
  "packages/domain/analyzer/src/semantic.ts"() {
4595
4574
  init_binding();
@@ -4602,27 +4581,13 @@ var init_semantic = __esm({
4602
4581
  const base = parts.pop() ?? className;
4603
4582
  return { variantKey: parts.join(":"), base };
4604
4583
  };
4605
- isArbitraryUtility = (baseClass) => {
4606
- return baseClass.includes("[") && baseClass.includes("]");
4607
- };
4608
- resolveConflictGroup = (base) => {
4609
- if (isArbitraryUtility(base)) return null;
4610
- if (["block", "inline", "inline-block", "inline-flex", "flex", "grid", "hidden"].includes(base))
4611
- return "display";
4612
- if (base.startsWith("bg-")) return "bg";
4613
- if (base.startsWith("text-")) return "text";
4614
- if (base.startsWith("font-")) return "font";
4615
- if (base.startsWith("rounded")) return "rounded";
4616
- if (base.startsWith("shadow")) return "shadow";
4617
- if (base.startsWith("border-")) return "border";
4618
- if (base.startsWith("opacity-")) return "opacity";
4619
- if (base.startsWith("w-") || base.startsWith("min-w-") || base.startsWith("max-w-"))
4620
- return "width";
4621
- if (base.startsWith("h-") || base.startsWith("min-h-") || base.startsWith("max-h-"))
4622
- return "height";
4623
- if (base.startsWith("p-") || base.startsWith("px-") || base.startsWith("py-")) return "padding";
4624
- if (base.startsWith("m-") || base.startsWith("mx-") || base.startsWith("my-")) return "margin";
4625
- return null;
4584
+ resolveConflictGroup = async (base) => {
4585
+ const native = await getNativeBinding();
4586
+ if (!native?.resolveConflictGroup) {
4587
+ throw new Error("Native binding 'resolveConflictGroup' is required but not available.");
4588
+ }
4589
+ const result = native.resolveConflictGroup(base);
4590
+ return result.length > 0 ? result : null;
4626
4591
  };
4627
4592
  detectConflicts = async (usages) => {
4628
4593
  const native = await getNativeBinding();
@@ -4710,7 +4675,7 @@ var init_semantic = __esm({
4710
4675
  return out;
4711
4676
  };
4712
4677
  collectSafelistFromSource = async (configPath) => {
4713
- const source = await fs12__default.promises.readFile(configPath, "utf8");
4678
+ const source = await fs11__default.promises.readFile(configPath, "utf8");
4714
4679
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4715
4680
  const allTokens = extractClassesNative2(source);
4716
4681
  const hasSafelist = source.includes("safelist");
@@ -4737,7 +4702,7 @@ var init_semantic = __esm({
4737
4702
  customUtilities: /* @__PURE__ */ new Set()
4738
4703
  };
4739
4704
  }
4740
- const configStat = await fs12__default.promises.stat(configPath).catch(() => null);
4705
+ const configStat = await fs11__default.promises.stat(configPath).catch(() => null);
4741
4706
  if (configStat) {
4742
4707
  const cached = tailwindConfigCache.get(configPath);
4743
4708
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5033,12 +4998,12 @@ var init_classToCss = __esm({
5033
4998
  init_binding();
5034
4999
  init_schemas2();
5035
5000
  init_utils();
5036
- normalizeClassInput = (input, _binding) => {
5001
+ normalizeClassInput = (input, binding) => {
5037
5002
  if (typeof input === "string") {
5038
- if (_binding?.normalizeClassInput) {
5039
- return _binding.normalizeClassInput(input);
5003
+ if (!binding.normalizeClassInput) {
5004
+ throw new Error("FATAL: Native binding 'normalizeClassInput' is required but not available.");
5040
5005
  }
5041
- return input.split(/\s+/).map((item) => item.trim()).filter((item) => item.length > 0);
5006
+ return binding.normalizeClassInput(input);
5042
5007
  }
5043
5008
  if (!Array.isArray(input)) {
5044
5009
  throw new TypeError("classToCss input must be a string or an array of strings.");
@@ -5070,11 +5035,11 @@ var init_classToCss = __esm({
5070
5035
  }
5071
5036
  };
5072
5037
  declarationMapToString = (declarationMap, binding) => {
5073
- const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5074
- if (binding?.declarationMapToString) {
5075
- return binding.declarationMapToString(entries);
5038
+ if (!binding.declarationMapToString) {
5039
+ throw new Error("FATAL: Native binding 'declarationMapToString' is required but not available.");
5076
5040
  }
5077
- return entries.map(({ property, value }) => `${property}: ${value}`).join("; ");
5041
+ const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5042
+ return binding.declarationMapToString(entries);
5078
5043
  };
5079
5044
  classToCss = async (input, options = {}) => {
5080
5045
  const binding = await requireNativeCssCompiler();
@@ -5170,7 +5135,7 @@ var init_src3 = __esm({
5170
5135
  });
5171
5136
  async function pathExists2(filePath) {
5172
5137
  try {
5173
- await fs8.access(filePath);
5138
+ await fs7.access(filePath);
5174
5139
  return true;
5175
5140
  } catch {
5176
5141
  return false;
@@ -5178,7 +5143,7 @@ async function pathExists2(filePath) {
5178
5143
  }
5179
5144
  async function readFileSafe(filePath) {
5180
5145
  try {
5181
- return await fs8.readFile(filePath, "utf8");
5146
+ return await fs7.readFile(filePath, "utf8");
5182
5147
  } catch {
5183
5148
  return null;
5184
5149
  }
@@ -5197,8 +5162,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5197
5162
  options.onDryRun?.(`write ${filePath}`);
5198
5163
  return;
5199
5164
  }
5200
- await fs8.mkdir(path6__default.dirname(filePath), { recursive: true });
5201
- await fs8.writeFile(filePath, content, "utf8");
5165
+ await fs7.mkdir(path6__default.dirname(filePath), { recursive: true });
5166
+ await fs7.writeFile(filePath, content, "utf8");
5202
5167
  }
5203
5168
  async function ensureFileSafe(filePath, content, options = {}) {
5204
5169
  if (await pathExists2(filePath)) return "skipped";
@@ -6071,7 +6036,7 @@ var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttem
6071
6036
  var init_nativeBridge = __esm({
6072
6037
  "packages/domain/compiler/src/nativeBridge.ts"() {
6073
6038
  init_src();
6074
- _loadNative = (path29) => __require(path29);
6039
+ _loadNative = (path30) => __require(path30);
6075
6040
  log3 = (...args) => {
6076
6041
  if (process.env.DEBUG?.includes("compiler:native")) {
6077
6042
  console.log("[compiler:native]", ...args);
@@ -6129,6 +6094,78 @@ Tried paths: ${result.tried.join("\n")}`);
6129
6094
  }
6130
6095
  });
6131
6096
 
6097
+ // packages/domain/compiler/src/compiler/index.ts
6098
+ var init_compiler = __esm({
6099
+ "packages/domain/compiler/src/compiler/index.ts"() {
6100
+ }
6101
+ });
6102
+
6103
+ // packages/domain/compiler/src/parser/index.ts
6104
+ var init_parser = __esm({
6105
+ "packages/domain/compiler/src/parser/index.ts"() {
6106
+ }
6107
+ });
6108
+
6109
+ // packages/domain/compiler/src/analyzer/index.ts
6110
+ var init_analyzer = __esm({
6111
+ "packages/domain/compiler/src/analyzer/index.ts"() {
6112
+ }
6113
+ });
6114
+
6115
+ // packages/domain/compiler/src/cache/index.ts
6116
+ var init_cache = __esm({
6117
+ "packages/domain/compiler/src/cache/index.ts"() {
6118
+ }
6119
+ });
6120
+
6121
+ // packages/domain/compiler/src/redis/index.ts
6122
+ var init_redis = __esm({
6123
+ "packages/domain/compiler/src/redis/index.ts"() {
6124
+ }
6125
+ });
6126
+
6127
+ // packages/domain/compiler/src/watch/index.ts
6128
+ var init_watch = __esm({
6129
+ "packages/domain/compiler/src/watch/index.ts"() {
6130
+ }
6131
+ });
6132
+ var compileCssFromClasses;
6133
+ var init_src4 = __esm({
6134
+ "packages/domain/compiler/src/index.ts"() {
6135
+ init_nativeBridge();
6136
+ init_compiler();
6137
+ init_parser();
6138
+ init_analyzer();
6139
+ init_cache();
6140
+ init_redis();
6141
+ init_watch();
6142
+ compileCssFromClasses = (classes, prefix) => {
6143
+ const native = getNativeBridge();
6144
+ if (!native?.transformSource) {
6145
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
6146
+ }
6147
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
6148
+ if (!result) {
6149
+ throw new Error("FATAL: transformSource returned null");
6150
+ }
6151
+ return result;
6152
+ };
6153
+ }
6154
+ });
6155
+
6156
+ // packages/domain/compiler/src/internal.ts
6157
+ var init_internal = __esm({
6158
+ "packages/domain/compiler/src/internal.ts"() {
6159
+ init_src4();
6160
+ init_compiler();
6161
+ init_parser();
6162
+ init_analyzer();
6163
+ init_cache();
6164
+ init_redis();
6165
+ init_watch();
6166
+ }
6167
+ });
6168
+
6132
6169
  // packages/infrastructure/cli/src/commands/program.ts
6133
6170
  init_esm();
6134
6171
 
@@ -6426,7 +6463,7 @@ async function findSourceFiles(dir) {
6426
6463
  const out = [];
6427
6464
  async function walk(currentDir) {
6428
6465
  if (!await pathExists2(currentDir)) return;
6429
- const entries = await fs8.readdir(currentDir, { withFileTypes: true });
6466
+ const entries = await fs7.readdir(currentDir, { withFileTypes: true });
6430
6467
  for (const entry of entries) {
6431
6468
  const fullPath = path6__default.join(currentDir, entry.name);
6432
6469
  if (entry.isDirectory()) {
@@ -6492,12 +6529,12 @@ async function runMigrateCli(rawArgs) {
6492
6529
  report.configWrites += await migrateConfig(root, dryRun);
6493
6530
  }
6494
6531
  for (const filePath of files) {
6495
- const source = await fs8.readFile(filePath, "utf8");
6532
+ const source = await fs7.readFile(filePath, "utf8");
6496
6533
  const migrated = migrateSource(source, { includeImports, includeClasses });
6497
6534
  if (migrated.output !== source) {
6498
6535
  report.updatedFiles++;
6499
6536
  if (!dryRun) {
6500
- await fs8.writeFile(filePath, migrated.output, "utf8");
6537
+ await fs7.writeFile(filePath, migrated.output, "utf8");
6501
6538
  }
6502
6539
  }
6503
6540
  report.classRenames += migrated.classRenames;
@@ -6563,8 +6600,8 @@ function buildClassNames(files, uniqueClasses) {
6563
6600
  function writeScanCache(root, cacheData) {
6564
6601
  const cacheDir = path6__default.join(root, ".tailwind-styled");
6565
6602
  const cachePath = path6__default.join(cacheDir, "scan-cache.json");
6566
- fs12__default.mkdirSync(cacheDir, { recursive: true });
6567
- fs12__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6603
+ fs11__default.mkdirSync(cacheDir, { recursive: true });
6604
+ fs11__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6568
6605
  return cachePath;
6569
6606
  }
6570
6607
  async function runScanCli(rawArgs) {
@@ -6738,26 +6775,62 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
6738
6775
  return `${ups}/.next/tw-classes/**`;
6739
6776
  }
6740
6777
  }
6778
+ function computeStateStaticImportPath(cssFilePath, cwd2) {
6779
+ try {
6780
+ const nodePath = __require("path");
6781
+ const cssAbs = nodePath.resolve(cwd2, cssFilePath);
6782
+ const cssDir = nodePath.dirname(cssAbs);
6783
+ const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
6784
+ const rel = nodePath.relative(cssDir, stateStaticAbs).replace(/\\/g, "/");
6785
+ return rel.startsWith(".") ? rel : `./${rel}`;
6786
+ } catch {
6787
+ const depth = cssFilePath.split("/").length - 1;
6788
+ const ups = Array(depth).fill("..").join("/");
6789
+ return `${ups}/.next/_tw-state-static.css`;
6790
+ }
6791
+ }
6741
6792
  function patchTailwindCssImpl(src, bundler, cssFilePath, cwd2) {
6742
6793
  const hasTailwindImport = src.includes('@import "tailwindcss"') || src.includes("@import 'tailwindcss'");
6743
- const hasSafelistSource2 = src.includes("tailwind-styled-safelist.css");
6794
+ const hasSafelistSource2 = src.includes("tw-classes");
6795
+ const hasStateImport = src.includes("_tw-state-static.css");
6744
6796
  const needsSafelistSource = bundler === "next" && !hasSafelistSource2;
6745
- const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tailwind-styled-safelist.css";
6797
+ const needsStateImport = bundler === "next" && !hasStateImport;
6798
+ const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tw-classes/**";
6799
+ const stateImportRelPath = needsStateImport && cssFilePath && cwd2 ? computeStateStaticImportPath(cssFilePath, cwd2) : "../.next/_tw-state-static.css";
6746
6800
  const safelistSource = `@source "${safelistRelPath}";`;
6801
+ const stateImport = `@import "${stateImportRelPath}";`;
6747
6802
  if (hasTailwindImport) {
6748
- if (!needsSafelistSource) return null;
6749
- const patched = src.replace(
6750
- /(@import\s+['"]tailwindcss['"];?)/,
6751
- `$1
6803
+ if (!needsSafelistSource && !needsStateImport) return null;
6804
+ let patched = src;
6805
+ if (needsSafelistSource) {
6806
+ patched = patched.replace(
6807
+ /(@import\s+['"]tailwindcss['"];?)/,
6808
+ `$1
6752
6809
  ${safelistSource}`
6753
- );
6810
+ );
6811
+ }
6812
+ if (needsStateImport) {
6813
+ if (patched.includes("tw-classes")) {
6814
+ patched = patched.replace(
6815
+ /(@source\s+["'][^"']+["'];?)/,
6816
+ `$1
6817
+ ${stateImport}`
6818
+ );
6819
+ } else {
6820
+ patched = patched.replace(
6821
+ /(@import\s+['"]tailwindcss['"];?)/,
6822
+ `$1
6823
+ ${stateImport}`
6824
+ );
6825
+ }
6826
+ }
6754
6827
  return patched === src ? null : patched;
6755
6828
  }
6756
- const base = `@import "tailwindcss";
6757
- ${needsSafelistSource ? `${safelistSource}
6758
- ` : ""}
6759
- ${src}`;
6760
- return base;
6829
+ const lines = [`@import "tailwindcss";`];
6830
+ if (needsSafelistSource) lines.push(safelistSource);
6831
+ if (needsStateImport) lines.push(stateImport);
6832
+ lines.push("", src);
6833
+ return lines.join("\n");
6761
6834
  }
6762
6835
  function patchTsConfigImpl(src) {
6763
6836
  try {
@@ -7559,7 +7632,7 @@ async function loadRegistry(context) {
7559
7632
  if (!registryPath) {
7560
7633
  throw new CliUsageError("Plugin registry file not found.");
7561
7634
  }
7562
- const raw = await fs8.readFile(registryPath, "utf8");
7635
+ const raw = await fs7.readFile(registryPath, "utf8");
7563
7636
  const data = JSON.parse(raw);
7564
7637
  return [
7565
7638
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7694,8 +7767,8 @@ var deployCommand = {
7694
7767
  return;
7695
7768
  }
7696
7769
  const cacheDir = path6__default.join(process.cwd(), ".tw-cache");
7697
- await fs8.mkdir(cacheDir, { recursive: true });
7698
- await fs8.writeFile(
7770
+ await fs7.mkdir(cacheDir, { recursive: true });
7771
+ await fs7.writeFile(
7699
7772
  path6__default.join(cacheDir, "deploy-manifest.json"),
7700
7773
  JSON.stringify(manifest, null, 2)
7701
7774
  );
@@ -7796,22 +7869,27 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7796
7869
  issues.push({ severity, type, message, suggestion, location });
7797
7870
  }
7798
7871
  function readJsonFile(filePath) {
7799
- if (!fs12__default.existsSync(filePath)) return null;
7872
+ if (!fs11__default.existsSync(filePath)) return null;
7800
7873
  try {
7801
- return JSON.parse(fs12__default.readFileSync(filePath, "utf8"));
7802
- } catch {
7874
+ return JSON.parse(fs11__default.readFileSync(filePath, "utf8"));
7875
+ } catch (parseErr) {
7876
+ if (process.env.TWS_DEBUG === "1") {
7877
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
7878
+ process.stderr.write(`[tw:doctor] malformed JSON: ${filePath} \u2014 ${msg}
7879
+ `);
7880
+ }
7803
7881
  return null;
7804
7882
  }
7805
7883
  }
7806
7884
  function findWorkspacePackageJsonFiles(root) {
7807
7885
  const packagesDir = path6__default.join(root, "packages");
7808
- if (!fs12__default.existsSync(packagesDir)) return [];
7809
- return fs12__default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs12__default.existsSync(filePath));
7886
+ if (!fs11__default.existsSync(packagesDir)) return [];
7887
+ return fs11__default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11__default.existsSync(filePath));
7810
7888
  }
7811
7889
  function findFiles(dir, ext) {
7812
7890
  const files = [];
7813
7891
  try {
7814
- const entries = fs12__default.readdirSync(dir, { withFileTypes: true });
7892
+ const entries = fs11__default.readdirSync(dir, { withFileTypes: true });
7815
7893
  for (const entry of entries) {
7816
7894
  const fullPath = path6__default.join(dir, entry.name);
7817
7895
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7820,7 +7898,12 @@ function findFiles(dir, ext) {
7820
7898
  files.push(fullPath);
7821
7899
  }
7822
7900
  }
7823
- } catch {
7901
+ } catch (dirErr) {
7902
+ if (process.env.TWS_DEBUG === "1") {
7903
+ const msg = dirErr instanceof Error ? dirErr.message : String(dirErr);
7904
+ process.stderr.write(`[tw:doctor] findFiles error in ${dir}: ${msg}
7905
+ `);
7906
+ }
7824
7907
  return files;
7825
7908
  }
7826
7909
  return files;
@@ -7973,7 +8056,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7973
8056
  const cssFiles = findFiles(root, ".css");
7974
8057
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
7975
8058
  try {
7976
- const content = fs12__default.readFileSync(filePath, "utf8");
8059
+ const content = fs11__default.readFileSync(filePath, "utf8");
7977
8060
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
7978
8061
  } catch {
7979
8062
  return false;
@@ -7997,7 +8080,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7997
8080
  );
7998
8081
  }
7999
8082
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
8000
- const hasConfig = configFiles.some((name) => fs12__default.existsSync(path6__default.join(root, name)));
8083
+ const hasConfig = configFiles.some((name) => fs11__default.existsSync(path6__default.join(root, name)));
8001
8084
  addCheck(
8002
8085
  checks,
8003
8086
  "tailwind",
@@ -8657,6 +8740,7 @@ init_args();
8657
8740
  init_errors();
8658
8741
  init_fs();
8659
8742
  init_json();
8743
+ init_src4();
8660
8744
  var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
8661
8745
  var DEFAULT_TW_CONFIG = `${JSON.stringify(
8662
8746
  {
@@ -8671,6 +8755,89 @@ var DEFAULT_TW_CONFIG = `${JSON.stringify(
8671
8755
  function pkgHasDep(pkg, name) {
8672
8756
  return Boolean(pkg.dependencies?.[name] || pkg.devDependencies?.[name]);
8673
8757
  }
8758
+ async function validateThemeConfig(cwd2) {
8759
+ const results = [];
8760
+ try {
8761
+ const native = getNativeBridge();
8762
+ if (!native) {
8763
+ results.push({ type: "theme", valid: false, message: "Native binding not available" });
8764
+ return results;
8765
+ }
8766
+ const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
8767
+ let configPath = null;
8768
+ for (const file of twConfigFiles) {
8769
+ if (await pathExists2(path6__default.join(cwd2, file))) {
8770
+ configPath = path6__default.join(cwd2, file);
8771
+ break;
8772
+ }
8773
+ }
8774
+ if (!configPath) {
8775
+ results.push({ type: "theme-config-missing", valid: false, message: "No tailwind.config found" });
8776
+ return results;
8777
+ }
8778
+ try {
8779
+ const configUrl = pathToFileURL(configPath);
8780
+ const configModule = await import(configUrl.href);
8781
+ const config = configModule.default || configModule;
8782
+ const theme = config.theme || {};
8783
+ if (theme.colors && native.validateColorsNapi) {
8784
+ try {
8785
+ const colorsJson = JSON.stringify(theme.colors);
8786
+ const isValid = native.validateColorsNapi(colorsJson);
8787
+ results.push({
8788
+ type: "theme-colors",
8789
+ valid: isValid,
8790
+ message: isValid ? "Colors theme validated OK" : "Invalid colors in theme"
8791
+ });
8792
+ } catch (err) {
8793
+ results.push({
8794
+ type: "theme-colors",
8795
+ valid: false,
8796
+ message: `Color validation error: ${err instanceof Error ? err.message : String(err)}`
8797
+ });
8798
+ }
8799
+ }
8800
+ if (theme.screens && native.validateBreakpointsNapi) {
8801
+ try {
8802
+ const screensJson = JSON.stringify(theme.screens);
8803
+ const isValid = native.validateBreakpointsNapi(screensJson);
8804
+ results.push({
8805
+ type: "theme-breakpoints",
8806
+ valid: isValid,
8807
+ message: isValid ? "Breakpoints validated OK" : "Invalid breakpoints in theme"
8808
+ });
8809
+ } catch (err) {
8810
+ results.push({
8811
+ type: "theme-breakpoints",
8812
+ valid: false,
8813
+ message: `Breakpoints validation error: ${err instanceof Error ? err.message : String(err)}`
8814
+ });
8815
+ }
8816
+ }
8817
+ if (native.runHealthCheck) {
8818
+ try {
8819
+ native.runHealthCheck();
8820
+ results.push({ type: "theme-integrity", valid: true, message: "Theme integrity check passed" });
8821
+ } catch {
8822
+ results.push({ type: "theme-integrity", valid: false, message: "Theme integrity check failed" });
8823
+ }
8824
+ }
8825
+ } catch (err) {
8826
+ results.push({
8827
+ type: "theme-load",
8828
+ valid: false,
8829
+ message: `Failed to load theme config: ${err instanceof Error ? err.message : String(err)}`
8830
+ });
8831
+ }
8832
+ } catch (err) {
8833
+ results.push({
8834
+ type: "theme-validation",
8835
+ valid: false,
8836
+ message: `Theme validation failed: ${err instanceof Error ? err.message : String(err)}`
8837
+ });
8838
+ }
8839
+ return results;
8840
+ }
8674
8841
  function nodeVersion() {
8675
8842
  const full = process.version.replace("v", "");
8676
8843
  const major = parseInt(full.split(".")[0], 10);
@@ -8795,6 +8962,16 @@ async function runPreflightCli(rawArgs) {
8795
8962
  "Run: tw migrate --dry-run to see migration steps"
8796
8963
  );
8797
8964
  }
8965
+ const themeValidation = await validateThemeConfig(cwd2);
8966
+ for (const validation of themeValidation) {
8967
+ check(
8968
+ results,
8969
+ `theme-${validation.type}`,
8970
+ `Theme ${validation.type}`,
8971
+ validation.valid,
8972
+ validation.message
8973
+ );
8974
+ }
8798
8975
  const hasTsConfig = await pathExists2(path6__default.join(cwd2, "tsconfig.json"));
8799
8976
  check(
8800
8977
  results,
@@ -9282,19 +9459,8 @@ var syncCommand = {
9282
9459
  var import_picocolors5 = __toESM(require_picocolors());
9283
9460
  init_errors();
9284
9461
 
9285
- // packages/domain/compiler/src/index.ts
9286
- init_nativeBridge();
9287
- var compileCssFromClasses = (classes, prefix) => {
9288
- const native = getNativeBridge();
9289
- if (!native?.transformSource) {
9290
- throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
9291
- }
9292
- const result = native.transformSource(classes.join(" "), { prefix: prefix });
9293
- if (!result) {
9294
- throw new Error("FATAL: transformSource returned null");
9295
- }
9296
- return result;
9297
- };
9462
+ // packages/infrastructure/cli/src/utils/traceService.ts
9463
+ init_internal();
9298
9464
 
9299
9465
  // packages/domain/engine/src/native-bridge.ts
9300
9466
  init_src();
@@ -9745,37 +9911,33 @@ var CascadeResolutionId = class {
9745
9911
  return `R${this.value}`;
9746
9912
  }
9747
9913
  };
9748
- var _propertyNamesFallback = /* @__PURE__ */ new Map();
9749
- var _valueNamesFallback = /* @__PURE__ */ new Map();
9750
9914
  function registerPropertyName(id, name) {
9751
9915
  const native = getNativeEngineBinding();
9752
- if (native?.registerPropertyName) {
9753
- native.registerPropertyName(id.value, name);
9754
- return;
9916
+ if (!native?.registerPropertyName) {
9917
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
9755
9918
  }
9756
- _propertyNamesFallback.set(id.value, name);
9919
+ native.registerPropertyName(id.value, name);
9757
9920
  }
9758
9921
  function registerValueName(id, name) {
9759
9922
  const native = getNativeEngineBinding();
9760
- if (native?.registerValueName) {
9761
- native.registerValueName(id.value, name);
9762
- return;
9923
+ if (!native?.registerValueName) {
9924
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
9763
9925
  }
9764
- _valueNamesFallback.set(id.value, name);
9926
+ native.registerValueName(id.value, name);
9765
9927
  }
9766
9928
  function propertyIdToString(id) {
9767
9929
  const native = getNativeEngineBinding();
9768
- if (native?.propertyIdToString) {
9769
- return native.propertyIdToString(id.value);
9930
+ if (!native?.propertyIdToString) {
9931
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
9770
9932
  }
9771
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
9933
+ return native.propertyIdToString(id.value);
9772
9934
  }
9773
9935
  function valueIdToString(id) {
9774
9936
  const native = getNativeEngineBinding();
9775
- if (native?.valueIdToString) {
9776
- return native.valueIdToString(id.value);
9937
+ if (!native?.valueIdToString) {
9938
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
9777
9939
  }
9778
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
9940
+ return native.valueIdToString(id.value);
9779
9941
  }
9780
9942
  var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9781
9943
  CascadeStage2[CascadeStage2["Origin"] = 0] = "Origin";
@@ -9785,19 +9947,12 @@ var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9785
9947
  CascadeStage2[CascadeStage2["Order"] = 4] = "Order";
9786
9948
  return CascadeStage2;
9787
9949
  })(CascadeStage || {});
9788
- function createFingerprintFallback(parts) {
9789
- const hash = parts.reduce(
9790
- (acc, part) => part.split("").reduce((h, char) => (h << 5) - h + char.charCodeAt(0) & h, acc),
9791
- 0
9792
- );
9793
- return Math.abs(hash).toString(36);
9794
- }
9795
9950
  function createFingerprint(parts) {
9796
9951
  const native = getNativeEngineBinding();
9797
- if (native?.createFingerprint) {
9798
- return native.createFingerprint(parts);
9952
+ if (!native?.createFingerprint) {
9953
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
9799
9954
  }
9800
- return createFingerprintFallback(parts);
9955
+ return native.createFingerprint(parts);
9801
9956
  }
9802
9957
 
9803
9958
  // packages/domain/engine/src/reverseLookup.ts
@@ -10059,14 +10214,68 @@ function detectLayerFromClassName(className) {
10059
10214
  return null;
10060
10215
  }
10061
10216
  function parseCssToIr(css, options = {}) {
10062
- resetIdGenerator();
10217
+ const native = getNativeEngineBinding();
10218
+ const prefix = options.prefix ?? "";
10219
+ if (native?.assembleCssIr) {
10220
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
10221
+ }
10222
+ return _parseCssToIrFallback(css, prefix, native);
10223
+ }
10224
+ function _parseCssToIrFast(assembled) {
10225
+ const native = getNativeEngineBinding();
10063
10226
  layerMap.clear();
10064
10227
  layerOrderMap.clear();
10065
- const native = getNativeEngineBinding();
10228
+ for (const le of assembled.layers) {
10229
+ const lid = new LayerId(le.layerId);
10230
+ layerMap.set(le.name, lid);
10231
+ layerOrderMap.set(le.name, le.order);
10232
+ }
10233
+ const rules = assembled.rules.map((r) => {
10234
+ const propertyId = new PropertyId(r.propertyId);
10235
+ const valueId = new ValueId(r.valueId);
10236
+ if (native?.registerPropertyName) {
10237
+ native.registerPropertyName(r.propertyId, r.propertyName);
10238
+ } else {
10239
+ registerPropertyName(propertyId, r.propertyName);
10240
+ }
10241
+ if (native?.registerValueName) {
10242
+ native.registerValueName(r.valueId, r.valueName);
10243
+ } else {
10244
+ registerValueName(valueId, r.valueName);
10245
+ }
10246
+ return {
10247
+ id: new RuleId(r.ruleId),
10248
+ selector: new SelectorId(r.selectorId),
10249
+ variantChain: new VariantChainId(0),
10250
+ property: propertyId,
10251
+ value: valueId,
10252
+ origin: r.origin,
10253
+ importance: r.importance,
10254
+ layer: r.layerId >= 0 ? new LayerId(r.layerId) : null,
10255
+ layerOrder: r.layerOrder,
10256
+ specificity: r.specificity,
10257
+ condition: r.conditionId >= 0 ? new ConditionId(r.conditionId) : null,
10258
+ conditionResult: r.conditionResult,
10259
+ insertionOrder: r.insertionOrder,
10260
+ fingerprint: r.fingerprint,
10261
+ source: { file: "", line: 1, column: 1 }
10262
+ };
10263
+ });
10264
+ const classToRuleIds = new Map(
10265
+ assembled.classToRuleIds.map((m) => [
10266
+ m.className,
10267
+ m.ruleIds.map((id) => new RuleId(id))
10268
+ ])
10269
+ );
10270
+ return { rules, classToRuleIds };
10271
+ }
10272
+ function _parseCssToIrFallback(css, prefix, native) {
10066
10273
  if (!native?.parseCssRules) {
10067
10274
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
10068
10275
  }
10069
- const prefix = options.prefix ?? "";
10276
+ resetIdGenerator();
10277
+ layerMap.clear();
10278
+ layerOrderMap.clear();
10070
10279
  const rules = [];
10071
10280
  const classToRuleIds = /* @__PURE__ */ new Map();
10072
10281
  const parsed = native.parseCssRules(css);
@@ -10081,7 +10290,7 @@ function parseCssToIr(css, options = {}) {
10081
10290
  const valueId = generateValueId(r.value);
10082
10291
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
10083
10292
  const conditionId = hasMedia ? generateConditionId() : null;
10084
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
10293
+ const conditionResult = 2 /* Unknown */;
10085
10294
  const ruleId = generateRuleId();
10086
10295
  const fingerprint = createFingerprint([className, r.property, r.value]);
10087
10296
  const rule = {
@@ -10095,7 +10304,6 @@ function parseCssToIr(css, options = {}) {
10095
10304
  layer,
10096
10305
  layerOrder,
10097
10306
  specificity: r.specificity,
10098
- // from native — no JS recalculation
10099
10307
  condition: conditionId,
10100
10308
  conditionResult,
10101
10309
  insertionOrder: getNextInsertionOrder(),
@@ -10321,6 +10529,9 @@ async function traceClass(className, options) {
10321
10529
  };
10322
10530
  return result;
10323
10531
  }
10532
+
10533
+ // packages/infrastructure/cli/src/utils/traceTargetService.ts
10534
+ init_internal();
10324
10535
  init_src2();
10325
10536
  function toRelativePath(root, value) {
10326
10537
  const relative = path6__default.relative(root, value);
@@ -10392,7 +10603,7 @@ function tryCompileClasses(classes) {
10392
10603
  }
10393
10604
  }
10394
10605
  function traceSingleFile(filePath, root) {
10395
- const source = fs12__default.readFileSync(filePath, "utf8");
10606
+ const source = fs11__default.readFileSync(filePath, "utf8");
10396
10607
  const classes = uniqueSorted(scanSource(source));
10397
10608
  const imports = extractImports(source);
10398
10609
  const compiled = tryCompileClasses(classes);
@@ -10422,8 +10633,8 @@ function traceDirectory(targetDir, root) {
10422
10633
  });
10423
10634
  const imports = [];
10424
10635
  const importKeys = /* @__PURE__ */ new Set();
10425
- const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10426
- const source = fs12__default.readFileSync(entry.file, "utf8");
10636
+ const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10637
+ const source = fs11__default.readFileSync(entry.file, "utf8");
10427
10638
  const fileImports = extractImports(source);
10428
10639
  for (const fileImport of fileImports) {
10429
10640
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10456,10 +10667,10 @@ function traceDirectory(targetDir, root) {
10456
10667
  async function traceTarget(target, options = {}) {
10457
10668
  const root = path6__default.resolve(options.root ?? process.cwd());
10458
10669
  const resolvedTarget = path6__default.resolve(root, target);
10459
- if (!fs12__default.existsSync(resolvedTarget)) {
10670
+ if (!fs11__default.existsSync(resolvedTarget)) {
10460
10671
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10461
10672
  }
10462
- const stat = fs12__default.statSync(resolvedTarget);
10673
+ const stat = fs11__default.statSync(resolvedTarget);
10463
10674
  if (stat.isDirectory()) {
10464
10675
  return traceDirectory(resolvedTarget, root);
10465
10676
  }
@@ -10665,10 +10876,10 @@ async function runGenerateTypesCli(rawArgs) {
10665
10876
  output.writeText("");
10666
10877
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10667
10878
  const outDir = path6__default.dirname(outPath);
10668
- if (!fs12__default.existsSync(outDir)) {
10669
- fs12__default.mkdirSync(outDir, { recursive: true });
10879
+ if (!fs11__default.existsSync(outDir)) {
10880
+ fs11__default.mkdirSync(outDir, { recursive: true });
10670
10881
  }
10671
- fs12__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10882
+ fs11__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10672
10883
  logger.ok(path6__default.relative(cwd2, outPath));
10673
10884
  output.writeText("");
10674
10885
  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"));
@@ -10684,7 +10895,7 @@ async function loadNativeBinding2(cwd2) {
10684
10895
  path6__default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10685
10896
  ];
10686
10897
  for (const candidate of candidates) {
10687
- if (fs12__default.existsSync(candidate)) {
10898
+ if (fs11__default.existsSync(candidate)) {
10688
10899
  try {
10689
10900
  return __require(candidate);
10690
10901
  } catch {
@@ -10696,6 +10907,9 @@ async function loadNativeBinding2(cwd2) {
10696
10907
 
10697
10908
  // packages/infrastructure/cli/src/commands/why.ts
10698
10909
  init_errors();
10910
+
10911
+ // packages/infrastructure/cli/src/utils/whyService.ts
10912
+ init_internal();
10699
10913
  init_src2();
10700
10914
  function extractVariantChain(usage) {
10701
10915
  const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
@@ -10743,7 +10957,7 @@ async function whyClass(className, options) {
10743
10957
  for (const file of scanResult.files) {
10744
10958
  const source = (() => {
10745
10959
  try {
10746
- return fs12__default.readFileSync(file.file, "utf8");
10960
+ return fs11__default.readFileSync(file.file, "utf8");
10747
10961
  } catch {
10748
10962
  return "";
10749
10963
  }