weapp-tailwindcss 5.1.11 → 5.1.13

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.
Files changed (54) hide show
  1. package/dist/cache-options-DavPxrhC.js +16 -0
  2. package/dist/cache-options-DwBtLwQe.mjs +5 -0
  3. package/dist/cli.js +10 -6
  4. package/dist/cli.mjs +10 -6
  5. package/dist/context-DRRgW7i2.js +1311 -0
  6. package/dist/context-xSJE588m.mjs +1234 -0
  7. package/dist/core.js +1 -1
  8. package/dist/core.mjs +1 -1
  9. package/dist/css-macro.js +1 -1
  10. package/dist/css-macro.mjs +1 -1
  11. package/dist/defaults.js +119 -5
  12. package/dist/defaults.mjs +114 -1
  13. package/dist/{generator-ROzBodj6.mjs → generator-BvPcmqxU.mjs} +9 -139
  14. package/dist/{generator-Bz94KTkH.js → generator-CS10c9g1.js} +18 -154
  15. package/dist/generator.js +1 -1
  16. package/dist/generator.mjs +1 -1
  17. package/dist/{gulp-BKqMb_Ds.mjs → gulp-BEOzXrbp.mjs} +5 -4
  18. package/dist/{gulp-DfOLvYLs.js → gulp-DNZZvUMq.js} +6 -5
  19. package/dist/gulp.js +1 -1
  20. package/dist/gulp.mjs +1 -1
  21. package/dist/{hmr-timing-DOTdH18A.js → hmr-timing-DW1g3zjl.js} +17 -15
  22. package/dist/{hmr-timing-DwtYJdwb.mjs → hmr-timing-hRhRAjYV.mjs} +5 -3
  23. package/dist/index.js +4 -4
  24. package/dist/index.mjs +4 -4
  25. package/dist/object-BJSWl-E5.mjs +9 -0
  26. package/dist/object-COs_Mw6p.js +14 -0
  27. package/dist/postcss.js +1 -1
  28. package/dist/postcss.mjs +1 -1
  29. package/dist/presets.js +5 -5
  30. package/dist/presets.mjs +3 -3
  31. package/dist/rspack.js +1 -1
  32. package/dist/rspack.mjs +1 -1
  33. package/dist/{source-candidate-scan-signature-BrWuBTjY.js → source-candidate-scan-signature-CMgu5bJk.js} +6 -6
  34. package/dist/{source-candidate-scan-signature-CQ04hiox.mjs → source-candidate-scan-signature-t4XKAQ04.mjs} +3 -3
  35. package/dist/{tailwindcss-hzy_WaC9.mjs → tailwindcss-DZT_pWrd.mjs} +132 -2
  36. package/dist/{tailwindcss-Dn5DVlkI.js → tailwindcss-z9JMF-qU.js} +140 -10
  37. package/dist/{transform-DZQETx51.js → transform-COFRlmDF.js} +13 -13
  38. package/dist/{transform-BgnNYkIG.mjs → transform-D5JUgMpE.mjs} +1 -1
  39. package/dist/{utils-D3h8j7Mk.js → utils-CuKLf1Zv.js} +0 -15
  40. package/dist/{utils-DodxWHGz.mjs → utils-MVwpU07P.mjs} +1 -8
  41. package/dist/{vite-DODC15Fr.js → vite-DnkObu2L.js} +60 -45
  42. package/dist/{vite-oI2ReOic.mjs → vite-Tpgi77vE.mjs} +45 -30
  43. package/dist/vite.js +1 -1
  44. package/dist/vite.mjs +1 -1
  45. package/dist/weapp-tw-css-import-rewrite-loader.js +6 -2
  46. package/dist/{webpack-CCapGlNg.mjs → webpack-CTYm19zA.mjs} +22 -16
  47. package/dist/{webpack-XxBCIrBp.js → webpack-CzXjfvYS.js} +28 -22
  48. package/dist/webpack.js +1 -1
  49. package/dist/webpack.mjs +1 -1
  50. package/dist/{context-y2BGCok4.js → wxml-Ce10eREX.js} +37 -1286
  51. package/dist/{context-DzkSFEVL.mjs → wxml-DdGdeqaH.mjs} +13 -1235
  52. package/package.json +2 -2
  53. package/dist/defaults-9B6aMyZb.mjs +0 -118
  54. package/dist/defaults-nsf4VNMX.js +0 -154
