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/turbopackLoader.mjs
CHANGED
|
@@ -744,6 +744,56 @@ var init_streamingNative = __esm({
|
|
|
744
744
|
init_nativeBridge();
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
|
+
function loadTailwindEngine() {
|
|
748
|
+
if (_twEngine) return _twEngine;
|
|
749
|
+
if (_twEngineError) throw _twEngineError;
|
|
750
|
+
try {
|
|
751
|
+
const tw = require2("tailwindcss");
|
|
752
|
+
if (typeof tw.compile !== "function") {
|
|
753
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
754
|
+
}
|
|
755
|
+
_twEngine = tw;
|
|
756
|
+
return _twEngine;
|
|
757
|
+
} catch (e) {
|
|
758
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
759
|
+
throw _twEngineError;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
763
|
+
if (classes.length === 0) return "";
|
|
764
|
+
const tw = loadTailwindEngine();
|
|
765
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
766
|
+
const { readFileSync, existsSync: existsSync2 } = await import('fs');
|
|
767
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
768
|
+
const projectRoot = root ?? process.cwd();
|
|
769
|
+
const req = createRequire(resolve2(projectRoot, "package.json"));
|
|
770
|
+
const loadStylesheet = async (id, base) => {
|
|
771
|
+
try {
|
|
772
|
+
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;
|
|
773
|
+
const pkgPath = req.resolve(cssId);
|
|
774
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
775
|
+
} catch {
|
|
776
|
+
try {
|
|
777
|
+
const absPath = resolve2(base, id);
|
|
778
|
+
if (existsSync2(absPath)) {
|
|
779
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
780
|
+
}
|
|
781
|
+
} catch {
|
|
782
|
+
}
|
|
783
|
+
return { content: "", base };
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
787
|
+
return compiler.build(classes);
|
|
788
|
+
}
|
|
789
|
+
var require2, _twEngine, _twEngineError;
|
|
790
|
+
var init_tailwindEngine = __esm({
|
|
791
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
792
|
+
require2 = createRequire(import.meta.url);
|
|
793
|
+
_twEngine = null;
|
|
794
|
+
_twEngineError = null;
|
|
795
|
+
}
|
|
796
|
+
});
|
|
747
797
|
|
|
748
798
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
749
799
|
var tailwindEngine_exports = {};
|
|
@@ -877,10 +927,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
877
927
|
}
|
|
878
928
|
_cacheMisses++;
|
|
879
929
|
let rawCss;
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
930
|
+
try {
|
|
931
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
932
|
+
} catch {
|
|
933
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
934
|
+
}
|
|
884
935
|
let finalCss = rawCss;
|
|
885
936
|
if (minify) {
|
|
886
937
|
if (minifier === "fast") {
|
|
@@ -891,7 +942,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
891
942
|
}
|
|
892
943
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
893
944
|
console.log(
|
|
894
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
945
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
895
946
|
`Size: ${finalCss.length} bytes`
|
|
896
947
|
);
|
|
897
948
|
}
|
|
@@ -920,11 +971,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
920
971
|
return result.css;
|
|
921
972
|
}
|
|
922
973
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
923
|
-
var
|
|
974
|
+
var init_tailwindEngine2 = __esm({
|
|
924
975
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
925
976
|
init_nativeBridge();
|
|
926
977
|
init_cssGeneratorNative();
|
|
927
978
|
init_cssCompilationNative();
|
|
979
|
+
init_tailwindEngine();
|
|
928
980
|
createRequire(import.meta.url);
|
|
929
981
|
_cssCache = /* @__PURE__ */ new Map();
|
|
930
982
|
_cacheHits = 0;
|
|
@@ -1962,7 +2014,7 @@ var init_src2 = __esm({
|
|
|
1962
2014
|
};
|
|
1963
2015
|
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
1964
2016
|
try {
|
|
1965
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
2017
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
1966
2018
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
1967
2019
|
return result.css;
|
|
1968
2020
|
} catch {
|
|
@@ -2472,7 +2524,7 @@ __export(internal_exports, {
|
|
|
2472
2524
|
var init_internal = __esm({
|
|
2473
2525
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2474
2526
|
init_src2();
|
|
2475
|
-
|
|
2527
|
+
init_tailwindEngine2();
|
|
2476
2528
|
init_compiler();
|
|
2477
2529
|
init_parser();
|
|
2478
2530
|
init_analyzer();
|