tailwind-styled-v4 5.0.35 → 5.0.37

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 (92) hide show
  1. package/README.md +458 -339
  2. package/dist/analyzer.d.mts +152 -5
  3. package/dist/analyzer.d.ts +152 -5
  4. package/dist/animate.d.mts +30 -3
  5. package/dist/animate.d.ts +30 -3
  6. package/dist/cli.js +9 -6
  7. package/dist/cli.js.map +1 -1
  8. package/dist/cli.mjs +9 -6
  9. package/dist/cli.mjs.map +1 -1
  10. package/dist/compiler.d.mts +5 -0
  11. package/dist/compiler.d.ts +5 -0
  12. package/dist/compiler.js.map +1 -1
  13. package/dist/compiler.mjs.map +1 -1
  14. package/dist/devtools.d.mts +88 -2
  15. package/dist/devtools.d.ts +88 -2
  16. package/dist/engine.d.mts +557 -6
  17. package/dist/engine.d.ts +557 -6
  18. package/dist/engine.js.map +1 -1
  19. package/dist/engine.mjs.map +1 -1
  20. package/dist/index.browser.mjs +689 -508
  21. package/dist/index.browser.mjs.map +1 -1
  22. package/dist/index.d.mts +236 -9
  23. package/dist/index.d.ts +236 -9
  24. package/dist/index.js +38 -20
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +38 -20
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/next.js +240 -170
  29. package/dist/next.js.map +1 -1
  30. package/dist/next.mjs +240 -170
  31. package/dist/next.mjs.map +1 -1
  32. package/dist/plugin-api.d.mts +4 -2
  33. package/dist/plugin-api.d.ts +4 -2
  34. package/dist/plugin-registry.js +39 -25
  35. package/dist/plugin-registry.js.map +1 -1
  36. package/dist/plugin-registry.mjs +39 -25
  37. package/dist/plugin-registry.mjs.map +1 -1
  38. package/dist/plugin.d.mts +165 -5
  39. package/dist/plugin.d.ts +165 -5
  40. package/dist/plugin.js +17 -0
  41. package/dist/plugin.js.map +1 -1
  42. package/dist/plugin.mjs +15 -1
  43. package/dist/plugin.mjs.map +1 -1
  44. package/dist/runtime.d.mts +38 -3
  45. package/dist/runtime.d.ts +38 -3
  46. package/dist/scanner.d.mts +58 -4
  47. package/dist/scanner.d.ts +58 -4
  48. package/dist/shared.d.mts +185 -3
  49. package/dist/shared.d.ts +185 -3
  50. package/dist/shared.js.map +1 -1
  51. package/dist/shared.mjs.map +1 -1
  52. package/dist/storybook-addon.d.mts +2 -2
  53. package/dist/storybook-addon.d.ts +2 -2
  54. package/dist/svelte.d.mts +2 -1
  55. package/dist/svelte.d.ts +2 -1
  56. package/dist/svelte.js +4 -4
  57. package/dist/svelte.js.map +1 -1
  58. package/dist/svelte.mjs +4 -4
  59. package/dist/svelte.mjs.map +1 -1
  60. package/dist/theme.d.mts +38 -3
  61. package/dist/theme.d.ts +38 -3
  62. package/dist/turbopackLoader.js.map +1 -1
  63. package/dist/turbopackLoader.mjs.map +1 -1
  64. package/dist/tw.js +9 -6
  65. package/dist/tw.js.map +1 -1
  66. package/dist/tw.mjs +9 -6
  67. package/dist/tw.mjs.map +1 -1
  68. package/dist/vite.js.map +1 -1
  69. package/dist/vite.mjs.map +1 -1
  70. package/dist/vue.d.mts +4 -1
  71. package/dist/vue.d.ts +4 -1
  72. package/dist/vue.js +4 -4
  73. package/dist/vue.js.map +1 -1
  74. package/dist/vue.mjs +4 -4
  75. package/dist/vue.mjs.map +1 -1
  76. package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
  77. package/native/tailwind-styled-native.node +0 -0
  78. package/package.json +7 -5
  79. package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
  80. package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
  81. package/dist/index-DQI6O24n.d.mts +0 -464
  82. package/dist/index-NDINUhLN.d.mts +0 -90
  83. package/dist/index-NDINUhLN.d.ts +0 -90
  84. package/dist/index-UkYbyBkR.d.ts +0 -464
  85. package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
  86. package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
  87. package/dist/schemas-DR-SLxZZ.d.mts +0 -59
  88. package/dist/schemas-DR-SLxZZ.d.ts +0 -59
  89. package/dist/trace-Dz4vmZdy.d.mts +0 -96
  90. package/dist/trace-Dz4vmZdy.d.ts +0 -96
  91. package/dist/types-DXr2PmGP.d.mts +0 -31
  92. package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/next.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module';
2
- import * as fs9 from 'fs';
3
- import fs9__default from 'fs';
4
- import * as path10 from 'path';
5
- import path10__default from 'path';
2
+ import * as fs10 from 'fs';
3
+ import fs10__default from 'fs';
4
+ import * as path11 from 'path';
5
+ import path11__default from 'path';
6
6
  import 'crypto';
7
7
  import { fileURLToPath } from 'url';
8
8
  import { z } from 'zod';
@@ -62,11 +62,11 @@ function resolvePath(...segments) {
62
62
  return segments.join("/").replace(/\/+/g, "/");
63
63
  }
64
64
  }
