tailwind-styled-v4 5.0.18 → 5.0.21

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 (76) hide show
  1. package/dist/{analyzeWorkspace-CopJNGmi.d.ts → analyzeWorkspace-B1_XRfdl.d.ts} +1 -0
  2. package/dist/{analyzeWorkspace-DpVPccjz.d.mts → analyzeWorkspace-hYfu4Hg3.d.mts} +1 -0
  3. package/dist/analyzer.d.mts +2 -2
  4. package/dist/analyzer.d.ts +2 -2
  5. package/dist/analyzer.js +5 -4
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +5 -4
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +3 -3
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +3 -3
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +38 -2
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +38 -2
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +43 -6
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +43 -6
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +177 -2
  22. package/dist/compiler.d.ts +177 -2
  23. package/dist/compiler.js +172 -10
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +159 -11
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/engine.d.mts +3 -3
  28. package/dist/engine.d.ts +3 -3
  29. package/dist/engine.js +182 -14
  30. package/dist/engine.js.map +1 -1
  31. package/dist/engine.mjs +182 -14
  32. package/dist/engine.mjs.map +1 -1
  33. package/dist/index-BFqmBxl9.d.mts +102 -0
  34. package/dist/{index-DJv28Uzq.d.mts → index-DQI6O24n.d.mts} +1 -1
  35. package/dist/index-DwNErRJ_.d.ts +102 -0
  36. package/dist/{index-BDQw13kn.d.ts → index-UkYbyBkR.d.ts} +1 -1
  37. package/dist/index.d.mts +2 -2
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +182 -14
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +182 -14
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/next.js +193 -11
  44. package/dist/next.js.map +1 -1
  45. package/dist/next.mjs +193 -11
  46. package/dist/next.mjs.map +1 -1
  47. package/dist/plugin-api.d.mts +3 -101
  48. package/dist/plugin-api.d.ts +3 -101
  49. package/dist/plugin.d.mts +3 -5
  50. package/dist/plugin.d.ts +3 -5
  51. package/dist/plugin.js +0 -97
  52. package/dist/plugin.js.map +1 -1
  53. package/dist/plugin.mjs +1 -77
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/shared.js +177 -10
  56. package/dist/shared.js.map +1 -1
  57. package/dist/shared.mjs +177 -10
  58. package/dist/shared.mjs.map +1 -1
  59. package/dist/turbopackLoader.js +179 -12
  60. package/dist/turbopackLoader.js.map +1 -1
  61. package/dist/turbopackLoader.mjs +179 -12
  62. package/dist/turbopackLoader.mjs.map +1 -1
  63. package/dist/tw.js +43 -6
  64. package/dist/tw.js.map +1 -1
  65. package/dist/tw.mjs +43 -6
  66. package/dist/tw.mjs.map +1 -1
  67. package/dist/vite.js +315 -147
  68. package/dist/vite.js.map +1 -1
  69. package/dist/vite.mjs +315 -147
  70. package/dist/vite.mjs.map +1 -1
  71. package/dist/webpackLoader.js +38 -2
  72. package/dist/webpackLoader.js.map +1 -1
  73. package/dist/webpackLoader.mjs +38 -2
  74. package/dist/webpackLoader.mjs.map +1 -1
  75. package/native/tailwind-styled-native.node +0 -0
  76. package/package.json +1 -1
