tailwind-styled-v4 5.1.16 → 5.1.18

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 (59) hide show
  1. package/dist/atomic.js +16 -4
  2. package/dist/atomic.js.map +1 -1
  3. package/dist/atomic.mjs +13 -2
  4. package/dist/atomic.mjs.map +1 -1
  5. package/dist/cli.js +80 -68
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.mjs +77 -66
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/compiler.d.mts +84 -4
  10. package/dist/compiler.d.ts +84 -4
  11. package/dist/compiler.js +245 -15
  12. package/dist/compiler.js.map +1 -1
  13. package/dist/compiler.mjs +240 -14
  14. package/dist/compiler.mjs.map +1 -1
  15. package/dist/engine.js +209 -167
  16. package/dist/engine.js.map +1 -1
  17. package/dist/engine.mjs +200 -159
  18. package/dist/engine.mjs.map +1 -1
  19. package/dist/index.browser.mjs +0 -3
  20. package/dist/index.browser.mjs.map +1 -1
  21. package/dist/index.js +0 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +0 -3
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/next.d.mts +16 -0
  26. package/dist/next.d.ts +16 -0
  27. package/dist/next.js +458 -158
  28. package/dist/next.js.map +1 -1
  29. package/dist/next.mjs +454 -154
  30. package/dist/next.mjs.map +1 -1
  31. package/dist/runtime.js +0 -3
  32. package/dist/runtime.js.map +1 -1
  33. package/dist/runtime.mjs +0 -3
  34. package/dist/runtime.mjs.map +1 -1
  35. package/dist/shared.js +106 -64
  36. package/dist/shared.js.map +1 -1
  37. package/dist/shared.mjs +101 -60
  38. package/dist/shared.mjs.map +1 -1
  39. package/dist/theme.js +0 -3
  40. package/dist/theme.js.map +1 -1
  41. package/dist/theme.mjs +0 -3
  42. package/dist/theme.mjs.map +1 -1
  43. package/dist/turbopackLoader.js +94 -52
  44. package/dist/turbopackLoader.js.map +1 -1
  45. package/dist/turbopackLoader.mjs +92 -51
  46. package/dist/turbopackLoader.mjs.map +1 -1
  47. package/dist/tw.js +80 -68
  48. package/dist/tw.js.map +1 -1
  49. package/dist/tw.mjs +77 -66
  50. package/dist/tw.mjs.map +1 -1
  51. package/dist/vite.js +172 -130
  52. package/dist/vite.js.map +1 -1
  53. package/dist/vite.mjs +166 -125
  54. package/dist/vite.mjs.map +1 -1
  55. package/dist/webpackLoader.js +28 -10
  56. package/dist/webpackLoader.js.map +1 -1
  57. package/dist/webpackLoader.mjs +26 -9
  58. package/dist/webpackLoader.mjs.map +1 -1
  59. package/package.json +1 -1
package/dist/next.js CHANGED
@@ -66,11 +66,11 @@ function resolvePath(...segments) {
66
66
  return segments.join("/").replace(/\/+/g, "/");
67
67
  }
68
68
  }
