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