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/tw.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import * as fs11 from 'fs';
4
- import fs11__default, { readFileSync, readdirSync } from 'fs';
3
+ import * as fs12 from 'fs';
4
+ import fs12__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 fs7 from 'fs/promises';
12
+ import fs8 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';
@@ -989,7 +989,7 @@ var require_command = __commonJS({
989
989
  var EventEmitter = __require("events").EventEmitter;
990
990
  var childProcess = __require("child_process");
991
991
  var path29 = __require("path");
992
- var fs15 = __require("fs");
992
+ var fs16 = __require("fs");
993
993
  var process2 = __require("process");
994
994
  var { Argument: Argument2, humanReadableArgName } = require_argument();
995
995
  var { CommanderError: CommanderError2 } = require_error();
@@ -1921,10 +1921,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1921
1921
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1922
1922
  function findFile(baseDir, baseName) {
1923
1923
  const localBin = path29.resolve(baseDir, baseName);
1924
- if (fs15.existsSync(localBin)) return localBin;
1924
+ if (fs16.existsSync(localBin)) return localBin;
1925
1925
  if (sourceExt.includes(path29.extname(baseName))) return void 0;
1926
1926
  const foundExt = sourceExt.find(
1927
- (ext) => fs15.existsSync(`${localBin}${ext}`)
1927
+ (ext) => fs16.existsSync(`${localBin}${ext}`)
1928
1928
  );
1929
1929
  if (foundExt) return `${localBin}${foundExt}`;
1930
1930
  return void 0;
@@ -1936,7 +1936,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1936
1936
  if (this._scriptPath) {
1937
1937
  let resolvedScriptPath;
1938
1938
  try {
1939
- resolvedScriptPath = fs15.realpathSync(this._scriptPath);
1939
+ resolvedScriptPath = fs16.realpathSync(this._scriptPath);
1940
1940
  } catch (err) {
1941
1941
  resolvedScriptPath = this._scriptPath;
1942
1942
  }
@@ -3172,7 +3172,7 @@ function resolveNativeBinary(runtimeDir) {
3172
3172
  }
3173
3173
  const envPath = process.env.TW_NATIVE_PATH?.trim();
3174
3174
  if (envPath) {
3175
- if (fs11.existsSync(envPath)) {
3175
+ if (fs12.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 (fs11.existsSync(candidate)) {
3184
+ if (fs12.existsSync(candidate)) {
3185
3185
  return { path: candidate, source: "prebuilt", platform, tried };
3186
3186
  }
3187
3187
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -3189,9 +3189,24 @@ function resolveNativeBinary(runtimeDir) {
3189
3189
  tried.push(`prebuilt:${pkg} (not installed)`);
3190
3190
  }
3191
3191
  }
3192
+ const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
3193
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
3194
+ if (runtimeDir) {
3195
+ for (const depth of ["..", path6.join("..", ".."), path6.join("..", "..", "..")]) {
3196
+ const pkgRoot = path6.resolve(runtimeDir, depth);
3197
+ for (const bin of BINARY_NAMES_SELF) {
3198
+ for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
3199
+ const candidate = path6.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
3200
+ tried.push(`self-bundled:${candidate}`);
3201
+ if (fs12.existsSync(candidate)) {
3202
+ return { path: candidate, source: "prebuilt", platform, tried };
3203
+ }
3204
+ }
3205
+ }
3206
+ }
3207
+ }
3192
3208
  const cwd2 = process.cwd();
3193
3209
  const base = runtimeDir ?? cwd2;
3194
- const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
3195
3210
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3196
3211
  const localCandidates = [];
3197
3212
  for (const bin of BINARY_NAMES) {
@@ -3217,7 +3232,7 @@ function resolveNativeBinary(runtimeDir) {
3217
3232
  }
3218
3233
  for (const candidate of localCandidates) {
3219
3234
  tried.push(`local:${candidate}`);
3220
- if (fs11.existsSync(candidate)) {
3235
+ if (fs12.existsSync(candidate)) {
3221
3236
  return { path: candidate, source: "local", platform, tried };
3222
3237
  }
3223
3238
  }
@@ -3229,12 +3244,12 @@ var init_native_resolution = __esm({
3229
3244
  isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
3230
3245
  _require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
3231
3246
  PLATFORM_MAP = {
3232
- "linux-x64": ["@tailwind-styled/native-linux-x64"],
3233
- "linux-arm64": ["@tailwind-styled/native-linux-arm64"],
3247
+ "linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
3248
+ "linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
3234
3249
  "darwin-x64": ["@tailwind-styled/native-darwin-x64"],
3235
3250
  "darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
3236
- "win32-x64": ["@tailwind-styled/native-win32-x64"],
3237
- "win32-arm64": ["@tailwind-styled/native-win32-arm64"]
3251
+ "win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
3252
+ "win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
3238
3253
  };
3239
3254
  }
3240
3255
  });
@@ -3282,7 +3297,7 @@ function loadNativeBinding(options) {
3282
3297
  for (const candidate of candidates) {
3283
3298
  const candidatePath = path6__default.resolve(runtimeDir, candidate);
3284
3299
  try {
3285
- if (!fs11__default.existsSync(candidatePath) && !fs11__default.existsSync(candidatePath + ".node")) {
3300
+ if (!fs12__default.existsSync(candidatePath) && !fs12__default.existsSync(candidatePath + ".node")) {
3286
3301
  continue;
3287
3302
  }
3288
3303
  const mod = requireNativeModule(candidatePath);
@@ -3314,9 +3329,9 @@ function resolveNativeBindingCandidates(options) {
3314
3329
  }
3315
3330
  }
3316
3331
  if (!includeDefaultCandidates) return candidates;
3317
- if (fs11__default.existsSync(runtimeDir)) {
3332
+ if (fs12__default.existsSync(runtimeDir)) {
3318
3333
  try {
3319
- for (const entry of fs11__default.readdirSync(runtimeDir)) {
3334
+ for (const entry of fs12__default.readdirSync(runtimeDir)) {
3320
3335
  if (entry.endsWith(".node")) candidates.push(entry);
3321
3336
  }
3322
3337
  } catch {
@@ -3327,11 +3342,13 @@ function resolveNativeBindingCandidates(options) {
3327
3342
  for (const bin of BINARY_NAMES) {
3328
3343
  candidates.push(path6__default.resolve(runtimeDir, `${bin}.node`));
3329
3344
  candidates.push(path6__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3345
+ candidates.push(path6__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3346
+ candidates.push(path6__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3347
+ candidates.push(path6__default.resolve(process.cwd(), "native", `${bin}.node`));
3348
+ candidates.push(path6__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3330
3349
  candidates.push(path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3331
3350
  candidates.push(path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3332
3351
  candidates.push(path6__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3333
- candidates.push(path6__default.resolve(process.cwd(), "native", `${bin}.node`));
3334
- candidates.push(path6__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3335
3352
  }
3336
3353
  return Array.from(new Set(candidates));
3337
3354
  }
@@ -3416,8 +3433,10 @@ __export(native_bridge_exports, {
3416
3433
  extractClassesNative: () => extractClassesNative,
3417
3434
  generateSubComponentTypesNative: () => generateSubComponentTypesNative,
3418
3435
  hasNativeScannerBinding: () => hasNativeScannerBinding,
3436
+ hasNativeWatchBinding: () => hasNativeWatchBinding,
3419
3437
  hashContentNative: () => hashContentNative,
3420
3438
  isRustCacheAvailable: () => isRustCacheAvailable,
3439
+ pollWatchEventsNative: () => pollWatchEventsNative,
3421
3440
  pruneStaleEntriesNative: () => pruneStaleEntriesNative,
3422
3441
  rebuildWorkspaceResultNative: () => rebuildWorkspaceResultNative,
3423
3442
  resetScannerBridgeCache: () => resetScannerBridgeCache,
@@ -3427,7 +3446,9 @@ __export(native_bridge_exports, {
3427
3446
  scanCacheStats: () => scanCacheStats,
3428
3447
  scanFileNative: () => scanFileNative,
3429
3448
  scanFilesBatchNative: () => scanFilesBatchNative,
3430
- scanWorkspaceNative: () => scanWorkspaceNative
3449
+ scanWorkspaceNative: () => scanWorkspaceNative,
3450
+ startWatchNative: () => startWatchNative,
3451
+ stopWatchNative: () => stopWatchNative
3431
3452
  });
3432
3453
  function getDirname2() {
3433
3454
  if (typeof __dirname !== "undefined") {
@@ -3604,6 +3625,41 @@ function computeCacheStatsNative(filesClasses, sizes, top) {
3604
3625
  if (!binding.computeCacheStats) return null;
3605
3626
  return binding.computeCacheStats(filesClasses, sizes, top ?? null);
3606
3627
  }
3628
+ function startWatchNative(rootDir) {
3629
+ try {
3630
+ const binding = scannerGetBinding();
3631
+ if (!binding.startWatch) return null;
3632
+ return binding.startWatch(rootDir);
3633
+ } catch {
3634
+ return null;
3635
+ }
3636
+ }
3637
+ function pollWatchEventsNative(handleId) {
3638
+ try {
3639
+ const binding = scannerGetBinding();
3640
+ if (!binding.pollWatchEvents) return [];
3641
+ return binding.pollWatchEvents(handleId);
3642
+ } catch {
3643
+ return [];
3644
+ }
3645
+ }
3646
+ function stopWatchNative(handleId) {
3647
+ try {
3648
+ const binding = scannerGetBinding();
3649
+ if (!binding.stopWatch) return false;
3650
+ return binding.stopWatch(handleId);
3651
+ } catch {
3652
+ return false;
3653
+ }
3654
+ }
3655
+ function hasNativeWatchBinding() {
3656
+ try {
3657
+ const binding = scannerGetBinding();
3658
+ return !!(binding.startWatch && binding.pollWatchEvents && binding.stopWatch);
3659
+ } catch {
3660
+ return false;
3661
+ }
3662
+ }
3607
3663
  var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
3608
3664
  var init_native_bridge = __esm({
3609
3665
  "packages/domain/scanner/src/native-bridge.ts"() {
@@ -3693,6 +3749,7 @@ function defaultCachePath(rootDir, cacheDir) {
3693
3749
  }
3694
3750
  function readCache(rootDir, cacheDir) {
3695
3751
  const cachePath = defaultCachePath(rootDir, cacheDir);
3752
+ fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3696
3753
  const result = cacheReadNative(cachePath);
3697
3754
  if (!result) return [];
3698
3755
  return result.entries.map((e) => ({
@@ -3707,6 +3764,7 @@ function readCache(rootDir, cacheDir) {
3707
3764
  }
3708
3765
  function writeCache(rootDir, entries, cacheDir) {
3709
3766
  const cachePath = defaultCachePath(rootDir, cacheDir);
3767
+ fs12__default.mkdirSync(path6__default.dirname(cachePath), { recursive: true });
3710
3768
  const success = cacheWriteNative(cachePath, entries);
3711
3769
  if (!success) {
3712
3770
  throw new Error(
@@ -3737,7 +3795,7 @@ function collectFiles(rootDir, extensions, ignoreDirs) {
3737
3795
  function walk(dir) {
3738
3796
  let entries;
3739
3797
  try {
3740
- entries = fs11__default.readdirSync(dir, { withFileTypes: true });
3798
+ entries = fs12__default.readdirSync(dir, { withFileTypes: true });
3741
3799
  } catch {
3742
3800
  return;
3743
3801
  }
@@ -3937,7 +3995,7 @@ function resolveScannerWorkerModulePath() {
3937
3995
  path6__default.resolve(runtimeDir, "worker.ts")
3938
3996
  ];
3939
3997
  for (const candidate of candidates) {
3940
- if (fs11__default.existsSync(candidate)) return candidate;
3998
+ if (fs12__default.existsSync(candidate)) return candidate;
3941
3999
  }
3942
4000
  return null;
3943
4001
  }
@@ -3994,7 +4052,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
3994
4052
  if (!currentDir) continue;
3995
4053
  const entries = (() => {
3996
4054
  try {
3997
- return fs11__default.readdirSync(currentDir, { withFileTypes: true });
4055
+ return fs12__default.readdirSync(currentDir, { withFileTypes: true });
3998
4056
  } catch {
3999
4057
  return [];
4000
4058
  }
@@ -4093,7 +4151,7 @@ function scanWorkspace(rootDir, options = {}) {
4093
4151
  for (const filePath of candidates) {
4094
4152
  const stat = (() => {
4095
4153
  try {
4096
- return fs11__default.statSync(filePath);
4154
+ return fs12__default.statSync(filePath);
4097
4155
  } catch {
4098
4156
  return null;
4099
4157
  }
@@ -4119,7 +4177,7 @@ function scanWorkspace(rootDir, options = {}) {
4119
4177
  for (const { filePath, stat, size, cached } of ranked) {
4120
4178
  const content = (() => {
4121
4179
  try {
4122
- return fs11__default.readFileSync(filePath, "utf8");
4180
+ return fs12__default.readFileSync(filePath, "utf8");
4123
4181
  } catch {
4124
4182
  return null;
4125
4183
  }
@@ -4224,21 +4282,31 @@ var init_src2 = __esm({
4224
4282
  if (_state.binding !== void 0) return _state.binding;
4225
4283
  const runtimeDir = getRuntimeDir();
4226
4284
  const req = createRequire(path6__default.join(runtimeDir, "noop.cjs"));
4285
+ const _platform = process.platform;
4286
+ const _arch = process.arch;
4287
+ const _platformArch = `${_platform}-${_arch}`;
4288
+ const _platformArchGnu = _platformArch === "linux-x64" ? "linux-x64-gnu" : _platformArch === "linux-arm64" ? "linux-arm64-gnu" : _platformArch;
4227
4289
  const candidates = [
4228
4290
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
4229
4291
  // cwd = repo root saat run dari root, atau package dir saat workspaces
4230
4292
  path6__default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4231
- path6__default.resolve(process.cwd(), "native", `tailwind-styled-native.${process.platform}-${process.arch}.node`),
4232
- path6__default.resolve(process.cwd(), "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4233
- // runtimeDir = dist/ → naik 4 level ke repo root
4293
+ path6__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4294
+ path6__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4295
+ // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
4296
+ // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
4297
+ path6__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4298
+ path6__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4299
+ path6__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4300
+ // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
4234
4301
  path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4235
- path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4302
+ path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4236
4303
  // 3 level fallback (jika package di-nest lebih dangkal)
4237
4304
  path6__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4238
- path6__default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${process.platform}-${process.arch}-gnu.node`),
4305
+ path6__default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4239
4306
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
4240
4307
  path6__default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4241
4308
  path6__default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4309
+ path6__default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4242
4310
  path6__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4243
4311
  path6__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4244
4312
  path6__default.resolve(
@@ -4253,7 +4321,7 @@ var init_src2 = __esm({
4253
4321
  )
4254
4322
  ];
4255
4323
  for (const fullPath of candidates) {
4256
- if (!fs11__default.existsSync(fullPath)) continue;
4324
+ if (!fs12__default.existsSync(fullPath)) continue;
4257
4325
  try {
4258
4326
  const required = req(fullPath);
4259
4327
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4295,7 +4363,7 @@ function isRecord(value) {
4295
4363
  }
4296
4364
  async function pathExists(filePath) {
4297
4365
  try {
4298
- await fs11__default.promises.access(filePath, fs11__default.constants.F_OK);
4366
+ await fs12__default.promises.access(filePath, fs12__default.constants.F_OK);
4299
4367
  return true;
4300
4368
  } catch {
4301
4369
  return false;
@@ -4643,7 +4711,7 @@ var init_semantic = __esm({
4643
4711
  return out;
4644
4712
  };
4645
4713
  collectSafelistFromSource = async (configPath) => {
4646
- const source = await fs11__default.promises.readFile(configPath, "utf8");
4714
+ const source = await fs12__default.promises.readFile(configPath, "utf8");
4647
4715
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
4648
4716
  const allTokens = extractClassesNative2(source);
4649
4717
  const hasSafelist = source.includes("safelist");
@@ -4670,7 +4738,7 @@ var init_semantic = __esm({
4670
4738
  customUtilities: /* @__PURE__ */ new Set()
4671
4739
  };
4672
4740
  }
4673
- const configStat = await fs11__default.promises.stat(configPath).catch(() => null);
4741
+ const configStat = await fs12__default.promises.stat(configPath).catch(() => null);
4674
4742
  if (configStat) {
4675
4743
  const cached = tailwindConfigCache.get(configPath);
4676
4744
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5103,7 +5171,7 @@ var init_src3 = __esm({
5103
5171
  });
5104
5172
  async function pathExists2(filePath) {
5105
5173
  try {
5106
- await fs7.access(filePath);
5174
+ await fs8.access(filePath);
5107
5175
  return true;
5108
5176
  } catch {
5109
5177
  return false;
@@ -5111,7 +5179,7 @@ async function pathExists2(filePath) {
5111
5179
  }
5112
5180
  async function readFileSafe(filePath) {
5113
5181
  try {
5114
- return await fs7.readFile(filePath, "utf8");
5182
+ return await fs8.readFile(filePath, "utf8");
5115
5183
  } catch {
5116
5184
  return null;
5117
5185
  }
@@ -5130,8 +5198,8 @@ async function writeFileSafe(filePath, content, options = {}) {
5130
5198
  options.onDryRun?.(`write ${filePath}`);
5131
5199
  return;
5132
5200
  }
5133
- await fs7.mkdir(path6__default.dirname(filePath), { recursive: true });
5134
- await fs7.writeFile(filePath, content, "utf8");
5201
+ await fs8.mkdir(path6__default.dirname(filePath), { recursive: true });
5202
+ await fs8.writeFile(filePath, content, "utf8");
5135
5203
  }
5136
5204
  async function ensureFileSafe(filePath, content, options = {}) {
5137
5205
  if (await pathExists2(filePath)) return "skipped";
@@ -6277,7 +6345,8 @@ async function runInitCli(rawArgs) {
6277
6345
  `${JSON.stringify(
6278
6346
  {
6279
6347
  version: 1,
6280
- cssEntry: "src/tailwind.css"
6348
+ compiler: { engine: "rust" },
6349
+ css: { entry: "src/tailwind.css" }
6281
6350
  },
6282
6351
  null,
6283
6352
  2
@@ -6358,7 +6427,7 @@ async function findSourceFiles(dir) {
6358
6427
  const out = [];
6359
6428
  async function walk(currentDir) {
6360
6429
  if (!await pathExists2(currentDir)) return;
6361
- const entries = await fs7.readdir(currentDir, { withFileTypes: true });
6430
+ const entries = await fs8.readdir(currentDir, { withFileTypes: true });
6362
6431
  for (const entry of entries) {
6363
6432
  const fullPath = path6__default.join(currentDir, entry.name);
6364
6433
  if (entry.isDirectory()) {
@@ -6424,12 +6493,12 @@ async function runMigrateCli(rawArgs) {
6424
6493
  report.configWrites += await migrateConfig(root, dryRun);
6425
6494
  }
6426
6495
  for (const filePath of files) {
6427
- const source = await fs7.readFile(filePath, "utf8");
6496
+ const source = await fs8.readFile(filePath, "utf8");
6428
6497
  const migrated = migrateSource(source, { includeImports, includeClasses });
6429
6498
  if (migrated.output !== source) {
6430
6499
  report.updatedFiles++;
6431
6500
  if (!dryRun) {
6432
- await fs7.writeFile(filePath, migrated.output, "utf8");
6501
+ await fs8.writeFile(filePath, migrated.output, "utf8");
6433
6502
  }
6434
6503
  }
6435
6504
  report.classRenames += migrated.classRenames;
@@ -6495,8 +6564,8 @@ function buildClassNames(files, uniqueClasses) {
6495
6564
  function writeScanCache(root, cacheData) {
6496
6565
  const cacheDir = path6__default.join(root, ".tailwind-styled");
6497
6566
  const cachePath = path6__default.join(cacheDir, "scan-cache.json");
6498
- fs11__default.mkdirSync(cacheDir, { recursive: true });
6499
- fs11__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6567
+ fs12__default.mkdirSync(cacheDir, { recursive: true });
6568
+ fs12__default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
6500
6569
  return cachePath;
6501
6570
  }
6502
6571
  async function runScanCli(rawArgs) {
@@ -6966,6 +7035,14 @@ async function findExisting(cwd2, names) {
6966
7035
  }
6967
7036
  return null;
6968
7037
  }
7038
+ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger) {
7039
+ if (flags.isDryRun) {
7040
+ logger.dry(`create ${label}`);
7041
+ return;
7042
+ }
7043
+ await writeFileSafe(filePath, content);
7044
+ logger.ok(path6__default.relative(cwd2, filePath) || label);
7045
+ }
6969
7046
  async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
6970
7047
  const source = await readFileSafe(filePath);
6971
7048
  if (!source) return false;
@@ -7151,6 +7228,21 @@ var runSetupCli = async (rawArgs) => {
7151
7228
  setupFlags,
7152
7229
  logger
7153
7230
  );
7231
+ const detectedCssEntry = path6__default.relative(cwd, cssFile).replace(/\\/g, "/");
7232
+ const twConfigPath = path6__default.join(cwd, "tailwind-styled.config.json");
7233
+ const twConfig = {
7234
+ version: 1,
7235
+ compiler: { engine: "rust" },
7236
+ css: { entry: detectedCssEntry }
7237
+ };
7238
+ await writeFileWithDryRun(
7239
+ cwd,
7240
+ twConfigPath,
7241
+ JSON.stringify(twConfig, null, 2) + "\n",
7242
+ "tailwind-styled.config.json",
7243
+ setupFlags,
7244
+ logger
7245
+ );
7154
7246
  } else {
7155
7247
  logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
7156
7248
  }
@@ -7162,6 +7254,21 @@ var runSetupCli = async (rawArgs) => {
7162
7254
  } else {
7163
7255
  logger.skip("tsconfig.json tidak ditemukan \u2014 skip");
7164
7256
  }
7257
+ output.writeText("\n" + import_picocolors3.default.bold(" [+]") + import_picocolors3.default.cyan(" pre-warming scanner cache"));
7258
+ if (!setupFlags.isDryRun) {
7259
+ try {
7260
+ const { scanWorkspaceAsync: scanWorkspaceAsync2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
7261
+ const scanSpinner = output.spinner();
7262
+ scanSpinner.start("Scanning workspace...");
7263
+ const scanned = await scanWorkspaceAsync2(cwd, { useCache: true });
7264
+ scanSpinner.stop(`Scanned ${scanned.totalFiles} file(s), ${scanned.uniqueClasses.length} unique classes`);
7265
+ logger.ok(".cache/tailwind-styled/scanner-cache.json");
7266
+ } catch {
7267
+ logger.warn("Pre-warm cache gagal \u2014 tidak masalah, cache akan dibangun saat npm run dev");
7268
+ }
7269
+ } else {
7270
+ logger.dry("pre-warm scanner cache");
7271
+ }
7165
7272
  output.writeText("");
7166
7273
  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"));
7167
7274
  output.writeText(import_picocolors3.default.bold(import_picocolors3.default.green(" \u2713 setup selesai")));
@@ -7453,7 +7560,7 @@ async function loadRegistry(context) {
7453
7560
  if (!registryPath) {
7454
7561
  throw new CliUsageError("Plugin registry file not found.");
7455
7562
  }
7456
- const raw = await fs7.readFile(registryPath, "utf8");
7563
+ const raw = await fs8.readFile(registryPath, "utf8");
7457
7564
  const data = JSON.parse(raw);
7458
7565
  return [
7459
7566
  ...data.official.map((item) => ({ ...item, official: true })),
@@ -7588,8 +7695,8 @@ var deployCommand = {
7588
7695
  return;
7589
7696
  }
7590
7697
  const cacheDir = path6__default.join(process.cwd(), ".tw-cache");
7591
- await fs7.mkdir(cacheDir, { recursive: true });
7592
- await fs7.writeFile(
7698
+ await fs8.mkdir(cacheDir, { recursive: true });
7699
+ await fs8.writeFile(
7593
7700
  path6__default.join(cacheDir, "deploy-manifest.json"),
7594
7701
  JSON.stringify(manifest, null, 2)
7595
7702
  );
@@ -7690,22 +7797,22 @@ function addIssue(issues, severity, type, message, suggestion, location) {
7690
7797
  issues.push({ severity, type, message, suggestion, location });
7691
7798
  }
7692
7799
  function readJsonFile(filePath) {
7693
- if (!fs11__default.existsSync(filePath)) return null;
7800
+ if (!fs12__default.existsSync(filePath)) return null;
7694
7801
  try {
7695
- return JSON.parse(fs11__default.readFileSync(filePath, "utf8"));
7802
+ return JSON.parse(fs12__default.readFileSync(filePath, "utf8"));
7696
7803
  } catch {
7697
7804
  return null;
7698
7805
  }
7699
7806
  }
7700
7807
  function findWorkspacePackageJsonFiles(root) {
7701
7808
  const packagesDir = path6__default.join(root, "packages");
7702
- if (!fs11__default.existsSync(packagesDir)) return [];
7703
- 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));
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));
7704
7811
  }
7705
7812
  function findFiles(dir, ext) {
7706
7813
  const files = [];
7707
7814
  try {
7708
- const entries = fs11__default.readdirSync(dir, { withFileTypes: true });
7815
+ const entries = fs12__default.readdirSync(dir, { withFileTypes: true });
7709
7816
  for (const entry of entries) {
7710
7817
  const fullPath = path6__default.join(dir, entry.name);
7711
7818
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
@@ -7867,7 +7974,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7867
7974
  const cssFiles = findFiles(root, ".css");
7868
7975
  const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
7869
7976
  try {
7870
- const content = fs11__default.readFileSync(filePath, "utf8");
7977
+ const content = fs12__default.readFileSync(filePath, "utf8");
7871
7978
  return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
7872
7979
  } catch {
7873
7980
  return false;
@@ -7891,7 +7998,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
7891
7998
  );
7892
7999
  }
7893
8000
  const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
7894
- const hasConfig = configFiles.some((name) => fs11__default.existsSync(path6__default.join(root, name)));
8001
+ const hasConfig = configFiles.some((name) => fs12__default.existsSync(path6__default.join(root, name)));
7895
8002
  addCheck(
7896
8003
  checks,
7897
8004
  "tailwind",
@@ -10286,7 +10393,7 @@ function tryCompileClasses(classes) {
10286
10393
  }
10287
10394
  }
10288
10395
  function traceSingleFile(filePath, root) {
10289
- const source = fs11__default.readFileSync(filePath, "utf8");
10396
+ const source = fs12__default.readFileSync(filePath, "utf8");
10290
10397
  const classes = uniqueSorted(scanSource(source));
10291
10398
  const imports = extractImports(source);
10292
10399
  const compiled = tryCompileClasses(classes);
@@ -10317,7 +10424,7 @@ function traceDirectory(targetDir, root) {
10317
10424
  const imports = [];
10318
10425
  const importKeys = /* @__PURE__ */ new Set();
10319
10426
  const files = scanResult.files.filter((entry) => isScannableFile(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
10320
- const source = fs11__default.readFileSync(entry.file, "utf8");
10427
+ const source = fs12__default.readFileSync(entry.file, "utf8");
10321
10428
  const fileImports = extractImports(source);
10322
10429
  for (const fileImport of fileImports) {
10323
10430
  const key = `${fileImport.kind}:${fileImport.source}`;
@@ -10350,10 +10457,10 @@ function traceDirectory(targetDir, root) {
10350
10457
  async function traceTarget(target, options = {}) {
10351
10458
  const root = path6__default.resolve(options.root ?? process.cwd());
10352
10459
  const resolvedTarget = path6__default.resolve(root, target);
10353
- if (!fs11__default.existsSync(resolvedTarget)) {
10460
+ if (!fs12__default.existsSync(resolvedTarget)) {
10354
10461
  throw new Error(`Trace target not found: ${resolvedTarget}`);
10355
10462
  }
10356
- const stat = fs11__default.statSync(resolvedTarget);
10463
+ const stat = fs12__default.statSync(resolvedTarget);
10357
10464
  if (stat.isDirectory()) {
10358
10465
  return traceDirectory(resolvedTarget, root);
10359
10466
  }
@@ -10559,10 +10666,10 @@ async function runGenerateTypesCli(rawArgs) {
10559
10666
  output.writeText("");
10560
10667
  output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
10561
10668
  const outDir = path6__default.dirname(outPath);
10562
- if (!fs11__default.existsSync(outDir)) {
10563
- fs11__default.mkdirSync(outDir, { recursive: true });
10669
+ if (!fs12__default.existsSync(outDir)) {
10670
+ fs12__default.mkdirSync(outDir, { recursive: true });
10564
10671
  }
10565
- fs11__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10672
+ fs12__default.writeFileSync(outPath, result.dtsContent, "utf-8");
10566
10673
  logger.ok(path6__default.relative(cwd2, outPath));
10567
10674
  output.writeText("");
10568
10675
  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"));
@@ -10578,7 +10685,7 @@ async function loadNativeBinding2(cwd2) {
10578
10685
  path6__default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
10579
10686
  ];
10580
10687
  for (const candidate of candidates) {
10581
- if (fs11__default.existsSync(candidate)) {
10688
+ if (fs12__default.existsSync(candidate)) {
10582
10689
  try {
10583
10690
  return __require(candidate);
10584
10691
  } catch {
@@ -10637,7 +10744,7 @@ async function whyClass(className, options) {
10637
10744
  for (const file of scanResult.files) {
10638
10745
  const source = (() => {
10639
10746
  try {
10640
- return fs11__default.readFileSync(file.file, "utf8");
10747
+ return fs12__default.readFileSync(file.file, "utf8");
10641
10748
  } catch {
10642
10749
  return "";
10643
10750
  }