tailwind-styled-v4 1.0.1 → 5.0.0
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/animate.cjs +771 -0
- package/dist/animate.cjs.map +1 -0
- package/dist/animate.d.cts +73 -0
- package/dist/animate.d.ts +73 -0
- package/dist/animate.js +752 -0
- package/dist/animate.js.map +1 -0
- package/dist/chunk-VZEJV27B.js +11 -0
- package/dist/chunk-VZEJV27B.js.map +1 -0
- package/dist/chunk-Y5D3E72P.cjs +13 -0
- package/dist/chunk-Y5D3E72P.cjs.map +1 -0
- package/dist/css.cjs +121 -0
- package/dist/css.cjs.map +1 -0
- package/dist/css.d.cts +30 -0
- package/dist/css.d.ts +30 -0
- package/dist/css.js +112 -0
- package/dist/css.js.map +1 -0
- package/dist/devtools.cjs +1071 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +22 -0
- package/dist/devtools.d.ts +22 -0
- package/dist/devtools.js +1064 -0
- package/dist/devtools.js.map +1 -0
- package/dist/index.cjs +1353 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +655 -0
- package/dist/index.d.ts +508 -968
- package/dist/index.js +1304 -3
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +248 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +54 -0
- package/dist/next.d.ts +54 -0
- package/dist/next.js +241 -0
- package/dist/next.js.map +1 -0
- package/dist/preset.cjs +423 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.d.cts +276 -0
- package/dist/preset.d.ts +276 -0
- package/dist/preset.js +416 -0
- package/dist/preset.js.map +1 -0
- package/dist/turbopackLoader.cjs +37 -0
- package/dist/turbopackLoader.cjs.map +1 -0
- package/dist/turbopackLoader.d.cts +12 -0
- package/dist/turbopackLoader.d.ts +12 -0
- package/dist/turbopackLoader.js +35 -0
- package/dist/turbopackLoader.js.map +1 -0
- package/dist/vite.cjs +138 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +51 -0
- package/dist/vite.d.ts +51 -0
- package/dist/vite.js +128 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpackLoader.cjs +51 -0
- package/dist/webpackLoader.cjs.map +1 -0
- package/dist/webpackLoader.d.cts +17 -0
- package/dist/webpackLoader.d.ts +17 -0
- package/dist/webpackLoader.js +49 -0
- package/dist/webpackLoader.js.map +1 -0
- package/package.json +65 -32
- package/CHANGELOG.md +0 -75
- package/LICENSE +0 -21
- package/README.md +0 -608
- package/dist/cli/init.js +0 -208
- package/dist/compiler/index.d.mts +0 -214
- package/dist/compiler/index.d.ts +0 -214
- package/dist/compiler/index.js +0 -546
- package/dist/compiler/index.js.map +0 -1
- package/dist/compiler/index.mjs +0 -504
- package/dist/compiler/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -1115
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/dist/turbopack-loader.js +0 -232
- package/dist/webpack-loader.js +0 -213
package/dist/next.cjs
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkY5D3E72P_cjs = require('./chunk-Y5D3E72P.cjs');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
10
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
11
|
+
|
|
12
|
+
/* tailwind-styled-v4 v4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
13
|
+
var LOADER_PATH = chunkY5D3E72P_cjs.__require.resolve("./turbopackLoader");
|
|
14
|
+
var WEBPACK_LOADER_PATH = chunkY5D3E72P_cjs.__require.resolve("./webpackLoader");
|
|
15
|
+
function warnDeprecated(options, key, message) {
|
|
16
|
+
if (options[key] !== void 0) {
|
|
17
|
+
console.warn(`[tailwind-styled-v4] Warning: '${key}' is deprecated in v5. ${message}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function withTailwindStyled(opts = {}) {
|
|
21
|
+
return (nextConfig = {}) => {
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
24
|
+
warnDeprecated(opts, "mode", "Only zero-runtime is supported in v5.");
|
|
25
|
+
warnDeprecated(opts, "atomic", "Use @tailwind-styled/atomic package instead.");
|
|
26
|
+
warnDeprecated(opts, "staticVariants", "Handled automatically by the engine.");
|
|
27
|
+
warnDeprecated(opts, "deadStyleElimination", "Use engine with analyze: true instead.");
|
|
28
|
+
warnDeprecated(opts, "incremental", "Handled internally by the engine.");
|
|
29
|
+
warnDeprecated(opts, "styleBuckets", "Handled internally by the engine.");
|
|
30
|
+
warnDeprecated(opts, "incrementalVerbose", "Handled internally by the engine.");
|
|
31
|
+
const hasReactCompiler = nextConfig.reactCompiler === true || nextConfig.experimental?.reactCompiler === true;
|
|
32
|
+
if (hasReactCompiler && isDev) {
|
|
33
|
+
console.log("[tailwind-styled-v4] React Compiler detected \u2192 hoist disabled");
|
|
34
|
+
}
|
|
35
|
+
const {
|
|
36
|
+
scanDirs = ["src"],
|
|
37
|
+
safelistOutput = "src/app/__tw-safelist.css",
|
|
38
|
+
addDataAttr = isDev,
|
|
39
|
+
autoClientBoundary = true,
|
|
40
|
+
hoist = !hasReactCompiler,
|
|
41
|
+
routeCssDir = path__default.default.join(cwd, ".next", "static", "css", "tw"),
|
|
42
|
+
zeroConfig = true,
|
|
43
|
+
plugins = [],
|
|
44
|
+
devtools = isDev
|
|
45
|
+
} = opts;
|
|
46
|
+
const routeCss = opts.routeCss !== void 0 ? opts.routeCss : !isDev;
|
|
47
|
+
const devManifest = opts.devManifest !== void 0 ? opts.devManifest : isDev;
|
|
48
|
+
const devManifestRewrites = devManifest && isDev ? [
|
|
49
|
+
{
|
|
50
|
+
source: "/__tw/css-manifest.json",
|
|
51
|
+
destination: "/.next/static/css/tw/css-manifest.json"
|
|
52
|
+
},
|
|
53
|
+
{ source: "/__tw/:path*.css", destination: "/.next/static/css/tw/:path*.css" }
|
|
54
|
+
] : [];
|
|
55
|
+
if (zeroConfig) {
|
|
56
|
+
try {
|
|
57
|
+
const { bootstrapZeroConfig } = chunkY5D3E72P_cjs.__require("@tailwind-styled/compiler");
|
|
58
|
+
bootstrapZeroConfig(cwd);
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const safelistAbsPath = path__default.default.isAbsolute(safelistOutput) ? safelistOutput : path__default.default.resolve(cwd, safelistOutput);
|
|
63
|
+
if (!fs__default.default.existsSync(safelistAbsPath)) {
|
|
64
|
+
try {
|
|
65
|
+
fs__default.default.mkdirSync(path__default.default.dirname(safelistAbsPath), { recursive: true });
|
|
66
|
+
fs__default.default.writeFileSync(
|
|
67
|
+
safelistAbsPath,
|
|
68
|
+
"/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */\n"
|
|
69
|
+
);
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (plugins.length > 0) {
|
|
74
|
+
try {
|
|
75
|
+
const { use } = chunkY5D3E72P_cjs.__require("@tailwind-styled/plugin");
|
|
76
|
+
for (const plugin of plugins) use(plugin);
|
|
77
|
+
console.log(
|
|
78
|
+
`[tailwind-styled-v4] ${plugins.length} plugin(s): ${plugins.map((p) => p.name).join(", ")}`
|
|
79
|
+
);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
console.warn("[tailwind-styled-v4] Plugin init failed:", e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const loaderOpts = {
|
|
85
|
+
addDataAttr: addDataAttr ? "true" : "false",
|
|
86
|
+
autoClientBoundary: autoClientBoundary ? "true" : "false",
|
|
87
|
+
hoist: hoist ? "true" : "false"
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
...nextConfig,
|
|
91
|
+
// Dev mode rewrites for /__tw/ manifest serving
|
|
92
|
+
...devManifestRewrites.length > 0 ? {
|
|
93
|
+
async rewrites() {
|
|
94
|
+
const existing = typeof nextConfig.rewrites === "function" ? await nextConfig.rewrites() : nextConfig.rewrites ?? [];
|
|
95
|
+
const {
|
|
96
|
+
beforeFiles = [],
|
|
97
|
+
afterFiles = [],
|
|
98
|
+
fallback = []
|
|
99
|
+
} = Array.isArray(existing) ? { beforeFiles: existing } : existing;
|
|
100
|
+
return { beforeFiles: [...devManifestRewrites, ...beforeFiles], afterFiles, fallback };
|
|
101
|
+
}
|
|
102
|
+
} : {},
|
|
103
|
+
experimental: {
|
|
104
|
+
...nextConfig.experimental
|
|
105
|
+
},
|
|
106
|
+
// Turbopack rules
|
|
107
|
+
turbopack: {
|
|
108
|
+
...nextConfig.turbopack,
|
|
109
|
+
rules: {
|
|
110
|
+
...Object.fromEntries(
|
|
111
|
+
scanDirs.flatMap((dir) => [
|
|
112
|
+
[
|
|
113
|
+
`{./${dir},./app,./pages,./components}/**/*.tsx`,
|
|
114
|
+
{
|
|
115
|
+
loaders: [{ loader: LOADER_PATH, options: loaderOpts }]
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
`{./${dir},./app,./pages,./components}/**/*.ts`,
|
|
120
|
+
{
|
|
121
|
+
loaders: [{ loader: LOADER_PATH, options: loaderOpts }]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
])
|
|
125
|
+
),
|
|
126
|
+
...nextConfig.turbopack?.rules
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
webpack(webpackConfig, webpackOpts) {
|
|
130
|
+
const alreadyRegistered = webpackConfig.module.rules.some(
|
|
131
|
+
(r) => r._tailwindStyledMarker === true
|
|
132
|
+
);
|
|
133
|
+
if (!alreadyRegistered) {
|
|
134
|
+
webpackConfig.module.rules.push({
|
|
135
|
+
_tailwindStyledMarker: true,
|
|
136
|
+
test: /\.(tsx|ts|jsx|js)$/,
|
|
137
|
+
exclude: /node_modules/,
|
|
138
|
+
use: [
|
|
139
|
+
{
|
|
140
|
+
loader: WEBPACK_LOADER_PATH,
|
|
141
|
+
options: {
|
|
142
|
+
...loaderOpts,
|
|
143
|
+
addDataAttr: opts.addDataAttr ?? webpackOpts.dev
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (devtools && webpackOpts.dev) {
|
|
150
|
+
webpackConfig.resolve = webpackConfig.resolve ?? {};
|
|
151
|
+
webpackConfig.resolve.alias = {
|
|
152
|
+
...webpackConfig.resolve.alias ?? void 0,
|
|
153
|
+
"tailwind-styled-v4/devtools": path__default.default.resolve(__dirname, "../../devtools/src/index.tsx")
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return typeof nextConfig.webpack === "function" ? nextConfig.webpack(webpackConfig, webpackOpts) : webpackConfig;
|
|
157
|
+
},
|
|
158
|
+
generateBuildId: async () => {
|
|
159
|
+
try {
|
|
160
|
+
const { generateSafelistCss } = chunkY5D3E72P_cjs.__require("@tailwind-styled/compiler");
|
|
161
|
+
generateSafelistCss(
|
|
162
|
+
scanDirs.map((d) => path__default.default.resolve(cwd, d)),
|
|
163
|
+
path__default.default.isAbsolute(safelistOutput) ? safelistOutput : path__default.default.resolve(cwd, safelistOutput)
|
|
164
|
+
);
|
|
165
|
+
console.log("[tailwind-styled-v4] \u2713 Safelist CSS generated");
|
|
166
|
+
} catch (e) {
|
|
167
|
+
console.warn("[tailwind-styled-v4] Safelist skipped:", e);
|
|
168
|
+
}
|
|
169
|
+
if (plugins.length > 0) {
|
|
170
|
+
try {
|
|
171
|
+
const { getGlobalRegistry, runBuildHooks } = chunkY5D3E72P_cjs.__require("@tailwind-styled/plugin");
|
|
172
|
+
await runBuildHooks(getGlobalRegistry());
|
|
173
|
+
console.log("[tailwind-styled-v4] \u2713 Plugin build hooks complete");
|
|
174
|
+
} catch (e) {
|
|
175
|
+
console.warn("[tailwind-styled-v4] Plugin build hooks failed:", e);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (routeCss) {
|
|
179
|
+
try {
|
|
180
|
+
const { createEngine } = chunkY5D3E72P_cjs.__require("@tailwind-styled/engine");
|
|
181
|
+
const engine = await createEngine({
|
|
182
|
+
root: cwd,
|
|
183
|
+
scanner: {
|
|
184
|
+
includeExtensions: [".tsx", ".ts", ".jsx", ".js"],
|
|
185
|
+
ignoreDirectories: scanDirs
|
|
186
|
+
},
|
|
187
|
+
compileCss: true,
|
|
188
|
+
tailwindConfigPath: zeroConfig ? void 0 : "tailwind.config.ts",
|
|
189
|
+
plugins: []
|
|
190
|
+
});
|
|
191
|
+
const buildResult = await engine.build();
|
|
192
|
+
if (buildResult.css) {
|
|
193
|
+
const routeDir = routeCssDir;
|
|
194
|
+
fs__default.default.mkdirSync(routeDir, { recursive: true });
|
|
195
|
+
const indexCssPath = path__default.default.join(routeDir, "index.css");
|
|
196
|
+
fs__default.default.writeFileSync(indexCssPath, buildResult.css);
|
|
197
|
+
const manifest = { "/": "index.css" };
|
|
198
|
+
const manifestPath = path__default.default.join(
|
|
199
|
+
cwd,
|
|
200
|
+
".next",
|
|
201
|
+
"static",
|
|
202
|
+
"css",
|
|
203
|
+
"tw",
|
|
204
|
+
"css-manifest.json"
|
|
205
|
+
);
|
|
206
|
+
fs__default.default.mkdirSync(path__default.default.dirname(manifestPath), { recursive: true });
|
|
207
|
+
fs__default.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
208
|
+
const sizeKb = Buffer.byteLength(buildResult.css, "utf8") / 1024;
|
|
209
|
+
console.log(`[tailwind-styled-v4] \u2713 Route CSS: ${sizeKb.toFixed(1)}KB`);
|
|
210
|
+
console.log(
|
|
211
|
+
"[tailwind-styled-v4] \u2713 Route CSS manifest \u2192 .next/static/css/tw/css-manifest.json"
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {
|
|
215
|
+
console.warn("[tailwind-styled-v4] Route CSS skipped:", e);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (plugins.length > 0) {
|
|
219
|
+
try {
|
|
220
|
+
const {
|
|
221
|
+
getGlobalRegistry,
|
|
222
|
+
generateTokenCss,
|
|
223
|
+
generateUtilityCss,
|
|
224
|
+
applyCssHooks
|
|
225
|
+
} = chunkY5D3E72P_cjs.__require("@tailwind-styled/plugin");
|
|
226
|
+
const registry = getGlobalRegistry();
|
|
227
|
+
let pluginCss = [generateTokenCss(registry), generateUtilityCss(registry)].filter(Boolean).join("\n\n");
|
|
228
|
+
pluginCss = applyCssHooks(pluginCss, registry);
|
|
229
|
+
if (pluginCss.trim()) {
|
|
230
|
+
const outPath = path__default.default.join(cwd, "public", "__tw-plugins.css");
|
|
231
|
+
fs__default.default.mkdirSync(path__default.default.dirname(outPath), { recursive: true });
|
|
232
|
+
fs__default.default.writeFileSync(outPath, pluginCss);
|
|
233
|
+
console.log("[tailwind-styled-v4] \u2713 Plugin CSS \u2192 public/__tw-plugins.css");
|
|
234
|
+
}
|
|
235
|
+
} catch (e) {
|
|
236
|
+
console.warn("[tailwind-styled-v4] Plugin CSS skipped:", e);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (typeof nextConfig.generateBuildId === "function") return nextConfig.generateBuildId();
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
exports.withTailwindStyled = withTailwindStyled;
|
|
247
|
+
//# sourceMappingURL=next.cjs.map
|
|
248
|
+
//# sourceMappingURL=next.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../next/src/withTailwindStyled.ts"],"names":["__require","path","fs"],"mappings":";;;;;;;;;;;;AAuDA,IAAM,WAAA,GAAcA,2BAAA,CAAQ,OAAA,CAAQ,mBAAmB,CAAA;AACvD,I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CAAQ,OAAO,GAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AACvD,cAAAC,mBAAA,CAAG,aAAA,CAAc,SAAS,SAAS,CAAA;AACnC,cAAA,OAAA,CAAQ,IAAI,uEAA6D,CAAA;AAAA,YAC3E;AAAA,UACF,SAAS,CAAA,EAAG;AACV,YAAA,OAAA,CAAQ,IAAA,CAAK,4CAA4C,CAAC,CAAA;AAAA,UAC5D;AAAA,QACF;AAEA,QAAA,IAAI,OAAO,UAAA,CAAW,eAAA,KAAoB,UAAA,EAAY,OAAO,WAAW,eAAA,EAAgB;AACxF,QAAA,OAAO,IAAA;AAAA,MACT;AAAA,KACF;AAAA,EACF,CAAA;AACF","file":"next.cjs","sourcesContent":["/**\n * tailwind-styled-v4 — withTailwindStyled v5\n *\n * Next.js plugin v5:\n * - Simplified API (removed deprecated options)\n * - Integrates with @tailwind-styled/engine for build\n * - Removed legacy code (scripts, direct compiler calls)\n * - Native-first architecture\n */\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport type { TwPlugin } from \"@tailwind-styled/plugin\"\nimport type { NextConfig } from \"next\"\n\nexport interface TailwindStyledNextOptions {\n /** Directories to scan for components. Default: [\"src\"] */\n scanDirs?: string[]\n /** Output path for safelist CSS. Default: \"src/app/__tw-safelist.css\" */\n safelistOutput?: string\n /** Add data-tw attributes to components. Default: true in dev */\n addDataAttr?: boolean\n /** Auto-add \"use client\" boundary for interactive components. Default: true */\n autoClientBoundary?: boolean\n /** Hoist static variants. Default: true (false with React Compiler) */\n hoist?: boolean\n /** Generate route-level CSS. Default: true in production */\n routeCss?: boolean\n /** Output directory for route CSS. Default: \".next/static/css/tw\" */\n routeCssDir?: string\n /** Serve css-manifest.json in dev mode. Default: true in dev */\n devManifest?: boolean\n /** Use Tailwind zero-config. Default: true */\n zeroConfig?: boolean\n /** Plugin array */\n plugins?: TwPlugin[]\n /** Enable DevTools overlay. Default: true in dev */\n devtools?: boolean\n\n /** @deprecated in v5 - mode is always \"zero-runtime\" */\n mode?: \"zero-runtime\" | \"runtime\"\n /** @deprecated in v5 - use @tailwind-styled/atomic package */\n atomic?: boolean\n /** @deprecated in v5 - handled by engine automatically */\n staticVariants?: boolean\n /** @deprecated in v5 - use engine with analyze: true */\n deadStyleElimination?: boolean\n /** @deprecated in v5 - handled by engine internally */\n incremental?: boolean\n /** @deprecated in v5 - handled by engine internally */\n styleBuckets?: boolean\n /** @deprecated in v5 - handled by engine internally */\n incrementalVerbose?: boolean\n}\n\nconst LOADER_PATH = require.resolve(\"./turbopackLoader\")\nconst WEBPACK_LOADER_PATH = require.resolve(\"./webpackLoader\")\n\nfunction warnDeprecated(\n options: TailwindStyledNextOptions,\n key: keyof TailwindStyledNextOptions,\n message: string\n) {\n if (options[key] !== undefined) {\n console.warn(`[tailwind-styled-v4] Warning: '${key}' is deprecated in v5. ${message}`)\n }\n}\n\nexport function withTailwindStyled(opts: TailwindStyledNextOptions = {}) {\n return (nextConfig: NextConfig = {}): NextConfig => {\n const cwd = process.cwd()\n const isDev = process.env.NODE_ENV !== \"production\"\n\n warnDeprecated(opts, \"mode\", \"Only zero-runtime is supported in v5.\")\n warnDeprecated(opts, \"atomic\", \"Use @tailwind-styled/atomic package instead.\")\n warnDeprecated(opts, \"staticVariants\", \"Handled automatically by the engine.\")\n warnDeprecated(opts, \"deadStyleElimination\", \"Use engine with analyze: true instead.\")\n warnDeprecated(opts, \"incremental\", \"Handled internally by the engine.\")\n warnDeprecated(opts, \"styleBuckets\", \"Handled internally by the engine.\")\n warnDeprecated(opts, \"incrementalVerbose\", \"Handled internally by the engine.\")\n\n const hasReactCompiler =\n (nextConfig as any).reactCompiler === true ||\n (nextConfig as any).experimental?.reactCompiler === true\n\n if (hasReactCompiler && isDev) {\n console.log(\"[tailwind-styled-v4] React Compiler detected → hoist disabled\")\n }\n\n const {\n scanDirs = [\"src\"],\n safelistOutput = \"src/app/__tw-safelist.css\",\n addDataAttr = isDev,\n autoClientBoundary = true,\n hoist = !hasReactCompiler,\n routeCssDir = path.join(cwd, \".next\", \"static\", \"css\", \"tw\"),\n zeroConfig = true,\n plugins = [],\n devtools = isDev,\n } = opts\n\n const routeCss = opts.routeCss !== undefined ? opts.routeCss : !isDev\n const devManifest = opts.devManifest !== undefined ? opts.devManifest : isDev\n const devManifestRewrites =\n devManifest && isDev\n ? [\n {\n source: \"/__tw/css-manifest.json\",\n destination: \"/.next/static/css/tw/css-manifest.json\",\n },\n { source: \"/__tw/:path*.css\", destination: \"/.next/static/css/tw/:path*.css\" },\n ]\n : []\n\n if (zeroConfig) {\n try {\n const { bootstrapZeroConfig } = require(\"@tailwind-styled/compiler\")\n bootstrapZeroConfig(cwd)\n } catch {\n /* non-critical */\n }\n }\n\n // Ensure safelist CSS exists\n const safelistAbsPath = path.isAbsolute(safelistOutput)\n ? safelistOutput\n : path.resolve(cwd, safelistOutput)\n if (!fs.existsSync(safelistAbsPath)) {\n try {\n fs.mkdirSync(path.dirname(safelistAbsPath), { recursive: true })\n fs.writeFileSync(\n safelistAbsPath,\n \"/* Auto-generated by tailwind-styled-v4 — DO NOT EDIT */\\n\"\n )\n } catch {\n /* non-critical */\n }\n }\n\n // Initialize plugins\n if (plugins.length > 0) {\n try {\n const { use } = require(\"@tailwind-styled/plugin\")\n for (const plugin of plugins) use(plugin)\n console.log(\n `[tailwind-styled-v4] ${plugins.length} plugin(s): ${plugins.map((p: TwPlugin) => p.name).join(\", \")}`\n )\n } catch (e) {\n console.warn(\"[tailwind-styled-v4] Plugin init failed:\", e)\n }\n }\n\n // Loader options - use string values for Turbopack serialization\n const loaderOpts = {\n addDataAttr: addDataAttr ? \"true\" : \"false\",\n autoClientBoundary: autoClientBoundary ? \"true\" : \"false\",\n hoist: hoist ? \"true\" : \"false\",\n }\n\n return {\n ...nextConfig,\n\n // Dev mode rewrites for /__tw/ manifest serving\n ...(devManifestRewrites.length > 0\n ? {\n async rewrites() {\n const existing =\n typeof nextConfig.rewrites === \"function\"\n ? await nextConfig.rewrites()\n : (nextConfig.rewrites ?? [])\n const {\n beforeFiles = [],\n afterFiles = [],\n fallback = [],\n } = Array.isArray(existing) ? { beforeFiles: existing as any[] } : (existing as any)\n return { beforeFiles: [...devManifestRewrites, ...beforeFiles], afterFiles, fallback }\n },\n }\n : {}),\n\n experimental: {\n ...(nextConfig.experimental as any),\n },\n\n // Turbopack rules\n turbopack: {\n ...(nextConfig as any).turbopack,\n rules: {\n ...Object.fromEntries(\n scanDirs.flatMap((dir: string) => [\n [\n `{./${dir},./app,./pages,./components}/**/*.tsx`,\n {\n loaders: [{ loader: LOADER_PATH, options: loaderOpts }],\n },\n ],\n [\n `{./${dir},./app,./pages,./components}/**/*.ts`,\n {\n loaders: [{ loader: LOADER_PATH, options: loaderOpts }],\n },\n ],\n ])\n ),\n ...(nextConfig as any).turbopack?.rules,\n },\n },\n\n webpack(webpackConfig: any, webpackOpts: any) {\n const alreadyRegistered = webpackConfig.module.rules.some(\n (r: any) => r._tailwindStyledMarker === true\n )\n if (!alreadyRegistered) {\n webpackConfig.module.rules.push({\n _tailwindStyledMarker: true,\n test: /\\.(tsx|ts|jsx|js)$/,\n exclude: /node_modules/,\n use: [\n {\n loader: WEBPACK_LOADER_PATH,\n options: {\n ...loaderOpts,\n addDataAttr: opts.addDataAttr ?? webpackOpts.dev,\n },\n },\n ],\n })\n }\n\n if (devtools && webpackOpts.dev) {\n webpackConfig.resolve = webpackConfig.resolve ?? {}\n webpackConfig.resolve.alias = {\n ...(webpackConfig.resolve.alias ?? undefined),\n \"tailwind-styled-v4/devtools\": path.resolve(__dirname, \"../../devtools/src/index.tsx\"),\n }\n }\n\n return typeof nextConfig.webpack === \"function\"\n ? nextConfig.webpack(webpackConfig, webpackOpts)\n : webpackConfig\n },\n\n generateBuildId: async () => {\n // 1. Safelist CSS - using engine via scanner\n try {\n const { generateSafelistCss } = require(\"@tailwind-styled/compiler\")\n generateSafelistCss(\n scanDirs.map((d: string) => path.resolve(cwd, d)),\n path.isAbsolute(safelistOutput) ? safelistOutput : path.resolve(cwd, safelistOutput)\n )\n console.log(\"[tailwind-styled-v4] ✓ Safelist CSS generated\")\n } catch (e) {\n console.warn(\"[tailwind-styled-v4] Safelist skipped:\", e)\n }\n\n // 2. Plugin build hooks\n if (plugins.length > 0) {\n try {\n const { getGlobalRegistry, runBuildHooks } = require(\"@tailwind-styled/plugin\")\n await runBuildHooks(getGlobalRegistry())\n console.log(\"[tailwind-styled-v4] ✓ Plugin build hooks complete\")\n } catch (e) {\n console.warn(\"[tailwind-styled-v4] Plugin build hooks failed:\", e)\n }\n }\n\n // 3. Route CSS - use engine for generation\n if (routeCss) {\n try {\n const { createEngine } = require(\"@tailwind-styled/engine\")\n\n const engine = await createEngine({\n root: cwd,\n scanner: {\n includeExtensions: [\".tsx\", \".ts\", \".jsx\", \".js\"],\n ignoreDirectories: scanDirs,\n },\n compileCss: true,\n tailwindConfigPath: zeroConfig ? undefined : \"tailwind.config.ts\",\n plugins: [],\n })\n\n const buildResult = await engine.build()\n\n // Write route CSS files\n if (buildResult.css) {\n const routeDir = routeCssDir\n fs.mkdirSync(routeDir, { recursive: true })\n\n // For now, write a single combined CSS - route splitting handled by Next.js\n const indexCssPath = path.join(routeDir, \"index.css\")\n fs.writeFileSync(indexCssPath, buildResult.css)\n\n // Generate manifest for route css middleware\n const manifest = { \"/\": \"index.css\" }\n const manifestPath = path.join(\n cwd,\n \".next\",\n \"static\",\n \"css\",\n \"tw\",\n \"css-manifest.json\"\n )\n fs.mkdirSync(path.dirname(manifestPath), { recursive: true })\n fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2))\n\n const sizeKb = Buffer.byteLength(buildResult.css, \"utf8\") / 1024\n console.log(`[tailwind-styled-v4] ✓ Route CSS: ${sizeKb.toFixed(1)}KB`)\n console.log(\n \"[tailwind-styled-v4] ✓ Route CSS manifest → .next/static/css/tw/css-manifest.json\"\n )\n }\n } catch (e) {\n console.warn(\"[tailwind-styled-v4] Route CSS skipped:\", e)\n }\n }\n\n // 4. Plugin CSS\n if (plugins.length > 0) {\n try {\n const {\n getGlobalRegistry,\n generateTokenCss,\n generateUtilityCss,\n applyCssHooks,\n } = require(\"@tailwind-styled/plugin\")\n const registry = getGlobalRegistry()\n let pluginCss = [generateTokenCss(registry), generateUtilityCss(registry)]\n .filter(Boolean)\n .join(\"\\n\\n\")\n pluginCss = applyCssHooks(pluginCss, registry)\n if (pluginCss.trim()) {\n const outPath = path.join(cwd, \"public\", \"__tw-plugins.css\")\n fs.mkdirSync(path.dirname(outPath), { recursive: true })\n fs.writeFileSync(outPath, pluginCss)\n console.log(\"[tailwind-styled-v4] ✓ Plugin CSS → public/__tw-plugins.css\")\n }\n } catch (e) {\n console.warn(\"[tailwind-styled-v4] Plugin CSS skipped:\", e)\n }\n }\n\n if (typeof nextConfig.generateBuildId === \"function\") return nextConfig.generateBuildId()\n return null\n },\n }\n }\n}\n\nexport default withTailwindStyled\n\n// Re-export route css utilities\nexport { getRouteCssLinks } from \"./routeCssMiddleware\"\n"]}
|
package/dist/next.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TwPlugin } from '@tailwind-styled/plugin';
|
|
2
|
+
import { NextConfig } from 'next';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* tailwind-styled-v4 — withTailwindStyled v5
|
|
6
|
+
*
|
|
7
|
+
* Next.js plugin v5:
|
|
8
|
+
* - Simplified API (removed deprecated options)
|
|
9
|
+
* - Integrates with @tailwind-styled/engine for build
|
|
10
|
+
* - Removed legacy code (scripts, direct compiler calls)
|
|
11
|
+
* - Native-first architecture
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface TailwindStyledNextOptions {
|
|
15
|
+
/** Directories to scan for components. Default: ["src"] */
|
|
16
|
+
scanDirs?: string[];
|
|
17
|
+
/** Output path for safelist CSS. Default: "src/app/__tw-safelist.css" */
|
|
18
|
+
safelistOutput?: string;
|
|
19
|
+
/** Add data-tw attributes to components. Default: true in dev */
|
|
20
|
+
addDataAttr?: boolean;
|
|
21
|
+
/** Auto-add "use client" boundary for interactive components. Default: true */
|
|
22
|
+
autoClientBoundary?: boolean;
|
|
23
|
+
/** Hoist static variants. Default: true (false with React Compiler) */
|
|
24
|
+
hoist?: boolean;
|
|
25
|
+
/** Generate route-level CSS. Default: true in production */
|
|
26
|
+
routeCss?: boolean;
|
|
27
|
+
/** Output directory for route CSS. Default: ".next/static/css/tw" */
|
|
28
|
+
routeCssDir?: string;
|
|
29
|
+
/** Serve css-manifest.json in dev mode. Default: true in dev */
|
|
30
|
+
devManifest?: boolean;
|
|
31
|
+
/** Use Tailwind zero-config. Default: true */
|
|
32
|
+
zeroConfig?: boolean;
|
|
33
|
+
/** Plugin array */
|
|
34
|
+
plugins?: TwPlugin[];
|
|
35
|
+
/** Enable DevTools overlay. Default: true in dev */
|
|
36
|
+
devtools?: boolean;
|
|
37
|
+
/** @deprecated in v5 - mode is always "zero-runtime" */
|
|
38
|
+
mode?: "zero-runtime" | "runtime";
|
|
39
|
+
/** @deprecated in v5 - use @tailwind-styled/atomic package */
|
|
40
|
+
atomic?: boolean;
|
|
41
|
+
/** @deprecated in v5 - handled by engine automatically */
|
|
42
|
+
staticVariants?: boolean;
|
|
43
|
+
/** @deprecated in v5 - use engine with analyze: true */
|
|
44
|
+
deadStyleElimination?: boolean;
|
|
45
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
46
|
+
incremental?: boolean;
|
|
47
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
48
|
+
styleBuckets?: boolean;
|
|
49
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
50
|
+
incrementalVerbose?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare function withTailwindStyled(opts?: TailwindStyledNextOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
53
|
+
|
|
54
|
+
export { type TailwindStyledNextOptions, withTailwindStyled };
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TwPlugin } from '@tailwind-styled/plugin';
|
|
2
|
+
import { NextConfig } from 'next';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* tailwind-styled-v4 — withTailwindStyled v5
|
|
6
|
+
*
|
|
7
|
+
* Next.js plugin v5:
|
|
8
|
+
* - Simplified API (removed deprecated options)
|
|
9
|
+
* - Integrates with @tailwind-styled/engine for build
|
|
10
|
+
* - Removed legacy code (scripts, direct compiler calls)
|
|
11
|
+
* - Native-first architecture
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface TailwindStyledNextOptions {
|
|
15
|
+
/** Directories to scan for components. Default: ["src"] */
|
|
16
|
+
scanDirs?: string[];
|
|
17
|
+
/** Output path for safelist CSS. Default: "src/app/__tw-safelist.css" */
|
|
18
|
+
safelistOutput?: string;
|
|
19
|
+
/** Add data-tw attributes to components. Default: true in dev */
|
|
20
|
+
addDataAttr?: boolean;
|
|
21
|
+
/** Auto-add "use client" boundary for interactive components. Default: true */
|
|
22
|
+
autoClientBoundary?: boolean;
|
|
23
|
+
/** Hoist static variants. Default: true (false with React Compiler) */
|
|
24
|
+
hoist?: boolean;
|
|
25
|
+
/** Generate route-level CSS. Default: true in production */
|
|
26
|
+
routeCss?: boolean;
|
|
27
|
+
/** Output directory for route CSS. Default: ".next/static/css/tw" */
|
|
28
|
+
routeCssDir?: string;
|
|
29
|
+
/** Serve css-manifest.json in dev mode. Default: true in dev */
|
|
30
|
+
devManifest?: boolean;
|
|
31
|
+
/** Use Tailwind zero-config. Default: true */
|
|
32
|
+
zeroConfig?: boolean;
|
|
33
|
+
/** Plugin array */
|
|
34
|
+
plugins?: TwPlugin[];
|
|
35
|
+
/** Enable DevTools overlay. Default: true in dev */
|
|
36
|
+
devtools?: boolean;
|
|
37
|
+
/** @deprecated in v5 - mode is always "zero-runtime" */
|
|
38
|
+
mode?: "zero-runtime" | "runtime";
|
|
39
|
+
/** @deprecated in v5 - use @tailwind-styled/atomic package */
|
|
40
|
+
atomic?: boolean;
|
|
41
|
+
/** @deprecated in v5 - handled by engine automatically */
|
|
42
|
+
staticVariants?: boolean;
|
|
43
|
+
/** @deprecated in v5 - use engine with analyze: true */
|
|
44
|
+
deadStyleElimination?: boolean;
|
|
45
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
46
|
+
incremental?: boolean;
|
|
47
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
48
|
+
styleBuckets?: boolean;
|
|
49
|
+
/** @deprecated in v5 - handled by engine internally */
|
|
50
|
+
incrementalVerbose?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare function withTailwindStyled(opts?: TailwindStyledNextOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
53
|
+
|
|
54
|
+
export { type TailwindStyledNextOptions, withTailwindStyled };
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { __require } from './chunk-VZEJV27B.js';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
/* tailwind-styled-v4 v4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
6
|
+
var LOADER_PATH = __require.resolve("./turbopackLoader");
|
|
7
|
+
var WEBPACK_LOADER_PATH = __require.resolve("./webpackLoader");
|
|
8
|
+
function warnDeprecated(options, key, message) {
|
|
9
|
+
if (options[key] !== void 0) {
|
|
10
|
+
console.warn(`[tailwind-styled-v4] Warning: '${key}' is deprecated in v5. ${message}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function withTailwindStyled(opts = {}) {
|
|
14
|
+
return (nextConfig = {}) => {
|
|
15
|
+
const cwd = process.cwd();
|
|
16
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
17
|
+
warnDeprecated(opts, "mode", "Only zero-runtime is supported in v5.");
|
|
18
|
+
warnDeprecated(opts, "atomic", "Use @tailwind-styled/atomic package instead.");
|
|
19
|
+
warnDeprecated(opts, "staticVariants", "Handled automatically by the engine.");
|
|
20
|
+
warnDeprecated(opts, "deadStyleElimination", "Use engine with analyze: true instead.");
|
|
21
|
+
warnDeprecated(opts, "incremental", "Handled internally by the engine.");
|
|
22
|
+
warnDeprecated(opts, "styleBuckets", "Handled internally by the engine.");
|
|
23
|
+
warnDeprecated(opts, "incrementalVerbose", "Handled internally by the engine.");
|
|
24
|
+
const hasReactCompiler = nextConfig.reactCompiler === true || nextConfig.experimental?.reactCompiler === true;
|
|
25
|
+
if (hasReactCompiler && isDev) {
|
|
26
|
+
console.log("[tailwind-styled-v4] React Compiler detected \u2192 hoist disabled");
|
|
27
|
+
}
|
|
28
|
+
const {
|
|
29
|
+
scanDirs = ["src"],
|
|
30
|
+
safelistOutput = "src/app/__tw-safelist.css",
|
|
31
|
+
addDataAttr = isDev,
|
|
32
|
+
autoClientBoundary = true,
|
|
33
|
+
hoist = !hasReactCompiler,
|
|
34
|
+
routeCssDir = path.join(cwd, ".next", "static", "css", "tw"),
|
|
35
|
+
zeroConfig = true,
|
|
36
|
+
plugins = [],
|
|
37
|
+
devtools = isDev
|
|
38
|
+
} = opts;
|
|
39
|
+
const routeCss = opts.routeCss !== void 0 ? opts.routeCss : !isDev;
|
|
40
|
+
const devManifest = opts.devManifest !== void 0 ? opts.devManifest : isDev;
|
|
41
|
+
const devManifestRewrites = devManifest && isDev ? [
|
|
42
|
+
{
|
|
43
|
+
source: "/__tw/css-manifest.json",
|
|
44
|
+
destination: "/.next/static/css/tw/css-manifest.json"
|
|
45
|
+
},
|
|
46
|
+
{ source: "/__tw/:path*.css", destination: "/.next/static/css/tw/:path*.css" }
|
|
47
|
+
] : [];
|
|
48
|
+
if (zeroConfig) {
|
|
49
|
+
try {
|
|
50
|
+
const { bootstrapZeroConfig } = __require("@tailwind-styled/compiler");
|
|
51
|
+
bootstrapZeroConfig(cwd);
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const safelistAbsPath = path.isAbsolute(safelistOutput) ? safelistOutput : path.resolve(cwd, safelistOutput);
|
|
56
|
+
if (!fs.existsSync(safelistAbsPath)) {
|
|
57
|
+
try {
|
|
58
|
+
fs.mkdirSync(path.dirname(safelistAbsPath), { recursive: true });
|
|
59
|
+
fs.writeFileSync(
|
|
60
|
+
safelistAbsPath,
|
|
61
|
+
"/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */\n"
|
|
62
|
+
);
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (plugins.length > 0) {
|
|
67
|
+
try {
|
|
68
|
+
const { use } = __require("@tailwind-styled/plugin");
|
|
69
|
+
for (const plugin of plugins) use(plugin);
|
|
70
|
+
console.log(
|
|
71
|
+
`[tailwind-styled-v4] ${plugins.length} plugin(s): ${plugins.map((p) => p.name).join(", ")}`
|
|
72
|
+
);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.warn("[tailwind-styled-v4] Plugin init failed:", e);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const loaderOpts = {
|
|
78
|
+
addDataAttr: addDataAttr ? "true" : "false",
|
|
79
|
+
autoClientBoundary: autoClientBoundary ? "true" : "false",
|
|
80
|
+
hoist: hoist ? "true" : "false"
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
...nextConfig,
|
|
84
|
+
// Dev mode rewrites for /__tw/ manifest serving
|
|
85
|
+
...devManifestRewrites.length > 0 ? {
|
|
86
|
+
async rewrites() {
|
|
87
|
+
const existing = typeof nextConfig.rewrites === "function" ? await nextConfig.rewrites() : nextConfig.rewrites ?? [];
|
|
88
|
+
const {
|
|
89
|
+
beforeFiles = [],
|
|
90
|
+
afterFiles = [],
|
|
91
|
+
fallback = []
|
|
92
|
+
} = Array.isArray(existing) ? { beforeFiles: existing } : existing;
|
|
93
|
+
return { beforeFiles: [...devManifestRewrites, ...beforeFiles], afterFiles, fallback };
|
|
94
|
+
}
|
|
95
|
+
} : {},
|
|
96
|
+
experimental: {
|
|
97
|
+
...nextConfig.experimental
|
|
98
|
+
},
|
|
99
|
+
// Turbopack rules
|
|
100
|
+
turbopack: {
|
|
101
|
+
...nextConfig.turbopack,
|
|
102
|
+
rules: {
|
|
103
|
+
...Object.fromEntries(
|
|
104
|
+
scanDirs.flatMap((dir) => [
|
|
105
|
+
[
|
|
106
|
+
`{./${dir},./app,./pages,./components}/**/*.tsx`,
|
|
107
|
+
{
|
|
108
|
+
loaders: [{ loader: LOADER_PATH, options: loaderOpts }]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
`{./${dir},./app,./pages,./components}/**/*.ts`,
|
|
113
|
+
{
|
|
114
|
+
loaders: [{ loader: LOADER_PATH, options: loaderOpts }]
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
])
|
|
118
|
+
),
|
|
119
|
+
...nextConfig.turbopack?.rules
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
webpack(webpackConfig, webpackOpts) {
|
|
123
|
+
const alreadyRegistered = webpackConfig.module.rules.some(
|
|
124
|
+
(r) => r._tailwindStyledMarker === true
|
|
125
|
+
);
|
|
126
|
+
if (!alreadyRegistered) {
|
|
127
|
+
webpackConfig.module.rules.push({
|
|
128
|
+
_tailwindStyledMarker: true,
|
|
129
|
+
test: /\.(tsx|ts|jsx|js)$/,
|
|
130
|
+
exclude: /node_modules/,
|
|
131
|
+
use: [
|
|
132
|
+
{
|
|
133
|
+
loader: WEBPACK_LOADER_PATH,
|
|
134
|
+
options: {
|
|
135
|
+
...loaderOpts,
|
|
136
|
+
addDataAttr: opts.addDataAttr ?? webpackOpts.dev
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (devtools && webpackOpts.dev) {
|
|
143
|
+
webpackConfig.resolve = webpackConfig.resolve ?? {};
|
|
144
|
+
webpackConfig.resolve.alias = {
|
|
145
|
+
...webpackConfig.resolve.alias ?? void 0,
|
|
146
|
+
"tailwind-styled-v4/devtools": path.resolve(__dirname, "../../devtools/src/index.tsx")
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return typeof nextConfig.webpack === "function" ? nextConfig.webpack(webpackConfig, webpackOpts) : webpackConfig;
|
|
150
|
+
},
|
|
151
|
+
generateBuildId: async () => {
|
|
152
|
+
try {
|
|
153
|
+
const { generateSafelistCss } = __require("@tailwind-styled/compiler");
|
|
154
|
+
generateSafelistCss(
|
|
155
|
+
scanDirs.map((d) => path.resolve(cwd, d)),
|
|
156
|
+
path.isAbsolute(safelistOutput) ? safelistOutput : path.resolve(cwd, safelistOutput)
|
|
157
|
+
);
|
|
158
|
+
console.log("[tailwind-styled-v4] \u2713 Safelist CSS generated");
|
|
159
|
+
} catch (e) {
|
|
160
|
+
console.warn("[tailwind-styled-v4] Safelist skipped:", e);
|
|
161
|
+
}
|
|
162
|
+
if (plugins.length > 0) {
|
|
163
|
+
try {
|
|
164
|
+
const { getGlobalRegistry, runBuildHooks } = __require("@tailwind-styled/plugin");
|
|
165
|
+
await runBuildHooks(getGlobalRegistry());
|
|
166
|
+
console.log("[tailwind-styled-v4] \u2713 Plugin build hooks complete");
|
|
167
|
+
} catch (e) {
|
|
168
|
+
console.warn("[tailwind-styled-v4] Plugin build hooks failed:", e);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (routeCss) {
|
|
172
|
+
try {
|
|
173
|
+
const { createEngine } = __require("@tailwind-styled/engine");
|
|
174
|
+
const engine = await createEngine({
|
|
175
|
+
root: cwd,
|
|
176
|
+
scanner: {
|
|
177
|
+
includeExtensions: [".tsx", ".ts", ".jsx", ".js"],
|
|
178
|
+
ignoreDirectories: scanDirs
|
|
179
|
+
},
|
|
180
|
+
compileCss: true,
|
|
181
|
+
tailwindConfigPath: zeroConfig ? void 0 : "tailwind.config.ts",
|
|
182
|
+
plugins: []
|
|
183
|
+
});
|
|
184
|
+
const buildResult = await engine.build();
|
|
185
|
+
if (buildResult.css) {
|
|
186
|
+
const routeDir = routeCssDir;
|
|
187
|
+
fs.mkdirSync(routeDir, { recursive: true });
|
|
188
|
+
const indexCssPath = path.join(routeDir, "index.css");
|
|
189
|
+
fs.writeFileSync(indexCssPath, buildResult.css);
|
|
190
|
+
const manifest = { "/": "index.css" };
|
|
191
|
+
const manifestPath = path.join(
|
|
192
|
+
cwd,
|
|
193
|
+
".next",
|
|
194
|
+
"static",
|
|
195
|
+
"css",
|
|
196
|
+
"tw",
|
|
197
|
+
"css-manifest.json"
|
|
198
|
+
);
|
|
199
|
+
fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
|
|
200
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
201
|
+
const sizeKb = Buffer.byteLength(buildResult.css, "utf8") / 1024;
|
|
202
|
+
console.log(`[tailwind-styled-v4] \u2713 Route CSS: ${sizeKb.toFixed(1)}KB`);
|
|
203
|
+
console.log(
|
|
204
|
+
"[tailwind-styled-v4] \u2713 Route CSS manifest \u2192 .next/static/css/tw/css-manifest.json"
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.warn("[tailwind-styled-v4] Route CSS skipped:", e);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (plugins.length > 0) {
|
|
212
|
+
try {
|
|
213
|
+
const {
|
|
214
|
+
getGlobalRegistry,
|
|
215
|
+
generateTokenCss,
|
|
216
|
+
generateUtilityCss,
|
|
217
|
+
applyCssHooks
|
|
218
|
+
} = __require("@tailwind-styled/plugin");
|
|
219
|
+
const registry = getGlobalRegistry();
|
|
220
|
+
let pluginCss = [generateTokenCss(registry), generateUtilityCss(registry)].filter(Boolean).join("\n\n");
|
|
221
|
+
pluginCss = applyCssHooks(pluginCss, registry);
|
|
222
|
+
if (pluginCss.trim()) {
|
|
223
|
+
const outPath = path.join(cwd, "public", "__tw-plugins.css");
|
|
224
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
225
|
+
fs.writeFileSync(outPath, pluginCss);
|
|
226
|
+
console.log("[tailwind-styled-v4] \u2713 Plugin CSS \u2192 public/__tw-plugins.css");
|
|
227
|
+
}
|
|
228
|
+
} catch (e) {
|
|
229
|
+
console.warn("[tailwind-styled-v4] Plugin CSS skipped:", e);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (typeof nextConfig.generateBuildId === "function") return nextConfig.generateBuildId();
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export { withTailwindStyled };
|
|
240
|
+
//# sourceMappingURL=next.js.map
|
|
241
|
+
//# sourceMappingURL=next.js.map
|