65
- function existsSync(path11) {
65
+ function existsSync(path12) {
66
66
  if (isBrowser) return false;
67
67
  try {
68
68
  const nodeFs = __require(NODE_FS);
69
- return nodeFs.existsSync(path11);
69
+ return nodeFs.existsSync(path12);
70
70
  } catch {
71
71
  return false;
72
72
  }
@@ -140,7 +140,7 @@ function resolveNativeBinary(runtimeDir) {
140
140
  }
141
141
  const envPath = process.env.TW_NATIVE_PATH?.trim();
142
142
  if (envPath) {
143
- if (fs9.existsSync(envPath)) {
143
+ if (fs10.existsSync(envPath)) {
144
144
  return { path: envPath, source: "env", platform, tried };
145
145
  }
146
146
  tried.push(`env:${envPath} (not found)`);
@@ -149,7 +149,7 @@ function resolveNativeBinary(runtimeDir) {
149
149
  for (const pkg of prebuiltPkgs) {
150
150
  try {
151
151
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
152
- if (fs9.existsSync(candidate)) {
152
+ if (fs10.existsSync(candidate)) {
153
153
  return { path: candidate, source: "prebuilt", platform, tried };
154
154
  }
155
155
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -160,13 +160,13 @@ function resolveNativeBinary(runtimeDir) {
160
160
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
161
161
  const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
162
162
  if (runtimeDir) {
163
- for (const depth of ["..", path10.join("..", ".."), path10.join("..", "..", "..")]) {
164
- const pkgRoot = path10.resolve(runtimeDir, depth);
163
+ for (const depth of ["..", path11.join("..", ".."), path11.join("..", "..", "..")]) {
164
+ const pkgRoot = path11.resolve(runtimeDir, depth);
165
165
  for (const bin of BINARY_NAMES_SELF) {
166
166
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
167
- const candidate = path10.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
167
+ const candidate = path11.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
168
168
  tried.push(`self-bundled:${candidate}`);
169
- if (fs9.existsSync(candidate)) {
169
+ if (fs10.existsSync(candidate)) {
170
170
  return { path: candidate, source: "prebuilt", platform, tried };
171
171
  }
172
172
  }
@@ -178,29 +178,29 @@ function resolveNativeBinary(runtimeDir) {
178
178
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
179
179
  const localCandidates = [];
180
180
  for (const bin of BINARY_NAMES) {
181
- localCandidates.push(path10.resolve(base, `${bin}.node`));
182
- localCandidates.push(path10.resolve(base, "..", `${bin}.node`));
183
- localCandidates.push(path10.resolve(base, `${bin}.${platform}.node`));
184
- localCandidates.push(path10.resolve(base, `${bin}.${napiPlatform}.node`));
181
+ localCandidates.push(path11.resolve(base, `${bin}.node`));
182
+ localCandidates.push(path11.resolve(base, "..", `${bin}.node`));
183
+ localCandidates.push(path11.resolve(base, `${bin}.${platform}.node`));
184
+ localCandidates.push(path11.resolve(base, `${bin}.${napiPlatform}.node`));
185
185
  }
186
186
  for (const startDir of [cwd, base]) {
187
187
  let dir = startDir;
188
188
  for (let i = 0; i < 6; i++) {
189
- const nativeDir = path10.resolve(dir, "native");
189
+ const nativeDir = path11.resolve(dir, "native");
190
190
  for (const bin of BINARY_NAMES) {
191
- localCandidates.push(path10.resolve(nativeDir, `${bin}.node`));
192
- localCandidates.push(path10.resolve(nativeDir, `${bin}.${platform}.node`));
193
- localCandidates.push(path10.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
194
- localCandidates.push(path10.resolve(nativeDir, "target", "release", `${bin}.node`));
191
+ localCandidates.push(path11.resolve(nativeDir, `${bin}.node`));
192
+ localCandidates.push(path11.resolve(nativeDir, `${bin}.${platform}.node`));
193
+ localCandidates.push(path11.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
194
+ localCandidates.push(path11.resolve(nativeDir, "target", "release", `${bin}.node`));
195
195
  }
196
- const parent = path10.resolve(dir, "..");
196
+ const parent = path11.resolve(dir, "..");
197
197
  if (parent === dir) break;
198
198
  dir = parent;
199
199
  }
200
200
  }
201
201
  for (const candidate of localCandidates) {
202
202
  tried.push(`local:${candidate}`);
203
- if (fs9.existsSync(candidate)) {
203
+ if (fs10.existsSync(candidate)) {
204
204
  return { path: candidate, source: "local", platform, tried };
205
205
  }
206
206
  }
@@ -227,7 +227,7 @@ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttemp
227
227
  var init_nativeBridge = __esm({
228
228
  "packages/domain/compiler/src/nativeBridge.ts"() {
229
229
  init_src2();
230
- _loadNative = (path11) => __require(path11);
230
+ _loadNative = (path12) => __require(path12);
231
231
  log = (...args) => {
232
232
  if (process.env.DEBUG?.includes("compiler:native")) {
233
233
  console.log("[compiler:native]", ...args);
@@ -2381,7 +2381,7 @@ var init_src = __esm({
2381
2381
  };
2382
2382
  scanProjectUsage = (dirs, cwd) => {
2383
2383
  const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
2384
- const files = dirs.map((dir) => path10__default.resolve(cwd, dir));
2384
+ const files = dirs.map((dir) => path11__default.resolve(cwd, dir));
2385
2385
  const results = batchExtractClasses2(files) || [];
2386
2386
  const combined = {};
2387
2387
  for (const result of results) {
@@ -2398,13 +2398,13 @@ var init_src = __esm({
2398
2398
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
2399
2399
  const allClasses = Object.keys(classes).sort();
2400
2400
  if (outputPath) {
2401
- fs9__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2401
+ fs10__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2402
2402
  }
2403
2403
  return allClasses;
2404
2404
  };
2405
2405
  loadSafelist = (safelistPath) => {
2406
2406
  try {
2407
- const content = fs9__default.readFileSync(safelistPath, "utf-8");
2407
+ const content = fs10__default.readFileSync(safelistPath, "utf-8");
2408
2408
  return JSON.parse(content);
2409
2409
  } catch {
2410
2410
  return [];
@@ -2418,8 +2418,8 @@ var init_src = __esm({
2418
2418
  "tailwind.config.cjs"
2419
2419
  ];
2420
2420
  for (const file of configFiles) {
2421
- const fullPath = path10__default.join(cwd, file);
2422
- if (fs9__default.existsSync(fullPath)) {
2421
+ const fullPath = path11__default.join(cwd, file);
2422
+ if (fs10__default.existsSync(fullPath)) {
2423
2423
  const mod = __require(fullPath);
2424
2424
  return mod.default || mod;
2425
2425
  }
@@ -2429,9 +2429,9 @@ var init_src = __esm({
2429
2429
  getContentPaths = (cwd = process.cwd()) => {
2430
2430
  return {
2431
2431
  content: [
2432
- path10__default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2433
- path10__default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2434
- path10__default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2432
+ path11__default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2433
+ path11__default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2434
+ path11__default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2435
2435
  ]
2436
2436
  };
2437
2437
  };
@@ -2889,17 +2889,17 @@ function getNative() {
2889
2889
  function* walkSourceFiles(dir) {
2890
2890
  let entries;
2891
2891
  try {
2892
- entries = fs9__default.readdirSync(dir, { withFileTypes: true });
2892
+ entries = fs10__default.readdirSync(dir, { withFileTypes: true });
2893
2893
  } catch {
2894
2894
  return;
2895
2895
  }
2896
2896
  for (const entry of entries) {
2897
- const fullPath = path10__default.join(dir, entry.name);
2897
+ const fullPath = path11__default.join(dir, entry.name);
2898
2898
  if (entry.isDirectory()) {
2899
2899
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
2900
2900
  yield* walkSourceFiles(fullPath);
2901
2901
  } else if (entry.isFile()) {
2902
- const ext = path10__default.extname(entry.name);
2902
+ const ext = path11__default.extname(entry.name);
2903
2903
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
2904
2904
  }
2905
2905
  }
@@ -2963,7 +2963,7 @@ function extractStaticStateCss(srcDir, options = {}) {
2963
2963
  allConfigs.push(...configs);
2964
2964
  if (verbose) {
2965
2965
  process.stderr.write(
2966
- `[tw:static-state] ${path10__default.relative(srcDir, filePath)}: ${configs.length} komponen
2966
+ `[tw:static-state] ${path11__default.relative(srcDir, filePath)}: ${configs.length} komponen
2967
2967
  `
2968
2968
  );
2969
2969
  }
@@ -2974,7 +2974,7 @@ function extractStaticStateCss(srcDir, options = {}) {
2974
2974
  if (filesScanned >= maxFiles) break;
2975
2975
  let source;
2976
2976
  try {
2977
- source = fs9__default.readFileSync(filePath, "utf-8");
2977
+ source = fs10__default.readFileSync(filePath, "utf-8");
2978
2978
  } catch {
2979
2979
  continue;
2980
2980
  }
@@ -2987,7 +2987,7 @@ function extractStaticStateCss(srcDir, options = {}) {
2987
2987
  allConfigs.push(...configs);
2988
2988
  if (verbose) {
2989
2989
  process.stderr.write(
2990
- `[tw:static-state] ${path10__default.relative(srcDir, filePath)}: ${configs.length} komponen
2990
+ `[tw:static-state] ${path11__default.relative(srcDir, filePath)}: ${configs.length} komponen
2991
2991
  `
2992
2992
  );
2993
2993
  }
@@ -3081,12 +3081,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3081
3081
  resolvedCss: options.resolvedCss || ""
3082
3082
  // ← ensure always passed
3083
3083
  });
3084
- const twClassesDir = path10__default.join(path10__default.dirname(safelistPath), "tw-classes");
3085
- fs9__default.mkdirSync(twClassesDir, { recursive: true });
3086
- const stateFilePath = path10__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3084
+ const twClassesDir = path11__default.join(path11__default.dirname(safelistPath), "tw-classes");
3085
+ fs10__default.mkdirSync(twClassesDir, { recursive: true });
3086
+ const stateFilePath = path11__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3087
3087
  if (result.rulesGenerated === 0) {
3088
3088
  try {
3089
- fs9__default.writeFileSync(
3089
+ fs10__default.writeFileSync(
3090
3090
  stateFilePath,
3091
3091
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3092
3092
  "utf-8"
@@ -3096,7 +3096,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3096
3096
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3097
3097
  }
3098
3098
  try {
3099
- fs9__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3099
+ fs10__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3100
3100
  return [
3101
3101
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3102
3102
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3126,8 +3126,8 @@ function setGlobalLogFile(filePath) {
3126
3126
  _globalLogFile = filePath;
3127
3127
  _logFileInitialized = false;
3128
3128
  try {
3129
- fs9__default.mkdirSync(path10__default.dirname(filePath), { recursive: true });
3130
- fs9__default.writeFileSync(
3129
+ fs10__default.mkdirSync(path11__default.dirname(filePath), { recursive: true });
3130
+ fs10__default.writeFileSync(
3131
3131
  filePath,
3132
3132
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3133
3133
  `,
@@ -3140,7 +3140,7 @@ function setGlobalLogFile(filePath) {
3140
3140
  function writeToFile(line) {
3141
3141
  if (!_globalLogFile || !_logFileInitialized) return;
3142
3142
  try {
3143
- fs9__default.appendFileSync(_globalLogFile, line);
3143
+ fs10__default.appendFileSync(_globalLogFile, line);
3144
3144
  } catch {
3145
3145
  }
3146
3146
  }
@@ -3205,9 +3205,9 @@ function createDebugLogger(namespace, label) {
3205
3205
  }
3206
3206
  };
3207
3207
  }
3208
- function formatIssuePath(path11) {
3209
- if (!path11 || path11.length === 0) return "(root)";
3210
- return path11.map(
3208
+ function formatIssuePath(path12) {
3209
+ if (!path12 || path12.length === 0) return "(root)";
3210
+ return path12.map(
3211
3211
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3212
3212
  ).join(".");
3213
3213
  }
@@ -3215,9 +3215,9 @@ function loadNativeBinding(options) {
3215
3215
  const { runtimeDir, candidates, isValid } = options;
3216
3216
  const loadErrors = [];
3217
3217
  for (const candidate of candidates) {
3218
- const candidatePath = path10__default.resolve(runtimeDir, candidate);
3218
+ const candidatePath = path11__default.resolve(runtimeDir, candidate);
3219
3219
  try {
3220
- if (!fs9__default.existsSync(candidatePath) && !fs9__default.existsSync(candidatePath + ".node")) {
3220
+ if (!fs10__default.existsSync(candidatePath) && !fs10__default.existsSync(candidatePath + ".node")) {
3221
3221
  continue;
3222
3222
  }
3223
3223
  const mod = requireNativeModule(candidatePath);
@@ -3249,9 +3249,9 @@ function resolveNativeBindingCandidates(options) {
3249
3249
  }
3250
3250
  }
3251
3251
  if (!includeDefaultCandidates) return candidates;
3252
- if (fs9__default.existsSync(runtimeDir)) {
3252
+ if (fs10__default.existsSync(runtimeDir)) {
3253
3253
  try {
3254
- for (const entry of fs9__default.readdirSync(runtimeDir)) {
3254
+ for (const entry of fs10__default.readdirSync(runtimeDir)) {
3255
3255
  if (entry.endsWith(".node")) candidates.push(entry);
3256
3256
  }
3257
3257
  } catch {
@@ -3260,21 +3260,21 @@ function resolveNativeBindingCandidates(options) {
3260
3260
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3261
3261
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
3262
3262
  for (const bin of BINARY_NAMES) {
3263
- candidates.push(path10__default.resolve(runtimeDir, `${bin}.node`));
3264
- candidates.push(path10__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3265
- candidates.push(path10__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3266
- candidates.push(path10__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3267
- candidates.push(path10__default.resolve(process.cwd(), "native", `${bin}.node`));
3268
- candidates.push(path10__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3269
- candidates.push(path10__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3270
- candidates.push(path10__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3271
- candidates.push(path10__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3263
+ candidates.push(path11__default.resolve(runtimeDir, `${bin}.node`));
3264
+ candidates.push(path11__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3265
+ candidates.push(path11__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3266
+ candidates.push(path11__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3267
+ candidates.push(path11__default.resolve(process.cwd(), "native", `${bin}.node`));
3268
+ candidates.push(path11__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3269
+ candidates.push(path11__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3270
+ candidates.push(path11__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3271
+ candidates.push(path11__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3272
3272
  }
3273
3273
  return Array.from(new Set(candidates));
3274
3274
  }
3275
3275
  function resolveRuntimeDir(dir, importMetaUrl) {
3276
3276
  try {
3277
- return path10__default.dirname(fileURLToPath(importMetaUrl));
3277
+ return path11__default.dirname(fileURLToPath(importMetaUrl));
3278
3278
  } catch {
3279
3279
  return process.cwd();
3280
3280
  }
@@ -3319,8 +3319,8 @@ var init_src2 = __esm({
3319
3319
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3320
3320
  static fromZod(err) {
3321
3321
  const first = err.issues?.[0] ?? err.errors?.[0];
3322
- const path11 = formatIssuePath(first?.path);
3323
- const message = first ? `${path11}: ${first.message}` : "Schema validation failed";
3322
+ const path12 = formatIssuePath(first?.path);
3323
+ const message = first ? `${path12}: ${first.message}` : "Schema validation failed";
3324
3324
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3325
3325
  }
3326
3326
  static wrap(source, code, err) {
@@ -3376,7 +3376,7 @@ function getDirname() {
3376
3376
  return __dirname;
3377
3377
  }
3378
3378
  if (typeof import.meta !== "undefined" && import.meta.url) {
3379
- return path10__default.dirname(fileURLToPath(import.meta.url));
3379
+ return path11__default.dirname(fileURLToPath(import.meta.url));
3380
3380
  }
3381
3381
  return process.cwd();
3382
3382
  }
@@ -3695,12 +3695,12 @@ init_src2();
3695
3695
  // packages/domain/scanner/src/cache-native.ts
3696
3696
  init_native_bridge();
3697
3697
  function defaultCachePath(rootDir, cacheDir) {
3698
- const dir = cacheDir ? path10__default.resolve(rootDir, cacheDir) : path10__default.join(process.cwd(), ".cache", "tailwind-styled");
3699
- return path10__default.join(dir, "scanner-cache.json");
3698
+ const dir = cacheDir ? path11__default.resolve(rootDir, cacheDir) : path11__default.join(process.cwd(), ".cache", "tailwind-styled");
3699
+ return path11__default.join(dir, "scanner-cache.json");
3700
3700
  }
3701
3701
  function readCache(rootDir, cacheDir) {
3702
3702
  const cachePath = defaultCachePath(rootDir, cacheDir);
3703
- fs9__default.mkdirSync(path10__default.dirname(cachePath), { recursive: true });
3703
+ fs10__default.mkdirSync(path11__default.dirname(cachePath), { recursive: true });
3704
3704
  const result = cacheReadNative(cachePath);
3705
3705
  if (!result) return [];
3706
3706
  return result.entries.map((e) => ({
@@ -3715,7 +3715,7 @@ function readCache(rootDir, cacheDir) {
3715
3715
  }
3716
3716
  function writeCache(rootDir, entries, cacheDir) {
3717
3717
  const cachePath = defaultCachePath(rootDir, cacheDir);
3718
- fs9__default.mkdirSync(path10__default.dirname(cachePath), { recursive: true });
3718
+ fs10__default.mkdirSync(path11__default.dirname(cachePath), { recursive: true });
3719
3719
  const success = cacheWriteNative(cachePath, entries);
3720
3720
  if (!success) {
3721
3721
  throw new Error(
@@ -3740,12 +3740,12 @@ init_native_bridge();
3740
3740
 
3741
3741
  // packages/domain/scanner/src/schemas.ts
3742
3742
  init_src2();
3743
- var formatIssuePath2 = (path11) => path11.length > 0 ? path11.map(
3743
+ var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
3744
3744
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3745
3745
  ).join(".") : "<root>";
3746
3746
  var formatIssues2 = (error) => error.issues.map((issue) => {
3747
- const path11 = formatIssuePath2(issue.path);
3748
- return `${path11}: ${issue.message}`;
3747
+ const path12 = formatIssuePath2(issue.path);
3748
+ return `${path12}: ${issue.message}`;
3749
3749
  }).join("; ");
3750
3750
  var parseWithSchema2 = (schema, data, label) => {
3751
3751
  const parsed = schema.safeParse(data);
@@ -3805,7 +3805,7 @@ function getRuntimeDir() {
3805
3805
  return __dirname;
3806
3806
  }
3807
3807
  if (typeof import.meta !== "undefined" && import.meta.url) {
3808
- return path10__default.dirname(fileURLToPath(import.meta.url));
3808
+ return path11__default.dirname(fileURLToPath(import.meta.url));
3809
3809
  }
3810
3810
  return process.cwd();
3811
3811
  }
@@ -3820,7 +3820,7 @@ var createNativeParserLoader = () => {
3820
3820
  const loadNativeParserBinding = () => {
3821
3821
  if (_state.binding !== void 0) return _state.binding;
3822
3822
  const runtimeDir = getRuntimeDir();
3823
- const req = createRequire(path10__default.join(runtimeDir, "noop.cjs"));
3823
+ const req = createRequire(path11__default.join(runtimeDir, "noop.cjs"));
3824
3824
  const _platform = process.platform;
3825
3825
  const _arch = process.arch;
3826
3826
  const _platformArch = `${_platform}-${_arch}`;
@@ -3828,27 +3828,27 @@ var createNativeParserLoader = () => {
3828
3828
  const candidates = [
3829
3829
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
3830
3830
  // cwd = repo root saat run dari root, atau package dir saat workspaces
3831
- path10__default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
3832
- path10__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
3833
- path10__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3831
+ path11__default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
3832
+ path11__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
3833
+ path11__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3834
3834
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
3835
3835
  // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
3836
- path10__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
3837
- path10__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
3838
- path10__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3836
+ path11__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
3837
+ path11__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
3838
+ path11__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3839
3839
  // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
3840
- path10__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
3841
- path10__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3840
+ path11__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
3841
+ path11__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3842
3842
  // 3 level fallback (jika package di-nest lebih dangkal)
3843
- path10__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
3844
- path10__default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3843
+ path11__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
3844
+ path11__default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
3845
3845
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
3846
- path10__default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
3847
- path10__default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
3848
- path10__default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
3849
- path10__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
3850
- path10__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
3851
- path10__default.resolve(
3846
+ path11__default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
3847
+ path11__default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
3848
+ path11__default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
3849
+ path11__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
3850
+ path11__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
3851
+ path11__default.resolve(
3852
3852
  runtimeDir,
3853
3853
  "..",
3854
3854
  "..",
@@ -3860,7 +3860,7 @@ var createNativeParserLoader = () => {
3860
3860
  )
3861
3861
  ];
3862
3862
  for (const fullPath of candidates) {
3863
- if (!fs9__default.existsSync(fullPath)) continue;
3863
+ if (!fs10__default.existsSync(fullPath)) continue;
3864
3864
  try {
3865
3865
  const required = req(fullPath);
3866
3866
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -3901,19 +3901,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
3901
3901
  if (!currentDir) continue;
3902
3902
  const entries = (() => {
3903
3903
  try {
3904
- return fs9__default.readdirSync(currentDir, { withFileTypes: true });
3904
+ return fs10__default.readdirSync(currentDir, { withFileTypes: true });
3905
3905
  } catch {
3906
3906
  return [];
3907
3907
  }
3908
3908
  })();
3909
3909
  for (const entry of entries) {
3910
- const fullPath = path10__default.join(currentDir, entry.name);
3910
+ const fullPath = path11__default.join(currentDir, entry.name);
3911
3911
  if (entry.isDirectory()) {
3912
3912
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
3913
3913
  continue;
3914
3914
  }
3915
3915
  if (!entry.isFile()) continue;
3916
- if (!extensionSet.has(path10__default.extname(entry.name))) continue;
3916
+ if (!extensionSet.has(path11__default.extname(entry.name))) continue;
3917
3917
  candidates.push(fullPath);
3918
3918
  }
3919
3919
  }
@@ -3997,7 +3997,7 @@ function scanWorkspace2(rootDir, options = {}) {
3997
3997
  for (const filePath of candidates) {
3998
3998
  const stat = (() => {
3999
3999
  try {
4000
- return fs9__default.statSync(filePath);
4000
+ return fs10__default.statSync(filePath);
4001
4001
  } catch {
4002
4002
  return null;
4003
4003
  }
@@ -4023,7 +4023,7 @@ function scanWorkspace2(rootDir, options = {}) {
4023
4023
  for (const { filePath, stat, size, cached } of ranked) {
4024
4024
  const content = (() => {
4025
4025
  try {
4026
- return fs9__default.readFileSync(filePath, "utf8");
4026
+ return fs10__default.readFileSync(filePath, "utf8");
4027
4027
  } catch {
4028
4028
  return null;
4029
4029
  }
@@ -4086,6 +4086,70 @@ function scanWorkspace2(rootDir, options = {}) {
4086
4086
 
4087
4087
  // packages/presentation/next/src/withTailwindStyled.ts
4088
4088
  init_src2();
4089
+
4090
+ // packages/presentation/next/src/incrementalOrchestrator.ts
4091
+ init_src();
4092
+ var _fingerprintCache = /* @__PURE__ */ new Map();
4093
+ function getNative2() {
4094
+ try {
4095
+ return getNativeBridge();
4096
+ } catch {
4097
+ return null;
4098
+ }
4099
+ }
4100
+ function fingerprintFile(filePath) {
4101
+ try {
4102
+ const stat = fs10__default.statSync(filePath);
4103
+ const native = getNative2();
4104
+ if (native?.create_fingerprint) {
4105
+ const content = fs10__default.readFileSync(filePath, "utf-8");
4106
+ const hash = native.create_fingerprint(filePath, content);
4107
+ return { hash, mtime: stat.mtimeMs };
4108
+ }
4109
+ return { hash: `${stat.mtimeMs}-${stat.size}`, mtime: stat.mtimeMs };
4110
+ } catch {
4111
+ return null;
4112
+ }
4113
+ }
4114
+ function hasSourceChanged(sourceFiles) {
4115
+ if (_fingerprintCache.size === 0) {
4116
+ for (const f of sourceFiles) {
4117
+ const fp = fingerprintFile(f);
4118
+ if (fp) _fingerprintCache.set(f, fp);
4119
+ }
4120
+ return true;
4121
+ }
4122
+ let changed = false;
4123
+ for (const f of sourceFiles) {
4124
+ const prev = _fingerprintCache.get(f);
4125
+ const curr = fingerprintFile(f);
4126
+ if (!curr) continue;
4127
+ if (!prev || prev.hash !== curr.hash) {
4128
+ changed = true;
4129
+ _fingerprintCache.set(f, curr);
4130
+ }
4131
+ }
4132
+ for (const f of sourceFiles) {
4133
+ if (!_fingerprintCache.has(f)) {
4134
+ const fp = fingerprintFile(f);
4135
+ if (fp) {
4136
+ _fingerprintCache.set(f, fp);
4137
+ changed = true;
4138
+ }
4139
+ }
4140
+ }
4141
+ return changed;
4142
+ }
4143
+ function isIncrementalEnabled(cwd) {
4144
+ try {
4145
+ const configPath = path11__default.join(cwd, "tailwind-styled.config.json");
4146
+ if (!fs10__default.existsSync(configPath)) return false;
4147
+ const config = JSON.parse(fs10__default.readFileSync(configPath, "utf-8"));
4148
+ return config.compiler?.incremental === true;
4149
+ } catch {
4150
+ return false;
4151
+ }
4152
+ }
4089
4153
  var _fileStaticCssMap = /* @__PURE__ */ new Map();
4090
4154
  function setFileStaticCss(filepath, css) {
4091
4155
  if (css && css.trim()) {
@@ -4119,14 +4183,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
4119
4183
  static PLUGIN_NAME = "TailwindStyledStaticCss";
4120
4184
  outPath;
4121
4185
  constructor(safelistPath) {
4122
- this.outPath = path10__default.join(path10__default.dirname(safelistPath), "_tw-state-static.css");
4186
+ this.outPath = path11__default.join(path11__default.dirname(safelistPath), "_tw-state-static.css");
4123
4187
  }
4124
4188
  apply(compiler) {
4125
4189
  compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
4126
4190
  try {
4127
4191
  const content = buildContent(_fileStaticCssMap);
4128
- fs9__default.mkdirSync(path10__default.dirname(this.outPath), { recursive: true });
4129
- fs9__default.writeFileSync(
4192
+ fs10__default.mkdirSync(path11__default.dirname(this.outPath), { recursive: true });
4193
+ fs10__default.writeFileSync(
4130
4194
  this.outPath,
4131
4195
  HEADER + (content || "/* no static rules yet */") + "\n",
4132
4196
  "utf-8"
@@ -4160,12 +4224,12 @@ var resolveLoaderPath2 = (basename) => {
4160
4224
  } catch {
4161
4225
  const runtimeDir = resolveRuntimeDir2();
4162
4226
  const candidates = [
4163
- path10__default.resolve(runtimeDir, `${basename}.mjs`),
4164
- path10__default.resolve(runtimeDir, `${basename}.js`),
4165
- path10__default.resolve(runtimeDir, `${basename}.cjs`)
4227
+ path11__default.resolve(runtimeDir, `${basename}.mjs`),
4228
+ path11__default.resolve(runtimeDir, `${basename}.js`),
4229
+ path11__default.resolve(runtimeDir, `${basename}.cjs`)
4166
4230
  ];
4167
4231
  for (const candidate of candidates) {
4168
- if (fs9__default.existsSync(candidate)) {
4232
+ if (fs10__default.existsSync(candidate)) {
4169
4233
  return candidate;
4170
4234
  }
4171
4235
  }
@@ -4203,7 +4267,7 @@ var createLoaderOptions = (options) => {
4203
4267
  preserveImports: true
4204
4268
  };
4205
4269
  if (options.verbose !== void 0) opts.verbose = options.verbose;
4206
- opts.safelistPath = options.safelistPath ?? path10__default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4270
+ opts.safelistPath = options.safelistPath ?? path11__default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4207
4271
  return Object.freeze(opts);
4208
4272
  };
4209
4273
  var buildTurbopackRules = (loaderPath, loaderOptions) => {
@@ -4216,7 +4280,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
4216
4280
  ])
4217
4281
  );
4218
4282
  };
4219
- var normalizeLoaderPath = (loaderPath) => path10__default.resolve(loaderPath);
4283
+ var normalizeLoaderPath = (loaderPath) => path11__default.resolve(loaderPath);
4220
4284
  var applyWebpackRule = (config, options, loaderPath) => {
4221
4285
  const loaderOptions = createLoaderOptions(options);
4222
4286
  const rules = config.module?.rules ?? [];
@@ -4233,7 +4297,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
4233
4297
  enforce: "pre",
4234
4298
  use: [{ loader: loaderPath, options: loaderOptions }]
4235
4299
  };
4236
- const safelistPath = loaderOptions.safelistPath ?? path10__default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4300
+ const safelistPath = loaderOptions.safelistPath ?? path11__default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4237
4301
  const pluginAlreadyRegistered = (config.plugins ?? []).some(
4238
4302
  (p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
4239
4303
  );
@@ -4333,17 +4397,17 @@ function withTailwindStyled(options = {}) {
4333
4397
  return fullCss.slice(startIdx, endIdx + 1);
4334
4398
  };
4335
4399
  var extractUtilitiesLayer = extractUtilitiesLayer2;
4336
- const twClassesDir = path10__default.join(path10__default.dirname(safelistPath), "tw-classes");
4337
- fs9__default.mkdirSync(twClassesDir, { recursive: true });
4338
- setGlobalLogFile(path10__default.join(twClassesDir, "_tw-build.log"));
4339
- fs9__default.writeFileSync(
4340
- path10__default.join(twClassesDir, "_start.txt"),
4400
+ const twClassesDir = path11__default.join(path11__default.dirname(safelistPath), "tw-classes");
4401
+ fs10__default.mkdirSync(twClassesDir, { recursive: true });
4402
+ setGlobalLogFile(path11__default.join(twClassesDir, "_tw-build.log"));
4403
+ fs10__default.writeFileSync(
4404
+ path11__default.join(twClassesDir, "_start.txt"),
4341
4405
  String(Date.now()),
4342
4406
  "utf-8"
4343
4407
  );
4344
- const stateStaticPath = path10__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
4408
+ const stateStaticPath = path11__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
4345
4409
  try {
4346
- fs9__default.writeFileSync(
4410
+ fs10__default.writeFileSync(
4347
4411
  stateStaticPath,
4348
4412
  "/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
4349
4413
  "utf-8"
@@ -4359,14 +4423,14 @@ function withTailwindStyled(options = {}) {
4359
4423
  "src/index.css",
4360
4424
  "styles/globals.css"
4361
4425
  ];
4362
- const safelistDir = path10__default.dirname(safelistPath);
4426
+ const safelistDir = path11__default.dirname(safelistPath);
4363
4427
  for (const candidate of CSS_CANDIDATES) {
4364
- const candidatePath = path10__default.join(process.cwd(), candidate);
4365
- if (!fs9__default.existsSync(candidatePath)) continue;
4366
- const content = fs9__default.readFileSync(candidatePath, "utf-8");
4428
+ const candidatePath = path11__default.join(process.cwd(), candidate);
4429
+ if (!fs10__default.existsSync(candidatePath)) continue;
4430
+ const content = fs10__default.readFileSync(candidatePath, "utf-8");
4367
4431
  if (content.includes("_tw-state-static.css")) break;
4368
- const globalsDir = path10__default.dirname(candidatePath);
4369
- const rel = path10__default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
4432
+ const globalsDir = path11__default.dirname(candidatePath);
4433
+ const rel = path11__default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
4370
4434
  const importLine = `@import "./${rel}";`;
4371
4435
  const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
4372
4436
  let updated;
@@ -4380,7 +4444,7 @@ function withTailwindStyled(options = {}) {
4380
4444
  updated = `${importLine}
4381
4445
  ${content}`;
4382
4446
  }
4383
- fs9__default.writeFileSync(candidatePath, updated, "utf-8");
4447
+ fs10__default.writeFileSync(candidatePath, updated, "utf-8");
4384
4448
  if (options.verbose) {
4385
4449
  console.log(
4386
4450
  `[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
@@ -4392,27 +4456,27 @@ ${content}`;
4392
4456
  }
4393
4457
  if (!process.env.TW_NATIVE_PATH) {
4394
4458
  const runtimeDir = resolveRuntimeDir2();
4395
- const nativePath = path10__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
4396
- if (fs9__default.existsSync(nativePath)) {
4459
+ const nativePath = path11__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
4460
+ if (fs10__default.existsSync(nativePath)) {
4397
4461
  process.env.TW_NATIVE_PATH = nativePath;
4398
4462
  }
4399
4463
  }
4400
- const srcDir = path10__default.join(process.cwd(), "src");
4401
- if (fs9__default.existsSync(srcDir)) {
4464
+ const srcDir = path11__default.join(process.cwd(), "src");
4465
+ if (fs10__default.existsSync(srcDir)) {
4402
4466
  try {
4403
4467
  const result = scanWorkspace2(srcDir);
4404
4468
  if (result.uniqueClasses.length > 0) {
4405
4469
  let atomicWriteFile2 = function(filePath, content) {
4406
4470
  const tmpPath = `${filePath}.tmp`;
4407
4471
  try {
4408
- fs9__default.writeFileSync(tmpPath, content, "utf-8");
4409
- fs9__default.renameSync(tmpPath, filePath);
4472
+ fs10__default.writeFileSync(tmpPath, content, "utf-8");
4473
+ fs10__default.renameSync(tmpPath, filePath);
4410
4474
  } catch {
4411
4475
  try {
4412
- fs9__default.unlinkSync(tmpPath);
4476
+ fs10__default.unlinkSync(tmpPath);
4413
4477
  } catch {
4414
4478
  }
4415
- fs9__default.writeFileSync(filePath, content, "utf-8");
4479
+ fs10__default.writeFileSync(filePath, content, "utf-8");
4416
4480
  }
4417
4481
  };
4418
4482
  var atomicWriteFile = atomicWriteFile2;
@@ -4475,14 +4539,14 @@ ${content}`;
4475
4539
  "styles/globals.css"
4476
4540
  ];
4477
4541
  try {
4478
- const twConfigPath = path10__default.join(process.cwd(), "tailwind-styled.config.json");
4479
- if (fs9__default.existsSync(twConfigPath)) {
4480
- const twConfig = JSON.parse(fs9__default.readFileSync(twConfigPath, "utf-8"));
4542
+ const twConfigPath = path11__default.join(process.cwd(), "tailwind-styled.config.json");
4543
+ if (fs10__default.existsSync(twConfigPath)) {
4544
+ const twConfig = JSON.parse(fs10__default.readFileSync(twConfigPath, "utf-8"));
4481
4545
  const cssEntry = twConfig.css?.entry;
4482
4546
  if (cssEntry) {
4483
- const cssEntryPath = path10__default.join(process.cwd(), cssEntry);
4484
- if (fs9__default.existsSync(cssEntryPath)) {
4485
- cssEntryContent = fs9__default.readFileSync(cssEntryPath, "utf-8");
4547
+ const cssEntryPath = path11__default.join(process.cwd(), cssEntry);
4548
+ if (fs10__default.existsSync(cssEntryPath)) {
4549
+ cssEntryContent = fs10__default.readFileSync(cssEntryPath, "utf-8");
4486
4550
  }
4487
4551
  }
4488
4552
  }
@@ -4490,9 +4554,9 @@ ${content}`;
4490
4554
  }
4491
4555
  if (!cssEntryContent) {
4492
4556
  for (const candidate of CSS_CANDIDATES) {
4493
- const candidatePath = path10__default.join(process.cwd(), candidate);
4494
- if (fs9__default.existsSync(candidatePath)) {
4495
- cssEntryContent = fs9__default.readFileSync(candidatePath, "utf-8");
4557
+ const candidatePath = path11__default.join(process.cwd(), candidate);
4558
+ if (fs10__default.existsSync(candidatePath)) {
4559
+ cssEntryContent = fs10__default.readFileSync(candidatePath, "utf-8");
4496
4560
  break;
4497
4561
  }
4498
4562
  }
@@ -4500,46 +4564,52 @@ ${content}`;
4500
4564
  if (cssEntryContent) {
4501
4565
  cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
4502
4566
  }
4503
- const initialScanPath = path10__default.join(twClassesDir, "_initial-scan.css");
4504
- if (!fs9__default.existsSync(initialScanPath)) {
4567
+ const initialScanPath = path11__default.join(twClassesDir, "_initial-scan.css");
4568
+ if (!fs10__default.existsSync(initialScanPath)) {
4505
4569
  atomicWriteFile2(
4506
4570
  initialScanPath,
4507
4571
  "/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
4508
4572
  );
4509
4573
  }
4510
- void (async () => {
4511
- try {
4512
- const compiler = await Promise.resolve().then(() => (init_src(), src_exports));
4513
- const generateCssForClasses2 = compiler.generateCssForClasses;
4514
- const css = await generateCssForClasses2(
4515
- filteredClasses,
4516
- {},
4517
- process.cwd(),
4518
- cssEntryContent ?? void 0,
4519
- process.env.NODE_ENV === "production"
4520
- // minify hanya di production
4521
- );
4522
- if (css) {
4523
- const utilitiesOnly = extractUtilitiesLayer2(css);
4524
- atomicWriteFile2(
4525
- initialScanPath,
4526
- `/* tw-classes: initial scan \u2014 auto-generated by withTailwindStyled */
4574
+ const sourceFiles = result.files?.map((f) => f.file) ?? [];
4575
+ const incremental = isIncrementalEnabled(process.cwd());
4576
+ if (incremental && fs10__default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
4577
+ if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
4578
+ } else {
4579
+ void (async () => {
4580
+ try {
4581
+ const compiler = await Promise.resolve().then(() => (init_src(), src_exports));
4582
+ const generateCssForClasses2 = compiler.generateCssForClasses;
4583
+ const css = await generateCssForClasses2(
4584
+ filteredClasses,
4585
+ {},
4586
+ process.cwd(),
4587
+ cssEntryContent ?? void 0,
4588
+ process.env.NODE_ENV === "production"
4589
+ // minify hanya di production
4590
+ );
4591
+ if (css) {
4592
+ const utilitiesOnly = extractUtilitiesLayer2(css);
4593
+ atomicWriteFile2(
4594
+ initialScanPath,
4595
+ `/* tw-classes: initial scan \u2014 auto-generated by withTailwindStyled */
4527
4596
  ${utilitiesOnly}`
4597
+ );
4598
+ const summary = appendStaticStateCssToSafelist(srcDir, safelistPath, {
4599
+ verbose: options.verbose ?? false,
4600
+ resolvedCss: css
4601
+ });
4602
+ if (options.verbose) console.log(summary);
4603
+ }
4604
+ } catch (err) {
4605
+ throw new Error(
4606
+ `[tailwind-styled] generateCssForClasses gagal \u2014 build-time CSS generation wajib berhasil.
4607
+ ${err.message}`,
4608
+ { cause: err }
4528
4609
  );
4529
- const summary = appendStaticStateCssToSafelist(srcDir, safelistPath, {
4530
- verbose: options.verbose ?? false,
4531
- resolvedCss: css
4532
- });
4533
- if (options.verbose) console.log(summary);
4534
4610
  }
4535
- } catch (err) {
4536
- throw new Error(
4537
- `[tailwind-styled] generateCssForClasses gagal \u2014 build-time CSS generation wajib berhasil.
4538
- ${err.message}`,
4539
- { cause: err }
4540
- );
4541
- }
4542
- })();
4611
+ })();
4612
+ }
4543
4613
  }
4544
4614
  } catch (e) {
4545
4615
  throw new Error(