weapp-tailwindcss 4.11.0-alpha.1 → 4.11.0-alpha.2
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/{chunk-35EI5JMK.mjs → chunk-23K4XDKF.mjs} +3 -1
- package/dist/{chunk-W2EMGF7H.js → chunk-2W24MRCQ.js} +10 -12
- package/dist/chunk-4AFQP74Z.js +24 -0
- package/dist/{chunk-SQG2MOFQ.js → chunk-4TTPYMVM.js} +12 -8
- package/dist/{chunk-4LPOQMFS.js → chunk-5KSBT6GU.js} +396 -219
- package/dist/{chunk-LD7LZ4IK.mjs → chunk-66E76FQE.mjs} +91 -50
- package/dist/{chunk-GWDHNCL2.js → chunk-6O7HJU2F.js} +123 -42
- package/dist/{chunk-RRHPTTCP.mjs → chunk-76S2EME4.mjs} +2 -0
- package/dist/{chunk-G3G437UE.js → chunk-7LKMJZD2.js} +2 -2
- package/dist/{chunk-OV7FX6XR.js → chunk-CRDOWYG4.js} +1 -1
- package/dist/{chunk-DOH7FULQ.mjs → chunk-EFBQ4SQR.mjs} +1 -1
- package/dist/{chunk-IEZ5RBMG.mjs → chunk-EW2K6CO5.mjs} +365 -188
- package/dist/{chunk-FZNYV7VH.mjs → chunk-HADJCWHU.mjs} +212 -258
- package/dist/{chunk-CZLXTEHN.js → chunk-K7CZXT46.js} +132 -91
- package/dist/{chunk-ACTJYB33.js → chunk-LL3QUKJI.js} +3 -1
- package/dist/{chunk-G5NLM3AL.js → chunk-LYGLQCWI.js} +278 -324
- package/dist/{chunk-LTJQUORK.js → chunk-OF6MFURR.js} +2 -0
- package/dist/{chunk-KKT2DKMW.mjs → chunk-RED7Y22U.mjs} +91 -10
- package/dist/{chunk-R6KEYO3F.mjs → chunk-SJ3SG6DU.mjs} +5 -1
- package/dist/{chunk-JBM3HGHP.mjs → chunk-UCUAXK7F.mjs} +4 -6
- package/dist/cli.js +1006 -147
- package/dist/cli.mjs +942 -107
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +9 -11
- package/dist/core.mjs +6 -8
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +3 -3
- package/dist/css-macro.mjs +4 -4
- package/dist/defaults.d.mts +2 -2
- package/dist/defaults.d.ts +2 -2
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/gulp.d.mts +2 -2
- package/dist/gulp.d.ts +2 -2
- package/dist/gulp.js +7 -8
- package/dist/gulp.mjs +6 -7
- package/dist/{index-t_VBjwYm.d.ts → index-BMwzhITq.d.mts} +6 -6
- package/dist/{index-t_VBjwYm.d.mts → index-BMwzhITq.d.ts} +6 -6
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -12
- package/dist/index.mjs +9 -10
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +8 -9
- package/dist/vite.mjs +6 -7
- package/dist/weapp-tw-css-import-rewrite-loader.js +3 -1
- package/dist/weapp-tw-runtime-classset-loader.js +29 -2
- package/dist/webpack.d.mts +2 -2
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +9 -10
- package/dist/webpack.mjs +7 -8
- package/dist/webpack4.d.mts +2 -2
- package/dist/webpack4.d.ts +2 -2
- package/dist/webpack4.js +41 -41
- package/dist/webpack4.mjs +12 -12
- package/package.json +8 -8
- package/dist/chunk-NOKJXG3W.js +0 -29
- package/dist/chunk-QYZCRG7F.mjs +0 -29
|
@@ -3,13 +3,307 @@
|
|
|
3
3
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkCRDOWYG4js = require('./chunk-CRDOWYG4.js');
|
|
7
7
|
|
|
8
|
-
// src/
|
|
9
|
-
|
|
8
|
+
// src/tailwindcss/patcher-options.ts
|
|
9
|
+
function resolveTailwindcssOptions(options) {
|
|
10
|
+
if (!options) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
return _nullishCoalesce(options.tailwindcss, () => ( options.tailwind));
|
|
14
|
+
}
|
|
15
|
+
function normalizeExtendLengthUnits(value) {
|
|
16
|
+
if (value === false) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (value === true) {
|
|
20
|
+
return { enabled: true };
|
|
21
|
+
}
|
|
22
|
+
if (value && typeof value === "object") {
|
|
23
|
+
return {
|
|
24
|
+
enabled: true,
|
|
25
|
+
...value
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
function normalizeTailwindcssPatcherOptions(options) {
|
|
31
|
+
if (!options) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
if ("patch" in options) {
|
|
35
|
+
const { cache, patch } = options;
|
|
36
|
+
const normalized = {};
|
|
37
|
+
if (cache !== void 0) {
|
|
38
|
+
normalized.cache = cache;
|
|
39
|
+
}
|
|
40
|
+
const apply = {};
|
|
41
|
+
const extract = {};
|
|
42
|
+
if (_optionalChain([patch, 'optionalAccess', _ => _.overwrite]) !== void 0) {
|
|
43
|
+
apply.overwrite = patch.overwrite;
|
|
44
|
+
}
|
|
45
|
+
if (_optionalChain([patch, 'optionalAccess', _2 => _2.filter])) {
|
|
46
|
+
normalized.filter = patch.filter;
|
|
47
|
+
}
|
|
48
|
+
const extendLengthUnits = normalizeExtendLengthUnits(_optionalChain([patch, 'optionalAccess', _3 => _3.applyPatches, 'optionalAccess', _4 => _4.extendLengthUnits]));
|
|
49
|
+
const exposeContext = _optionalChain([patch, 'optionalAccess', _5 => _5.applyPatches, 'optionalAccess', _6 => _6.exportContext]);
|
|
50
|
+
if (extendLengthUnits !== void 0 || exposeContext !== void 0) {
|
|
51
|
+
apply.exposeContext = exposeContext;
|
|
52
|
+
apply.extendLengthUnits = extendLengthUnits;
|
|
53
|
+
}
|
|
54
|
+
const cwd = _nullishCoalesce(_optionalChain([patch, 'optionalAccess', _7 => _7.cwd]), () => ( _optionalChain([patch, 'optionalAccess', _8 => _8.basedir])));
|
|
55
|
+
if (cwd) {
|
|
56
|
+
normalized.projectRoot = cwd;
|
|
57
|
+
}
|
|
58
|
+
const tailwindOptions = _optionalChain([patch, 'optionalAccess', _9 => _9.tailwindcss]) ? { ...patch.tailwindcss } : void 0;
|
|
59
|
+
const legacyResolve = _optionalChain([patch, 'optionalAccess', _10 => _10.resolve]);
|
|
60
|
+
let nextTailwindOptions = tailwindOptions;
|
|
61
|
+
if (_optionalChain([nextTailwindOptions, 'optionalAccess', _11 => _11.version]) === 2 && !nextTailwindOptions.packageName) {
|
|
62
|
+
nextTailwindOptions = {
|
|
63
|
+
...nextTailwindOptions,
|
|
64
|
+
packageName: "@tailwindcss/postcss7-compat",
|
|
65
|
+
postcssPlugin: nextTailwindOptions.postcssPlugin
|
|
66
|
+
};
|
|
67
|
+
if (!nextTailwindOptions.postcssPlugin) {
|
|
68
|
+
nextTailwindOptions.postcssPlugin = "@tailwindcss/postcss7-compat";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (nextTailwindOptions || legacyResolve) {
|
|
72
|
+
const resolveOptions = _optionalChain([nextTailwindOptions, 'optionalAccess', _12 => _12.resolve]);
|
|
73
|
+
const mergedResolve = legacyResolve || resolveOptions ? {
|
|
74
|
+
..._nullishCoalesce(resolveOptions, () => ( {})),
|
|
75
|
+
..._nullishCoalesce(legacyResolve, () => ( {}))
|
|
76
|
+
} : void 0;
|
|
77
|
+
normalized.tailwindcss = {
|
|
78
|
+
..._nullishCoalesce(nextTailwindOptions, () => ( {})),
|
|
79
|
+
...mergedResolve ? { resolve: mergedResolve } : {}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (_optionalChain([patch, 'optionalAccess', _13 => _13.output])) {
|
|
83
|
+
if (patch.output.filename !== void 0) {
|
|
84
|
+
extract.file = patch.output.filename;
|
|
85
|
+
}
|
|
86
|
+
if (patch.output.loose !== void 0) {
|
|
87
|
+
extract.pretty = patch.output.loose ? 2 : false;
|
|
88
|
+
}
|
|
89
|
+
if (patch.output.removeUniversalSelector !== void 0) {
|
|
90
|
+
extract.removeUniversalSelector = patch.output.removeUniversalSelector;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (Object.keys(apply).length > 0) {
|
|
94
|
+
normalized.apply = apply;
|
|
95
|
+
}
|
|
96
|
+
if (Object.keys(extract).length > 0) {
|
|
97
|
+
normalized.extract = extract;
|
|
98
|
+
}
|
|
99
|
+
return toModernTailwindcssPatchOptions(normalized);
|
|
100
|
+
}
|
|
101
|
+
return toModernTailwindcssPatchOptions(options);
|
|
102
|
+
}
|
|
103
|
+
function toModernTailwindcssPatchOptions(options) {
|
|
104
|
+
if (!options) {
|
|
105
|
+
return void 0;
|
|
106
|
+
}
|
|
107
|
+
const normalized = {};
|
|
108
|
+
if (options.cache !== void 0) {
|
|
109
|
+
normalized.cache = options.cache;
|
|
110
|
+
}
|
|
111
|
+
if (options.filter) {
|
|
112
|
+
normalized.filter = options.filter;
|
|
113
|
+
}
|
|
114
|
+
const projectRoot = _nullishCoalesce(options.projectRoot, () => ( options.cwd));
|
|
115
|
+
if (projectRoot) {
|
|
116
|
+
normalized.projectRoot = projectRoot;
|
|
117
|
+
}
|
|
118
|
+
const tailwindcss = resolveTailwindcssOptions(options);
|
|
119
|
+
if (tailwindcss) {
|
|
120
|
+
normalized.tailwindcss = {
|
|
121
|
+
...tailwindcss
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const apply = {
|
|
125
|
+
..._nullishCoalesce(options.apply, () => ( {}))
|
|
126
|
+
};
|
|
127
|
+
if (apply.overwrite === void 0 && options.overwrite !== void 0) {
|
|
128
|
+
apply.overwrite = options.overwrite;
|
|
129
|
+
}
|
|
130
|
+
if (apply.exposeContext === void 0 && _optionalChain([options, 'access', _14 => _14.features, 'optionalAccess', _15 => _15.exposeContext]) !== void 0) {
|
|
131
|
+
apply.exposeContext = options.features.exposeContext;
|
|
132
|
+
}
|
|
133
|
+
if (apply.extendLengthUnits === void 0 && _optionalChain([options, 'access', _16 => _16.features, 'optionalAccess', _17 => _17.extendLengthUnits]) !== void 0) {
|
|
134
|
+
apply.extendLengthUnits = options.features.extendLengthUnits;
|
|
135
|
+
}
|
|
136
|
+
if (Object.keys(apply).length > 0) {
|
|
137
|
+
normalized.apply = apply;
|
|
138
|
+
}
|
|
139
|
+
const extract = {
|
|
140
|
+
..._nullishCoalesce(options.extract, () => ( {}))
|
|
141
|
+
};
|
|
142
|
+
if (options.output) {
|
|
143
|
+
if (extract.write === void 0 && options.output.enabled !== void 0) {
|
|
144
|
+
extract.write = options.output.enabled;
|
|
145
|
+
}
|
|
146
|
+
if (extract.file === void 0 && options.output.file !== void 0) {
|
|
147
|
+
extract.file = options.output.file;
|
|
148
|
+
}
|
|
149
|
+
if (extract.format === void 0 && options.output.format !== void 0) {
|
|
150
|
+
extract.format = options.output.format;
|
|
151
|
+
}
|
|
152
|
+
if (extract.pretty === void 0 && options.output.pretty !== void 0) {
|
|
153
|
+
extract.pretty = options.output.pretty;
|
|
154
|
+
}
|
|
155
|
+
if (extract.removeUniversalSelector === void 0 && options.output.removeUniversalSelector !== void 0) {
|
|
156
|
+
extract.removeUniversalSelector = options.output.removeUniversalSelector;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (Object.keys(extract).length > 0) {
|
|
160
|
+
normalized.extract = extract;
|
|
161
|
+
}
|
|
162
|
+
return normalized;
|
|
163
|
+
}
|
|
10
164
|
|
|
11
|
-
// src/
|
|
165
|
+
// src/tailwindcss/runtime/cache.ts
|
|
12
166
|
var _fs = require('fs');
|
|
167
|
+
var runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
168
|
+
var runtimeFileSignatureCache = /* @__PURE__ */ new Map();
|
|
169
|
+
var runtimeFileSignatureCacheClearTimer;
|
|
170
|
+
var runtimeSignaturePatchersSymbol = /* @__PURE__ */ Symbol.for("weapp-tailwindcss.runtimeSignaturePatchers");
|
|
171
|
+
function getCacheEntry(twPatcher) {
|
|
172
|
+
let entry = runtimeClassSetCache.get(twPatcher);
|
|
173
|
+
if (!entry) {
|
|
174
|
+
entry = {};
|
|
175
|
+
runtimeClassSetCache.set(twPatcher, entry);
|
|
176
|
+
}
|
|
177
|
+
return entry;
|
|
178
|
+
}
|
|
179
|
+
function scheduleRuntimeConfigSignatureCacheClear() {
|
|
180
|
+
if (runtimeFileSignatureCacheClearTimer) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
runtimeFileSignatureCacheClearTimer = setTimeout(() => {
|
|
184
|
+
runtimeFileSignatureCache.clear();
|
|
185
|
+
runtimeFileSignatureCacheClearTimer = void 0;
|
|
186
|
+
}, 0);
|
|
187
|
+
_optionalChain([runtimeFileSignatureCacheClearTimer, 'access', _18 => _18.unref, 'optionalCall', _19 => _19()]);
|
|
188
|
+
}
|
|
189
|
+
function getFileSignature(filePath) {
|
|
190
|
+
const cached = runtimeFileSignatureCache.get(filePath);
|
|
191
|
+
if (cached !== void 0) {
|
|
192
|
+
return cached;
|
|
193
|
+
}
|
|
194
|
+
let signature;
|
|
195
|
+
try {
|
|
196
|
+
const stats = _fs.statSync.call(void 0, filePath);
|
|
197
|
+
signature = `${filePath}:${stats.size}:${stats.mtimeMs}`;
|
|
198
|
+
} catch (e) {
|
|
199
|
+
signature = `${filePath}:missing`;
|
|
200
|
+
}
|
|
201
|
+
runtimeFileSignatureCache.set(filePath, signature);
|
|
202
|
+
scheduleRuntimeConfigSignatureCacheClear();
|
|
203
|
+
return signature;
|
|
204
|
+
}
|
|
205
|
+
function getTailwindTrackedFiles(twPatcher) {
|
|
206
|
+
const tailwindOptions = resolveTailwindcssOptions(twPatcher.options);
|
|
207
|
+
const tracked = /* @__PURE__ */ new Set();
|
|
208
|
+
const configPath = _optionalChain([tailwindOptions, 'optionalAccess', _20 => _20.config]);
|
|
209
|
+
if (typeof configPath === "string" && configPath.length > 0) {
|
|
210
|
+
tracked.add(configPath);
|
|
211
|
+
}
|
|
212
|
+
for (const entry of _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _21 => _21.v4, 'optionalAccess', _22 => _22.cssEntries]), () => ( []))) {
|
|
213
|
+
if (typeof entry === "string" && entry.length > 0) {
|
|
214
|
+
tracked.add(entry);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return tracked;
|
|
218
|
+
}
|
|
219
|
+
function normalizeSignatureValue(value) {
|
|
220
|
+
if (value == null) {
|
|
221
|
+
return "null";
|
|
222
|
+
}
|
|
223
|
+
if (typeof value === "string") {
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
227
|
+
return String(value);
|
|
228
|
+
}
|
|
229
|
+
if (Array.isArray(value)) {
|
|
230
|
+
return `[${value.map((item) => normalizeSignatureValue(item)).join(",")}]`;
|
|
231
|
+
}
|
|
232
|
+
if (typeof value === "object") {
|
|
233
|
+
const entries = Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a.localeCompare(b));
|
|
234
|
+
return `{${entries.map(([key, item]) => `${key}:${normalizeSignatureValue(item)}`).join(",")}}`;
|
|
235
|
+
}
|
|
236
|
+
return String(value);
|
|
237
|
+
}
|
|
238
|
+
function getTailwindOptionsSignature(twPatcher) {
|
|
239
|
+
const options = twPatcher.options;
|
|
240
|
+
const tailwindOptions = resolveTailwindcssOptions(options);
|
|
241
|
+
return normalizeSignatureValue({
|
|
242
|
+
projectRoot: _optionalChain([options, 'optionalAccess', _23 => _23.projectRoot]),
|
|
243
|
+
packageName: _optionalChain([tailwindOptions, 'optionalAccess', _24 => _24.packageName]),
|
|
244
|
+
versionHint: _optionalChain([tailwindOptions, 'optionalAccess', _25 => _25.versionHint]),
|
|
245
|
+
cwd: _optionalChain([tailwindOptions, 'optionalAccess', _26 => _26.cwd]),
|
|
246
|
+
config: _optionalChain([tailwindOptions, 'optionalAccess', _27 => _27.config]),
|
|
247
|
+
v2: _optionalChain([tailwindOptions, 'optionalAccess', _28 => _28.v2]),
|
|
248
|
+
v3: _optionalChain([tailwindOptions, 'optionalAccess', _29 => _29.v3]),
|
|
249
|
+
v4: {
|
|
250
|
+
base: _optionalChain([tailwindOptions, 'optionalAccess', _30 => _30.v4, 'optionalAccess', _31 => _31.base]),
|
|
251
|
+
configuredBase: _optionalChain([tailwindOptions, 'optionalAccess', _32 => _32.v4, 'optionalAccess', _33 => _33.configuredBase]),
|
|
252
|
+
css: _optionalChain([tailwindOptions, 'optionalAccess', _34 => _34.v4, 'optionalAccess', _35 => _35.css]),
|
|
253
|
+
cssEntries: _optionalChain([tailwindOptions, 'optionalAccess', _36 => _36.v4, 'optionalAccess', _37 => _37.cssEntries]),
|
|
254
|
+
hasUserDefinedSources: _optionalChain([tailwindOptions, 'optionalAccess', _38 => _38.v4, 'optionalAccess', _39 => _39.hasUserDefinedSources]),
|
|
255
|
+
sources: _optionalChain([tailwindOptions, 'optionalAccess', _40 => _40.v4, 'optionalAccess', _41 => _41.sources])
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function getPatchTargetSignature(twPatcher) {
|
|
260
|
+
const packageInfo = twPatcher.packageInfo;
|
|
261
|
+
return [
|
|
262
|
+
_nullishCoalesce(_optionalChain([packageInfo, 'optionalAccess', _42 => _42.name]), () => ( "missing")),
|
|
263
|
+
_nullishCoalesce(_optionalChain([packageInfo, 'optionalAccess', _43 => _43.rootPath]), () => ( "missing")),
|
|
264
|
+
_nullishCoalesce(_optionalChain([packageInfo, 'optionalAccess', _44 => _44.version]), () => ( "unknown")),
|
|
265
|
+
_nullishCoalesce(twPatcher.majorVersion, () => ( "unknown")),
|
|
266
|
+
getTailwindOptionsSignature(twPatcher)
|
|
267
|
+
].join(":");
|
|
268
|
+
}
|
|
269
|
+
function getNestedPatchers(twPatcher) {
|
|
270
|
+
const nested = twPatcher[runtimeSignaturePatchersSymbol];
|
|
271
|
+
return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
|
|
272
|
+
}
|
|
273
|
+
function getOwnRuntimeClassSetSignature(twPatcher) {
|
|
274
|
+
const trackedFiles = [...getTailwindTrackedFiles(twPatcher)].sort((a, b) => a.localeCompare(b)).map(getFileSignature);
|
|
275
|
+
const configSignature = trackedFiles.length > 0 ? trackedFiles.join("|") : "files:missing";
|
|
276
|
+
const patchTargetSignature = getPatchTargetSignature(twPatcher);
|
|
277
|
+
return `${configSignature}|patch:${patchTargetSignature}`;
|
|
278
|
+
}
|
|
279
|
+
function invalidateRuntimeClassSet(twPatcher) {
|
|
280
|
+
if (!twPatcher) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const nestedPatchers = getNestedPatchers(twPatcher);
|
|
284
|
+
if (nestedPatchers) {
|
|
285
|
+
for (const patcher of nestedPatchers) {
|
|
286
|
+
invalidateRuntimeClassSet(patcher);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
for (const trackedFile of getTailwindTrackedFiles(twPatcher)) {
|
|
290
|
+
runtimeFileSignatureCache.delete(trackedFile);
|
|
291
|
+
}
|
|
292
|
+
runtimeClassSetCache.delete(twPatcher);
|
|
293
|
+
}
|
|
294
|
+
function getRuntimeClassSetCacheEntry(twPatcher) {
|
|
295
|
+
return getCacheEntry(twPatcher);
|
|
296
|
+
}
|
|
297
|
+
function getRuntimeClassSetSignature(twPatcher) {
|
|
298
|
+
const nestedPatchers = getNestedPatchers(twPatcher);
|
|
299
|
+
if (nestedPatchers) {
|
|
300
|
+
return nestedPatchers.map(getOwnRuntimeClassSetSignature).sort((a, b) => a.localeCompare(b)).join("||");
|
|
301
|
+
}
|
|
302
|
+
return getOwnRuntimeClassSetSignature(twPatcher);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/context/workspace.ts
|
|
306
|
+
|
|
13
307
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
14
308
|
var IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
15
309
|
"node_modules",
|
|
@@ -70,20 +364,20 @@ function findWorkspacePackageDir(rootDir, packageName) {
|
|
|
70
364
|
const pkgPath = _path2.default.join(normalized, "package.json");
|
|
71
365
|
if (_fs.existsSync.call(void 0, pkgPath)) {
|
|
72
366
|
const pkg = JSON.parse(_fs.readFileSync.call(void 0, pkgPath, "utf8"));
|
|
73
|
-
if (_optionalChain([pkg, 'optionalAccess',
|
|
367
|
+
if (_optionalChain([pkg, 'optionalAccess', _45 => _45.name]) === packageName) {
|
|
74
368
|
return normalized;
|
|
75
369
|
}
|
|
76
370
|
}
|
|
77
|
-
} catch (
|
|
371
|
+
} catch (e2) {
|
|
78
372
|
}
|
|
79
373
|
let entries;
|
|
80
374
|
try {
|
|
81
375
|
entries = _fs.readdirSync.call(void 0, normalized, { withFileTypes: true });
|
|
82
|
-
} catch (
|
|
376
|
+
} catch (e3) {
|
|
83
377
|
continue;
|
|
84
378
|
}
|
|
85
379
|
for (const entry of entries) {
|
|
86
|
-
if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || _optionalChain([entry, 'access',
|
|
380
|
+
if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || _optionalChain([entry, 'access', _46 => _46.isSymbolicLink, 'optionalCall', _47 => _47()])) {
|
|
87
381
|
continue;
|
|
88
382
|
}
|
|
89
383
|
queue.push(_path2.default.join(normalized, entry.name));
|
|
@@ -93,7 +387,7 @@ function findWorkspacePackageDir(rootDir, packageName) {
|
|
|
93
387
|
}
|
|
94
388
|
|
|
95
389
|
// src/tailwindcss/v4/config.ts
|
|
96
|
-
|
|
390
|
+
var _logger = require('@weapp-tailwindcss/logger');
|
|
97
391
|
var DEFAULT_CSS_CALC_CUSTOM_PROPERTIES = [];
|
|
98
392
|
function includesToken(list, token) {
|
|
99
393
|
return list.some((candidate) => {
|
|
@@ -161,18 +455,18 @@ function hasConfiguredCssEntries(ctx) {
|
|
|
161
455
|
if (normalizeCssEntriesConfig(ctx.cssEntries)) {
|
|
162
456
|
return true;
|
|
163
457
|
}
|
|
164
|
-
if (normalizeCssEntriesConfig(_optionalChain([ctx, 'access',
|
|
458
|
+
if (normalizeCssEntriesConfig(_optionalChain([ctx, 'access', _48 => _48.tailwindcss, 'optionalAccess', _49 => _49.v4, 'optionalAccess', _50 => _50.cssEntries]))) {
|
|
165
459
|
return true;
|
|
166
460
|
}
|
|
167
461
|
const patcherOptions = ctx.tailwindcssPatcherOptions;
|
|
168
462
|
if (patcherOptions) {
|
|
169
|
-
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access',
|
|
463
|
+
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access', _51 => _51.tailwindcss, 'optionalAccess', _52 => _52.v4, 'optionalAccess', _53 => _53.cssEntries]))) {
|
|
170
464
|
return true;
|
|
171
465
|
}
|
|
172
|
-
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access',
|
|
466
|
+
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access', _54 => _54.tailwind, 'optionalAccess', _55 => _55.v4, 'optionalAccess', _56 => _56.cssEntries]))) {
|
|
173
467
|
return true;
|
|
174
468
|
}
|
|
175
|
-
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access',
|
|
469
|
+
if (normalizeCssEntriesConfig(_optionalChain([patcherOptions, 'access', _57 => _57.patch, 'optionalAccess', _58 => _58.tailwindcss, 'optionalAccess', _59 => _59.v4, 'optionalAccess', _60 => _60.cssEntries]))) {
|
|
176
470
|
return true;
|
|
177
471
|
}
|
|
178
472
|
}
|
|
@@ -183,7 +477,7 @@ function warnMissingCssEntries(ctx, patcher) {
|
|
|
183
477
|
if (hasWarnedMissingCssEntries) {
|
|
184
478
|
return;
|
|
185
479
|
}
|
|
186
|
-
if (_optionalChain([patcher, 'optionalAccess',
|
|
480
|
+
if (_optionalChain([patcher, 'optionalAccess', _61 => _61.majorVersion]) !== 4) {
|
|
187
481
|
return;
|
|
188
482
|
}
|
|
189
483
|
if (hasConfiguredCssEntries(ctx)) {
|
|
@@ -195,8 +489,8 @@ function warnMissingCssEntries(ctx, patcher) {
|
|
|
195
489
|
);
|
|
196
490
|
}
|
|
197
491
|
function applyV4CssCalcDefaults(cssCalc, patcher) {
|
|
198
|
-
const cssCalcOptions = _nullishCoalesce(cssCalc, () => ( _optionalChain([patcher, 'optionalAccess',
|
|
199
|
-
if (_optionalChain([patcher, 'optionalAccess',
|
|
492
|
+
const cssCalcOptions = _nullishCoalesce(cssCalc, () => ( _optionalChain([patcher, 'optionalAccess', _62 => _62.majorVersion]) === 4));
|
|
493
|
+
if (_optionalChain([patcher, 'optionalAccess', _63 => _63.majorVersion]) === 4 && cssCalcOptions) {
|
|
200
494
|
return ensureDefaultsIncluded(cssCalcOptions);
|
|
201
495
|
}
|
|
202
496
|
return cssCalcOptions;
|
|
@@ -238,9 +532,9 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
238
532
|
return void 0;
|
|
239
533
|
}
|
|
240
534
|
try {
|
|
241
|
-
const req = _module.createRequire.call(void 0,
|
|
535
|
+
const req = _module.createRequire.call(void 0, _chunkCRDOWYG4js.importMetaUrl);
|
|
242
536
|
return req.resolve(specifier, { paths });
|
|
243
|
-
} catch (
|
|
537
|
+
} catch (e4) {
|
|
244
538
|
return void 0;
|
|
245
539
|
}
|
|
246
540
|
}
|
|
@@ -293,11 +587,11 @@ function createDefaultResolvePaths(basedir) {
|
|
|
293
587
|
const cwd = _process2.default.cwd();
|
|
294
588
|
appendNodeModules(paths, cwd);
|
|
295
589
|
try {
|
|
296
|
-
const modulePath = _url.fileURLToPath.call(void 0,
|
|
590
|
+
const modulePath = _url.fileURLToPath.call(void 0, _chunkCRDOWYG4js.importMetaUrl);
|
|
297
591
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
298
592
|
paths.add(candidate);
|
|
299
|
-
} catch (
|
|
300
|
-
paths.add(
|
|
593
|
+
} catch (e5) {
|
|
594
|
+
paths.add(_chunkCRDOWYG4js.importMetaUrl);
|
|
301
595
|
}
|
|
302
596
|
if (paths.size === 0) {
|
|
303
597
|
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
@@ -320,159 +614,6 @@ function createDefaultResolvePaths(basedir) {
|
|
|
320
614
|
|
|
321
615
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
322
616
|
var _tailwindcsspatch = require('tailwindcss-patch');
|
|
323
|
-
|
|
324
|
-
// src/tailwindcss/patcher-options.ts
|
|
325
|
-
function normalizeExtendLengthUnits(value) {
|
|
326
|
-
if (value === false) {
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
if (value === true) {
|
|
330
|
-
return { enabled: true };
|
|
331
|
-
}
|
|
332
|
-
if (value && typeof value === "object") {
|
|
333
|
-
return {
|
|
334
|
-
enabled: true,
|
|
335
|
-
...value
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
return void 0;
|
|
339
|
-
}
|
|
340
|
-
function normalizeTailwindcssPatcherOptions(options) {
|
|
341
|
-
if (!options) {
|
|
342
|
-
return void 0;
|
|
343
|
-
}
|
|
344
|
-
if ("patch" in options) {
|
|
345
|
-
const { cache, patch } = options;
|
|
346
|
-
const normalized = {};
|
|
347
|
-
if (cache !== void 0) {
|
|
348
|
-
normalized.cache = cache;
|
|
349
|
-
}
|
|
350
|
-
const apply = {};
|
|
351
|
-
const extract = {};
|
|
352
|
-
if (_optionalChain([patch, 'optionalAccess', _20 => _20.overwrite]) !== void 0) {
|
|
353
|
-
apply.overwrite = patch.overwrite;
|
|
354
|
-
}
|
|
355
|
-
if (_optionalChain([patch, 'optionalAccess', _21 => _21.filter])) {
|
|
356
|
-
normalized.filter = patch.filter;
|
|
357
|
-
}
|
|
358
|
-
const extendLengthUnits = normalizeExtendLengthUnits(_optionalChain([patch, 'optionalAccess', _22 => _22.applyPatches, 'optionalAccess', _23 => _23.extendLengthUnits]));
|
|
359
|
-
const exposeContext = _optionalChain([patch, 'optionalAccess', _24 => _24.applyPatches, 'optionalAccess', _25 => _25.exportContext]);
|
|
360
|
-
if (extendLengthUnits !== void 0 || exposeContext !== void 0) {
|
|
361
|
-
apply.exposeContext = exposeContext;
|
|
362
|
-
apply.extendLengthUnits = extendLengthUnits;
|
|
363
|
-
}
|
|
364
|
-
const cwd = _nullishCoalesce(_optionalChain([patch, 'optionalAccess', _26 => _26.cwd]), () => ( _optionalChain([patch, 'optionalAccess', _27 => _27.basedir])));
|
|
365
|
-
if (cwd) {
|
|
366
|
-
normalized.projectRoot = cwd;
|
|
367
|
-
}
|
|
368
|
-
const tailwindOptions = _optionalChain([patch, 'optionalAccess', _28 => _28.tailwindcss]) ? { ...patch.tailwindcss } : void 0;
|
|
369
|
-
const legacyResolve = _optionalChain([patch, 'optionalAccess', _29 => _29.resolve]);
|
|
370
|
-
let nextTailwindOptions = tailwindOptions;
|
|
371
|
-
if (_optionalChain([nextTailwindOptions, 'optionalAccess', _30 => _30.version]) === 2 && !nextTailwindOptions.packageName) {
|
|
372
|
-
nextTailwindOptions = {
|
|
373
|
-
...nextTailwindOptions,
|
|
374
|
-
packageName: "@tailwindcss/postcss7-compat",
|
|
375
|
-
postcssPlugin: nextTailwindOptions.postcssPlugin
|
|
376
|
-
};
|
|
377
|
-
if (!nextTailwindOptions.postcssPlugin) {
|
|
378
|
-
nextTailwindOptions.postcssPlugin = "@tailwindcss/postcss7-compat";
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
if (nextTailwindOptions || legacyResolve) {
|
|
382
|
-
const resolveOptions = _optionalChain([nextTailwindOptions, 'optionalAccess', _31 => _31.resolve]);
|
|
383
|
-
const mergedResolve = legacyResolve || resolveOptions ? {
|
|
384
|
-
..._nullishCoalesce(resolveOptions, () => ( {})),
|
|
385
|
-
..._nullishCoalesce(legacyResolve, () => ( {}))
|
|
386
|
-
} : void 0;
|
|
387
|
-
normalized.tailwindcss = {
|
|
388
|
-
..._nullishCoalesce(nextTailwindOptions, () => ( {})),
|
|
389
|
-
...mergedResolve ? { resolve: mergedResolve } : {}
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
if (_optionalChain([patch, 'optionalAccess', _32 => _32.output])) {
|
|
393
|
-
if (patch.output.filename !== void 0) {
|
|
394
|
-
extract.file = patch.output.filename;
|
|
395
|
-
}
|
|
396
|
-
if (patch.output.loose !== void 0) {
|
|
397
|
-
extract.pretty = patch.output.loose ? 2 : false;
|
|
398
|
-
}
|
|
399
|
-
if (patch.output.removeUniversalSelector !== void 0) {
|
|
400
|
-
extract.removeUniversalSelector = patch.output.removeUniversalSelector;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
if (Object.keys(apply).length > 0) {
|
|
404
|
-
normalized.apply = apply;
|
|
405
|
-
}
|
|
406
|
-
if (Object.keys(extract).length > 0) {
|
|
407
|
-
normalized.extract = extract;
|
|
408
|
-
}
|
|
409
|
-
return toModernTailwindcssPatchOptions(normalized);
|
|
410
|
-
}
|
|
411
|
-
return toModernTailwindcssPatchOptions(options);
|
|
412
|
-
}
|
|
413
|
-
function toModernTailwindcssPatchOptions(options) {
|
|
414
|
-
if (!options) {
|
|
415
|
-
return void 0;
|
|
416
|
-
}
|
|
417
|
-
const normalized = {};
|
|
418
|
-
if (options.cache !== void 0) {
|
|
419
|
-
normalized.cache = options.cache;
|
|
420
|
-
}
|
|
421
|
-
if (options.filter) {
|
|
422
|
-
normalized.filter = options.filter;
|
|
423
|
-
}
|
|
424
|
-
const projectRoot = _nullishCoalesce(options.projectRoot, () => ( options.cwd));
|
|
425
|
-
if (projectRoot) {
|
|
426
|
-
normalized.projectRoot = projectRoot;
|
|
427
|
-
}
|
|
428
|
-
const tailwindcss = _nullishCoalesce(options.tailwindcss, () => ( options.tailwind));
|
|
429
|
-
if (tailwindcss) {
|
|
430
|
-
normalized.tailwindcss = {
|
|
431
|
-
...tailwindcss
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
const apply = {
|
|
435
|
-
..._nullishCoalesce(options.apply, () => ( {}))
|
|
436
|
-
};
|
|
437
|
-
if (apply.overwrite === void 0 && options.overwrite !== void 0) {
|
|
438
|
-
apply.overwrite = options.overwrite;
|
|
439
|
-
}
|
|
440
|
-
if (apply.exposeContext === void 0 && _optionalChain([options, 'access', _33 => _33.features, 'optionalAccess', _34 => _34.exposeContext]) !== void 0) {
|
|
441
|
-
apply.exposeContext = options.features.exposeContext;
|
|
442
|
-
}
|
|
443
|
-
if (apply.extendLengthUnits === void 0 && _optionalChain([options, 'access', _35 => _35.features, 'optionalAccess', _36 => _36.extendLengthUnits]) !== void 0) {
|
|
444
|
-
apply.extendLengthUnits = options.features.extendLengthUnits;
|
|
445
|
-
}
|
|
446
|
-
if (Object.keys(apply).length > 0) {
|
|
447
|
-
normalized.apply = apply;
|
|
448
|
-
}
|
|
449
|
-
const extract = {
|
|
450
|
-
..._nullishCoalesce(options.extract, () => ( {}))
|
|
451
|
-
};
|
|
452
|
-
if (options.output) {
|
|
453
|
-
if (extract.write === void 0 && options.output.enabled !== void 0) {
|
|
454
|
-
extract.write = options.output.enabled;
|
|
455
|
-
}
|
|
456
|
-
if (extract.file === void 0 && options.output.file !== void 0) {
|
|
457
|
-
extract.file = options.output.file;
|
|
458
|
-
}
|
|
459
|
-
if (extract.format === void 0 && options.output.format !== void 0) {
|
|
460
|
-
extract.format = options.output.format;
|
|
461
|
-
}
|
|
462
|
-
if (extract.pretty === void 0 && options.output.pretty !== void 0) {
|
|
463
|
-
extract.pretty = options.output.pretty;
|
|
464
|
-
}
|
|
465
|
-
if (extract.removeUniversalSelector === void 0 && options.output.removeUniversalSelector !== void 0) {
|
|
466
|
-
extract.removeUniversalSelector = options.output.removeUniversalSelector;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
if (Object.keys(extract).length > 0) {
|
|
470
|
-
normalized.extract = extract;
|
|
471
|
-
}
|
|
472
|
-
return normalized;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// src/tailwindcss/patcher.ts
|
|
476
617
|
function createFallbackTailwindcssPatcher() {
|
|
477
618
|
const packageInfo = {
|
|
478
619
|
name: "tailwindcss",
|
|
@@ -512,6 +653,9 @@ function createFallbackTailwindcssPatcher() {
|
|
|
512
653
|
var hasLoggedMissingTailwind = false;
|
|
513
654
|
var TAILWINDCSS_NOT_FOUND_RE = /tailwindcss not found/i;
|
|
514
655
|
var UNABLE_TO_LOCATE_TAILWINDCSS_RE = /unable to locate tailwind css package/i;
|
|
656
|
+
function isTailwindcssV4PackageName(packageName) {
|
|
657
|
+
return packageName === "@tailwindcss/postcss" || packageName === "tailwindcss4" || Boolean(packageName && packageName.includes("tailwindcss4"));
|
|
658
|
+
}
|
|
515
659
|
function createTailwindcssPatcher(options) {
|
|
516
660
|
const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
|
|
517
661
|
const cache = {
|
|
@@ -556,7 +700,7 @@ function createTailwindcssPatcher(options) {
|
|
|
556
700
|
baseTailwindOptions.packageName = "tailwindcss";
|
|
557
701
|
}
|
|
558
702
|
if (!baseTailwindOptions.postcssPlugin) {
|
|
559
|
-
baseTailwindOptions.postcssPlugin = baseTailwindOptions.version === 4 ? "@tailwindcss/postcss" : "tailwindcss";
|
|
703
|
+
baseTailwindOptions.postcssPlugin = baseTailwindOptions.version === 4 || isTailwindcssV4PackageName(baseTailwindOptions.packageName) ? "@tailwindcss/postcss" : "tailwindcss";
|
|
560
704
|
}
|
|
561
705
|
if (typeof baseTailwindOptions.postcssPlugin === "string") {
|
|
562
706
|
const resolvedPlugin = resolveModuleFromPaths(baseTailwindOptions.postcssPlugin, resolvePaths);
|
|
@@ -596,7 +740,7 @@ function createTailwindcssPatcher(options) {
|
|
|
596
740
|
if (typeof resolvedTailwindOptions.postcssPlugin === "string") {
|
|
597
741
|
const resolvedPlugin = resolveModuleFromPaths(
|
|
598
742
|
resolvedTailwindOptions.postcssPlugin,
|
|
599
|
-
_nullishCoalesce(_optionalChain([resolvedTailwindOptions, 'access',
|
|
743
|
+
_nullishCoalesce(_optionalChain([resolvedTailwindOptions, 'access', _64 => _64.resolve, 'optionalAccess', _65 => _65.paths]), () => ( resolvePaths))
|
|
600
744
|
);
|
|
601
745
|
if (resolvedPlugin) {
|
|
602
746
|
resolvedTailwindOptions.postcssPlugin = resolvedPlugin;
|
|
@@ -606,7 +750,7 @@ function createTailwindcssPatcher(options) {
|
|
|
606
750
|
if (resolvedTailwindOptions.cwd) {
|
|
607
751
|
searchRoots.add(resolvedTailwindOptions.cwd);
|
|
608
752
|
}
|
|
609
|
-
for (const resolvePath of _nullishCoalesce(_optionalChain([resolvedTailwindOptions, 'access',
|
|
753
|
+
for (const resolvePath of _nullishCoalesce(_optionalChain([resolvedTailwindOptions, 'access', _66 => _66.resolve, 'optionalAccess', _67 => _67.paths]), () => ( []))) {
|
|
610
754
|
const parentDir = _path2.default.dirname(resolvePath);
|
|
611
755
|
searchRoots.add(parentDir);
|
|
612
756
|
}
|
|
@@ -632,7 +776,7 @@ function createTailwindcssPatcher(options) {
|
|
|
632
776
|
try {
|
|
633
777
|
return new (0, _tailwindcsspatch.TailwindcssPatcher)(resolvedOptions);
|
|
634
778
|
} catch (error) {
|
|
635
|
-
const searchPaths = _optionalChain([resolvedOptions, 'access',
|
|
779
|
+
const searchPaths = _optionalChain([resolvedOptions, 'access', _68 => _68.tailwindcss, 'optionalAccess', _69 => _69.resolve, 'optionalAccess', _70 => _70.paths]);
|
|
636
780
|
if (error instanceof Error && TAILWINDCSS_NOT_FOUND_RE.test(error.message)) {
|
|
637
781
|
if (!hasLoggedMissingTailwind) {
|
|
638
782
|
_logger.logger.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
|
|
@@ -641,7 +785,7 @@ function createTailwindcssPatcher(options) {
|
|
|
641
785
|
return createFallbackTailwindcssPatcher();
|
|
642
786
|
}
|
|
643
787
|
if (error instanceof Error && UNABLE_TO_LOCATE_TAILWINDCSS_RE.test(error.message)) {
|
|
644
|
-
_logger.logger.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', _optionalChain([resolvedOptions, 'access',
|
|
788
|
+
_logger.logger.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', _optionalChain([resolvedOptions, 'access', _71 => _71.tailwindcss, 'optionalAccess', _72 => _72.packageName]), searchPaths);
|
|
645
789
|
}
|
|
646
790
|
throw error;
|
|
647
791
|
}
|
|
@@ -655,18 +799,18 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
655
799
|
const [first] = patchers;
|
|
656
800
|
const multiPatcher = {
|
|
657
801
|
...first,
|
|
658
|
-
packageInfo: _optionalChain([first, 'optionalAccess',
|
|
659
|
-
majorVersion: _optionalChain([first, 'optionalAccess',
|
|
660
|
-
options: _optionalChain([first, 'optionalAccess',
|
|
802
|
+
packageInfo: _optionalChain([first, 'optionalAccess', _73 => _73.packageInfo]),
|
|
803
|
+
majorVersion: _optionalChain([first, 'optionalAccess', _74 => _74.majorVersion]),
|
|
804
|
+
options: _optionalChain([first, 'optionalAccess', _75 => _75.options]),
|
|
661
805
|
async patch() {
|
|
662
806
|
let exposeContext;
|
|
663
807
|
let extendLengthUnits;
|
|
664
808
|
for (const patcher of patchers) {
|
|
665
809
|
const result = await patcher.patch();
|
|
666
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
810
|
+
if (_optionalChain([result, 'optionalAccess', _76 => _76.exposeContext]) && exposeContext == null) {
|
|
667
811
|
exposeContext = result.exposeContext;
|
|
668
812
|
}
|
|
669
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
813
|
+
if (_optionalChain([result, 'optionalAccess', _77 => _77.extendLengthUnits]) && extendLengthUnits == null) {
|
|
670
814
|
extendLengthUnits = result.extendLengthUnits;
|
|
671
815
|
}
|
|
672
816
|
}
|
|
@@ -722,7 +866,7 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
722
866
|
multiPatcher.getClassSetSync = () => {
|
|
723
867
|
const aggregated = /* @__PURE__ */ new Set();
|
|
724
868
|
for (const patcher of patchers) {
|
|
725
|
-
const current = _optionalChain([patcher, 'access',
|
|
869
|
+
const current = _optionalChain([patcher, 'access', _78 => _78.getClassSetSync, 'optionalCall', _79 => _79()]);
|
|
726
870
|
if (!current) {
|
|
727
871
|
continue;
|
|
728
872
|
}
|
|
@@ -733,6 +877,10 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
733
877
|
return aggregated;
|
|
734
878
|
};
|
|
735
879
|
}
|
|
880
|
+
Object.defineProperty(multiPatcher, runtimeSignaturePatchersSymbol, {
|
|
881
|
+
value: [...patchers],
|
|
882
|
+
configurable: true
|
|
883
|
+
});
|
|
736
884
|
return multiPatcher;
|
|
737
885
|
}
|
|
738
886
|
|
|
@@ -794,8 +942,8 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
|
|
|
794
942
|
...modernTailwind,
|
|
795
943
|
v4: {
|
|
796
944
|
..._nullishCoalesce(modernTailwind.v4, () => ( {})),
|
|
797
|
-
...hasCssEntries ? {} : { base: _nullishCoalesce(_optionalChain([modernTailwind, 'access',
|
|
798
|
-
cssEntries: hasCssEntries ? cssEntries : _nullishCoalesce(_optionalChain([modernTailwind, 'access',
|
|
945
|
+
...hasCssEntries ? {} : { base: _nullishCoalesce(_optionalChain([modernTailwind, 'access', _80 => _80.v4, 'optionalAccess', _81 => _81.base]), () => ( baseDir)) },
|
|
946
|
+
cssEntries: hasCssEntries ? cssEntries : _nullishCoalesce(_optionalChain([modernTailwind, 'access', _82 => _82.v4, 'optionalAccess', _83 => _83.cssEntries]), () => ( cssEntries))
|
|
799
947
|
}
|
|
800
948
|
}
|
|
801
949
|
};
|
|
@@ -883,13 +1031,26 @@ function groupCssEntriesByBase(entries, options = {}) {
|
|
|
883
1031
|
}
|
|
884
1032
|
|
|
885
1033
|
// src/tailwindcss/v4/patcher.ts
|
|
1034
|
+
var CONFIGURED_TAILWIND_VERSION_RE = /Configured tailwindcss\.version=\d+/u;
|
|
1035
|
+
var RESOLVED_TAILWIND_VERSION_RE = /resolved package ".+" is version /u;
|
|
1036
|
+
function isTailwindcss4Package(packageName) {
|
|
1037
|
+
return Boolean(
|
|
1038
|
+
packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4"))
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
function hasOwnV4Signal(value) {
|
|
1042
|
+
return typeof value === "object" && value !== null && "v4" in value;
|
|
1043
|
+
}
|
|
1044
|
+
function isTailwindVersionMismatchError(error) {
|
|
1045
|
+
return error instanceof Error && CONFIGURED_TAILWIND_VERSION_RE.test(error.message) && RESOLVED_TAILWIND_VERSION_RE.test(error.message);
|
|
1046
|
+
}
|
|
886
1047
|
function createPatcherForBase(baseDir, cssEntries, options) {
|
|
887
1048
|
const {
|
|
888
1049
|
tailwindcss,
|
|
889
1050
|
tailwindcssPatcherOptions,
|
|
890
1051
|
supportCustomLengthUnitsPatch
|
|
891
1052
|
} = options;
|
|
892
|
-
const hasCssEntries = Boolean(_optionalChain([cssEntries, 'optionalAccess',
|
|
1053
|
+
const hasCssEntries = Boolean(_optionalChain([cssEntries, 'optionalAccess', _84 => _84.length]));
|
|
893
1054
|
const defaultTailwindcssConfig = {
|
|
894
1055
|
cwd: baseDir,
|
|
895
1056
|
v2: {
|
|
@@ -903,9 +1064,6 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
903
1064
|
cssEntries
|
|
904
1065
|
}
|
|
905
1066
|
};
|
|
906
|
-
if (hasCssEntries && (tailwindcss == null || tailwindcss.version == null)) {
|
|
907
|
-
defaultTailwindcssConfig.version = 4;
|
|
908
|
-
}
|
|
909
1067
|
const mergedTailwindOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
|
|
910
1068
|
_nullishCoalesce(tailwindcss, () => ( {})),
|
|
911
1069
|
defaultTailwindcssConfig
|
|
@@ -920,7 +1078,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
920
1078
|
mergedTailwindOptions.v4.base = baseDir;
|
|
921
1079
|
}
|
|
922
1080
|
if (hasCssEntries) {
|
|
923
|
-
if (_optionalChain([cssEntries, 'optionalAccess',
|
|
1081
|
+
if (_optionalChain([cssEntries, 'optionalAccess', _85 => _85.length])) {
|
|
924
1082
|
mergedTailwindOptions.v4.cssEntries = cssEntries;
|
|
925
1083
|
} else if (!mergedTailwindOptions.v4.cssEntries) {
|
|
926
1084
|
mergedTailwindOptions.v4.cssEntries = [];
|
|
@@ -934,12 +1092,10 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
934
1092
|
baseDir,
|
|
935
1093
|
_nullishCoalesce(cssEntries, () => ( []))
|
|
936
1094
|
);
|
|
937
|
-
const configuredPackageName = _optionalChain([tailwindcss, 'optionalAccess',
|
|
938
|
-
const configuredVersion = _optionalChain([tailwindcss, 'optionalAccess',
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
);
|
|
942
|
-
const isV4 = configuredVersion === 4 || mergedTailwindOptions.version === 4 || isTailwindcss4Package(_nullishCoalesce(configuredPackageName, () => ( mergedTailwindOptions.packageName)));
|
|
1095
|
+
const configuredPackageName = _optionalChain([tailwindcss, 'optionalAccess', _86 => _86.packageName]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _87 => _87.tailwindcss, 'optionalAccess', _88 => _88.packageName]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _89 => _89.tailwind, 'optionalAccess', _90 => _90.packageName]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _91 => _91.patch, 'optionalAccess', _92 => _92.tailwindcss, 'optionalAccess', _93 => _93.packageName]);
|
|
1096
|
+
const configuredVersion = _optionalChain([tailwindcss, 'optionalAccess', _94 => _94.version]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _95 => _95.tailwindcss, 'optionalAccess', _96 => _96.version]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _97 => _97.tailwind, 'optionalAccess', _98 => _98.version]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _99 => _99.patch, 'optionalAccess', _100 => _100.tailwindcss, 'optionalAccess', _101 => _101.version]) || mergedTailwindOptions.version;
|
|
1097
|
+
const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(_optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _102 => _102.tailwindcss])) || hasOwnV4Signal(_optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _103 => _103.tailwind])) || hasOwnV4Signal(_optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _104 => _104.patch, 'optionalAccess', _105 => _105.tailwindcss]));
|
|
1098
|
+
const isV4 = configuredVersion === 4 || mergedTailwindOptions.version === 4 || isTailwindcss4Package(_nullishCoalesce(configuredPackageName, () => ( mergedTailwindOptions.packageName))) || hasExplicitV4Signals;
|
|
943
1099
|
const tailwindPackageConfigured = Boolean(configuredPackageName);
|
|
944
1100
|
const shouldPatchV4PostcssPackage = isV4 && !tailwindPackageConfigured;
|
|
945
1101
|
const packageCandidates = /* @__PURE__ */ new Set();
|
|
@@ -949,18 +1105,33 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
949
1105
|
packageCandidates.add(
|
|
950
1106
|
_nullishCoalesce(_nullishCoalesce(mergedTailwindOptions.packageName, () => ( configuredPackageName)), () => ( "tailwindcss"))
|
|
951
1107
|
);
|
|
952
|
-
const patchers =
|
|
1108
|
+
const patchers = [];
|
|
1109
|
+
const packageCandidateList = [...packageCandidates];
|
|
1110
|
+
let firstVersionMismatchError;
|
|
1111
|
+
for (const packageName of packageCandidateList) {
|
|
953
1112
|
const tailwindOptionsForPackage = {
|
|
954
1113
|
...mergedTailwindOptions,
|
|
955
1114
|
packageName
|
|
956
1115
|
};
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1116
|
+
try {
|
|
1117
|
+
patchers.push(createTailwindcssPatcher({
|
|
1118
|
+
basedir: baseDir,
|
|
1119
|
+
supportCustomLengthUnitsPatch: _nullishCoalesce(supportCustomLengthUnitsPatch, () => ( true)),
|
|
1120
|
+
tailwindcss: tailwindOptionsForPackage,
|
|
1121
|
+
tailwindcssPatcherOptions: patchedOptions
|
|
1122
|
+
}));
|
|
1123
|
+
} catch (error) {
|
|
1124
|
+
if (packageCandidateList.length > 1 && isTailwindVersionMismatchError(error)) {
|
|
1125
|
+
_nullishCoalesce(firstVersionMismatchError, () => ( (firstVersionMismatchError = error)));
|
|
1126
|
+
_logger.logger.warn('skip incompatible Tailwind package candidate "%s" for v4 patcher: %s', packageName, error.message);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
throw error;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
if (patchers.length === 0 && firstVersionMismatchError) {
|
|
1133
|
+
throw firstVersionMismatchError;
|
|
1134
|
+
}
|
|
964
1135
|
return patchers.length === 1 ? patchers[0] : createMultiTailwindcssPatcher(patchers);
|
|
965
1136
|
}
|
|
966
1137
|
function tryCreateMultiTailwindcssPatcher(groups, options) {
|
|
@@ -1030,7 +1201,7 @@ function detectCallerBasedir() {
|
|
|
1030
1201
|
const lines = stack.split("\n");
|
|
1031
1202
|
for (const line of lines) {
|
|
1032
1203
|
const match = _nullishCoalesce(line.match(STACK_PAREN_RE), () => ( line.match(STACK_AT_RE)));
|
|
1033
|
-
const location = _optionalChain([match, 'optionalAccess',
|
|
1204
|
+
const location = _optionalChain([match, 'optionalAccess', _106 => _106[1]]);
|
|
1034
1205
|
if (!location) {
|
|
1035
1206
|
continue;
|
|
1036
1207
|
}
|
|
@@ -1038,7 +1209,7 @@ function detectCallerBasedir() {
|
|
|
1038
1209
|
if (filePath.startsWith("file://")) {
|
|
1039
1210
|
try {
|
|
1040
1211
|
filePath = _url.fileURLToPath.call(void 0, filePath);
|
|
1041
|
-
} catch (
|
|
1212
|
+
} catch (e6) {
|
|
1042
1213
|
continue;
|
|
1043
1214
|
}
|
|
1044
1215
|
}
|
|
@@ -1052,7 +1223,7 @@ function detectCallerBasedir() {
|
|
|
1052
1223
|
}
|
|
1053
1224
|
try {
|
|
1054
1225
|
return _path2.default.dirname(resolvedPath);
|
|
1055
|
-
} catch (
|
|
1226
|
+
} catch (e7) {
|
|
1056
1227
|
continue;
|
|
1057
1228
|
}
|
|
1058
1229
|
}
|
|
@@ -1060,8 +1231,8 @@ function detectCallerBasedir() {
|
|
|
1060
1231
|
}
|
|
1061
1232
|
function resolveTailwindcssBasedir(basedir, fallback) {
|
|
1062
1233
|
const envBasedirResult = pickEnvBasedir();
|
|
1063
|
-
const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess',
|
|
1064
|
-
const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess',
|
|
1234
|
+
const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess', _107 => _107.value]);
|
|
1235
|
+
const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess', _108 => _108.key]);
|
|
1065
1236
|
const envBasedirIsGeneric = envBasedirKey ? GENERIC_ENV_BASEDIR_KEYS.has(envBasedirKey) : false;
|
|
1066
1237
|
const packageEnvBasedir = pickPackageEnvBasedir();
|
|
1067
1238
|
const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
|
|
@@ -1111,7 +1282,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
1111
1282
|
_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
|
|
1112
1283
|
}
|
|
1113
1284
|
return _path2.default.normalize(_path2.default.dirname(packageJsonPath));
|
|
1114
|
-
} catch (
|
|
1285
|
+
} catch (e8) {
|
|
1115
1286
|
if (_process2.default.env.WEAPP_TW_DEBUG_STACK === "1") {
|
|
1116
1287
|
_logger.logger.debug("failed to resolve package json for %s", packageName);
|
|
1117
1288
|
}
|
|
@@ -1154,7 +1325,7 @@ function isRaxWorkspace(appType, baseDir) {
|
|
|
1154
1325
|
if (deps["rax-app"] || deps.rax) {
|
|
1155
1326
|
return true;
|
|
1156
1327
|
}
|
|
1157
|
-
} catch (
|
|
1328
|
+
} catch (e9) {
|
|
1158
1329
|
return false;
|
|
1159
1330
|
}
|
|
1160
1331
|
return false;
|
|
@@ -1219,12 +1390,12 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1219
1390
|
if (normalizedCssEntries) {
|
|
1220
1391
|
ctx.cssEntries = normalizedCssEntries;
|
|
1221
1392
|
}
|
|
1222
|
-
const shouldAttachBase = Boolean(ctx.tailwindcssBasedir && _optionalChain([normalizedCssEntries, 'optionalAccess',
|
|
1223
|
-
const tailwindcssWithBase = shouldAttachBase && _optionalChain([tailwindcss, 'optionalAccess',
|
|
1393
|
+
const shouldAttachBase = Boolean(ctx.tailwindcssBasedir && _optionalChain([normalizedCssEntries, 'optionalAccess', _109 => _109.length]));
|
|
1394
|
+
const tailwindcssWithBase = shouldAttachBase && _optionalChain([tailwindcss, 'optionalAccess', _110 => _110.v4]) !== null ? {
|
|
1224
1395
|
..._nullishCoalesce(tailwindcss, () => ( {})),
|
|
1225
1396
|
v4: {
|
|
1226
|
-
..._nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess',
|
|
1227
|
-
base: _nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess',
|
|
1397
|
+
..._nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _111 => _111.v4]), () => ( {})),
|
|
1398
|
+
base: _nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _112 => _112.v4, 'optionalAccess', _113 => _113.base]), () => ( resolvedTailwindcssBasedir))
|
|
1228
1399
|
}
|
|
1229
1400
|
} : tailwindcss;
|
|
1230
1401
|
const patcherOptions = {
|
|
@@ -1242,7 +1413,7 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1242
1413
|
if (multiPatcher) {
|
|
1243
1414
|
return multiPatcher;
|
|
1244
1415
|
}
|
|
1245
|
-
if (_optionalChain([groupedCssEntries, 'optionalAccess',
|
|
1416
|
+
if (_optionalChain([groupedCssEntries, 'optionalAccess', _114 => _114.size]) === 1) {
|
|
1246
1417
|
const firstGroup = groupedCssEntries.entries().next().value;
|
|
1247
1418
|
if (firstGroup) {
|
|
1248
1419
|
const [baseDir, entries] = firstGroup;
|
|
@@ -1257,6 +1428,12 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1257
1428
|
);
|
|
1258
1429
|
}
|
|
1259
1430
|
|
|
1431
|
+
// src/logger/index.ts
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1260
1437
|
|
|
1261
1438
|
|
|
1262
1439
|
|
|
@@ -1266,4 +1443,4 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1266
1443
|
|
|
1267
1444
|
|
|
1268
1445
|
|
|
1269
|
-
exports.
|
|
1446
|
+
exports.resolveTailwindcssOptions = resolveTailwindcssOptions; exports.invalidateRuntimeClassSet = invalidateRuntimeClassSet; exports.getRuntimeClassSetCacheEntry = getRuntimeClassSetCacheEntry; exports.getRuntimeClassSetSignature = getRuntimeClassSetSignature; exports.findNearestPackageRoot = findNearestPackageRoot; exports.warnMissingCssEntries = warnMissingCssEntries; exports.applyV4CssCalcDefaults = applyV4CssCalcDefaults; exports.findTailwindConfig = findTailwindConfig; exports.resolveTailwindcssBasedir = resolveTailwindcssBasedir; exports.createTailwindcssPatcherFromContext = createTailwindcssPatcherFromContext; exports.logger = _logger.logger;
|