tailwind-styled-v4 5.0.10 → 5.0.11
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 +245 -373
- package/dist/analyzer.js +75 -22
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +74 -21
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +4 -2
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +4 -2
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +20 -5
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +20 -5
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +174 -67
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +171 -64
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +7 -1
- package/dist/compiler.d.ts +7 -1
- package/dist/compiler.js +53 -27
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +53 -27
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +159 -61
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +159 -61
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +1512 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.d.mts +94 -12
- package/dist/index.d.ts +94 -12
- package/dist/index.js +436 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -106
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +1946 -47
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +1929 -44
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +23 -10
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +23 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs.map +1 -1
- package/dist/scanner.js +72 -19
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +71 -18
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.js +32 -15
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +32 -15
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +38 -12
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -12
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +17 -5
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +17 -5
- package/dist/syntax.mjs.map +1 -1
- package/dist/theme.js +4 -2
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +4 -2
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +87 -33
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +87 -33
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +174 -67
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +171 -64
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +145 -63
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +145 -63
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +38 -12
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -12
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +20 -5
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +20 -5
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +29 -24
package/dist/compiler.d.mts
CHANGED
|
@@ -165,6 +165,12 @@ type LoaderOutput = {
|
|
|
165
165
|
code: string;
|
|
166
166
|
changed: boolean;
|
|
167
167
|
classes: string[];
|
|
168
|
+
rsc?: {
|
|
169
|
+
isServer?: boolean;
|
|
170
|
+
needsClientDirective?: boolean;
|
|
171
|
+
clientReasons?: string[];
|
|
172
|
+
};
|
|
173
|
+
engine?: string;
|
|
168
174
|
};
|
|
169
175
|
declare const transformSource: (source: string, opts?: Record<string, unknown>) => NativeTransformResult;
|
|
170
176
|
declare const hasTwUsage: (source: string) => boolean;
|
|
@@ -173,7 +179,7 @@ declare const shouldProcess: (source: string) => boolean;
|
|
|
173
179
|
declare const compileCssFromClasses: (classes: string[], prefix?: string | null) => NativeTransformResult;
|
|
174
180
|
declare const buildStyleTag: (classes: string[]) => string;
|
|
175
181
|
declare const compileCssNative: (classes: string[], prefix?: string | null) => NativeTransformResult;
|
|
176
|
-
declare const generateCssForClasses: (classes: string[], _tailwindConfig?: Record<string, unknown>,
|
|
182
|
+
declare const generateCssForClasses: (classes: string[], _tailwindConfig?: Record<string, unknown>, root?: string, cssEntryContent?: string, minify?: boolean) => Promise<string>;
|
|
177
183
|
declare const extractAllClasses: (source: string) => string[];
|
|
178
184
|
declare const extractClassesFromSource: (source: string) => string;
|
|
179
185
|
declare const astExtractClasses: (source: string, filename: string) => string[];
|
package/dist/compiler.d.ts
CHANGED
|
@@ -165,6 +165,12 @@ type LoaderOutput = {
|
|
|
165
165
|
code: string;
|
|
166
166
|
changed: boolean;
|
|
167
167
|
classes: string[];
|
|
168
|
+
rsc?: {
|
|
169
|
+
isServer?: boolean;
|
|
170
|
+
needsClientDirective?: boolean;
|
|
171
|
+
clientReasons?: string[];
|
|
172
|
+
};
|
|
173
|
+
engine?: string;
|
|
168
174
|
};
|
|
169
175
|
declare const transformSource: (source: string, opts?: Record<string, unknown>) => NativeTransformResult;
|
|
170
176
|
declare const hasTwUsage: (source: string) => boolean;
|
|
@@ -173,7 +179,7 @@ declare const shouldProcess: (source: string) => boolean;
|
|
|
173
179
|
declare const compileCssFromClasses: (classes: string[], prefix?: string | null) => NativeTransformResult;
|
|
174
180
|
declare const buildStyleTag: (classes: string[]) => string;
|
|
175
181
|
declare const compileCssNative: (classes: string[], prefix?: string | null) => NativeTransformResult;
|
|
176
|
-
declare const generateCssForClasses: (classes: string[], _tailwindConfig?: Record<string, unknown>,
|
|
182
|
+
declare const generateCssForClasses: (classes: string[], _tailwindConfig?: Record<string, unknown>, root?: string, cssEntryContent?: string, minify?: boolean) => Promise<string>;
|
|
177
183
|
declare const extractAllClasses: (source: string) => string[];
|
|
178
184
|
declare const extractClassesFromSource: (source: string) => string;
|
|
179
185
|
declare const astExtractClasses: (source: string, filename: string) => string[];
|
package/dist/compiler.js
CHANGED
|
@@ -76,9 +76,24 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
76
76
|
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
80
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
81
|
+
if (runtimeDir) {
|
|
82
|
+
for (const depth of ["..", path__namespace.join("..", ".."), path__namespace.join("..", "..", "..")]) {
|
|
83
|
+
const pkgRoot = path__namespace.resolve(runtimeDir, depth);
|
|
84
|
+
for (const bin of BINARY_NAMES_SELF) {
|
|
85
|
+
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
86
|
+
const candidate = path__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
87
|
+
tried.push(`self-bundled:${candidate}`);
|
|
88
|
+
if (fs__namespace.existsSync(candidate)) {
|
|
89
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
79
95
|
const cwd = process.cwd();
|
|
80
96
|
const base = runtimeDir ?? cwd;
|
|
81
|
-
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
82
97
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
83
98
|
const localCandidates = [];
|
|
84
99
|
for (const bin of BINARY_NAMES) {
|
|
@@ -116,12 +131,12 @@ var init_native_resolution = __esm({
|
|
|
116
131
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
117
132
|
_require = typeof __require !== "undefined" ? __require : 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)));
|
|
118
133
|
PLATFORM_MAP = {
|
|
119
|
-
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
120
|
-
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
134
|
+
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
135
|
+
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
121
136
|
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
122
137
|
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
123
|
-
"win32-x64": ["@tailwind-styled/native-win32-x64"],
|
|
124
|
-
"win32-arm64": ["@tailwind-styled/native-win32-arm64"]
|
|
138
|
+
"win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
|
|
139
|
+
"win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
|
|
125
140
|
};
|
|
126
141
|
}
|
|
127
142
|
});
|
|
@@ -240,10 +255,34 @@ function loadTailwindEngine() {
|
|
|
240
255
|
throw _twEngineError;
|
|
241
256
|
}
|
|
242
257
|
}
|
|
243
|
-
function generateRawCss(classes) {
|
|
258
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
244
259
|
if (classes.length === 0) return "";
|
|
245
260
|
const tw = loadTailwindEngine();
|
|
246
|
-
const
|
|
261
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
262
|
+
const { readFileSync, existsSync: existsSync2 } = await import('fs');
|
|
263
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
264
|
+
const projectRoot = root ?? process.cwd();
|
|
265
|
+
const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
|
|
266
|
+
const loadStylesheet = async (id, base) => {
|
|
267
|
+
try {
|
|
268
|
+
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;
|
|
269
|
+
const pkgPath = req.resolve(cssId);
|
|
270
|
+
return {
|
|
271
|
+
content: readFileSync(pkgPath, "utf-8"),
|
|
272
|
+
base: dirname(pkgPath)
|
|
273
|
+
};
|
|
274
|
+
} catch {
|
|
275
|
+
try {
|
|
276
|
+
const absPath = resolve2(base, id);
|
|
277
|
+
if (existsSync2(absPath)) {
|
|
278
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
279
|
+
}
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
return { content: "", base };
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
247
286
|
return compiler.build(classes);
|
|
248
287
|
}
|
|
249
288
|
function postProcessWithLightning(rawCss) {
|
|
@@ -255,14 +294,14 @@ function postProcessWithLightning(rawCss) {
|
|
|
255
294
|
const result = native.processTailwindCssLightning(rawCss);
|
|
256
295
|
return result?.css ?? rawCss;
|
|
257
296
|
}
|
|
258
|
-
async function runCssPipeline(classes) {
|
|
297
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
259
298
|
const unique = [...new Set(classes.filter(Boolean))];
|
|
260
299
|
if (unique.length === 0) {
|
|
261
300
|
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
262
301
|
}
|
|
263
|
-
const rawCss = generateRawCss(unique);
|
|
302
|
+
const rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
264
303
|
const native = exports.getNativeBridge();
|
|
265
|
-
const hasLightning = typeof native.processTailwindCssLightning === "function";
|
|
304
|
+
const hasLightning = minify && typeof native.processTailwindCssLightning === "function";
|
|
266
305
|
const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
|
|
267
306
|
return {
|
|
268
307
|
css: finalCss,
|
|
@@ -271,21 +310,8 @@ async function runCssPipeline(classes) {
|
|
|
271
310
|
optimized: hasLightning
|
|
272
311
|
};
|
|
273
312
|
}
|
|
274
|
-
function runCssPipelineSync(
|
|
275
|
-
|
|
276
|
-
if (unique.length === 0) {
|
|
277
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
278
|
-
}
|
|
279
|
-
const rawCss = generateRawCss(unique);
|
|
280
|
-
const native = exports.getNativeBridge();
|
|
281
|
-
const hasLightning = typeof native.processTailwindCssLightning === "function";
|
|
282
|
-
const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
|
|
283
|
-
return {
|
|
284
|
-
css: finalCss,
|
|
285
|
-
classes: unique,
|
|
286
|
-
sizeBytes: finalCss.length,
|
|
287
|
-
optimized: hasLightning
|
|
288
|
-
};
|
|
313
|
+
function runCssPipelineSync(_classes) {
|
|
314
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
289
315
|
}
|
|
290
316
|
function processTailwindCssWithTargets(css, targets) {
|
|
291
317
|
const native = exports.getNativeBridge();
|
|
@@ -353,9 +379,9 @@ var buildStyleTag = (classes) => {
|
|
|
353
379
|
var compileCssNative = (classes, prefix = null) => {
|
|
354
380
|
return compileCssFromClasses(classes, prefix);
|
|
355
381
|
};
|
|
356
|
-
var generateCssForClasses = async (classes, _tailwindConfig,
|
|
382
|
+
var generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
357
383
|
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
358
|
-
const result = await runCssPipeline2(classes);
|
|
384
|
+
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
359
385
|
return result.css;
|
|
360
386
|
};
|
|
361
387
|
var extractAllClasses = (source) => {
|