tailwind-styled-v4 5.0.34 → 5.0.35
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/compiler.js +60 -8
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +60 -8
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +60 -8
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +60 -8
- package/dist/engine.mjs.map +1 -1
- package/dist/index.js +60 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -8
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +64 -12
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +64 -12
- package/dist/next.mjs.map +1 -1
- package/dist/shared.js +60 -8
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +60 -8
- package/dist/shared.mjs.map +1 -1
- package/dist/turbopackLoader.js +60 -8
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +60 -8
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/vite.js +60 -8
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +60 -8
- package/dist/vite.mjs.map +1 -1
- package/package.json +1 -1
package/dist/next.mjs
CHANGED
|
@@ -841,6 +841,56 @@ var init_streamingNative = __esm({
|
|
|
841
841
|
init_nativeBridge();
|
|
842
842
|
}
|
|
843
843
|
});
|
|
844
|
+
function loadTailwindEngine() {
|
|
845
|
+
if (_twEngine) return _twEngine;
|
|
846
|
+
if (_twEngineError) throw _twEngineError;
|
|
847
|
+
try {
|
|
848
|
+
const tw = require2("tailwindcss");
|
|
849
|
+
if (typeof tw.compile !== "function") {
|
|
850
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
851
|
+
}
|
|
852
|
+
_twEngine = tw;
|
|
853
|
+
return _twEngine;
|
|
854
|
+
} catch (e) {
|
|
855
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
856
|
+
throw _twEngineError;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
860
|
+
if (classes.length === 0) return "";
|
|
861
|
+
const tw = loadTailwindEngine();
|
|
862
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
863
|
+
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
864
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
865
|
+
const projectRoot = root ?? process.cwd();
|
|
866
|
+
const req = createRequire(resolve2(projectRoot, "package.json"));
|
|
867
|
+
const loadStylesheet = async (id, base) => {
|
|
868
|
+
try {
|
|
869
|
+
const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
|
|
870
|
+
const pkgPath = req.resolve(cssId);
|
|
871
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
872
|
+
} catch {
|
|
873
|
+
try {
|
|
874
|
+
const absPath = resolve2(base, id);
|
|
875
|
+
if (existsSync3(absPath)) {
|
|
876
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
877
|
+
}
|
|
878
|
+
} catch {
|
|
879
|
+
}
|
|
880
|
+
return { content: "", base };
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
884
|
+
return compiler.build(classes);
|
|
885
|
+
}
|
|
886
|
+
var require2, _twEngine, _twEngineError;
|
|
887
|
+
var init_tailwindEngine = __esm({
|
|
888
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
889
|
+
require2 = createRequire(import.meta.url);
|
|
890
|
+
_twEngine = null;
|
|
891
|
+
_twEngineError = null;
|
|
892
|
+
}
|
|
893
|
+
});
|
|
844
894
|
|
|
845
895
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
846
896
|
var tailwindEngine_exports = {};
|
|
@@ -974,10 +1024,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
974
1024
|
}
|
|
975
1025
|
_cacheMisses++;
|
|
976
1026
|
let rawCss;
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1027
|
+
try {
|
|
1028
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
1029
|
+
} catch {
|
|
1030
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
1031
|
+
}
|
|
981
1032
|
let finalCss = rawCss;
|
|
982
1033
|
if (minify) {
|
|
983
1034
|
if (minifier === "fast") {
|
|
@@ -988,7 +1039,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
988
1039
|
}
|
|
989
1040
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
990
1041
|
console.log(
|
|
991
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
1042
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
992
1043
|
`Size: ${finalCss.length} bytes`
|
|
993
1044
|
);
|
|
994
1045
|
}
|
|
@@ -1017,11 +1068,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1017
1068
|
return result.css;
|
|
1018
1069
|
}
|
|
1019
1070
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1020
|
-
var
|
|
1071
|
+
var init_tailwindEngine2 = __esm({
|
|
1021
1072
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1022
1073
|
init_nativeBridge();
|
|
1023
1074
|
init_cssGeneratorNative();
|
|
1024
1075
|
init_cssCompilationNative();
|
|
1076
|
+
init_tailwindEngine();
|
|
1025
1077
|
createRequire(import.meta.url);
|
|
1026
1078
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1027
1079
|
_cacheHits = 0;
|
|
@@ -1038,7 +1090,7 @@ var init_compiler = __esm({
|
|
|
1038
1090
|
init_cssCompilationNative();
|
|
1039
1091
|
init_idRegistryNative();
|
|
1040
1092
|
init_streamingNative();
|
|
1041
|
-
|
|
1093
|
+
init_tailwindEngine2();
|
|
1042
1094
|
}
|
|
1043
1095
|
});
|
|
1044
1096
|
|
|
@@ -2284,7 +2336,7 @@ var init_src = __esm({
|
|
|
2284
2336
|
};
|
|
2285
2337
|
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2286
2338
|
try {
|
|
2287
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
2339
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
2288
2340
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2289
2341
|
return result.css;
|
|
2290
2342
|
} catch {
|
|
@@ -2799,7 +2851,7 @@ __export(internal_exports, {
|
|
|
2799
2851
|
var init_internal = __esm({
|
|
2800
2852
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2801
2853
|
init_src();
|
|
2802
|
-
|
|
2854
|
+
init_tailwindEngine2();
|
|
2803
2855
|
init_compiler();
|
|
2804
2856
|
init_parser();
|
|
2805
2857
|
init_analyzer();
|
|
@@ -4100,7 +4152,7 @@ function getDirnameFromUrl2(importMetaUrl) {
|
|
|
4100
4152
|
const lastSlash = Math.max(importMetaUrl.lastIndexOf("/"), importMetaUrl.lastIndexOf("\\"));
|
|
4101
4153
|
return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : "";
|
|
4102
4154
|
}
|
|
4103
|
-
var
|
|
4155
|
+
var require4 = createRequire(import.meta.url);
|
|
4104
4156
|
var resolveRuntimeDir2 = () => getDirnameFromUrl2(import.meta.url);
|
|
4105
4157
|
var resolveLoaderPath2 = (basename) => {
|
|
4106
4158
|
try {
|
|
@@ -4124,8 +4176,8 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4124
4176
|
};
|
|
4125
4177
|
function checkNextVersion() {
|
|
4126
4178
|
try {
|
|
4127
|
-
const pkgPath =
|
|
4128
|
-
const { version } =
|
|
4179
|
+
const pkgPath = require4.resolve("next/package.json");
|
|
4180
|
+
const { version } = require4(pkgPath);
|
|
4129
4181
|
const major = Number.parseInt(version.split(".")[0], 10);
|
|
4130
4182
|
if (major < 15) {
|
|
4131
4183
|
console.warn(
|