tailwind-styled-v4 5.0.18 → 5.0.20

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 (66) 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 +177 -13
  30. package/dist/engine.js.map +1 -1
  31. package/dist/engine.mjs +177 -13
  32. package/dist/engine.mjs.map +1 -1
  33. package/dist/{index-DJv28Uzq.d.mts → index-DQI6O24n.d.mts} +1 -1
  34. package/dist/{index-BDQw13kn.d.ts → index-UkYbyBkR.d.ts} +1 -1
  35. package/dist/index.d.mts +2 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +177 -13
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +177 -13
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/next.js +188 -10
  42. package/dist/next.js.map +1 -1
  43. package/dist/next.mjs +188 -10
  44. package/dist/next.mjs.map +1 -1
  45. package/dist/shared.js +172 -9
  46. package/dist/shared.js.map +1 -1
  47. package/dist/shared.mjs +172 -9
  48. package/dist/shared.mjs.map +1 -1
  49. package/dist/turbopackLoader.js +172 -9
  50. package/dist/turbopackLoader.js.map +1 -1
  51. package/dist/turbopackLoader.mjs +172 -9
  52. package/dist/turbopackLoader.mjs.map +1 -1
  53. package/dist/tw.js +43 -6
  54. package/dist/tw.js.map +1 -1
  55. package/dist/tw.mjs +43 -6
  56. package/dist/tw.mjs.map +1 -1
  57. package/dist/vite.js +310 -146
  58. package/dist/vite.js.map +1 -1
  59. package/dist/vite.mjs +310 -146
  60. package/dist/vite.mjs.map +1 -1
  61. package/dist/webpackLoader.js +38 -2
  62. package/dist/webpackLoader.js.map +1 -1
  63. package/dist/webpackLoader.mjs +38 -2
  64. package/dist/webpackLoader.mjs.map +1 -1
  65. package/native/tailwind-styled-native.node +0 -0
  66. package/package.json +1 -1