@@ -0,0 +1,1234 @@
1
+ import { resolveMpxPlatform } from "./framework.mjs";
2
+ import { Ft as resolveValidTailwindV4Candidates$1, Mt as resolveCssMacroTailwindV4Source, O as resolveBooleanObjectOption, Pt as loadTailwindV4DesignSystem, _t as createTailwindV4Engine$1, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-BvPcmqxU.mjs";
3
+ import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-DZT_pWrd.mjs";
4
+ import { i as isMap, n as defuOverrideArray } from "./utils-MVwpU07P.mjs";
5
+ import { b as md5Hash, d as jsStringEscape, h as shouldEnableArbitraryValueFallback, l as getReplacement, m as resolveClassNameTransformWithResult, o as jsHandler, p as decodeUnicode2, t as createTemplateHandler, u as getReplacementCacheStore, y as createDebug } from "./wxml-DdGdeqaH.mjs";
6
+ import { getDefaultOptions, resolveDefaultCssPreflight } from "./defaults.mjs";
7
+ import { createRequire } from "node:module";
8
+ import path from "node:path";
9
+ import process from "node:process";
10
+ import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
11
+ import { createStyleHandler } from "@weapp-tailwindcss/postcss";
12
+ import { LRUCache } from "lru-cache";
13
+ import { rm } from "node:fs/promises";
14
+ import { Buffer } from "node:buffer";
15
+ import { logger, pc } from "@weapp-tailwindcss/logger";
16
+ import MagicString from "magic-string";
17
+ //#region src/cache/index.ts
18
+ function isProcessResult(value) {
19
+ return typeof value === "object" && value !== null && "result" in value;
20
+ }
21
+ function createCache(options) {
22
+ const disabled = options === false;
23
+ const hashMap = /* @__PURE__ */ new Map();
24
+ const instance = new LRUCache({
25
+ max: 1024,
26
+ ttl: 0,
27
+ ttlAutopurge: false
28
+ });
29
+ const cache = {
30
+ hashMap,
31
+ instance,
32
+ hasHashKey(key) {
33
+ return hashMap.has(key);
34
+ },
35
+ getHashValue(key) {
36
+ return hashMap.get(key);
37
+ },
38
+ setHashValue(key, value) {
39
+ return hashMap.set(key, value);
40
+ },
41
+ get(key) {
42
+ return instance.get(key);
43
+ },
44
+ set(key, value) {
45
+ return instance.set(key, value);
46
+ },
47
+ computeHash(message) {
48
+ return md5Hash(message);
49
+ },
50
+ calcHashValueChanged(key, hash) {
51
+ const hit = hashMap.get(key);
52
+ if (hit) hashMap.set(key, {
53
+ changed: hash !== hit.hash,
54
+ hash
55
+ });
56
+ else hashMap.set(key, {
57
+ changed: true,
58
+ hash
59
+ });
60
+ return cache;
61
+ },
62
+ pruneHashKeys(hashKeys) {
63
+ const activeHashKeys = new Set(hashKeys);
64
+ for (const key of hashMap.keys()) if (!activeHashKeys.has(key)) hashMap.delete(key);
65
+ },
66
+ prune(options) {
67
+ if (options.cacheKeys) {
68
+ const cacheKeys = new Set(options.cacheKeys);
69
+ for (const key of instance.keys()) if (!cacheKeys.has(key)) instance.delete(key);
70
+ }
71
+ if (options.hashKeys) cache.pruneHashKeys?.(options.hashKeys);
72
+ },
73
+ has(key) {
74
+ return instance.has(key);
75
+ },
76
+ async process({ key, hashKey, rawSource, hash, resolveCache, transform, onCacheHit }) {
77
+ if (disabled) {
78
+ const value = await transform();
79
+ return isProcessResult(value) ? value.result : value;
80
+ }
81
+ const cacheHashKey = hashKey ?? key;
82
+ let hasChanged = true;
83
+ if (hash != null || rawSource != null) {
84
+ const nextHash = hash ?? cache.computeHash(rawSource);
85
+ cache.calcHashValueChanged(cacheHashKey, nextHash);
86
+ hasChanged = cache.getHashValue(cacheHashKey)?.changed ?? true;
87
+ }
88
+ const readCache = resolveCache ?? (() => cache.get(key));
89
+ if (!hasChanged) {
90
+ const cached = readCache();
91
+ if (cached !== void 0) {
92
+ await onCacheHit?.(cached);
93
+ return cached;
94
+ }
95
+ }
96
+ const value = await transform();
97
+ const normalized = isProcessResult(value) ? value : { result: value };
98
+ const stored = normalized.cacheValue ?? normalized.result;
99
+ cache.set(key, stored);
100
+ return normalized.result;
101
+ }
102
+ };
103
+ return cache;
104
+ }
105
+ function initializeCache(cacheConfig) {
106
+ if (typeof cacheConfig === "boolean" || cacheConfig === void 0) return createCache(cacheConfig);
107
+ return cacheConfig;
108
+ }
109
+ //#endregion
110
+ //#region src/framework/platform.ts
111
+ const MPX_TO_UNI_PLATFORM = {
112
+ ali: "mp-alipay",
113
+ dd: "mp-dingtalk",
114
+ jd: "mp-jd",
115
+ qq: "mp-qq",
116
+ swan: "mp-baidu",
117
+ tt: "mp-toutiao",
118
+ wx: "mp-weixin"
119
+ };
120
+ function normalizeFrameworkStylePlatform(platform, appType) {
121
+ const normalized = platform?.trim().toLowerCase();
122
+ if (!normalized) return;
123
+ if (appType === "mpx") return MPX_TO_UNI_PLATFORM[normalized] ?? normalized;
124
+ return normalized;
125
+ }
126
+ //#endregion
127
+ //#region src/tailwindcss/runtime.ts
128
+ const debug = createDebug("[tailwindcss:runtime] ");
129
+ const refreshTailwindcssRuntimeSymbol = Symbol.for("weapp-tailwindcss.refreshTailwindcssRuntime");
130
+ function createTailwindRuntimeReadyPromise(tailwindRuntime) {
131
+ return Promise.resolve().then(async () => {
132
+ invalidateRuntimeClassSet(tailwindRuntime);
133
+ });
134
+ }
135
+ const runtimeClassSetStateCache = /* @__PURE__ */ new WeakMap();
136
+ function getRuntimeClassSetStateEntry(state) {
137
+ let entry = runtimeClassSetStateCache.get(state);
138
+ if (!entry) {
139
+ entry = {};
140
+ runtimeClassSetStateCache.set(state, entry);
141
+ }
142
+ return entry;
143
+ }
144
+ function getTailwindRuntime(state) {
145
+ return state.tailwindRuntime;
146
+ }
147
+ function setTailwindRuntime(state, runtime) {
148
+ state.tailwindRuntime = runtime;
149
+ }
150
+ function getRefreshTailwindRuntime(state) {
151
+ return state.refreshTailwindcssRuntime;
152
+ }
153
+ async function refreshTailwindRuntimeState(state, forceOrOptions) {
154
+ const normalizedOptions = typeof forceOrOptions === "boolean" ? { force: forceOrOptions } : forceOrOptions;
155
+ const force = normalizedOptions.force;
156
+ const clearCache = normalizedOptions.clearCache === true;
157
+ if (!force) return false;
158
+ const currentRuntime = getTailwindRuntime(state);
159
+ debug("refresh runtime state start, clearCache=%s major=%s", clearCache, currentRuntime.majorVersion ?? "unknown");
160
+ await state.readyPromise;
161
+ let refreshed = false;
162
+ const refreshTailwindRuntime = getRefreshTailwindRuntime(state);
163
+ if (typeof refreshTailwindRuntime === "function") {
164
+ const next = await refreshTailwindRuntime({ clearCache });
165
+ if (next !== getTailwindRuntime(state)) setTailwindRuntime(state, next);
166
+ refreshed = true;
167
+ }
168
+ if (refreshed) state.readyPromise = createTailwindRuntimeReadyPromise(getTailwindRuntime(state));
169
+ debug("refresh runtime state end, refreshed=%s major=%s", refreshed, getTailwindRuntime(state).majorVersion ?? "unknown");
170
+ return refreshed;
171
+ }
172
+ async function ensureRuntimeClassSet(state, options = {}) {
173
+ const forceRefresh = options.forceRefresh === true;
174
+ const forceCollect = options.forceCollect === true;
175
+ const clearCache = options.clearCache === true;
176
+ const allowEmpty = options.allowEmpty === true;
177
+ if (forceRefresh) await refreshTailwindRuntimeState(state, {
178
+ force: true,
179
+ clearCache
180
+ });
181
+ await state.readyPromise;
182
+ const entry = getRuntimeClassSetStateEntry(state);
183
+ const signature = await getRuntimeClassSetSignatureWithSources(getTailwindRuntime(state));
184
+ const signatureChanged = entry.signature !== signature;
185
+ const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
186
+ if (!shouldForceCollect) {
187
+ if (entry.value && (allowEmpty || entry.value.size > 0)) return entry.value;
188
+ if (entry.promise) return entry.promise;
189
+ }
190
+ const task = (async () => {
191
+ const collected = await collectRuntimeClassSet(getTailwindRuntime(state), {
192
+ force: shouldForceCollect,
193
+ skipRefresh: true,
194
+ clearCache
195
+ });
196
+ if (allowEmpty || collected.size > 0) return collected;
197
+ await refreshTailwindRuntimeState(state, {
198
+ force: true,
199
+ clearCache: true
200
+ });
201
+ await state.readyPromise;
202
+ return collectRuntimeClassSet(getTailwindRuntime(state), {
203
+ force: true,
204
+ skipRefresh: true,
205
+ clearCache: true
206
+ });
207
+ })();
208
+ entry.promise = task;
209
+ try {
210
+ const runtimeSet = await task;
211
+ entry.value = runtimeSet;
212
+ entry.signature = await getRuntimeClassSetSignatureWithSources(getTailwindRuntime(state));
213
+ return runtimeSet;
214
+ } finally {
215
+ if (entry.promise === task) entry.promise = void 0;
216
+ }
217
+ }
218
+ function tryGetRuntimeClassSetSync(tailwindRuntime) {
219
+ if (typeof tailwindRuntime.getClassSetSync !== "function") return;
220
+ try {
221
+ const set = tailwindRuntime.getClassSetSync();
222
+ if (set && set.size === 0) return;
223
+ return set;
224
+ } catch (error) {
225
+ debug("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
226
+ return;
227
+ }
228
+ }
229
+ async function collectTailwindV4GeneratorClassSet(tailwindRuntime) {
230
+ if (typeof tailwindRuntime.collectContentTokens !== "function") return;
231
+ try {
232
+ const source = resolveCssMacroTailwindV4Source(await resolveTailwindV4SourceFromRuntime(tailwindRuntime));
233
+ const generated = await createTailwindV4Engine$1(source).generate({
234
+ scanSources: true,
235
+ target: "web"
236
+ });
237
+ const classSet = resolveValidTailwindV4Candidates$1(await loadTailwindV4DesignSystem(source), generated.classSet, { ...source.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: source.bareArbitraryValues } });
238
+ debug("runtime class set resolved via tailwindcss v4 generator source scan, raw=%d valid=%d", generated.classSet.size, classSet.size);
239
+ return classSet;
240
+ } catch (error) {
241
+ debug("tailwindcss v4 generator source scan failed, continuing fallback chain: %O", error);
242
+ return;
243
+ }
244
+ }
245
+ async function mergeTailwindV4GeneratorClassSet(tailwindRuntime, classSet) {
246
+ const generatorClassSet = await collectTailwindV4GeneratorClassSet(tailwindRuntime).catch(() => void 0);
247
+ if (!generatorClassSet || generatorClassSet.size === 0) return classSet;
248
+ return /* @__PURE__ */ new Set([...classSet, ...generatorClassSet]);
249
+ }
250
+ async function collectRuntimeClassSet(tailwindRuntime, options = {}) {
251
+ let activeRuntime = tailwindRuntime;
252
+ if (options.force && !options.skipRefresh) {
253
+ const refresh = activeRuntime[refreshTailwindcssRuntimeSymbol];
254
+ if (typeof refresh === "function") try {
255
+ const refreshed = await refresh({ clearCache: options.clearCache === true });
256
+ if (refreshed) activeRuntime = refreshed;
257
+ } catch (error) {
258
+ debug("refreshTailwindcssRuntime failed, continuing with existing runtime: %O", error);
259
+ }
260
+ }
261
+ const entry = getRuntimeClassSetCacheEntry(activeRuntime);
262
+ const signature = await getRuntimeClassSetSignatureWithSources(activeRuntime);
263
+ if (!options.force) {
264
+ if (entry.value && entry.signature === signature) return entry.value;
265
+ if (entry.promise) return entry.promise;
266
+ } else entry.value = void 0;
267
+ const task = (async () => {
268
+ const preferExtract = options.force === true;
269
+ try {
270
+ const result = await activeRuntime.extract({ write: false });
271
+ if (result?.classSet) {
272
+ if (result.classSet.size > 0) {
273
+ const merged = await mergeTailwindV4GeneratorClassSet(activeRuntime, result.classSet);
274
+ debug("runtime class set resolved via extract() + tailwindcss v4 source scan, extract=%d merged=%d", result.classSet.size, merged.size);
275
+ return merged;
276
+ }
277
+ if (preferExtract) debug("runtime class set from extract() is empty on force collect, fallback to generator/sync/async class set");
278
+ else debug("runtime class set from extract() is empty, fallback to sync/async class set");
279
+ }
280
+ } catch (error) {
281
+ debug("extract() failed, fallback to getClassSet(): %O", error);
282
+ }
283
+ const generatorClassSet = await collectTailwindV4GeneratorClassSet(activeRuntime);
284
+ if (generatorClassSet && generatorClassSet.size > 0) return generatorClassSet;
285
+ const syncSet = tryGetRuntimeClassSetSync(activeRuntime);
286
+ if (syncSet) {
287
+ debug("runtime class set resolved via getClassSetSync(), size=%d", syncSet.size);
288
+ return syncSet;
289
+ }
290
+ try {
291
+ const fallbackSet = await Promise.resolve(activeRuntime.getClassSet());
292
+ if (fallbackSet) {
293
+ debug("runtime class set resolved via getClassSet(), size=%d", fallbackSet.size);
294
+ return fallbackSet;
295
+ }
296
+ } catch (error) {
297
+ debug("getClassSet() failed, returning empty set: %O", error);
298
+ }
299
+ return /* @__PURE__ */ new Set();
300
+ })();
301
+ entry.promise = task;
302
+ entry.signature = signature;
303
+ try {
304
+ const resolved = await task;
305
+ entry.value = resolved;
306
+ entry.promise = void 0;
307
+ entry.signature = signature;
308
+ return resolved;
309
+ } catch (error) {
310
+ entry.promise = void 0;
311
+ throw error;
312
+ }
313
+ }
314
+ //#endregion
315
+ //#region src/tailwindcss/runtime-logs.ts
316
+ const runtimeLogDedupeHolder = globalThis;
317
+ const runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
318
+ function createRuntimeLogKey(category, baseDir, rootPath, version) {
319
+ return JSON.stringify([
320
+ category,
321
+ baseDir ?? process.cwd(),
322
+ rootPath ?? "",
323
+ version ?? ""
324
+ ]);
325
+ }
326
+ function markRuntimeLog(category, baseDir, rootPath, version) {
327
+ const key = createRuntimeLogKey(category, baseDir, rootPath, version);
328
+ if (runtimeLogDedupe.has(key)) return false;
329
+ runtimeLogDedupe.add(key);
330
+ return true;
331
+ }
332
+ function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
333
+ if (!markRuntimeLog("target", baseDir, rootPath, version)) return;
334
+ const versionText = version ? ` (v${version})` : "";
335
+ logger.info("%s 使用 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
336
+ }
337
+ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
338
+ if (version) {
339
+ if (!markRuntimeLog("version", baseDir, rootPath, version)) return;
340
+ logger.success(`当前使用 ${pc.cyanBright("Tailwind CSS")} 版本为: ${pc.underline(pc.bold(pc.green(version)))}`);
341
+ return;
342
+ }
343
+ if (!markRuntimeLog("missing", baseDir, rootPath, version)) return;
344
+ logger.warn(`${pc.cyanBright("Tailwind CSS")} 未安装,已跳过版本检测与运行时初始化。`);
345
+ }
346
+ //#endregion
347
+ //#region src/tailwindcss/targets.ts
348
+ function formatRelativeToBase(targetPath, baseDir) {
349
+ const normalized = path.normalize(targetPath);
350
+ if (!baseDir) return normalized.replace(/\\/g, "/");
351
+ const relative = path.relative(baseDir, normalized);
352
+ if (!relative || relative === ".") return ".";
353
+ if (relative.startsWith("..")) return normalized.replace(/\\/g, "/");
354
+ return path.join(".", relative).replace(/\\/g, "/");
355
+ }
356
+ function logTailwindcssTarget(tailwindRuntime, baseDir) {
357
+ const packageInfo = tailwindRuntime?.packageInfo;
358
+ const label = "Weapp-tailwindcss";
359
+ if (!packageInfo?.rootPath) {
360
+ logger.warn("%s 未找到 Tailwind CSS 依赖,请检查在 %s 是否已安装 tailwindcss", label, baseDir ?? process.cwd());
361
+ return;
362
+ }
363
+ const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
364
+ const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
365
+ logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
366
+ logger.debug("%s 解析 Tailwind CSS -> %s%s", label, displayPath, version);
367
+ }
368
+ //#endregion
369
+ //#region src/unocss/index.ts
370
+ function normalizeUnocssOptions(unocss) {
371
+ return resolveBooleanObjectOption(unocss, {});
372
+ }
373
+ function resolveUnocssBareArbitraryValues(arbitraryValues, unocss) {
374
+ const baseArbitraryValues = arbitraryValues ?? {};
375
+ const options = normalizeUnocssOptions(unocss);
376
+ if (!options) return baseArbitraryValues;
377
+ if (baseArbitraryValues.bareArbitraryValues !== void 0 && baseArbitraryValues.bareArbitraryValues !== false) return baseArbitraryValues;
378
+ const bareArbitraryValues = options.bareArbitraryValues ?? true;
379
+ if (bareArbitraryValues === false) return baseArbitraryValues;
380
+ return {
381
+ ...baseArbitraryValues,
382
+ bareArbitraryValues
383
+ };
384
+ }
385
+ //#endregion
386
+ //#region src/context/compiler-context-cache.ts
387
+ const PAREN_CONTENT_RE = /\(([^)]+)\)/u;
388
+ const AT_LOCATION_RE = /at\s+(\S.*)$/u;
389
+ const TRAILING_LINE_COL_RE = /:\d+(?::\d+)?$/u;
390
+ const DEFAULT_COMPILER_CONTEXT_CACHE_MAX = 32;
391
+ const DEFAULT_COMPILER_CONTEXT_KEY_CACHE_MAX = DEFAULT_COMPILER_CONTEXT_CACHE_MAX * 2;
392
+ const globalCacheHolder = globalThis;
393
+ const compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
394
+ const compilerContextKeyCacheByOptions = /* @__PURE__ */ new WeakMap();
395
+ const compilerContextKeyCacheWithoutOptions = /* @__PURE__ */ new Map();
396
+ function resolveCompilerContextCacheMax(defaultValue) {
397
+ const raw = Number.parseInt(process.env["WEAPP_TW_COMPILER_CONTEXT_CACHE_MAX"] ?? "", 10);
398
+ if (!Number.isFinite(raw) || raw <= 0) return defaultValue;
399
+ return Math.floor(raw);
400
+ }
401
+ function touchMapValue(map, key, value) {
402
+ map.delete(key);
403
+ map.set(key, value);
404
+ }
405
+ function pruneMapToMaxSize(map, maxSize) {
406
+ while (map.size > maxSize) {
407
+ const firstKey = map.keys().next().value;
408
+ if (firstKey === void 0) break;
409
+ map.delete(firstKey);
410
+ }
411
+ }
412
+ function withCircularGuard(value, stack, factory) {
413
+ if (stack.has(value)) throw new TypeError("Cannot serialize circular structure in compiler context options");
414
+ stack.add(value);
415
+ try {
416
+ return factory();
417
+ } finally {
418
+ stack.delete(value);
419
+ }
420
+ }
421
+ function encodeTaggedValue(type, value) {
422
+ const record = { __type: type };
423
+ if (value !== void 0) record["value"] = value;
424
+ return record;
425
+ }
426
+ function hasExplicitOptionBasedir(opts) {
427
+ return typeof opts?.tailwindcssBasedir === "string" && opts.tailwindcssBasedir.length > 0;
428
+ }
429
+ function shouldProbeCallerLocation(opts) {
430
+ if (hasExplicitOptionBasedir(opts)) return false;
431
+ return !(process.env["WEAPP_TAILWINDCSS_BASEDIR"] || process.env["WEAPP_TAILWINDCSS_BASE_DIR"] || process.env["TAILWINDCSS_BASEDIR"] || process.env["TAILWINDCSS_BASE_DIR"]);
432
+ }
433
+ function detectCallerLocation() {
434
+ const stack = (/* @__PURE__ */ new Error("compiler-context-cache stack probe")).stack;
435
+ if (!stack) return;
436
+ const lines = stack.split("\n");
437
+ for (const line of lines) {
438
+ const location = (line.match(PAREN_CONTENT_RE) ?? line.match(AT_LOCATION_RE))?.[1];
439
+ if (!location) continue;
440
+ const candidatePath = location.replace(TRAILING_LINE_COL_RE, "");
441
+ if (!candidatePath || !path.isAbsolute(candidatePath)) continue;
442
+ if (candidatePath.includes(`${path.sep}weapp-tailwindcss${path.sep}src${path.sep}`) || candidatePath.includes(`${path.sep}weapp-tailwindcss${path.sep}dist${path.sep}`) || candidatePath.includes(`${path.sep}node_modules${path.sep}weapp-tailwindcss${path.sep}`)) continue;
443
+ return candidatePath;
444
+ }
445
+ }
446
+ function getRuntimeCacheScope(opts) {
447
+ if (hasExplicitOptionBasedir(opts)) return { caller: void 0 };
448
+ const runtimeScope = {
449
+ caller: void 0,
450
+ cwd: process.cwd(),
451
+ init_cwd: process.env["INIT_CWD"],
452
+ npm_config_local_prefix: process.env["npm_config_local_prefix"],
453
+ npm_package_json: process.env["npm_package_json"],
454
+ pnpm_package_name: process.env["PNPM_PACKAGE_NAME"],
455
+ pwd: process.env["PWD"],
456
+ tailwindcss_base_dir: process.env["TAILWINDCSS_BASE_DIR"],
457
+ tailwindcss_basedir: process.env["TAILWINDCSS_BASEDIR"],
458
+ uni_app_input_dir: process.env["UNI_APP_INPUT_DIR"],
459
+ uni_cli_root: process.env["UNI_CLI_ROOT"],
460
+ uni_input_dir: process.env["UNI_INPUT_DIR"],
461
+ uni_input_root: process.env["UNI_INPUT_ROOT"],
462
+ weapp_tailwindcss_base_dir: process.env["WEAPP_TAILWINDCSS_BASE_DIR"],
463
+ weapp_tailwindcss_basedir: process.env["WEAPP_TAILWINDCSS_BASEDIR"]
464
+ };
465
+ if (shouldProbeCallerLocation(opts)) runtimeScope.caller = detectCallerLocation();
466
+ return runtimeScope;
467
+ }
468
+ function serializeNormalizedValue(value) {
469
+ return JSON.stringify(value);
470
+ }
471
+ function createRuntimeCacheScopeKey(opts) {
472
+ return serializeNormalizedValue(normalizeOptionsValue(getRuntimeCacheScope(opts)));
473
+ }
474
+ function getCompilerContextKeyCacheStore(opts) {
475
+ if (!opts) return compilerContextKeyCacheWithoutOptions;
476
+ let store = compilerContextKeyCacheByOptions.get(opts);
477
+ if (!store) {
478
+ store = /* @__PURE__ */ new Map();
479
+ compilerContextKeyCacheByOptions.set(opts, store);
480
+ }
481
+ return store;
482
+ }
483
+ function createComparableNormalizedValue(rawValue, stack) {
484
+ const normalized = normalizeOptionsValue(rawValue, stack);
485
+ return {
486
+ normalized,
487
+ sortKey: serializeNormalizedValue(normalized)
488
+ };
489
+ }
490
+ function getRuntimeCacheScopeValue(opts) {
491
+ return {
492
+ options: opts ?? {},
493
+ runtime: getRuntimeCacheScope(opts)
494
+ };
495
+ }
496
+ function normalizeOptionsValue(rawValue, stack = /* @__PURE__ */ new WeakSet()) {
497
+ if (rawValue === null) return null;
498
+ if (rawValue === void 0) return encodeTaggedValue("Undefined");
499
+ const type = typeof rawValue;
500
+ if (type === "string") return rawValue;
501
+ if (type === "boolean") return rawValue;
502
+ if (type === "number") {
503
+ const numericValue = rawValue;
504
+ if (Number.isNaN(numericValue)) return encodeTaggedValue("Number", "NaN");
505
+ if (!Number.isFinite(numericValue)) return encodeTaggedValue("Number", numericValue > 0 ? "Infinity" : "-Infinity");
506
+ if (Object.is(numericValue, -0)) return encodeTaggedValue("Number", "-0");
507
+ return numericValue;
508
+ }
509
+ if (type === "bigint") return encodeTaggedValue("BigInt", rawValue.toString());
510
+ if (type === "symbol") {
511
+ const symbolValue = rawValue;
512
+ return encodeTaggedValue("Symbol", symbolValue.description ?? String(symbolValue));
513
+ }
514
+ if (type === "function") return encodeTaggedValue("Function", rawValue.toString());
515
+ if (Array.isArray(rawValue)) return withCircularGuard(rawValue, stack, () => rawValue.map((item) => normalizeOptionsValue(item, stack)));
516
+ if (rawValue instanceof Date) return encodeTaggedValue("Date", rawValue.toISOString());
517
+ if (rawValue instanceof RegExp) return {
518
+ __type: "RegExp",
519
+ source: rawValue.source,
520
+ flags: rawValue.flags
521
+ };
522
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer(rawValue)) return encodeTaggedValue("Buffer", rawValue.toString("base64"));
523
+ if (ArrayBuffer.isView(rawValue)) {
524
+ const view = rawValue;
525
+ const buffer = Buffer.from(view.buffer, view.byteOffset, view.byteLength);
526
+ return encodeTaggedValue(view.constructor?.name ?? "ArrayBufferView", buffer.toString("base64"));
527
+ }
528
+ if (rawValue instanceof ArrayBuffer) return encodeTaggedValue("ArrayBuffer", Buffer.from(rawValue).toString("base64"));
529
+ if (rawValue instanceof Set) return withCircularGuard(rawValue, stack, () => {
530
+ const normalizedEntries = Array.from(rawValue, (element) => createComparableNormalizedValue(element, stack));
531
+ normalizedEntries.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
532
+ return {
533
+ __type: "Set",
534
+ value: normalizedEntries.map((entry) => entry.normalized)
535
+ };
536
+ });
537
+ if (rawValue instanceof Map) return withCircularGuard(rawValue, stack, () => {
538
+ const normalizedEntries = Array.from(rawValue.entries(), ([key, entryValue]) => {
539
+ const normalizedKey = createComparableNormalizedValue(key, stack);
540
+ return {
541
+ key: normalizedKey.normalized,
542
+ sortKey: normalizedKey.sortKey,
543
+ value: normalizeOptionsValue(entryValue, stack)
544
+ };
545
+ });
546
+ normalizedEntries.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
547
+ return {
548
+ __type: "Map",
549
+ value: normalizedEntries.map((entry) => [entry.key, entry.value])
550
+ };
551
+ });
552
+ if (typeof URL !== "undefined" && rawValue instanceof URL) return encodeTaggedValue("URL", rawValue.toString());
553
+ if (rawValue instanceof Error) {
554
+ const errorValue = rawValue;
555
+ return {
556
+ __type: "Error",
557
+ name: errorValue.name,
558
+ message: errorValue.message,
559
+ stack: errorValue.stack ?? ""
560
+ };
561
+ }
562
+ if (rawValue instanceof Promise) return encodeTaggedValue("Promise");
563
+ if (rawValue instanceof WeakMap) return encodeTaggedValue("WeakMap");
564
+ if (rawValue instanceof WeakSet) return encodeTaggedValue("WeakSet");
565
+ if (rawValue && typeof rawValue === "object") return withCircularGuard(rawValue, stack, () => {
566
+ const result = {};
567
+ const entries = Object.entries(rawValue);
568
+ entries.sort(([a], [b]) => a.localeCompare(b));
569
+ for (const [key, entryValue] of entries) result[key] = normalizeOptionsValue(entryValue, stack);
570
+ return result;
571
+ });
572
+ return encodeTaggedValue(typeof rawValue, String(rawValue));
573
+ }
574
+ function createCompilerContextCacheKey(opts) {
575
+ try {
576
+ const runtimeCacheScopeKey = createRuntimeCacheScopeKey(opts);
577
+ const keyStore = getCompilerContextKeyCacheStore(opts);
578
+ const cached = keyStore.get(runtimeCacheScopeKey);
579
+ if (cached !== void 0) return cached;
580
+ const cacheKey = md5Hash(serializeNormalizedValue(normalizeOptionsValue(getRuntimeCacheScopeValue(opts))));
581
+ touchMapValue(keyStore, runtimeCacheScopeKey, cacheKey);
582
+ pruneMapToMaxSize(keyStore, resolveCompilerContextCacheMax(DEFAULT_COMPILER_CONTEXT_KEY_CACHE_MAX));
583
+ return cacheKey;
584
+ } catch (error) {
585
+ logger.debug("skip compiler context cache: %O", error);
586
+ return;
587
+ }
588
+ }
589
+ function withCompilerContextCache(opts, factory) {
590
+ const cacheKey = createCompilerContextCacheKey(opts);
591
+ if (cacheKey) {
592
+ const cached = compilerContextCache.get(cacheKey);
593
+ if (cached) {
594
+ touchMapValue(compilerContextCache, cacheKey, cached);
595
+ return cached;
596
+ }
597
+ }
598
+ const ctx = factory();
599
+ if (cacheKey) {
600
+ touchMapValue(compilerContextCache, cacheKey, ctx);
601
+ pruneMapToMaxSize(compilerContextCache, resolveCompilerContextCacheMax(DEFAULT_COMPILER_CONTEXT_CACHE_MAX));
602
+ }
603
+ return ctx;
604
+ }
605
+ //#endregion
606
+ //#region src/context/custom-attributes.ts
607
+ function toCustomAttributesEntities(customAttributes) {
608
+ if (!customAttributes) return [];
609
+ if (isMap(customAttributes)) return [...customAttributes.entries()];
610
+ return Object.entries(customAttributes);
611
+ }
612
+ //#endregion
613
+ //#region src/js/literal-transform.ts
614
+ function transformLiteralText(literal, options) {
615
+ const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
616
+ if (!options.alwaysEscape && !fallbackEnabled && (!options.classNameSet || options.classNameSet.size === 0)) return;
617
+ const source = options.unescapeUnicode && literal.includes("\\u") ? decodeUnicode2(literal) : literal;
618
+ const candidates = splitCandidateTokens(source);
619
+ if (candidates.length === 0) return;
620
+ const transformOptions = {
621
+ ...options,
622
+ classContext: true
623
+ };
624
+ const replacementCache = getReplacementCacheStore(options.escapeMap);
625
+ let transformed = source;
626
+ let mutated = false;
627
+ for (const candidate of candidates) {
628
+ const result = resolveClassNameTransformWithResult(candidate, transformOptions);
629
+ if (result.decision === "skip" || !transformed.includes(candidate)) continue;
630
+ const replacement = result.decision === "escaped" && result.escapedValue ? result.escapedValue : getReplacement(candidate, options.escapeMap, replacementCache);
631
+ const replaced = transformed.replace(candidate, replacement);
632
+ if (replaced !== transformed) {
633
+ transformed = replaced;
634
+ mutated = true;
635
+ }
636
+ }
637
+ return mutated ? transformed : void 0;
638
+ }
639
+ //#endregion
640
+ //#region src/js/fast-path/oxc.ts
641
+ const require = createRequire(import.meta.url);
642
+ let oxcParser;
643
+ let oxcWalker;
644
+ function isOxcParserRuntimeSupported(version = process.versions.node) {
645
+ const match = /^(\d+)\.(\d+)(?:\.|$)/.exec(version);
646
+ if (!match) return false;
647
+ const major = Number(match[1]);
648
+ const minor = Number(match[2]);
649
+ if (major === 20) return minor >= 19;
650
+ if (major === 21) return false;
651
+ if (major === 22) return minor >= 12;
652
+ return major > 22;
653
+ }
654
+ function loadOxcParser() {
655
+ if (!isOxcParserRuntimeSupported()) return;
656
+ if (oxcParser === false) return;
657
+ if (oxcParser) return oxcParser;
658
+ try {
659
+ oxcParser = require("oxc-parser");
660
+ } catch {
661
+ oxcParser = false;
662
+ return;
663
+ }
664
+ return oxcParser;
665
+ }
666
+ function loadOxcWalker() {
667
+ if (!isOxcParserRuntimeSupported()) return;
668
+ if (oxcWalker === false) return;
669
+ if (oxcWalker) return oxcWalker;
670
+ try {
671
+ oxcWalker = require("oxc-walker");
672
+ } catch {
673
+ oxcWalker = false;
674
+ return;
675
+ }
676
+ return oxcWalker;
677
+ }
678
+ function hasValues(values) {
679
+ return Array.isArray(values) && values.length > 0;
680
+ }
681
+ function hasUnsupportedSourceMarker(rawSource) {
682
+ return rawSource.includes("eval(") || rawSource.includes("weapp-tw") && rawSource.includes("ignore");
683
+ }
684
+ function hasSupportedClassMatchSource(options) {
685
+ return options.alwaysEscape === true || Boolean(options.classNameSet && options.classNameSet.size > 0);
686
+ }
687
+ function canUseOxcJsFastPath(options) {
688
+ if (options.experimentalJsFastPath !== true && options.experimentalJsFastPath !== "oxc") return false;
689
+ return !options.generateMap && !options.wrapExpression && !options.moduleGraph && !options.moduleSpecifierReplacements && hasSupportedClassMatchSource(options) && !shouldEnableArbitraryValueFallback(options) && !hasValues(options.ignoreCallExpressionIdentifiers) && !hasValues(options.ignoreTaggedTemplateExpressionIdentifiers);
690
+ }
691
+ function getParserLang(filename) {
692
+ if (filename?.endsWith(".ts") || filename?.endsWith(".mts") || filename?.endsWith(".cts")) return "ts";
693
+ if (filename?.endsWith(".tsx")) return "tsx";
694
+ if (filename?.endsWith(".jsx")) return "jsx";
695
+ return "js";
696
+ }
697
+ function getParserSourceType(sourceType) {
698
+ return sourceType === "script" || sourceType === "module" ? sourceType : "module";
699
+ }
700
+ function isRangeValid(start, end) {
701
+ return typeof start === "number" && typeof end === "number" && start < end;
702
+ }
703
+ function getMagicString(rawSource, context) {
704
+ if (!context.ms) context.ms = new MagicString(rawSource);
705
+ return context.ms;
706
+ }
707
+ function addStringLiteralReplacement(rawSource, node, transformOptions, context) {
708
+ if (typeof node.value !== "string" || typeof node.raw !== "string" || !isRangeValid(node.start, node.end)) return false;
709
+ const transformed = transformLiteralText(node.value, transformOptions);
710
+ if (!transformed) return false;
711
+ const start = node.start + 1;
712
+ const end = node.end - 1;
713
+ if (start >= end || transformed === rawSource.slice(start, end)) return false;
714
+ getMagicString(rawSource, context).update(start, end, jsStringEscape(transformed));
715
+ return true;
716
+ }
717
+ function addTemplateElementReplacement(rawSource, node, transformOptions, context) {
718
+ const raw = node.value?.raw;
719
+ if (typeof raw !== "string" || !isRangeValid(node.start, node.end)) return false;
720
+ const transformed = transformLiteralText(raw, transformOptions);
721
+ if (!transformed || transformed === raw) return false;
722
+ const first = rawSource[node.start];
723
+ const last = rawSource[node.end - 1];
724
+ const start = node.start + (first === "`" || first === "}" ? 1 : 0);
725
+ const end = node.end - (last === "`" ? 1 : last === "{" ? 2 : 0);
726
+ if (start >= end) return false;
727
+ getMagicString(rawSource, context).update(start, end, transformed);
728
+ return true;
729
+ }
730
+ function applyReplacements(rawSource, program, walker, stringLiteralOptions, templateLiteralOptions, context) {
731
+ let changed = false;
732
+ walker.walk(program, { enter(node) {
733
+ if (node.type === "Literal") {
734
+ changed = addStringLiteralReplacement(rawSource, node, stringLiteralOptions, context) || changed;
735
+ return;
736
+ }
737
+ if (node.type === "TemplateElement") {
738
+ changed = addTemplateElementReplacement(rawSource, node, templateLiteralOptions, context) || changed;
739
+ this.skip();
740
+ }
741
+ } });
742
+ return changed;
743
+ }
744
+ function oxcJsHandler(rawSource, options) {
745
+ if (!canUseOxcJsFastPath(options)) return;
746
+ if (hasUnsupportedSourceMarker(rawSource)) return;
747
+ const parser = loadOxcParser();
748
+ const walker = loadOxcWalker();
749
+ if (!parser || !walker) return;
750
+ let result;
751
+ try {
752
+ result = parser.parseSync(options.filename ?? "weapp-tailwindcss.js", rawSource, {
753
+ sourceType: getParserSourceType(options.babelParserOptions?.sourceType),
754
+ lang: getParserLang(options.filename)
755
+ });
756
+ } catch {
757
+ return;
758
+ }
759
+ if (!result.program || Array.isArray(result.errors) && result.errors.length > 0) return;
760
+ const stringLiteralOptions = options.needEscaped === true ? options : {
761
+ ...options,
762
+ needEscaped: true
763
+ };
764
+ const templateLiteralOptions = options.needEscaped === false ? options : {
765
+ ...options,
766
+ needEscaped: false
767
+ };
768
+ const replacementContext = {};
769
+ if (!applyReplacements(rawSource, result.program, walker, stringLiteralOptions, templateLiteralOptions, replacementContext)) return { code: rawSource };
770
+ return { code: replacementContext.ms.toString() };
771
+ }
772
+ //#endregion
773
+ //#region src/js/precheck.ts
774
+ /** 用于检测源码中是否包含类名相关模式的正则表达式 */
775
+ const FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
776
+ /** 用于检测源码中是否包含 import/export/require 语句的正则表达式 */
777
+ const DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
778
+ /**
779
+ * 判断源码是否可能声明跨模块依赖。
780
+ *
781
+ * 该检查只作为性能预筛:返回 `true` 时必须保守走 AST 模块图分析;
782
+ * 返回 `false` 时源码中没有可被当前模块图消费的静态 import/export/require 形态。
783
+ */
784
+ function hasDependencyHint(rawSource) {
785
+ return DEPENDENCY_HINT_RE.test(rawSource);
786
+ }
787
+ /**
788
+ * 判断是否可以跳过 JS 转换。
789
+ * 通过正则快速检测源码内容,避免不必要的 Babel AST 解析。
790
+ *
791
+ * @param rawSource - 原始 JS 源码字符串
792
+ * @param options - 可选的 JS 处理器配置选项
793
+ * @returns 如果可以跳过转换返回 `true`,否则返回 `false`
794
+ */
795
+ function shouldSkipJsTransform(rawSource, options) {
796
+ if (process.env["WEAPP_TW_DISABLE_JS_PRECHECK"] === "1") return false;
797
+ if (!rawSource) return true;
798
+ if (options?.alwaysEscape) return false;
799
+ if (options?.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) return false;
800
+ if (options?.wrapExpression) return false;
801
+ if (hasDependencyHint(rawSource)) return false;
802
+ return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
803
+ }
804
+ //#endregion
805
+ //#region src/js/index.ts
806
+ /** 默认 LRU 缓存最大条目数 */
807
+ const RESULT_CACHE_MAX = 512;
808
+ /** 仅对短片段做内层结果缓存,避免 bundler 热路径重复 hash 大块 JS。 */
809
+ const CACHEABLE_SOURCE_MAX_LENGTH = 512;
810
+ /** 为每个 ClassNameSet 实例分配递增 ID */
811
+ const classNameSetIds = /* @__PURE__ */ new WeakMap();
812
+ let nextClassNameSetId = 0;
813
+ /**
814
+ * 获取 ClassNameSet 的唯一身份 ID。
815
+ * 每个 Set 引用分配一个递增整数,用于指纹计算。
816
+ */
817
+ function getClassNameSetId(set) {
818
+ if (!set) return "none";
819
+ const existing = classNameSetIds.get(set);
820
+ if (existing !== void 0) return String(existing);
821
+ const id = nextClassNameSetId++;
822
+ classNameSetIds.set(set, id);
823
+ return String(id);
824
+ }
825
+ /** 缓存 IJsHandlerOptions -> fingerprint 的映射 */
826
+ const fingerprintCache = /* @__PURE__ */ new WeakMap();
827
+ /**
828
+ * 计算选项指纹,包含所有影响转译结果的字段。
829
+ * 不包含 filename、moduleGraph、jsPreserveClass。
830
+ */
831
+ function getOptionsFingerprint(options) {
832
+ const cached = fingerprintCache.get(options);
833
+ if (cached) return cached;
834
+ const fingerprint = [
835
+ getClassNameSetId(options.classNameSet),
836
+ JSON.stringify(options.escapeMap ?? null),
837
+ options.needEscaped ? "1" : "0",
838
+ options.alwaysEscape ? "1" : "0",
839
+ options.unescapeUnicode ? "1" : "0",
840
+ options.generateMap ? "1" : "0",
841
+ options.uniAppX ? "1" : "0",
842
+ options.wrapExpression ? "1" : "0",
843
+ String(options.tailwindcssMajorVersion ?? ""),
844
+ String(options.jsArbitraryValueFallback ?? ""),
845
+ JSON.stringify(options.arbitraryValues ?? null),
846
+ JSON.stringify(options.ignoreCallExpressionIdentifiers ?? null),
847
+ JSON.stringify(options.ignoreTaggedTemplateExpressionIdentifiers?.map((v) => v instanceof RegExp ? v.source : v) ?? null),
848
+ JSON.stringify(options.moduleSpecifierReplacements ?? null),
849
+ String(options.experimentalJsFastPath ?? ""),
850
+ JSON.stringify(options.babelParserOptions ?? null)
851
+ ].join("|");
852
+ fingerprintCache.set(options, fingerprint);
853
+ return fingerprint;
854
+ }
855
+ function hasDefinedOverrides(options) {
856
+ if (!options) return false;
857
+ for (const key in options) if (options[key] !== void 0) return true;
858
+ return false;
859
+ }
860
+ function shouldCacheJsResult(rawSource, options) {
861
+ if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) return false;
862
+ if (options.moduleGraph || options.filename) return false;
863
+ return true;
864
+ }
865
+ function resolveFastPathOptions(rawSource, options) {
866
+ if (!options.moduleGraph) return options;
867
+ if (options.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) return options;
868
+ if (hasDependencyHint(rawSource)) return options;
869
+ const { moduleGraph: _moduleGraph, ...fastPathOptions } = options;
870
+ return fastPathOptions;
871
+ }
872
+ function createJsHandler(options) {
873
+ const defaults = {
874
+ escapeMap: options.escapeMap,
875
+ jsArbitraryValueFallback: options.jsArbitraryValueFallback,
876
+ tailwindcssMajorVersion: options.tailwindcssMajorVersion,
877
+ arbitraryValues: options.arbitraryValues,
878
+ jsPreserveClass: options.jsPreserveClass,
879
+ generateMap: options.generateMap,
880
+ needEscaped: options.needEscaped,
881
+ alwaysEscape: options.alwaysEscape,
882
+ unescapeUnicode: options.unescapeUnicode,
883
+ babelParserOptions: options.babelParserOptions,
884
+ experimentalJsFastPath: options.experimentalJsFastPath,
885
+ ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
886
+ ignoreTaggedTemplateExpressionIdentifiers: options.ignoreTaggedTemplateExpressionIdentifiers,
887
+ uniAppX: options.uniAppX,
888
+ moduleSpecifierReplacements: options.moduleSpecifierReplacements
889
+ };
890
+ /** 层1: 无 override 时,classNameSet -> resolvedOptions */
891
+ const defaultOptionsCache = /* @__PURE__ */ new WeakMap();
892
+ let resolvedOptionsWithoutClassNameSet;
893
+ /** 层2: 有 override 时,overrideOptions -> { bySet, noSet } */
894
+ const overrideOptionsCache = /* @__PURE__ */ new WeakMap();
895
+ const resultCache = new LRUCache({ max: RESULT_CACHE_MAX });
896
+ function resolveDefaultOptions(classNameSet) {
897
+ if (!classNameSet) {
898
+ if (!resolvedOptionsWithoutClassNameSet) resolvedOptionsWithoutClassNameSet = {
899
+ ...defaults,
900
+ classNameSet
901
+ };
902
+ return resolvedOptionsWithoutClassNameSet;
903
+ }
904
+ const cached = defaultOptionsCache.get(classNameSet);
905
+ if (cached) return cached;
906
+ const created = {
907
+ ...defaults,
908
+ classNameSet
909
+ };
910
+ defaultOptionsCache.set(classNameSet, created);
911
+ return created;
912
+ }
913
+ function getCachedJsResult(rawSource, resolvedOptions) {
914
+ if (!shouldCacheJsResult(rawSource, resolvedOptions)) return;
915
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${md5Hash(rawSource)}`;
916
+ return resultCache.get(key);
917
+ }
918
+ function setCachedJsResult(rawSource, resolvedOptions, result) {
919
+ if (!shouldCacheJsResult(rawSource, resolvedOptions) || result.error || result.linked) return result;
920
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${md5Hash(rawSource)}`;
921
+ resultCache.set(key, result);
922
+ return result;
923
+ }
924
+ function resolveOptions(classNameSet, overrideOptions) {
925
+ if (!hasDefinedOverrides(overrideOptions)) return resolveDefaultOptions(classNameSet);
926
+ let entry = overrideOptionsCache.get(overrideOptions);
927
+ if (!entry) {
928
+ entry = { bySet: /* @__PURE__ */ new WeakMap() };
929
+ overrideOptionsCache.set(overrideOptions, entry);
930
+ }
931
+ if (!classNameSet) {
932
+ if (entry.noSet) return entry.noSet;
933
+ const created = defuOverrideArray({
934
+ ...overrideOptions,
935
+ classNameSet
936
+ }, defaults);
937
+ entry.noSet = created;
938
+ return created;
939
+ }
940
+ const cached = entry.bySet.get(classNameSet);
941
+ if (cached) return cached;
942
+ const created = defuOverrideArray({
943
+ ...overrideOptions,
944
+ classNameSet
945
+ }, defaults);
946
+ entry.bySet.set(classNameSet, created);
947
+ return created;
948
+ }
949
+ function handler(rawSource, classNameSet, options) {
950
+ const resolvedOptions = resolveOptions(classNameSet, options);
951
+ const cached = getCachedJsResult(rawSource, resolvedOptions);
952
+ if (cached) return cached;
953
+ return setCachedJsResult(rawSource, resolvedOptions, oxcJsHandler(rawSource, resolveFastPathOptions(rawSource, resolvedOptions)) ?? jsHandler(rawSource, resolvedOptions));
954
+ }
955
+ return handler;
956
+ }
957
+ //#endregion
958
+ //#region src/constants.ts
959
+ const pluginName = "weapp-tailwindcss";
960
+ const vitePluginName = "weapp-tailwindcss:adaptor";
961
+ const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
962
+ "tailwind-merge": "@weapp-tailwindcss/merge",
963
+ "class-variance-authority": "@weapp-tailwindcss/cva",
964
+ "tailwind-variants": "@weapp-tailwindcss/variants"
965
+ };
966
+ //#endregion
967
+ //#region src/context/runtime-package-replacements.ts
968
+ function resolveRuntimePackageReplacements(option) {
969
+ const mapping = resolveBooleanObjectOption(option, DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS);
970
+ if (!mapping) return;
971
+ const normalized = {};
972
+ for (const [from, to] of Object.entries(mapping)) {
973
+ if (!from || typeof to !== "string" || to.length === 0) continue;
974
+ normalized[from] = to;
975
+ }
976
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
977
+ }
978
+ //#endregion
979
+ //#region src/context/style-options.ts
980
+ function normalizeStyleHandlerMajorVersion(majorVersion) {
981
+ return majorVersion === 4 ? 4 : void 0;
982
+ }
983
+ function resolveStyleOptionsFromContext(ctx, tailwindcssMajorVersion) {
984
+ const resolvedUniAppXOptions = resolveUniAppXOptions(ctx.uniAppX);
985
+ const branch = resolveGeneratorRuntimeBranch(normalizeWeappTailwindcssGeneratorOptions(ctx.generator, {
986
+ appType: ctx.appType,
987
+ platform: ctx.cssOptions?.platform ?? ctx.platform,
988
+ tailwindcssMajorVersion,
989
+ uniAppX: resolvedUniAppXOptions
990
+ }), {
991
+ appType: ctx.appType,
992
+ platform: ctx.cssOptions?.platform ?? ctx.platform,
993
+ tailwindcssMajorVersion,
994
+ uniAppX: resolvedUniAppXOptions
995
+ });
996
+ const hasCssOptions = ctx.cssOptions !== void 0;
997
+ const cssOptions = {
998
+ cssPreflight: ctx.cssOptions?.cssPreflight ?? ctx.cssPreflight,
999
+ cssPreflightRange: ctx.cssOptions?.cssPreflightRange ?? ctx.cssPreflightRange,
1000
+ cssChildCombinatorReplaceValue: ctx.cssOptions?.cssChildCombinatorReplaceValue ?? ctx.cssChildCombinatorReplaceValue,
1001
+ cssSelectorReplacement: ctx.cssOptions?.cssSelectorReplacement ?? ctx.cssSelectorReplacement,
1002
+ rem2rpx: ctx.cssOptions?.rem2rpx ?? ctx.rem2rpx,
1003
+ cssRemoveProperty: ctx.cssOptions?.cssRemoveProperty ?? ctx.cssRemoveProperty,
1004
+ cssRemoveHoverPseudoClass: ctx.cssOptions?.cssRemoveHoverPseudoClass ?? ctx.cssRemoveHoverPseudoClass,
1005
+ tailwindcssV4GradientFallback: ctx.cssOptions?.tailwindcssV4GradientFallback ?? ctx.tailwindcssV4GradientFallback,
1006
+ cssPresetEnv: ctx.cssOptions?.cssPresetEnv ?? ctx.cssPresetEnv,
1007
+ atRules: ctx.cssOptions?.atRules ?? ctx.atRules,
1008
+ autoprefixer: ctx.cssOptions?.autoprefixer ?? ctx.autoprefixer,
1009
+ cssCalc: ctx.cssOptions?.cssCalc ?? ctx.cssCalc,
1010
+ platform: branch.platform ?? ctx.cssOptions?.platform ?? ctx.platform,
1011
+ px2rpx: ctx.cssOptions?.px2rpx ?? ctx.px2rpx,
1012
+ unitsToPx: ctx.cssOptions?.unitsToPx ?? ctx.unitsToPx,
1013
+ unitConversion: ctx.cssOptions?.unitConversion ?? ctx.unitConversion,
1014
+ injectAdditionalCssVarScope: ctx.cssOptions?.injectAdditionalCssVarScope ?? ctx.injectAdditionalCssVarScope
1015
+ };
1016
+ return {
1017
+ appType: ctx.appType,
1018
+ postcssOptions: ctx.postcssOptions,
1019
+ cssPreflight: cssOptions.cssPreflight,
1020
+ cssPreflightRange: cssOptions.cssPreflightRange,
1021
+ cssChildCombinatorReplaceValue: cssOptions.cssChildCombinatorReplaceValue,
1022
+ cssSelectorReplacement: cssOptions.cssSelectorReplacement,
1023
+ rem2rpx: cssOptions.rem2rpx,
1024
+ ...hasCssOptions ? { cssOptions } : {},
1025
+ cssRemoveProperty: cssOptions.cssRemoveProperty,
1026
+ cssRemoveHoverPseudoClass: cssOptions.cssRemoveHoverPseudoClass,
1027
+ tailwindcssV4GradientFallback: cssOptions.tailwindcssV4GradientFallback,
1028
+ cssPresetEnv: cssOptions.cssPresetEnv,
1029
+ atRules: cssOptions.atRules,
1030
+ autoprefixer: cssOptions.autoprefixer,
1031
+ cssCalc: cssOptions.cssCalc,
1032
+ uniAppX: branch.isNativeApp,
1033
+ platform: cssOptions.platform,
1034
+ px2rpx: cssOptions.px2rpx,
1035
+ unitsToPx: cssOptions.unitsToPx,
1036
+ unitConversion: cssOptions.unitConversion
1037
+ };
1038
+ }
1039
+ //#endregion
1040
+ //#region src/context/handlers.ts
1041
+ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
1042
+ const { escapeMap, injectAdditionalCssVarScope, postcssOptions, uniAppX, arbitraryValues, jsPreserveClass, jsArbitraryValueFallback, babelParserOptions, experimentalJsFastPath, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
1043
+ const resolvedUniAppXOptions = resolveUniAppXOptions(uniAppX);
1044
+ const styleOptions = resolveStyleOptionsFromContext(ctx, tailwindcssMajorVersion);
1045
+ const resolvedInjectAdditionalCssVarScope = styleOptions.cssOptions?.injectAdditionalCssVarScope ?? injectAdditionalCssVarScope;
1046
+ const uniAppXEnabled = styleOptions.uniAppX === true;
1047
+ const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
1048
+ const styleHandler = createStyleHandler({
1049
+ ...styleOptions,
1050
+ escapeMap,
1051
+ injectAdditionalCssVarScope: resolvedInjectAdditionalCssVarScope,
1052
+ postcssOptions,
1053
+ uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
1054
+ cssCalc: cssCalcOptions,
1055
+ majorVersion: normalizeStyleHandlerMajorVersion(tailwindcssMajorVersion)
1056
+ });
1057
+ const jsHandler = createJsHandler({
1058
+ escapeMap,
1059
+ arbitraryValues,
1060
+ jsPreserveClass,
1061
+ jsArbitraryValueFallback: jsArbitraryValueFallback ?? "auto",
1062
+ tailwindcssMajorVersion,
1063
+ generateMap: true,
1064
+ babelParserOptions,
1065
+ experimentalJsFastPath,
1066
+ ignoreCallExpressionIdentifiers,
1067
+ ignoreTaggedTemplateExpressionIdentifiers,
1068
+ uniAppX: uniAppXEnabled,
1069
+ moduleSpecifierReplacements
1070
+ });
1071
+ return {
1072
+ styleHandler,
1073
+ jsHandler,
1074
+ templateHandler: createTemplateHandler({
1075
+ customAttributesEntities,
1076
+ escapeMap,
1077
+ inlineWxs,
1078
+ jsHandler,
1079
+ disabledDefaultTemplateHandler
1080
+ })
1081
+ };
1082
+ }
1083
+ //#endregion
1084
+ //#region src/context/logger.ts
1085
+ const loggerLevelMap = {
1086
+ error: 0,
1087
+ warn: 1,
1088
+ info: 3,
1089
+ silent: -999
1090
+ };
1091
+ function applyLoggerLevel(logLevel) {
1092
+ logger.level = loggerLevelMap[logLevel ?? "info"] ?? loggerLevelMap.info;
1093
+ }
1094
+ //#endregion
1095
+ //#region src/context/index.ts
1096
+ function resolveContextCssPreflight(opts, ctx, majorVersion) {
1097
+ const userCssPreflight = opts?.cssOptions?.cssPreflight ?? opts?.cssPreflight;
1098
+ const cssPreflight = resolveDefaultCssPreflight(userCssPreflight, majorVersion);
1099
+ const shouldUseUniAppXPreflight = ctx.appType === "uni-app-x" || resolveUniAppXOptions(ctx.uniAppX).enabled;
1100
+ if (cssPreflight === false || !shouldUseUniAppXPreflight) return cssPreflight;
1101
+ const userCssPreflightObject = userCssPreflight && typeof userCssPreflight === "object" ? userCssPreflight : void 0;
1102
+ return {
1103
+ ...cssPreflight,
1104
+ "border-width": userCssPreflightObject && "border-width" in userCssPreflightObject ? cssPreflight["border-width"] ?? false : "0",
1105
+ "border-style": userCssPreflightObject && "border-style" in userCssPreflightObject ? cssPreflight["border-style"] ?? false : false,
1106
+ "border": userCssPreflightObject && "border" in userCssPreflightObject ? cssPreflight["border"] ?? false : false
1107
+ };
1108
+ }
1109
+ function syncCssOptionsToLegacyFields(ctx) {
1110
+ if (!ctx.cssOptions) return;
1111
+ const cssOptions = ctx.cssOptions;
1112
+ ctx.cssPreflight = cssOptions.cssPreflight ?? ctx.cssPreflight;
1113
+ ctx.cssPreflightRange = cssOptions.cssPreflightRange ?? ctx.cssPreflightRange;
1114
+ ctx.cssChildCombinatorReplaceValue = cssOptions.cssChildCombinatorReplaceValue ?? ctx.cssChildCombinatorReplaceValue;
1115
+ ctx.cssSelectorReplacement = cssOptions.cssSelectorReplacement ?? ctx.cssSelectorReplacement;
1116
+ ctx.rem2rpx = cssOptions.rem2rpx ?? ctx.rem2rpx;
1117
+ ctx.cssRemoveProperty = cssOptions.cssRemoveProperty ?? ctx.cssRemoveProperty;
1118
+ ctx.cssRemoveHoverPseudoClass = cssOptions.cssRemoveHoverPseudoClass ?? ctx.cssRemoveHoverPseudoClass;
1119
+ ctx.tailwindcssV4GradientFallback = cssOptions.tailwindcssV4GradientFallback ?? ctx.tailwindcssV4GradientFallback;
1120
+ ctx.cssPresetEnv = cssOptions.cssPresetEnv ?? ctx.cssPresetEnv;
1121
+ ctx.atRules = cssOptions.atRules ?? ctx.atRules;
1122
+ ctx.autoprefixer = cssOptions.autoprefixer ?? ctx.autoprefixer;
1123
+ ctx.cssCalc = cssOptions.cssCalc ?? ctx.cssCalc;
1124
+ ctx.platform = cssOptions.platform ?? ctx.platform;
1125
+ ctx.px2rpx = cssOptions.px2rpx ?? ctx.px2rpx;
1126
+ ctx.unitsToPx = cssOptions.unitsToPx ?? ctx.unitsToPx;
1127
+ ctx.unitConversion = cssOptions.unitConversion ?? ctx.unitConversion;
1128
+ ctx.injectAdditionalCssVarScope = cssOptions.injectAdditionalCssVarScope ?? ctx.injectAdditionalCssVarScope;
1129
+ }
1130
+ function syncLegacyFieldsToCssOptions(ctx) {
1131
+ if (!ctx.cssOptions) return;
1132
+ ctx.cssOptions = {
1133
+ ...ctx.cssOptions ?? {},
1134
+ cssPreflight: ctx.cssPreflight,
1135
+ cssPreflightRange: ctx.cssPreflightRange,
1136
+ cssChildCombinatorReplaceValue: ctx.cssChildCombinatorReplaceValue,
1137
+ cssSelectorReplacement: ctx.cssSelectorReplacement,
1138
+ rem2rpx: ctx.rem2rpx,
1139
+ cssRemoveProperty: ctx.cssRemoveProperty,
1140
+ cssRemoveHoverPseudoClass: ctx.cssRemoveHoverPseudoClass,
1141
+ tailwindcssV4GradientFallback: ctx.tailwindcssV4GradientFallback,
1142
+ cssPresetEnv: ctx.cssPresetEnv,
1143
+ atRules: ctx.atRules,
1144
+ autoprefixer: ctx.autoprefixer,
1145
+ cssCalc: ctx.cssCalc,
1146
+ platform: ctx.platform,
1147
+ px2rpx: ctx.px2rpx,
1148
+ unitsToPx: ctx.unitsToPx,
1149
+ unitConversion: ctx.unitConversion,
1150
+ injectAdditionalCssVarScope: ctx.injectAdditionalCssVarScope
1151
+ };
1152
+ }
1153
+ function applyFrameworkPlatformDefaults(ctx) {
1154
+ if (ctx.cssOptions?.platform || ctx.platform) {
1155
+ ctx.platform = normalizeFrameworkStylePlatform(ctx.cssOptions?.platform ?? ctx.platform, ctx.appType);
1156
+ return;
1157
+ }
1158
+ if (ctx.appType === "mpx") ctx.platform = normalizeFrameworkStylePlatform(resolveMpxPlatform().normalized, ctx.appType);
1159
+ }
1160
+ async function clearTailwindcssRuntimeCache(tailwindRuntime, options) {
1161
+ if (!tailwindRuntime) return;
1162
+ const cacheOptions = tailwindRuntime.options?.cache;
1163
+ if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) return;
1164
+ if (typeof tailwindRuntime.clearCache === "function") try {
1165
+ await tailwindRuntime.clearCache({ scope: "all" });
1166
+ } catch (error) {
1167
+ logger.debug("failed to clear tailwindcss runtime cache via clearCache(): %O", error);
1168
+ }
1169
+ if (!options?.removeDirectory) return;
1170
+ const cachePaths = /* @__PURE__ */ new Map();
1171
+ const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
1172
+ const privateCachePath = tailwindRuntime?.cacheStore?.options?.path;
1173
+ if (privateCachePath) cachePaths.set(privateCachePath, false);
1174
+ if (normalizedCacheOptions?.path) cachePaths.set(normalizedCacheOptions.path, false);
1175
+ if (options?.removeDirectory && normalizedCacheOptions?.dir) cachePaths.set(normalizedCacheOptions.dir, true);
1176
+ if (!cachePaths.size) return;
1177
+ for (const [cachePath, recursive] of cachePaths.entries()) try {
1178
+ await rm(cachePath, {
1179
+ force: true,
1180
+ recursive
1181
+ });
1182
+ } catch (error) {
1183
+ const err = error;
1184
+ if (err?.code === "ENOENT") continue;
1185
+ logger.debug("failed to clear tailwindcss runtime cache: %s %O", cachePath, err);
1186
+ }
1187
+ }
1188
+ function createInternalCompilerContext(opts) {
1189
+ const ctx = defuOverrideArray(opts, getDefaultOptions(), {});
1190
+ ctx.arbitraryValues = resolveUnocssBareArbitraryValues(ctx.arbitraryValues, ctx.unocss);
1191
+ ctx.escapeMap = ctx.customReplaceDictionary;
1192
+ syncCssOptionsToLegacyFields(ctx);
1193
+ applyFrameworkPlatformDefaults(ctx);
1194
+ applyLoggerLevel(ctx.logLevel);
1195
+ const tailwindRuntime = createTailwindcssRuntimeFromContext(ctx);
1196
+ logTailwindcssTarget(tailwindRuntime, ctx.tailwindcssBasedir);
1197
+ logRuntimeTailwindcssVersion(ctx.tailwindcssBasedir, tailwindRuntime.packageInfo?.rootPath, tailwindRuntime.packageInfo?.version);
1198
+ if (opts?.__internalDeferMissingCssEntriesWarning !== true) warnMissingCssEntries(ctx, tailwindRuntime);
1199
+ ctx.cssPreflight = resolveContextCssPreflight(opts, ctx, tailwindRuntime.majorVersion);
1200
+ const cssCalcOptions = applyV4CssCalcDefaults(ctx.cssCalc, tailwindRuntime);
1201
+ ctx.cssCalc = cssCalcOptions;
1202
+ syncLegacyFieldsToCssOptions(ctx);
1203
+ const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, toCustomAttributesEntities(ctx.customAttributes), cssCalcOptions, tailwindRuntime.majorVersion);
1204
+ ctx.styleHandler = styleHandler;
1205
+ ctx.jsHandler = jsHandler;
1206
+ ctx.templateHandler = templateHandler;
1207
+ ctx.cache = initializeCache(ctx.cache);
1208
+ ctx.tailwindRuntime = tailwindRuntime;
1209
+ const refreshTailwindcssRuntime = async (options) => {
1210
+ const previousRuntime = ctx.tailwindRuntime;
1211
+ if (options?.clearCache !== false) await clearTailwindcssRuntimeCache(previousRuntime);
1212
+ invalidateRuntimeClassSet(previousRuntime);
1213
+ const nextRuntime = createTailwindcssRuntimeFromContext(ctx);
1214
+ Object.assign(previousRuntime, nextRuntime);
1215
+ ctx.tailwindRuntime = previousRuntime;
1216
+ return previousRuntime;
1217
+ };
1218
+ ctx.refreshTailwindcssRuntime = refreshTailwindcssRuntime;
1219
+ Object.defineProperty(ctx.tailwindRuntime, refreshTailwindcssRuntimeSymbol, {
1220
+ value: refreshTailwindcssRuntime,
1221
+ configurable: true
1222
+ });
1223
+ return ctx;
1224
+ }
1225
+ /**
1226
+ * 获取用户定义选项的内部表示,并初始化相关的处理程序和 Tailwind 运行时。
1227
+ * @param opts - 用户定义的选项,可选。
1228
+ * @returns 返回一个包含内部用户定义选项的对象,包括样式、JS 和模板处理程序,以及 Tailwind CSS 运行时。
1229
+ */
1230
+ function getCompilerContext(opts) {
1231
+ return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
1232
+ }
1233
+ //#endregion
1234
+ export { vitePluginName as a, collectRuntimeClassSet as c, refreshTailwindRuntimeState as d, normalizeFrameworkStylePlatform as f, pluginName as i, createTailwindRuntimeReadyPromise as l, normalizeStyleHandlerMajorVersion as n, shouldSkipJsTransform as o, resolveStyleOptionsFromContext as r, toCustomAttributesEntities as s, getCompilerContext as t, ensureRuntimeClassSet as u };