tailwind-styled-v4 5.0.10 → 5.0.11

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 (93) hide show
  1. package/README.md +245 -373
  2. package/dist/analyzer.js +75 -22
  3. package/dist/analyzer.js.map +1 -1
  4. package/dist/analyzer.mjs +74 -21
  5. package/dist/analyzer.mjs.map +1 -1
  6. package/dist/animate.js +4 -2
  7. package/dist/animate.js.map +1 -1
  8. package/dist/animate.mjs +4 -2
  9. package/dist/animate.mjs.map +1 -1
  10. package/dist/atomic.js +20 -5
  11. package/dist/atomic.js.map +1 -1
  12. package/dist/atomic.mjs +20 -5
  13. package/dist/atomic.mjs.map +1 -1
  14. package/dist/cli.js +174 -67
  15. package/dist/cli.js.map +1 -1
  16. package/dist/cli.mjs +171 -64
  17. package/dist/cli.mjs.map +1 -1
  18. package/dist/compiler.d.mts +7 -1
  19. package/dist/compiler.d.ts +7 -1
  20. package/dist/compiler.js +53 -27
  21. package/dist/compiler.js.map +1 -1
  22. package/dist/compiler.mjs +53 -27
  23. package/dist/compiler.mjs.map +1 -1
  24. package/dist/devtools.js.map +1 -1
  25. package/dist/devtools.mjs.map +1 -1
  26. package/dist/engine.js +159 -61
  27. package/dist/engine.js.map +1 -1
  28. package/dist/engine.mjs +159 -61
  29. package/dist/engine.mjs.map +1 -1
  30. package/dist/index.browser.mjs +1512 -0
  31. package/dist/index.browser.mjs.map +1 -0
  32. package/dist/index.d.mts +94 -12
  33. package/dist/index.d.ts +94 -12
  34. package/dist/index.js +436 -106
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +436 -106
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/next.js +1946 -47
  39. package/dist/next.js.map +1 -1
  40. package/dist/next.mjs +1929 -44
  41. package/dist/next.mjs.map +1 -1
  42. package/dist/plugin-api.js.map +1 -1
  43. package/dist/plugin-api.mjs.map +1 -1
  44. package/dist/plugin-registry.js +23 -10
  45. package/dist/plugin-registry.js.map +1 -1
  46. package/dist/plugin-registry.mjs +23 -11
  47. package/dist/plugin-registry.mjs.map +1 -1
  48. package/dist/plugin.js.map +1 -1
  49. package/dist/plugin.mjs.map +1 -1
  50. package/dist/rspack.js.map +1 -1
  51. package/dist/rspack.mjs.map +1 -1
  52. package/dist/scanner.js +72 -19
  53. package/dist/scanner.js.map +1 -1
  54. package/dist/scanner.mjs +71 -18
  55. package/dist/scanner.mjs.map +1 -1
  56. package/dist/shared.js +32 -15
  57. package/dist/shared.js.map +1 -1
  58. package/dist/shared.mjs +32 -15
  59. package/dist/shared.mjs.map +1 -1
  60. package/dist/svelte.js +38 -12
  61. package/dist/svelte.js.map +1 -1
  62. package/dist/svelte.mjs +38 -12
  63. package/dist/svelte.mjs.map +1 -1
  64. package/dist/syntax.js +17 -5
  65. package/dist/syntax.js.map +1 -1
  66. package/dist/syntax.mjs +17 -5
  67. package/dist/syntax.mjs.map +1 -1
  68. package/dist/theme.js +4 -2
  69. package/dist/theme.js.map +1 -1
  70. package/dist/theme.mjs +4 -2
  71. package/dist/theme.mjs.map +1 -1
  72. package/dist/turbopackLoader.js +87 -33
  73. package/dist/turbopackLoader.js.map +1 -1
  74. package/dist/turbopackLoader.mjs +87 -33
  75. package/dist/turbopackLoader.mjs.map +1 -1
  76. package/dist/tw.js +174 -67
  77. package/dist/tw.js.map +1 -1
  78. package/dist/tw.mjs +171 -64
  79. package/dist/tw.mjs.map +1 -1
  80. package/dist/vite.js +145 -63
  81. package/dist/vite.js.map +1 -1
  82. package/dist/vite.mjs +145 -63
  83. package/dist/vite.mjs.map +1 -1
  84. package/dist/vue.js +38 -12
  85. package/dist/vue.js.map +1 -1
  86. package/dist/vue.mjs +38 -12
  87. package/dist/vue.mjs.map +1 -1
  88. package/dist/webpackLoader.js +20 -5
  89. package/dist/webpackLoader.js.map +1 -1
  90. package/dist/webpackLoader.mjs +20 -5
  91. package/dist/webpackLoader.mjs.map +1 -1
  92. package/native/tailwind-styled-native.node +0 -0
  93. package/package.json +29 -24
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var module$1 = require('module');
4
- var fs11 = require('fs');
4
+ var fs12 = require('fs');
5
5
  var path6 = require('path');
