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/vite.mjs
CHANGED
|
@@ -1168,6 +1168,56 @@ var init_cssCompilationNative = __esm({
|
|
|
1168
1168
|
init_nativeBridge();
|
|
1169
1169
|
}
|
|
1170
1170
|
});
|
|
1171
|
+
function loadTailwindEngine() {
|
|
1172
|
+
if (_twEngine) return _twEngine;
|
|
1173
|
+
if (_twEngineError) throw _twEngineError;
|
|
1174
|
+
try {
|
|
1175
|
+
const tw = require2("tailwindcss");
|
|
1176
|
+
if (typeof tw.compile !== "function") {
|
|
1177
|
+
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
1178
|
+
}
|
|
1179
|
+
_twEngine = tw;
|
|
1180
|
+
return _twEngine;
|
|
1181
|
+
} catch (e) {
|
|
1182
|
+
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
1183
|
+
throw _twEngineError;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
1187
|
+
if (classes.length === 0) return "";
|
|
1188
|
+
const tw = loadTailwindEngine();
|
|
1189
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1190
|
+
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
1191
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
1192
|
+
const projectRoot = root ?? process.cwd();
|
|
1193
|
+
const req = createRequire(resolve2(projectRoot, "package.json"));
|
|
1194
|
+
const loadStylesheet = async (id, base) => {
|
|
1195
|
+
try {
|
|
1196
|
+
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;
|
|
1197
|
+
const pkgPath = req.resolve(cssId);
|
|
1198
|
+
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
1199
|
+
} catch {
|
|
1200
|
+
try {
|
|
1201
|
+
const absPath = resolve2(base, id);
|
|
1202
|
+
if (existsSync3(absPath)) {
|
|
1203
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
1204
|
+
}
|
|
1205
|
+
} catch {
|
|
1206
|
+
}
|
|
1207
|
+
return { content: "", base };
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
1211
|
+
return compiler.build(classes);
|
|
1212
|
+
}
|
|
1213
|
+
var require2, _twEngine, _twEngineError;
|
|
1214
|
+
var init_tailwindEngine = __esm({
|
|
1215
|
+
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1216
|
+
require2 = createRequire(import.meta.url);
|
|
1217
|
+
_twEngine = null;
|
|
1218
|
+
_twEngineError = null;
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1171
1221
|
|
|
1172
1222
|
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
1173
1223
|
var tailwindEngine_exports = {};
|
|
@@ -1301,10 +1351,11 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
1301
1351
|
}
|
|
1302
1352
|
_cacheMisses++;
|
|
1303
1353
|
let rawCss;
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1354
|
+
try {
|
|
1355
|
+
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
1356
|
+
} catch {
|
|
1357
|
+
rawCss = await generateCssNative(unique, { theme: getThemeConfig() });
|
|
1358
|
+
}
|
|
1308
1359
|
let finalCss = rawCss;
|
|
1309
1360
|
if (minify) {
|
|
1310
1361
|
if (minifier === "fast") {
|
|
@@ -1315,7 +1366,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true, min
|
|
|
1315
1366
|
}
|
|
1316
1367
|
if (process.env.DEBUG?.includes("compiler")) {
|
|
1317
1368
|
console.log(
|
|
1318
|
-
`[Compiler] Generated CSS from ${unique.length} classes
|
|
1369
|
+
`[Compiler] Generated CSS from ${unique.length} classes`,
|
|
1319
1370
|
`Size: ${finalCss.length} bytes`
|
|
1320
1371
|
);
|
|
1321
1372
|
}
|
|
@@ -1344,11 +1395,12 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1344
1395
|
return result.css;
|
|
1345
1396
|
}
|
|
1346
1397
|
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1347
|
-
var
|
|
1398
|
+
var init_tailwindEngine2 = __esm({
|
|
1348
1399
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1349
1400
|
init_nativeBridge();
|
|
1350
1401
|
init_cssGeneratorNative();
|
|
1351
1402
|
init_cssCompilationNative();
|
|
1403
|
+
init_tailwindEngine();
|
|
1352
1404
|
createRequire(import.meta.url);
|
|
1353
1405
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1354
1406
|
_cacheHits = 0;
|
|
@@ -2833,7 +2885,7 @@ __export(internal_exports, {
|
|
|
2833
2885
|
var init_internal = __esm({
|
|
2834
2886
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2835
2887
|
init_src2();
|
|
2836
|
-
|
|
2888
|
+
init_tailwindEngine2();
|
|
2837
2889
|
init_compiler();
|
|
2838
2890
|
init_parser();
|
|
2839
2891
|
init_analyzer();
|
|
@@ -3661,7 +3713,7 @@ var init_src2 = __esm({
|
|
|
3661
3713
|
};
|
|
3662
3714
|
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
3663
3715
|
try {
|
|
3664
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (
|
|
3716
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine2(), tailwindEngine_exports));
|
|
3665
3717
|
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
3666
3718
|
return result.css;
|
|
3667
3719
|
} catch {
|