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/index.mjs
CHANGED
|
@@ -1589,6 +1589,56 @@ var init_streamingNative = __esm({
|
|
|
1589
1589
|
init_nativeBridge();
|
|
1590
1590
|
}
|
|
1591
1591
|
});
|
|
1592
|
+
function loadTailwindEngine() {
|
|
1593
|
+
if (_twEngine) return _twEngine;
|
|
1594
|
+
if (_twEngineError) throw _twEngineError;
|
|
1595
|
+
try {
|
|
1596
|
+
const tw2 = require2("tailwindcss");
|
|
1597
|
+
if (typeof tw2.compile !== "function") {
|
|
1598
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
1599
|
+
}
|
|
1600
|
+
_twEngine = tw2;
|
|
1601
|
+
return _twEngine;
|
|
1602
|
+
} catch (e) {
|
|
1603
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
1604
|
+
throw _twEngineError;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
1608
|
+
if (classes.length === 0) return "";
|
|
1609
|
+
const tw2 = loadTailwindEngine();
|
|
1610
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1611
|
+
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
1612
|
+
const { dirname: dirname2, resolve: resolve2 } = await import('path');
|
|
1613
|
+
const projectRoot = root ?? process.cwd();
|
|
1614
|
+
const req = createRequire(resolve2(projectRoot, "package.json"));
|
|
1615
|
+
const loadStylesheet = async (id, base) => {
|
|
1616
|
+
try {
|
|
1617
|
+
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;
|
|
1618
|
+
const pkgPath = req.resolve(cssId);
|
|
1619
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname2(pkgPath) };
|
|
1620
|
+
} catch {
|
|
1621
|
+
try {
|
|
1622
|
+
const absPath = resolve2(base, id);
|
|
1623
|
+
if (existsSync3(absPath)) {
|
|
1624
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname2(absPath) };
|
|
1625
|
+
}
|
|
1626
|
+
} catch {
|
|
1627
|
+
}
|
|
1628
|
+
return { content: "", base };
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
const compiler = await Promise.resolve(tw2.compile(input, { loadStylesheet }));
|
|
1632
|
+
return compiler.build(classes);
|
|
1633
|
+
}
|
|
1634
|
+
var require2, _twEngine, _twEngineError;
|
|
1635
|
+
var init_tailwindEngine = __esm({
|
|
1636
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1637
|
+
require2 = createRequire(import.meta.url);
|
|
1638
|
+
_twEngine = null;
|
|
1639
|
+
_twEngineError = null;
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1592
1642
|
|
|
1593
1643
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
1594
1644
|
var tailwindEngine_exports = {};
|
|
@@ -1722,10 +1772,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
1722
1772
|
}
|
|
1723
1773
|
_cacheMisses++;
|
|
1724
1774
|
let rawCss;
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1775
|
+
try {
|
|
1776
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
1777
|
+
} catch {
|
|
1778
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
1779
|
+
}
|
|
1729
1780
|
let finalCss = rawCss;
|
|
1730
1781
|
if (minify) {
|
|
1731
1782
|
if (minifier === "fast") {
|
|
@@ -1736,7 +1787,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
1736
1787
|
}
|
|
1737
1788
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
1738
1789
|
console.log(
|
|
1739
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
1790
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
1740
1791
|
`Size: ${finalCss.length} bytes`
|
|
1741
1792
|
);
|
|
1742
1793
|
}
|
|
@@ -1765,11 +1816,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1765
1816
|
return result.css;
|
|
1766
1817
|
}
|
|
1767
1818
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1768
|
-
var
|
|
1819
|
+
var init_tailwindEngine2 = __esm({
|
|
1769
1820
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1770
1821
|
init_nativeBridge();
|
|
1771
1822
|
init_cssGeneratorNative();
|
|
1772
1823
|
init_cssCompilationNative();
|
|
1824
|
+
init_tailwindEngine();
|
|
1773
1825
|
createRequire(import.meta.url);
|
|
1774
1826
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1775
1827
|
_cacheHits = 0;
|
|
@@ -2807,7 +2859,7 @@ var init_src = __esm({
|
|
|
2807
2859
|
};
|
|
2808
2860
|
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2809
2861
|
try {
|
|
2810
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
2862
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
2811
2863
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2812
2864
|
return result.css;
|
|
2813
2865
|
} catch {
|
|
@@ -3317,7 +3369,7 @@ __export(internal_exports, {
|
|
|
3317
3369
|
var init_internal = __esm({
|
|
3318
3370
|
"packages/domain/compiler/src/internal.ts"() {
|
|
3319
3371
|
init_src();
|
|
3320
|
-
|
|
3372
|
+
init_tailwindEngine2();
|
|
3321
3373
|
init_compiler();
|
|
3322
3374
|
init_parser();
|
|
3323
3375
|
init_analyzer();
|