tailwind-styled-v4 5.1.22 → 5.1.24
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 +216 -0
- package/dist/atomic.js +34 -4
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +31 -2
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +132 -97
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +129 -95
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +195 -1
- package/dist/compiler.d.ts +195 -1
- package/dist/compiler.js +356 -12
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +340 -10
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +194 -164
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +184 -155
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +136 -14
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +45 -4
- package/dist/index.d.ts +45 -4
- package/dist/index.js +166 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -21
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +489 -158
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +483 -153
- package/dist/next.mjs.map +1 -1
- package/dist/runtime-css.js +1 -1
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +1 -1
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +17 -0
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +23 -0
- package/dist/runtime.mjs.map +1 -1
- package/dist/shared.js +91 -61
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -56
- package/dist/shared.mjs.map +1 -1
- package/dist/turbopackLoader.js +79 -49
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +76 -47
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +132 -97
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +129 -95
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +157 -127
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +150 -121
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +39 -9
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +36 -7
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -182
package/dist/turbopackLoader.mjs
CHANGED
|
@@ -182,7 +182,7 @@ var init_nativeBridge = __esm({
|
|
|
182
182
|
"use strict";
|
|
183
183
|
init_esm_shims();
|
|
184
184
|
init_src();
|
|
185
|
-
_loadNative = (
|
|
185
|
+
_loadNative = (path8) => __require(path8);
|
|
186
186
|
log = (...args) => {
|
|
187
187
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
188
188
|
console.log("[compiler:native]", ...args);
|
|
@@ -2016,9 +2016,35 @@ var init_routeGraph = __esm({
|
|
|
2016
2016
|
}
|
|
2017
2017
|
});
|
|
2018
2018
|
|
|
2019
|
-
// packages/domain/compiler/src/
|
|
2019
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2020
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2021
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2022
|
+
"use strict";
|
|
2023
|
+
init_esm_shims();
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2028
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2029
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2030
|
+
"use strict";
|
|
2031
|
+
init_esm_shims();
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
|
|
2035
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2020
2036
|
import fs4 from "fs";
|
|
2021
2037
|
import path5 from "path";
|
|
2038
|
+
var init_typeGenerationPlugin = __esm({
|
|
2039
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2040
|
+
"use strict";
|
|
2041
|
+
init_esm_shims();
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
|
|
2045
|
+
// packages/domain/compiler/src/index.ts
|
|
2046
|
+
import fs5 from "fs";
|
|
2047
|
+
import path6 from "path";
|
|
2022
2048
|
import { createRequire as createRequire5 } from "module";
|
|
2023
2049
|
function _layoutClassesToCss(classes) {
|
|
2024
2050
|
const native = getNativeBridge();
|
|
@@ -2067,6 +2093,9 @@ var init_src2 = __esm({
|
|
|
2067
2093
|
init_redis();
|
|
2068
2094
|
init_watch();
|
|
2069
2095
|
init_routeGraph();
|
|
2096
|
+
init_semanticComponentAnalyzer();
|
|
2097
|
+
init_typeGeneratorFromMetadata();
|
|
2098
|
+
init_typeGenerationPlugin();
|
|
2070
2099
|
_require3 = createRequire5(
|
|
2071
2100
|
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2072
2101
|
);
|
|
@@ -2161,7 +2190,7 @@ var init_src2 = __esm({
|
|
|
2161
2190
|
};
|
|
2162
2191
|
scanProjectUsage = (dirs, cwd) => {
|
|
2163
2192
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
2164
|
-
const files = dirs.map((dir) =>
|
|
2193
|
+
const files = dirs.map((dir) => path6.resolve(cwd, dir));
|
|
2165
2194
|
const results = batchExtractClasses2(files) || [];
|
|
2166
2195
|
const combined = {};
|
|
2167
2196
|
for (const result of results) {
|
|
@@ -2178,13 +2207,13 @@ var init_src2 = __esm({
|
|
|
2178
2207
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2179
2208
|
const allClasses = Object.keys(classes).sort();
|
|
2180
2209
|
if (outputPath) {
|
|
2181
|
-
|
|
2210
|
+
fs5.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2182
2211
|
}
|
|
2183
2212
|
return allClasses;
|
|
2184
2213
|
};
|
|
2185
2214
|
loadSafelist = (safelistPath) => {
|
|
2186
2215
|
try {
|
|
2187
|
-
const content =
|
|
2216
|
+
const content = fs5.readFileSync(safelistPath, "utf-8");
|
|
2188
2217
|
return JSON.parse(content);
|
|
2189
2218
|
} catch {
|
|
2190
2219
|
return [];
|
|
@@ -2198,8 +2227,8 @@ var init_src2 = __esm({
|
|
|
2198
2227
|
"tailwind.config.cjs"
|
|
2199
2228
|
];
|
|
2200
2229
|
for (const file of configFiles) {
|
|
2201
|
-
const fullPath =
|
|
2202
|
-
if (
|
|
2230
|
+
const fullPath = path6.join(cwd, file);
|
|
2231
|
+
if (fs5.existsSync(fullPath)) {
|
|
2203
2232
|
const mod = __require(fullPath);
|
|
2204
2233
|
return mod.default || mod;
|
|
2205
2234
|
}
|
|
@@ -2209,9 +2238,9 @@ var init_src2 = __esm({
|
|
|
2209
2238
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2210
2239
|
return {
|
|
2211
2240
|
content: [
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2241
|
+
path6.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2242
|
+
path6.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2243
|
+
path6.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2215
2244
|
]
|
|
2216
2245
|
};
|
|
2217
2246
|
};
|
|
@@ -2671,12 +2700,12 @@ var init_internal = __esm({
|
|
|
2671
2700
|
// packages/presentation/next/src/turbopackLoader.ts
|
|
2672
2701
|
init_esm_shims();
|
|
2673
2702
|
init_internal();
|
|
2674
|
-
import
|
|
2675
|
-
import
|
|
2703
|
+
import fs6 from "fs";
|
|
2704
|
+
import path7 from "path";
|
|
2676
2705
|
var _writtenRules = /* @__PURE__ */ new Set();
|
|
2677
2706
|
function appendStaticCssToFile(staticCss, safelistPath) {
|
|
2678
2707
|
if (!staticCss.trim() || !safelistPath) return;
|
|
2679
|
-
const stateFilePath =
|
|
2708
|
+
const stateFilePath = path7.join(path7.dirname(safelistPath), "_tw-state-static.css");
|
|
2680
2709
|
const newRules = [];
|
|
2681
2710
|
for (const chunk of staticCss.split(/(?<=\})\s*/)) {
|
|
2682
2711
|
const rule = chunk.trim();
|
|
@@ -2687,9 +2716,9 @@ function appendStaticCssToFile(staticCss, safelistPath) {
|
|
|
2687
2716
|
}
|
|
2688
2717
|
if (newRules.length === 0) return;
|
|
2689
2718
|
try {
|
|
2690
|
-
|
|
2691
|
-
if (!
|
|
2692
|
-
|
|
2719
|
+
fs6.mkdirSync(path7.dirname(stateFilePath), { recursive: true });
|
|
2720
|
+
if (!fs6.existsSync(stateFilePath)) {
|
|
2721
|
+
fs6.writeFileSync(
|
|
2693
2722
|
stateFilePath,
|
|
2694
2723
|
`/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
|
|
2695
2724
|
* Import di globals.css: @import "./_tw-state-static.css";
|
|
@@ -2700,7 +2729,7 @@ function appendStaticCssToFile(staticCss, safelistPath) {
|
|
|
2700
2729
|
"utf-8"
|
|
2701
2730
|
);
|
|
2702
2731
|
}
|
|
2703
|
-
|
|
2732
|
+
fs6.appendFileSync(stateFilePath, newRules.join("\n") + "\n", "utf-8");
|
|
2704
2733
|
} catch {
|
|
2705
2734
|
}
|
|
2706
2735
|
}
|
|
@@ -2739,11 +2768,11 @@ var CYCLE_SENTINEL = "_cycle.txt";
|
|
|
2739
2768
|
var START_SENTINEL = "_start.txt";
|
|
2740
2769
|
var _workerCache = /* @__PURE__ */ new Map();
|
|
2741
2770
|
function getTwClassesDir(safelistPath) {
|
|
2742
|
-
return
|
|
2771
|
+
return path7.join(path7.dirname(safelistPath), "tw-classes");
|
|
2743
2772
|
}
|
|
2744
2773
|
function readSentinel(filePath) {
|
|
2745
2774
|
try {
|
|
2746
|
-
return
|
|
2775
|
+
return fs6.readFileSync(filePath, "utf-8").trim();
|
|
2747
2776
|
} catch {
|
|
2748
2777
|
return "";
|
|
2749
2778
|
}
|
|
@@ -2753,36 +2782,36 @@ function clearAndMarkCycle(twClassesDir, startId) {
|
|
|
2753
2782
|
if (_clearLock) return;
|
|
2754
2783
|
_clearLock = true;
|
|
2755
2784
|
try {
|
|
2756
|
-
if (
|
|
2785
|
+
if (fs6.existsSync(twClassesDir)) {
|
|
2757
2786
|
const tempDir = `${twClassesDir}_clearing_${Date.now()}`;
|
|
2758
2787
|
try {
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
const startFile =
|
|
2762
|
-
if (
|
|
2763
|
-
|
|
2788
|
+
fs6.renameSync(twClassesDir, tempDir);
|
|
2789
|
+
fs6.mkdirSync(twClassesDir, { recursive: true });
|
|
2790
|
+
const startFile = path7.join(tempDir, START_SENTINEL);
|
|
2791
|
+
if (fs6.existsSync(startFile)) {
|
|
2792
|
+
fs6.copyFileSync(startFile, path7.join(twClassesDir, START_SENTINEL));
|
|
2764
2793
|
}
|
|
2765
|
-
const mergedFile =
|
|
2766
|
-
if (
|
|
2767
|
-
|
|
2794
|
+
const mergedFile = path7.join(tempDir, "_webpack-merged.css");
|
|
2795
|
+
if (fs6.existsSync(mergedFile)) {
|
|
2796
|
+
fs6.copyFileSync(mergedFile, path7.join(twClassesDir, "_webpack-merged.css"));
|
|
2768
2797
|
}
|
|
2769
|
-
|
|
2798
|
+
fs6.writeFileSync(path7.join(twClassesDir, CYCLE_SENTINEL), startId, "utf-8");
|
|
2770
2799
|
_workerCache.set(twClassesDir, startId);
|
|
2771
|
-
|
|
2800
|
+
fs6.rmSync(tempDir, { recursive: true, force: true });
|
|
2772
2801
|
} catch {
|
|
2773
|
-
for (const file of
|
|
2802
|
+
for (const file of fs6.readdirSync(twClassesDir)) {
|
|
2774
2803
|
if (file === START_SENTINEL || file === "_webpack-merged.css") continue;
|
|
2775
2804
|
try {
|
|
2776
|
-
|
|
2805
|
+
fs6.unlinkSync(path7.join(twClassesDir, file));
|
|
2777
2806
|
} catch {
|
|
2778
2807
|
}
|
|
2779
2808
|
}
|
|
2780
|
-
|
|
2809
|
+
fs6.writeFileSync(path7.join(twClassesDir, CYCLE_SENTINEL), startId, "utf-8");
|
|
2781
2810
|
_workerCache.set(twClassesDir, startId);
|
|
2782
2811
|
}
|
|
2783
2812
|
} else {
|
|
2784
|
-
|
|
2785
|
-
|
|
2813
|
+
fs6.mkdirSync(twClassesDir, { recursive: true });
|
|
2814
|
+
fs6.writeFileSync(path7.join(twClassesDir, CYCLE_SENTINEL), startId, "utf-8");
|
|
2786
2815
|
_workerCache.set(twClassesDir, startId);
|
|
2787
2816
|
}
|
|
2788
2817
|
} catch {
|
|
@@ -2793,41 +2822,41 @@ function clearAndMarkCycle(twClassesDir, startId) {
|
|
|
2793
2822
|
function getPerFileSafelistPath(safelistDir, resourcePath) {
|
|
2794
2823
|
const normalized = resourcePath.replace(/\\/g, "/");
|
|
2795
2824
|
const slug = normalized.replace(/^.*\/src\//, "").replace(/\.[tj]sx?$/, "").replace(/[^a-zA-Z0-9]/g, "_").slice(0, 80);
|
|
2796
|
-
return
|
|
2825
|
+
return path7.join(safelistDir, `${slug}.css`);
|
|
2797
2826
|
}
|
|
2798
2827
|
function writePerFileSafelist(safelistPath, resourcePath, classes) {
|
|
2799
2828
|
if (!safelistPath || classes.length === 0) return;
|
|
2800
2829
|
try {
|
|
2801
2830
|
const twClassesDir = getTwClassesDir(safelistPath);
|
|
2802
|
-
const startId = readSentinel(
|
|
2803
|
-
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(
|
|
2831
|
+
const startId = readSentinel(path7.join(twClassesDir, START_SENTINEL));
|
|
2832
|
+
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(path7.join(twClassesDir, CYCLE_SENTINEL));
|
|
2804
2833
|
if (startId && cachedCycle !== startId) {
|
|
2805
2834
|
clearAndMarkCycle(twClassesDir, startId);
|
|
2806
|
-
} else if (!
|
|
2807
|
-
|
|
2835
|
+
} else if (!fs6.existsSync(twClassesDir)) {
|
|
2836
|
+
fs6.mkdirSync(twClassesDir, { recursive: true });
|
|
2808
2837
|
}
|
|
2809
2838
|
const outPath = getPerFileSafelistPath(twClassesDir, resourcePath);
|
|
2810
2839
|
const sorted = [...new Set(classes)].sort();
|
|
2811
2840
|
const css = [
|
|
2812
|
-
`/* tw-safelist: ${
|
|
2841
|
+
`/* tw-safelist: ${path7.basename(resourcePath)} \u2014 auto-generated */`,
|
|
2813
2842
|
"@layer utilities {",
|
|
2814
2843
|
sorted.map((cls) => `.${cls.replace(/([^a-zA-Z0-9_-])/g, "\\$1")} {}`).join("\n"),
|
|
2815
2844
|
"}"
|
|
2816
2845
|
].join("\n");
|
|
2817
2846
|
try {
|
|
2818
|
-
if (
|
|
2847
|
+
if (fs6.readFileSync(outPath, "utf-8") === css) return;
|
|
2819
2848
|
} catch {
|
|
2820
2849
|
}
|
|
2821
2850
|
const tmpPath = `${outPath}.tmp`;
|
|
2822
2851
|
try {
|
|
2823
|
-
|
|
2824
|
-
|
|
2852
|
+
fs6.writeFileSync(tmpPath, css, "utf-8");
|
|
2853
|
+
fs6.renameSync(tmpPath, outPath);
|
|
2825
2854
|
} catch {
|
|
2826
2855
|
try {
|
|
2827
|
-
|
|
2856
|
+
fs6.unlinkSync(tmpPath);
|
|
2828
2857
|
} catch {
|
|
2829
2858
|
}
|
|
2830
|
-
|
|
2859
|
+
fs6.writeFileSync(outPath, css, "utf-8");
|
|
2831
2860
|
}
|
|
2832
2861
|
} catch {
|
|
2833
2862
|
}
|
|
@@ -2841,7 +2870,7 @@ function turbopackLoader(source, options = {}) {
|
|
|
2841
2870
|
const router = detectRouter(this.resourcePath);
|
|
2842
2871
|
const nextMajor = parseNum(options.nextMajor);
|
|
2843
2872
|
const debug = parseBool(options.debug);
|
|
2844
|
-
const filename =
|
|
2873
|
+
const filename = path7.basename(this.resourcePath);
|
|
2845
2874
|
const effective = {
|
|
2846
2875
|
addDataAttr: parseBool(options.addDataAttr),
|
|
2847
2876
|
// App Router: selalu auto-detect client boundary
|