tailwind-styled-v4 5.0.7 → 5.0.9
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/CHANGELOG.md +184 -410
- package/README.md +45 -15
- package/dist/cli.js +62 -52
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +62 -52
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +8 -3
- package/dist/compiler.d.ts +8 -3
- package/dist/compiler.js +214 -127
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +195 -103
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +146 -66
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +146 -66
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +72 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -19
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +12 -40
- package/dist/next.d.ts +12 -40
- package/dist/next.js +27 -320
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +27 -320
- package/dist/next.mjs.map +1 -1
- package/dist/turbopackLoader.js +137 -88
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +137 -88
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +62 -52
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +62 -52
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +146 -66
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +146 -66
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +92 -83
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +92 -83
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -3
package/dist/webpackLoader.js
CHANGED
|
@@ -10,16 +10,18 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
11
11
|
|
|
12
12
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
14
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
14
15
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
15
16
|
}) : x)(function(x) {
|
|
16
17
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
17
18
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
18
19
|
});
|
|
20
|
+
var __esm = (fn, res) => function __init() {
|
|
21
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
22
|
+
};
|
|
19
23
|
|
|
20
24
|
// packages/domain/shared/src/native-resolution.ts
|
|
21
|
-
var isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
22
|
-
var nodeModuleRef = null;
|
|
23
25
|
function getNodeModuleRef() {
|
|
24
26
|
if (isBrowser) return null;
|
|
25
27
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
@@ -32,9 +34,6 @@ function getNodeModuleRef() {
|
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
var _nodeFs = null;
|
|
36
|
-
var _nodePath = null;
|
|
37
|
-
var _require = null;
|
|
38
37
|
function getNodeFs() {
|
|
39
38
|
if (isBrowser) return { existsSync: () => false };
|
|
40
39
|
const nodeRequire = getNodeModuleRef();
|
|
@@ -60,14 +59,6 @@ function getRequire(_importMetaUrl) {
|
|
|
60
59
|
if (!_require) _require = nodeRequire.createRequire(_importMetaUrl);
|
|
61
60
|
return _require;
|
|
62
61
|
}
|
|
63
|
-
var PLATFORM_MAP = {
|
|
64
|
-
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
65
|
-
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
66
|
-
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
67
|
-
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
68
|
-
"win32-x64": ["@tailwind-styled/native-win32-x64"],
|
|
69
|
-
"win32-arm64": ["@tailwind-styled/native-win32-arm64"]
|
|
70
|
-
};
|
|
71
62
|
function platformKey() {
|
|
72
63
|
if (isBrowser) return "browser";
|
|
73
64
|
return `${process.platform}-${process.arch}`;
|
|
@@ -121,10 +112,26 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
121
112
|
}
|
|
122
113
|
return { path: null, source: "not-found", platform, tried };
|
|
123
114
|
}
|
|
115
|
+
var isBrowser, nodeModuleRef, _nodeFs, _nodePath, _require, PLATFORM_MAP;
|
|
116
|
+
var init_native_resolution = __esm({
|
|
117
|
+
"packages/domain/shared/src/native-resolution.ts"() {
|
|
118
|
+
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
119
|
+
nodeModuleRef = null;
|
|
120
|
+
_nodeFs = null;
|
|
121
|
+
_nodePath = null;
|
|
122
|
+
_require = null;
|
|
123
|
+
PLATFORM_MAP = {
|
|
124
|
+
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
125
|
+
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
126
|
+
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
127
|
+
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
128
|
+
"win32-x64": ["@tailwind-styled/native-win32-x64"],
|
|
129
|
+
"win32-arm64": ["@tailwind-styled/native-win32-arm64"]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
});
|
|
124
133
|
|
|
125
134
|
// packages/domain/shared/src/index.ts
|
|
126
|
-
var isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
127
|
-
var nodeModuleRef2 = null;
|
|
128
135
|
function getNodeModuleRef2() {
|
|
129
136
|
if (isBrowser2) return null;
|
|
130
137
|
if (nodeModuleRef2 !== null) return nodeModuleRef2;
|
|
@@ -137,7 +144,6 @@ function getNodeModuleRef2() {
|
|
|
137
144
|
return null;
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
|
-
var _nodeUrl = null;
|
|
141
147
|
function getNodeUrl() {
|
|
142
148
|
if (isBrowser2) throw new Error("node:url not available in browser");
|
|
143
149
|
const nodeRequire = getNodeModuleRef2();
|
|
@@ -155,7 +161,6 @@ function getRequire2() {
|
|
|
155
161
|
});
|
|
156
162
|
return nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
|
|
157
163
|
}
|
|
158
|
-
getRequire2();
|
|
159
164
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
160
165
|
if (isBrowser2) return "";
|
|
161
166
|
try {
|
|
@@ -164,57 +169,80 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
164
169
|
return process.cwd();
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var bridgeLoadError = null;
|
|
176
|
-
var isValidNativeBridge = (mod) => {
|
|
177
|
-
const m = mod;
|
|
178
|
-
return !!(typeof m.transformSource === "function" || typeof m.extractAllClasses === "function" || typeof m.hasTwUsage === "function");
|
|
179
|
-
};
|
|
180
|
-
var getNativeBridge = () => {
|
|
181
|
-
if (nativeBridge) {
|
|
182
|
-
return nativeBridge;
|
|
183
|
-
}
|
|
184
|
-
if (bridgeLoadAttempted) {
|
|
185
|
-
if (bridgeLoadError) {
|
|
186
|
-
throw bridgeLoadError;
|
|
187
|
-
}
|
|
188
|
-
throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
|
|
172
|
+
var isBrowser2, nodeModuleRef2, _nodeUrl;
|
|
173
|
+
var init_src = __esm({
|
|
174
|
+
"packages/domain/shared/src/index.ts"() {
|
|
175
|
+
init_native_resolution();
|
|
176
|
+
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
177
|
+
nodeModuleRef2 = null;
|
|
178
|
+
_nodeUrl = null;
|
|
179
|
+
getRequire2();
|
|
189
180
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
181
|
+
});
|
|
182
|
+
var log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
183
|
+
var init_nativeBridge = __esm({
|
|
184
|
+
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
185
|
+
init_src();
|
|
186
|
+
log = (...args) => {
|
|
187
|
+
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
188
|
+
console.log("[compiler:native]", ...args);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/compiler v5] Native binding is required but not available.\nThis package requires native Rust bindings. There is no JavaScript fallback.\nPlease ensure:\n 1. The native module is properly installed\n 2. You have run: npm run build:rust (or use prebuilt binary)\n\nFor help, see: https://tailwind-styled.dev/docs/install";
|
|
192
|
+
nativeBridge = null;
|
|
193
|
+
bridgeLoadAttempted = false;
|
|
194
|
+
bridgeLoadError = null;
|
|
195
|
+
isValidNativeBridge = (mod) => {
|
|
196
|
+
const m = mod;
|
|
197
|
+
return !!(typeof m.transformSource === "function" || typeof m.extractAllClasses === "function" || typeof m.hasTwUsage === "function");
|
|
198
|
+
};
|
|
199
|
+
getNativeBridge = () => {
|
|
200
|
+
if (nativeBridge) {
|
|
201
|
+
return nativeBridge;
|
|
202
|
+
}
|
|
203
|
+
if (bridgeLoadAttempted) {
|
|
204
|
+
if (bridgeLoadError) {
|
|
205
|
+
throw bridgeLoadError;
|
|
202
206
|
}
|
|
203
|
-
|
|
204
|
-
log("Failed to require native binding:", e);
|
|
207
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
|
|
205
208
|
}
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
bridgeLoadAttempted = true;
|
|
210
|
+
try {
|
|
211
|
+
const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
|
|
212
|
+
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
|
|
213
|
+
const result = resolveNativeBinary(runtimeDir);
|
|
214
|
+
if (result.path && result.path.endsWith(".node")) {
|
|
215
|
+
try {
|
|
216
|
+
const binding = require2(result.path);
|
|
217
|
+
if (isValidNativeBridge(binding)) {
|
|
218
|
+
nativeBridge = binding;
|
|
219
|
+
log("Native bridge loaded successfully from:", result.path);
|
|
220
|
+
return nativeBridge;
|
|
221
|
+
}
|
|
222
|
+
} catch (e) {
|
|
223
|
+
log("Failed to require native binding:", e);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
|
|
208
227
|
|
|
209
228
|
Tried paths: ${result.tried.join("\n")}`);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
229
|
+
} catch (err) {
|
|
230
|
+
bridgeLoadError = err instanceof Error ? err : new Error(String(err));
|
|
231
|
+
log("Failed to load native bridge:", bridgeLoadError.message);
|
|
232
|
+
throw bridgeLoadError;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
if (typeof process !== "undefined" && !bridgeLoadAttempted) {
|
|
236
|
+
try {
|
|
237
|
+
getNativeBridge();
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
}
|
|
214
241
|
}
|
|
215
|
-
};
|
|
242
|
+
});
|
|
216
243
|
|
|
217
244
|
// packages/domain/compiler/src/index.ts
|
|
245
|
+
init_nativeBridge();
|
|
218
246
|
var transformSource = (source, opts) => {
|
|
219
247
|
const native = getNativeBridge();
|
|
220
248
|
if (!native?.transformSource) {
|
|
@@ -246,30 +274,7 @@ var shouldSkipFile = (filepath) => {
|
|
|
246
274
|
}
|
|
247
275
|
return false;
|
|
248
276
|
};
|
|
249
|
-
var fileToRoute = (filepath) => {
|
|
250
|
-
const normalized = filepath.replace(/\\/g, "/");
|
|
251
|
-
if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
|
|
252
|
-
return "__global";
|
|
253
|
-
}
|
|
254
|
-
const appPageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
|
|
255
|
-
if (appPageMatch) return `/${appPageMatch[1]}`;
|
|
256
|
-
const appRootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
|
|
257
|
-
if (appRootPage) return "/";
|
|
258
|
-
const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
|
|
259
|
-
if (pagesMatch) {
|
|
260
|
-
const pagePath = pagesMatch[1];
|
|
261
|
-
if (pagePath.startsWith("_") || pagePath.startsWith("api/")) return "__global";
|
|
262
|
-
return pagePath === "index" ? "/" : `/${pagePath}`;
|
|
263
|
-
}
|
|
264
|
-
return null;
|
|
265
|
-
};
|
|
266
|
-
var _routeClassMap = /* @__PURE__ */ new Map();
|
|
267
277
|
var registerFileClasses = (filepath, classes) => {
|
|
268
|
-
if (!classes.length) return;
|
|
269
|
-
const route = fileToRoute(filepath) ?? "__global";
|
|
270
|
-
const existing = _routeClassMap.get(route) ?? /* @__PURE__ */ new Set();
|
|
271
|
-
for (const cls of classes) existing.add(cls);
|
|
272
|
-
_routeClassMap.set(route, existing);
|
|
273
278
|
};
|
|
274
279
|
var WebpackLoaderOptionsSchema = zod.z.object({
|
|
275
280
|
mode: zod.z.literal("zero-runtime").optional(),
|
|
@@ -313,6 +318,10 @@ function webpackLoader(source) {
|
|
|
313
318
|
if (typeof output.code !== "string") {
|
|
314
319
|
throw new TypeError(`[tailwind-styled] Invalid transform output for ${filepath}: code is not a string`);
|
|
315
320
|
}
|
|
321
|
+
if (!output.changed) {
|
|
322
|
+
callback(null, source);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
316
325
|
if (options.verbose && output.changed) {
|
|
317
326
|
const rsc = output.rsc;
|
|
318
327
|
const engine = output.engine ?? "js";
|