tailwind-styled-v4 5.0.11 → 5.0.12

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 (107) hide show
  1. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  2. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  3. package/dist/analyzer.d.mts +4 -4
  4. package/dist/analyzer.d.ts +4 -4
  5. package/dist/analyzer.js +34 -69
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +33 -68
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +11 -11
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +11 -11
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +16 -7
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +16 -7
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +262 -190
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +259 -187
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +2543 -109
  22. package/dist/compiler.d.ts +2543 -109
  23. package/dist/compiler.js +1962 -435
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +1816 -382
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/devtools.js +17 -4
  28. package/dist/devtools.js.map +1 -1
  29. package/dist/devtools.mjs +17 -4
  30. package/dist/devtools.mjs.map +1 -1
  31. package/dist/engine.d.mts +11 -470
  32. package/dist/engine.d.ts +11 -470
  33. package/dist/engine.js +1442 -417
  34. package/dist/engine.js.map +1 -1
  35. package/dist/engine.mjs +1442 -417
  36. package/dist/engine.mjs.map +1 -1
  37. package/dist/index-BDQw13kn.d.ts +464 -0
  38. package/dist/index-DJv28Uzq.d.mts +464 -0
  39. package/dist/index.browser.mjs +143 -255
  40. package/dist/index.browser.mjs.map +1 -1
  41. package/dist/index.d.mts +23 -39
  42. package/dist/index.d.ts +23 -39
  43. package/dist/index.js +6000 -1463
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +5995 -1458
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/next.d.mts +44 -1
  48. package/dist/next.d.ts +44 -1
  49. package/dist/next.js +3197 -1128
  50. package/dist/next.js.map +1 -1
  51. package/dist/next.mjs +3196 -1129
  52. package/dist/next.mjs.map +1 -1
  53. package/dist/rspack.d.mts +9 -0
  54. package/dist/rspack.d.ts +9 -0
  55. package/dist/rspack.js +99 -61
  56. package/dist/rspack.js.map +1 -1
  57. package/dist/rspack.mjs +99 -61
  58. package/dist/rspack.mjs.map +1 -1
  59. package/dist/runtime-css.d.mts +8 -0
  60. package/dist/runtime-css.d.ts +8 -0
  61. package/dist/runtime-css.js +23 -7
  62. package/dist/runtime-css.js.map +1 -1
  63. package/dist/runtime-css.mjs +23 -7
  64. package/dist/runtime-css.mjs.map +1 -1
  65. package/dist/scanner.js +16 -37
  66. package/dist/scanner.js.map +1 -1
  67. package/dist/scanner.mjs +15 -36
  68. package/dist/scanner.mjs.map +1 -1
  69. package/dist/shared.d.mts +107 -1
  70. package/dist/shared.d.ts +107 -1
  71. package/dist/shared.js +1627 -376
  72. package/dist/shared.js.map +1 -1
  73. package/dist/shared.mjs +1620 -354
  74. package/dist/shared.mjs.map +1 -1
  75. package/dist/svelte.js +39 -35
  76. package/dist/svelte.js.map +1 -1
  77. package/dist/svelte.mjs +38 -34
  78. package/dist/svelte.mjs.map +1 -1
  79. package/dist/theme.js +85 -76
  80. package/dist/theme.js.map +1 -1
  81. package/dist/theme.mjs +83 -74
  82. package/dist/theme.mjs.map +1 -1
  83. package/dist/turbopackLoader.js +943 -76
  84. package/dist/turbopackLoader.js.map +1 -1
  85. package/dist/turbopackLoader.mjs +943 -76
  86. package/dist/turbopackLoader.mjs.map +1 -1
  87. package/dist/tw.js +262 -190
  88. package/dist/tw.js.map +1 -1
  89. package/dist/tw.mjs +259 -187
  90. package/dist/tw.mjs.map +1 -1
  91. package/dist/vite.js +1336 -296
  92. package/dist/vite.js.map +1 -1
  93. package/dist/vite.mjs +1336 -296
  94. package/dist/vite.mjs.map +1 -1
  95. package/dist/vue.js +39 -35
  96. package/dist/vue.js.map +1 -1
  97. package/dist/vue.mjs +38 -34
  98. package/dist/vue.mjs.map +1 -1
  99. package/dist/webpackLoader.js +140 -34
  100. package/dist/webpackLoader.js.map +1 -1
  101. package/dist/webpackLoader.mjs +140 -34
  102. package/dist/webpackLoader.mjs.map +1 -1
  103. package/native/index.node +0 -0
  104. package/native/tailwind-styled-native.node +0 -0
  105. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  106. package/package.json +9 -4
  107. 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);