package/dist/engine.mjs CHANGED
@@ -1024,8 +1024,44 @@ var init_nativeBridge = __esm({
1024
1024
  try {
1025
1025
  const binding = _loadNative(result.path);
1026
1026
  if (isValidNativeBridge(binding)) {
1027
- nativeBridge = binding;
1028
- log("Native bridge loaded successfully from:", result.path);
1027
+ const toCamelCase = (str) => {
1028
+ return str.replace(/_([a-z0-9])/g, (_, g) => g.toUpperCase());
1029
+ };
1030
+ nativeBridge = new Proxy(binding, {
1031
+ get(target, prop) {
1032
+ if (typeof prop === "string") {
1033
+ if (prop in target) {
1034
+ return target[prop];
1035
+ }
1036
+ const camelKey = toCamelCase(prop);
1037
+ if (camelKey in target) {
1038
+ const val = target[camelKey];
1039
+ if (typeof val === "function") {
1040
+ return val.bind(target);
1041
+ }
1042
+ return val;
1043
+ }
1044
+ const napiKey = `${camelKey}Napi`;
1045
+ if (napiKey in target) {
1046
+ const val = target[napiKey];
1047
+ if (typeof val === "function") {
1048
+ return val.bind(target);
1049
+ }
1050
+ return val;
1051
+ }
1052
+ const napiInnerKey = `${camelKey}NapiInner`;
1053
+ if (napiInnerKey in target) {
1054
+ const val = target[napiInnerKey];
1055
+ if (typeof val === "function") {
1056
+ return val.bind(target);
1057
+ }
1058
+ return val;
1059
+ }
1060
+ }
1061
+ return target[prop];
1062
+ }
1063
+ });
1064
+ log("Native bridge loaded successfully and proxy-wrapped from:", result.path);
1029
1065
  return nativeBridge;
1030
1066
  }
1031
1067
  } catch (e) {
@@ -1073,8 +1109,8 @@ async function generateCssNative(classes, options) {
1073
1109
  return css;
1074
1110
  }
1075
1111
  function clearThemeCache() {
1112
+ const native = getNativeBridge();
1076
1113
  try {
1077
- const native = getNativeBridge();
1078
1114
  if (!native?.clearThemeCache) {
1079
1115
  return;
1080
1116
  }
@@ -1082,6 +1118,16 @@ function clearThemeCache() {
1082
1118
  } catch {
1083
1119
  }
1084
1120
  }
1121
+ function resetCacheStats() {
1122
+ const native = getNativeBridge();
1123
+ try {
1124
+ if (!native?.resetCacheStats) {
1125
+ return;
1126
+ }
1127
+ native.resetCacheStats();
1128
+ } catch {
1129
+ }
1130
+ }
1085
1131
  var init_cssGeneratorNative = __esm({
1086
1132
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1087
1133
  init_nativeBridge();
@@ -1207,6 +1253,16 @@ function minifyCss(css) {
1207
1253
  if (!native?.minify_css) throw new Error("minify_css not available");
1208
1254
  return native.minify_css(css);
1209
1255
  }
1256
+ function generateCss(ruleJson, minify) {
1257
+ const native = getNativeBridge();
1258
+ if (!native?.generate_css) throw new Error("generate_css not available");
1259
+ return native.generate_css(ruleJson, minify);
1260
+ }
1261
+ function generateCssBatch(rulesJson, minify) {
1262
+ const native = getNativeBridge();
1263
+ if (!native?.generate_css_batch) throw new Error("generate_css_batch not available");
1264
+ return native.generate_css_batch(rulesJson, minify);
1265
+ }
1210
1266
  function compileAnimation(animationName, from, to) {
1211
1267
  const native = getNativeBridge();
1212
1268
  if (!native?.compile_animation) throw new Error("compile_animation not available");
@@ -1644,7 +1700,7 @@ function postProcessWithLightning(rawCss) {
1644
1700
  }
1645
1701
  return result.css;
1646
1702
  }
1647
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1703
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true, minifier = "lightning") {
1648
1704
  const filtered = classes.filter(Boolean);
1649
1705
  const uniqueMap = /* @__PURE__ */ new Map();
1650
1706
  filtered.forEach((cls) => uniqueMap.set(cls, cls));
@@ -1652,7 +1708,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1652
1708
  if (unique.length === 0) {
1653
1709
  return { css: "", classes: [], sizeBytes: 0, optimized: false };
1654
1710
  }
1655
- const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
1711
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root) + `|${minifier}`;
1656
1712
  const cached = _cssCache.get(cacheKey);
1657
1713
  if (cached) {
1658
1714
  _cacheHits++;
@@ -1669,7 +1725,14 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
1669
1725
  const theme = getThemeConfig();
1670
1726
  rawCss = await generateCssNative(unique, { theme });
1671
1727
  usedRustCompiler = true;
1672
- const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
1728
+ let finalCss = rawCss;
1729
+ if (minify) {
1730
+ if (minifier === "fast") {
1731
+ finalCss = minifyCss(rawCss);
1732
+ } else {
1733
+ finalCss = postProcessWithLightning(rawCss);
1734
+ }
1735
+ }
1673
1736
  if (process.env.DEBUG?.includes("compiler")) {
1674
1737
  console.log(
1675
1738
  `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
@@ -1705,6 +1768,7 @@ var init_tailwindEngine = __esm({
1705
1768
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1706
1769
  init_nativeBridge();
1707
1770
  init_cssGeneratorNative();
1771
+ init_cssCompilationNative();
1708
1772
  createRequire(import.meta.url);
1709
1773
  _cssCache = /* @__PURE__ */ new Map();
1710
1774
  _cacheHits = 0;
@@ -1737,9 +1801,10 @@ __export(parser_exports, {
1737
1801
  mergeClassesStatic: () => mergeClassesStatic,
1738
1802
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
1739
1803
  normalizeClasses: () => normalizeClasses,
1804
+ parseClass: () => parseClass,
1740
1805
  parseClasses: () => parseClasses
1741
1806
  });
1742
- var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1807
+ var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1743
1808
  var init_parser = __esm({
1744
1809
  "packages/domain/compiler/src/parser/index.ts"() {
1745
1810
  init_nativeBridge();
@@ -1750,6 +1815,14 @@ var init_parser = __esm({
1750
1815
  }
1751
1816
  return native.parseClasses(raw) || [];
1752
1817
  };
1818
+ parseClass = (input) => {
1819
+ const native = getNativeBridge();
1820
+ if (!native?.parseClass) {
1821
+ throw new Error("FATAL: Native binding 'parseClass' is required but not available.");
1822
+ }
1823
+ const result = native.parseClass(input);
1824
+ return typeof result === "string" ? JSON.parse(result) : result;
1825
+ };
1753
1826
  extractAllClasses = (source) => {
1754
1827
  const native = getNativeBridge();
1755
1828
  if (!native?.extractAllClasses) {
@@ -1881,6 +1954,35 @@ function mergeCssDeclarationsNative(cssChunks) {
1881
1954
  if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1882
1955
  return native.mergeCssDeclarations(cssChunks);
1883
1956
  }
1957
+ function getWeek6FeaturesStatus() {
1958
+ const native = getNativeBridge();
1959
+ if (!native?.getWeek6FeaturesStatus) throw new Error("getWeek6FeaturesStatus not available");
1960
+ const resultJson = native.getWeek6FeaturesStatus();
1961
+ return JSON.parse(resultJson);
1962
+ }
1963
+ function getMemoryStatsNative() {
1964
+ const native = getNativeBridge();
1965
+ if (!native?.getMemoryStatsNative) throw new Error("getMemoryStatsNative not available");
1966
+ const resultJson = native.getMemoryStatsNative();
1967
+ return JSON.parse(resultJson);
1968
+ }
1969
+ function getMemoryRecommendationsNative() {
1970
+ const native = getNativeBridge();
1971
+ if (!native?.getMemoryRecommendationsNative) throw new Error("getMemoryRecommendationsNative not available");
1972
+ const resultJson = native.getMemoryRecommendationsNative();
1973
+ return JSON.parse(resultJson);
1974
+ }
1975
+ function estimateOptimalCacheConfigNative(workloadType, expectedEntries) {
1976
+ const native = getNativeBridge();
1977
+ if (!native?.estimateOptimalCacheConfigNative) throw new Error("estimateOptimalCacheConfigNative not available");
1978
+ const resultJson = native.estimateOptimalCacheConfigNative(workloadType, expectedEntries);
1979
+ return JSON.parse(resultJson);
1980
+ }
1981
+ function resetMemoryStats() {
1982
+ const native = getNativeBridge();
1983
+ if (!native?.resetMemoryStats) throw new Error("resetMemoryStats not available");
1984
+ native.resetMemoryStats();
1985
+ }
1884
1986
  var init_analyzerNative = __esm({
1885
1987
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1886
1988
  init_nativeBridge();
@@ -2170,6 +2272,52 @@ function cachePriority(mtimeMs, sizeBytes, hitCount) {
2170
2272
  if (!native?.cache_priority) throw new Error("cache_priority not available");
2171
2273
  return native.cache_priority(mtimeMs, sizeBytes, hitCount);
2172
2274
  }
2275
+ function getResolverPoolStats() {
2276
+ const native = getNativeBridge();
2277
+ if (!native?.getResolverPoolStats) throw new Error("getResolverPoolStats not available");
2278
+ const statsJson = native.getResolverPoolStats();
2279
+ try {
2280
+ return JSON.parse(statsJson);
2281
+ } catch {
2282
+ return {
2283
+ hits: 0,
2284
+ misses: 0,
2285
+ total: 0,
2286
+ hit_rate: 0,
2287
+ cached_resolvers: 0
2288
+ };
2289
+ }
2290
+ }
2291
+ function clearResolverPool() {
2292
+ const native = getNativeBridge();
2293
+ if (!native?.clearResolverPool) throw new Error("clearResolverPool not available");
2294
+ const resultJson = native.clearResolverPool();
2295
+ try {
2296
+ return JSON.parse(resultJson);
2297
+ } catch {
2298
+ return { status: "error" };
2299
+ }
2300
+ }
2301
+ function resolveColorCached(themeId, color, configJson) {
2302
+ const native = getNativeBridge();
2303
+ if (!native?.resolveColorCached) throw new Error("resolveColorCached not available");
2304
+ return native.resolveColorCached(themeId, color, configJson);
2305
+ }
2306
+ function resolveSpacingCached(themeId, spacing, configJson) {
2307
+ const native = getNativeBridge();
2308
+ if (!native?.resolveSpacingCached) throw new Error("resolveSpacingCached not available");
2309
+ return native.resolveSpacingCached(themeId, spacing, configJson);
2310
+ }
2311
+ function resolveFontSizeCached(themeId, size, configJson) {
2312
+ const native = getNativeBridge();
2313
+ if (!native?.resolveFontSizeCached) throw new Error("resolveFontSizeCached not available");
2314
+ return native.resolveFontSizeCached(themeId, size, configJson);
2315
+ }
2316
+ function resetResolverPoolStats() {
2317
+ const native = getNativeBridge();
2318
+ if (!native?.resetResolverPoolStats) throw new Error("resetResolverPoolStats not available");
2319
+ native.resetResolverPoolStats();
2320
+ }
2173
2321
  var init_cacheNative = __esm({
2174
2322
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
2175
2323
  init_nativeBridge();
@@ -2818,9 +2966,9 @@ var init_src = __esm({
2818
2966
  if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
2819
2967
  return "__global";
2820
2968
  }
2821
- const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2969
+ const pageMatch = normalized.match(/(?:^|\/)app\/(.+?)\/page\.[tj]sx?$/);
2822
2970
  if (pageMatch) return `/${pageMatch[1]}`;
2823
- const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2971
+ const rootPage = normalized.match(/(?:^|\/)app\/page\.[tj]sx?$/);
2824
2972
  if (rootPage) return "/";
2825
2973
  return null;
2826
2974
  };
@@ -2979,6 +3127,7 @@ __export(internal_exports, {
2979
3127
  clearCssGenCache: () => clearCssGenCache,
2980
3128
  clearParseCache: () => clearParseCache,
2981
3129
  clearResolveCache: () => clearResolveCache,
3130
+ clearResolverPool: () => clearResolverPool,
2982
3131
  clearThemeCache: () => clearThemeCache,
2983
3132
  collectFiles: () => collectFiles,
2984
3133
  compileAnimation: () => compileAnimation,
@@ -3001,6 +3150,7 @@ __export(internal_exports, {
3001
3150
  eliminateDeadCssNative: () => eliminateDeadCssNative,
3002
3151
  emitPluginHook: () => emitPluginHook,
3003
3152
  estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
3153
+ estimateOptimalCacheConfigNative: () => estimateOptimalCacheConfigNative,
3004
3154
  extractAllClasses: () => extractAllClasses,
3005
3155
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
3006
3156
  extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
@@ -3014,6 +3164,8 @@ __export(internal_exports, {
3014
3164
  fileToRoute: () => fileToRoute,
3015
3165
  findDeadVariants: () => findDeadVariants,
3016
3166
  generateAtomicCss: () => generateAtomicCss,
3167
+ generateCss: () => generateCss,
3168
+ generateCssBatch: () => generateCssBatch,
3017
3169
  generateCssForClasses: () => generateCssForClasses,
3018
3170
  generateCssNative: () => generateCssNative,
3019
3171
  generateSafelist: () => generateSafelist,
@@ -3029,10 +3181,14 @@ __export(internal_exports, {
3029
3181
  getCompilerDiagnostics: () => getCompilerDiagnostics,
3030
3182
  getContentPaths: () => getContentPaths,
3031
3183
  getIncrementalEngine: () => getIncrementalEngine,
3184
+ getMemoryRecommendationsNative: () => getMemoryRecommendationsNative,
3185
+ getMemoryStatsNative: () => getMemoryStatsNative,
3032
3186
  getNativeBridge: () => getNativeBridge,
3033
3187
  getPluginHooks: () => getPluginHooks,
3188
+ getResolverPoolStats: () => getResolverPoolStats,
3034
3189
  getRouteClasses: () => getRouteClasses,
3035
3190
  getWatchStats: () => getWatchStats,
3191
+ getWeek6FeaturesStatus: () => getWeek6FeaturesStatus,
3036
3192
  hasTwUsage: () => hasTwUsage,
3037
3193
  hashContent: () => hashContent,
3038
3194
  hoistComponentsNative: () => hoistComponentsNative,
@@ -3061,6 +3217,7 @@ __export(internal_exports, {
3061
3217
  normalizeClasses: () => normalizeClasses,
3062
3218
  optimizeCssNative: () => optimizeCssNative,
3063
3219
  parseAtomicClass: () => parseAtomicClass,
3220
+ parseClass: () => parseClass,
3064
3221
  parseClasses: () => parseClasses,
3065
3222
  pollWatchEvents: () => pollWatchEvents,
3066
3223
  processFileChange: () => processFileChange,
@@ -3112,12 +3269,18 @@ __export(internal_exports, {
3112
3269
  registerPropertyName: () => registerPropertyName,
3113
3270
  registerValueName: () => registerValueName,
3114
3271
  resetBucketEngine: () => resetBucketEngine,
3272
+ resetCacheStats: () => resetCacheStats,
3115
3273
  resetCompilationMetrics: () => resetCompilationMetrics,
3116
3274
  resetIncrementalEngine: () => resetIncrementalEngine,
3275
+ resetMemoryStats: () => resetMemoryStats,
3276
+ resetResolverPoolStats: () => resetResolverPoolStats,
3117
3277
  resolveCascade: () => resolveCascade,
3118
3278
  resolveClassNames: () => resolveClassNames,
3279
+ resolveColorCached: () => resolveColorCached,
3119
3280
  resolveConflictGroup: () => resolveConflictGroup,
3281
+ resolveFontSizeCached: () => resolveFontSizeCached,
3120
3282
  resolveSimpleVariants: () => resolveSimpleVariants,
3283
+ resolveSpacingCached: () => resolveSpacingCached,
3121
3284
  resolveThemeValue: () => resolveThemeValue,
3122
3285
  resolveVariants: () => resolveVariants,
3123
3286
  reverseLookupProperty: () => reverseLookupProperty,
@@ -5393,7 +5556,7 @@ function sanitizeFrequentThreshold(value) {
5393
5556
  // packages/domain/analyzer/src/binding.ts
5394
5557
  var isAnalyzerModule = (module) => {
5395
5558
  const candidate = module;
5396
- return typeof candidate?.analyzeClasses === "function";
5559
+ return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
5397
5560
  };
5398
5561
  var createAnalyzerBindingLoader = () => {
5399
5562
  const _state = { bindingPromise: null };
@@ -5412,7 +5575,7 @@ var createAnalyzerBindingLoader = () => {
5412
5575
  runtimeDir,
5413
5576
  candidates,
5414
5577
  isValid: isAnalyzerModule,
5415
- invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
5578
+ invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
5416
5579
  });
5417
5580
  if (binding) {
5418
5581
  debugLog(`native binding loaded from: ${loadedPath}`);
@@ -5455,7 +5618,7 @@ async function requireNativeBinding() {
5455
5618
  runtimeDir,
5456
5619
  candidates,
5457
5620
  isValid: isAnalyzerModule,
5458
- invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
5621
+ invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
5459
5622
  });
5460
5623
  const lines = [
5461
5624
  "Native analyzer binding not found. Ensure `tailwind_styled_parser.node` is built."
@@ -5875,7 +6038,8 @@ async function analyzeWorkspace(root, options = {}) {
5875
6038
  );
5876
6039
  const nativeReport = (() => {
5877
6040
  try {
5878
- const report = binding.analyzeClasses(filesJson, resolvedRoot, topLimit);
6041
+ const fn = binding.analyzeClassesWorkspace || binding.analyzeClasses;
6042
+ const report = fn(filesJson, resolvedRoot, topLimit);
5879
6043
  if (!report) {
5880
6044
  throw new Error(`Native analyzer returned no report for "${resolvedRoot}".`);
5881
6045
  }