tailwind-styled-v4 5.0.9 → 5.0.10
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 +15 -1
- package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
- package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
- package/dist/analyzer.d.mts +5 -3
- package/dist/analyzer.d.ts +5 -3
- package/dist/analyzer.js +563 -468
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +562 -467
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -7
- package/dist/animate.d.ts +4 -7
- package/dist/animate.js +171 -265
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +165 -264
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.d.mts +22 -1
- package/dist/atomic.d.ts +22 -1
- package/dist/atomic.js +221 -165
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +200 -165
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.d.mts +60 -1
- package/dist/cli.d.ts +60 -1
- package/dist/cli.js +1261 -1517
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1238 -1513
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +38 -7
- package/dist/compiler.d.ts +38 -7
- package/dist/compiler.js +174 -197
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +151 -194
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +7 -31
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +7 -31
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +134 -63
- package/dist/engine.d.ts +134 -63
- package/dist/engine.js +2863 -2482
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2852 -2485
- package/dist/engine.mjs.map +1 -1
- package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
- package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
- package/dist/index.d.mts +45 -32
- package/dist/index.d.ts +45 -32
- package/dist/index.js +271 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -158
- package/dist/index.mjs.map +1 -1
- package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
- package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
- package/dist/next.js +20 -39
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +18 -37
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +8 -2
- package/dist/plugin-api.d.ts +8 -2
- package/dist/plugin-api.js +14 -2
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +14 -3
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +51 -11
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +51 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +5 -7
- package/dist/plugin.d.ts +5 -7
- package/dist/plugin.js +16 -15
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +16 -16
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js +17 -38
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +15 -36
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/scanner.d.mts +10 -1
- package/dist/scanner.d.ts +10 -1
- package/dist/scanner.js +298 -124
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +296 -124
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +104 -176
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -176
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +1 -1
- package/dist/storybook-addon.d.ts +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +166 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +143 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +21 -21
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +21 -21
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +9 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +9 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +2 -2
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +40 -112
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +37 -110
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +79 -124
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +63 -122
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +1256 -1517
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +1236 -1513
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1783 -823
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1767 -821
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +165 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +141 -1
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +65 -108
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -104
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +22 -24
package/dist/turbopackLoader.js
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
|
-
var
|
|
4
|
+
var fs3 = require('fs');
|
|
5
5
|
var path = require('path');
|
|
6
|
+
require('crypto');
|
|
7
|
+
var url = require('url');
|
|
6
8
|
|
|
7
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
-
function
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
9
27
|
|
|
10
|
-
var
|
|
11
|
-
var
|
|
28
|
+
var fs3__namespace = /*#__PURE__*/_interopNamespace(fs3);
|
|
29
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
12
30
|
|
|
13
31
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
14
32
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,45 +39,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
21
39
|
var __esm = (fn, res) => function __init() {
|
|
22
40
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
23
41
|
};
|
|
24
|
-
|
|
25
|
-
// packages/domain/shared/src/native-resolution.ts
|
|
26
|
-
function getNodeModuleRef() {
|
|
27
|
-
if (isBrowser) return null;
|
|
28
|
-
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
29
|
-
try {
|
|
30
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
31
|
-
nodeModuleRef = test;
|
|
32
|
-
return test;
|
|
33
|
-
} catch {
|
|
34
|
-
nodeModuleRef = null;
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function getNodeFs() {
|
|
39
|
-
if (isBrowser) return { existsSync: () => false };
|
|
40
|
-
const nodeRequire = getNodeModuleRef();
|
|
41
|
-
if (!nodeRequire) return { existsSync: () => false };
|
|
42
|
-
if (!_nodeFs) _nodeFs = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:fs");
|
|
43
|
-
return _nodeFs;
|
|
44
|
-
}
|
|
45
|
-
function getNodePath() {
|
|
46
|
-
if (isBrowser) return { resolve: () => "", dirname: "" };
|
|
47
|
-
const nodeRequire = getNodeModuleRef();
|
|
48
|
-
if (!nodeRequire) return { resolve: () => "", dirname: "" };
|
|
49
|
-
if (!_nodePath) _nodePath = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:path");
|
|
50
|
-
return _nodePath;
|
|
51
|
-
}
|
|
52
|
-
function getRequire(_importMetaUrl) {
|
|
53
|
-
if (isBrowser) return () => {
|
|
54
|
-
throw new Error("node:module not available");
|
|
55
|
-
};
|
|
56
|
-
const nodeRequire = getNodeModuleRef();
|
|
57
|
-
if (!nodeRequire) return () => {
|
|
58
|
-
throw new Error("require not available");
|
|
59
|
-
};
|
|
60
|
-
if (!_require) _require = nodeRequire.createRequire(_importMetaUrl);
|
|
61
|
-
return _require;
|
|
62
|
-
}
|
|
63
42
|
function platformKey() {
|
|
64
43
|
if (isBrowser) return "browser";
|
|
65
44
|
return `${process.platform}-${process.arch}`;
|
|
@@ -70,24 +49,21 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
70
49
|
if (isBrowser) {
|
|
71
50
|
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
72
51
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
52
|
+
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
53
|
+
return { path: null, source: "not-found", platform, tried: [] };
|
|
54
|
+
}
|
|
76
55
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
77
56
|
if (envPath) {
|
|
78
|
-
if (
|
|
57
|
+
if (fs3__namespace.existsSync(envPath)) {
|
|
79
58
|
return { path: envPath, source: "env", platform, tried };
|
|
80
59
|
}
|
|
81
60
|
tried.push(`env:${envPath} (not found)`);
|
|
82
61
|
}
|
|
83
|
-
if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
|
|
84
|
-
return { path: null, source: "not-found", platform, tried: ["disabled by env"] };
|
|
85
|
-
}
|
|
86
62
|
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
87
63
|
for (const pkg of prebuiltPkgs) {
|
|
88
64
|
try {
|
|
89
|
-
const candidate =
|
|
90
|
-
if (
|
|
65
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
66
|
+
if (fs3__namespace.existsSync(candidate)) {
|
|
91
67
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
92
68
|
}
|
|
93
69
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -97,30 +73,43 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
97
73
|
}
|
|
98
74
|
const cwd = process.cwd();
|
|
99
75
|
const base = runtimeDir ?? cwd;
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
77
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
78
|
+
const localCandidates = [];
|
|
79
|
+
for (const bin of BINARY_NAMES) {
|
|
80
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.node`));
|
|
81
|
+
localCandidates.push(path__namespace.resolve(base, "..", `${bin}.node`));
|
|
82
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${platform}.node`));
|
|
83
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
84
|
+
}
|
|
85
|
+
for (const startDir of [cwd, base]) {
|
|
86
|
+
let dir = startDir;
|
|
87
|
+
for (let i = 0; i < 6; i++) {
|
|
88
|
+
const nativeDir = path__namespace.resolve(dir, "native");
|
|
89
|
+
for (const bin of BINARY_NAMES) {
|
|
90
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.node`));
|
|
91
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
92
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
93
|
+
localCandidates.push(path__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
94
|
+
}
|
|
95
|
+
const parent = path__namespace.resolve(dir, "..");
|
|
96
|
+
if (parent === dir) break;
|
|
97
|
+
dir = parent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
108
100
|
for (const candidate of localCandidates) {
|
|
109
101
|
tried.push(`local:${candidate}`);
|
|
110
|
-
if (
|
|
102
|
+
if (fs3__namespace.existsSync(candidate)) {
|
|
111
103
|
return { path: candidate, source: "local", platform, tried };
|
|
112
104
|
}
|
|
113
105
|
}
|
|
114
106
|
return { path: null, source: "not-found", platform, tried };
|
|
115
107
|
}
|
|
116
|
-
var isBrowser,
|
|
108
|
+
var isBrowser, _require, PLATFORM_MAP;
|
|
117
109
|
var init_native_resolution = __esm({
|
|
118
110
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
119
111
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
120
|
-
|
|
121
|
-
_nodeFs = null;
|
|
122
|
-
_nodePath = null;
|
|
123
|
-
_require = null;
|
|
112
|
+
_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('turbopackLoader.js', document.baseURI).href)));
|
|
124
113
|
PLATFORM_MAP = {
|
|
125
114
|
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
126
115
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
@@ -131,59 +120,26 @@ var init_native_resolution = __esm({
|
|
|
131
120
|
};
|
|
132
121
|
}
|
|
133
122
|
});
|
|
134
|
-
|
|
135
|
-
// packages/domain/shared/src/index.ts
|
|
136
|
-
function getNodeModuleRef2() {
|
|
137
|
-
if (isBrowser2) return null;
|
|
138
|
-
if (nodeModuleRef2 !== null) return nodeModuleRef2;
|
|
139
|
-
try {
|
|
140
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
141
|
-
nodeModuleRef2 = test;
|
|
142
|
-
return test;
|
|
143
|
-
} catch {
|
|
144
|
-
nodeModuleRef2 = null;
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function getNodeUrl() {
|
|
149
|
-
if (isBrowser2) throw new Error("node:url not available in browser");
|
|
150
|
-
const nodeRequire = getNodeModuleRef2();
|
|
151
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
152
|
-
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:url");
|
|
153
|
-
return _nodeUrl;
|
|
154
|
-
}
|
|
155
|
-
function getRequire2() {
|
|
156
|
-
if (isBrowser2) return (() => {
|
|
157
|
-
throw new Error("require not available in browser");
|
|
158
|
-
});
|
|
159
|
-
const nodeRequire = getNodeModuleRef2();
|
|
160
|
-
if (!nodeRequire) return (() => {
|
|
161
|
-
throw new Error("require not available");
|
|
162
|
-
});
|
|
163
|
-
return nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
164
|
-
}
|
|
165
123
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
166
|
-
if (isBrowser2) return "";
|
|
167
124
|
try {
|
|
168
|
-
return
|
|
125
|
+
return path__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
|
|
169
126
|
} catch {
|
|
170
127
|
return process.cwd();
|
|
171
128
|
}
|
|
172
129
|
}
|
|
173
|
-
var isBrowser2, nodeModuleRef2, _nodeUrl;
|
|
174
130
|
var init_src = __esm({
|
|
175
131
|
"packages/domain/shared/src/index.ts"() {
|
|
176
132
|
init_native_resolution();
|
|
177
|
-
|
|
178
|
-
nodeModuleRef2 = null;
|
|
179
|
-
_nodeUrl = null;
|
|
180
|
-
getRequire2();
|
|
133
|
+
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
181
134
|
}
|
|
182
135
|
});
|
|
183
|
-
|
|
136
|
+
|
|
137
|
+
// packages/domain/compiler/src/nativeBridge.ts
|
|
138
|
+
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
184
139
|
var init_nativeBridge = __esm({
|
|
185
140
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
186
141
|
init_src();
|
|
142
|
+
_loadNative = (path4) => __require(path4);
|
|
187
143
|
log = (...args) => {
|
|
188
144
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
189
145
|
console.log("[compiler:native]", ...args);
|
|
@@ -210,11 +166,10 @@ var init_nativeBridge = __esm({
|
|
|
210
166
|
bridgeLoadAttempted = true;
|
|
211
167
|
try {
|
|
212
168
|
const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
213
|
-
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
214
169
|
const result = resolveNativeBinary(runtimeDir);
|
|
215
170
|
if (result.path && result.path.endsWith(".node")) {
|
|
216
171
|
try {
|
|
217
|
-
const binding =
|
|
172
|
+
const binding = _loadNative(result.path);
|
|
218
173
|
if (isValidNativeBridge(binding)) {
|
|
219
174
|
nativeBridge = binding;
|
|
220
175
|
log("Native bridge loaded successfully from:", result.path);
|
|
@@ -264,7 +219,7 @@ var runLoaderTransform = (ctx) => {
|
|
|
264
219
|
classes: result?.classes || []
|
|
265
220
|
};
|
|
266
221
|
};
|
|
267
|
-
var registerFileClasses = (
|
|
222
|
+
var registerFileClasses = (_filepath, _classes) => {
|
|
268
223
|
};
|
|
269
224
|
function parseBool(val, fallback = false) {
|
|
270
225
|
if (typeof val === "boolean") return val;
|
|
@@ -301,29 +256,29 @@ var CYCLE_SENTINEL = "_cycle.txt";
|
|
|
301
256
|
var START_SENTINEL = "_start.txt";
|
|
302
257
|
var _workerCache = /* @__PURE__ */ new Map();
|
|
303
258
|
function getTwClassesDir(safelistPath) {
|
|
304
|
-
return
|
|
259
|
+
return path__namespace.default.join(path__namespace.default.dirname(safelistPath), "tw-classes");
|
|
305
260
|
}
|
|
306
261
|
function readSentinel(filePath) {
|
|
307
262
|
try {
|
|
308
|
-
return
|
|
263
|
+
return fs3__namespace.default.readFileSync(filePath, "utf-8").trim();
|
|
309
264
|
} catch {
|
|
310
265
|
return "";
|
|
311
266
|
}
|
|
312
267
|
}
|
|
313
268
|
function clearAndMarkCycle(twClassesDir, startId) {
|
|
314
269
|
try {
|
|
315
|
-
if (
|
|
316
|
-
for (const file of
|
|
270
|
+
if (fs3__namespace.default.existsSync(twClassesDir)) {
|
|
271
|
+
for (const file of fs3__namespace.default.readdirSync(twClassesDir)) {
|
|
317
272
|
if (file === START_SENTINEL || file === "_webpack-merged.css") continue;
|
|
318
273
|
try {
|
|
319
|
-
|
|
274
|
+
fs3__namespace.default.unlinkSync(path__namespace.default.join(twClassesDir, file));
|
|
320
275
|
} catch {
|
|
321
276
|
}
|
|
322
277
|
}
|
|
323
278
|
} else {
|
|
324
|
-
|
|
279
|
+
fs3__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
325
280
|
}
|
|
326
|
-
|
|
281
|
+
fs3__namespace.default.writeFileSync(path__namespace.default.join(twClassesDir, CYCLE_SENTINEL), startId, "utf-8");
|
|
327
282
|
_workerCache.set(twClassesDir, startId);
|
|
328
283
|
} catch {
|
|
329
284
|
}
|
|
@@ -331,32 +286,32 @@ function clearAndMarkCycle(twClassesDir, startId) {
|
|
|
331
286
|
function getPerFileSafelistPath(safelistDir, resourcePath) {
|
|
332
287
|
const normalized = resourcePath.replace(/\\/g, "/");
|
|
333
288
|
const slug = normalized.replace(/^.*\/src\//, "").replace(/\.[tj]sx?$/, "").replace(/[^a-zA-Z0-9]/g, "_").slice(0, 80);
|
|
334
|
-
return
|
|
289
|
+
return path__namespace.default.join(safelistDir, `${slug}.css`);
|
|
335
290
|
}
|
|
336
291
|
function writePerFileSafelist(safelistPath, resourcePath, classes) {
|
|
337
292
|
if (!safelistPath || classes.length === 0) return;
|
|
338
293
|
try {
|
|
339
294
|
const twClassesDir = getTwClassesDir(safelistPath);
|
|
340
|
-
const startId = readSentinel(
|
|
341
|
-
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(
|
|
295
|
+
const startId = readSentinel(path__namespace.default.join(twClassesDir, START_SENTINEL));
|
|
296
|
+
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(path__namespace.default.join(twClassesDir, CYCLE_SENTINEL));
|
|
342
297
|
if (startId && cachedCycle !== startId) {
|
|
343
298
|
clearAndMarkCycle(twClassesDir, startId);
|
|
344
|
-
} else if (!
|
|
345
|
-
|
|
299
|
+
} else if (!fs3__namespace.default.existsSync(twClassesDir)) {
|
|
300
|
+
fs3__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
346
301
|
}
|
|
347
302
|
const outPath = getPerFileSafelistPath(twClassesDir, resourcePath);
|
|
348
303
|
const sorted = [...new Set(classes)].sort();
|
|
349
304
|
const css = [
|
|
350
|
-
`/* tw-safelist: ${
|
|
305
|
+
`/* tw-safelist: ${path__namespace.default.basename(resourcePath)} \u2014 auto-generated */`,
|
|
351
306
|
"@layer utilities {",
|
|
352
307
|
sorted.map((cls) => `.${cls.replace(/([^a-zA-Z0-9_-])/g, "\\$1")} {}`).join("\n"),
|
|
353
308
|
"}"
|
|
354
309
|
].join("\n");
|
|
355
310
|
try {
|
|
356
|
-
if (
|
|
311
|
+
if (fs3__namespace.default.readFileSync(outPath, "utf-8") === css) return;
|
|
357
312
|
} catch {
|
|
358
313
|
}
|
|
359
|
-
|
|
314
|
+
fs3__namespace.default.writeFileSync(outPath, css, "utf-8");
|
|
360
315
|
} catch {
|
|
361
316
|
}
|
|
362
317
|
}
|
|
@@ -365,7 +320,7 @@ function turbopackLoader(source, options = {}) {
|
|
|
365
320
|
const router = detectRouter(this.resourcePath);
|
|
366
321
|
const nextMajor = parseNum(options.nextMajor);
|
|
367
322
|
const debug = parseBool(options.debug);
|
|
368
|
-
const filename =
|
|
323
|
+
const filename = path__namespace.default.basename(this.resourcePath);
|
|
369
324
|
const effective = {
|
|
370
325
|
addDataAttr: parseBool(options.addDataAttr),
|
|
371
326
|
// App Router: selalu auto-detect client boundary
|