69
- function existsSync(path12) {
69
+ function existsSync(path13) {
70
70
  if (isBrowser) return false;
71
71
  try {
72
72
  const nodeFs = require(NODE_FS);
73
- return nodeFs.existsSync(path12);
73
+ return nodeFs.existsSync(path13);
74
74
  } catch {
75
75
  return false;
76
76
  }
@@ -252,7 +252,7 @@ var init_nativeBridge = __esm({
252
252
  "use strict";
253
253
  init_cjs_shims();
254
254
  init_src2();
255
- _loadNative = (path12) => require(path12);
255
+ _loadNative = (path13) => require(path13);
256
256
  log = (...args) => {
257
257
  if (process.env.DEBUG?.includes("compiler:native")) {
258
258
  console.log("[compiler:native]", ...args);
@@ -2097,6 +2097,199 @@ var init_watch = __esm({
2097
2097
  }
2098
2098
  });
2099
2099
 
2100
+ // packages/domain/compiler/src/routeGraph.ts
2101
+ function deriveRouteFromPageFile(normalizedFile) {
2102
+ const rootMatch = normalizedFile.match(ROOT_PAGE_RE);
2103
+ if (rootMatch) return "/";
2104
+ const match = normalizedFile.match(PAGE_RE);
2105
+ if (!match) return null;
2106
+ const segments = match[1].split("/").filter((s) => !(s.startsWith("(") && s.endsWith(")")));
2107
+ return `/${segments.join("/")}`;
2108
+ }
2109
+ function stripJsonComments(input) {
2110
+ let out = "";
2111
+ let i = 0;
2112
+ let inString = false;
2113
+ let stringChar = "";
2114
+ while (i < input.length) {
2115
+ const ch = input[i];
2116
+ if (inString) {
2117
+ out += ch;
2118
+ if (ch === "\\" && i + 1 < input.length) {
2119
+ out += input[i + 1];
2120
+ i += 2;
2121
+ continue;
2122
+ }
2123
+ if (ch === stringChar) inString = false;
2124
+ i++;
2125
+ continue;
2126
+ }
2127
+ if (ch === '"' || ch === "'") {
2128
+ inString = true;
2129
+ stringChar = ch;
2130
+ out += ch;
2131
+ i++;
2132
+ continue;
2133
+ }
2134
+ if (ch === "/" && input[i + 1] === "/") {
2135
+ while (i < input.length && input[i] !== "\n") i++;
2136
+ continue;
2137
+ }
2138
+ if (ch === "/" && input[i + 1] === "*") {
2139
+ i += 2;
2140
+ while (i < input.length && !(input[i] === "*" && input[i + 1] === "/")) i++;
2141
+ i += 2;
2142
+ continue;
2143
+ }
2144
+ out += ch;
2145
+ i++;
2146
+ }
2147
+ return out;
2148
+ }
2149
+ function loadTsconfigAliases(root) {
2150
+ for (const candidate of ["tsconfig.json", "jsconfig.json"]) {
2151
+ const configPath = import_node_path.default.join(root, candidate);
2152
+ if (!import_node_fs.default.existsSync(configPath)) continue;
2153
+ try {
2154
+ const raw = stripJsonComments(import_node_fs.default.readFileSync(configPath, "utf-8"));
2155
+ const parsed = JSON.parse(raw);
2156
+ const co = parsed.compilerOptions;
2157
+ if (!co?.paths) continue;
2158
+ const baseDir = import_node_path.default.join(root, co.baseUrl ?? ".");
2159
+ const paths = Object.entries(co.paths).map(([prefix, targets]) => ({
2160
+ prefix: prefix.replace(/\*$/, ""),
2161
+ targets: targets.map((t) => t.replace(/\*$/, ""))
2162
+ }));
2163
+ return { baseDir, paths };
2164
+ } catch {
2165
+ continue;
2166
+ }
2167
+ }
2168
+ return null;
2169
+ }
2170
+ function resolveSpecifier(specifier, fromFile, aliasInfo) {
2171
+ let candidate = null;
2172
+ if (specifier.startsWith(".")) {
2173
+ candidate = import_node_path.default.resolve(import_node_path.default.dirname(fromFile), specifier);
2174
+ } else if (aliasInfo) {
2175
+ for (const { prefix, targets } of aliasInfo.paths) {
2176
+ if (specifier.startsWith(prefix)) {
2177
+ const rest = specifier.slice(prefix.length);
2178
+ candidate = import_node_path.default.join(aliasInfo.baseDir, targets[0] ?? "", rest);
2179
+ break;
2180
+ }
2181
+ }
2182
+ }
2183
+ if (!candidate) return null;
2184
+ if (/\.(css|scss|sass|less|svg|png|jpe?g|gif|webp|json|woff2?|ttf|eot)$/i.test(candidate)) return null;
2185
+ if (import_node_fs.default.existsSync(candidate) && import_node_fs.default.statSync(candidate).isFile()) return candidate;
2186
+ for (const ext of CODE_EXTENSIONS) {
2187
+ if (import_node_fs.default.existsSync(candidate + ext)) return candidate + ext;
2188
+ }
2189
+ for (const ext of CODE_EXTENSIONS) {
2190
+ const indexPath = import_node_path.default.join(candidate, `index${ext}`);
2191
+ if (import_node_fs.default.existsSync(indexPath)) return indexPath;
2192
+ }
2193
+ return null;
2194
+ }
2195
+ function extractImportSpecifiers(source) {
2196
+ const specs = /* @__PURE__ */ new Set();
2197
+ for (const re of [IMPORT_FROM_RE, SIDE_EFFECT_IMPORT_RE, DYNAMIC_IMPORT_RE]) {
2198
+ re.lastIndex = 0;
2199
+ let m;
2200
+ while (m = re.exec(source)) {
2201
+ if (m[1]) specs.add(m[1]);
2202
+ }
2203
+ }
2204
+ return [...specs];
2205
+ }
2206
+ function buildRouteClassBuckets(root, srcDir, files) {
2207
+ const aliasInfo = loadTsconfigAliases(root);
2208
+ const classesByFile = /* @__PURE__ */ new Map();
2209
+ const adjacency = /* @__PURE__ */ new Map();
2210
+ for (const f of files) {
2211
+ const normalized = import_node_path.default.normalize(f.file);
2212
+ classesByFile.set(normalized, f.classes);
2213
+ if (!adjacency.has(normalized)) adjacency.set(normalized, /* @__PURE__ */ new Set());
2214
+ }
2215
+ for (const f of files) {
2216
+ const normalized = import_node_path.default.normalize(f.file);
2217
+ let source;
2218
+ try {
2219
+ source = import_node_fs.default.readFileSync(normalized, "utf-8");
2220
+ } catch {
2221
+ continue;
2222
+ }
2223
+ const edges = adjacency.get(normalized);
2224
+ for (const spec of extractImportSpecifiers(source)) {
2225
+ const resolved = resolveSpecifier(spec, normalized, aliasInfo);
2226
+ if (resolved && classesByFile.has(resolved)) edges.add(resolved);
2227
+ }
2228
+ }
2229
+ const routeEntries = [];
2230
+ for (const f of files) {
2231
+ const normalized = import_node_path.default.normalize(f.file).replace(/\\/g, "/");
2232
+ const route = deriveRouteFromPageFile(normalized);
2233
+ if (route) routeEntries.push({ route, file: import_node_path.default.normalize(f.file) });
2234
+ }
2235
+ const reachableByRoute = /* @__PURE__ */ new Map();
2236
+ for (const { route, file } of routeEntries) {
2237
+ const visited = /* @__PURE__ */ new Set();
2238
+ const queue = [file];
2239
+ while (queue.length > 0) {
2240
+ const current = queue.shift();
2241
+ if (visited.has(current)) continue;
2242
+ visited.add(current);
2243
+ for (const next of adjacency.get(current) ?? []) {
2244
+ if (!visited.has(next)) queue.push(next);
2245
+ }
2246
+ }
2247
+ reachableByRoute.set(route, visited);
2248
+ }
2249
+ const routesByFile = /* @__PURE__ */ new Map();
2250
+ for (const [route, fileSet] of reachableByRoute) {
2251
+ for (const file of fileSet) {
2252
+ if (!routesByFile.has(file)) routesByFile.set(file, /* @__PURE__ */ new Set());
2253
+ routesByFile.get(file).add(route);
2254
+ }
2255
+ }
2256
+ const result = { routes: /* @__PURE__ */ new Map(), global: /* @__PURE__ */ new Set() };
2257
+ for (const [file, classes] of classesByFile) {
2258
+ const normalizedSlash = file.replace(/\\/g, "/");
2259
+ const isSharedSegment = SHARED_SEGMENT_RE.test(normalizedSlash);
2260
+ const reachingRoutes = isSharedSegment ? /* @__PURE__ */ new Set() : routesByFile.get(file);
2261
+ if (!isSharedSegment && reachingRoutes && reachingRoutes.size === 1) {
2262
+ const [route] = reachingRoutes;
2263
+ if (!result.routes.has(route)) result.routes.set(route, /* @__PURE__ */ new Set());
2264
+ const bucket = result.routes.get(route);
2265
+ for (const cls of classes) bucket.add(cls);
2266
+ } else {
2267
+ for (const cls of classes) result.global.add(cls);
2268
+ }
2269
+ }
2270
+ return result;
2271
+ }
2272
+ function routeToCssFilename(route) {
2273
+ const slug = route.replace(/^\/+/, "").replace(/[^a-zA-Z0-9_-]+/g, "_").replace(/^_+|_+$/g, "");
2274
+ return `route_${slug || "root"}.css`;
2275
+ }
2276
+ var import_node_fs, import_node_path, CODE_EXTENSIONS, SHARED_SEGMENT_RE, PAGE_RE, ROOT_PAGE_RE, IMPORT_FROM_RE, SIDE_EFFECT_IMPORT_RE, DYNAMIC_IMPORT_RE;
2277
+ var init_routeGraph = __esm({
2278
+ "packages/domain/compiler/src/routeGraph.ts"() {
2279
+ "use strict";
2280
+ init_cjs_shims();
2281
+ import_node_fs = __toESM(require("fs"), 1);
2282
+ import_node_path = __toESM(require("path"), 1);
2283
+ CODE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs"];
2284
+ SHARED_SEGMENT_RE = /(?:^|[\\/])(layout|loading|error|template|not-found|default)\.(?:tsx|ts|jsx|js)$/;
2285
+ PAGE_RE = /(?:^|[\\/])app[\\/](.*?)[\\/]page\.(?:tsx|ts|jsx|js)$/;
2286
+ ROOT_PAGE_RE = /(?:^|[\\/])app[\\/]page\.(?:tsx|ts|jsx|js)$/;
2287
+ IMPORT_FROM_RE = /(?:import|export)(?:[^'"`;]*?)from\s+["']([^"']+)["']/g;
2288
+ SIDE_EFFECT_IMPORT_RE = /^\s*import\s+["']([^"']+)["']/gm;
2289
+ DYNAMIC_IMPORT_RE = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g;
2290
+ }
2291
+ });
2292
+
2100
2293
  // packages/domain/compiler/src/index.ts
2101
2294
  var src_exports = {};
2102
2295
  __export(src_exports, {
@@ -2114,6 +2307,7 @@ __export(src_exports, {
2114
2307
  batchExtractClasses: () => batchExtractClasses,
2115
2308
  batchExtractClassesNative: () => batchExtractClassesNative,
2116
2309
  bucketSort: () => bucketSort,
2310
+ buildRouteClassBuckets: () => buildRouteClassBuckets,
2117
2311
  buildStyleTag: () => buildStyleTag,
2118
2312
  cachePriority: () => cachePriority,
2119
2313
  cacheRead: () => cacheRead,
@@ -2173,6 +2367,7 @@ __export(src_exports, {
2173
2367
  generateStaticStateCss: () => generateStaticStateCss,
2174
2368
  generateStaticStateCssNative: () => generateStaticStateCssNative,
2175
2369
  generateSubComponentTypes: () => generateSubComponentTypes,
2370
+ getAllRegisteredClasses: () => getAllRegisteredClasses,
2176
2371
  getAllRoutes: () => getAllRoutes,
2177
2372
  getBucketEngine: () => getBucketEngine,
2178
2373
  getCacheOptimizationHints: () => getCacheOptimizationHints,
@@ -2276,6 +2471,7 @@ __export(src_exports, {
2276
2471
  resetMemoryStats: () => resetMemoryStats,
2277
2472
  resetNativeBridgeCache: () => resetNativeBridgeCache,
2278
2473
  resetResolverPoolStats: () => resetResolverPoolStats,
2474
+ resetRouteClassRegistry: () => resetRouteClassRegistry,
2279
2475
  resolveCascade: () => resolveCascade,
2280
2476
  resolveClassNames: () => resolveClassNames,
2281
2477
  resolveColorCached: () => resolveColorCached,
@@ -2287,6 +2483,7 @@ __export(src_exports, {
2287
2483
  resolveVariants: () => resolveVariants,
2288
2484
  reverseLookupProperty: () => reverseLookupProperty,
2289
2485
  reverseLookupValue: () => reverseLookupValue,
2486
+ routeToCssFilename: () => routeToCssFilename,
2290
2487
  runCssPipeline: () => runCssPipeline,
2291
2488
  runElimination: () => runElimination,
2292
2489
  runLoaderTransform: () => runLoaderTransform,
@@ -2354,13 +2551,13 @@ function extractContainerCssFromSource(source) {
2354
2551
  }
2355
2552
  return rules.join("\n");
2356
2553
  }
2357
- var import_node_fs, import_node_path, import_node_module4, _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2554
+ var import_node_fs2, import_node_path2, import_node_module4, _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, _fileClassesMap, _globalClasses, getRouteClasses, getAllRegisteredClasses, registerFileClasses, registerGlobalClasses, resetRouteClassRegistry, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2358
2555
  var init_src = __esm({
2359
2556
  "packages/domain/compiler/src/index.ts"() {
2360
2557
  "use strict";
2361
2558
  init_cjs_shims();
2362
- import_node_fs = __toESM(require("fs"), 1);
2363
- import_node_path = __toESM(require("path"), 1);
2559
+ import_node_fs2 = __toESM(require("fs"), 1);
2560
+ import_node_path2 = __toESM(require("path"), 1);
2364
2561
  import_node_module4 = require("module");
2365
2562
  init_nativeBridge();
2366
2563
  init_compiler();
@@ -2369,6 +2566,7 @@ var init_src = __esm({
2369
2566
  init_cache();
2370
2567
  init_redis();
2371
2568
  init_watch();
2569
+ init_routeGraph();
2372
2570
  _require2 = (0, import_node_module4.createRequire)(
2373
2571
  typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
2374
2572
  );
@@ -2463,7 +2661,7 @@ var init_src = __esm({
2463
2661
  };
2464
2662
  scanProjectUsage = (dirs, cwd) => {
2465
2663
  const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
2466
- const files = dirs.map((dir) => import_node_path.default.resolve(cwd, dir));
2664
+ const files = dirs.map((dir) => import_node_path2.default.resolve(cwd, dir));
2467
2665
  const results = batchExtractClasses2(files) || [];
2468
2666
  const combined = {};
2469
2667
  for (const result of results) {
@@ -2480,13 +2678,13 @@ var init_src = __esm({
2480
2678
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
2481
2679
  const allClasses = Object.keys(classes).sort();
2482
2680
  if (outputPath) {
2483
- import_node_fs.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2681
+ import_node_fs2.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2484
2682
  }
2485
2683
  return allClasses;
2486
2684
  };
2487
2685
  loadSafelist = (safelistPath) => {
2488
2686
  try {
2489
- const content = import_node_fs.default.readFileSync(safelistPath, "utf-8");
2687
+ const content = import_node_fs2.default.readFileSync(safelistPath, "utf-8");
2490
2688
  return JSON.parse(content);
2491
2689
  } catch {
2492
2690
  return [];
@@ -2500,8 +2698,8 @@ var init_src = __esm({
2500
2698
  "tailwind.config.cjs"
2501
2699
  ];
2502
2700
  for (const file of configFiles) {
2503
- const fullPath = import_node_path.default.join(cwd, file);
2504
- if (import_node_fs.default.existsSync(fullPath)) {
2701
+ const fullPath = import_node_path2.default.join(cwd, file);
2702
+ if (import_node_fs2.default.existsSync(fullPath)) {
2505
2703
  const mod = require(fullPath);
2506
2704
  return mod.default || mod;
2507
2705
  }
@@ -2511,9 +2709,9 @@ var init_src = __esm({
2511
2709
  getContentPaths = (cwd = process.cwd()) => {
2512
2710
  return {
2513
2711
  content: [
2514
- import_node_path.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2515
- import_node_path.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2516
- import_node_path.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2712
+ import_node_path2.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2713
+ import_node_path2.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2714
+ import_node_path2.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2517
2715
  ]
2518
2716
  };
2519
2717
  };
@@ -2584,10 +2782,38 @@ var init_src = __esm({
2584
2782
  }
2585
2783
  return ["/", "__global"];
2586
2784
  };
2587
- getRouteClasses = (_route) => /* @__PURE__ */ new Set();
2588
- registerFileClasses = (_filepath, _classes) => {
2785
+ _fileClassesMap = /* @__PURE__ */ new Map();
2786
+ _globalClasses = /* @__PURE__ */ new Set();
2787
+ getRouteClasses = (route) => {
2788
+ const result = /* @__PURE__ */ new Set();
2789
+ for (const [filepath, classes] of _fileClassesMap) {
2790
+ const fileRoute = fileToRoute(filepath) ?? "__global";
2791
+ if (fileRoute === route) {
2792
+ for (const cls of classes) result.add(cls);
2793
+ }
2794
+ }
2795
+ return result;
2796
+ };
2797
+ getAllRegisteredClasses = () => {
2798
+ const result = new Set(_globalClasses);
2799
+ for (const classes of _fileClassesMap.values()) {
2800
+ for (const cls of classes) result.add(cls);
2801
+ }
2802
+ return result;
2803
+ };
2804
+ registerFileClasses = (filepath, classes) => {
2805
+ if (!classes || classes.length === 0) {
2806
+ _fileClassesMap.delete(filepath);
2807
+ return;
2808
+ }
2809
+ _fileClassesMap.set(filepath, new Set(classes));
2810
+ };
2811
+ registerGlobalClasses = (classes) => {
2812
+ for (const cls of classes) _globalClasses.add(cls);
2589
2813
  };
2590
- registerGlobalClasses = (_classes) => {
2814
+ resetRouteClassRegistry = () => {
2815
+ _fileClassesMap.clear();
2816
+ _globalClasses.clear();
2591
2817
  };
2592
2818
  _incrementalEngineInstance = null;
2593
2819
  getIncrementalEngine = () => {
@@ -2783,6 +3009,7 @@ __export(internal_exports, {
2783
3009
  generateStaticStateCss: () => generateStaticStateCss,
2784
3010
  generateStaticStateCssNative: () => generateStaticStateCssNative,
2785
3011
  generateSubComponentTypes: () => generateSubComponentTypes,
3012
+ getAllRegisteredClasses: () => getAllRegisteredClasses,
2786
3013
  getAllRoutes: () => getAllRoutes,
2787
3014
  getBucketEngine: () => getBucketEngine,
2788
3015
  getCacheOptimizationHints: () => getCacheOptimizationHints,
@@ -2885,6 +3112,7 @@ __export(internal_exports, {
2885
3112
  resetIncrementalEngine: () => resetIncrementalEngine,
2886
3113
  resetMemoryStats: () => resetMemoryStats,
2887
3114
  resetResolverPoolStats: () => resetResolverPoolStats,
3115
+ resetRouteClassRegistry: () => resetRouteClassRegistry,
2888
3116
  resolveCascade: () => resolveCascade,
2889
3117
  resolveClassNames: () => resolveClassNames,
2890
3118
  resolveColorCached: () => resolveColorCached,
@@ -2975,17 +3203,17 @@ function getNative() {
2975
3203
  function* walkSourceFiles(dir) {
2976
3204
  let entries;
2977
3205
  try {
2978
- entries = import_node_fs2.default.readdirSync(dir, { withFileTypes: true });
3206
+ entries = import_node_fs3.default.readdirSync(dir, { withFileTypes: true });
2979
3207
  } catch {
2980
3208
  return;
2981
3209
  }
2982
3210
  for (const entry of entries) {
2983
- const fullPath = import_node_path2.default.join(dir, entry.name);
3211
+ const fullPath = import_node_path3.default.join(dir, entry.name);
2984
3212
  if (entry.isDirectory()) {
2985
3213
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
2986
3214
  yield* walkSourceFiles(fullPath);
2987
3215
  } else if (entry.isFile()) {
2988
- const ext = import_node_path2.default.extname(entry.name);
3216
+ const ext = import_node_path3.default.extname(entry.name);
2989
3217
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
2990
3218
  }
2991
3219
  }
@@ -3049,7 +3277,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3049
3277
  allConfigs.push(...configs);
3050
3278
  if (verbose) {
3051
3279
  process.stderr.write(
3052
- `[tw:static-state] ${import_node_path2.default.relative(srcDir, filePath)}: ${configs.length} komponen
3280
+ `[tw:static-state] ${import_node_path3.default.relative(srcDir, filePath)}: ${configs.length} komponen
3053
3281
  `
3054
3282
  );
3055
3283
  }
@@ -3060,7 +3288,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3060
3288
  if (filesScanned >= maxFiles) break;
3061
3289
  let source;
3062
3290
  try {
3063
- source = import_node_fs2.default.readFileSync(filePath, "utf-8");
3291
+ source = import_node_fs3.default.readFileSync(filePath, "utf-8");
3064
3292
  } catch {
3065
3293
  continue;
3066
3294
  }
@@ -3073,7 +3301,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3073
3301
  allConfigs.push(...configs);
3074
3302
  if (verbose) {
3075
3303
  process.stderr.write(
3076
- `[tw:static-state] ${import_node_path2.default.relative(srcDir, filePath)}: ${configs.length} komponen
3304
+ `[tw:static-state] ${import_node_path3.default.relative(srcDir, filePath)}: ${configs.length} komponen
3077
3305
  `
3078
3306
  );
3079
3307
  }
@@ -3167,12 +3395,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3167
3395
  resolvedCss: options.resolvedCss || ""
3168
3396
  // ← ensure always passed
3169
3397
  });
3170
- const twClassesDir = import_node_path2.default.join(import_node_path2.default.dirname(safelistPath), "tw-classes");
3171
- import_node_fs2.default.mkdirSync(twClassesDir, { recursive: true });
3172
- const stateFilePath = import_node_path2.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3398
+ const twClassesDir = import_node_path3.default.join(import_node_path3.default.dirname(safelistPath), "tw-classes");
3399
+ import_node_fs3.default.mkdirSync(twClassesDir, { recursive: true });
3400
+ const stateFilePath = import_node_path3.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3173
3401
  if (result.rulesGenerated === 0) {
3174
3402
  try {
3175
- import_node_fs2.default.writeFileSync(
3403
+ import_node_fs3.default.writeFileSync(
3176
3404
  stateFilePath,
3177
3405
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3178
3406
  "utf-8"
@@ -3182,7 +3410,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3182
3410
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3183
3411
  }
3184
3412
  try {
3185
- import_node_fs2.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3413
+ import_node_fs3.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3186
3414
  return [
3187
3415
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3188
3416
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3194,13 +3422,13 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3194
3422
  return `[tw:static-state] gagal tulis state CSS: ${msg}`;
3195
3423
  }
3196
3424
  }
3197
- var import_node_fs2, import_node_path2, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3425
+ var import_node_fs3, import_node_path3, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3198
3426
  var init_staticStateExtractor = __esm({
3199
3427
  "packages/domain/shared/src/staticStateExtractor.ts"() {
3200
3428
  "use strict";
3201
3429
  init_cjs_shims();
3202
- import_node_fs2 = __toESM(require("fs"));
3203
- import_node_path2 = __toESM(require("path"));
3430
+ import_node_fs3 = __toESM(require("fs"));
3431
+ import_node_path3 = __toESM(require("path"));
3204
3432
  SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
3205
3433
  IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
3206
3434
  _native = null;
@@ -3218,8 +3446,8 @@ function setGlobalLogFile(filePath) {
3218
3446
  _globalLogFile = filePath;
3219
3447
  _logFileInitialized = false;
3220
3448
  try {
3221
- import_node_fs3.default.mkdirSync(import_node_path3.default.dirname(filePath), { recursive: true });
3222
- import_node_fs3.default.writeFileSync(
3449
+ import_node_fs4.default.mkdirSync(import_node_path4.default.dirname(filePath), { recursive: true });
3450
+ import_node_fs4.default.writeFileSync(
3223
3451
  filePath,
3224
3452
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3225
3453
  `,
@@ -3232,7 +3460,7 @@ function setGlobalLogFile(filePath) {
3232
3460
  function writeToFile(line) {
3233
3461
  if (!_globalLogFile || !_logFileInitialized) return;
3234
3462
  try {
3235
- import_node_fs3.default.appendFileSync(_globalLogFile, line);
3463
+ import_node_fs4.default.appendFileSync(_globalLogFile, line);
3236
3464
  } catch {
3237
3465
  }
3238
3466
  }
@@ -3259,13 +3487,13 @@ function createLogger(prefix, level) {
3259
3487
  setLogFile: (filePath) => setGlobalLogFile(filePath)
3260
3488
  };
3261
3489
  }
3262
- var import_node_fs3, import_node_path3, LEVELS, _globalLogFile, _logFileInitialized, logger;
3490
+ var import_node_fs4, import_node_path4, LEVELS, _globalLogFile, _logFileInitialized, logger;
3263
3491
  var init_logger = __esm({
3264
3492
  "packages/domain/shared/src/logger.ts"() {
3265
3493
  "use strict";
3266
3494
  init_cjs_shims();
3267
- import_node_fs3 = __toESM(require("fs"));
3268
- import_node_path3 = __toESM(require("path"));
3495
+ import_node_fs4 = __toESM(require("fs"));
3496
+ import_node_path4 = __toESM(require("path"));
3269
3497
  LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3270
3498
  _globalLogFile = null;
3271
3499
  _logFileInitialized = false;
@@ -3303,9 +3531,9 @@ function createDebugLogger(namespace, label) {
3303
3531
  }
3304
3532
  };
3305
3533
  }
3306
- function formatIssuePath(path12) {
3307
- if (!path12 || path12.length === 0) return "(root)";
3308
- return path12.map(
3534
+ function formatIssuePath(path13) {
3535
+ if (!path13 || path13.length === 0) return "(root)";
3536
+ return path13.map(
3309
3537
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3310
3538
  ).join(".");
3311
3539
  }
@@ -3313,9 +3541,9 @@ function loadNativeBinding(options) {
3313
3541
  const { runtimeDir, candidates, isValid } = options;
3314
3542
  const loadErrors = [];
3315
3543
  for (const candidate of candidates) {
3316
- const candidatePath = import_node_path4.default.resolve(runtimeDir, candidate);
3544
+ const candidatePath = import_node_path5.default.resolve(runtimeDir, candidate);
3317
3545
  try {
3318
- if (!import_node_fs4.default.existsSync(candidatePath) && !import_node_fs4.default.existsSync(candidatePath + ".node")) {
3546
+ if (!import_node_fs5.default.existsSync(candidatePath) && !import_node_fs5.default.existsSync(candidatePath + ".node")) {
3319
3547
  continue;
3320
3548
  }
3321
3549
  const mod = requireNativeModule(candidatePath);
@@ -3347,9 +3575,9 @@ function resolveNativeBindingCandidates(options) {
3347
3575
  }
3348
3576
  }
3349
3577
  if (!includeDefaultCandidates) return candidates;
3350
- if (import_node_fs4.default.existsSync(runtimeDir)) {
3578
+ if (import_node_fs5.default.existsSync(runtimeDir)) {
3351
3579
  try {
3352
- for (const entry of import_node_fs4.default.readdirSync(runtimeDir)) {
3580
+ for (const entry of import_node_fs5.default.readdirSync(runtimeDir)) {
3353
3581
  if (entry.endsWith(".node")) candidates.push(entry);
3354
3582
  }
3355
3583
  } catch {
@@ -3358,34 +3586,34 @@ function resolveNativeBindingCandidates(options) {
3358
3586
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3359
3587
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
3360
3588
  for (const bin of BINARY_NAMES) {
3361
- candidates.push(import_node_path4.default.resolve(runtimeDir, `${bin}.node`));
3362
- candidates.push(import_node_path4.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3363
- candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3364
- candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3365
- candidates.push(import_node_path4.default.resolve(process.cwd(), "native", `${bin}.node`));
3366
- candidates.push(import_node_path4.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3367
- candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3368
- candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3369
- candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3589
+ candidates.push(import_node_path5.default.resolve(runtimeDir, `${bin}.node`));
3590
+ candidates.push(import_node_path5.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3591
+ candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3592
+ candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3593
+ candidates.push(import_node_path5.default.resolve(process.cwd(), "native", `${bin}.node`));
3594
+ candidates.push(import_node_path5.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3595
+ candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3596
+ candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3597
+ candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3370
3598
  }
3371
3599
  return Array.from(new Set(candidates));
3372
3600
  }
3373
3601
  function resolveRuntimeDir(dir, importMetaUrl2) {
3374
- if (dir) return import_node_path4.default.resolve(dir);
3602
+ if (dir) return import_node_path5.default.resolve(dir);
3375
3603
  try {
3376
- return import_node_path4.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl2));
3604
+ return import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl2));
3377
3605
  } catch {
3378
3606
  return process.cwd();
3379
3607
  }
3380
3608
  }
3381
- var import_node_crypto, import_node_fs4, import_node_path4, import_node_url, import_node_module5, TwError, _require3;
3609
+ var import_node_crypto, import_node_fs5, import_node_path5, import_node_url, import_node_module5, TwError, _require3;
3382
3610
  var init_src2 = __esm({
3383
3611
  "packages/domain/shared/src/index.ts"() {
3384
3612
  "use strict";
3385
3613
  init_cjs_shims();
3386
3614
  import_node_crypto = require("crypto");
3387
- import_node_fs4 = __toESM(require("fs"));
3388
- import_node_path4 = __toESM(require("path"));
3615
+ import_node_fs5 = __toESM(require("fs"));
3616
+ import_node_path5 = __toESM(require("path"));
3389
3617
  import_node_url = require("url");
3390
3618
  import_node_module5 = require("module");
3391
3619
  init_workerResolver();
@@ -3425,8 +3653,8 @@ var init_src2 = __esm({
3425
3653
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
3426
3654
  static fromZod(err) {
3427
3655
  const first = err.issues?.[0] ?? err.errors?.[0];
3428
- const path12 = formatIssuePath(first?.path);
3429
- const message = first ? `${path12}: ${first.message}` : "Schema validation failed";
3656
+ const path13 = formatIssuePath(first?.path);
3657
+ const message = first ? `${path13}: ${first.message}` : "Schema validation failed";
3430
3658
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
3431
3659
  }
3432
3660
  static wrap(source, code, err) {
@@ -3485,7 +3713,7 @@ function getDirname() {
3485
3713
  return __dirname;
3486
3714
  }
3487
3715
  if (typeof import_meta4 !== "undefined" && importMetaUrl) {
3488
- return import_node_path5.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
3716
+ return import_node_path6.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
3489
3717
  }
3490
3718
  return process.cwd();
3491
3719
  }
@@ -3697,12 +3925,12 @@ function hasNativeWatchBinding() {
3697
3925
  return false;
3698
3926
  }
3699
3927
  }
3700
- var import_node_path5, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
3928
+ var import_node_path6, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
3701
3929
  var init_native_bridge = __esm({
3702
3930
  "packages/domain/scanner/src/native-bridge.ts"() {
3703
3931
  "use strict";
3704
3932
  init_cjs_shims();
3705
- import_node_path5 = __toESM(require("path"), 1);
3933
+ import_node_path6 = __toESM(require("path"), 1);
3706
3934
  import_node_url2 = require("url");
3707
3935
  init_src2();
3708
3936
  import_meta4 = {};
@@ -3832,28 +4060,28 @@ var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSch
3832
4060
 
3833
4061
  // packages/presentation/next/src/withTailwindStyled.ts
3834
4062
  init_cjs_shims();
3835
- var import_node_fs9 = __toESM(require("fs"), 1);
4063
+ var import_node_fs10 = __toESM(require("fs"), 1);
3836
4064
  var import_node_module7 = require("module");
3837
- var import_node_path10 = __toESM(require("path"), 1);
4065
+ var import_node_path11 = __toESM(require("path"), 1);
3838
4066
  init_src2();
3839
4067
 
3840
4068
  // packages/domain/scanner/src/index.ts
3841
4069
  init_cjs_shims();
3842
- var import_node_fs6 = __toESM(require("fs"), 1);
4070
+ var import_node_fs7 = __toESM(require("fs"), 1);
3843
4071
  var import_node_module6 = require("module");
3844
- var import_node_path7 = __toESM(require("path"), 1);
4072
+ var import_node_path8 = __toESM(require("path"), 1);
3845
4073
  var import_node_url3 = require("url");
3846
4074
  var import_node_worker_threads = require("worker_threads");
3847
4075
  init_src2();
3848
4076
 
3849
4077
  // packages/domain/scanner/src/cache-native.ts
3850
4078
  init_cjs_shims();
3851
- var import_node_fs5 = __toESM(require("fs"), 1);
3852
- var import_node_path6 = __toESM(require("path"), 1);
4079
+ var import_node_fs6 = __toESM(require("fs"), 1);
4080
+ var import_node_path7 = __toESM(require("path"), 1);
3853
4081
  init_native_bridge();
3854
4082
  function defaultCachePath(rootDir, cacheDir) {
3855
- const dir = cacheDir ? import_node_path6.default.resolve(rootDir, cacheDir) : import_node_path6.default.join(process.cwd(), ".cache", "tailwind-styled");
3856
- return import_node_path6.default.join(dir, "scanner-cache.json");
4083
+ const dir = cacheDir ? import_node_path7.default.resolve(rootDir, cacheDir) : import_node_path7.default.join(process.cwd(), ".cache", "tailwind-styled");
4084
+ return import_node_path7.default.join(dir, "scanner-cache.json");
3857
4085
  }
3858
4086
  function metaPathFor(cachePath) {
3859
4087
  return cachePath.replace(/\.json$/, ".meta.json");
@@ -3867,7 +4095,7 @@ function getBinaryFingerprint() {
3867
4095
  _cachedFingerprint = null;
3868
4096
  return null;
3869
4097
  }
3870
- const stat = import_node_fs5.default.statSync(loadedPath);
4098
+ const stat = import_node_fs6.default.statSync(loadedPath);
3871
4099
  _cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
3872
4100
  } catch {
3873
4101
  _cachedFingerprint = null;
@@ -3877,13 +4105,13 @@ function getBinaryFingerprint() {
3877
4105
  var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
3878
4106
  function readCache(rootDir, cacheDir) {
3879
4107
  const cachePath = defaultCachePath(rootDir, cacheDir);
3880
- import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
4108
+ import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
3881
4109
  const currentFingerprint = getBinaryFingerprint();
3882
4110
  if (currentFingerprint !== null) {
3883
4111
  const metaPath = metaPathFor(cachePath);
3884
4112
  let storedFingerprint = null;
3885
4113
  try {
3886
- storedFingerprint = JSON.parse(import_node_fs5.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
4114
+ storedFingerprint = JSON.parse(import_node_fs6.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
3887
4115
  } catch {
3888
4116
  }
3889
4117
  if (storedFingerprint !== currentFingerprint) {
@@ -3907,7 +4135,7 @@ function readCache(rootDir, cacheDir) {
3907
4135
  }
3908
4136
  function writeCache(rootDir, entries, cacheDir) {
3909
4137
  const cachePath = defaultCachePath(rootDir, cacheDir);
3910
- import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
4138
+ import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
3911
4139
  const success = cacheWriteNative(cachePath, entries);
3912
4140
  if (!success) {
3913
4141
  throw new Error(
@@ -3917,7 +4145,7 @@ function writeCache(rootDir, entries, cacheDir) {
3917
4145
  const currentFingerprint = getBinaryFingerprint();
3918
4146
  if (currentFingerprint !== null) {
3919
4147
  try {
3920
- import_node_fs5.default.writeFileSync(
4148
+ import_node_fs6.default.writeFileSync(
3921
4149
  metaPathFor(cachePath),
3922
4150
  JSON.stringify({ binaryFingerprint: currentFingerprint }),
3923
4151
  "utf8"
@@ -3945,12 +4173,12 @@ init_native_bridge();
3945
4173
  init_cjs_shims();
3946
4174
  var import_zod2 = require("zod");
3947
4175
  init_src2();
3948
- var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
4176
+ var formatIssuePath2 = (path13) => path13.length > 0 ? path13.map(
3949
4177
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3950
4178
  ).join(".") : "<root>";
3951
4179
  var formatIssues2 = (error) => error.issues.map((issue) => {
3952
- const path12 = formatIssuePath2(issue.path);
3953
- return `${path12}: ${issue.message}`;
4180
+ const path13 = formatIssuePath2(issue.path);
4181
+ return `${path13}: ${issue.message}`;
3954
4182
  }).join("; ");
3955
4183
  var parseWithSchema2 = (schema, data, label) => {
3956
4184
  const parsed = schema.safeParse(data);
@@ -4011,7 +4239,7 @@ function getRuntimeDir() {
4011
4239
  return __dirname;
4012
4240
  }
4013
4241
  if (typeof import_meta5 !== "undefined" && importMetaUrl) {
4014
- return import_node_path7.default.dirname((0, import_node_url3.fileURLToPath)(importMetaUrl));
4242
+ return import_node_path8.default.dirname((0, import_node_url3.fileURLToPath)(importMetaUrl));
4015
4243
  }
4016
4244
  return process.cwd();
4017
4245
  }
@@ -4026,7 +4254,7 @@ var createNativeParserLoader = () => {
4026
4254
  const loadNativeParserBinding = () => {
4027
4255
  if (_state.binding !== void 0) return _state.binding;
4028
4256
  const runtimeDir = getRuntimeDir();
4029
- const req = (0, import_node_module6.createRequire)(import_node_path7.default.join(runtimeDir, "noop.cjs"));
4257
+ const req = (0, import_node_module6.createRequire)(import_node_path8.default.join(runtimeDir, "noop.cjs"));
4030
4258
  const _platform = process.platform;
4031
4259
  const _arch = process.arch;
4032
4260
  const _platformArch = `${_platform}-${_arch}`;
@@ -4034,27 +4262,27 @@ var createNativeParserLoader = () => {
4034
4262
  const candidates = [
4035
4263
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
4036
4264
  // cwd = repo root saat run dari root, atau package dir saat workspaces
4037
- import_node_path7.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4038
- import_node_path7.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4039
- import_node_path7.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4265
+ import_node_path8.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4266
+ import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4267
+ import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4040
4268
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
4041
4269
  // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
4042
- import_node_path7.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4043
- import_node_path7.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4044
- import_node_path7.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4270
+ import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4271
+ import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4272
+ import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4045
4273
  // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
4046
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4047
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4274
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4275
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4048
4276
  // 3 level fallback (jika package di-nest lebih dangkal)
4049
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4050
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4277
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4278
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4051
4279
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
4052
- import_node_path7.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4053
- import_node_path7.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4054
- import_node_path7.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4055
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4056
- import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4057
- import_node_path7.default.resolve(
4280
+ import_node_path8.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4281
+ import_node_path8.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4282
+ import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4283
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4284
+ import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4285
+ import_node_path8.default.resolve(
4058
4286
  runtimeDir,
4059
4287
  "..",
4060
4288
  "..",
@@ -4066,7 +4294,7 @@ var createNativeParserLoader = () => {
4066
4294
  )
4067
4295
  ];
4068
4296
  for (const fullPath of candidates) {
4069
- if (!import_node_fs6.default.existsSync(fullPath)) continue;
4297
+ if (!import_node_fs7.default.existsSync(fullPath)) continue;
4070
4298
  try {
4071
4299
  const required = req(fullPath);
4072
4300
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4107,19 +4335,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4107
4335
  if (!currentDir) continue;
4108
4336
  const entries = (() => {
4109
4337
  try {
4110
- return import_node_fs6.default.readdirSync(currentDir, { withFileTypes: true });
4338
+ return import_node_fs7.default.readdirSync(currentDir, { withFileTypes: true });
4111
4339
  } catch {
4112
4340
  return [];
4113
4341
  }
4114
4342
  })();
4115
4343
  for (const entry of entries) {
4116
- const fullPath = import_node_path7.default.join(currentDir, entry.name);
4344
+ const fullPath = import_node_path8.default.join(currentDir, entry.name);
4117
4345
  if (entry.isDirectory()) {
4118
4346
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
4119
4347
  continue;
4120
4348
  }
4121
4349
  if (!entry.isFile()) continue;
4122
- if (!extensionSet.has(import_node_path7.default.extname(entry.name))) continue;
4350
+ if (!extensionSet.has(import_node_path8.default.extname(entry.name))) continue;
4123
4351
  candidates.push(fullPath);
4124
4352
  }
4125
4353
  }
@@ -4203,7 +4431,7 @@ function scanWorkspace2(rootDir, options = {}) {
4203
4431
  for (const filePath of candidates) {
4204
4432
  const stat = (() => {
4205
4433
  try {
4206
- return import_node_fs6.default.statSync(filePath);
4434
+ return import_node_fs7.default.statSync(filePath);
4207
4435
  } catch {
4208
4436
  return null;
4209
4437
  }
@@ -4229,7 +4457,7 @@ function scanWorkspace2(rootDir, options = {}) {
4229
4457
  for (const { filePath, stat, size, cached } of ranked) {
4230
4458
  const content = (() => {
4231
4459
  try {
4232
- return import_node_fs6.default.readFileSync(filePath, "utf8");
4460
+ return import_node_fs7.default.readFileSync(filePath, "utf8");
4233
4461
  } catch {
4234
4462
  return null;
4235
4463
  }
@@ -4295,8 +4523,8 @@ init_src2();
4295
4523
 
4296
4524
  // packages/presentation/next/src/incrementalOrchestrator.ts
4297
4525
  init_cjs_shims();
4298
- var import_node_fs7 = __toESM(require("fs"), 1);
4299
- var import_node_path8 = __toESM(require("path"), 1);
4526
+ var import_node_fs8 = __toESM(require("fs"), 1);
4527
+ var import_node_path9 = __toESM(require("path"), 1);
4300
4528
  init_src();
4301
4529
  var _fingerprintCache = /* @__PURE__ */ new Map();
4302
4530
  function getNative2() {
@@ -4308,10 +4536,10 @@ function getNative2() {
4308
4536
  }
4309
4537
  function fingerprintFile(filePath) {
4310
4538
  try {
4311
- const stat = import_node_fs7.default.statSync(filePath);
4539
+ const stat = import_node_fs8.default.statSync(filePath);
4312
4540
  const native = getNative2();
4313
4541
  if (native?.create_fingerprint) {
4314
- const content = import_node_fs7.default.readFileSync(filePath, "utf-8");
4542
+ const content = import_node_fs8.default.readFileSync(filePath, "utf-8");
4315
4543
  const hash = native.create_fingerprint(filePath, content);
4316
4544
  return { hash, mtime: stat.mtimeMs };
4317
4545
  }
@@ -4351,9 +4579,9 @@ function hasSourceChanged(sourceFiles) {
4351
4579
  }
4352
4580
  function isIncrementalEnabled(cwd) {
4353
4581
  try {
4354
- const configPath = import_node_path8.default.join(cwd, "tailwind-styled.config.json");
4355
- if (!import_node_fs7.default.existsSync(configPath)) return false;
4356
- const config = JSON.parse(import_node_fs7.default.readFileSync(configPath, "utf-8"));
4582
+ const configPath = import_node_path9.default.join(cwd, "tailwind-styled.config.json");
4583
+ if (!import_node_fs8.default.existsSync(configPath)) return false;
4584
+ const config = JSON.parse(import_node_fs8.default.readFileSync(configPath, "utf-8"));
4357
4585
  return config.compiler?.incremental === true;
4358
4586
  } catch {
4359
4587
  return false;
@@ -4362,8 +4590,8 @@ function isIncrementalEnabled(cwd) {
4362
4590
 
4363
4591
  // packages/presentation/next/src/staticCssWebpackPlugin.ts
4364
4592
  init_cjs_shims();
4365
- var import_node_fs8 = __toESM(require("fs"), 1);
4366
- var import_node_path9 = __toESM(require("path"), 1);
4593
+ var import_node_fs9 = __toESM(require("fs"), 1);
4594
+ var import_node_path10 = __toESM(require("path"), 1);
4367
4595
  var _fileStaticCssMap = /* @__PURE__ */ new Map();
4368
4596
  function setFileStaticCss(filepath, css) {
4369
4597
  if (css && css.trim()) {
@@ -4397,14 +4625,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
4397
4625
  static PLUGIN_NAME = "TailwindStyledStaticCss";
4398
4626
  outPath;
4399
4627
  constructor(safelistPath) {
4400
- this.outPath = import_node_path9.default.join(import_node_path9.default.dirname(safelistPath), "_tw-state-static.css");
4628
+ this.outPath = import_node_path10.default.join(import_node_path10.default.dirname(safelistPath), "_tw-state-static.css");
4401
4629
  }
4402
4630
  apply(compiler) {
4403
4631
  compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
4404
4632
  try {
4405
4633
  const content = buildContent(_fileStaticCssMap);
4406
- import_node_fs8.default.mkdirSync(import_node_path9.default.dirname(this.outPath), { recursive: true });
4407
- import_node_fs8.default.writeFileSync(
4634
+ import_node_fs9.default.mkdirSync(import_node_path10.default.dirname(this.outPath), { recursive: true });
4635
+ import_node_fs9.default.writeFileSync(
4408
4636
  this.outPath,
4409
4637
  HEADER + (content || "/* no static rules yet */") + "\n",
4410
4638
  "utf-8"
@@ -4442,12 +4670,12 @@ var resolveLoaderPath2 = (basename) => {
4442
4670
  } catch {
4443
4671
  const runtimeDir = resolveRuntimeDir2();
4444
4672
  const candidates = [
4445
- import_node_path10.default.resolve(runtimeDir, `${basename}.mjs`),
4446
- import_node_path10.default.resolve(runtimeDir, `${basename}.js`),
4447
- import_node_path10.default.resolve(runtimeDir, `${basename}.cjs`)
4673
+ import_node_path11.default.resolve(runtimeDir, `${basename}.mjs`),
4674
+ import_node_path11.default.resolve(runtimeDir, `${basename}.js`),
4675
+ import_node_path11.default.resolve(runtimeDir, `${basename}.cjs`)
4448
4676
  ];
4449
4677
  for (const candidate of candidates) {
4450
- if (import_node_fs9.default.existsSync(candidate)) {
4678
+ if (import_node_fs10.default.existsSync(candidate)) {
4451
4679
  return candidate;
4452
4680
  }
4453
4681
  }
@@ -4485,7 +4713,7 @@ var createLoaderOptions = (options) => {
4485
4713
  preserveImports: true
4486
4714
  };
4487
4715
  if (options.verbose !== void 0) opts.verbose = options.verbose;
4488
- opts.safelistPath = options.safelistPath ?? import_node_path10.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4716
+ opts.safelistPath = options.safelistPath ?? import_node_path11.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4489
4717
  return Object.freeze(opts);
4490
4718
  };
4491
4719
  var buildTurbopackRules = (loaderPath, loaderOptions) => {
@@ -4498,7 +4726,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
4498
4726
  ])
4499
4727
  );
4500
4728
  };
4501
- var normalizeLoaderPath = (loaderPath) => import_node_path10.default.resolve(loaderPath);
4729
+ var normalizeLoaderPath = (loaderPath) => import_node_path11.default.resolve(loaderPath);
4502
4730
  var applyWebpackRule = (config, options, loaderPath) => {
4503
4731
  const loaderOptions = createLoaderOptions(options);
4504
4732
  const rules = config.module?.rules ?? [];
@@ -4515,7 +4743,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
4515
4743
  enforce: "pre",
4516
4744
  use: [{ loader: loaderPath, options: loaderOptions }]
4517
4745
  };
4518
- const safelistPath = loaderOptions.safelistPath ?? import_node_path10.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4746
+ const safelistPath = loaderOptions.safelistPath ?? import_node_path11.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
4519
4747
  const pluginAlreadyRegistered = (config.plugins ?? []).some(
4520
4748
  (p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
4521
4749
  );
@@ -4615,17 +4843,17 @@ function withTailwindStyled(options = {}) {
4615
4843
  return fullCss.slice(startIdx, endIdx + 1);
4616
4844
  };
4617
4845
  var extractUtilitiesLayer = extractUtilitiesLayer2;
4618
- const twClassesDir = import_node_path10.default.join(import_node_path10.default.dirname(safelistPath), "tw-classes");
4619
- import_node_fs9.default.mkdirSync(twClassesDir, { recursive: true });
4620
- setGlobalLogFile(import_node_path10.default.join(twClassesDir, "_tw-build.log"));
4621
- import_node_fs9.default.writeFileSync(
4622
- import_node_path10.default.join(twClassesDir, "_start.txt"),
4846
+ const twClassesDir = import_node_path11.default.join(import_node_path11.default.dirname(safelistPath), "tw-classes");
4847
+ import_node_fs10.default.mkdirSync(twClassesDir, { recursive: true });
4848
+ setGlobalLogFile(import_node_path11.default.join(twClassesDir, "_tw-build.log"));
4849
+ import_node_fs10.default.writeFileSync(
4850
+ import_node_path11.default.join(twClassesDir, "_start.txt"),
4623
4851
  String(Date.now()),
4624
4852
  "utf-8"
4625
4853
  );
4626
- const stateStaticPath = import_node_path10.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
4854
+ const stateStaticPath = import_node_path11.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
4627
4855
  try {
4628
- import_node_fs9.default.writeFileSync(
4856
+ import_node_fs10.default.writeFileSync(
4629
4857
  stateStaticPath,
4630
4858
  "/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
4631
4859
  "utf-8"
@@ -4641,14 +4869,14 @@ function withTailwindStyled(options = {}) {
4641
4869
  "src/index.css",
4642
4870
  "styles/globals.css"
4643
4871
  ];
4644
- const safelistDir = import_node_path10.default.dirname(safelistPath);
4872
+ const safelistDir = import_node_path11.default.dirname(safelistPath);
4645
4873
  for (const candidate of CSS_CANDIDATES) {
4646
- const candidatePath = import_node_path10.default.join(process.cwd(), candidate);
4647
- if (!import_node_fs9.default.existsSync(candidatePath)) continue;
4648
- const content = import_node_fs9.default.readFileSync(candidatePath, "utf-8");
4874
+ const candidatePath = import_node_path11.default.join(process.cwd(), candidate);
4875
+ if (!import_node_fs10.default.existsSync(candidatePath)) continue;
4876
+ const content = import_node_fs10.default.readFileSync(candidatePath, "utf-8");
4649
4877
  if (content.includes("_tw-state-static.css")) break;
4650
- const globalsDir = import_node_path10.default.dirname(candidatePath);
4651
- const rel = import_node_path10.default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
4878
+ const globalsDir = import_node_path11.default.dirname(candidatePath);
4879
+ const rel = import_node_path11.default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
4652
4880
  const importLine = `@import "./${rel}";`;
4653
4881
  const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
4654
4882
  let updated;
@@ -4662,7 +4890,7 @@ function withTailwindStyled(options = {}) {
4662
4890
  updated = `${importLine}
4663
4891
  ${content}`;
4664
4892
  }
4665
- import_node_fs9.default.writeFileSync(candidatePath, updated, "utf-8");
4893
+ import_node_fs10.default.writeFileSync(candidatePath, updated, "utf-8");
4666
4894
  if (options.verbose) {
4667
4895
  console.log(
4668
4896
  `[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
@@ -4674,27 +4902,27 @@ ${content}`;
4674
4902
  }
4675
4903
  if (!process.env.TW_NATIVE_PATH) {
4676
4904
  const runtimeDir = resolveRuntimeDir2();
4677
- const nativePath = import_node_path10.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
4678
- if (import_node_fs9.default.existsSync(nativePath)) {
4905
+ const nativePath = import_node_path11.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
4906
+ if (import_node_fs10.default.existsSync(nativePath)) {
4679
4907
  process.env.TW_NATIVE_PATH = nativePath;
4680
4908
  }
4681
4909
  }
4682
- const srcDir = import_node_path10.default.join(process.cwd(), "src");
4683
- if (import_node_fs9.default.existsSync(srcDir)) {
4910
+ const srcDir = import_node_path11.default.join(process.cwd(), "src");
4911
+ if (import_node_fs10.default.existsSync(srcDir)) {
4684
4912
  try {
4685
4913
  const result = scanWorkspace2(srcDir);
4686
4914
  if (result.uniqueClasses.length > 0) {
4687
4915
  let atomicWriteFile2 = function(filePath, content) {
4688
4916
  const tmpPath = `${filePath}.tmp`;
4689
4917
  try {
4690
- import_node_fs9.default.writeFileSync(tmpPath, content, "utf-8");
4691
- import_node_fs9.default.renameSync(tmpPath, filePath);
4918
+ import_node_fs10.default.writeFileSync(tmpPath, content, "utf-8");
4919
+ import_node_fs10.default.renameSync(tmpPath, filePath);
4692
4920
  } catch {
4693
4921
  try {
4694
- import_node_fs9.default.unlinkSync(tmpPath);
4922
+ import_node_fs10.default.unlinkSync(tmpPath);
4695
4923
  } catch {
4696
4924
  }
4697
- import_node_fs9.default.writeFileSync(filePath, content, "utf-8");
4925
+ import_node_fs10.default.writeFileSync(filePath, content, "utf-8");
4698
4926
  }
4699
4927
  };
4700
4928
  var atomicWriteFile = atomicWriteFile2;
@@ -4738,7 +4966,7 @@ ${content}`;
4738
4966
  "portrait",
4739
4967
  "landscape"
4740
4968
  ]);
4741
- const filteredClasses = result.uniqueClasses.filter((cls) => {
4969
+ const isValidTwClass = (cls) => {
4742
4970
  if (cls.includes(":")) {
4743
4971
  const prefix = cls.split(":")[0];
4744
4972
  if (!VALID_VARIANT_PREFIXES.has(prefix ?? "")) return false;
@@ -4746,7 +4974,8 @@ ${content}`;
4746
4974
  if (/\[[\d]+\.[\d]{2,}(?:px|rem|em|vh|vw|%)\]/.test(cls)) return false;
4747
4975
  if (/\[[\d]{5,}(?:px|rem|em)?\]/.test(cls)) return false;
4748
4976
  return true;
4749
- });
4977
+ };
4978
+ const filteredClasses = result.uniqueClasses.filter(isValidTwClass);
4750
4979
  let cssEntryContent = null;
4751
4980
  const CSS_CANDIDATES = [
4752
4981
  "src/app/globals.css",
@@ -4757,14 +4986,14 @@ ${content}`;
4757
4986
  "styles/globals.css"
4758
4987
  ];
4759
4988
  try {
4760
- const twConfigPath = import_node_path10.default.join(process.cwd(), "tailwind-styled.config.json");
4761
- if (import_node_fs9.default.existsSync(twConfigPath)) {
4762
- const twConfig = JSON.parse(import_node_fs9.default.readFileSync(twConfigPath, "utf-8"));
4989
+ const twConfigPath = import_node_path11.default.join(process.cwd(), "tailwind-styled.config.json");
4990
+ if (import_node_fs10.default.existsSync(twConfigPath)) {
4991
+ const twConfig = JSON.parse(import_node_fs10.default.readFileSync(twConfigPath, "utf-8"));
4763
4992
  const cssEntry = twConfig.css?.entry;
4764
4993
  if (cssEntry) {
4765
- const cssEntryPath = import_node_path10.default.join(process.cwd(), cssEntry);
4766
- if (import_node_fs9.default.existsSync(cssEntryPath)) {
4767
- cssEntryContent = import_node_fs9.default.readFileSync(cssEntryPath, "utf-8");
4994
+ const cssEntryPath = import_node_path11.default.join(process.cwd(), cssEntry);
4995
+ if (import_node_fs10.default.existsSync(cssEntryPath)) {
4996
+ cssEntryContent = import_node_fs10.default.readFileSync(cssEntryPath, "utf-8");
4768
4997
  }
4769
4998
  }
4770
4999
  }
@@ -4772,9 +5001,9 @@ ${content}`;
4772
5001
  }
4773
5002
  if (!cssEntryContent) {
4774
5003
  for (const candidate of CSS_CANDIDATES) {
4775
- const candidatePath = import_node_path10.default.join(process.cwd(), candidate);
4776
- if (import_node_fs9.default.existsSync(candidatePath)) {
4777
- cssEntryContent = import_node_fs9.default.readFileSync(candidatePath, "utf-8");
5004
+ const candidatePath = import_node_path11.default.join(process.cwd(), candidate);
5005
+ if (import_node_fs10.default.existsSync(candidatePath)) {
5006
+ cssEntryContent = import_node_fs10.default.readFileSync(candidatePath, "utf-8");
4778
5007
  break;
4779
5008
  }
4780
5009
  }
@@ -4782,8 +5011,8 @@ ${content}`;
4782
5011
  if (cssEntryContent) {
4783
5012
  cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
4784
5013
  }
4785
- const initialScanPath = import_node_path10.default.join(twClassesDir, "_initial-scan.css");
4786
- if (!import_node_fs9.default.existsSync(initialScanPath)) {
5014
+ const initialScanPath = import_node_path11.default.join(twClassesDir, "_initial-scan.css");
5015
+ if (!import_node_fs10.default.existsSync(initialScanPath)) {
4787
5016
  atomicWriteFile2(
4788
5017
  initialScanPath,
4789
5018
  "/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
@@ -4791,7 +5020,7 @@ ${content}`;
4791
5020
  }
4792
5021
  const sourceFiles = result.files?.map((f) => f.file) ?? [];
4793
5022
  const incremental = isIncrementalEnabled(process.cwd());
4794
- if (incremental && import_node_fs9.default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
5023
+ if (incremental && import_node_fs10.default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
4795
5024
  if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
4796
5025
  } else {
4797
5026
  void (async () => {
@@ -4818,6 +5047,77 @@ ${utilitiesOnly}`
4818
5047
  resolvedCss: css
4819
5048
  });
4820
5049
  if (options.verbose) console.log(summary);
5050
+ if (normalizedOptions.routeCss) {
5051
+ try {
5052
+ const buildRouteClassBuckets2 = compiler.buildRouteClassBuckets;
5053
+ const routeToCssFilename2 = compiler.routeToCssFilename;
5054
+ if (typeof buildRouteClassBuckets2 !== "function" || typeof routeToCssFilename2 !== "function") {
5055
+ throw new Error(
5056
+ "buildRouteClassBuckets/routeToCssFilename tidak tersedia di @tailwind-styled/compiler"
5057
+ );
5058
+ }
5059
+ const filesForGraph = result.files.map((f) => ({
5060
+ file: f.file,
5061
+ classes: f.classes.filter(isValidTwClass)
5062
+ }));
5063
+ const buckets = buildRouteClassBuckets2(process.cwd(), srcDir, filesForGraph);
5064
+ const cssManifestDir = import_node_path11.default.join(process.cwd(), ".next", "static", "css", "tw");
5065
+ import_node_fs10.default.mkdirSync(cssManifestDir, { recursive: true });
5066
+ const manifestRoutes = {};
5067
+ const usedFilenames = /* @__PURE__ */ new Set(["_global.css"]);
5068
+ const minifyManifestCss = process.env.NODE_ENV === "production";
5069
+ if (buckets.global.size > 0) {
5070
+ const globalCss = await generateCssForClasses2(
5071
+ Array.from(buckets.global),
5072
+ {},
5073
+ process.cwd(),
5074
+ cssEntryContent ?? void 0,
5075
+ minifyManifestCss
5076
+ );
5077
+ const globalUtilities = extractUtilitiesLayer2(globalCss);
5078
+ if (globalUtilities.trim()) {
5079
+ const filename = "_global.css";
5080
+ atomicWriteFile2(import_node_path11.default.join(cssManifestDir, filename), globalUtilities);
5081
+ manifestRoutes.__global = filename;
5082
+ }
5083
+ }
5084
+ for (const [route, classSet] of buckets.routes) {
5085
+ if (classSet.size === 0) continue;
5086
+ const routeCss = await generateCssForClasses2(
5087
+ Array.from(classSet),
5088
+ {},
5089
+ process.cwd(),
5090
+ cssEntryContent ?? void 0,
5091
+ minifyManifestCss
5092
+ );
5093
+ const routeUtilities = extractUtilitiesLayer2(routeCss);
5094
+ if (!routeUtilities.trim()) continue;
5095
+ let filename = routeToCssFilename2(route);
5096
+ let suffix = 2;
5097
+ while (usedFilenames.has(filename)) {
5098
+ filename = routeToCssFilename2(route).replace(/\.css$/, `_${suffix}.css`);
5099
+ suffix++;
5100
+ }
5101
+ usedFilenames.add(filename);
5102
+ atomicWriteFile2(import_node_path11.default.join(cssManifestDir, filename), routeUtilities);
5103
+ manifestRoutes[route] = filename;
5104
+ }
5105
+ atomicWriteFile2(
5106
+ import_node_path11.default.join(cssManifestDir, "css-manifest.json"),
5107
+ JSON.stringify({ routes: manifestRoutes }, null, 2)
5108
+ );
5109
+ if (options.verbose) {
5110
+ console.log(
5111
+ `[tailwind-styled] css-manifest.json ditulis di ${cssManifestDir} \u2014 ${buckets.routes.size} route eksklusif + ${manifestRoutes.__global ? "1" : "0"} global bucket.`
5112
+ );
5113
+ }
5114
+ } catch (err) {
5115
+ console.warn(
5116
+ "[tailwind-styled] Gagal tulis css-manifest.json:",
5117
+ err instanceof Error ? err.message : err
5118
+ );
5119
+ }
5120
+ }
4821
5121
  }
4822
5122
  } catch (err) {
4823
5123
  throw new Error(