tailwind-styled-v4 5.0.34 → 5.0.36
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/README.md +458 -339
- package/dist/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +9 -6
- package/dist/cli.mjs.map +1 -1
- 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.browser.mjs +689 -508
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +98 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -28
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +304 -182
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +304 -182
- 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/svelte.js +4 -4
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +4 -4
- package/dist/svelte.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/tw.js +9 -6
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +9 -6
- package/dist/tw.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/dist/vue.js +4 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +4 -4
- package/dist/vue.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +7 -5
package/dist/compiler.js
CHANGED
|
@@ -773,6 +773,56 @@ var init_streamingNative = __esm({
|
|
|
773
773
|
init_nativeBridge();
|
|
774
774
|
}
|
|
775
775
|
});
|
|
776
|
+
function loadTailwindEngine() {
|
|
777
|
+
if (_twEngine) return _twEngine;
|
|
778
|
+
if (_twEngineError) throw _twEngineError;
|
|
779
|
+
try {
|
|
780
|
+
const tw = require2("tailwindcss");
|
|
781
|
+
if (typeof tw.compile !== "function") {
|
|
782
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
783
|
+
}
|
|
784
|
+
_twEngine = tw;
|
|
785
|
+
return _twEngine;
|
|
786
|
+
} catch (e) {
|
|
787
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
788
|
+
throw _twEngineError;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
792
|
+
if (classes.length === 0) return "";
|
|
793
|
+
const tw = loadTailwindEngine();
|
|
794
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
795
|
+
const { readFileSync, existsSync: existsSync2 } = await import('fs');
|
|
796
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
797
|
+
const projectRoot = root ?? process.cwd();
|
|
798
|
+
const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
|
|
799
|
+
const loadStylesheet = async (id, base) => {
|
|
800
|
+
try {
|
|
801
|
+
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;
|
|
802
|
+
const pkgPath = req.resolve(cssId);
|
|
803
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
804
|
+
} catch {
|
|
805
|
+
try {
|
|
806
|
+
const absPath = resolve2(base, id);
|
|
807
|
+
if (existsSync2(absPath)) {
|
|
808
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
809
|
+
}
|
|
810
|
+
} catch {
|
|
811
|
+
}
|
|
812
|
+
return { content: "", base };
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
816
|
+
return compiler.build(classes);
|
|
817
|
+
}
|
|
818
|
+
var require2, _twEngine, _twEngineError;
|
|
819
|
+
var init_tailwindEngine = __esm({
|
|
820
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
821
|
+
require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
|
|
822
|
+
_twEngine = null;
|
|
823
|
+
_twEngineError = null;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
776
826
|
|
|
777
827
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
778
828
|
var tailwindEngine_exports = {};
|
|
@@ -906,10 +956,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
906
956
|
}
|
|
907
957
|
_cacheMisses++;
|
|
908
958
|
let rawCss;
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
959
|
+
try {
|
|
960
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
961
|
+
} catch {
|
|
962
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
963
|
+
}
|
|
913
964
|
let finalCss = rawCss;
|
|
914
965
|
if (minify) {
|
|
915
966
|
if (minifier === "fast") {
|
|
@@ -920,7 +971,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
920
971
|
}
|
|
921
972
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
922
973
|
console.log(
|
|
923
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
974
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
924
975
|
`Size: ${finalCss.length} bytes`
|
|
925
976
|
);
|
|
926
977
|
}
|
|
@@ -949,11 +1000,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
949
1000
|
return result.css;
|
|
950
1001
|
}
|
|
951
1002
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
952
|
-
var
|
|
1003
|
+
var init_tailwindEngine2 = __esm({
|
|
953
1004
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
954
1005
|
init_nativeBridge();
|
|
955
1006
|
init_cssGeneratorNative();
|
|
956
1007
|
init_cssCompilationNative();
|
|
1008
|
+
init_tailwindEngine();
|
|
957
1009
|
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
|
|
958
1010
|
_cssCache = /* @__PURE__ */ new Map();
|
|
959
1011
|
_cacheHits = 0;
|
|
@@ -970,7 +1022,7 @@ var init_compiler = __esm({
|
|
|
970
1022
|
init_cssCompilationNative();
|
|
971
1023
|
init_idRegistryNative();
|
|
972
1024
|
init_streamingNative();
|
|
973
|
-
|
|
1025
|
+
init_tailwindEngine2();
|
|
974
1026
|
}
|
|
975
1027
|
});
|
|
976
1028
|
|
|
@@ -1992,7 +2044,7 @@ var init_src2 = __esm({
|
|
|
1992
2044
|
};
|
|
1993
2045
|
exports.generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
1994
2046
|
try {
|
|
1995
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
2047
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
1996
2048
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
1997
2049
|
return result.css;
|
|
1998
2050
|
} catch {
|