@@ -6153,6 +6118,30 @@ Tried paths: ${result.tried.join("\n")}`);
6153
6118
  }
6154
6119
  }
6155
6120
  });
6121
+ var compileCssFromClasses;
6122
+ var init_src4 = __esm({
6123
+ "packages/domain/compiler/src/index.ts"() {
6124
+ init_nativeBridge();
6125
+ compileCssFromClasses = (classes, prefix) => {
6126
+ const native = getNativeBridge();
6127
+ if (!native?.transformSource) {
6128
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
6129
+ }
6130
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
6131
+ if (!result) {
6132
+ throw new Error("FATAL: transformSource returned null");
6133
+ }
6134
+ return result;
6135
+ };
6136
+ }
6137
+ });
6138
+
6139
+ // packages/domain/compiler/src/internal.ts
6140
+ var init_internal = __esm({
6141
+ "packages/domain/compiler/src/internal.ts"() {
6142
+ init_src4();
6143
+ }
6144
+ });
6156
6145
 
6157
6146
  // packages/infrastructure/cli/src/commands/program.ts
6158
6147
  init_esm();
@@ -6451,7 +6440,7 @@ async function findSourceFiles(dir) {
6451
6440
  const out = [];
6452
6441
  async function walk(currentDir) {
6453
6442
  if (!await pathExists2(currentDir)) return;
6454
- const entries = await fs8__default.default.readdir(currentDir, { withFileTypes: true });
6443
+ const entries = await fs7__default.default.readdir(currentDir, { withFileTypes: true });
6455
6444
  for (const entry of entries) {
6456
6445
  const fullPath = path6__namespace.default.join(currentDir, entry.name);
6457
6446
  if (entry.isDirectory()) {
@@ -6517,12 +6506,12 @@ async function runMigrateCli(rawArgs) {
6517
6506
  report.configWrites += await migrateConfig(root, dryRun);
6518
6507
  }
6519
6508
  for (const filePath of files) {
6520
- const source = await fs8__default.default.readFile(filePath, "utf8");
6509
+ const source = await fs7__default.default.readFile(filePath, "utf8");
6521
6510
  const migrated = migrateSource(source, { includeImports, includeClasses });
6522
6511
  if (migrated.output !== source) {
6523
6512
  report.updatedFiles++;
6524
6513
  if (!dryRun) {
6525
- await fs8__default.default.writeFile(filePath, migrated.output, "utf8");
6514
+ await fs7__default.default.writeFile(filePath, migrated.output, "utf8");
6526
6515
  }
6527
6516
  }
6528
6517
  report.classRenames += migrated.classRenames;
@@ -6588,8 +6577,8 @@ function buildClassNames(files, uniqueClasses) {
6588
6577
  function writeScanCache(root, cacheData) {
6589
6578
  const cacheDir = path6__namespace.default.join(root, ".tailwind-styled");
6590
6579
  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");
6580
+ fs11__namespace.default.mkdirSync(cacheDir, { recursive: true });
6581
+ fs11__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6593
6582
  return cachePath;
6594
6583
  }
6595
6584
  async function runScanCli(rawArgs) {
@@ -6763,26 +6752,62 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
6763
6752
  return `${ups}/.next/tw-classes/**`;
6764
6753
  }
6765
6754
  }
6755
+ function computeStateStaticImportPath(cssFilePath, cwd2) {
6756
+ try {
6757
+ const nodePath = __require("path");
6758
+ const cssAbs = nodePath.resolve(cwd2, cssFilePath);
6759
+ const cssDir = nodePath.dirname(cssAbs);
6760
+ const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
6761
+ const rel = nodePath.relative(cssDir, stateStaticAbs).replace(/\\/g, "/");
6762
+ return rel.startsWith(".") ? rel : `./${rel}`;
6763
+ } catch {
6764
+ const depth = cssFilePath.split("/").length - 1;
6765
+ const ups = Array(depth).fill("..").join("/");
6766
+ return `${ups}/.next/_tw-state-static.css`;
6767
+ }
6768
+ }
6766
6769
  function patchTailwindCssImpl(src, bundler, cssFilePath, cwd2) {
6767
6770
  const hasTailwindImport = src.includes('@import "tailwindcss"') || src.includes("@import 'tailwindcss'");
6768
- const hasSafelistSource2 = src.includes("tailwind-styled-safelist.css");
6771
+ const hasSafelistSource2 = src.includes("tw-classes");
6772
+ const hasStateImport = src.includes("_tw-state-static.css");
6769
6773
  const needsSafelistSource = bundler === "next" && !hasSafelistSource2;
6770
- const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tailwind-styled-safelist.css";
6774
+ const needsStateImport = bundler === "next" && !hasStateImport;
6775
+ const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tw-classes/**";
6776
+ const stateImportRelPath = needsStateImport && cssFilePath && cwd2 ? computeStateStaticImportPath(cssFilePath, cwd2) : "../.next/_tw-state-static.css";
6771
6777
  const safelistSource = `@source "${safelistRelPath}";`;
6778
+ const stateImport = `@import "${stateImportRelPath}";`;
6772
6779
  if (hasTailwindImport) {
6773
- if (!needsSafelistSource) return null;
6774
- const patched = src.replace(
6775
- /(@import\s+['"]tailwindcss['"];?)/,
6776
- `$1
6780
+ if (!needsSafelistSource && !needsStateImport) return null;
6781
+ let patched = src;
6782
+ if (needsSafelistSource) {
6783
+ patched = patched.replace(
6784
+ /(@import\s+['"]tailwindcss['"];?)/,
6785
+ `$1
6777
6786
  ${safelistSource}`
6778
- );
6787
+ );
6788
+ }
6789
+ if (needsStateImport) {
6790
+ if (patched.includes("tw-classes")) {
6791
+ patched = patched.replace(
6792
+ /(@source\s+["'][^"']+["'];?)/,
6793
+ `$1
6794
+ ${stateImport}`
6795
+ );
6796
+ } else {
6797
+ patched = patched.replace(
6798
+ /(@import\s+['"]tailwindcss['"];?)/,
6799
+ `$1
6800
+ ${stateImport}`
6801
+ );
6802
+ }
6803
+ }
6779
6804
  return patched === src ? null : patched;
6780
6805
  }
6781
- const base = `@import "tailwindcss";
6782
- ${needsSafelistSource ? `${safelistSource}
6783
- ` : ""}
6784
- ${src}`;
6785
- return base;
6806
+ const lines = [`@import "tailwindcss";`];
6807
+ if (needsSafelistSource) lines.push(safelistSource);
6808
+ if (needsStateImport) lines.push(stateImport);
6809
+ lines.push("", src);
6810
+ return lines.join("\n");
6786
6811
  }
6787
6812
  function patchTsConfigImpl(src) {
6788
6813
  try {
@@ -7406,7 +7431,7 @@ async function runStatsCli(args) {
7406
7431
  init_runtime();
7407
7432
  function collectTsFiles(dir, extensions) {
7408
7433
  const files = [];
7409
- const entries = fs12.readdirSync(dir, { withFileTypes: true });
7434
+ const entries = fs11.readdirSync(dir, { withFileTypes: true });
7410
7435
  for (const entry of entries) {
7411
7436
  const full = path6.join(dir, entry.name);
7412
7437
  if (entry.isDirectory()) {
@@ -7489,7 +7514,7 @@ async function runBoundaryCli(args, context) {
7489
7514
  for (const file of files) {
7490
7515
  let source;
7491
7516
  try {
7492
- source = fs12.readFileSync(file, "utf8");
7517
+ source = fs11.readFileSync(file, "utf8");
7493
7518
  } catch {
7494
7519
  continue;
7495
7520
  }
@@ -7584,7 +7609,7 @@ async function loadRegistry(context) {
7584
7609
  if (!registryPath) {
7585
7610
  throw new CliUsageError("Plugin registry file not found.");
7586
7611
  }
7587
- const raw = await fs8__default.default.readFile(registryPath, "utf8");
7612
+ const raw = await fs7__default.default.readFile(registryPath, "utf8");
7588
7613
  const data = JSON.parse(raw);
7589
7614
  return [
7590
7615
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7719,8 +7744,8 @@ var deployCommand = {
7719
7744
  return;
7720
7745
  }
7721
7746
  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(
7747
+ await fs7__default.default.mkdir(cacheDir, { recursive: true });
7748
+ await fs7__default.default.writeFile(
7724
7749
  path6__namespace.default.join(cacheDir, "deploy-manifest.json"),
7725
7750
  JSON.stringify(manifest, null, 2)
7726
7751
  );
@@ -7821,22 +7846,27 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7821
7846
  issues.push({ severity, type, message, suggestion, location });
7822
7847
  }
7823
7848
  function readJsonFile(filePath) {
7824
- if (!fs12__namespace.default.existsSync(filePath)) return null;
7849
+ if (!fs11__namespace.default.existsSync(filePath)) return null;
7825
7850
  try {
7826
- return JSON.parse(fs12__namespace.default.readFileSync(filePath, "utf8"));
7827
- } catch {
7851
+ return JSON.parse(fs11__namespace.default.readFileSync(filePath, "utf8"));
7852
+ } catch (parseErr) {
7853
+ if (process.env.TWS_DEBUG === "1") {
7854
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
7855
+ process.stderr.write(`[tw:doctor] malformed JSON: ${filePath} \u2014 ${msg}
7856
+ `);
7857
+ }
7828
7858
  return null;
7829
7859
  }
7830
7860
  }
7831
7861
  function findWorkspacePackageJsonFiles(root) {
7832
7862
  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));
7863
+ if (!fs11__namespace.default.existsSync(packagesDir)) return [];
7864
+ 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
7865
  }
7836
7866
  function findFiles(dir, ext) {
7837
7867
  const files = [];
7838
7868
  try {
7839
- const entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
7869
+ const entries = fs11__namespace.default.readdirSync(dir, { withFileTypes: true });
7840
7870
  for (const entry of entries) {
7841
7871
  const fullPath = path6__namespace.default.join(dir, entry.name);
7842
7872
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7845,7 +7875,12 @@ function findFiles(dir, ext) {
7845
7875
  files.push(fullPath);
7846
7876
  }
7847
7877
  }
7848
- } catch {
7878
+ } catch (dirErr) {
7879
+ if (process.env.TWS_DEBUG === "1") {
7880
+ const msg = dirErr instanceof Error ? dirErr.message : String(dirErr);
7881
+ process.stderr.write(`[tw:doctor] findFiles error in ${dir}: ${msg}
7882
+ `);
7883
+ }
7849
7884
  return files;
7850
7885
  }
7851
7886
  return files;
@@ -7998,7 +8033,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7998
8033
  const cssFiles = findFiles(root, ".css");
7999
8034
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
8000
8035
  try {
8001
- const content = fs12__namespace.default.readFileSync(filePath, "utf8");
8036
+ const content = fs11__namespace.default.readFileSync(filePath, "utf8");
8002
8037
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
8003
8038
  } catch {
8004
8039
  return false;
@@ -8022,7 +8057,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
8022
8057
  );
8023
8058
  }
8024
8059
  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)));
8060
+ const hasConfig = configFiles.some((name) => fs11__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8026
8061
  addCheck(
8027
8062
  checks,
8028
8063
  "tailwind",
@@ -9307,19 +9342,8 @@ var syncCommand = {
9307
9342
  var import_picocolors5 = __toESM(require_picocolors());
9308
9343
  init_errors();
9309
9344
 
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
- };
9345
+ // packages/infrastructure/cli/src/utils/traceService.ts
9346
+ init_internal();
9323
9347
 
9324
9348
  // packages/domain/engine/src/native-bridge.ts
9325
9349
  init_src();
@@ -9770,37 +9794,33 @@ var CascadeResolutionId = class {
9770
9794
  return `R${this.value}`;
9771
9795
  }
9772
9796
  };
9773
- var _propertyNamesFallback = /* @__PURE__ */ new Map();
9774
- var _valueNamesFallback = /* @__PURE__ */ new Map();
9775
9797
  function registerPropertyName(id, name) {
9776
9798
  const native = getNativeEngineBinding();
9777
- if (native?.registerPropertyName) {
9778
- native.registerPropertyName(id.value, name);
9779
- return;
9799
+ if (!native?.registerPropertyName) {
9800
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
9780
9801
  }
9781
- _propertyNamesFallback.set(id.value, name);
9802
+ native.registerPropertyName(id.value, name);
9782
9803
  }
9783
9804
  function registerValueName(id, name) {
9784
9805
  const native = getNativeEngineBinding();
9785
- if (native?.registerValueName) {
9786
- native.registerValueName(id.value, name);
9787
- return;
9806
+ if (!native?.registerValueName) {
9807
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
9788
9808
  }
9789
- _valueNamesFallback.set(id.value, name);
9809
+ native.registerValueName(id.value, name);
9790
9810
  }
9791
9811
  function propertyIdToString(id) {
9792
9812
  const native = getNativeEngineBinding();
9793
- if (native?.propertyIdToString) {
9794
- return native.propertyIdToString(id.value);
9813
+ if (!native?.propertyIdToString) {
9814
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
9795
9815
  }
9796
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
9816
+ return native.propertyIdToString(id.value);
9797
9817
  }
9798
9818
  function valueIdToString(id) {
9799
9819
  const native = getNativeEngineBinding();
9800
- if (native?.valueIdToString) {
9801
- return native.valueIdToString(id.value);
9820
+ if (!native?.valueIdToString) {
9821
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
9802
9822
  }
9803
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
9823
+ return native.valueIdToString(id.value);
9804
9824
  }
9805
9825
  var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9806
9826
  CascadeStage2[CascadeStage2["Origin"] = 0] = "Origin";
@@ -9810,19 +9830,12 @@ var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9810
9830
  CascadeStage2[CascadeStage2["Order"] = 4] = "Order";
9811
9831
  return CascadeStage2;
9812
9832
  })(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
9833
  function createFingerprint(parts) {
9821
9834
  const native = getNativeEngineBinding();
9822
- if (native?.createFingerprint) {
9823
- return native.createFingerprint(parts);
9835
+ if (!native?.createFingerprint) {
9836
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
9824
9837
  }
9825
- return createFingerprintFallback(parts);
9838
+ return native.createFingerprint(parts);
9826
9839
  }
9827
9840
 
9828
9841
  // packages/domain/engine/src/reverseLookup.ts
@@ -10084,14 +10097,68 @@ function detectLayerFromClassName(className) {
10084
10097
  return null;
10085
10098
  }
10086
10099
  function parseCssToIr(css, options = {}) {
10087
- resetIdGenerator();
10100
+ const native = getNativeEngineBinding();
10101
+ const prefix = options.prefix ?? "";
10102
+ if (native?.assembleCssIr) {
10103
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
10104
+ }
10105
+ return _parseCssToIrFallback(css, prefix, native);
10106
+ }
10107
+ function _parseCssToIrFast(assembled) {
10108
+ const native = getNativeEngineBinding();
10088
10109
  layerMap.clear();
10089
10110
  layerOrderMap.clear();
10090
- const native = getNativeEngineBinding();
10111
+ for (const le of assembled.layers) {
10112
+ const lid = new LayerId(le.layerId);
10113
+ layerMap.set(le.name, lid);
10114
+ layerOrderMap.set(le.name, le.order);
10115
+ }
10116
+ const rules = assembled.rules.map((r) => {
10117
+ const propertyId = new PropertyId(r.propertyId);
10118
+ const valueId = new ValueId(r.valueId);
10119
+ if (native?.registerPropertyName) {
10120
+ native.registerPropertyName(r.propertyId, r.propertyName);
10121
+ } else {
10122
+ registerPropertyName(propertyId, r.propertyName);
10123
+ }
10124
+ if (native?.registerValueName) {
10125
+ native.registerValueName(r.valueId, r.valueName);
10126
+ } else {
10127
+ registerValueName(valueId, r.valueName);
10128
+ }
10129
+ return {
10130
+ id: new RuleId(r.ruleId),
10131
+ selector: new SelectorId(r.selectorId),
10132
+ variantChain: new VariantChainId(0),
10133
+ property: propertyId,
10134
+ value: valueId,
10135
+ origin: r.origin,
10136
+ importance: r.importance,
10137
+ layer: r.layerId >= 0 ? new LayerId(r.layerId) : null,
10138
+ layerOrder: r.layerOrder,
10139
+ specificity: r.specificity,
10140
+ condition: r.conditionId >= 0 ? new ConditionId(r.conditionId) : null,
10141
+ conditionResult: r.conditionResult,
10142
+ insertionOrder: r.insertionOrder,
10143
+ fingerprint: r.fingerprint,
10144
+ source: { file: "", line: 1, column: 1 }
10145
+ };
10146
+ });
10147
+ const classToRuleIds = new Map(
10148
+ assembled.classToRuleIds.map((m) => [
10149
+ m.className,
10150
+ m.ruleIds.map((id) => new RuleId(id))
10151
+ ])
10152
+ );
10153
+ return { rules, classToRuleIds };
10154
+ }
10155
+ function _parseCssToIrFallback(css, prefix, native) {
10091
10156
  if (!native?.parseCssRules) {
10092
10157
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
10093
10158
  }
10094
- const prefix = options.prefix ?? "";
10159
+ resetIdGenerator();
10160
+ layerMap.clear();
10161
+ layerOrderMap.clear();
10095
10162
  const rules = [];
10096
10163
  const classToRuleIds = /* @__PURE__ */ new Map();
10097
10164
  const parsed = native.parseCssRules(css);
@@ -10106,7 +10173,7 @@ function parseCssToIr(css, options = {}) {
10106
10173
  const valueId = generateValueId(r.value);
10107
10174
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
10108
10175
  const conditionId = hasMedia ? generateConditionId() : null;
10109
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
10176
+ const conditionResult = 2 /* Unknown */;
10110
10177
  const ruleId = generateRuleId();
10111
10178
  const fingerprint = createFingerprint([className, r.property, r.value]);
10112
10179
  const rule = {
@@ -10120,7 +10187,6 @@ function parseCssToIr(css, options = {}) {
10120
10187
  layer,
10121
10188
  layerOrder,
10122
10189
  specificity: r.specificity,
10123
- // from native — no JS recalculation
10124
10190
  condition: conditionId,
10125
10191
  conditionResult,
10126
10192
  insertionOrder: getNextInsertionOrder(),
@@ -10346,6 +10412,9 @@ async function traceClass(className, options) {
10346
10412
  };
10347
10413
  return result;
10348
10414
  }
10415
+
10416
+ // packages/infrastructure/cli/src/utils/traceTargetService.ts
10417
+ init_internal();
10349
10418
  init_src2();
10350
10419
  function toRelativePath(root, value) {
10351
10420
  const relative = path6__namespace.default.relative(root, value);
@@ -10417,7 +10486,7 @@ function tryCompileClasses(classes) {
10417
10486
  }
10418
10487
  }
10419
10488
  function traceSingleFile(filePath, root) {
10420
- const source = fs12__namespace.default.readFileSync(filePath, "utf8");
10489
+ const source = fs11__namespace.default.readFileSync(filePath, "utf8");
10421
10490
  const classes = uniqueSorted(scanSource(source));
10422
10491
  const imports = extractImports(source);
10423
10492
  const compiled = tryCompileClasses(classes);
@@ -10447,8 +10516,8 @@ function traceDirectory(targetDir, root) {
10447
10516
  });
10448
10517
  const imports = [];
10449
10518
  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");
10519
+ const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10520
+ const source = fs11__namespace.default.readFileSync(entry.file, "utf8");
10452
10521
  const fileImports = extractImports(source);
10453
10522
  for (const fileImport of fileImports) {
10454
10523
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10481,10 +10550,10 @@ function traceDirectory(targetDir, root) {
10481
10550
  async function traceTarget(target, options = {}) {
10482
10551
  const root = path6__namespace.default.resolve(options.root ?? process.cwd());
10483
10552
  const resolvedTarget = path6__namespace.default.resolve(root, target);
10484
- if (!fs12__namespace.default.existsSync(resolvedTarget)) {
10553
+ if (!fs11__namespace.default.existsSync(resolvedTarget)) {
10485
10554
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10486
10555
  }
10487
- const stat = fs12__namespace.default.statSync(resolvedTarget);
10556
+ const stat = fs11__namespace.default.statSync(resolvedTarget);
10488
10557
  if (stat.isDirectory()) {
10489
10558
  return traceDirectory(resolvedTarget, root);
10490
10559
  }
@@ -10690,10 +10759,10 @@ async function runGenerateTypesCli(rawArgs) {
10690
10759
  output.writeText("");
10691
10760
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10692
10761
  const outDir = path6__namespace.default.dirname(outPath);
10693
- if (!fs12__namespace.default.existsSync(outDir)) {
10694
- fs12__namespace.default.mkdirSync(outDir, { recursive: true });
10762
+ if (!fs11__namespace.default.existsSync(outDir)) {
10763
+ fs11__namespace.default.mkdirSync(outDir, { recursive: true });
10695
10764
  }
10696
- fs12__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10765
+ fs11__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10697
10766
  logger.ok(path6__namespace.default.relative(cwd2, outPath));
10698
10767
  output.writeText("");
10699
10768
  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 +10778,7 @@ async function loadNativeBinding2(cwd2) {
10709
10778
  path6__namespace.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10710
10779
  ];
10711
10780
  for (const candidate of candidates) {
10712
- if (fs12__namespace.default.existsSync(candidate)) {
10781
+ if (fs11__namespace.default.existsSync(candidate)) {
10713
10782
  try {
10714
10783
  return __require(candidate);
10715
10784
  } catch {
@@ -10721,6 +10790,9 @@ async function loadNativeBinding2(cwd2) {
10721
10790
 
10722
10791
  // packages/infrastructure/cli/src/commands/why.ts
10723
10792
  init_errors();
10793
+
10794
+ // packages/infrastructure/cli/src/utils/whyService.ts
10795
+ init_internal();
10724
10796
  init_src2();
10725
10797
  function extractVariantChain(usage) {
10726
10798
  const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
@@ -10768,7 +10840,7 @@ async function whyClass(className, options) {
10768
10840
  for (const file of scanResult.files) {
10769
10841
  const source = (() => {
10770
10842
  try {
10771
- return fs12__namespace.default.readFileSync(file.file, "utf8");
10843
+ return fs11__namespace.default.readFileSync(file.file, "utf8");
10772
10844
  } catch {
10773
10845
  return "";
10774
10846
  }