tailwind-styled-v4 5.0.17 → 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.
- package/dist/{analyzeWorkspace-CopJNGmi.d.ts → analyzeWorkspace-B1_XRfdl.d.ts} +1 -0
- package/dist/{analyzeWorkspace-DpVPccjz.d.mts → analyzeWorkspace-hYfu4Hg3.d.mts} +1 -0
- package/dist/analyzer.d.mts +2 -2
- package/dist/analyzer.d.ts +2 -2
- package/dist/analyzer.js +5 -4
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +5 -4
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +3 -3
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +3 -3
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +52 -16
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +52 -16
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +57 -20
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +57 -20
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +177 -2
- package/dist/compiler.d.ts +177 -2
- package/dist/compiler.js +186 -24
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +173 -25
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.d.mts +3 -3
- package/dist/engine.d.ts +3 -3
- package/dist/engine.js +191 -27
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +191 -27
- package/dist/engine.mjs.map +1 -1
- package/dist/{index-DJv28Uzq.d.mts → index-DQI6O24n.d.mts} +1 -1
- package/dist/{index-BDQw13kn.d.ts → index-UkYbyBkR.d.ts} +1 -1
- package/dist/index.browser.mjs +5 -66
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +241 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +241 -118
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +202 -24
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +202 -24
- package/dist/next.mjs.map +1 -1
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/shared.d.mts +2 -3
- package/dist/shared.d.ts +2 -3
- package/dist/shared.js +186 -23
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +186 -23
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +24 -42
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +24 -42
- package/dist/svelte.mjs.map +1 -1
- package/dist/turbopackLoader.js +186 -23
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +186 -23
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +57 -20
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +57 -20
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +324 -160
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +324 -160
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +24 -42
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +24 -42
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +52 -16
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -16
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +1 -4
package/dist/index.mjs
CHANGED
|
@@ -860,15 +860,27 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
860
860
|
}
|
|
861
861
|
tried.push(`env:${envPath} (not found)`);
|
|
862
862
|
}
|
|
863
|
+
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
864
|
+
for (const pkg of prebuiltPkgs) {
|
|
865
|
+
try {
|
|
866
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
867
|
+
if (fs3.existsSync(candidate)) {
|
|
868
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
869
|
+
}
|
|
870
|
+
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
871
|
+
} catch {
|
|
872
|
+
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
863
875
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
864
|
-
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"
|
|
876
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
865
877
|
if (runtimeDir) {
|
|
866
878
|
for (const depth of ["..", path9.join("..", ".."), path9.join("..", "..", "..")]) {
|
|
867
879
|
const pkgRoot = path9.resolve(runtimeDir, depth);
|
|
868
880
|
for (const bin of BINARY_NAMES_SELF) {
|
|
869
881
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
870
882
|
const candidate = path9.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
871
|
-
tried.push(`
|
|
883
|
+
tried.push(`self-bundled:${candidate}`);
|
|
872
884
|
if (fs3.existsSync(candidate)) {
|
|
873
885
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
874
886
|
}
|
|
@@ -876,18 +888,6 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
876
888
|
}
|
|
877
889
|
}
|
|
878
890
|
}
|
|
879
|
-
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
880
|
-
for (const pkg of prebuiltPkgs) {
|
|
881
|
-
try {
|
|
882
|
-
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
883
|
-
if (fs3.existsSync(candidate)) {
|
|
884
|
-
return { path: candidate, source: "prebuilt", platform, tried };
|
|
885
|
-
}
|
|
886
|
-
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
887
|
-
} catch {
|
|
888
|
-
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
891
|
const cwd = process.cwd();
|
|
892
892
|
const base = runtimeDir ?? cwd;
|
|
893
893
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
@@ -1025,8 +1025,44 @@ var init_nativeBridge = __esm({
|
|
|
1025
1025
|
try {
|
|
1026
1026
|
const binding = _loadNative(result.path);
|
|
1027
1027
|
if (isValidNativeBridge(binding)) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1028
|
+
const toCamelCase = (str) => {
|
|
1029
|
+
return str.replace(/_([a-z0-9])/g, (_, g) => g.toUpperCase());
|
|
1030
|
+
};
|
|
1031
|
+
nativeBridge = new Proxy(binding, {
|
|
1032
|
+
get(target, prop) {
|
|
1033
|
+
if (typeof prop === "string") {
|
|
1034
|
+
if (prop in target) {
|
|
1035
|
+
return target[prop];
|
|
1036
|
+
}
|
|
1037
|
+
const camelKey = toCamelCase(prop);
|
|
1038
|
+
if (camelKey in target) {
|
|
1039
|
+
const val = target[camelKey];
|
|
1040
|
+
if (typeof val === "function") {
|
|
1041
|
+
return val.bind(target);
|
|
1042
|
+
}
|
|
1043
|
+
return val;
|
|
1044
|
+
}
|
|
1045
|
+
const napiKey = `${camelKey}Napi`;
|
|
1046
|
+
if (napiKey in target) {
|
|
1047
|
+
const val = target[napiKey];
|
|
1048
|
+
if (typeof val === "function") {
|
|
1049
|
+
return val.bind(target);
|
|
1050
|
+
}
|
|
1051
|
+
return val;
|
|
1052
|
+
}
|
|
1053
|
+
const napiInnerKey = `${camelKey}NapiInner`;
|
|
1054
|
+
if (napiInnerKey in target) {
|
|
1055
|
+
const val = target[napiInnerKey];
|
|
1056
|
+
if (typeof val === "function") {
|
|
1057
|
+
return val.bind(target);
|
|
1058
|
+
}
|
|
1059
|
+
return val;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
return target[prop];
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
log("Native bridge loaded successfully and proxy-wrapped from:", result.path);
|
|
1030
1066
|
return nativeBridge;
|
|
1031
1067
|
}
|
|
1032
1068
|
} catch (e) {
|
|
@@ -1074,8 +1110,8 @@ async function generateCssNative(classes, options) {
|
|
|
1074
1110
|
return css;
|
|
1075
1111
|
}
|
|
1076
1112
|
function clearThemeCache() {
|
|
1113
|
+
const native = getNativeBridge();
|
|
1077
1114
|
try {
|
|
1078
|
-
const native = getNativeBridge();
|
|
1079
1115
|
if (!native?.clearThemeCache) {
|
|
1080
1116
|
return;
|
|
1081
1117
|
}
|
|
@@ -1083,6 +1119,16 @@ function clearThemeCache() {
|
|
|
1083
1119
|
} catch {
|
|
1084
1120
|
}
|
|
1085
1121
|
}
|
|
1122
|
+
function resetCacheStats() {
|
|
1123
|
+
const native = getNativeBridge();
|
|
1124
|
+
try {
|
|
1125
|
+
if (!native?.resetCacheStats) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
native.resetCacheStats();
|
|
1129
|
+
} catch {
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1086
1132
|
var init_cssGeneratorNative = __esm({
|
|
1087
1133
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1088
1134
|
init_nativeBridge();
|
|
@@ -1208,6 +1254,16 @@ function minifyCss(css) {
|
|
|
1208
1254
|
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
1209
1255
|
return native.minify_css(css);
|
|
1210
1256
|
}
|
|
1257
|
+
function generateCss(ruleJson, minify) {
|
|
1258
|
+
const native = getNativeBridge();
|
|
1259
|
+
if (!native?.generate_css) throw new Error("generate_css not available");
|
|
1260
|
+
return native.generate_css(ruleJson, minify);
|
|
1261
|
+
}
|
|
1262
|
+
function generateCssBatch(rulesJson, minify) {
|
|
1263
|
+
const native = getNativeBridge();
|
|
1264
|
+
if (!native?.generate_css_batch) throw new Error("generate_css_batch not available");
|
|
1265
|
+
return native.generate_css_batch(rulesJson, minify);
|
|
1266
|
+
}
|
|
1211
1267
|
function compileAnimation(animationName, from, to) {
|
|
1212
1268
|
const native = getNativeBridge();
|
|
1213
1269
|
if (!native?.compile_animation) throw new Error("compile_animation not available");
|
|
@@ -1645,7 +1701,7 @@ function postProcessWithLightning(rawCss) {
|
|
|
1645
1701
|
}
|
|
1646
1702
|
return result.css;
|
|
1647
1703
|
}
|
|
1648
|
-
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
1704
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true, minifier = "lightning") {
|
|
1649
1705
|
const filtered = classes.filter(Boolean);
|
|
1650
1706
|
const uniqueMap = /* @__PURE__ */ new Map();
|
|
1651
1707
|
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
@@ -1653,7 +1709,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
|
1653
1709
|
if (unique.length === 0) {
|
|
1654
1710
|
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
1655
1711
|
}
|
|
1656
|
-
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root)
|
|
1712
|
+
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root) + `|${minifier}`;
|
|
1657
1713
|
const cached = _cssCache.get(cacheKey);
|
|
1658
1714
|
if (cached) {
|
|
1659
1715
|
_cacheHits++;
|
|
@@ -1670,7 +1726,14 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
|
1670
1726
|
const theme = getThemeConfig();
|
|
1671
1727
|
rawCss = await generateCssNative(unique, { theme });
|
|
1672
1728
|
usedRustCompiler = true;
|
|
1673
|
-
|
|
1729
|
+
let finalCss = rawCss;
|
|
1730
|
+
if (minify) {
|
|
1731
|
+
if (minifier === "fast") {
|
|
1732
|
+
finalCss = minifyCss(rawCss);
|
|
1733
|
+
} else {
|
|
1734
|
+
finalCss = postProcessWithLightning(rawCss);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1674
1737
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
1675
1738
|
console.log(
|
|
1676
1739
|
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
@@ -1706,6 +1769,7 @@ var init_tailwindEngine = __esm({
|
|
|
1706
1769
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1707
1770
|
init_nativeBridge();
|
|
1708
1771
|
init_cssGeneratorNative();
|
|
1772
|
+
init_cssCompilationNative();
|
|
1709
1773
|
createRequire(import.meta.url);
|
|
1710
1774
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1711
1775
|
_cacheHits = 0;
|
|
@@ -1738,9 +1802,10 @@ __export(parser_exports, {
|
|
|
1738
1802
|
mergeClassesStatic: () => mergeClassesStatic,
|
|
1739
1803
|
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
1740
1804
|
normalizeClasses: () => normalizeClasses,
|
|
1805
|
+
parseClass: () => parseClass,
|
|
1741
1806
|
parseClasses: () => parseClasses
|
|
1742
1807
|
});
|
|
1743
|
-
var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1808
|
+
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1744
1809
|
var init_parser = __esm({
|
|
1745
1810
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1746
1811
|
init_nativeBridge();
|
|
@@ -1751,6 +1816,14 @@ var init_parser = __esm({
|
|
|
1751
1816
|
}
|
|
1752
1817
|
return native.parseClasses(raw) || [];
|
|
1753
1818
|
};
|
|
1819
|
+
parseClass = (input) => {
|
|
1820
|
+
const native = getNativeBridge();
|
|
1821
|
+
if (!native?.parseClass) {
|
|
1822
|
+
throw new Error("FATAL: Native binding 'parseClass' is required but not available.");
|
|
1823
|
+
}
|
|
1824
|
+
const result = native.parseClass(input);
|
|
1825
|
+
return typeof result === "string" ? JSON.parse(result) : result;
|
|
1826
|
+
};
|
|
1754
1827
|
extractAllClasses = (source) => {
|
|
1755
1828
|
const native = getNativeBridge();
|
|
1756
1829
|
if (!native?.extractAllClasses) {
|
|
@@ -1882,6 +1955,35 @@ function mergeCssDeclarationsNative(cssChunks) {
|
|
|
1882
1955
|
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
1883
1956
|
return native.mergeCssDeclarations(cssChunks);
|
|
1884
1957
|
}
|
|
1958
|
+
function getWeek6FeaturesStatus() {
|
|
1959
|
+
const native = getNativeBridge();
|
|
1960
|
+
if (!native?.getWeek6FeaturesStatus) throw new Error("getWeek6FeaturesStatus not available");
|
|
1961
|
+
const resultJson = native.getWeek6FeaturesStatus();
|
|
1962
|
+
return JSON.parse(resultJson);
|
|
1963
|
+
}
|
|
1964
|
+
function getMemoryStatsNative() {
|
|
1965
|
+
const native = getNativeBridge();
|
|
1966
|
+
if (!native?.getMemoryStatsNative) throw new Error("getMemoryStatsNative not available");
|
|
1967
|
+
const resultJson = native.getMemoryStatsNative();
|
|
1968
|
+
return JSON.parse(resultJson);
|
|
1969
|
+
}
|
|
1970
|
+
function getMemoryRecommendationsNative() {
|
|
1971
|
+
const native = getNativeBridge();
|
|
1972
|
+
if (!native?.getMemoryRecommendationsNative) throw new Error("getMemoryRecommendationsNative not available");
|
|
1973
|
+
const resultJson = native.getMemoryRecommendationsNative();
|
|
1974
|
+
return JSON.parse(resultJson);
|
|
1975
|
+
}
|
|
1976
|
+
function estimateOptimalCacheConfigNative(workloadType, expectedEntries) {
|
|
1977
|
+
const native = getNativeBridge();
|
|
1978
|
+
if (!native?.estimateOptimalCacheConfigNative) throw new Error("estimateOptimalCacheConfigNative not available");
|
|
1979
|
+
const resultJson = native.estimateOptimalCacheConfigNative(workloadType, expectedEntries);
|
|
1980
|
+
return JSON.parse(resultJson);
|
|
1981
|
+
}
|
|
1982
|
+
function resetMemoryStats() {
|
|
1983
|
+
const native = getNativeBridge();
|
|
1984
|
+
if (!native?.resetMemoryStats) throw new Error("resetMemoryStats not available");
|
|
1985
|
+
native.resetMemoryStats();
|
|
1986
|
+
}
|
|
1885
1987
|
var init_analyzerNative = __esm({
|
|
1886
1988
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1887
1989
|
init_nativeBridge();
|
|
@@ -2171,6 +2273,52 @@ function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
|
2171
2273
|
if (!native?.cache_priority) throw new Error("cache_priority not available");
|
|
2172
2274
|
return native.cache_priority(mtimeMs, sizeBytes, hitCount);
|
|
2173
2275
|
}
|
|
2276
|
+
function getResolverPoolStats() {
|
|
2277
|
+
const native = getNativeBridge();
|
|
2278
|
+
if (!native?.getResolverPoolStats) throw new Error("getResolverPoolStats not available");
|
|
2279
|
+
const statsJson = native.getResolverPoolStats();
|
|
2280
|
+
try {
|
|
2281
|
+
return JSON.parse(statsJson);
|
|
2282
|
+
} catch {
|
|
2283
|
+
return {
|
|
2284
|
+
hits: 0,
|
|
2285
|
+
misses: 0,
|
|
2286
|
+
total: 0,
|
|
2287
|
+
hit_rate: 0,
|
|
2288
|
+
cached_resolvers: 0
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
function clearResolverPool() {
|
|
2293
|
+
const native = getNativeBridge();
|
|
2294
|
+
if (!native?.clearResolverPool) throw new Error("clearResolverPool not available");
|
|
2295
|
+
const resultJson = native.clearResolverPool();
|
|
2296
|
+
try {
|
|
2297
|
+
return JSON.parse(resultJson);
|
|
2298
|
+
} catch {
|
|
2299
|
+
return { status: "error" };
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
function resolveColorCached(themeId, color, configJson) {
|
|
2303
|
+
const native = getNativeBridge();
|
|
2304
|
+
if (!native?.resolveColorCached) throw new Error("resolveColorCached not available");
|
|
2305
|
+
return native.resolveColorCached(themeId, color, configJson);
|
|
2306
|
+
}
|
|
2307
|
+
function resolveSpacingCached(themeId, spacing, configJson) {
|
|
2308
|
+
const native = getNativeBridge();
|
|
2309
|
+
if (!native?.resolveSpacingCached) throw new Error("resolveSpacingCached not available");
|
|
2310
|
+
return native.resolveSpacingCached(themeId, spacing, configJson);
|
|
2311
|
+
}
|
|
2312
|
+
function resolveFontSizeCached(themeId, size, configJson) {
|
|
2313
|
+
const native = getNativeBridge();
|
|
2314
|
+
if (!native?.resolveFontSizeCached) throw new Error("resolveFontSizeCached not available");
|
|
2315
|
+
return native.resolveFontSizeCached(themeId, size, configJson);
|
|
2316
|
+
}
|
|
2317
|
+
function resetResolverPoolStats() {
|
|
2318
|
+
const native = getNativeBridge();
|
|
2319
|
+
if (!native?.resetResolverPoolStats) throw new Error("resetResolverPoolStats not available");
|
|
2320
|
+
native.resetResolverPoolStats();
|
|
2321
|
+
}
|
|
2174
2322
|
var init_cacheNative = __esm({
|
|
2175
2323
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2176
2324
|
init_nativeBridge();
|
|
@@ -2819,9 +2967,9 @@ var init_src = __esm({
|
|
|
2819
2967
|
if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
|
|
2820
2968
|
return "__global";
|
|
2821
2969
|
}
|
|
2822
|
-
const pageMatch = normalized.match(
|
|
2970
|
+
const pageMatch = normalized.match(/(?:^|\/)app\/(.+?)\/page\.[tj]sx?$/);
|
|
2823
2971
|
if (pageMatch) return `/${pageMatch[1]}`;
|
|
2824
|
-
const rootPage = normalized.match(
|
|
2972
|
+
const rootPage = normalized.match(/(?:^|\/)app\/page\.[tj]sx?$/);
|
|
2825
2973
|
if (rootPage) return "/";
|
|
2826
2974
|
return null;
|
|
2827
2975
|
};
|
|
@@ -2980,6 +3128,7 @@ __export(internal_exports, {
|
|
|
2980
3128
|
clearCssGenCache: () => clearCssGenCache,
|
|
2981
3129
|
clearParseCache: () => clearParseCache,
|
|
2982
3130
|
clearResolveCache: () => clearResolveCache,
|
|
3131
|
+
clearResolverPool: () => clearResolverPool,
|
|
2983
3132
|
clearThemeCache: () => clearThemeCache,
|
|
2984
3133
|
collectFiles: () => collectFiles,
|
|
2985
3134
|
compileAnimation: () => compileAnimation,
|
|
@@ -3002,6 +3151,7 @@ __export(internal_exports, {
|
|
|
3002
3151
|
eliminateDeadCssNative: () => eliminateDeadCssNative,
|
|
3003
3152
|
emitPluginHook: () => emitPluginHook,
|
|
3004
3153
|
estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
|
|
3154
|
+
estimateOptimalCacheConfigNative: () => estimateOptimalCacheConfigNative,
|
|
3005
3155
|
extractAllClasses: () => extractAllClasses,
|
|
3006
3156
|
extractAndGenerateStateCss: () => extractAndGenerateStateCss,
|
|
3007
3157
|
extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
|
|
@@ -3015,6 +3165,8 @@ __export(internal_exports, {
|
|
|
3015
3165
|
fileToRoute: () => fileToRoute,
|
|
3016
3166
|
findDeadVariants: () => findDeadVariants,
|
|
3017
3167
|
generateAtomicCss: () => generateAtomicCss,
|
|
3168
|
+
generateCss: () => generateCss,
|
|
3169
|
+
generateCssBatch: () => generateCssBatch,
|
|
3018
3170
|
generateCssForClasses: () => generateCssForClasses,
|
|
3019
3171
|
generateCssNative: () => generateCssNative,
|
|
3020
3172
|
generateSafelist: () => generateSafelist,
|
|
@@ -3030,10 +3182,14 @@ __export(internal_exports, {
|
|
|
3030
3182
|
getCompilerDiagnostics: () => getCompilerDiagnostics,
|
|
3031
3183
|
getContentPaths: () => getContentPaths,
|
|
3032
3184
|
getIncrementalEngine: () => getIncrementalEngine,
|
|
3185
|
+
getMemoryRecommendationsNative: () => getMemoryRecommendationsNative,
|
|
3186
|
+
getMemoryStatsNative: () => getMemoryStatsNative,
|
|
3033
3187
|
getNativeBridge: () => getNativeBridge,
|
|
3034
3188
|
getPluginHooks: () => getPluginHooks,
|
|
3189
|
+
getResolverPoolStats: () => getResolverPoolStats,
|
|
3035
3190
|
getRouteClasses: () => getRouteClasses,
|
|
3036
3191
|
getWatchStats: () => getWatchStats,
|
|
3192
|
+
getWeek6FeaturesStatus: () => getWeek6FeaturesStatus,
|
|
3037
3193
|
hasTwUsage: () => hasTwUsage,
|
|
3038
3194
|
hashContent: () => hashContent,
|
|
3039
3195
|
hoistComponentsNative: () => hoistComponentsNative,
|
|
@@ -3062,6 +3218,7 @@ __export(internal_exports, {
|
|
|
3062
3218
|
normalizeClasses: () => normalizeClasses,
|
|
3063
3219
|
optimizeCssNative: () => optimizeCssNative,
|
|
3064
3220
|
parseAtomicClass: () => parseAtomicClass,
|
|
3221
|
+
parseClass: () => parseClass,
|
|
3065
3222
|
parseClasses: () => parseClasses,
|
|
3066
3223
|
pollWatchEvents: () => pollWatchEvents,
|
|
3067
3224
|
processFileChange: () => processFileChange,
|
|
@@ -3113,12 +3270,18 @@ __export(internal_exports, {
|
|
|
3113
3270
|
registerPropertyName: () => registerPropertyName,
|
|
3114
3271
|
registerValueName: () => registerValueName,
|
|
3115
3272
|
resetBucketEngine: () => resetBucketEngine,
|
|
3273
|
+
resetCacheStats: () => resetCacheStats,
|
|
3116
3274
|
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
3117
3275
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
3276
|
+
resetMemoryStats: () => resetMemoryStats,
|
|
3277
|
+
resetResolverPoolStats: () => resetResolverPoolStats,
|
|
3118
3278
|
resolveCascade: () => resolveCascade,
|
|
3119
3279
|
resolveClassNames: () => resolveClassNames,
|
|
3280
|
+
resolveColorCached: () => resolveColorCached,
|
|
3120
3281
|
resolveConflictGroup: () => resolveConflictGroup,
|
|
3282
|
+
resolveFontSizeCached: () => resolveFontSizeCached,
|
|
3121
3283
|
resolveSimpleVariants: () => resolveSimpleVariants,
|
|
3284
|
+
resolveSpacingCached: () => resolveSpacingCached,
|
|
3122
3285
|
resolveThemeValue: () => resolveThemeValue,
|
|
3123
3286
|
resolveVariants: () => resolveVariants,
|
|
3124
3287
|
reverseLookupProperty: () => reverseLookupProperty,
|
|
@@ -4771,31 +4934,24 @@ var init_native_bridge2 = __esm({
|
|
|
4771
4934
|
|
|
4772
4935
|
// packages/domain/core/src/native.ts
|
|
4773
4936
|
init_src2();
|
|
4774
|
-
var isBrowser4 = typeof window !== "undefined"
|
|
4775
|
-
var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\
|
|
4937
|
+
var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
4938
|
+
var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
|
|
4776
4939
|
var _nodeRequire = createRequire(import.meta.url);
|
|
4777
4940
|
var _loadNative2 = (path15) => _nodeRequire(path15);
|
|
4778
4941
|
var nativeBinding = null;
|
|
4779
4942
|
var bindingLoadAttempted = false;
|
|
4780
|
-
var bindingError = null;
|
|
4781
4943
|
var getBinding = () => {
|
|
4782
|
-
if (
|
|
4783
|
-
|
|
4784
|
-
throw bindingError;
|
|
4944
|
+
if (isBrowser4) {
|
|
4945
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
|
|
4785
4946
|
}
|
|
4947
|
+
if (nativeBinding) return nativeBinding;
|
|
4786
4948
|
if (bindingLoadAttempted) {
|
|
4787
4949
|
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
|
|
4788
4950
|
}
|
|
4789
4951
|
bindingLoadAttempted = true;
|
|
4790
4952
|
try {
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
"[tailwind-styled/core] Cannot use template literals (tw`...`) in browser environment.\n\nTemplate literal parsing requires native Rust bindings compiled to WebAssembly,\nwhich is not currently supported.\n\nSolutions:\n1. Use object config only: tw.button({ base: '...', variants: {...} })\n2. Pre-compile components on the server (Next.js Server Components)\n3. Use @tailwind-styled browser-safe packages if available\n\nFor more info: https://github.com/Dictionar32/css-in-rust/discussions"
|
|
4794
|
-
);
|
|
4795
|
-
throw bindingError;
|
|
4796
|
-
}
|
|
4797
|
-
const runtimeDir = dirname(fileURLToPath(import.meta.url));
|
|
4798
|
-
const result = resolveNativeBinary(runtimeDir);
|
|
4953
|
+
const runtimeDir = isBrowser4 ? "" : dirname(fileURLToPath(import.meta.url));
|
|
4954
|
+
const result = isBrowser4 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
|
|
4799
4955
|
if (result.path && result.path.endsWith(".node")) {
|
|
4800
4956
|
const mod = _loadNative2(result.path);
|
|
4801
4957
|
if (mod?.batchSplitClasses) {
|
|
@@ -4803,22 +4959,11 @@ var getBinding = () => {
|
|
|
4803
4959
|
return nativeBinding;
|
|
4804
4960
|
}
|
|
4805
4961
|
}
|
|
4806
|
-
|
|
4807
|
-
`${NATIVE_UNAVAILABLE_MESSAGE2}
|
|
4962
|
+
throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE2}
|
|
4808
4963
|
|
|
4809
|
-
|
|
4810
|
-
${result.tried.map((t2) => ` - ${t2}`).join("\n")}
|
|
4811
|
-
|
|
4812
|
-
Quick fixes:
|
|
4813
|
-
1. npm run build:rust # Build native binaries
|
|
4814
|
-
2. npm install # Reinstall with pre-built binaries
|
|
4815
|
-
3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
|
|
4816
|
-
);
|
|
4817
|
-
throw bindingError;
|
|
4964
|
+
Tried: ${result.tried.join("\n")}`);
|
|
4818
4965
|
} catch (err) {
|
|
4819
|
-
|
|
4820
|
-
bindingError = error;
|
|
4821
|
-
throw error;
|
|
4966
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
4822
4967
|
}
|
|
4823
4968
|
};
|
|
4824
4969
|
var getNativeBinding = getBinding;
|
|
@@ -5485,70 +5630,49 @@ function lookupGenerated(componentId, props, defaultVariants, variantKeys) {
|
|
|
5485
5630
|
);
|
|
5486
5631
|
return table[key];
|
|
5487
5632
|
}
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
const cfgStr = JSON.stringify(cfgObj);
|
|
5499
|
-
const parsed = JSON.parse(cfgStr);
|
|
5500
|
-
if ("defaultVariants" in parsed && !("default_variants" in parsed)) {
|
|
5501
|
-
parsed.default_variants = parsed.defaultVariants;
|
|
5502
|
-
delete parsed.defaultVariants;
|
|
5503
|
-
}
|
|
5504
|
-
if ("compoundVariants" in parsed && !("compound_variants" in parsed)) {
|
|
5505
|
-
parsed.compound_variants = parsed.compoundVariants;
|
|
5506
|
-
delete parsed.compoundVariants;
|
|
5507
|
-
}
|
|
5508
|
-
if (!("variants" in parsed) || parsed.variants == null) {
|
|
5509
|
-
parsed.variants = {};
|
|
5510
|
-
}
|
|
5511
|
-
return JSON.stringify(parsed);
|
|
5512
|
-
})();
|
|
5513
|
-
const cleanProps = {};
|
|
5514
|
-
for (const k of variantKeys) {
|
|
5515
|
-
const dv = defaultVariants[k];
|
|
5516
|
-
if (dv !== void 0 && dv !== null) cleanProps[k] = String(dv);
|
|
5517
|
-
}
|
|
5518
|
-
for (const k of variantKeys) {
|
|
5519
|
-
const v = props[k];
|
|
5520
|
-
if (v !== void 0 && v !== null) cleanProps[k] = String(v);
|
|
5633
|
+
var _configJsonCache = /* @__PURE__ */ new WeakMap();
|
|
5634
|
+
function _getConfigJson(config) {
|
|
5635
|
+
let json = _configJsonCache.get(config);
|
|
5636
|
+
if (!json) {
|
|
5637
|
+
const cfgObj = config;
|
|
5638
|
+
const cfgStr = JSON.stringify(cfgObj);
|
|
5639
|
+
const parsed = JSON.parse(cfgStr);
|
|
5640
|
+
if ("defaultVariants" in parsed && !("default_variants" in parsed)) {
|
|
5641
|
+
parsed.default_variants = parsed.defaultVariants;
|
|
5642
|
+
delete parsed.defaultVariants;
|
|
5521
5643
|
}
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
} catch (_err) {
|
|
5526
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5527
|
-
console.warn("[cv() fallback] getNativeBinding threw error, using JS fallback");
|
|
5644
|
+
if ("compoundVariants" in parsed && !("compound_variants" in parsed)) {
|
|
5645
|
+
parsed.compound_variants = parsed.compoundVariants;
|
|
5646
|
+
delete parsed.compoundVariants;
|
|
5528
5647
|
}
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
if (base) result.push(base);
|
|
5532
|
-
const merged = { ...defaultVariants };
|
|
5533
|
-
for (const [key, values] of Object.entries(variants || {})) {
|
|
5534
|
-
const selected = props[key] ?? defaultVariants?.[key];
|
|
5535
|
-
if (selected !== void 0 && selected !== null) merged[key] = selected;
|
|
5536
|
-
if (selected && typeof values === "object" && values !== null) {
|
|
5537
|
-
const variantValues = values;
|
|
5538
|
-
if (variantValues[String(selected)]) {
|
|
5539
|
-
result.push(variantValues[String(selected)]);
|
|
5540
|
-
}
|
|
5541
|
-
}
|
|
5648
|
+
if (!("variants" in parsed) || parsed.variants == null) {
|
|
5649
|
+
parsed.variants = {};
|
|
5542
5650
|
}
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
const matches = Object.entries(conditions).every(
|
|
5546
|
-
([k, v]) => String(merged[k]) === String(v)
|
|
5547
|
-
);
|
|
5548
|
-
if (matches && compoundClass) result.push(compoundClass);
|
|
5549
|
-
}
|
|
5550
|
-
return result.join(" ");
|
|
5651
|
+
json = JSON.stringify(parsed);
|
|
5652
|
+
_configJsonCache.set(config, json);
|
|
5551
5653
|
}
|
|
5654
|
+
return json;
|
|
5655
|
+
}
|
|
5656
|
+
function resolveVariantsNative(config, props) {
|
|
5657
|
+
const { variants = {}, defaultVariants = {} } = config;
|
|
5658
|
+
const binding = getNativeBinding();
|
|
5659
|
+
if (!binding?.resolveVariants) {
|
|
5660
|
+
throw new Error("FATAL: Native binding 'resolveVariants' is required but not available. Build cannot continue.");
|
|
5661
|
+
}
|
|
5662
|
+
const variantKeys = Object.keys(variants);
|
|
5663
|
+
const configJson = _getConfigJson(config);
|
|
5664
|
+
const cleanProps = {};
|
|
5665
|
+
for (const k of variantKeys) {
|
|
5666
|
+
const dv = defaultVariants[k];
|
|
5667
|
+
if (dv !== void 0 && dv !== null) cleanProps[k] = String(dv);
|
|
5668
|
+
}
|
|
5669
|
+
for (const k of variantKeys) {
|
|
5670
|
+
const v = props[k];
|
|
5671
|
+
if (v !== void 0 && v !== null) cleanProps[k] = String(v);
|
|
5672
|
+
}
|
|
5673
|
+
const propsJson = JSON.stringify(cleanProps);
|
|
5674
|
+
const result = binding.resolveVariants(configJson, propsJson);
|
|
5675
|
+
return result.classes;
|
|
5552
5676
|
}
|
|
5553
5677
|
function cv(config, componentId) {
|
|
5554
5678
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -6042,9 +6166,7 @@ function parseTemplate(strings, exprs) {
|
|
|
6042
6166
|
if (cached) return cached;
|
|
6043
6167
|
const binding = getNativeBinding();
|
|
6044
6168
|
if (!binding?.parseTemplate) {
|
|
6045
|
-
throw new Error(
|
|
6046
|
-
"FATAL: Native binding 'parseTemplate' is required but not available in this environment.\n\nThis function is only available on Node.js with native bindings loaded.\nFor browser environments, use object config instead:\n tw.button({ base: '...', variants: {...} })"
|
|
6047
|
-
);
|
|
6169
|
+
throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
|
|
6048
6170
|
}
|
|
6049
6171
|
const r = binding.parseTemplate(raw);
|
|
6050
6172
|
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
@@ -6314,7 +6436,7 @@ function sanitizeFrequentThreshold(value) {
|
|
|
6314
6436
|
// packages/domain/analyzer/src/binding.ts
|
|
6315
6437
|
var isAnalyzerModule = (module) => {
|
|
6316
6438
|
const candidate = module;
|
|
6317
|
-
return typeof candidate?.analyzeClasses === "function";
|
|
6439
|
+
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
6318
6440
|
};
|
|
6319
6441
|
var createAnalyzerBindingLoader = () => {
|
|
6320
6442
|
const _state = { bindingPromise: null };
|
|
@@ -6333,7 +6455,7 @@ var createAnalyzerBindingLoader = () => {
|
|
|
6333
6455
|
runtimeDir,
|
|
6334
6456
|
candidates,
|
|
6335
6457
|
isValid: isAnalyzerModule,
|
|
6336
|
-
invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
|
|
6458
|
+
invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
|
|
6337
6459
|
});
|
|
6338
6460
|
if (binding) {
|
|
6339
6461
|
debugLog(`native binding loaded from: ${loadedPath}`);
|
|
@@ -6376,7 +6498,7 @@ async function requireNativeBinding() {
|
|
|
6376
6498
|
runtimeDir,
|
|
6377
6499
|
candidates,
|
|
6378
6500
|
isValid: isAnalyzerModule,
|
|
6379
|
-
invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
|
|
6501
|
+
invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
|
|
6380
6502
|
});
|
|
6381
6503
|
const lines = [
|
|
6382
6504
|
"Native analyzer binding not found. Ensure `tailwind_styled_parser.node` is built."
|
|
@@ -6796,7 +6918,8 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
6796
6918
|
);
|
|
6797
6919
|
const nativeReport = (() => {
|
|
6798
6920
|
try {
|
|
6799
|
-
const
|
|
6921
|
+
const fn = binding.analyzeClassesWorkspace || binding.analyzeClasses;
|
|
6922
|
+
const report = fn(filesJson, resolvedRoot, topLimit);
|
|
6800
6923
|
if (!report) {
|
|
6801
6924
|
throw new Error(`Native analyzer returned no report for "${resolvedRoot}".`);
|
|
6802
6925
|
}
|