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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import * as fs12 from 'fs';
4
- import fs12__default, { readFileSync, readdirSync } from 'fs';
3
+ import * as fs11 from 'fs';
4
+ import fs11__default, { readFileSync, readdirSync } from 'fs';
5
5
  import * as path6 from 'path';
6
6
  import path6__default, { join, extname } from 'path';
7
7
  import 'crypto';
@@ -9,7 +9,7 @@ import { fileURLToPath, pathToFileURL } from 'url';
9
9
  import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
10
10
  import { availableParallelism } from 'os';
11
11
  import { z } from 'zod';
12
- import fs8 from 'fs/promises';
12
+ import fs7 from 'fs/promises';
13
13
  import { isTTY, spinner, note, outro, intro, text, isCancel, select, confirm } from '@clack/prompts';
14
14
  import { parseArgs } from 'util';
15
15
  import { spawn } from 'child_process';
@@ -988,7 +988,7 @@ var require_command = __commonJS({
988
988
  "packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports$1) {
989
989
  var EventEmitter = __require("events").EventEmitter;
990
990
  var childProcess = __require("child_process");
991
- var path29 = __require("path");
991
+ var path30 = __require("path");
992
992
  var fs16 = __require("fs");
993
993
  var process2 = __require("process");
994
994
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1920,9 +1920,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1920
1920
  let launchWithNode = false;
1921
1921
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1922
1922
  function findFile(baseDir, baseName) {
1923
- const localBin = path29.resolve(baseDir, baseName);
1923
+ const localBin = path30.resolve(baseDir, baseName);
1924
1924
  if (fs16.existsSync(localBin)) return localBin;
1925
- if (sourceExt.includes(path29.extname(baseName))) return void 0;
1925
+ if (sourceExt.includes(path30.extname(baseName))) return void 0;
1926
1926
  const foundExt = sourceExt.find(
1927
1927
  (ext) => fs16.existsSync(`${localBin}${ext}`)
1928
1928
  );
@@ -1940,17 +1940,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
1940
1940
  } catch (err) {
1941
1941
  resolvedScriptPath = this._scriptPath;
1942
1942
  }
1943
- executableDir = path29.resolve(
1944
- path29.dirname(resolvedScriptPath),
1943
+ executableDir = path30.resolve(
1944
+ path30.dirname(resolvedScriptPath),
1945
1945
  executableDir
1946
1946
  );
1947
1947
  }
1948
1948
  if (executableDir) {
1949
1949
  let localFile = findFile(executableDir, executableFile);
1950
1950
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1951
- const legacyName = path29.basename(
1951
+ const legacyName = path30.basename(
1952
1952
  this._scriptPath,
1953
- path29.extname(this._scriptPath)
1953
+ path30.extname(this._scriptPath)
1954
1954
  );
1955
1955
  if (legacyName !== this._name) {
1956
1956
  localFile = findFile(
@@ -1961,7 +1961,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1961
1961
  }
1962
1962
  executableFile = localFile || executableFile;
1963
1963
  }
1964
- launchWithNode = sourceExt.includes(path29.extname(executableFile));
1964
+ launchWithNode = sourceExt.includes(path30.extname(executableFile));
1965
1965
  let proc;
1966
1966
  if (process2.platform !== "win32") {
1967
1967
  if (launchWithNode) {
@@ -2801,7 +2801,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2801
2801
  * @return {Command}
2802
2802
  */
2803
2803
  nameFromFilename(filename) {
2804
- this._name = path29.basename(filename, path29.extname(filename));
2804
+ this._name = path30.basename(filename, path30.extname(filename));
2805
2805
  return this;
2806
2806
  }
2807
2807
  /**
@@ -2815,9 +2815,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2815
2815
  * @param {string} [path]
2816
2816
  * @return {(string|null|Command)}
2817
2817
  */
2818
- executableDir(path30) {
2819
- if (path30 === void 0) return this._executableDir;
2820
- this._executableDir = path30;
2818
+ executableDir(path31) {
2819
+ if (path31 === void 0) return this._executableDir;
2820
+ this._executableDir = path31;
2821
2821
  return this;
2822
2822
  }
2823
2823
  /**
@@ -3167,12 +3167,12 @@ function resolveNativeBinary(runtimeDir) {
3167
3167
  if (isBrowser2) {
3168
3168
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
3169
3169
  }
3170
- if (process.env.TWS_DISABLE_NATIVE === "1") {
3170
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
3171
3171
  return { path: null, source: "not-found", platform, tried: [] };
3172
3172
  }
3173
3173
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3174
3174
  if (envPath) {
3175
- if (fs12.existsSync(envPath)) {
3175
+ if (fs11.existsSync(envPath)) {
3176
3176
  return { path: envPath, source: "env", platform, tried };
3177
3177
  }
3178
3178
  tried.push(`env:${envPath} (not found)`);
@@ -3181,7 +3181,7 @@ function resolveNativeBinary(runtimeDir) {
3181
3181
  for (const pkg of prebuiltPkgs) {
3182
3182
  try {
3183
3183
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
3184
- if (fs12.existsSync(candidate)) {
3184
+ if (fs11.existsSync(candidate)) {
3185
3185
  return { path: candidate, source: "prebuilt", platform, tried };
3186
3186
  }
3187
3187
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3198,7 +3198,7 @@ function resolveNativeBinary(runtimeDir) {
3198
3198
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3199
3199
  const candidate = path6.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3200
3200
  tried.push(`self-bundled:${candidate}`);
3201
- if (fs12.existsSync(candidate)) {
3201
+ if (fs11.existsSync(candidate)) {
3202
3202
  return { path: candidate, source: "prebuilt", platform, tried };
3203
3203
  }
3204
3204
  }
@@ -3232,7 +3232,7 @@ function resolveNativeBinary(runtimeDir) {
3232
3232
  }
3233
3233
  for (const candidate of localCandidates) {
3234
3234
  tried.push(`local:${candidate}`);
3235
- if (fs12.existsSync(candidate)) {
3235
+ if (fs11.existsSync(candidate)) {
3236
3236
  return { path: candidate, source: "local", platform, tried };
3237
3237
  }
3238
3238
  }
@@ -3282,9 +3282,9 @@ function createDebugLogger(namespace, label) {
3282
3282
  }
3283
3283
  };
3284
3284
  }
3285
- function formatIssuePath(path29) {
3286
- if (!path29 || path29.length === 0) return "(root)";
3287
- return path29.map(
3285
+ function formatIssuePath(path30) {
3286
+ if (!path30 || path30.length === 0) return "(root)";
3287
+ return path30.map(
3288
3288
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3289
3289
  ).join(".");
3290
3290
  }
@@ -3297,7 +3297,7 @@ function loadNativeBinding(options) {
3297
3297
  for (const candidate of candidates) {
3298
3298
  const candidatePath = path6__default.resolve(runtimeDir, candidate);
3299
3299
  try {
3300
- if (!fs12__default.existsSync(candidatePath) && !fs12__default.existsSync(candidatePath + ".node")) {
3300
+ if (!fs11__default.existsSync(candidatePath) && !fs11__default.existsSync(candidatePath + ".node")) {
3301
3301
  continue;
3302
3302
  }
3303
3303
  const mod = requireNativeModule(candidatePath);
@@ -3329,9 +3329,9 @@ function resolveNativeBindingCandidates(options) {
3329
3329
  }
3330
3330
  }
3331
3331
  if (!includeDefaultCandidates) return candidates;
3332
- if (fs12__default.existsSync(runtimeDir)) {
3332
+ if (fs11__default.existsSync(runtimeDir)) {
3333
3333
  try {
3334
- for (const entry of fs12__default.readdirSync(runtimeDir)) {
3334
+ for (const entry of fs11__default.readdirSync(runtimeDir)) {
3335
3335
  if (entry.endsWith(".node")) candidates.push(entry);
3336
3336
  }
3337
3337
  } catch {
@@ -3398,8 +3398,8 @@ var init_src = __esm({
3398
3398
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3399
3399
  static fromZod(err) {
3400
3400
  const first = err.issues?.[0] ?? err.errors?.[0];
3401
- const path29 = formatIssuePath(first?.path);
3402
- const message = first ? `${path29}: ${first.message}` : "Schema validation failed";
3401
+ const path30 = formatIssuePath(first?.path);
3402
+ const message = first ? `${path30}: ${first.message}` : "Schema validation failed";
3403
3403
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3404
3404
  }
3405
3405
  static wrap(source, code, err) {
@@ -3749,7 +3749,7 @@ function defaultCachePath(rootDir, cacheDir) {
3749
3749
  }
3750
3750
  function readCache(rootDir, cacheDir) {
3751
3751
  const cachePath = defaultCachePath(rootDir, cacheDir);
3752
- fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3752
+ fs11__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3753
3753
  const result = cacheReadNative(cachePath);
3754
3754
  if (!result) return [];
3755
3755
  return result.entries.map((e) => ({
@@ -3764,7 +3764,7 @@ function readCache(rootDir, cacheDir) {
3764
3764
  }
3765
3765
  function writeCache(rootDir, entries, cacheDir) {
3766
3766
  const cachePath = defaultCachePath(rootDir, cacheDir);
3767
- fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3767
+ fs11__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3768
3768
  const success = cacheWriteNative(cachePath, entries);
3769
3769
  if (!success) {
3770
3770
  throw new Error(
@@ -3791,27 +3791,7 @@ var init_cache_native = __esm({
3791
3791
  function collectFiles(rootDir, extensions, ignoreDirs) {
3792
3792
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
3793
3793
  if (native !== null) return native;
3794
- const files = [];
3795
- function walk(dir) {
3796
- let entries;
3797
- try {
3798
- entries = fs12__default.readdirSync(dir, { withFileTypes: true });
3799
- } catch {
3800
- return;
3801
- }
3802
- for (const entry of entries) {
3803
- const fullPath = path6__default.join(dir, entry.name);
3804
- const rel = path6__default.relative(rootDir, fullPath);
3805
- if (entry.isDirectory()) {
3806
- const ignored = ignoreDirs.some((d) => entry.name === d || rel.startsWith(d + path6__default.sep));
3807
- if (!ignored) walk(fullPath);
3808
- } else if (isScannableFile(entry.name, extensions)) {
3809
- files.push(fullPath);
3810
- }
3811
- }
3812
- }
3813
- walk(rootDir);
3814
- return files;
3794
+ throw new Error("FATAL: Native binding 'collectFiles' is required but not available.");
3815
3795
  }
3816
3796
  function mergeResults(batchResults) {
3817
3797
  const files = batchResults.map((r) => ({
@@ -3821,8 +3801,7 @@ function mergeResults(batchResults) {
3821
3801
  }));
3822
3802
  const native = rebuildWorkspaceResultNative(files);
3823
3803
  if (native) return native;
3824
- const unique = new Set(files.flatMap((f) => f.classes));
3825
- return { files, totalFiles: files.length, uniqueClasses: Array.from(unique).sort() };
3804
+ throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
3826
3805
  }
3827
3806
  function runChunkInWorker(filePaths) {
3828
3807
  return new Promise((resolve2, reject) => {
@@ -3893,12 +3872,12 @@ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, S
3893
3872
  var init_schemas = __esm({
3894
3873
  "packages/domain/scanner/src/schemas.ts"() {
3895
3874
  init_src();
3896
- formatIssuePath2 = (path29) => path29.length > 0 ? path29.map(
3875
+ formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
3897
3876
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3898
3877
  ).join(".") : "<root>";
3899
3878
  formatIssues = (error) => error.issues.map((issue) => {
3900
- const path29 = formatIssuePath2(issue.path);
3901
- return `${path29}: ${issue.message}`;
3879
+ const path30 = formatIssuePath2(issue.path);
3880
+ return `${path30}: ${issue.message}`;
3902
3881
  }).join("; ");
3903
3882
  parseWithSchema = (schema, data, label) => {
3904
3883
  const parsed = schema.safeParse(data);
@@ -3961,7 +3940,7 @@ __export(src_exports, {
3961
3940
  DEFAULT_IGNORES: () => DEFAULT_IGNORES,
3962
3941
  batchExtractClassesNative: () => batchExtractClassesNative,
3963
3942
  extractClassesNative: () => extractClassesNative,
3964
- isScannableFile: () => isScannableFile,
3943
+ isScannableFile: () => isScannableFile2,
3965
3944
  parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
3966
3945
  parseScanWorkspaceResult: () => parseScanWorkspaceResult,
3967
3946
  parseScannerWorkerMessage: () => parseScannerWorkerMessage,
@@ -3995,7 +3974,7 @@ function resolveScannerWorkerModulePath() {
3995
3974
  path6__default.resolve(runtimeDir, "worker.ts")
3996
3975
  ];
3997
3976
  for (const candidate of candidates) {
3998
- if (fs12__default.existsSync(candidate)) return candidate;
3977
+ if (fs11__default.existsSync(candidate)) return candidate;
3999
3978
  }
4000
3979
  return null;
4001
3980
  }
@@ -4052,7 +4031,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4052
4031
  if (!currentDir) continue;
4053
4032
  const entries = (() => {
4054
4033
  try {
4055
- return fs12__default.readdirSync(currentDir, { withFileTypes: true });
4034
+ return fs11__default.readdirSync(currentDir, { withFileTypes: true });
4056
4035
  } catch {
4057
4036
  return [];
4058
4037
  }
@@ -4090,7 +4069,7 @@ function scanSource(source) {
4090
4069
  "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"
4091
4070
  );
4092
4071
  }
4093
- function isScannableFile(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4072
+ function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4094
4073
  return includeExtensions.includes(path6__default.extname(filePath));
4095
4074
  }
4096
4075
  function scanFile(filePath) {
@@ -4151,7 +4130,7 @@ function scanWorkspace(rootDir, options = {}) {
4151
4130
  for (const filePath of candidates) {
4152
4131
  const stat = (() => {
4153
4132
  try {
4154
- return fs12__default.statSync(filePath);
4133
+ return fs11__default.statSync(filePath);
4155
4134
  } catch {
4156
4135
  return null;
4157
4136
  }
@@ -4177,7 +4156,7 @@ function scanWorkspace(rootDir, options = {}) {
4177
4156
  for (const { filePath, stat, size, cached } of ranked) {
4178
4157
  const content = (() => {
4179
4158
  try {
4180
- return fs12__default.readFileSync(filePath, "utf8");
4159
+ return fs11__default.readFileSync(filePath, "utf8");
4181
4160
  } catch {
4182
4161
  return null;
4183
4162
  }
@@ -4321,7 +4300,7 @@ var init_src2 = __esm({
4321
4300
  )
4322
4301
  ];
4323
4302
  for (const fullPath of candidates) {
4324
- if (!fs12__default.existsSync(fullPath)) continue;
4303
+ if (!fs11__default.existsSync(fullPath)) continue;
4325
4304
  try {
4326
4305
  const required = req(fullPath);
4327
4306
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4363,7 +4342,7 @@ function isRecord(value) {
4363
4342
  }
4364
4343
  async function pathExists(filePath) {
4365
4344
  try {
4366
- await fs12__default.promises.access(filePath, fs12__default.constants.F_OK);
4345
+ await fs11__default.promises.access(filePath, fs11__default.constants.F_OK);
4367
4346
  return true;
4368
4347
  } catch {
4369
4348
  return false;
@@ -4484,7 +4463,7 @@ var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchem
4484
4463
  var init_schemas2 = __esm({
4485
4464
  "packages/domain/analyzer/src/schemas.ts"() {
4486
4465
  init_src();
4487
- formatIssuePath3 = (path29) => path29.length > 0 ? path29.map(
4466
+ formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
4488
4467
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
4489
4468
  ).join(".") : "<root>";
4490
4469
  isPlainObject = (value) => {
@@ -4493,8 +4472,8 @@ var init_schemas2 = __esm({
4493
4472
  return proto === Object.prototype || proto === null;
4494
4473
  };
4495
4474
  formatIssues2 = (error) => error.issues.map((issue) => {
4496
- const path29 = formatIssuePath3(issue.path);
4497
- return `${path29}: ${issue.message}`;
4475
+ const path30 = formatIssuePath3(issue.path);
4476
+ return `${path30}: ${issue.message}`;
4498
4477
  }).join("; ");
4499
4478
  parseWithSchema2 = (schema, data, label) => {
4500
4479
  const parsed = schema.safeParse(data);
@@ -4590,7 +4569,7 @@ var init_schemas2 = __esm({
4590
4569
  parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
4591
4570
  }
4592
4571
  });
4593
- var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, isArbitraryUtility, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4572
+ var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
4594
4573
  var init_semantic = __esm({
4595
4574
  "packages/domain/analyzer/src/semantic.ts"() {
4596
4575
  init_binding();
@@ -4603,27 +4582,13 @@ var init_semantic = __esm({
4603
4582
  const base = parts.pop() ?? className;
4604
4583
  return { variantKey: parts.join(":"), base };
4605
4584
  };
4606
- isArbitraryUtility = (baseClass) => {
4607
- return baseClass.includes("[") && baseClass.includes("]");
4608
- };
4609
- resolveConflictGroup = (base) => {
4610
- if (isArbitraryUtility(base)) return null;
4611
- if (["block", "inline", "inline-block", "inline-flex", "flex", "grid", "hidden"].includes(base))
4612
- return "display";
4613
- if (base.startsWith("bg-")) return "bg";
4614
- if (base.startsWith("text-")) return "text";
4615
- if (base.startsWith("font-")) return "font";
4616
- if (base.startsWith("rounded")) return "rounded";
4617
- if (base.startsWith("shadow")) return "shadow";
4618
- if (base.startsWith("border-")) return "border";
4619
- if (base.startsWith("opacity-")) return "opacity";
4620
- if (base.startsWith("w-") || base.startsWith("min-w-") || base.startsWith("max-w-"))
4621
- return "width";
4622
- if (base.startsWith("h-") || base.startsWith("min-h-") || base.startsWith("max-h-"))
4623
- return "height";
4624
- if (base.startsWith("p-") || base.startsWith("px-") || base.startsWith("py-")) return "padding";
4625
- if (base.startsWith("m-") || base.startsWith("mx-") || base.startsWith("my-")) return "margin";
4626
- return null;
4585
+ resolveConflictGroup = async (base) => {
4586
+ const native = await getNativeBinding();
4587
+ if (!native?.resolveConflictGroup) {
4588
+ throw new Error("Native binding 'resolveConflictGroup' is required but not available.");
4589
+ }
4590
+ const result = native.resolveConflictGroup(base);
4591
+ return result.length > 0 ? result : null;
4627
4592
  };
4628
4593
  detectConflicts = async (usages) => {
4629
4594
  const native = await getNativeBinding();
@@ -4711,7 +4676,7 @@ var init_semantic = __esm({
4711
4676
  return out;
4712
4677
  };
4713
4678
  collectSafelistFromSource = async (configPath) => {
4714
- const source = await fs12__default.promises.readFile(configPath, "utf8");
4679
+ const source = await fs11__default.promises.readFile(configPath, "utf8");
4715
4680
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4716
4681
  const allTokens = extractClassesNative2(source);
4717
4682
  const hasSafelist = source.includes("safelist");
@@ -4738,7 +4703,7 @@ var init_semantic = __esm({
4738
4703
  customUtilities: /* @__PURE__ */ new Set()
4739
4704
  };
4740
4705
  }
4741
- const configStat = await fs12__default.promises.stat(configPath).catch(() => null);
4706
+ const configStat = await fs11__default.promises.stat(configPath).catch(() => null);
4742
4707
  if (configStat) {
4743
4708
  const cached = tailwindConfigCache.get(configPath);
4744
4709
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5034,12 +4999,12 @@ var init_classToCss = __esm({
5034
4999
  init_binding();
5035
5000
  init_schemas2();
5036
5001
  init_utils();
5037
- normalizeClassInput = (input, _binding) => {
5002
+ normalizeClassInput = (input, binding) => {
5038
5003
  if (typeof input === "string") {
5039
- if (_binding?.normalizeClassInput) {
5040
- return _binding.normalizeClassInput(input);
5004
+ if (!binding.normalizeClassInput) {
5005
+ throw new Error("FATAL: Native binding 'normalizeClassInput' is required but not available.");
5041
5006
  }
5042
- return input.split(/\s+/).map((item) => item.trim()).filter((item) => item.length > 0);
5007
+ return binding.normalizeClassInput(input);
5043
5008
  }
5044
5009
  if (!Array.isArray(input)) {
5045
5010
  throw new TypeError("classToCss input must be a string or an array of strings.");
@@ -5071,11 +5036,11 @@ var init_classToCss = __esm({
5071
5036
  }
5072
5037
  };
5073
5038
  declarationMapToString = (declarationMap, binding) => {
5074
- const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5075
- if (binding?.declarationMapToString) {
5076
- return binding.declarationMapToString(entries);
5039
+ if (!binding.declarationMapToString) {
5040
+ throw new Error("FATAL: Native binding 'declarationMapToString' is required but not available.");
5077
5041
  }
5078
- return entries.map(({ property, value }) => `${property}: ${value}`).join("; ");
5042
+ const entries = Array.from(declarationMap.entries()).map(([property, value]) => ({ property, value }));
5043
+ return binding.declarationMapToString(entries);
5079
5044
  };
5080
5045
  classToCss = async (input, options = {}) => {
5081
5046
  const binding = await requireNativeCssCompiler();
@@ -5171,7 +5136,7 @@ var init_src3 = __esm({
5171
5136
  });
5172
5137
  async function pathExists2(filePath) {
5173
5138
  try {
5174
- await fs8.access(filePath);
5139
+ await fs7.access(filePath);
5175
5140
  return true;
5176
5141
  } catch {
5177
5142
  return false;
@@ -5179,7 +5144,7 @@ async function pathExists2(filePath) {
5179
5144
  }
5180
5145
  async function readFileSafe(filePath) {
5181
5146
  try {
5182
- return await fs8.readFile(filePath, "utf8");
5147
+ return await fs7.readFile(filePath, "utf8");
5183
5148
  } catch {
5184
5149
  return null;
5185
5150
  }
@@ -5198,8 +5163,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5198
5163
  options.onDryRun?.(`write ${filePath}`);
5199
5164
  return;
5200
5165
  }
5201
- await fs8.mkdir(path6__default.dirname(filePath), { recursive: true });
5202
- await fs8.writeFile(filePath, content, "utf8");
5166
+ await fs7.mkdir(path6__default.dirname(filePath), { recursive: true });
5167
+ await fs7.writeFile(filePath, content, "utf8");
5203
5168
  }
5204
5169
  async function ensureFileSafe(filePath, content, options = {}) {
5205
5170
  if (await pathExists2(filePath)) return "skipped";
@@ -6072,7 +6037,7 @@ var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttem
6072
6037
  var init_nativeBridge = __esm({
6073
6038
  "packages/domain/compiler/src/nativeBridge.ts"() {
6074
6039
  init_src();
6075
- _loadNative = (path29) => __require(path29);
6040
+ _loadNative = (path30) => __require(path30);
6076
6041
  log3 = (...args) => {
6077
6042
  if (process.env.DEBUG?.includes("compiler:native")) {
6078
6043
  console.log("[compiler:native]", ...args);
@@ -6129,6 +6094,30 @@ Tried paths: ${result.tried.join("\n")}`);
6129
6094
  }
6130
6095
  }
6131
6096
  });
6097
+ var compileCssFromClasses;
6098
+ var init_src4 = __esm({
6099
+ "packages/domain/compiler/src/index.ts"() {
6100
+ init_nativeBridge();
6101
+ compileCssFromClasses = (classes, prefix) => {
6102
+ const native = getNativeBridge();
6103
+ if (!native?.transformSource) {
6104
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
6105
+ }
6106
+ const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
6107
+ if (!result) {
6108
+ throw new Error("FATAL: transformSource returned null");
6109
+ }
6110
+ return result;
6111
+ };
6112
+ }
6113
+ });
6114
+
6115
+ // packages/domain/compiler/src/internal.ts
6116
+ var init_internal = __esm({
6117
+ "packages/domain/compiler/src/internal.ts"() {
6118
+ init_src4();
6119
+ }
6120
+ });
6132
6121
 
6133
6122
  // packages/infrastructure/cli/src/commands/program.ts
6134
6123
  init_esm();
@@ -6427,7 +6416,7 @@ async function findSourceFiles(dir) {
6427
6416
  const out = [];
6428
6417
  async function walk(currentDir) {
6429
6418
  if (!await pathExists2(currentDir)) return;
6430
- const entries = await fs8.readdir(currentDir, { withFileTypes: true });
6419
+ const entries = await fs7.readdir(currentDir, { withFileTypes: true });
6431
6420
  for (const entry of entries) {
6432
6421
  const fullPath = path6__default.join(currentDir, entry.name);
6433
6422
  if (entry.isDirectory()) {
@@ -6493,12 +6482,12 @@ async function runMigrateCli(rawArgs) {
6493
6482
  report.configWrites += await migrateConfig(root, dryRun);
6494
6483
  }
6495
6484
  for (const filePath of files) {
6496
- const source = await fs8.readFile(filePath, "utf8");
6485
+ const source = await fs7.readFile(filePath, "utf8");
6497
6486
  const migrated = migrateSource(source, { includeImports, includeClasses });
6498
6487
  if (migrated.output !== source) {
6499
6488
  report.updatedFiles++;
6500
6489
  if (!dryRun) {
6501
- await fs8.writeFile(filePath, migrated.output, "utf8");
6490
+ await fs7.writeFile(filePath, migrated.output, "utf8");
6502
6491
  }
6503
6492
  }
6504
6493
  report.classRenames += migrated.classRenames;
@@ -6564,8 +6553,8 @@ function buildClassNames(files, uniqueClasses) {
6564
6553
  function writeScanCache(root, cacheData) {
6565
6554
  const cacheDir = path6__default.join(root, ".tailwind-styled");
6566
6555
  const cachePath = path6__default.join(cacheDir, "scan-cache.json");
6567
- fs12__default.mkdirSync(cacheDir, { recursive: true });
6568
- fs12__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6556
+ fs11__default.mkdirSync(cacheDir, { recursive: true });
6557
+ fs11__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6569
6558
  return cachePath;
6570
6559
  }
6571
6560
  async function runScanCli(rawArgs) {
@@ -6739,26 +6728,62 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
6739
6728
  return `${ups}/.next/tw-classes/**`;
6740
6729
  }
6741
6730
  }
6731
+ function computeStateStaticImportPath(cssFilePath, cwd2) {
6732
+ try {
6733
+ const nodePath = __require("path");
6734
+ const cssAbs = nodePath.resolve(cwd2, cssFilePath);
6735
+ const cssDir = nodePath.dirname(cssAbs);
6736
+ const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
6737
+ const rel = nodePath.relative(cssDir, stateStaticAbs).replace(/\\/g, "/");
6738
+ return rel.startsWith(".") ? rel : `./${rel}`;
6739
+ } catch {
6740
+ const depth = cssFilePath.split("/").length - 1;
6741
+ const ups = Array(depth).fill("..").join("/");
6742
+ return `${ups}/.next/_tw-state-static.css`;
6743
+ }
6744
+ }
6742
6745
  function patchTailwindCssImpl(src, bundler, cssFilePath, cwd2) {
6743
6746
  const hasTailwindImport = src.includes('@import "tailwindcss"') || src.includes("@import 'tailwindcss'");
6744
- const hasSafelistSource2 = src.includes("tailwind-styled-safelist.css");
6747
+ const hasSafelistSource2 = src.includes("tw-classes");
6748
+ const hasStateImport = src.includes("_tw-state-static.css");
6745
6749
  const needsSafelistSource = bundler === "next" && !hasSafelistSource2;
6746
- const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tailwind-styled-safelist.css";
6750
+ const needsStateImport = bundler === "next" && !hasStateImport;
6751
+ const safelistRelPath = needsSafelistSource && cssFilePath && cwd2 ? computeSafelistSourcePath(cssFilePath, cwd2) : "../.next/tw-classes/**";
6752
+ const stateImportRelPath = needsStateImport && cssFilePath && cwd2 ? computeStateStaticImportPath(cssFilePath, cwd2) : "../.next/_tw-state-static.css";
6747
6753
  const safelistSource = `@source "${safelistRelPath}";`;
6754
+ const stateImport = `@import "${stateImportRelPath}";`;
6748
6755
  if (hasTailwindImport) {
6749
- if (!needsSafelistSource) return null;
6750
- const patched = src.replace(
6751
- /(@import\s+['"]tailwindcss['"];?)/,
6752
- `$1
6756
+ if (!needsSafelistSource && !needsStateImport) return null;
6757
+ let patched = src;
6758
+ if (needsSafelistSource) {
6759
+ patched = patched.replace(
6760
+ /(@import\s+['"]tailwindcss['"];?)/,
6761
+ `$1
6753
6762
  ${safelistSource}`
6754
- );
6763
+ );
6764
+ }
6765
+ if (needsStateImport) {
6766
+ if (patched.includes("tw-classes")) {
6767
+ patched = patched.replace(
6768
+ /(@source\s+["'][^"']+["'];?)/,
6769
+ `$1
6770
+ ${stateImport}`
6771
+ );
6772
+ } else {
6773
+ patched = patched.replace(
6774
+ /(@import\s+['"]tailwindcss['"];?)/,
6775
+ `$1
6776
+ ${stateImport}`
6777
+ );
6778
+ }
6779
+ }
6755
6780
  return patched === src ? null : patched;
6756
6781
  }
6757
- const base = `@import "tailwindcss";
6758
- ${needsSafelistSource ? `${safelistSource}
6759
- ` : ""}
6760
- ${src}`;
6761
- return base;
6782
+ const lines = [`@import "tailwindcss";`];
6783
+ if (needsSafelistSource) lines.push(safelistSource);
6784
+ if (needsStateImport) lines.push(stateImport);
6785
+ lines.push("", src);
6786
+ return lines.join("\n");
6762
6787
  }
6763
6788
  function patchTsConfigImpl(src) {
6764
6789
  try {
@@ -7560,7 +7585,7 @@ async function loadRegistry(context) {
7560
7585
  if (!registryPath) {
7561
7586
  throw new CliUsageError("Plugin registry file not found.");
7562
7587
  }
7563
- const raw = await fs8.readFile(registryPath, "utf8");
7588
+ const raw = await fs7.readFile(registryPath, "utf8");
7564
7589
  const data = JSON.parse(raw);
7565
7590
  return [
7566
7591
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7695,8 +7720,8 @@ var deployCommand = {
7695
7720
  return;
7696
7721
  }
7697
7722
  const cacheDir = path6__default.join(process.cwd(), ".tw-cache");
7698
- await fs8.mkdir(cacheDir, { recursive: true });
7699
- await fs8.writeFile(
7723
+ await fs7.mkdir(cacheDir, { recursive: true });
7724
+ await fs7.writeFile(
7700
7725
  path6__default.join(cacheDir, "deploy-manifest.json"),
7701
7726
  JSON.stringify(manifest, null, 2)
7702
7727
  );
@@ -7797,22 +7822,27 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7797
7822
  issues.push({ severity, type, message, suggestion, location });
7798
7823
  }
7799
7824
  function readJsonFile(filePath) {
7800
- if (!fs12__default.existsSync(filePath)) return null;
7825
+ if (!fs11__default.existsSync(filePath)) return null;
7801
7826
  try {
7802
- return JSON.parse(fs12__default.readFileSync(filePath, "utf8"));
7803
- } catch {
7827
+ return JSON.parse(fs11__default.readFileSync(filePath, "utf8"));
7828
+ } catch (parseErr) {
7829
+ if (process.env.TWS_DEBUG === "1") {
7830
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
7831
+ process.stderr.write(`[tw:doctor] malformed JSON: ${filePath} \u2014 ${msg}
7832
+ `);
7833
+ }
7804
7834
  return null;
7805
7835
  }
7806
7836
  }
7807
7837
  function findWorkspacePackageJsonFiles(root) {
7808
7838
  const packagesDir = path6__default.join(root, "packages");
7809
- if (!fs12__default.existsSync(packagesDir)) return [];
7810
- return fs12__default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs12__default.existsSync(filePath));
7839
+ if (!fs11__default.existsSync(packagesDir)) return [];
7840
+ return fs11__default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11__default.existsSync(filePath));
7811
7841
  }
7812
7842
  function findFiles(dir, ext) {
7813
7843
  const files = [];
7814
7844
  try {
7815
- const entries = fs12__default.readdirSync(dir, { withFileTypes: true });
7845
+ const entries = fs11__default.readdirSync(dir, { withFileTypes: true });
7816
7846
  for (const entry of entries) {
7817
7847
  const fullPath = path6__default.join(dir, entry.name);
7818
7848
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7821,7 +7851,12 @@ function findFiles(dir, ext) {
7821
7851
  files.push(fullPath);
7822
7852
  }
7823
7853
  }
7824
- } catch {
7854
+ } catch (dirErr) {
7855
+ if (process.env.TWS_DEBUG === "1") {
7856
+ const msg = dirErr instanceof Error ? dirErr.message : String(dirErr);
7857
+ process.stderr.write(`[tw:doctor] findFiles error in ${dir}: ${msg}
7858
+ `);
7859
+ }
7825
7860
  return files;
7826
7861
  }
7827
7862
  return files;
@@ -7974,7 +8009,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7974
8009
  const cssFiles = findFiles(root, ".css");
7975
8010
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
7976
8011
  try {
7977
- const content = fs12__default.readFileSync(filePath, "utf8");
8012
+ const content = fs11__default.readFileSync(filePath, "utf8");
7978
8013
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
7979
8014
  } catch {
7980
8015
  return false;
@@ -7998,7 +8033,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7998
8033
  );
7999
8034
  }
8000
8035
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
8001
- const hasConfig = configFiles.some((name) => fs12__default.existsSync(path6__default.join(root, name)));
8036
+ const hasConfig = configFiles.some((name) => fs11__default.existsSync(path6__default.join(root, name)));
8002
8037
  addCheck(
8003
8038
  checks,
8004
8039
  "tailwind",
@@ -9283,19 +9318,8 @@ var syncCommand = {
9283
9318
  var import_picocolors5 = __toESM(require_picocolors());
9284
9319
  init_errors();
9285
9320
 
9286
- // packages/domain/compiler/src/index.ts
9287
- init_nativeBridge();
9288
- var compileCssFromClasses = (classes, prefix) => {
9289
- const native = getNativeBridge();
9290
- if (!native?.transformSource) {
9291
- throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
9292
- }
9293
- const result = native.transformSource(classes.join(" "), { prefix: prefix });
9294
- if (!result) {
9295
- throw new Error("FATAL: transformSource returned null");
9296
- }
9297
- return result;
9298
- };
9321
+ // packages/infrastructure/cli/src/utils/traceService.ts
9322
+ init_internal();
9299
9323
 
9300
9324
  // packages/domain/engine/src/native-bridge.ts
9301
9325
  init_src();
@@ -9746,37 +9770,33 @@ var CascadeResolutionId = class {
9746
9770
  return `R${this.value}`;
9747
9771
  }
9748
9772
  };
9749
- var _propertyNamesFallback = /* @__PURE__ */ new Map();
9750
- var _valueNamesFallback = /* @__PURE__ */ new Map();
9751
9773
  function registerPropertyName(id, name) {
9752
9774
  const native = getNativeEngineBinding();
9753
- if (native?.registerPropertyName) {
9754
- native.registerPropertyName(id.value, name);
9755
- return;
9775
+ if (!native?.registerPropertyName) {
9776
+ throw new Error("FATAL: Native binding 'registerPropertyName' is required but not available.");
9756
9777
  }
9757
- _propertyNamesFallback.set(id.value, name);
9778
+ native.registerPropertyName(id.value, name);
9758
9779
  }
9759
9780
  function registerValueName(id, name) {
9760
9781
  const native = getNativeEngineBinding();
9761
- if (native?.registerValueName) {
9762
- native.registerValueName(id.value, name);
9763
- return;
9782
+ if (!native?.registerValueName) {
9783
+ throw new Error("FATAL: Native binding 'registerValueName' is required but not available.");
9764
9784
  }
9765
- _valueNamesFallback.set(id.value, name);
9785
+ native.registerValueName(id.value, name);
9766
9786
  }
9767
9787
  function propertyIdToString(id) {
9768
9788
  const native = getNativeEngineBinding();
9769
- if (native?.propertyIdToString) {
9770
- return native.propertyIdToString(id.value);
9789
+ if (!native?.propertyIdToString) {
9790
+ throw new Error("FATAL: Native binding 'propertyIdToString' is required but not available.");
9771
9791
  }
9772
- return _propertyNamesFallback.get(id.value) ?? `P${id.value}`;
9792
+ return native.propertyIdToString(id.value);
9773
9793
  }
9774
9794
  function valueIdToString(id) {
9775
9795
  const native = getNativeEngineBinding();
9776
- if (native?.valueIdToString) {
9777
- return native.valueIdToString(id.value);
9796
+ if (!native?.valueIdToString) {
9797
+ throw new Error("FATAL: Native binding 'valueIdToString' is required but not available.");
9778
9798
  }
9779
- return _valueNamesFallback.get(id.value) ?? `V${id.value}`;
9799
+ return native.valueIdToString(id.value);
9780
9800
  }
9781
9801
  var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9782
9802
  CascadeStage2[CascadeStage2["Origin"] = 0] = "Origin";
@@ -9786,19 +9806,12 @@ var CascadeStage = /* @__PURE__ */ ((CascadeStage2) => {
9786
9806
  CascadeStage2[CascadeStage2["Order"] = 4] = "Order";
9787
9807
  return CascadeStage2;
9788
9808
  })(CascadeStage || {});
9789
- function createFingerprintFallback(parts) {
9790
- const hash = parts.reduce(
9791
- (acc, part) => part.split("").reduce((h, char) => (h << 5) - h + char.charCodeAt(0) & h, acc),
9792
- 0
9793
- );
9794
- return Math.abs(hash).toString(36);
9795
- }
9796
9809
  function createFingerprint(parts) {
9797
9810
  const native = getNativeEngineBinding();
9798
- if (native?.createFingerprint) {
9799
- return native.createFingerprint(parts);
9811
+ if (!native?.createFingerprint) {
9812
+ throw new Error("FATAL: Native binding 'createFingerprint' is required but not available.");
9800
9813
  }
9801
- return createFingerprintFallback(parts);
9814
+ return native.createFingerprint(parts);
9802
9815
  }
9803
9816
 
9804
9817
  // packages/domain/engine/src/reverseLookup.ts
@@ -10060,14 +10073,68 @@ function detectLayerFromClassName(className) {
10060
10073
  return null;
10061
10074
  }
10062
10075
  function parseCssToIr(css, options = {}) {
10063
- resetIdGenerator();
10076
+ const native = getNativeEngineBinding();
10077
+ const prefix = options.prefix ?? "";
10078
+ if (native?.assembleCssIr) {
10079
+ return _parseCssToIrFast(native.assembleCssIr(css, prefix || null));
10080
+ }
10081
+ return _parseCssToIrFallback(css, prefix, native);
10082
+ }
10083
+ function _parseCssToIrFast(assembled) {
10084
+ const native = getNativeEngineBinding();
10064
10085
  layerMap.clear();
10065
10086
  layerOrderMap.clear();
10066
- const native = getNativeEngineBinding();
10087
+ for (const le of assembled.layers) {
10088
+ const lid = new LayerId(le.layerId);
10089
+ layerMap.set(le.name, lid);
10090
+ layerOrderMap.set(le.name, le.order);
10091
+ }
10092
+ const rules = assembled.rules.map((r) => {
10093
+ const propertyId = new PropertyId(r.propertyId);
10094
+ const valueId = new ValueId(r.valueId);
10095
+ if (native?.registerPropertyName) {
10096
+ native.registerPropertyName(r.propertyId, r.propertyName);
10097
+ } else {
10098
+ registerPropertyName(propertyId, r.propertyName);
10099
+ }
10100
+ if (native?.registerValueName) {
10101
+ native.registerValueName(r.valueId, r.valueName);
10102
+ } else {
10103
+ registerValueName(valueId, r.valueName);
10104
+ }
10105
+ return {
10106
+ id: new RuleId(r.ruleId),
10107
+ selector: new SelectorId(r.selectorId),
10108
+ variantChain: new VariantChainId(0),
10109
+ property: propertyId,
10110
+ value: valueId,
10111
+ origin: r.origin,
10112
+ importance: r.importance,
10113
+ layer: r.layerId >= 0 ? new LayerId(r.layerId) : null,
10114
+ layerOrder: r.layerOrder,
10115
+ specificity: r.specificity,
10116
+ condition: r.conditionId >= 0 ? new ConditionId(r.conditionId) : null,
10117
+ conditionResult: r.conditionResult,
10118
+ insertionOrder: r.insertionOrder,
10119
+ fingerprint: r.fingerprint,
10120
+ source: { file: "", line: 1, column: 1 }
10121
+ };
10122
+ });
10123
+ const classToRuleIds = new Map(
10124
+ assembled.classToRuleIds.map((m) => [
10125
+ m.className,
10126
+ m.ruleIds.map((id) => new RuleId(id))
10127
+ ])
10128
+ );
10129
+ return { rules, classToRuleIds };
10130
+ }
10131
+ function _parseCssToIrFallback(css, prefix, native) {
10067
10132
  if (!native?.parseCssRules) {
10068
10133
  throw new Error("FATAL: Native binding 'parseCssRules' is required but not available.");
10069
10134
  }
10070
- const prefix = options.prefix ?? "";
10135
+ resetIdGenerator();
10136
+ layerMap.clear();
10137
+ layerOrderMap.clear();
10071
10138
  const rules = [];
10072
10139
  const classToRuleIds = /* @__PURE__ */ new Map();
10073
10140
  const parsed = native.parseCssRules(css);
@@ -10082,7 +10149,7 @@ function parseCssToIr(css, options = {}) {
10082
10149
  const valueId = generateValueId(r.value);
10083
10150
  const hasMedia = r.variants.some((v) => v.startsWith("@") || v === "dark" || v === "print");
10084
10151
  const conditionId = hasMedia ? generateConditionId() : null;
10085
- const conditionResult = hasMedia ? 2 /* Unknown */ : 2 /* Unknown */;
10152
+ const conditionResult = 2 /* Unknown */;
10086
10153
  const ruleId = generateRuleId();
10087
10154
  const fingerprint = createFingerprint([className, r.property, r.value]);
10088
10155
  const rule = {
@@ -10096,7 +10163,6 @@ function parseCssToIr(css, options = {}) {
10096
10163
  layer,
10097
10164
  layerOrder,
10098
10165
  specificity: r.specificity,
10099
- // from native — no JS recalculation
10100
10166
  condition: conditionId,
10101
10167
  conditionResult,
10102
10168
  insertionOrder: getNextInsertionOrder(),
@@ -10322,6 +10388,9 @@ async function traceClass(className, options) {
10322
10388
  };
10323
10389
  return result;
10324
10390
  }
10391
+
10392
+ // packages/infrastructure/cli/src/utils/traceTargetService.ts
10393
+ init_internal();
10325
10394
  init_src2();
10326
10395
  function toRelativePath(root, value) {
10327
10396
  const relative = path6__default.relative(root, value);
@@ -10393,7 +10462,7 @@ function tryCompileClasses(classes) {
10393
10462
  }
10394
10463
  }
10395
10464
  function traceSingleFile(filePath, root) {
10396
- const source = fs12__default.readFileSync(filePath, "utf8");
10465
+ const source = fs11__default.readFileSync(filePath, "utf8");
10397
10466
  const classes = uniqueSorted(scanSource(source));
10398
10467
  const imports = extractImports(source);
10399
10468
  const compiled = tryCompileClasses(classes);
@@ -10423,8 +10492,8 @@ function traceDirectory(targetDir, root) {
10423
10492
  });
10424
10493
  const imports = [];
10425
10494
  const importKeys = /* @__PURE__ */ new Set();
10426
- const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10427
- const source = fs12__default.readFileSync(entry.file, "utf8");
10495
+ const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10496
+ const source = fs11__default.readFileSync(entry.file, "utf8");
10428
10497
  const fileImports = extractImports(source);
10429
10498
  for (const fileImport of fileImports) {
10430
10499
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10457,10 +10526,10 @@ function traceDirectory(targetDir, root) {
10457
10526
  async function traceTarget(target, options = {}) {
10458
10527
  const root = path6__default.resolve(options.root ?? process.cwd());
10459
10528
  const resolvedTarget = path6__default.resolve(root, target);
10460
- if (!fs12__default.existsSync(resolvedTarget)) {
10529
+ if (!fs11__default.existsSync(resolvedTarget)) {
10461
10530
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10462
10531
  }
10463
- const stat = fs12__default.statSync(resolvedTarget);
10532
+ const stat = fs11__default.statSync(resolvedTarget);
10464
10533
  if (stat.isDirectory()) {
10465
10534
  return traceDirectory(resolvedTarget, root);
10466
10535
  }
@@ -10666,10 +10735,10 @@ async function runGenerateTypesCli(rawArgs) {
10666
10735
  output.writeText("");
10667
10736
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10668
10737
  const outDir = path6__default.dirname(outPath);
10669
- if (!fs12__default.existsSync(outDir)) {
10670
- fs12__default.mkdirSync(outDir, { recursive: true });
10738
+ if (!fs11__default.existsSync(outDir)) {
10739
+ fs11__default.mkdirSync(outDir, { recursive: true });
10671
10740
  }
10672
- fs12__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10741
+ fs11__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10673
10742
  logger.ok(path6__default.relative(cwd2, outPath));
10674
10743
  output.writeText("");
10675
10744
  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"));
@@ -10685,7 +10754,7 @@ async function loadNativeBinding2(cwd2) {
10685
10754
  path6__default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10686
10755
  ];
10687
10756
  for (const candidate of candidates) {
10688
- if (fs12__default.existsSync(candidate)) {
10757
+ if (fs11__default.existsSync(candidate)) {
10689
10758
  try {
10690
10759
  return __require(candidate);
10691
10760
  } catch {
@@ -10697,6 +10766,9 @@ async function loadNativeBinding2(cwd2) {
10697
10766
 
10698
10767
  // packages/infrastructure/cli/src/commands/why.ts
10699
10768
  init_errors();
10769
+
10770
+ // packages/infrastructure/cli/src/utils/whyService.ts
10771
+ init_internal();
10700
10772
  init_src2();
10701
10773
  function extractVariantChain(usage) {
10702
10774
  const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
@@ -10744,7 +10816,7 @@ async function whyClass(className, options) {
10744
10816
  for (const file of scanResult.files) {
10745
10817
  const source = (() => {
10746
10818
  try {
10747
- return fs12__default.readFileSync(file.file, "utf8");
10819
+ return fs11__default.readFileSync(file.file, "utf8");
10748
10820
  } catch {
10749
10821
  return "";
10750
10822
  }