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.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import { a as AnimateOptions } from './types-DXr2PmGP.mjs';
|
|
|
3
3
|
import { H as HtmlTagName } from './index-NDINUhLN.mjs';
|
|
4
4
|
export { T as TokenMap } from './index-NDINUhLN.mjs';
|
|
5
5
|
export { a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, t as containerRef, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-DKoWRtqH.mjs';
|
|
6
|
-
export { K as createEngine } from './index-
|
|
7
|
-
import './analyzeWorkspace-
|
|
6
|
+
export { K as createEngine } from './index-DQI6O24n.mjs';
|
|
7
|
+
import './analyzeWorkspace-hYfu4Hg3.mjs';
|
|
8
8
|
import './schemas-DR-SLxZZ.mjs';
|
|
9
9
|
import 'zod';
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { a as AnimateOptions } from './types-DXr2PmGP.js';
|
|
|
3
3
|
import { H as HtmlTagName } from './index-NDINUhLN.js';
|
|
4
4
|
export { T as TokenMap } from './index-NDINUhLN.js';
|
|
5
5
|
export { a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, t as containerRef, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-CN9ian1R.js';
|
|
6
|
-
export { K as createEngine } from './index-
|
|
7
|
-
import './analyzeWorkspace-
|
|
6
|
+
export { K as createEngine } from './index-UkYbyBkR.js';
|
|
7
|
+
import './analyzeWorkspace-B1_XRfdl.js';
|
|
8
8
|
import './schemas-DR-SLxZZ.js';
|
|
9
9
|
import 'zod';
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -885,15 +885,27 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
885
885
|
}
|
|
886
886
|
tried.push(`env:${envPath} (not found)`);
|
|
887
887
|
}
|
|
888
|
+
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
889
|
+
for (const pkg of prebuiltPkgs) {
|
|
890
|
+
try {
|
|
891
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
892
|
+
if (fs3__namespace.existsSync(candidate)) {
|
|
893
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
894
|
+
}
|
|
895
|
+
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
896
|
+
} catch {
|
|
897
|
+
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
888
900
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
889
|
-
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"
|
|
901
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
890
902
|
if (runtimeDir) {
|
|
891
903
|
for (const depth of ["..", path9__namespace.join("..", ".."), path9__namespace.join("..", "..", "..")]) {
|
|
892
904
|
const pkgRoot = path9__namespace.resolve(runtimeDir, depth);
|
|
893
905
|
for (const bin of BINARY_NAMES_SELF) {
|
|
894
906
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
895
907
|
const candidate = path9__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
896
|
-
tried.push(`
|
|
908
|
+
tried.push(`self-bundled:${candidate}`);
|
|
897
909
|
if (fs3__namespace.existsSync(candidate)) {
|
|
898
910
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
899
911
|
}
|
|
@@ -901,18 +913,6 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
901
913
|
}
|
|
902
914
|
}
|
|
903
915
|
}
|
|
904
|
-
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
905
|
-
for (const pkg of prebuiltPkgs) {
|
|
906
|
-
try {
|
|
907
|
-
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
908
|
-
if (fs3__namespace.existsSync(candidate)) {
|
|
909
|
-
return { path: candidate, source: "prebuilt", platform, tried };
|
|
910
|
-
}
|
|
911
|
-
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
912
|
-
} catch {
|
|
913
|
-
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
916
|
const cwd = process.cwd();
|
|
917
917
|
const base = runtimeDir ?? cwd;
|
|
918
918
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
@@ -1050,8 +1050,44 @@ var init_nativeBridge = __esm({
|
|
|
1050
1050
|
try {
|
|
1051
1051
|
const binding = _loadNative(result.path);
|
|
1052
1052
|
if (isValidNativeBridge(binding)) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1053
|
+
const toCamelCase = (str) => {
|
|
1054
|
+
return str.replace(/_([a-z0-9])/g, (_, g) => g.toUpperCase());
|
|
1055
|
+
};
|
|
1056
|
+
nativeBridge = new Proxy(binding, {
|
|
1057
|
+
get(target, prop) {
|
|
1058
|
+
if (typeof prop === "string") {
|
|
1059
|
+
if (prop in target) {
|
|
1060
|
+
return target[prop];
|
|
1061
|
+
}
|
|
1062
|
+
const camelKey = toCamelCase(prop);
|
|
1063
|
+
if (camelKey in target) {
|
|
1064
|
+
const val = target[camelKey];
|
|
1065
|
+
if (typeof val === "function") {
|
|
1066
|
+
return val.bind(target);
|
|
1067
|
+
}
|
|
1068
|
+
return val;
|
|
1069
|
+
}
|
|
1070
|
+
const napiKey = `${camelKey}Napi`;
|
|
1071
|
+
if (napiKey in target) {
|
|
1072
|
+
const val = target[napiKey];
|
|
1073
|
+
if (typeof val === "function") {
|
|
1074
|
+
return val.bind(target);
|
|
1075
|
+
}
|
|
1076
|
+
return val;
|
|
1077
|
+
}
|
|
1078
|
+
const napiInnerKey = `${camelKey}NapiInner`;
|
|
1079
|
+
if (napiInnerKey in target) {
|
|
1080
|
+
const val = target[napiInnerKey];
|
|
1081
|
+
if (typeof val === "function") {
|
|
1082
|
+
return val.bind(target);
|
|
1083
|
+
}
|
|
1084
|
+
return val;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return target[prop];
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
log("Native bridge loaded successfully and proxy-wrapped from:", result.path);
|
|
1055
1091
|
return nativeBridge;
|
|
1056
1092
|
}
|
|
1057
1093
|
} catch (e) {
|
|
@@ -1099,8 +1135,8 @@ async function generateCssNative(classes, options) {
|
|
|
1099
1135
|
return css;
|
|
1100
1136
|
}
|
|
1101
1137
|
function clearThemeCache() {
|
|
1138
|
+
const native = getNativeBridge();
|
|
1102
1139
|
try {
|
|
1103
|
-
const native = getNativeBridge();
|
|
1104
1140
|
if (!native?.clearThemeCache) {
|
|
1105
1141
|
return;
|
|
1106
1142
|
}
|
|
@@ -1108,6 +1144,16 @@ function clearThemeCache() {
|
|
|
1108
1144
|
} catch {
|
|
1109
1145
|
}
|
|
1110
1146
|
}
|
|
1147
|
+
function resetCacheStats() {
|
|
1148
|
+
const native = getNativeBridge();
|
|
1149
|
+
try {
|
|
1150
|
+
if (!native?.resetCacheStats) {
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
native.resetCacheStats();
|
|
1154
|
+
} catch {
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1111
1157
|
var init_cssGeneratorNative = __esm({
|
|
1112
1158
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1113
1159
|
init_nativeBridge();
|
|
@@ -1233,6 +1279,16 @@ function minifyCss(css) {
|
|
|
1233
1279
|
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
1234
1280
|
return native.minify_css(css);
|
|
1235
1281
|
}
|
|
1282
|
+
function generateCss(ruleJson, minify) {
|
|
1283
|
+
const native = getNativeBridge();
|
|
1284
|
+
if (!native?.generate_css) throw new Error("generate_css not available");
|
|
1285
|
+
return native.generate_css(ruleJson, minify);
|
|
1286
|
+
}
|
|
1287
|
+
function generateCssBatch(rulesJson, minify) {
|
|
1288
|
+
const native = getNativeBridge();
|
|
1289
|
+
if (!native?.generate_css_batch) throw new Error("generate_css_batch not available");
|
|
1290
|
+
return native.generate_css_batch(rulesJson, minify);
|
|
1291
|
+
}
|
|
1236
1292
|
function compileAnimation(animationName, from, to) {
|
|
1237
1293
|
const native = getNativeBridge();
|
|
1238
1294
|
if (!native?.compile_animation) throw new Error("compile_animation not available");
|
|
@@ -1670,7 +1726,7 @@ function postProcessWithLightning(rawCss) {
|
|
|
1670
1726
|
}
|
|
1671
1727
|
return result.css;
|
|
1672
1728
|
}
|
|
1673
|
-
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
1729
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true, minifier = "lightning") {
|
|
1674
1730
|
const filtered = classes.filter(Boolean);
|
|
1675
1731
|
const uniqueMap = /* @__PURE__ */ new Map();
|
|
1676
1732
|
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
@@ -1678,7 +1734,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
|
1678
1734
|
if (unique.length === 0) {
|
|
1679
1735
|
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
1680
1736
|
}
|
|
1681
|
-
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root)
|
|
1737
|
+
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root) + `|${minifier}`;
|
|
1682
1738
|
const cached = _cssCache.get(cacheKey);
|
|
1683
1739
|
if (cached) {
|
|
1684
1740
|
_cacheHits++;
|
|
@@ -1695,7 +1751,14 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
|
1695
1751
|
const theme = getThemeConfig();
|
|
1696
1752
|
rawCss = await generateCssNative(unique, { theme });
|
|
1697
1753
|
usedRustCompiler = true;
|
|
1698
|
-
|
|
1754
|
+
let finalCss = rawCss;
|
|
1755
|
+
if (minify) {
|
|
1756
|
+
if (minifier === "fast") {
|
|
1757
|
+
finalCss = minifyCss(rawCss);
|
|
1758
|
+
} else {
|
|
1759
|
+
finalCss = postProcessWithLightning(rawCss);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1699
1762
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
1700
1763
|
console.log(
|
|
1701
1764
|
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
@@ -1731,6 +1794,7 @@ var init_tailwindEngine = __esm({
|
|
|
1731
1794
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1732
1795
|
init_nativeBridge();
|
|
1733
1796
|
init_cssGeneratorNative();
|
|
1797
|
+
init_cssCompilationNative();
|
|
1734
1798
|
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
1735
1799
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1736
1800
|
_cacheHits = 0;
|
|
@@ -1763,9 +1827,10 @@ __export(parser_exports, {
|
|
|
1763
1827
|
mergeClassesStatic: () => mergeClassesStatic,
|
|
1764
1828
|
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
1765
1829
|
normalizeClasses: () => normalizeClasses,
|
|
1830
|
+
parseClass: () => parseClass,
|
|
1766
1831
|
parseClasses: () => parseClasses
|
|
1767
1832
|
});
|
|
1768
|
-
var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1833
|
+
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1769
1834
|
var init_parser = __esm({
|
|
1770
1835
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1771
1836
|
init_nativeBridge();
|
|
@@ -1776,6 +1841,14 @@ var init_parser = __esm({
|
|
|
1776
1841
|
}
|
|
1777
1842
|
return native.parseClasses(raw) || [];
|
|
1778
1843
|
};
|
|
1844
|
+
parseClass = (input) => {
|
|
1845
|
+
const native = getNativeBridge();
|
|
1846
|
+
if (!native?.parseClass) {
|
|
1847
|
+
throw new Error("FATAL: Native binding 'parseClass' is required but not available.");
|
|
1848
|
+
}
|
|
1849
|
+
const result = native.parseClass(input);
|
|
1850
|
+
return typeof result === "string" ? JSON.parse(result) : result;
|
|
1851
|
+
};
|
|
1779
1852
|
extractAllClasses = (source) => {
|
|
1780
1853
|
const native = getNativeBridge();
|
|
1781
1854
|
if (!native?.extractAllClasses) {
|
|
@@ -1907,6 +1980,35 @@ function mergeCssDeclarationsNative(cssChunks) {
|
|
|
1907
1980
|
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
1908
1981
|
return native.mergeCssDeclarations(cssChunks);
|
|
1909
1982
|
}
|
|
1983
|
+
function getWeek6FeaturesStatus() {
|
|
1984
|
+
const native = getNativeBridge();
|
|
1985
|
+
if (!native?.getWeek6FeaturesStatus) throw new Error("getWeek6FeaturesStatus not available");
|
|
1986
|
+
const resultJson = native.getWeek6FeaturesStatus();
|
|
1987
|
+
return JSON.parse(resultJson);
|
|
1988
|
+
}
|
|
1989
|
+
function getMemoryStatsNative() {
|
|
1990
|
+
const native = getNativeBridge();
|
|
1991
|
+
if (!native?.getMemoryStatsNative) throw new Error("getMemoryStatsNative not available");
|
|
1992
|
+
const resultJson = native.getMemoryStatsNative();
|
|
1993
|
+
return JSON.parse(resultJson);
|
|
1994
|
+
}
|
|
1995
|
+
function getMemoryRecommendationsNative() {
|
|
1996
|
+
const native = getNativeBridge();
|
|
1997
|
+
if (!native?.getMemoryRecommendationsNative) throw new Error("getMemoryRecommendationsNative not available");
|
|
1998
|
+
const resultJson = native.getMemoryRecommendationsNative();
|
|
1999
|
+
return JSON.parse(resultJson);
|
|
2000
|
+
}
|
|
2001
|
+
function estimateOptimalCacheConfigNative(workloadType, expectedEntries) {
|
|
2002
|
+
const native = getNativeBridge();
|
|
2003
|
+
if (!native?.estimateOptimalCacheConfigNative) throw new Error("estimateOptimalCacheConfigNative not available");
|
|
2004
|
+
const resultJson = native.estimateOptimalCacheConfigNative(workloadType, expectedEntries);
|
|
2005
|
+
return JSON.parse(resultJson);
|
|
2006
|
+
}
|
|
2007
|
+
function resetMemoryStats() {
|
|
2008
|
+
const native = getNativeBridge();
|
|
2009
|
+
if (!native?.resetMemoryStats) throw new Error("resetMemoryStats not available");
|
|
2010
|
+
native.resetMemoryStats();
|
|
2011
|
+
}
|
|
1910
2012
|
var init_analyzerNative = __esm({
|
|
1911
2013
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1912
2014
|
init_nativeBridge();
|
|
@@ -2196,6 +2298,52 @@ function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
|
2196
2298
|
if (!native?.cache_priority) throw new Error("cache_priority not available");
|
|
2197
2299
|
return native.cache_priority(mtimeMs, sizeBytes, hitCount);
|
|
2198
2300
|
}
|
|
2301
|
+
function getResolverPoolStats() {
|
|
2302
|
+
const native = getNativeBridge();
|
|
2303
|
+
if (!native?.getResolverPoolStats) throw new Error("getResolverPoolStats not available");
|
|
2304
|
+
const statsJson = native.getResolverPoolStats();
|
|
2305
|
+
try {
|
|
2306
|
+
return JSON.parse(statsJson);
|
|
2307
|
+
} catch {
|
|
2308
|
+
return {
|
|
2309
|
+
hits: 0,
|
|
2310
|
+
misses: 0,
|
|
2311
|
+
total: 0,
|
|
2312
|
+
hit_rate: 0,
|
|
2313
|
+
cached_resolvers: 0
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
function clearResolverPool() {
|
|
2318
|
+
const native = getNativeBridge();
|
|
2319
|
+
if (!native?.clearResolverPool) throw new Error("clearResolverPool not available");
|
|
2320
|
+
const resultJson = native.clearResolverPool();
|
|
2321
|
+
try {
|
|
2322
|
+
return JSON.parse(resultJson);
|
|
2323
|
+
} catch {
|
|
2324
|
+
return { status: "error" };
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
function resolveColorCached(themeId, color, configJson) {
|
|
2328
|
+
const native = getNativeBridge();
|
|
2329
|
+
if (!native?.resolveColorCached) throw new Error("resolveColorCached not available");
|
|
2330
|
+
return native.resolveColorCached(themeId, color, configJson);
|
|
2331
|
+
}
|
|
2332
|
+
function resolveSpacingCached(themeId, spacing, configJson) {
|
|
2333
|
+
const native = getNativeBridge();
|
|
2334
|
+
if (!native?.resolveSpacingCached) throw new Error("resolveSpacingCached not available");
|
|
2335
|
+
return native.resolveSpacingCached(themeId, spacing, configJson);
|
|
2336
|
+
}
|
|
2337
|
+
function resolveFontSizeCached(themeId, size, configJson) {
|
|
2338
|
+
const native = getNativeBridge();
|
|
2339
|
+
if (!native?.resolveFontSizeCached) throw new Error("resolveFontSizeCached not available");
|
|
2340
|
+
return native.resolveFontSizeCached(themeId, size, configJson);
|
|
2341
|
+
}
|
|
2342
|
+
function resetResolverPoolStats() {
|
|
2343
|
+
const native = getNativeBridge();
|
|
2344
|
+
if (!native?.resetResolverPoolStats) throw new Error("resetResolverPoolStats not available");
|
|
2345
|
+
native.resetResolverPoolStats();
|
|
2346
|
+
}
|
|
2199
2347
|
var init_cacheNative = __esm({
|
|
2200
2348
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2201
2349
|
init_nativeBridge();
|
|
@@ -2844,9 +2992,9 @@ var init_src = __esm({
|
|
|
2844
2992
|
if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
|
|
2845
2993
|
return "__global";
|
|
2846
2994
|
}
|
|
2847
|
-
const pageMatch = normalized.match(
|
|
2995
|
+
const pageMatch = normalized.match(/(?:^|\/)app\/(.+?)\/page\.[tj]sx?$/);
|
|
2848
2996
|
if (pageMatch) return `/${pageMatch[1]}`;
|
|
2849
|
-
const rootPage = normalized.match(
|
|
2997
|
+
const rootPage = normalized.match(/(?:^|\/)app\/page\.[tj]sx?$/);
|
|
2850
2998
|
if (rootPage) return "/";
|
|
2851
2999
|
return null;
|
|
2852
3000
|
};
|
|
@@ -3005,6 +3153,7 @@ __export(internal_exports, {
|
|
|
3005
3153
|
clearCssGenCache: () => clearCssGenCache,
|
|
3006
3154
|
clearParseCache: () => clearParseCache,
|
|
3007
3155
|
clearResolveCache: () => clearResolveCache,
|
|
3156
|
+
clearResolverPool: () => clearResolverPool,
|
|
3008
3157
|
clearThemeCache: () => clearThemeCache,
|
|
3009
3158
|
collectFiles: () => collectFiles,
|
|
3010
3159
|
compileAnimation: () => compileAnimation,
|
|
@@ -3027,6 +3176,7 @@ __export(internal_exports, {
|
|
|
3027
3176
|
eliminateDeadCssNative: () => eliminateDeadCssNative,
|
|
3028
3177
|
emitPluginHook: () => emitPluginHook,
|
|
3029
3178
|
estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
|
|
3179
|
+
estimateOptimalCacheConfigNative: () => estimateOptimalCacheConfigNative,
|
|
3030
3180
|
extractAllClasses: () => extractAllClasses,
|
|
3031
3181
|
extractAndGenerateStateCss: () => extractAndGenerateStateCss,
|
|
3032
3182
|
extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
|
|
@@ -3040,6 +3190,8 @@ __export(internal_exports, {
|
|
|
3040
3190
|
fileToRoute: () => fileToRoute,
|
|
3041
3191
|
findDeadVariants: () => findDeadVariants,
|
|
3042
3192
|
generateAtomicCss: () => generateAtomicCss,
|
|
3193
|
+
generateCss: () => generateCss,
|
|
3194
|
+
generateCssBatch: () => generateCssBatch,
|
|
3043
3195
|
generateCssForClasses: () => generateCssForClasses,
|
|
3044
3196
|
generateCssNative: () => generateCssNative,
|
|
3045
3197
|
generateSafelist: () => generateSafelist,
|
|
@@ -3055,10 +3207,14 @@ __export(internal_exports, {
|
|
|
3055
3207
|
getCompilerDiagnostics: () => getCompilerDiagnostics,
|
|
3056
3208
|
getContentPaths: () => getContentPaths,
|
|
3057
3209
|
getIncrementalEngine: () => getIncrementalEngine,
|
|
3210
|
+
getMemoryRecommendationsNative: () => getMemoryRecommendationsNative,
|
|
3211
|
+
getMemoryStatsNative: () => getMemoryStatsNative,
|
|
3058
3212
|
getNativeBridge: () => getNativeBridge,
|
|
3059
3213
|
getPluginHooks: () => getPluginHooks,
|
|
3214
|
+
getResolverPoolStats: () => getResolverPoolStats,
|
|
3060
3215
|
getRouteClasses: () => getRouteClasses,
|
|
3061
3216
|
getWatchStats: () => getWatchStats,
|
|
3217
|
+
getWeek6FeaturesStatus: () => getWeek6FeaturesStatus,
|
|
3062
3218
|
hasTwUsage: () => hasTwUsage,
|
|
3063
3219
|
hashContent: () => hashContent,
|
|
3064
3220
|
hoistComponentsNative: () => hoistComponentsNative,
|
|
@@ -3087,6 +3243,7 @@ __export(internal_exports, {
|
|
|
3087
3243
|
normalizeClasses: () => normalizeClasses,
|
|
3088
3244
|
optimizeCssNative: () => optimizeCssNative,
|
|
3089
3245
|
parseAtomicClass: () => parseAtomicClass,
|
|
3246
|
+
parseClass: () => parseClass,
|
|
3090
3247
|
parseClasses: () => parseClasses,
|
|
3091
3248
|
pollWatchEvents: () => pollWatchEvents,
|
|
3092
3249
|
processFileChange: () => processFileChange,
|
|
@@ -3138,12 +3295,18 @@ __export(internal_exports, {
|
|
|
3138
3295
|
registerPropertyName: () => registerPropertyName,
|
|
3139
3296
|
registerValueName: () => registerValueName,
|
|
3140
3297
|
resetBucketEngine: () => resetBucketEngine,
|
|
3298
|
+
resetCacheStats: () => resetCacheStats,
|
|
3141
3299
|
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
3142
3300
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
3301
|
+
resetMemoryStats: () => resetMemoryStats,
|
|
3302
|
+
resetResolverPoolStats: () => resetResolverPoolStats,
|
|
3143
3303
|
resolveCascade: () => resolveCascade,
|
|
3144
3304
|
resolveClassNames: () => resolveClassNames,
|
|
3305
|
+
resolveColorCached: () => resolveColorCached,
|
|
3145
3306
|
resolveConflictGroup: () => resolveConflictGroup,
|
|
3307
|
+
resolveFontSizeCached: () => resolveFontSizeCached,
|
|
3146
3308
|
resolveSimpleVariants: () => resolveSimpleVariants,
|
|
3309
|
+
resolveSpacingCached: () => resolveSpacingCached,
|
|
3147
3310
|
resolveThemeValue: () => resolveThemeValue,
|
|
3148
3311
|
resolveVariants: () => resolveVariants,
|
|
3149
3312
|
reverseLookupProperty: () => reverseLookupProperty,
|
|
@@ -4796,31 +4959,24 @@ var init_native_bridge2 = __esm({
|
|
|
4796
4959
|
|
|
4797
4960
|
// packages/domain/core/src/native.ts
|
|
4798
4961
|
init_src2();
|
|
4799
|
-
var isBrowser4 = typeof window !== "undefined"
|
|
4800
|
-
var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\
|
|
4962
|
+
var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
4963
|
+
var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
|
|
4801
4964
|
var _nodeRequire = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
4802
4965
|
var _loadNative2 = (path15) => _nodeRequire(path15);
|
|
4803
4966
|
var nativeBinding = null;
|
|
4804
4967
|
var bindingLoadAttempted = false;
|
|
4805
|
-
var bindingError = null;
|
|
4806
4968
|
var getBinding = () => {
|
|
4807
|
-
if (
|
|
4808
|
-
|
|
4809
|
-
throw bindingError;
|
|
4969
|
+
if (isBrowser4) {
|
|
4970
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
|
|
4810
4971
|
}
|
|
4972
|
+
if (nativeBinding) return nativeBinding;
|
|
4811
4973
|
if (bindingLoadAttempted) {
|
|
4812
4974
|
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
|
|
4813
4975
|
}
|
|
4814
4976
|
bindingLoadAttempted = true;
|
|
4815
4977
|
try {
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
"[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"
|
|
4819
|
-
);
|
|
4820
|
-
throw bindingError;
|
|
4821
|
-
}
|
|
4822
|
-
const runtimeDir = path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
|
|
4823
|
-
const result = resolveNativeBinary(runtimeDir);
|
|
4978
|
+
const runtimeDir = isBrowser4 ? "" : path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
|
|
4979
|
+
const result = isBrowser4 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
|
|
4824
4980
|
if (result.path && result.path.endsWith(".node")) {
|
|
4825
4981
|
const mod = _loadNative2(result.path);
|
|
4826
4982
|
if (mod?.batchSplitClasses) {
|
|
@@ -4828,22 +4984,11 @@ var getBinding = () => {
|
|
|
4828
4984
|
return nativeBinding;
|
|
4829
4985
|
}
|
|
4830
4986
|
}
|
|
4831
|
-
|
|
4832
|
-
`${NATIVE_UNAVAILABLE_MESSAGE2}
|
|
4987
|
+
throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE2}
|
|
4833
4988
|
|
|
4834
|
-
|
|
4835
|
-
${result.tried.map((t2) => ` - ${t2}`).join("\n")}
|
|
4836
|
-
|
|
4837
|
-
Quick fixes:
|
|
4838
|
-
1. npm run build:rust # Build native binaries
|
|
4839
|
-
2. npm install # Reinstall with pre-built binaries
|
|
4840
|
-
3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
|
|
4841
|
-
);
|
|
4842
|
-
throw bindingError;
|
|
4989
|
+
Tried: ${result.tried.join("\n")}`);
|
|
4843
4990
|
} catch (err) {
|
|
4844
|
-
|
|
4845
|
-
bindingError = error;
|
|
4846
|
-
throw error;
|
|
4991
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
4847
4992
|
}
|
|
4848
4993
|
};
|
|
4849
4994
|
var getNativeBinding = getBinding;
|
|
@@ -5510,70 +5655,49 @@ function lookupGenerated(componentId, props, defaultVariants, variantKeys) {
|
|
|
5510
5655
|
);
|
|
5511
5656
|
return table[key];
|
|
5512
5657
|
}
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
const cfgStr = JSON.stringify(cfgObj);
|
|
5524
|
-
const parsed = JSON.parse(cfgStr);
|
|
5525
|
-
if ("defaultVariants" in parsed && !("default_variants" in parsed)) {
|
|
5526
|
-
parsed.default_variants = parsed.defaultVariants;
|
|
5527
|
-
delete parsed.defaultVariants;
|
|
5528
|
-
}
|
|
5529
|
-
if ("compoundVariants" in parsed && !("compound_variants" in parsed)) {
|
|
5530
|
-
parsed.compound_variants = parsed.compoundVariants;
|
|
5531
|
-
delete parsed.compoundVariants;
|
|
5532
|
-
}
|
|
5533
|
-
if (!("variants" in parsed) || parsed.variants == null) {
|
|
5534
|
-
parsed.variants = {};
|
|
5535
|
-
}
|
|
5536
|
-
return JSON.stringify(parsed);
|
|
5537
|
-
})();
|
|
5538
|
-
const cleanProps = {};
|
|
5539
|
-
for (const k of variantKeys) {
|
|
5540
|
-
const dv = defaultVariants[k];
|
|
5541
|
-
if (dv !== void 0 && dv !== null) cleanProps[k] = String(dv);
|
|
5542
|
-
}
|
|
5543
|
-
for (const k of variantKeys) {
|
|
5544
|
-
const v = props[k];
|
|
5545
|
-
if (v !== void 0 && v !== null) cleanProps[k] = String(v);
|
|
5658
|
+
var _configJsonCache = /* @__PURE__ */ new WeakMap();
|
|
5659
|
+
function _getConfigJson(config) {
|
|
5660
|
+
let json = _configJsonCache.get(config);
|
|
5661
|
+
if (!json) {
|
|
5662
|
+
const cfgObj = config;
|
|
5663
|
+
const cfgStr = JSON.stringify(cfgObj);
|
|
5664
|
+
const parsed = JSON.parse(cfgStr);
|
|
5665
|
+
if ("defaultVariants" in parsed && !("default_variants" in parsed)) {
|
|
5666
|
+
parsed.default_variants = parsed.defaultVariants;
|
|
5667
|
+
delete parsed.defaultVariants;
|
|
5546
5668
|
}
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
} catch (_err) {
|
|
5551
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5552
|
-
console.warn("[cv() fallback] getNativeBinding threw error, using JS fallback");
|
|
5669
|
+
if ("compoundVariants" in parsed && !("compound_variants" in parsed)) {
|
|
5670
|
+
parsed.compound_variants = parsed.compoundVariants;
|
|
5671
|
+
delete parsed.compoundVariants;
|
|
5553
5672
|
}
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
if (base) result.push(base);
|
|
5557
|
-
const merged = { ...defaultVariants };
|
|
5558
|
-
for (const [key, values] of Object.entries(variants || {})) {
|
|
5559
|
-
const selected = props[key] ?? defaultVariants?.[key];
|
|
5560
|
-
if (selected !== void 0 && selected !== null) merged[key] = selected;
|
|
5561
|
-
if (selected && typeof values === "object" && values !== null) {
|
|
5562
|
-
const variantValues = values;
|
|
5563
|
-
if (variantValues[String(selected)]) {
|
|
5564
|
-
result.push(variantValues[String(selected)]);
|
|
5565
|
-
}
|
|
5566
|
-
}
|
|
5673
|
+
if (!("variants" in parsed) || parsed.variants == null) {
|
|
5674
|
+
parsed.variants = {};
|
|
5567
5675
|
}
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
const matches = Object.entries(conditions).every(
|
|
5571
|
-
([k, v]) => String(merged[k]) === String(v)
|
|
5572
|
-
);
|
|
5573
|
-
if (matches && compoundClass) result.push(compoundClass);
|
|
5574
|
-
}
|
|
5575
|
-
return result.join(" ");
|
|
5676
|
+
json = JSON.stringify(parsed);
|
|
5677
|
+
_configJsonCache.set(config, json);
|
|
5576
5678
|
}
|
|
5679
|
+
return json;
|
|
5680
|
+
}
|
|
5681
|
+
function resolveVariantsNative(config, props) {
|
|
5682
|
+
const { variants = {}, defaultVariants = {} } = config;
|
|
5683
|
+
const binding = getNativeBinding();
|
|
5684
|
+
if (!binding?.resolveVariants) {
|
|
5685
|
+
throw new Error("FATAL: Native binding 'resolveVariants' is required but not available. Build cannot continue.");
|
|
5686
|
+
}
|
|
5687
|
+
const variantKeys = Object.keys(variants);
|
|
5688
|
+
const configJson = _getConfigJson(config);
|
|
5689
|
+
const cleanProps = {};
|
|
5690
|
+
for (const k of variantKeys) {
|
|
5691
|
+
const dv = defaultVariants[k];
|
|
5692
|
+
if (dv !== void 0 && dv !== null) cleanProps[k] = String(dv);
|
|
5693
|
+
}
|
|
5694
|
+
for (const k of variantKeys) {
|
|
5695
|
+
const v = props[k];
|
|
5696
|
+
if (v !== void 0 && v !== null) cleanProps[k] = String(v);
|
|
5697
|
+
}
|
|
5698
|
+
const propsJson = JSON.stringify(cleanProps);
|
|
5699
|
+
const result = binding.resolveVariants(configJson, propsJson);
|
|
5700
|
+
return result.classes;
|
|
5577
5701
|
}
|
|
5578
5702
|
function cv(config, componentId) {
|
|
5579
5703
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -6067,9 +6191,7 @@ function parseTemplate(strings, exprs) {
|
|
|
6067
6191
|
if (cached) return cached;
|
|
6068
6192
|
const binding = getNativeBinding();
|
|
6069
6193
|
if (!binding?.parseTemplate) {
|
|
6070
|
-
throw new Error(
|
|
6071
|
-
"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: {...} })"
|
|
6072
|
-
);
|
|
6194
|
+
throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
|
|
6073
6195
|
}
|
|
6074
6196
|
const r = binding.parseTemplate(raw);
|
|
6075
6197
|
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
@@ -6339,7 +6461,7 @@ function sanitizeFrequentThreshold(value) {
|
|
|
6339
6461
|
// packages/domain/analyzer/src/binding.ts
|
|
6340
6462
|
var isAnalyzerModule = (module) => {
|
|
6341
6463
|
const candidate = module;
|
|
6342
|
-
return typeof candidate?.analyzeClasses === "function";
|
|
6464
|
+
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
6343
6465
|
};
|
|
6344
6466
|
var createAnalyzerBindingLoader = () => {
|
|
6345
6467
|
const _state = { bindingPromise: null };
|
|
@@ -6358,7 +6480,7 @@ var createAnalyzerBindingLoader = () => {
|
|
|
6358
6480
|
runtimeDir,
|
|
6359
6481
|
candidates,
|
|
6360
6482
|
isValid: isAnalyzerModule,
|
|
6361
|
-
invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
|
|
6483
|
+
invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
|
|
6362
6484
|
});
|
|
6363
6485
|
if (binding) {
|
|
6364
6486
|
debugLog(`native binding loaded from: ${loadedPath}`);
|
|
@@ -6401,7 +6523,7 @@ async function requireNativeBinding() {
|
|
|
6401
6523
|
runtimeDir,
|
|
6402
6524
|
candidates,
|
|
6403
6525
|
isValid: isAnalyzerModule,
|
|
6404
|
-
invalidExportMessage: "Module loaded but missing `analyzeClasses` export."
|
|
6526
|
+
invalidExportMessage: "Module loaded but missing `analyzeClasses` or `analyzeClassesWorkspace` export."
|
|
6405
6527
|
});
|
|
6406
6528
|
const lines = [
|
|
6407
6529
|
"Native analyzer binding not found. Ensure `tailwind_styled_parser.node` is built."
|
|
@@ -6821,7 +6943,8 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
6821
6943
|
);
|
|
6822
6944
|
const nativeReport = (() => {
|
|
6823
6945
|
try {
|
|
6824
|
-
const
|
|
6946
|
+
const fn = binding.analyzeClassesWorkspace || binding.analyzeClasses;
|
|
6947
|
+
const report = fn(filesJson, resolvedRoot, topLimit);
|
|
6825
6948
|
if (!report) {
|
|
6826
6949
|
throw new Error(`Native analyzer returned no report for "${resolvedRoot}".`);
|
|
6827
6950
|
}
|