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/tw.js CHANGED
@@ -2,14 +2,14 @@
2
2
  'use strict';
3
3
 
4
4
  var module$1 = require('module');
5
- var fs12 = require('fs');
5
+ var fs11 = require('fs');
6
6
  var path6 = require('path');
7
7
  require('crypto');
8
8
  var url = require('url');
9
9
  var worker_threads = require('worker_threads');
10
10
  var os = require('os');
11
11
  var zod = require('zod');
12
- var fs8 = require('fs/promises');
12
+ var fs7 = require('fs/promises');
13
13
  var prompts = require('@clack/prompts');
14
14
  var util = require('util');
15
15
  var child_process = require('child_process');
@@ -35,9 +35,9 @@ function _interopNamespace(e) {
35
35
  return Object.freeze(n);
36
36
  }
37
37
 
38
- var fs12__namespace = /*#__PURE__*/_interopNamespace(fs12);
38
+ var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
39
39
  var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
40
- var fs8__default = /*#__PURE__*/_interopDefault(fs8);
40
+ var fs7__default = /*#__PURE__*/_interopDefault(fs7);
41
41
 
42
42
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
43
43
  var __create = Object.create;
@@ -1013,7 +1013,7 @@ var require_command = __commonJS({
1013
1013
  "packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports$1) {
1014
1014
  var EventEmitter = __require("events").EventEmitter;
1015
1015
  var childProcess = __require("child_process");
1016
- var path29 = __require("path");
1016
+ var path30 = __require("path");
1017
1017
  var fs16 = __require("fs");
1018
1018
  var process2 = __require("process");
1019
1019
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1945,9 +1945,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1945
1945
  let launchWithNode = false;
1946
1946
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1947
1947
  function findFile(baseDir, baseName) {
1948
- const localBin = path29.resolve(baseDir, baseName);
1948
+ const localBin = path30.resolve(baseDir, baseName);
1949
1949
  if (fs16.existsSync(localBin)) return localBin;
1950
- if (sourceExt.includes(path29.extname(baseName))) return void 0;
1950
+ if (sourceExt.includes(path30.extname(baseName))) return void 0;
1951
1951
  const foundExt = sourceExt.find(
1952
1952
  (ext) => fs16.existsSync(`${localBin}${ext}`)
1953
1953
  );
@@ -1965,17 +1965,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1965
1965
  } catch (err) {
1966
1966
  resolvedScriptPath = this._scriptPath;
1967
1967
  }
1968
- executableDir = path29.resolve(
1969
- path29.dirname(resolvedScriptPath),
1968
+ executableDir = path30.resolve(
1969
+ path30.dirname(resolvedScriptPath),
1970
1970
  executableDir
1971
1971
  );
1972
1972
  }
1973
1973
  if (executableDir) {
1974
1974
  let localFile = findFile(executableDir, executableFile);
1975
1975
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1976
- const legacyName = path29.basename(
1976
+ const legacyName = path30.basename(
1977
1977
  this._scriptPath,
1978
- path29.extname(this._scriptPath)
1978
+ path30.extname(this._scriptPath)
1979
1979
  );
1980
1980
  if (legacyName !== this._name) {
1981
1981
  localFile = findFile(
@@ -1986,7 +1986,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1986
1986
  }
1987
1987
  executableFile = localFile || executableFile;
1988
1988
  }
1989
- launchWithNode = sourceExt.includes(path29.extname(executableFile));
1989
+ launchWithNode = sourceExt.includes(path30.extname(executableFile));
1990
1990
  let proc;
1991
1991
  if (process2.platform !== "win32") {
1992
1992
  if (launchWithNode) {
@@ -2826,7 +2826,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2826
2826
  * @return {Command}
2827
2827
  */
2828
2828
  nameFromFilename(filename) {
2829
- this._name = path29.basename(filename, path29.extname(filename));
2829
+ this._name = path30.basename(filename, path30.extname(filename));
2830
2830
  return this;
2831
2831
  }
2832
2832
  /**
@@ -2840,9 +2840,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2840
2840
  * @param {string} [path]
2841
2841
  * @return {(string|null|Command)}
2842
2842
  */
2843
- executableDir(path30) {
2844
- if (path30 === void 0) return this._executableDir;
2845
- this._executableDir = path30;
2843
+ executableDir(path31) {
2844
+ if (path31 === void 0) return this._executableDir;
2845
+ this._executableDir = path31;
2846
2846
  return this;
2847
2847
  }
2848
2848
  /**
@@ -3192,12 +3192,12 @@ function resolveNativeBinary(runtimeDir) {
3192
3192
  if (isBrowser2) {
3193
3193
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
3194
3194
  }
3195
- if (process.env.TWS_DISABLE_NATIVE === "1") {
3195
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
3196
3196
  return { path: null, source: "not-found", platform, tried: [] };
3197
3197
  }
3198
3198
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3199
3199
  if (envPath) {
3200
- if (fs12__namespace.existsSync(envPath)) {
3200
+ if (fs11__namespace.existsSync(envPath)) {
3201
3201
  return { path: envPath, source: "env", platform, tried };
3202
3202
  }
3203
3203
  tried.push(`env:${envPath} (not found)`);
@@ -3206,7 +3206,7 @@ function resolveNativeBinary(runtimeDir) {
3206
3206
  for (const pkg of prebuiltPkgs) {
3207
3207
  try {
3208
3208
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
3209
- if (fs12__namespace.existsSync(candidate)) {
3209
+ if (fs11__namespace.existsSync(candidate)) {
3210
3210
  return { path: candidate, source: "prebuilt", platform, tried };
3211
3211
  }
3212
3212
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3223,7 +3223,7 @@ function resolveNativeBinary(runtimeDir) {
3223
3223
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3224
3224
  const candidate = path6__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3225
3225
  tried.push(`self-bundled:${candidate}`);
3226
- if (fs12__namespace.existsSync(candidate)) {
3226
+ if (fs11__namespace.existsSync(candidate)) {
3227
3227
  return { path: candidate, source: "prebuilt", platform, tried };
3228
3228
  }
3229
3229
  }
@@ -3257,7 +3257,7 @@ function resolveNativeBinary(runtimeDir) {
3257
3257
  }
3258
3258
  for (const candidate of localCandidates) {
3259
3259
  tried.push(`local:${candidate}`);
3260
- if (fs12__namespace.existsSync(candidate)) {
3260
+ if (fs11__namespace.existsSync(candidate)) {
3261
3261
  return { path: candidate, source: "local", platform, tried };
3262
3262
  }
3263
3263
  }
@@ -3307,9 +3307,9 @@ function createDebugLogger(namespace, label) {
3307
3307
  }
3308
3308
  };
3309
3309
  }
3310
- function formatIssuePath(path29) {
3311
- if (!path29 || path29.length === 0) return "(root)";
3312
- return path29.map(
3310
+ function formatIssuePath(path30) {
3311
+ if (!path30 || path30.length === 0) return "(root)";
3312
+ return path30.map(
3313
3313
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3314
3314
  ).join(".");
3315
3315
  }
@@ -3322,7 +3322,7 @@ function loadNativeBinding(options) {
3322
3322
  for (const candidate of candidates) {
3323
3323
  const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
3324
3324
  try {
3325
- if (!fs12__namespace.default.existsSync(candidatePath) && !fs12__namespace.default.existsSync(candidatePath + ".node")) {
3325
+ if (!fs11__namespace.default.existsSync(candidatePath) && !fs11__namespace.default.existsSync(candidatePath + ".node")) {
3326
3326
  continue;
3327
3327
  }
3328
3328
  const mod = requireNativeModule(candidatePath);
@@ -3354,9 +3354,9 @@ function resolveNativeBindingCandidates(options) {
3354
3354
  }
3355
3355
  }
3356
3356
  if (!includeDefaultCandidates) return candidates;
3357
- if (fs12__namespace.default.existsSync(runtimeDir)) {
3357
+ if (fs11__namespace.default.existsSync(runtimeDir)) {
3358
3358
  try {
3359
- for (const entry of fs12__namespace.default.readdirSync(runtimeDir)) {
3359
+ for (const entry of fs11__namespace.default.readdirSync(runtimeDir)) {
3360
3360
  if (entry.endsWith(".node")) candidates.push(entry);
3361
3361
  }
3362
3362
  } catch {
@@ -3423,8 +3423,8 @@ var init_src = __esm({
3423
3423
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3424
3424
  static fromZod(err) {
3425
3425
  const first = err.issues?.[0] ?? err.errors?.[0];
3426
- const path29 = formatIssuePath(first?.path);
3427
- const message = first ? `${path29}: ${first.message}` : "Schema validation failed";
3426
+ const path30 = formatIssuePath(first?.path);
3427
+ const message = first ? `${path30}: ${first.message}` : "Schema validation failed";
3428
3428
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3429
3429
  }
3430
3430
  static wrap(source, code, err) {
@@ -3774,7 +3774,7 @@ function defaultCachePath(rootDir, cacheDir) {
3774
3774
  }
3775
3775
  function readCache(rootDir, cacheDir) {
3776
3776
  const cachePath = defaultCachePath(rootDir, cacheDir);
3777
- fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3777
+ fs11__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3778
3778
  const result = cacheReadNative(cachePath);
3779
3779
  if (!result) return [];
3780
3780
  return result.entries.map((e) => ({
@@ -3789,7 +3789,7 @@ function readCache(rootDir, cacheDir) {
3789
3789
  }
3790
3790
  function writeCache(rootDir, entries, cacheDir) {
3791
3791
  const cachePath = defaultCachePath(rootDir, cacheDir);
3792
- fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3792
+ fs11__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3793
3793
  const success = cacheWriteNative(cachePath, entries);
3794
3794
  if (!success) {
3795
3795
  throw new Error(
@@ -3816,27 +3816,7 @@ var init_cache_native = __esm({
3816
3816
  function collectFiles(rootDir, extensions, ignoreDirs) {
3817
3817
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
3818
3818
  if (native !== null) return native;
3819
- const files = [];
3820
- function walk(dir) {
3821
- let entries;
3822
- try {
3823
- entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
3824
- } catch {
3825
- return;
3826
- }
3827
- for (const entry of entries) {
3828
- const fullPath = path6__namespace.default.join(dir, entry.name);
3829
- const rel = path6__namespace.default.relative(rootDir, fullPath);
3830
- if (entry.isDirectory()) {
3831
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__namespace.default.sep));
3832
- if (!ignored) walk(fullPath);
3833
- } else if (isScannableFile(entry.name, extensions)) {
3834
- files.push(fullPath);
3835
- }
3836
- }
3837
- }
3838
- walk(rootDir);
3839
- return files;
3819
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
3840
3820
  }
3841
3821
  function mergeResults(batchResults) {
3842
3822
  const files = batchResults.map((r) => ({
@@ -3846,8 +3826,7 @@ function mergeResults(batchResults) {
3846
3826
  }));
3847
3827
  const native = rebuildWorkspaceResultNative(files);
3848
3828
  if (native) return native;
3849
- const unique = new Set(files.flatMap((f) => f.classes));
3850
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
3829
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
3851
3830
  }
3852
3831
  function runChunkInWorker(filePaths) {
3853
3832
  return new Promise((resolve2, reject) => {
@@ -3918,12 +3897,12 @@ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, S
3918
3897
  var init_schemas = __esm({
3919
3898
  "packages/domain/scanner/src/schemas.ts"() {
3920
3899
  init_src();
3921
- formatIssuePath2 = (path29) => path29.length > 0 ? path29.map(
3900
+ formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
3922
3901
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3923
3902
  ).join(".") : "<root>";
3924
3903
  formatIssues = (error) => error.issues.map((issue) => {
3925
- const path29 = formatIssuePath2(issue.path);
3926
- return `${path29}: ${issue.message}`;
3904
+ const path30 = formatIssuePath2(issue.path);
3905
+ return `${path30}: ${issue.message}`;
3927
3906
  }).join("; ");
3928
3907
  parseWithSchema = (schema, data, label) => {
3929
3908
  const parsed = schema.safeParse(data);
@@ -3986,7 +3965,7 @@ __export(src_exports, {
3986
3965
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3987
3966
  batchExtractClassesNative: () => batchExtractClassesNative,
3988
3967
  extractClassesNative: () => extractClassesNative,
3989
- isScannableFile: () => isScannableFile,
3968
+ isScannableFile: () => isScannableFile2,
3990
3969
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3991
3970
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3992
3971
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
@@ -4020,7 +3999,7 @@ function resolveScannerWorkerModulePath() {
4020
3999
  path6__namespace.default.resolve(runtimeDir, "worker.ts")
4021
4000
  ];
4022
4001
  for (const candidate of candidates) {
4023
- if (fs12__namespace.default.existsSync(candidate)) return candidate;
4002
+ if (fs11__namespace.default.existsSync(candidate)) return candidate;
4024
4003
  }
4025
4004
  return null;
4026
4005
  }
@@ -4077,7 +4056,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4077
4056
  if (!currentDir) continue;
4078
4057
  const entries = (() => {
4079
4058
  try {
4080
- return fs12__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4059
+ return fs11__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4081
4060
  } catch {
4082
4061
  return [];
4083
4062
  }
@@ -4115,7 +4094,7 @@ function scanSource(source) {
4115
4094
  "FATAL: Native parser binding is required but not available.\nThis package requires native Rust bindings.\n\nResolution steps:\n1. Build the native Rust module: npm run build:rust"
4116
4095
  );
4117
4096
  }
4118
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4097
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4119
4098
  return includeExtensions.includes(path6__namespace.default.extname(filePath));
4120
4099
  }
4121
4100
  function scanFile(filePath) {
@@ -4176,7 +4155,7 @@ function scanWorkspace(rootDir, options = {}) {
4176
4155
  for (const filePath of candidates) {
4177
4156
  const stat = (() => {
4178
4157
  try {
4179
- return fs12__namespace.default.statSync(filePath);
4158
+ return fs11__namespace.default.statSync(filePath);
4180
4159
  } catch {
4181
4160
  return null;
4182
4161
  }
@@ -4202,7 +4181,7 @@ function scanWorkspace(rootDir, options = {}) {
4202
4181
  for (const { filePath, stat, size, cached } of ranked) {
4203
4182
  const content = (() => {
4204
4183
  try {
4205
- return fs12__namespace.default.readFileSync(filePath, "utf8");
4184
+ return fs11__namespace.default.readFileSync(filePath, "utf8");
4206
4185
  } catch {
4207
4186
  return null;
4208
4187
  }
@@ -4346,7 +4325,7 @@ var init_src2 = __esm({
4346
4325
  )
4347
4326
  ];
4348
4327
  for (const fullPath of candidates) {
4349
- if (!fs12__namespace.default.existsSync(fullPath)) continue;
4328
+ if (!fs11__namespace.default.existsSync(fullPath)) continue;
4350
4329
  try {
4351
4330
  const required = req(fullPath);
4352
4331
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4388,7 +4367,7 @@ function isRecord(value) {
4388
4367
  }
4389
4368
  async function pathExists(filePath) {
4390
4369
  try {
4391
- await fs12__namespace.default.promises.access(filePath, fs12__namespace.default.constants.F_OK);
4370
+ await fs11__namespace.default.promises.access(filePath, fs11__namespace.default.constants.F_OK);
4392
4371
  return true;
4393
4372
  } catch {
4394
4373
  return false;
@@ -4509,7 +4488,7 @@ var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchem
4509
4488
  var init_schemas2 = __esm({
4510
4489
  "packages/domain/analyzer/src/schemas.ts"() {
4511
4490
  init_src();
4512
- formatIssuePath3 = (path29) => path29.length > 0 ? path29.map(
4491
+ formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
4513
4492
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
4514
4493
  ).join(".") : "<root>";
4515
4494
  isPlainObject = (value) => {
@@ -4518,8 +4497,8 @@ var init_schemas2 = __esm({
4518
4497
  return proto === Object.prototype || proto === null;
4519
4498
  };
4520
4499
  formatIssues2 = (error) => error.issues.map((issue) => {
4521
- const path29 = formatIssuePath3(issue.path);
4522
- return `${path29}: ${issue.message}`;
4500
+ const path30 = formatIssuePath3(issue.path);
4501
+ return `${path30}: ${issue.message}`;
4523
4502
  }).join("; ");
4524
4503
  parseWithSchema2 = (schema, data, label) => {
4525
4504
  const parsed = schema.safeParse(data);
@@ -4615,7 +4594,7 @@ var init_schemas2 = __esm({
4615
4594
  parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
4616
4595
  }
4617
4596
  });
4618
- var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, isArbitraryUtility, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4597
+ var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4619
4598
  var init_semantic = __esm({
4620
4599
  "packages/domain/analyzer/src/semantic.ts"() {
4621
4600
  init_binding();
@@ -4628,27 +4607,13 @@ var init_semantic = __esm({
4628
4607
  const base = parts.pop() ?? className;
4629
4608
  return { variantKey: parts.join(":"), base };
4630
4609
  };
4631
- isArbitraryUtility = (baseClass) => {
4632
- return baseClass.includes("[") && baseClass.includes("]");
4633
- };
4634
- resolveConflictGroup = (base) => {
4635
- if (isArbitraryUtility(base)) return null;
4636
- if (["block", "inline", "inline-block", "inline-flex", "flex", "grid", "hidden"].includes(base))
4637
- return "display";
4638
- if (base.startsWith("bg-")) return "bg";
4639
- if (base.startsWith("text-")) return "text";
4640
- if (base.startsWith("font-")) return "font";
4641
- if (base.startsWith("rounded")) return "rounded";
4642
- if (base.startsWith("shadow")) return "shadow";
4643
- if (base.startsWith("border-")) return "border";
4644
- if (base.startsWith("opacity-")) return "opacity";
4645
- if (base.startsWith("w-") || base.startsWith("min-w-") || base.startsWith("max-w-"))
4646
- return "width";
4647
- if (base.startsWith("h-") || base.startsWith("min-h-") || base.startsWith("max-h-"))
4648
- return "height";
4649
- if (base.startsWith("p-") || base.startsWith("px-") || base.startsWith("py-")) return "padding";
4650
- if (base.startsWith("m-") || base.startsWith("mx-") || base.startsWith("my-")) return "margin";
4651
- return null;
4610
+ resolveConflictGroup = async (base) => {
4611
+ const native = await getNativeBinding();
4612
+ if (!native?.resolveConflictGroup) {
4613
+ throw new Error("Native binding 'resolveConflictGroup' is required but not available.");
4614
+ }
4615
+ const result = native.resolveConflictGroup(base);
4616
+ return result.length > 0 ? result : null;
4652
4617
  };
4653
4618
  detectConflicts = async (usages) => {
4654
4619
  const native = await getNativeBinding();
@@ -4736,7 +4701,7 @@ var init_semantic = __esm({
4736
4701
  return out;
4737
4702
  };
4738
4703
  collectSafelistFromSource = async (configPath) => {
4739
- const source = await fs12__namespace.default.promises.readFile(configPath, "utf8");
4704
+ const source = await fs11__namespace.default.promises.readFile(configPath, "utf8");
4740
4705
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4741
4706
  const allTokens = extractClassesNative2(source);
4742
4707
  const hasSafelist = source.includes("safelist");
@@ -4763,7 +4728,7 @@ var init_semantic = __esm({
4763
4728
  customUtilities: /* @__PURE__ */ new Set()
4764
4729
  };
4765
4730
  }
4766
- const configStat = await fs12__namespace.default.promises.stat(configPath).catch(() => null);
4731
+ const configStat = await fs11__namespace.default.promises.stat(configPath).catch(() => null);
4767
4732
  if (configStat) {
4768
4733
  const cached = tailwindConfigCache.get(configPath);
4769
4734
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5059,12 +5024,12 @@ var init_classToCss = __esm({
5059
5024
  init_binding();
5060
5025
  init_schemas2();
5061
5026
  init_utils();
5062
- normalizeClassInput = (input, _binding) => {
5027
+ normalizeClassInput = (input, binding) => {
5063
5028
  if (typeof input === "string") {
5064
- if (_binding?.normalizeClassInput) {
5065
- return _binding.normalizeClassInput(input);
5029
+ if (!binding.normalizeClassInput) {
5030
+ throw new Error("FATAL: Native binding 'normalizeClassInput' is required but not available.");
5066
5031
  }
5067
- return input.split(/\s+/).map((item) => item.trim()).filter((item) => item.length > 0);
5032
+ return binding.normalizeClassInput(input);
5068
5033
  }
5069
5034
  if (!Array.isArray(input)) {
5070
5035
  throw new TypeError("classToCss input must be a string or an array of strings.");
@@ -5096,11 +5061,11 @@ var init_classToCss = __esm({
5096
5061
  }
5097
5062
  };
5098
5063
  declarationMapToString = (declarationMap, binding) => {
5099
- const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5100
- if (binding?.declarationMapToString) {
5101
- return binding.declarationMapToString(entries);
5064
+ if (!binding.declarationMapToString) {
5065
+ throw new Error("FATAL: Native binding 'declarationMapToString' is required but not available.");
5102
5066
  }
5103
- return entries.map(({ property, value }) => `${property}: ${value}`).join("; ");
5067
+ const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5068
+ return binding.declarationMapToString(entries);
5104
5069
  };
5105
5070
  classToCss = async (input, options = {}) => {
5106
5071
  const binding = await requireNativeCssCompiler();
@@ -5196,7 +5161,7 @@ var init_src3 = __esm({
5196
5161
  });
5197
5162
  async function pathExists2(filePath) {
5198
5163
  try {
5199
- await fs8__default.default.access(filePath);
5164
+ await fs7__default.default.access(filePath);
5200
5165
  return true;
5201
5166
  } catch {
5202
5167
  return false;
@@ -5204,7 +5169,7 @@ async function pathExists2(filePath) {
5204
5169
  }
5205
5170
  async function readFileSafe(filePath) {
5206
5171
  try {
5207
- return await fs8__default.default.readFile(filePath, "utf8");
5172
+ return await fs7__default.default.readFile(filePath, "utf8");
5208
5173
  } catch {
5209
5174
  return null;
5210
5175
  }
@@ -5223,8 +5188,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5223
5188
  options.onDryRun?.(`write ${filePath}`);
5224
5189
  return;
5225
5190
  }
5226
- await fs8__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5227
- await fs8__default.default.writeFile(filePath, content, "utf8");
5191
+ await fs7__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5192
+ await fs7__default.default.writeFile(filePath, content, "utf8");
5228
5193
  }
5229
5194
  async function ensureFileSafe(filePath, content, options = {}) {
5230
5195
  if (await pathExists2(filePath)) return "skipped";
@@ -6097,7 +6062,7 @@ var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttem
6097
6062
  var init_nativeBridge = __esm({
6098
6063
  "packages/domain/compiler/src/nativeBridge.ts"() {
6099
6064
  init_src();
6100
- _loadNative = (path29) => __require(path29);
6065
+ _loadNative = (path30) => __require(path30);
6101
6066
  log3 = (...args) => {
6102
6067
  if (process.env.DEBUG?.includes("compiler:native")) {
6103
6068
  console.log("[compiler:native]", ...args);
@@ -6154,6 +6119,30 @@ Tried paths: ${result.tried.join("\n")}`);
6154
6119
  }
6155
6120
  }
6156
6121
  });
6122
+ var compileCssFromClasses;
6123
+ var init_src4 = __esm({
6124
+ "packages/domain/compiler/src/index.ts"() {
6125
+ init_nativeBridge();
6126
+ compileCssFromClasses = (classes, prefix) => {
6127
+ const native = getNativeBridge();
6128
+ if (!native?.transformSource) {
6129
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
6130
+ }
6131
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
6132
+ if (!result) {
6133
+ throw new Error("FATAL: transformSource returned null");
6134
+ }
6135
+ return result;
6136
+ };
6137
+ }
6138
+ });
6139
+
6140
+ // packages/domain/compiler/src/internal.ts
6141
+ var init_internal = __esm({
6142
+ "packages/domain/compiler/src/internal.ts"() {
6143
+ init_src4();
6144
+ }
6145
+ });
6157
6146
 
6158
6147
  // packages/infrastructure/cli/src/commands/program.ts
6159
6148
  init_esm();
@@ -6452,7 +6441,7 @@ async function findSourceFiles(dir) {
6452
6441
  const out = [];
6453
6442
  async function walk(currentDir) {
6454
6443
  if (!await pathExists2(currentDir)) return;
6455
- const entries = await fs8__default.default.readdir(currentDir, { withFileTypes: true });
6444
+ const entries = await fs7__default.default.readdir(currentDir, { withFileTypes: true });
6456
6445
  for (const entry of entries) {
6457
6446
  const fullPath = path6__namespace.default.join(currentDir, entry.name);
6458
6447
  if (entry.isDirectory()) {
@@ -6518,12 +6507,12 @@ async function runMigrateCli(rawArgs) {
6518
6507
  report.configWrites += await migrateConfig(root, dryRun);
6519
6508
  }
6520
6509
  for (const filePath of files) {
6521
- const source = await fs8__default.default.readFile(filePath, "utf8");
6510
+ const source = await fs7__default.default.readFile(filePath, "utf8");
6522
6511
  const migrated = migrateSource(source, { includeImports, includeClasses });
6523
6512
  if (migrated.output !== source) {
6524
6513
  report.updatedFiles++;
6525
6514
  if (!dryRun) {
6526
- await fs8__default.default.writeFile(filePath, migrated.output, "utf8");
6515
+ await fs7__default.default.writeFile(filePath, migrated.output, "utf8");
6527
6516
  }
6528
6517
  }
6529
6518
  report.classRenames += migrated.classRenames;
@@ -6589,8 +6578,8 @@ function buildClassNames(files, uniqueClasses) {
6589
6578
  function writeScanCache(root, cacheData) {
6590
6579
  const cacheDir = path6__namespace.default.join(root, ".tailwind-styled");
6591
6580
  const cachePath = path6__namespace.default.join(cacheDir, "scan-cache.json");
6592
- fs12__namespace.default.mkdirSync(cacheDir, { recursive: true });
6593
- fs12__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6581
+ fs11__namespace.default.mkdirSync(cacheDir, { recursive: true });
6582
+ fs11__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6594
6583
  return cachePath;
6595
6584
  }
6596
6585
  async function runScanCli(rawArgs) {
@@ -6764,26 +6753,62 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
6764
6753
  return `${ups}/.next/tw-classes/**`;
6765
6754
  }
6766
6755
  }
6756
+ function computeStateStaticImportPath(cssFilePath, cwd2) {
6757
+ try {
6758
+ const nodePath = __require("path");
6759
+ const cssAbs = nodePath.resolve(cwd2, cssFilePath);
6760
+ const cssDir = nodePath.dirname(cssAbs);
6761
+ const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
6762
+ const rel = nodePath.relative(cssDir, stateStaticAbs).replace(/\\/g, "/");
6763
+ return rel.startsWith(".") ? rel : `./${rel}`;
6764
+ } catch {
6765
+ const depth = cssFilePath.split("/").length - 1;
6766
+ const ups = Array(depth).fill("..").join("/");
6767
+ return `${ups}/.next/_tw-state-static.css`;
6768
+ }
6769
+ }
6767
6770
  function patchTailwindCssImpl(src, bundler, cssFilePath, cwd2) {
6768
6771
  const hasTailwindImport = src.includes('@import "tailwindcss"') || src.includes("@import 'tailwindcss'");
6769
- const hasSafelistSource2 = src.includes("tailwind-styled-safelist.css");
6772
+ const hasSafelistSource2 = src.includes("tw-classes");
6773
+ const hasStateImport = src.includes("_tw-state-static.css");
6770
6774
  const needsSafelistSource = bundler === "next" && !hasSafelistSource2;
6771
- const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tailwind-styled-safelist.css";
6775
+ const needsStateImport = bundler === "next" && !hasStateImport;
6776
+ const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tw-classes/**";
6777
+ const stateImportRelPath = needsStateImport && cssFilePath && cwd2 ? computeStateStaticImportPath(cssFilePath, cwd2) : "../.next/_tw-state-static.css";
6772
6778
  const safelistSource = `@source "${safelistRelPath}";`;
6779
+ const stateImport = `@import "${stateImportRelPath}";`;
6773
6780
  if (hasTailwindImport) {
6774
- if (!needsSafelistSource) return null;
6775
- const patched = src.replace(
6776
- /(@import\s+['"]tailwindcss['"];?)/,
6777
- `$1
6781
+ if (!needsSafelistSource && !needsStateImport) return null;
6782
+ let patched = src;
6783
+ if (needsSafelistSource) {
6784
+ patched = patched.replace(
6785
+ /(@import\s+['"]tailwindcss['"];?)/,
6786
+ `$1
6778
6787
  ${safelistSource}`
6779
- );
6788
+ );
6789
+ }
6790
+ if (needsStateImport) {
6791
+ if (patched.includes("tw-classes")) {
6792
+ patched = patched.replace(
6793
+ /(@source\s+["'][^"']+["'];?)/,
6794
+ `$1
6795
+ ${stateImport}`
6796
+ );
6797
+ } else {
6798
+ patched = patched.replace(
6799
+ /(@import\s+['"]tailwindcss['"];?)/,
6800
+ `$1
6801
+ ${stateImport}`
6802
+ );
6803
+ }
6804
+ }
6780
6805
  return patched === src ? null : patched;
6781
6806
  }
6782
- const base = `@import "tailwindcss";
6783
- ${needsSafelistSource ? `${safelistSource}
6784
- ` : ""}
6785
- ${src}`;
6786
- return base;
6807
+ const lines = [`@import "tailwindcss";`];
6808
+ if (needsSafelistSource) lines.push(safelistSource);
6809
+ if (needsStateImport) lines.push(stateImport);
6810
+ lines.push("", src);
6811
+ return lines.join("\n");
6787
6812
  }
6788
6813
  function patchTsConfigImpl(src) {
6789
6814
  try {
@@ -7407,7 +7432,7 @@ async function runStatsCli(args) {
7407
7432
  init_runtime();
7408
7433
  function collectTsFiles(dir, extensions) {
7409
7434
  const files = [];
7410
- const entries = fs12.readdirSync(dir, { withFileTypes: true });
7435
+ const entries = fs11.readdirSync(dir, { withFileTypes: true });
7411
7436
  for (const entry of entries) {
7412
7437
  const full = path6.join(dir, entry.name);
7413
7438
  if (entry.isDirectory()) {
@@ -7490,7 +7515,7 @@ async function runBoundaryCli(args, context) {
7490
7515
  for (const file of files) {
7491
7516
  let source;
7492
7517
  try {
7493
- source = fs12.readFileSync(file, "utf8");
7518
+ source = fs11.readFileSync(file, "utf8");
7494
7519
  } catch {
7495
7520
  continue;
7496
7521
  }
@@ -7585,7 +7610,7 @@ async function loadRegistry(context) {
7585
7610
  if (!registryPath) {
7586
7611
  throw new CliUsageError("Plugin registry file not found.");
7587
7612
  }
7588
- const raw = await fs8__default.default.readFile(registryPath, "utf8");
7613
+ const raw = await fs7__default.default.readFile(registryPath, "utf8");
7589
7614
  const data = JSON.parse(raw);
7590
7615
  return [
7591
7616
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7720,8 +7745,8 @@ var deployCommand = {
7720
7745
  return;
7721
7746
  }
7722
7747
  const cacheDir = path6__namespace.default.join(process.cwd(), ".tw-cache");
7723
- await fs8__default.default.mkdir(cacheDir, { recursive: true });
7724
- await fs8__default.default.writeFile(
7748
+ await fs7__default.default.mkdir(cacheDir, { recursive: true });
7749
+ await fs7__default.default.writeFile(
7725
7750
  path6__namespace.default.join(cacheDir, "deploy-manifest.json"),
7726
7751
  JSON.stringify(manifest, null, 2)
7727
7752
  );
@@ -7822,22 +7847,27 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7822
7847
  issues.push({ severity, type, message, suggestion, location });
7823
7848
  }
7824
7849
  function readJsonFile(filePath) {
7825
- if (!fs12__namespace.default.existsSync(filePath)) return null;
7850
+ if (!fs11__namespace.default.existsSync(filePath)) return null;
7826
7851
  try {
7827
- return JSON.parse(fs12__namespace.default.readFileSync(filePath, "utf8"));
7828
- } catch {
7852
+ return JSON.parse(fs11__namespace.default.readFileSync(filePath, "utf8"));
7853
+ } catch (parseErr) {
7854
+ if (process.env.TWS_DEBUG === "1") {
7855
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
7856
+ process.stderr.write(`[tw:doctor] malformed JSON: ${filePath} \u2014 ${msg}
7857
+ `);
7858
+ }
7829
7859
  return null;
7830
7860
  }
7831
7861
  }
7832
7862
  function findWorkspacePackageJsonFiles(root) {
7833
7863
  const packagesDir = path6__namespace.default.join(root, "packages");
7834
- if (!fs12__namespace.default.existsSync(packagesDir)) return [];
7835
- return fs12__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__namespace.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs12__namespace.default.existsSync(filePath));
7864
+ if (!fs11__namespace.default.existsSync(packagesDir)) return [];
7865
+ return fs11__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__namespace.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11__namespace.default.existsSync(filePath));
7836
7866
  }
7837
7867
  function findFiles(dir, ext) {
7838
7868
  const files = [];
7839
7869
  try {
7840
- const entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
7870
+ const entries = fs11__namespace.default.readdirSync(dir, { withFileTypes: true });
7841
7871
  for (const entry of entries) {
7842
7872
  const fullPath = path6__namespace.default.join(dir, entry.name);
7843
7873
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7846,7 +7876,12 @@ function findFiles(dir, ext) {
7846
7876
  files.push(fullPath);
7847
7877
  }
7848
7878
  }
7849
- } catch {
7879
+ } catch (dirErr) {
7880
+ if (process.env.TWS_DEBUG === "1") {
7881
+ const msg = dirErr instanceof Error ? dirErr.message : String(dirErr);
7882
+ process.stderr.write(`[tw:doctor] findFiles error in ${dir}: ${msg}
7883
+ `);
7884
+ }
7850
7885
  return files;
7851
7886
  }
7852
7887
  return files;
@@ -7999,7 +8034,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7999
8034
  const cssFiles = findFiles(root, ".css");
8000
8035
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
8001
8036
  try {
8002
- const content = fs12__namespace.default.readFileSync(filePath, "utf8");
8037
+ const content = fs11__namespace.default.readFileSync(filePath, "utf8");
8003
8038
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
8004
8039
  } catch {
8005
8040
  return false;
@@ -8023,7 +8058,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
8023
8058
  );
8024
8059
  }
8025
8060
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
8026
- const hasConfig = configFiles.some((name) => fs12__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8061
+ const hasConfig = configFiles.some((name) => fs11__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8027
8062
  addCheck(
8028
8063
  checks,
8029
8064
  "tailwind",
@@ -9308,19 +9343,8 @@ var syncCommand = {
9308
9343
  var import_picocolors5 = __toESM(require_picocolors());
9309
9344
  init_errors();
9310
9345
 
9311
- // packages/domain/compiler/src/index.ts
9312
- init_nativeBridge();
9313
- var compileCssFromClasses = (classes, prefix) => {
9314
- const native = getNativeBridge();
9315
- if (!native?.transformSource) {
9316
- throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
9317
- }
9318
- const result = native.transformSource(classes.join(" "), { prefix: prefix });
9319
- if (!result) {
9320
- throw new Error("FATAL: transformSource returned null");
9321
- }
9322
- return result;
9323
- };
9346
+ // packages/infrastructure/cli/src/utils/traceService.ts
9347
+ init_internal();
9324
9348
 
9325
9349
  // packages/domain/engine/src/native-bridge.ts
9326
9350
  init_src();
@@ -9771,37 +9795,33 @@ var CascadeResolutionId = class {
9771
9795
  return `R${this.value}`;
9772
9796
  }
9773
9797
  };
9774
- var _propertyNamesFallback = /* @__PURE__ */ new Map();
9775
- var _valueNamesFallback = /* @__PURE__ */ new Map();
9776
9798
  function registerPropertyName(id, name) {
9777
9799
  const native = getNativeEngineBinding();
9778
- if (native?.registerPropertyName) {
9779
- native.registerPropertyName(id.value, name);
9780
- return;
9800
+ if (!native?.registerPropertyName) {
9801
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
9781
9802
  }
9782
- _propertyNamesFallback.set(id.value, name);
9803
+ native.registerPropertyName(id.value, name);
9783
9804
  }
9784
9805
  function registerValueName(id, name) {
9785
9806
  const native = getNativeEngineBinding();
9786
- if (native?.registerValueName) {
9787
- native.registerValueName(id.value, name);
9788
- return;
9807
+ if (!native?.registerValueName) {
9808
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
9789
9809
  }
9790
- _valueNamesFallback.set(id.value, name);
9810
+ native.registerValueName(id.value, name);
9791
9811
  }
9792
9812
  function propertyIdToString(id) {
9793
9813
  const native = getNativeEngineBinding();
9794
- if (native?.propertyIdToString) {
9795
- return native.propertyIdToString(id.value);
9814
+ if (!native?.propertyIdToString) {
9815
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
9796
9816
  }
9797
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
9817
+ return native.propertyIdToString(id.value);
9798
9818
  }
9799
9819
  function valueIdToString(id) {
9800
9820
  const native = getNativeEngineBinding();
9801
- if (native?.valueIdToString) {
9802
- return native.valueIdToString(id.value);
9821
+ if (!native?.valueIdToString) {
9822
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
9803
9823
  }
9804
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
9824
+ return native.valueIdToString(id.value);
9805
9825
  }
9806
9826
  var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9807
9827
  CascadeStage2[CascadeStage2["Origin"] = 0] = "Origin";
@@ -9811,19 +9831,12 @@ var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9811
9831
  CascadeStage2[CascadeStage2["Order"] = 4] = "Order";
9812
9832
  return CascadeStage2;
9813
9833
  })(CascadeStage || {});
9814
- function createFingerprintFallback(parts) {
9815
- const hash = parts.reduce(
9816
- (acc, part) => part.split("").reduce((h, char) => (h << 5) - h + char.charCodeAt(0) & h, acc),
9817
- 0
9818
- );
9819
- return Math.abs(hash).toString(36);
9820
- }
9821
9834
  function createFingerprint(parts) {
9822
9835
  const native = getNativeEngineBinding();
9823
- if (native?.createFingerprint) {
9824
- return native.createFingerprint(parts);
9836
+ if (!native?.createFingerprint) {
9837
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
9825
9838
  }
9826
- return createFingerprintFallback(parts);
9839
+ return native.createFingerprint(parts);
9827
9840
  }
9828
9841
 
9829
9842
  // packages/domain/engine/src/reverseLookup.ts
@@ -10085,14 +10098,68 @@ function detectLayerFromClassName(className) {
10085
10098
  return null;
10086
10099
  }
10087
10100
  function parseCssToIr(css, options = {}) {
10088
- resetIdGenerator();
10101
+ const native = getNativeEngineBinding();
10102
+ const prefix = options.prefix ?? "";
10103
+ if (native?.assembleCssIr) {
10104
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
10105
+ }
10106
+ return _parseCssToIrFallback(css, prefix, native);
10107
+ }
10108
+ function _parseCssToIrFast(assembled) {
10109
+ const native = getNativeEngineBinding();
10089
10110
  layerMap.clear();
10090
10111
  layerOrderMap.clear();
10091
- const native = getNativeEngineBinding();
10112
+ for (const le of assembled.layers) {
10113
+ const lid = new LayerId(le.layerId);
10114
+ layerMap.set(le.name, lid);
10115
+ layerOrderMap.set(le.name, le.order);
10116
+ }
10117
+ const rules = assembled.rules.map((r) => {
10118
+ const propertyId = new PropertyId(r.propertyId);
10119
+ const valueId = new ValueId(r.valueId);
10120
+ if (native?.registerPropertyName) {
10121
+ native.registerPropertyName(r.propertyId, r.propertyName);
10122
+ } else {
10123
+ registerPropertyName(propertyId, r.propertyName);
10124
+ }
10125
+ if (native?.registerValueName) {
10126
+ native.registerValueName(r.valueId, r.valueName);
10127
+ } else {
10128
+ registerValueName(valueId, r.valueName);
10129
+ }
10130
+ return {
10131
+ id: new RuleId(r.ruleId),
10132
+ selector: new SelectorId(r.selectorId),
10133
+ variantChain: new VariantChainId(0),
10134
+ property: propertyId,
10135
+ value: valueId,
10136
+ origin: r.origin,
10137
+ importance: r.importance,
10138
+ layer: r.layerId >= 0 ? new LayerId(r.layerId) : null,
10139
+ layerOrder: r.layerOrder,
10140
+ specificity: r.specificity,
10141
+ condition: r.conditionId >= 0 ? new ConditionId(r.conditionId) : null,
10142
+ conditionResult: r.conditionResult,
10143
+ insertionOrder: r.insertionOrder,
10144
+ fingerprint: r.fingerprint,
10145
+ source: { file: "", line: 1, column: 1 }
10146
+ };
10147
+ });
10148
+ const classToRuleIds = new Map(
10149
+ assembled.classToRuleIds.map((m) => [
10150
+ m.className,
10151
+ m.ruleIds.map((id) => new RuleId(id))
10152
+ ])
10153
+ );
10154
+ return { rules, classToRuleIds };
10155
+ }
10156
+ function _parseCssToIrFallback(css, prefix, native) {
10092
10157
  if (!native?.parseCssRules) {
10093
10158
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
10094
10159
  }
10095
- const prefix = options.prefix ?? "";
10160
+ resetIdGenerator();
10161
+ layerMap.clear();
10162
+ layerOrderMap.clear();
10096
10163
  const rules = [];
10097
10164
  const classToRuleIds = /* @__PURE__ */ new Map();
10098
10165
  const parsed = native.parseCssRules(css);
@@ -10107,7 +10174,7 @@ function parseCssToIr(css, options = {}) {
10107
10174
  const valueId = generateValueId(r.value);
10108
10175
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
10109
10176
  const conditionId = hasMedia ? generateConditionId() : null;
10110
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
10177
+ const conditionResult = 2 /* Unknown */;
10111
10178
  const ruleId = generateRuleId();
10112
10179
  const fingerprint = createFingerprint([className, r.property, r.value]);
10113
10180
  const rule = {
@@ -10121,7 +10188,6 @@ function parseCssToIr(css, options = {}) {
10121
10188
  layer,
10122
10189
  layerOrder,
10123
10190
  specificity: r.specificity,
10124
- // from native — no JS recalculation
10125
10191
  condition: conditionId,
10126
10192
  conditionResult,
10127
10193
  insertionOrder: getNextInsertionOrder(),
@@ -10347,6 +10413,9 @@ async function traceClass(className, options) {
10347
10413
  };
10348
10414
  return result;
10349
10415
  }
10416
+
10417
+ // packages/infrastructure/cli/src/utils/traceTargetService.ts
10418
+ init_internal();
10350
10419
  init_src2();
10351
10420
  function toRelativePath(root, value) {
10352
10421
  const relative = path6__namespace.default.relative(root, value);
@@ -10418,7 +10487,7 @@ function tryCompileClasses(classes) {
10418
10487
  }
10419
10488
  }
10420
10489
  function traceSingleFile(filePath, root) {
10421
- const source = fs12__namespace.default.readFileSync(filePath, "utf8");
10490
+ const source = fs11__namespace.default.readFileSync(filePath, "utf8");
10422
10491
  const classes = uniqueSorted(scanSource(source));
10423
10492
  const imports = extractImports(source);
10424
10493
  const compiled = tryCompileClasses(classes);
@@ -10448,8 +10517,8 @@ function traceDirectory(targetDir, root) {
10448
10517
  });
10449
10518
  const imports = [];
10450
10519
  const importKeys = /* @__PURE__ */ new Set();
10451
- const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10452
- const source = fs12__namespace.default.readFileSync(entry.file, "utf8");
10520
+ const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10521
+ const source = fs11__namespace.default.readFileSync(entry.file, "utf8");
10453
10522
  const fileImports = extractImports(source);
10454
10523
  for (const fileImport of fileImports) {
10455
10524
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10482,10 +10551,10 @@ function traceDirectory(targetDir, root) {
10482
10551
  async function traceTarget(target, options = {}) {
10483
10552
  const root = path6__namespace.default.resolve(options.root ?? process.cwd());
10484
10553
  const resolvedTarget = path6__namespace.default.resolve(root, target);
10485
- if (!fs12__namespace.default.existsSync(resolvedTarget)) {
10554
+ if (!fs11__namespace.default.existsSync(resolvedTarget)) {
10486
10555
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10487
10556
  }
10488
- const stat = fs12__namespace.default.statSync(resolvedTarget);
10557
+ const stat = fs11__namespace.default.statSync(resolvedTarget);
10489
10558
  if (stat.isDirectory()) {
10490
10559
  return traceDirectory(resolvedTarget, root);
10491
10560
  }
@@ -10691,10 +10760,10 @@ async function runGenerateTypesCli(rawArgs) {
10691
10760
  output.writeText("");
10692
10761
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10693
10762
  const outDir = path6__namespace.default.dirname(outPath);
10694
- if (!fs12__namespace.default.existsSync(outDir)) {
10695
- fs12__namespace.default.mkdirSync(outDir, { recursive: true });
10763
+ if (!fs11__namespace.default.existsSync(outDir)) {
10764
+ fs11__namespace.default.mkdirSync(outDir, { recursive: true });
10696
10765
  }
10697
- fs12__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10766
+ fs11__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10698
10767
  logger.ok(path6__namespace.default.relative(cwd2, outPath));
10699
10768
  output.writeText("");
10700
10769
  output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
@@ -10710,7 +10779,7 @@ async function loadNativeBinding2(cwd2) {
10710
10779
  path6__namespace.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10711
10780
  ];
10712
10781
  for (const candidate of candidates) {
10713
- if (fs12__namespace.default.existsSync(candidate)) {
10782
+ if (fs11__namespace.default.existsSync(candidate)) {
10714
10783
  try {
10715
10784
  return __require(candidate);
10716
10785
  } catch {
@@ -10722,6 +10791,9 @@ async function loadNativeBinding2(cwd2) {
10722
10791
 
10723
10792
  // packages/infrastructure/cli/src/commands/why.ts
10724
10793
  init_errors();
10794
+
10795
+ // packages/infrastructure/cli/src/utils/whyService.ts
10796
+ init_internal();
10725
10797
  init_src2();
10726
10798
  function extractVariantChain(usage) {
10727
10799
  const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
@@ -10769,7 +10841,7 @@ async function whyClass(className, options) {
10769
10841
  for (const file of scanResult.files) {
10770
10842
  const source = (() => {
10771
10843
  try {
10772
- return fs12__namespace.default.readFileSync(file.file, "utf8");
10844
+ return fs11__namespace.default.readFileSync(file.file, "utf8");
10773
10845
  } catch {
10774
10846
  return "";
10775
10847
  }