6
6
  require('crypto');
7
7
  var url = require('url');
8
8
  var worker_threads = require('worker_threads');
9
9
  var os = require('os');
10
10
  var zod = require('zod');
11
- var fs7 = require('fs/promises');
11
+ var fs8 = require('fs/promises');
12
12
  var prompts = require('@clack/prompts');
13
13
  var util = require('util');
14
14
  var child_process = require('child_process');
@@ -34,9 +34,9 @@ function _interopNamespace(e) {
34
34
  return Object.freeze(n);
35
35
  }
36
36
 
37
- var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
37
+ var fs12__namespace = /*#__PURE__*/_interopNamespace(fs12);
38
38
  var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
39
- var fs7__default = /*#__PURE__*/_interopDefault(fs7);
39
+ var fs8__default = /*#__PURE__*/_interopDefault(fs8);
40
40
 
41
41
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
42
42
  var __create = Object.create;
@@ -1013,7 +1013,7 @@ var require_command = __commonJS({
1013
1013
  var EventEmitter = __require("events").EventEmitter;
1014
1014
  var childProcess = __require("child_process");
1015
1015
  var path29 = __require("path");
1016
- var fs15 = __require("fs");
1016
+ var fs16 = __require("fs");
1017
1017
  var process2 = __require("process");
1018
1018
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1019
1019
  var { CommanderError: CommanderError2 } = require_error();
@@ -1945,10 +1945,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1945
1945
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1946
1946
  function findFile(baseDir, baseName) {
1947
1947
  const localBin = path29.resolve(baseDir, baseName);
1948
- if (fs15.existsSync(localBin)) return localBin;
1948
+ if (fs16.existsSync(localBin)) return localBin;
1949
1949
  if (sourceExt.includes(path29.extname(baseName))) return void 0;
1950
1950
  const foundExt = sourceExt.find(
1951
- (ext) => fs15.existsSync(`${localBin}${ext}`)
1951
+ (ext) => fs16.existsSync(`${localBin}${ext}`)
1952
1952
  );
1953
1953
  if (foundExt) return `${localBin}${foundExt}`;
1954
1954
  return void 0;
@@ -1960,7 +1960,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1960
1960
  if (this._scriptPath) {
1961
1961
  let resolvedScriptPath;
1962
1962
  try {
1963
- resolvedScriptPath = fs15.realpathSync(this._scriptPath);
1963
+ resolvedScriptPath = fs16.realpathSync(this._scriptPath);
1964
1964
  } catch (err) {
1965
1965
  resolvedScriptPath = this._scriptPath;
1966
1966
  }
@@ -3196,7 +3196,7 @@ function resolveNativeBinary(runtimeDir) {
3196
3196
  }
3197
3197
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3198
3198
  if (envPath) {
3199
- if (fs11__namespace.existsSync(envPath)) {
3199
+ if (fs12__namespace.existsSync(envPath)) {
3200
3200
  return { path: envPath, source: "env", platform, tried };
3201
3201
  }
3202
3202
  tried.push(`env:${envPath} (not found)`);
@@ -3205,7 +3205,7 @@ function resolveNativeBinary(runtimeDir) {
3205
3205
  for (const pkg of prebuiltPkgs) {
3206
3206
  try {
3207
3207
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
3208
- if (fs11__namespace.existsSync(candidate)) {
3208
+ if (fs12__namespace.existsSync(candidate)) {
3209
3209
  return { path: candidate, source: "prebuilt", platform, tried };
3210
3210
  }
3211
3211
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3213,9 +3213,24 @@ function resolveNativeBinary(runtimeDir) {
3213
3213
  tried.push(`prebuilt:${pkg} (not installed)`);
3214
3214
  }
3215
3215
  }
3216
+ const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
3217
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
3218
+ if (runtimeDir) {
3219
+ for (const depth of ["..", path6__namespace.join("..", ".."), path6__namespace.join("..", "..", "..")]) {
3220
+ const pkgRoot = path6__namespace.resolve(runtimeDir, depth);
3221
+ for (const bin of BINARY_NAMES_SELF) {
3222
+ for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3223
+ const candidate = path6__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3224
+ tried.push(`self-bundled:${candidate}`);
3225
+ if (fs12__namespace.existsSync(candidate)) {
3226
+ return { path: candidate, source: "prebuilt", platform, tried };
3227
+ }
3228
+ }
3229
+ }
3230
+ }
3231
+ }
3216
3232
  const cwd2 = process.cwd();
3217
3233
  const base = runtimeDir ?? cwd2;
3218
- const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
3219
3234
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3220
3235
  const localCandidates = [];
3221
3236
  for (const bin of BINARY_NAMES) {
@@ -3241,7 +3256,7 @@ function resolveNativeBinary(runtimeDir) {
3241
3256
  }
3242
3257
  for (const candidate of localCandidates) {
3243
3258
  tried.push(`local:${candidate}`);
3244
- if (fs11__namespace.existsSync(candidate)) {
3259
+ if (fs12__namespace.existsSync(candidate)) {
3245
3260
  return { path: candidate, source: "local", platform, tried };
3246
3261
  }
3247
3262
  }
@@ -3253,12 +3268,12 @@ var init_native_resolution = __esm({
3253
3268
  isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
3254
3269
  _require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
3255
3270
  PLATFORM_MAP = {
3256
- "linux-x64": ["@tailwind-styled/native-linux-x64"],
3257
- "linux-arm64": ["@tailwind-styled/native-linux-arm64"],
3271
+ "linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
3272
+ "linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
3258
3273
  "darwin-x64": ["@tailwind-styled/native-darwin-x64"],
3259
3274
  "darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
3260
- "win32-x64": ["@tailwind-styled/native-win32-x64"],
3261
- "win32-arm64": ["@tailwind-styled/native-win32-arm64"]
3275
+ "win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
3276
+ "win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
3262
3277
  };
3263
3278
  }
3264
3279
  });
@@ -3306,7 +3321,7 @@ function loadNativeBinding(options) {
3306
3321
  for (const candidate of candidates) {
3307
3322
  const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
3308
3323
  try {
3309
- if (!fs11__namespace.default.existsSync(candidatePath) && !fs11__namespace.default.existsSync(candidatePath + ".node")) {
3324
+ if (!fs12__namespace.default.existsSync(candidatePath) && !fs12__namespace.default.existsSync(candidatePath + ".node")) {
3310
3325
  continue;
3311
3326
  }
3312
3327
  const mod = requireNativeModule(candidatePath);
@@ -3338,9 +3353,9 @@ function resolveNativeBindingCandidates(options) {
3338
3353
  }
3339
3354
  }
3340
3355
  if (!includeDefaultCandidates) return candidates;
3341
- if (fs11__namespace.default.existsSync(runtimeDir)) {
3356
+ if (fs12__namespace.default.existsSync(runtimeDir)) {
3342
3357
  try {
3343
- for (const entry of fs11__namespace.default.readdirSync(runtimeDir)) {
3358
+ for (const entry of fs12__namespace.default.readdirSync(runtimeDir)) {
3344
3359
  if (entry.endsWith(".node")) candidates.push(entry);
3345
3360
  }
3346
3361
  } catch {
@@ -3351,11 +3366,13 @@ function resolveNativeBindingCandidates(options) {
3351
3366
  for (const bin of BINARY_NAMES) {
3352
3367
  candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.node`));
3353
3368
  candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3369
+ candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3370
+ candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3371
+ candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
3372
+ candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3354
3373
  candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3355
3374
  candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3356
3375
  candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3357
- candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
3358
- candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3359
3376
  }
3360
3377
  return Array.from(new Set(candidates));
3361
3378
  }
@@ -3440,8 +3457,10 @@ __export(native_bridge_exports, {
3440
3457
  extractClassesNative: () => extractClassesNative,
3441
3458
  generateSubComponentTypesNative: () => generateSubComponentTypesNative,
3442
3459
  hasNativeScannerBinding: () => hasNativeScannerBinding,
3460
+ hasNativeWatchBinding: () => hasNativeWatchBinding,
3443
3461
  hashContentNative: () => hashContentNative,
3444
3462
  isRustCacheAvailable: () => isRustCacheAvailable,
3463
+ pollWatchEventsNative: () => pollWatchEventsNative,
3445
3464
  pruneStaleEntriesNative: () => pruneStaleEntriesNative,
3446
3465
  rebuildWorkspaceResultNative: () => rebuildWorkspaceResultNative,
3447
3466
  resetScannerBridgeCache: () => resetScannerBridgeCache,
@@ -3451,7 +3470,9 @@ __export(native_bridge_exports, {
3451
3470
  scanCacheStats: () => scanCacheStats,
3452
3471
  scanFileNative: () => scanFileNative,
3453
3472
  scanFilesBatchNative: () => scanFilesBatchNative,
3454
- scanWorkspaceNative: () => scanWorkspaceNative
3473
+ scanWorkspaceNative: () => scanWorkspaceNative,
3474
+ startWatchNative: () => startWatchNative,
3475
+ stopWatchNative: () => stopWatchNative
3455
3476
  });
3456
3477
  function getDirname2() {
3457
3478
  if (typeof __dirname !== "undefined") {
@@ -3628,6 +3649,41 @@ function computeCacheStatsNative(filesClasses, sizes, top) {
3628
3649
  if (!binding.computeCacheStats) return null;
3629
3650
  return binding.computeCacheStats(filesClasses, sizes, top ?? null);
3630
3651
  }
3652
+ function startWatchNative(rootDir) {
3653
+ try {
3654
+ const binding = scannerGetBinding();
3655
+ if (!binding.startWatch) return null;
3656
+ return binding.startWatch(rootDir);
3657
+ } catch {
3658
+ return null;
3659
+ }
3660
+ }
3661
+ function pollWatchEventsNative(handleId) {
3662
+ try {
3663
+ const binding = scannerGetBinding();
3664
+ if (!binding.pollWatchEvents) return [];
3665
+ return binding.pollWatchEvents(handleId);
3666
+ } catch {
3667
+ return [];
3668
+ }
3669
+ }
3670
+ function stopWatchNative(handleId) {
3671
+ try {
3672
+ const binding = scannerGetBinding();
3673
+ if (!binding.stopWatch) return false;
3674
+ return binding.stopWatch(handleId);
3675
+ } catch {
3676
+ return false;
3677
+ }
3678
+ }
3679
+ function hasNativeWatchBinding() {
3680
+ try {
3681
+ const binding = scannerGetBinding();
3682
+ return !!(binding.startWatch && binding.pollWatchEvents && binding.stopWatch);
3683
+ } catch {
3684
+ return false;
3685
+ }
3686
+ }
3631
3687
  var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
3632
3688
  var init_native_bridge = __esm({
3633
3689
  "packages/domain/scanner/src/native-bridge.ts"() {
@@ -3717,6 +3773,7 @@ function defaultCachePath(rootDir, cacheDir) {
3717
3773
  }
3718
3774
  function readCache(rootDir, cacheDir) {
3719
3775
  const cachePath = defaultCachePath(rootDir, cacheDir);
3776
+ fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3720
3777
  const result = cacheReadNative(cachePath);
3721
3778
  if (!result) return [];
3722
3779
  return result.entries.map((e) => ({
@@ -3731,6 +3788,7 @@ function readCache(rootDir, cacheDir) {
3731
3788
  }
3732
3789
  function writeCache(rootDir, entries, cacheDir) {
3733
3790
  const cachePath = defaultCachePath(rootDir, cacheDir);
3791
+ fs12__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
3734
3792
  const success = cacheWriteNative(cachePath, entries);
3735
3793
  if (!success) {
3736
3794
  throw new Error(
@@ -3761,7 +3819,7 @@ function collectFiles(rootDir, extensions, ignoreDirs) {
3761
3819
  function walk(dir) {
3762
3820
  let entries;
3763
3821
  try {
3764
- entries = fs11__namespace.default.readdirSync(dir, { withFileTypes: true });
3822
+ entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
3765
3823
  } catch {
3766
3824
  return;
3767
3825
  }
@@ -3961,7 +4019,7 @@ function resolveScannerWorkerModulePath() {
3961
4019
  path6__namespace.default.resolve(runtimeDir, "worker.ts")
3962
4020
  ];
3963
4021
  for (const candidate of candidates) {
3964
- if (fs11__namespace.default.existsSync(candidate)) return candidate;
4022
+ if (fs12__namespace.default.existsSync(candidate)) return candidate;
3965
4023
  }
3966
4024
  return null;
3967
4025
  }
@@ -4018,7 +4076,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4018
4076
  if (!currentDir) continue;
4019
4077
  const entries = (() => {
4020
4078
  try {
4021
- return fs11__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4079
+ return fs12__namespace.default.readdirSync(currentDir, { withFileTypes: true });
4022
4080
  } catch {
4023
4081
  return [];
4024
4082
  }
@@ -4117,7 +4175,7 @@ function scanWorkspace(rootDir, options = {}) {
4117
4175
  for (const filePath of candidates) {
4118
4176
  const stat = (() => {
4119
4177
  try {
4120
- return fs11__namespace.default.statSync(filePath);
4178
+ return fs12__namespace.default.statSync(filePath);
4121
4179
  } catch {
4122
4180
  return null;
4123
4181
  }
@@ -4143,7 +4201,7 @@ function scanWorkspace(rootDir, options = {}) {
4143
4201
  for (const { filePath, stat, size, cached } of ranked) {
4144
4202
  const content = (() => {
4145
4203
  try {
4146
- return fs11__namespace.default.readFileSync(filePath, "utf8");
4204
+ return fs12__namespace.default.readFileSync(filePath, "utf8");
4147
4205
  } catch {
4148
4206
  return null;
4149
4207
  }
@@ -4248,21 +4306,31 @@ var init_src2 = __esm({
4248
4306
  if (_state.binding !== void 0) return _state.binding;
4249
4307
  const runtimeDir = getRuntimeDir();
4250
4308
  const req = module$1.createRequire(path6__namespace.default.join(runtimeDir, "noop.cjs"));
4309
+ const _platform = process.platform;
4310
+ const _arch = process.arch;
4311
+ const _platformArch = `${_platform}-${_arch}`;
4312
+ const _platformArchGnu = _platformArch === "linux-x64" ? "linux-x64-gnu" : _platformArch === "linux-arm64" ? "linux-arm64-gnu" : _platformArch;
4251
4313
  const candidates = [
4252
4314
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
4253
4315
  // cwd = repo root saat run dari root, atau package dir saat workspaces
4254
4316
  path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4255
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${process.platform}-${process.arch}.node`),
4256
- path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4257
- // runtimeDir = dist/ → naik 4 level ke repo root
4317
+ path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4318
+ path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4319
+ // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
4320
+ // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
4321
+ path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4322
+ path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4323
+ path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4324
+ // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
4258
4325
  path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4259
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4326
+ path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4260
4327
  // 3 level fallback (jika package di-nest lebih dangkal)
4261
4328
  path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4262
- path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4329
+ path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4263
4330
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
4264
4331
  path6__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4265
4332
  path6__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4333
+ path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4266
4334
  path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4267
4335
  path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4268
4336
  path6__namespace.default.resolve(
@@ -4277,7 +4345,7 @@ var init_src2 = __esm({
4277
4345
  )
4278
4346
  ];
4279
4347
  for (const fullPath of candidates) {
4280
- if (!fs11__namespace.default.existsSync(fullPath)) continue;
4348
+ if (!fs12__namespace.default.existsSync(fullPath)) continue;
4281
4349
  try {
4282
4350
  const required = req(fullPath);
4283
4351
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4319,7 +4387,7 @@ function isRecord(value) {
4319
4387
  }
4320
4388
  async function pathExists(filePath) {
4321
4389
  try {
4322
- await fs11__namespace.default.promises.access(filePath, fs11__namespace.default.constants.F_OK);
4390
+ await fs12__namespace.default.promises.access(filePath, fs12__namespace.default.constants.F_OK);
4323
4391
  return true;
4324
4392
  } catch {
4325
4393
  return false;
@@ -4667,7 +4735,7 @@ var init_semantic = __esm({
4667
4735
  return out;
4668
4736
  };
4669
4737
  collectSafelistFromSource = async (configPath) => {
4670
- const source = await fs11__namespace.default.promises.readFile(configPath, "utf8");
4738
+ const source = await fs12__namespace.default.promises.readFile(configPath, "utf8");
4671
4739
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4672
4740
  const allTokens = extractClassesNative2(source);
4673
4741
  const hasSafelist = source.includes("safelist");
@@ -4694,7 +4762,7 @@ var init_semantic = __esm({
4694
4762
  customUtilities: /* @__PURE__ */ new Set()
4695
4763
  };
4696
4764
  }
4697
- const configStat = await fs11__namespace.default.promises.stat(configPath).catch(() => null);
4765
+ const configStat = await fs12__namespace.default.promises.stat(configPath).catch(() => null);
4698
4766
  if (configStat) {
4699
4767
  const cached = tailwindConfigCache.get(configPath);
4700
4768
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5127,7 +5195,7 @@ var init_src3 = __esm({
5127
5195
  });
5128
5196
  async function pathExists2(filePath) {
5129
5197
  try {
5130
- await fs7__default.default.access(filePath);
5198
+ await fs8__default.default.access(filePath);
5131
5199
  return true;
5132
5200
  } catch {
5133
5201
  return false;
@@ -5135,7 +5203,7 @@ async function pathExists2(filePath) {
5135
5203
  }
5136
5204
  async function readFileSafe(filePath) {
5137
5205
  try {
5138
- return await fs7__default.default.readFile(filePath, "utf8");
5206
+ return await fs8__default.default.readFile(filePath, "utf8");
5139
5207
  } catch {
5140
5208
  return null;
5141
5209
  }
@@ -5154,8 +5222,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5154
5222
  options.onDryRun?.(`write ${filePath}`);
5155
5223
  return;
5156
5224
  }
5157
- await fs7__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5158
- await fs7__default.default.writeFile(filePath, content, "utf8");
5225
+ await fs8__default.default.mkdir(path6__namespace.default.dirname(filePath), { recursive: true });
5226
+ await fs8__default.default.writeFile(filePath, content, "utf8");
5159
5227
  }
5160
5228
  async function ensureFileSafe(filePath, content, options = {}) {
5161
5229
  if (await pathExists2(filePath)) return "skipped";
@@ -6301,7 +6369,8 @@ async function runInitCli(rawArgs) {
6301
6369
  `${JSON.stringify(
6302
6370
  {
6303
6371
  version: 1,
6304
- cssEntry: "src/tailwind.css"
6372
+ compiler: { engine: "rust" },
6373
+ css: { entry: "src/tailwind.css" }
6305
6374
  },
6306
6375
  null,
6307
6376
  2
@@ -6382,7 +6451,7 @@ async function findSourceFiles(dir) {
6382
6451
  const out = [];
6383
6452
  async function walk(currentDir) {
6384
6453
  if (!await pathExists2(currentDir)) return;
6385
- const entries = await fs7__default.default.readdir(currentDir, { withFileTypes: true });
6454
+ const entries = await fs8__default.default.readdir(currentDir, { withFileTypes: true });
6386
6455
  for (const entry of entries) {
6387
6456
  const fullPath = path6__namespace.default.join(currentDir, entry.name);
6388
6457
  if (entry.isDirectory()) {
@@ -6448,12 +6517,12 @@ async function runMigrateCli(rawArgs) {
6448
6517
  report.configWrites += await migrateConfig(root, dryRun);
6449
6518
  }
6450
6519
  for (const filePath of files) {
6451
- const source = await fs7__default.default.readFile(filePath, "utf8");
6520
+ const source = await fs8__default.default.readFile(filePath, "utf8");
6452
6521
  const migrated = migrateSource(source, { includeImports, includeClasses });
6453
6522
  if (migrated.output !== source) {
6454
6523
  report.updatedFiles++;
6455
6524
  if (!dryRun) {
6456
- await fs7__default.default.writeFile(filePath, migrated.output, "utf8");
6525
+ await fs8__default.default.writeFile(filePath, migrated.output, "utf8");
6457
6526
  }
6458
6527
  }
6459
6528
  report.classRenames += migrated.classRenames;
@@ -6519,8 +6588,8 @@ function buildClassNames(files, uniqueClasses) {
6519
6588
  function writeScanCache(root, cacheData) {
6520
6589
  const cacheDir = path6__namespace.default.join(root, ".tailwind-styled");
6521
6590
  const cachePath = path6__namespace.default.join(cacheDir, "scan-cache.json");
6522
- fs11__namespace.default.mkdirSync(cacheDir, { recursive: true });
6523
- fs11__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6591
+ fs12__namespace.default.mkdirSync(cacheDir, { recursive: true });
6592
+ fs12__namespace.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6524
6593
  return cachePath;
6525
6594
  }
6526
6595
  async function runScanCli(rawArgs) {
@@ -6990,6 +7059,14 @@ async function findExisting(cwd2, names) {
6990
7059
  }
6991
7060
  return null;
6992
7061
  }
7062
+ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger) {
7063
+ if (flags.isDryRun) {
7064
+ logger.dry(`create ${label}`);
7065
+ return;
7066
+ }
7067
+ await writeFileSafe(filePath, content);
7068
+ logger.ok(path6__namespace.default.relative(cwd2, filePath) || label);
7069
+ }
6993
7070
  async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
6994
7071
  const source = await readFileSafe(filePath);
6995
7072
  if (!source) return false;
@@ -7175,6 +7252,21 @@ var runSetupCli = async (rawArgs) => {
7175
7252
  setupFlags,
7176
7253
  logger
7177
7254
  );
7255
+ const detectedCssEntry = path6__namespace.default.relative(cwd, cssFile).replace(/\\/g, "/");
7256
+ const twConfigPath = path6__namespace.default.join(cwd, "tailwind-styled.config.json");
7257
+ const twConfig = {
7258
+ version: 1,
7259
+ compiler: { engine: "rust" },
7260
+ css: { entry: detectedCssEntry }
7261
+ };
7262
+ await writeFileWithDryRun(
7263
+ cwd,
7264
+ twConfigPath,
7265
+ JSON.stringify(twConfig, null, 2) + "\n",
7266
+ "tailwind-styled.config.json",
7267
+ setupFlags,
7268
+ logger
7269
+ );
7178
7270
  } else {
7179
7271
  logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
7180
7272
  }
@@ -7186,6 +7278,21 @@ var runSetupCli = async (rawArgs) => {
7186
7278
  } else {
7187
7279
  logger.skip("tsconfig.json tidak ditemukan \u2014 skip");
7188
7280
  }
7281
+ output.writeText("\n" + import_picocolors3.default.bold(" [+]") + import_picocolors3.default.cyan(" pre-warming scanner cache"));
7282
+ if (!setupFlags.isDryRun) {
7283
+ try {
7284
+ const { scanWorkspaceAsync: scanWorkspaceAsync2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
7285
+ const scanSpinner = output.spinner();
7286
+ scanSpinner.start("Scanning workspace...");
7287
+ const scanned = await scanWorkspaceAsync2(cwd, { useCache: true });
7288
+ scanSpinner.stop(`Scanned ${scanned.totalFiles} file(s), ${scanned.uniqueClasses.length} unique classes`);
7289
+ logger.ok(".cache/tailwind-styled/scanner-cache.json");
7290
+ } catch {
7291
+ logger.warn("Pre-warm cache gagal \u2014 tidak masalah, cache akan dibangun saat npm run dev");
7292
+ }
7293
+ } else {
7294
+ logger.dry("pre-warm scanner cache");
7295
+ }
7189
7296
  output.writeText("");
7190
7297
  output.writeText(import_picocolors3.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"));
7191
7298
  output.writeText(import_picocolors3.default.bold(import_picocolors3.default.green(" \u2713 setup selesai")));
@@ -7299,7 +7406,7 @@ async function runStatsCli(args) {
7299
7406
  init_runtime();
7300
7407
  function collectTsFiles(dir, extensions) {
7301
7408
  const files = [];
7302
- const entries = fs11.readdirSync(dir, { withFileTypes: true });
7409
+ const entries = fs12.readdirSync(dir, { withFileTypes: true });
7303
7410
  for (const entry of entries) {
7304
7411
  const full = path6.join(dir, entry.name);
7305
7412
  if (entry.isDirectory()) {
@@ -7382,7 +7489,7 @@ async function runBoundaryCli(args, context) {
7382
7489
  for (const file of files) {
7383
7490
  let source;
7384
7491
  try {
7385
- source = fs11.readFileSync(file, "utf8");
7492
+ source = fs12.readFileSync(file, "utf8");
7386
7493
  } catch {
7387
7494
  continue;
7388
7495
  }
@@ -7477,7 +7584,7 @@ async function loadRegistry(context) {
7477
7584
  if (!registryPath) {
7478
7585
  throw new CliUsageError("Plugin registry file not found.");
7479
7586
  }
7480
- const raw = await fs7__default.default.readFile(registryPath, "utf8");
7587
+ const raw = await fs8__default.default.readFile(registryPath, "utf8");
7481
7588
  const data = JSON.parse(raw);
7482
7589
  return [
7483
7590
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7612,8 +7719,8 @@ var deployCommand = {
7612
7719
  return;
7613
7720
  }
7614
7721
  const cacheDir = path6__namespace.default.join(process.cwd(), ".tw-cache");
7615
- await fs7__default.default.mkdir(cacheDir, { recursive: true });
7616
- await fs7__default.default.writeFile(
7722
+ await fs8__default.default.mkdir(cacheDir, { recursive: true });
7723
+ await fs8__default.default.writeFile(
7617
7724
  path6__namespace.default.join(cacheDir, "deploy-manifest.json"),
7618
7725
  JSON.stringify(manifest, null, 2)
7619
7726
  );
@@ -7714,22 +7821,22 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7714
7821
  issues.push({ severity, type, message, suggestion, location });
7715
7822
  }
7716
7823
  function readJsonFile(filePath) {
7717
- if (!fs11__namespace.default.existsSync(filePath)) return null;
7824
+ if (!fs12__namespace.default.existsSync(filePath)) return null;
7718
7825
  try {
7719
- return JSON.parse(fs11__namespace.default.readFileSync(filePath, "utf8"));
7826
+ return JSON.parse(fs12__namespace.default.readFileSync(filePath, "utf8"));
7720
7827
  } catch {
7721
7828
  return null;
7722
7829
  }
7723
7830
  }
7724
7831
  function findWorkspacePackageJsonFiles(root) {
7725
7832
  const packagesDir = path6__namespace.default.join(root, "packages");
7726
- if (!fs11__namespace.default.existsSync(packagesDir)) return [];
7727
- 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));
7833
+ if (!fs12__namespace.default.existsSync(packagesDir)) return [];
7834
+ return fs12__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path6__namespace.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs12__namespace.default.existsSync(filePath));
7728
7835
  }
7729
7836
  function findFiles(dir, ext) {
7730
7837
  const files = [];
7731
7838
  try {
7732
- const entries = fs11__namespace.default.readdirSync(dir, { withFileTypes: true });
7839
+ const entries = fs12__namespace.default.readdirSync(dir, { withFileTypes: true });
7733
7840
  for (const entry of entries) {
7734
7841
  const fullPath = path6__namespace.default.join(dir, entry.name);
7735
7842
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7891,7 +7998,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7891
7998
  const cssFiles = findFiles(root, ".css");
7892
7999
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
7893
8000
  try {
7894
- const content = fs11__namespace.default.readFileSync(filePath, "utf8");
8001
+ const content = fs12__namespace.default.readFileSync(filePath, "utf8");
7895
8002
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
7896
8003
  } catch {
7897
8004
  return false;
@@ -7915,7 +8022,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7915
8022
  );
7916
8023
  }
7917
8024
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
7918
- const hasConfig = configFiles.some((name) => fs11__namespace.default.existsSync(path6__namespace.default.join(root, name)));
8025
+ const hasConfig = configFiles.some((name) => fs12__namespace.default.existsSync(path6__namespace.default.join(root, name)));
7919
8026
  addCheck(
7920
8027
  checks,
7921
8028
  "tailwind",
@@ -10310,7 +10417,7 @@ function tryCompileClasses(classes) {
10310
10417
  }
10311
10418
  }
10312
10419
  function traceSingleFile(filePath, root) {
10313
- const source = fs11__namespace.default.readFileSync(filePath, "utf8");
10420
+ const source = fs12__namespace.default.readFileSync(filePath, "utf8");
10314
10421
  const classes = uniqueSorted(scanSource(source));
10315
10422
  const imports = extractImports(source);
10316
10423
  const compiled = tryCompileClasses(classes);
@@ -10341,7 +10448,7 @@ function traceDirectory(targetDir, root) {
10341
10448
  const imports = [];
10342
10449
  const importKeys = /* @__PURE__ */ new Set();
10343
10450
  const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10344
- const source = fs11__namespace.default.readFileSync(entry.file, "utf8");
10451
+ const source = fs12__namespace.default.readFileSync(entry.file, "utf8");
10345
10452
  const fileImports = extractImports(source);
10346
10453
  for (const fileImport of fileImports) {
10347
10454
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10374,10 +10481,10 @@ function traceDirectory(targetDir, root) {
10374
10481
  async function traceTarget(target, options = {}) {
10375
10482
  const root = path6__namespace.default.resolve(options.root ?? process.cwd());
10376
10483
  const resolvedTarget = path6__namespace.default.resolve(root, target);
10377
- if (!fs11__namespace.default.existsSync(resolvedTarget)) {
10484
+ if (!fs12__namespace.default.existsSync(resolvedTarget)) {
10378
10485
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10379
10486
  }
10380
- const stat = fs11__namespace.default.statSync(resolvedTarget);
10487
+ const stat = fs12__namespace.default.statSync(resolvedTarget);
10381
10488
  if (stat.isDirectory()) {
10382
10489
  return traceDirectory(resolvedTarget, root);
10383
10490
  }
@@ -10583,10 +10690,10 @@ async function runGenerateTypesCli(rawArgs) {
10583
10690
  output.writeText("");
10584
10691
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10585
10692
  const outDir = path6__namespace.default.dirname(outPath);
10586
- if (!fs11__namespace.default.existsSync(outDir)) {
10587
- fs11__namespace.default.mkdirSync(outDir, { recursive: true });
10693
+ if (!fs12__namespace.default.existsSync(outDir)) {
10694
+ fs12__namespace.default.mkdirSync(outDir, { recursive: true });
10588
10695
  }
10589
- fs11__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10696
+ fs12__namespace.default.writeFileSync(outPath, result.dtsContent, "utf-8");
10590
10697
  logger.ok(path6__namespace.default.relative(cwd2, outPath));
10591
10698
  output.writeText("");
10592
10699
  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"));
@@ -10602,7 +10709,7 @@ async function loadNativeBinding2(cwd2) {
10602
10709
  path6__namespace.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10603
10710
  ];
10604
10711
  for (const candidate of candidates) {
10605
- if (fs11__namespace.default.existsSync(candidate)) {
10712
+ if (fs12__namespace.default.existsSync(candidate)) {
10606
10713
  try {
10607
10714
  return __require(candidate);
10608
10715
  } catch {
@@ -10661,7 +10768,7 @@ async function whyClass(className, options) {
10661
10768
  for (const file of scanResult.files) {
10662
10769
  const source = (() => {
10663
10770
  try {
10664
- return fs11__namespace.default.readFileSync(file.file, "utf8");
10771
+ return fs12__namespace.default.readFileSync(file.file, "utf8");
10665
10772
  } catch {
10666
10773
  return "";
10667
10774
  }