tailwind-styled-v4 5.0.33 → 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.js
CHANGED
|
@@ -863,6 +863,56 @@ var init_streamingNative = __esm({
|
|
|
863
863
|
init_nativeBridge();
|
|
864
864
|
}
|
|
865
865
|
});
|
|
866
|
+
function loadTailwindEngine() {
|
|
867
|
+
if (_twEngine) return _twEngine;
|
|
868
|
+
if (_twEngineError) throw _twEngineError;
|
|
869
|
+
try {
|
|
870
|
+
const tw = require2("tailwindcss");
|
|
871
|
+
if (typeof tw.compile !== "function") {
|
|
872
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
873
|
+
}
|
|
874
|
+
_twEngine = tw;
|
|
875
|
+
return _twEngine;
|
|
876
|
+
} catch (e) {
|
|
877
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
878
|
+
throw _twEngineError;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
882
|
+
if (classes.length === 0) return "";
|
|
883
|
+
const tw = loadTailwindEngine();
|
|
884
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
885
|
+
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
886
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
887
|
+
const projectRoot = root ?? process.cwd();
|
|
888
|
+
const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
|
|
889
|
+
const loadStylesheet = async (id, base) => {
|
|
890
|
+
try {
|
|
891
|
+
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;
|
|
892
|
+
const pkgPath = req.resolve(cssId);
|
|
893
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
894
|
+
} catch {
|
|
895
|
+
try {
|
|
896
|
+
const absPath = resolve2(base, id);
|
|
897
|
+
if (existsSync3(absPath)) {
|
|
898
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
899
|
+
}
|
|
900
|
+
} catch {
|
|
901
|
+
}
|
|
902
|
+
return { content: "", base };
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
906
|
+
return compiler.build(classes);
|
|
907
|
+
}
|
|
908
|
+
var require2, _twEngine, _twEngineError;
|
|
909
|
+
var init_tailwindEngine = __esm({
|
|
910
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
911
|
+
require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)));
|
|
912
|
+
_twEngine = null;
|
|
913
|
+
_twEngineError = null;
|
|
914
|
+
}
|
|
915
|
+
});
|
|
866
916
|
|
|
867
917
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
868
918
|
var tailwindEngine_exports = {};
|
|
@@ -996,10 +1046,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
996
1046
|
}
|
|
997
1047
|
_cacheMisses++;
|
|
998
1048
|
let rawCss;
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1049
|
+
try {
|
|
1050
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
1051
|
+
} catch {
|
|
1052
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
1053
|
+
}
|
|
1003
1054
|
let finalCss = rawCss;
|
|
1004
1055
|
if (minify) {
|
|
1005
1056
|
if (minifier === "fast") {
|
|
@@ -1010,7 +1061,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
1010
1061
|
}
|
|
1011
1062
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
1012
1063
|
console.log(
|
|
1013
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
1064
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
1014
1065
|
`Size: ${finalCss.length} bytes`
|
|
1015
1066
|
);
|
|
1016
1067
|
}
|
|
@@ -1039,11 +1090,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1039
1090
|
return result.css;
|
|
1040
1091
|
}
|
|
1041
1092
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1042
|
-
var
|
|
1093
|
+
var init_tailwindEngine2 = __esm({
|
|
1043
1094
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1044
1095
|
init_nativeBridge();
|
|
1045
1096
|
init_cssGeneratorNative();
|
|
1046
1097
|
init_cssCompilationNative();
|
|
1098
|
+
init_tailwindEngine();
|
|
1047
1099
|
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)));
|
|
1048
1100
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1049
1101
|
_cacheHits = 0;
|
|
@@ -1060,7 +1112,7 @@ var init_compiler = __esm({
|
|
|
1060
1112
|
init_cssCompilationNative();
|
|
1061
1113
|
init_idRegistryNative();
|
|
1062
1114
|
init_streamingNative();
|
|
1063
|
-
|
|
1115
|
+
init_tailwindEngine2();
|
|
1064
1116
|
}
|
|
1065
1117
|
});
|
|
1066
1118
|
|
|
@@ -2306,7 +2358,7 @@ var init_src = __esm({
|
|
|
2306
2358
|
};
|
|
2307
2359
|
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2308
2360
|
try {
|
|
2309
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
2361
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
2310
2362
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2311
2363
|
return result.css;
|
|
2312
2364
|
} catch {
|
|
@@ -2821,7 +2873,7 @@ __export(internal_exports, {
|
|
|
2821
2873
|
var init_internal = __esm({
|
|
2822
2874
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2823
2875
|
init_src();
|
|
2824
|
-
|
|
2876
|
+
init_tailwindEngine2();
|
|
2825
2877
|
init_compiler();
|
|
2826
2878
|
init_parser();
|
|
2827
2879
|
init_analyzer();
|
|
@@ -4122,7 +4174,7 @@ function getDirnameFromUrl2(importMetaUrl) {
|
|
|
4122
4174
|
const lastSlash = Math.max(importMetaUrl.lastIndexOf("/"), importMetaUrl.lastIndexOf("\\"));
|
|
4123
4175
|
return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : "";
|
|
4124
4176
|
}
|
|
4125
|
-
var
|
|
4177
|
+
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)));
|
|
4126
4178
|
var resolveRuntimeDir2 = () => getDirnameFromUrl2((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)));
|
|
4127
4179
|
var resolveLoaderPath2 = (basename) => {
|
|
4128
4180
|
try {
|
|
@@ -4146,8 +4198,8 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4146
4198
|
};
|
|
4147
4199
|
function checkNextVersion() {
|
|
4148
4200
|
try {
|
|
4149
|
-
const pkgPath =
|
|
4150
|
-
const { version } =
|
|
4201
|
+
const pkgPath = require4.resolve("next/package.json");
|
|
4202
|
+
const { version } = require4(pkgPath);
|
|
4151
4203
|
const major = Number.parseInt(version.split(".")[0], 10);
|
|
4152
4204
|
if (major < 15) {
|
|
4153
4205
|
console.warn(
|