@@ -180,8 +180,44 @@ var init_nativeBridge = __esm({
180
180
  try {
181
181
  const binding = _loadNative(result.path);
182
182
  if (isValidNativeBridge(binding)) {
183
- nativeBridge = binding;
184
- log("Native bridge loaded successfully from:", result.path);
183
+ const toCamelCase = (str) => {
184
+ return str.replace(/_([a-z0-9])/g, (_, g) => g.toUpperCase());
185
+ };
186
+ nativeBridge = new Proxy(binding, {
187
+ get(target, prop) {
188
+ if (typeof prop === "string") {
189
+ if (prop in target) {
190
+ return target[prop];
191
+ }
192
+ const camelKey = toCamelCase(prop);
193
+ if (camelKey in target) {
194
+ const val = target[camelKey];
195
+ if (typeof val === "function") {
196
+ return val.bind(target);
197
+ }
198
+ return val;
199
+ }
200
+ const napiKey = `${camelKey}Napi`;
201
+ if (napiKey in target) {
202
+ const val = target[napiKey];
203
+ if (typeof val === "function") {
204
+ return val.bind(target);
205
+ }
206
+ return val;
207
+ }
208
+ const napiInnerKey = `${camelKey}NapiInner`;
209
+ if (napiInnerKey in target) {
210
+ const val = target[napiInnerKey];
211
+ if (typeof val === "function") {
212
+ return val.bind(target);
213
+ }
214
+ return val;
215
+ }
216
+ }
217
+ return target[prop];
218
+ }
219
+ });
220
+ log("Native bridge loaded successfully and proxy-wrapped from:", result.path);
185
221
  return nativeBridge;
186
222
  }
187
223
  } catch (e) {
@@ -229,8 +265,8 @@ async function generateCssNative(classes, options) {
229
265
  return css;
230
266
  }
231
267
  function clearThemeCache() {
268
+ const native = getNativeBridge();
232
269
  try {
233
- const native = getNativeBridge();
234
270
  if (!native?.clearThemeCache) {
235
271
  return;
236
272
  }
@@ -238,6 +274,16 @@ function clearThemeCache() {
238
274
  } catch {
239
275
  }
240
276
  }
277
+ function resetCacheStats() {
278
+ const native = getNativeBridge();
279
+ try {
280
+ if (!native?.resetCacheStats) {
281
+ return;
282
+ }
283
+ native.resetCacheStats();
284
+ } catch {
285
+ }
286
+ }
241
287
  var init_cssGeneratorNative = __esm({
242
288
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
243
289
  init_nativeBridge();
@@ -363,6 +409,16 @@ function minifyCss(css) {
363
409
  if (!native?.minify_css) throw new Error("minify_css not available");
364
410
  return native.minify_css(css);
365
411
  }
412
+ function generateCss(ruleJson, minify) {
413
+ const native = getNativeBridge();
414
+ if (!native?.generate_css) throw new Error("generate_css not available");
415
+ return native.generate_css(ruleJson, minify);
416
+ }
417
+ function generateCssBatch(rulesJson, minify) {
418
+ const native = getNativeBridge();
419
+ if (!native?.generate_css_batch) throw new Error("generate_css_batch not available");
420
+ return native.generate_css_batch(rulesJson, minify);
421
+ }
366
422
  function compileAnimation(animationName, from, to) {
367
423
  const native = getNativeBridge();
368
424
  if (!native?.compile_animation) throw new Error("compile_animation not available");
@@ -800,7 +856,7 @@ function postProcessWithLightning(rawCss) {
800
856
  }
801
857
  return result.css;
802
858
  }
803
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
859
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true, minifier = "lightning") {
804
860
  const filtered = classes.filter(Boolean);
805
861
  const uniqueMap = /* @__PURE__ */ new Map();
806
862
  filtered.forEach((cls) => uniqueMap.set(cls, cls));
@@ -808,7 +864,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
808
864
  if (unique.length === 0) {
809
865
  return { css: "", classes: [], sizeBytes: 0, optimized: false };
810
866
  }
811
- const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
867
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root) + `|${minifier}`;
812
868
  const cached = _cssCache.get(cacheKey);
813
869
  if (cached) {
814
870
  _cacheHits++;
@@ -825,7 +881,14 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
825
881
  const theme = getThemeConfig();
826
882
  rawCss = await generateCssNative(unique, { theme });
827
883
  usedRustCompiler = true;
828
- const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
884
+ let finalCss = rawCss;
885
+ if (minify) {
886
+ if (minifier === "fast") {
887
+ finalCss = minifyCss(rawCss);
888
+ } else {
889
+ finalCss = postProcessWithLightning(rawCss);
890
+ }
891
+ }
829
892
  if (process.env.DEBUG?.includes("compiler")) {
830
893
  console.log(
831
894
  `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
@@ -861,6 +924,7 @@ var init_tailwindEngine = __esm({
861
924
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
862
925
  init_nativeBridge();
863
926
  init_cssGeneratorNative();
927
+ init_cssCompilationNative();
864
928
  createRequire(import.meta.url);
865
929
  _cssCache = /* @__PURE__ */ new Map();
866
930
  _cacheHits = 0;
@@ -893,9 +957,10 @@ __export(parser_exports, {
893
957
  mergeClassesStatic: () => mergeClassesStatic,
894
958
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
895
959
  normalizeClasses: () => normalizeClasses,
960
+ parseClass: () => parseClass,
896
961
  parseClasses: () => parseClasses
897
962
  });
898
- var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
963
+ var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
899
964
  var init_parser = __esm({
900
965
  "packages/domain/compiler/src/parser/index.ts"() {
901
966
  init_nativeBridge();
@@ -906,6 +971,14 @@ var init_parser = __esm({
906
971
  }
907
972
  return native.parseClasses(raw) || [];
908
973
  };
974
+ parseClass = (input) => {
975
+ const native = getNativeBridge();
976
+ if (!native?.parseClass) {
977
+ throw new Error("FATAL: Native binding 'parseClass' is required but not available.");
978
+ }
979
+ const result = native.parseClass(input);
980
+ return typeof result === "string" ? JSON.parse(result) : result;
981
+ };
909
982
  extractAllClasses = (source) => {
910
983
  const native = getNativeBridge();
911
984
  if (!native?.extractAllClasses) {
@@ -1037,6 +1110,35 @@ function mergeCssDeclarationsNative(cssChunks) {
1037
1110
  if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1038
1111
  return native.mergeCssDeclarations(cssChunks);
1039
1112
  }
1113
+ function getWeek6FeaturesStatus() {
1114
+ const native = getNativeBridge();
1115
+ if (!native?.getWeek6FeaturesStatus) throw new Error("getWeek6FeaturesStatus not available");
1116
+ const resultJson = native.getWeek6FeaturesStatus();
1117
+ return JSON.parse(resultJson);
1118
+ }
1119
+ function getMemoryStatsNative() {
1120
+ const native = getNativeBridge();
1121
+ if (!native?.getMemoryStatsNative) throw new Error("getMemoryStatsNative not available");
1122
+ const resultJson = native.getMemoryStatsNative();
1123
+ return JSON.parse(resultJson);
1124
+ }
1125
+ function getMemoryRecommendationsNative() {
1126
+ const native = getNativeBridge();
1127
+ if (!native?.getMemoryRecommendationsNative) throw new Error("getMemoryRecommendationsNative not available");
1128
+ const resultJson = native.getMemoryRecommendationsNative();
1129
+ return JSON.parse(resultJson);
1130
+ }
1131
+ function estimateOptimalCacheConfigNative(workloadType, expectedEntries) {
1132
+ const native = getNativeBridge();
1133
+ if (!native?.estimateOptimalCacheConfigNative) throw new Error("estimateOptimalCacheConfigNative not available");
1134
+ const resultJson = native.estimateOptimalCacheConfigNative(workloadType, expectedEntries);
1135
+ return JSON.parse(resultJson);
1136
+ }
1137
+ function resetMemoryStats() {
1138
+ const native = getNativeBridge();
1139
+ if (!native?.resetMemoryStats) throw new Error("resetMemoryStats not available");
1140
+ native.resetMemoryStats();
1141
+ }
1040
1142
  var init_analyzerNative = __esm({
1041
1143
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1042
1144
  init_nativeBridge();
@@ -1326,6 +1428,52 @@ function cachePriority(mtimeMs, sizeBytes, hitCount) {
1326
1428
  if (!native?.cache_priority) throw new Error("cache_priority not available");
1327
1429
  return native.cache_priority(mtimeMs, sizeBytes, hitCount);
1328
1430
  }
1431
+ function getResolverPoolStats() {
1432
+ const native = getNativeBridge();
1433
+ if (!native?.getResolverPoolStats) throw new Error("getResolverPoolStats not available");
1434
+ const statsJson = native.getResolverPoolStats();
1435
+ try {
1436
+ return JSON.parse(statsJson);
1437
+ } catch {
1438
+ return {
1439
+ hits: 0,
1440
+ misses: 0,
1441
+ total: 0,
1442
+ hit_rate: 0,
1443
+ cached_resolvers: 0
1444
+ };
1445
+ }
1446
+ }
1447
+ function clearResolverPool() {
1448
+ const native = getNativeBridge();
1449
+ if (!native?.clearResolverPool) throw new Error("clearResolverPool not available");
1450
+ const resultJson = native.clearResolverPool();
1451
+ try {
1452
+ return JSON.parse(resultJson);
1453
+ } catch {
1454
+ return { status: "error" };
1455
+ }
1456
+ }
1457
+ function resolveColorCached(themeId, color, configJson) {
1458
+ const native = getNativeBridge();
1459
+ if (!native?.resolveColorCached) throw new Error("resolveColorCached not available");
1460
+ return native.resolveColorCached(themeId, color, configJson);
1461
+ }
1462
+ function resolveSpacingCached(themeId, spacing, configJson) {
1463
+ const native = getNativeBridge();
1464
+ if (!native?.resolveSpacingCached) throw new Error("resolveSpacingCached not available");
1465
+ return native.resolveSpacingCached(themeId, spacing, configJson);
1466
+ }
1467
+ function resolveFontSizeCached(themeId, size, configJson) {
1468
+ const native = getNativeBridge();
1469
+ if (!native?.resolveFontSizeCached) throw new Error("resolveFontSizeCached not available");
1470
+ return native.resolveFontSizeCached(themeId, size, configJson);
1471
+ }
1472
+ function resetResolverPoolStats() {
1473
+ const native = getNativeBridge();
1474
+ if (!native?.resetResolverPoolStats) throw new Error("resetResolverPoolStats not available");
1475
+ native.resetResolverPoolStats();
1476
+ }
1329
1477
  var init_cacheNative = __esm({
1330
1478
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
1331
1479
  init_nativeBridge();
@@ -1974,9 +2122,9 @@ var init_src2 = __esm({
1974
2122
  if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
1975
2123
  return "__global";
1976
2124
  }
1977
- const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2125
+ const pageMatch = normalized.match(/(?:^|\/)app\/(.+?)\/page\.[tj]sx?$/);
1978
2126
  if (pageMatch) return `/${pageMatch[1]}`;
1979
- const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2127
+ const rootPage = normalized.match(/(?:^|\/)app\/page\.[tj]sx?$/);
1980
2128
  if (rootPage) return "/";
1981
2129
  return null;
1982
2130
  };
@@ -2135,6 +2283,7 @@ __export(internal_exports, {
2135
2283
  clearCssGenCache: () => clearCssGenCache,
2136
2284
  clearParseCache: () => clearParseCache,
2137
2285
  clearResolveCache: () => clearResolveCache,
2286
+ clearResolverPool: () => clearResolverPool,
2138
2287
  clearThemeCache: () => clearThemeCache,
2139
2288
  collectFiles: () => collectFiles,
2140
2289
  compileAnimation: () => compileAnimation,
@@ -2157,6 +2306,7 @@ __export(internal_exports, {
2157
2306
  eliminateDeadCssNative: () => eliminateDeadCssNative,
2158
2307
  emitPluginHook: () => emitPluginHook,
2159
2308
  estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
2309
+ estimateOptimalCacheConfigNative: () => estimateOptimalCacheConfigNative,
2160
2310
  extractAllClasses: () => extractAllClasses,
2161
2311
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
2162
2312
  extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
@@ -2170,6 +2320,8 @@ __export(internal_exports, {
2170
2320
  fileToRoute: () => fileToRoute,
2171
2321
  findDeadVariants: () => findDeadVariants,
2172
2322
  generateAtomicCss: () => generateAtomicCss,
2323
+ generateCss: () => generateCss,
2324
+ generateCssBatch: () => generateCssBatch,
2173
2325
  generateCssForClasses: () => generateCssForClasses,
2174
2326
  generateCssNative: () => generateCssNative,
2175
2327
  generateSafelist: () => generateSafelist,
@@ -2185,10 +2337,14 @@ __export(internal_exports, {
2185
2337
  getCompilerDiagnostics: () => getCompilerDiagnostics,
2186
2338
  getContentPaths: () => getContentPaths,
2187
2339
  getIncrementalEngine: () => getIncrementalEngine,
2340
+ getMemoryRecommendationsNative: () => getMemoryRecommendationsNative,
2341
+ getMemoryStatsNative: () => getMemoryStatsNative,
2188
2342
  getNativeBridge: () => getNativeBridge,
2189
2343
  getPluginHooks: () => getPluginHooks,
2344
+ getResolverPoolStats: () => getResolverPoolStats,
2190
2345
  getRouteClasses: () => getRouteClasses,
2191
2346
  getWatchStats: () => getWatchStats,
2347
+ getWeek6FeaturesStatus: () => getWeek6FeaturesStatus,
2192
2348
  hasTwUsage: () => hasTwUsage,
2193
2349
  hashContent: () => hashContent,
2194
2350
  hoistComponentsNative: () => hoistComponentsNative,
@@ -2217,6 +2373,7 @@ __export(internal_exports, {
2217
2373
  normalizeClasses: () => normalizeClasses,
2218
2374
  optimizeCssNative: () => optimizeCssNative,
2219
2375
  parseAtomicClass: () => parseAtomicClass,
2376
+ parseClass: () => parseClass,
2220
2377
  parseClasses: () => parseClasses,
2221
2378
  pollWatchEvents: () => pollWatchEvents,
2222
2379
  processFileChange: () => processFileChange,
@@ -2268,12 +2425,18 @@ __export(internal_exports, {
2268
2425
  registerPropertyName: () => registerPropertyName,
2269
2426
  registerValueName: () => registerValueName,
2270
2427
  resetBucketEngine: () => resetBucketEngine,
2428
+ resetCacheStats: () => resetCacheStats,
2271
2429
  resetCompilationMetrics: () => resetCompilationMetrics,
2272
2430
  resetIncrementalEngine: () => resetIncrementalEngine,
2431
+ resetMemoryStats: () => resetMemoryStats,
2432
+ resetResolverPoolStats: () => resetResolverPoolStats,
2273
2433
  resolveCascade: () => resolveCascade,
2274
2434
  resolveClassNames: () => resolveClassNames,
2435
+ resolveColorCached: () => resolveColorCached,
2275
2436
  resolveConflictGroup: () => resolveConflictGroup,
2437
+ resolveFontSizeCached: () => resolveFontSizeCached,
2276
2438
  resolveSimpleVariants: () => resolveSimpleVariants,
2439
+ resolveSpacingCached: () => resolveSpacingCached,
2277
2440
  resolveThemeValue: () => resolveThemeValue,
2278
2441
  resolveVariants: () => resolveVariants,
2279
2442
  reverseLookupProperty: () => reverseLookupProperty,
@@ -2377,8 +2540,8 @@ function detectRouter(resourcePath) {
2377
2540
  var NEXT_RSC_ENTRIES = /(?:^|[\\/])(?:layout|page|loading|error|not-found|template|default)\.[jt]sx?$/;
2378
2541
  function isSkippable(resourcePath) {
2379
2542
  const normalized = resourcePath.replace(/\\/g, "/");
2380
- return normalized.includes("/node_modules/") || normalized.endsWith(".d.ts") || normalized.endsWith(".d.mts") || normalized.endsWith(".d.cts") || // Skip CSS/assets
2381
- /\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized) || // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,
2543
+ return normalized.includes("/node_modules/") || normalized.endsWith(".d.ts") || normalized.endsWith(".d.mts") || normalized.endsWith(".d.cts") || // Skip non-JS files that Turbopack may pass to the loader (no rule-level exclude)
2544
+ /\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot|md|mdx|txt|yaml|yml|json|tsbuildinfo)$/.test(normalized) || // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,
2382
2545
  // jadi guard ini menggantikan NEXT_RSC_ENTRIES exclude yang ada di webpack path.
2383
2546
  NEXT_RSC_ENTRIES.test(normalized);
2384
2547
  }
@@ -2487,7 +2650,11 @@ function writePerFileSafelist(safelistPath, resourcePath, classes) {
2487
2650
  }
2488
2651
  }
2489
2652
  function turbopackLoader(source, options = {}) {
2490
- if (isSkippable(this.resourcePath)) return source;
2653
+ if (isSkippable(this.resourcePath)) {
2654
+ const isRscEntry = NEXT_RSC_ENTRIES.test(this.resourcePath.replace(/\\/g, "/"));
2655
+ const hasUseClient = /^\s*["'](use client)["']/.test(source);
2656
+ if (!isRscEntry || !hasUseClient) return source;
2657
+ }
2491
2658
  const router = detectRouter(this.resourcePath);
2492
2659
  const nextMajor = parseNum(options.nextMajor);
2493
2660
  const debug = parseBool(options.debug);