weapp-tailwindcss 4.10.1 → 4.10.3

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 (65) hide show
  1. package/dist/{chunk-IIDSY4XZ.js → chunk-6Z4GEN2Y.js} +2 -2
  2. package/dist/{chunk-7K3R5LV6.js → chunk-DEIJXHGJ.js} +252 -70
  3. package/dist/{chunk-RXM5ERRJ.mjs → chunk-E7775SFS.mjs} +212 -30
  4. package/dist/{chunk-RB7YN5XZ.js → chunk-GCRL3ZYP.js} +5 -5
  5. package/dist/{chunk-W3EZEDKD.js → chunk-L7OBNTRI.js} +8 -7
  6. package/dist/{chunk-4QCL7FBX.mjs → chunk-LICQ6EGN.mjs} +1 -1
  7. package/dist/{chunk-ESIT2XWD.mjs → chunk-PALDKVKG.mjs} +58 -5
  8. package/dist/{chunk-7ZI6WVIU.mjs → chunk-RM3SY4S4.mjs} +3 -2
  9. package/dist/{chunk-5APD2MNV.js → chunk-RYC23C3K.js} +4 -4
  10. package/dist/{chunk-HT76VHOV.mjs → chunk-TNYEOBAC.mjs} +1 -1
  11. package/dist/{chunk-GKT5AE7D.mjs → chunk-UYTCZXNE.mjs} +1 -1
  12. package/dist/{chunk-K7CTHHN2.js → chunk-W2N6G2QQ.js} +35 -34
  13. package/dist/{chunk-P65O2L27.js → chunk-WF636Q5E.js} +5 -5
  14. package/dist/{chunk-3BKE5AJQ.mjs → chunk-WXT2GI5R.mjs} +5 -4
  15. package/dist/{chunk-EE4DYM4E.js → chunk-YJSFFRNZ.js} +81 -28
  16. package/dist/{chunk-DBAAU4LK.js → chunk-YUTKX7JZ.js} +1 -1
  17. package/dist/cli.js +39 -39
  18. package/dist/cli.mjs +2 -2
  19. package/dist/core.d.mts +1 -1
  20. package/dist/core.d.ts +1 -1
  21. package/dist/core.js +24 -11
  22. package/dist/core.mjs +18 -5
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.d.mts +1 -1
  28. package/dist/defaults.d.ts +1 -1
  29. package/dist/defaults.js +1 -1
  30. package/dist/defaults.mjs +1 -1
  31. package/dist/gulp.d.mts +1 -1
  32. package/dist/gulp.d.ts +1 -1
  33. package/dist/gulp.js +6 -6
  34. package/dist/gulp.mjs +4 -4
  35. package/dist/{index-BESv5MWf.d.ts → index-t_VBjwYm.d.mts} +11 -0
  36. package/dist/{index-BESv5MWf.d.mts → index-t_VBjwYm.d.ts} +11 -0
  37. package/dist/index.d.mts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +10 -10
  40. package/dist/index.mjs +7 -7
  41. package/dist/postcss-html-transform.js +1 -1
  42. package/dist/postcss-html-transform.mjs +1 -1
  43. package/dist/presets.d.mts +1 -1
  44. package/dist/presets.d.ts +1 -1
  45. package/dist/presets.js +5 -5
  46. package/dist/presets.mjs +1 -1
  47. package/dist/reset.js +1 -1
  48. package/dist/reset.mjs +1 -1
  49. package/dist/types.d.mts +14 -2
  50. package/dist/types.d.ts +14 -2
  51. package/dist/types.js +1 -1
  52. package/dist/types.mjs +1 -1
  53. package/dist/vite.d.mts +1 -1
  54. package/dist/vite.d.ts +1 -1
  55. package/dist/vite.js +7 -7
  56. package/dist/vite.mjs +4 -4
  57. package/dist/webpack.d.mts +1 -1
  58. package/dist/webpack.d.ts +1 -1
  59. package/dist/webpack.js +8 -8
  60. package/dist/webpack.mjs +5 -5
  61. package/dist/webpack4.d.mts +1 -1
  62. package/dist/webpack4.d.ts +1 -1
  63. package/dist/webpack4.js +36 -35
  64. package/dist/webpack4.mjs +5 -4
  65. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkDBAAU4LKjs = require('./chunk-DBAAU4LK.js');
3
+ var _chunkYUTKX7JZjs = require('./chunk-YUTKX7JZ.js');
4
4
 
5
5
  // src/utils/disabled.ts
6
6
  function resolveDisabledOptions(disabled) {
@@ -19,7 +19,7 @@ function resolveDisabledOptions(disabled) {
19
19
  // src/utils/resolve-package.ts
20
20
  var _module = require('module');
21
21
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
22
- var require2 = _module.createRequire.call(void 0, _chunkDBAAU4LKjs.importMetaUrl);
22
+ var require2 = _module.createRequire.call(void 0, _chunkYUTKX7JZjs.importMetaUrl);
23
23
  function resolvePackageDir(name) {
24
24
  const pkgPath = require2.resolve(`${name}/package.json`);
25
25
  return _path2.default.dirname(pkgPath);
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
6
+ var _chunkRYC23C3Kjs = require('./chunk-RYC23C3K.js');
7
7
 
8
8
 
9
9
  var _chunk5U24PLVVjs = require('./chunk-5U24PLVV.js');
@@ -16,10 +16,10 @@ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
16
16
  var _debug2 = require('debug'); var _debug3 = _interopRequireDefault(_debug2);
17
17
  var _debug = _debug3.default.call(void 0, "weapp-tw");
18
18
  function createDebug(prefix) {
19
- function debug2(formatter, ...args) {
19
+ function debug3(formatter, ...args) {
20
20
  return _debug((_nullishCoalesce(prefix, () => ( ""))) + formatter, ...args);
21
21
  }
22
- return debug2;
22
+ return debug3;
23
23
  }
24
24
 
25
25
  // src/tailwindcss/runtime/cache.ts
@@ -285,7 +285,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
285
285
  // package.json
286
286
  var package_default = {
287
287
  name: "weapp-tailwindcss",
288
- version: "4.10.1",
288
+ version: "4.10.3",
289
289
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
290
290
  author: "ice breaker <1324318532@qq.com>",
291
291
  license: "MIT",
@@ -480,7 +480,7 @@ var package_default = {
480
480
  "@babel/parser": "~7.29.0",
481
481
  "@babel/traverse": "~7.29.0",
482
482
  "@babel/types": "~7.29.0",
483
- "@tailwindcss-mangle/config": "^6.1.1",
483
+ "@tailwindcss-mangle/config": "^6.1.3",
484
484
  "@vue/compiler-dom": "catalog:vue3",
485
485
  "@vue/compiler-sfc": "catalog:vue3",
486
486
  "@weapp-core/escape": "~7.0.0",
@@ -646,7 +646,7 @@ function formatRelativeToBase(targetPath, baseDir) {
646
646
  }
647
647
  function resolveRecordLocation(baseDir) {
648
648
  const normalizedBase = _path2.default.normalize(baseDir);
649
- const packageRoot = _nullishCoalesce(_chunk5APD2MNVjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
649
+ const packageRoot = _nullishCoalesce(_chunkRYC23C3Kjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
650
650
  const packageJsonPath = _path2.default.join(packageRoot, "package.json");
651
651
  const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
652
652
  const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
@@ -1189,22 +1189,80 @@ var _escape = require('@ast-core/escape');
1189
1189
 
1190
1190
  var _extractors = require('@weapp-tailwindcss/shared/extractors');
1191
1191
 
1192
+ // src/wxml/shared.ts
1193
+ var _escape3 = require('@weapp-core/escape');
1194
+ function replaceWxml(original, options = {
1195
+ keepEOL: false,
1196
+ escapeMap: _escape3.MappingChars2String
1197
+ }) {
1198
+ const { keepEOL, escapeMap, ignoreHead } = options;
1199
+ let res = original;
1200
+ if (!keepEOL) {
1201
+ res = res.replaceAll(/[\n\r]+/g, "");
1202
+ }
1203
+ res = _escape3.escape.call(void 0, res, {
1204
+ map: escapeMap,
1205
+ ignoreHead
1206
+ });
1207
+ return res;
1208
+ }
1209
+
1192
1210
  // src/shared/classname-transform.ts
1193
- function shouldTransformClassNameCandidate(candidate, {
1211
+ function isArbitraryValueCandidate(candidate) {
1212
+ const normalized = candidate.trim();
1213
+ if (!normalized.includes("[") || !normalized.includes("]")) {
1214
+ return false;
1215
+ }
1216
+ if (/^(?:https?:)?\/\//.test(normalized)) {
1217
+ return false;
1218
+ }
1219
+ return true;
1220
+ }
1221
+ function shouldEnableArbitraryValueFallback({
1222
+ classNameSet,
1223
+ jsArbitraryValueFallback,
1224
+ tailwindcssMajorVersion
1225
+ }) {
1226
+ if (jsArbitraryValueFallback === true) {
1227
+ return true;
1228
+ }
1229
+ if (jsArbitraryValueFallback === false) {
1230
+ return false;
1231
+ }
1232
+ return tailwindcssMajorVersion === 4 && (!classNameSet || classNameSet.size === 0);
1233
+ }
1234
+ function resolveClassNameTransformDecision(candidate, {
1194
1235
  alwaysEscape,
1195
1236
  classNameSet,
1196
- jsPreserveClass
1237
+ escapeMap,
1238
+ jsArbitraryValueFallback,
1239
+ jsPreserveClass,
1240
+ tailwindcssMajorVersion,
1241
+ classContext
1197
1242
  }) {
1198
1243
  if (alwaysEscape) {
1199
- return true;
1244
+ return "direct";
1200
1245
  }
1201
1246
  if (_optionalChain([jsPreserveClass, 'optionalCall', _33 => _33(candidate)])) {
1202
- return false;
1247
+ return "skip";
1203
1248
  }
1204
- if (!classNameSet || classNameSet.size === 0) {
1205
- return false;
1249
+ if (_optionalChain([classNameSet, 'optionalAccess', _34 => _34.has, 'call', _35 => _35(candidate)])) {
1250
+ return "direct";
1251
+ }
1252
+ if (classNameSet && classNameSet.size > 0) {
1253
+ const escapedCandidate = replaceWxml(candidate, { escapeMap });
1254
+ if (escapedCandidate !== candidate && classNameSet.has(escapedCandidate)) {
1255
+ return "escaped";
1256
+ }
1257
+ }
1258
+ if (classContext && isArbitraryValueCandidate(candidate) && shouldEnableArbitraryValueFallback({
1259
+ classNameSet,
1260
+ jsArbitraryValueFallback,
1261
+ tailwindcssMajorVersion
1262
+ })) {
1263
+ return "fallback";
1206
1264
  }
1207
- return classNameSet.has(candidate);
1265
+ return "skip";
1208
1266
  }
1209
1267
 
1210
1268
  // src/utils/decode.ts
@@ -1230,25 +1288,105 @@ function decodeUnicode2(input) {
1230
1288
  }
1231
1289
  }
1232
1290
 
1233
- // src/wxml/shared.ts
1234
- var _escape3 = require('@weapp-core/escape');
1235
- function replaceWxml(original, options = {
1236
- keepEOL: false,
1237
- escapeMap: _escape3.MappingChars2String
1238
- }) {
1239
- const { keepEOL, escapeMap, ignoreHead } = options;
1240
- let res = original;
1241
- if (!keepEOL) {
1242
- res = res.replaceAll(/[\n\r]+/g, "");
1291
+ // src/js/class-context.ts
1292
+ var CLASS_LIKE_KEYWORDS = /* @__PURE__ */ new Set([
1293
+ "class",
1294
+ "classname",
1295
+ "hoverclass",
1296
+ "virtualhostclass",
1297
+ "rootclass"
1298
+ ]);
1299
+ var CLASS_HELPER_IDENTIFIERS = /* @__PURE__ */ new Set([
1300
+ "cn",
1301
+ "clsx",
1302
+ "classnames",
1303
+ "twmerge",
1304
+ "cva",
1305
+ "tv",
1306
+ "cx",
1307
+ "r"
1308
+ ]);
1309
+ function normalizeKeyword(name) {
1310
+ return name.replace(/[-_:]/g, "").toLowerCase();
1311
+ }
1312
+ function readObjectKeyName(path5) {
1313
+ if (path5.isIdentifier()) {
1314
+ return path5.node.name;
1243
1315
  }
1244
- res = _escape3.escape.call(void 0, res, {
1245
- map: escapeMap,
1246
- ignoreHead
1247
- });
1248
- return res;
1316
+ if (path5.isStringLiteral()) {
1317
+ return path5.node.value;
1318
+ }
1319
+ if (path5.isTemplateLiteral() && path5.node.expressions.length === 0) {
1320
+ return _nullishCoalesce(_optionalChain([path5, 'access', _36 => _36.node, 'access', _37 => _37.quasis, 'access', _38 => _38[0], 'optionalAccess', _39 => _39.value, 'access', _40 => _40.cooked]), () => ( _optionalChain([path5, 'access', _41 => _41.node, 'access', _42 => _42.quasis, 'access', _43 => _43[0], 'optionalAccess', _44 => _44.value, 'access', _45 => _45.raw])));
1321
+ }
1322
+ return void 0;
1323
+ }
1324
+ function isClassLikeObjectProperty(path5, valuePath) {
1325
+ if (!path5.isObjectProperty()) {
1326
+ return false;
1327
+ }
1328
+ if (path5.get("value") !== valuePath) {
1329
+ return false;
1330
+ }
1331
+ const keyName = readObjectKeyName(path5.get("key"));
1332
+ if (!keyName) {
1333
+ return false;
1334
+ }
1335
+ return CLASS_LIKE_KEYWORDS.has(normalizeKeyword(keyName));
1336
+ }
1337
+ function isClassLikeJsxAttribute(path5) {
1338
+ if (!path5.isJSXAttribute()) {
1339
+ return false;
1340
+ }
1341
+ const namePath = path5.get("name");
1342
+ if (!namePath.isJSXIdentifier()) {
1343
+ return false;
1344
+ }
1345
+ return CLASS_LIKE_KEYWORDS.has(normalizeKeyword(namePath.node.name));
1346
+ }
1347
+ function isClassLikeCallExpression(path5, valuePath) {
1348
+ if (!path5.isCallExpression()) {
1349
+ return false;
1350
+ }
1351
+ const args = path5.get("arguments");
1352
+ if (!args.includes(valuePath)) {
1353
+ return false;
1354
+ }
1355
+ const calleePath = path5.get("callee");
1356
+ if (calleePath.isIdentifier()) {
1357
+ return CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(calleePath.node.name));
1358
+ }
1359
+ if (calleePath.isMemberExpression()) {
1360
+ const propertyPath = calleePath.get("property");
1361
+ if (propertyPath.isIdentifier()) {
1362
+ return CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(propertyPath.node.name));
1363
+ }
1364
+ if (propertyPath.isStringLiteral()) {
1365
+ return CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(propertyPath.node.value));
1366
+ }
1367
+ }
1368
+ return false;
1369
+ }
1370
+ function isClassContextLiteralPath(path5) {
1371
+ let current = path5;
1372
+ while (current.parentPath) {
1373
+ const parent = current.parentPath;
1374
+ if (isClassLikeObjectProperty(parent, current)) {
1375
+ return true;
1376
+ }
1377
+ if (isClassLikeJsxAttribute(parent)) {
1378
+ return true;
1379
+ }
1380
+ if (isClassLikeCallExpression(parent, current)) {
1381
+ return true;
1382
+ }
1383
+ current = parent;
1384
+ }
1385
+ return false;
1249
1386
  }
1250
1387
 
1251
1388
  // src/js/handlers.ts
1389
+ var debug2 = createDebug("[js:handlers] ");
1252
1390
  var patternCache = /* @__PURE__ */ new Map();
1253
1391
  var replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
1254
1392
  var defaultReplacementCache = /* @__PURE__ */ new Map();
@@ -1285,7 +1423,7 @@ function hasIgnoreComment(node) {
1285
1423
  return Array.isArray(node.leadingComments) && node.leadingComments.some((comment) => comment.value.includes("weapp-tw") && comment.value.includes("ignore"));
1286
1424
  }
1287
1425
  function extractLiteralValue(path5, { unescapeUnicode, arbitraryValues }) {
1288
- const allowDoubleQuotes = _optionalChain([arbitraryValues, 'optionalAccess', _34 => _34.allowDoubleQuotes]);
1426
+ const allowDoubleQuotes = _optionalChain([arbitraryValues, 'optionalAccess', _46 => _46.allowDoubleQuotes]);
1289
1427
  let offset = 0;
1290
1428
  let original;
1291
1429
  if (path5.isStringLiteral()) {
@@ -1313,7 +1451,9 @@ function replaceHandleValue(path5, options) {
1313
1451
  needEscaped = false
1314
1452
  } = options;
1315
1453
  const { classNameSet, alwaysEscape } = options;
1316
- if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)) {
1454
+ const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
1455
+ const classContext = options.wrapExpression || isClassContextLiteralPath(path5);
1456
+ if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) {
1317
1457
  return void 0;
1318
1458
  }
1319
1459
  const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path5, options);
@@ -1326,10 +1466,32 @@ function replaceHandleValue(path5, options) {
1326
1466
  }
1327
1467
  let transformed = literal;
1328
1468
  let mutated = false;
1469
+ let matchedCandidateCount = 0;
1470
+ let escapedDecisionCount = 0;
1471
+ let fallbackDecisionCount = 0;
1472
+ const escapedSamples = [];
1473
+ const skippedSamples = [];
1329
1474
  for (const candidate of candidates) {
1330
- if (!shouldTransformClassNameCandidate(candidate, options)) {
1475
+ const decision = resolveClassNameTransformDecision(candidate, {
1476
+ ...options,
1477
+ classContext
1478
+ });
1479
+ if (decision === "skip") {
1480
+ if (skippedSamples.length < 6) {
1481
+ skippedSamples.push(candidate);
1482
+ }
1331
1483
  continue;
1332
1484
  }
1485
+ matchedCandidateCount += 1;
1486
+ if (decision === "escaped") {
1487
+ escapedDecisionCount += 1;
1488
+ if (escapedSamples.length < 6) {
1489
+ escapedSamples.push(candidate);
1490
+ }
1491
+ }
1492
+ if (decision === "fallback") {
1493
+ fallbackDecisionCount += 1;
1494
+ }
1333
1495
  if (!transformed.includes(candidate)) {
1334
1496
  continue;
1335
1497
  }
@@ -1345,6 +1507,18 @@ function replaceHandleValue(path5, options) {
1345
1507
  if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") {
1346
1508
  return void 0;
1347
1509
  }
1510
+ debug2(
1511
+ "runtimeSet size=%d fallbackTriggered=%s candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s",
1512
+ _nullishCoalesce(_optionalChain([classNameSet, 'optionalAccess', _47 => _47.size]), () => ( 0)),
1513
+ fallbackDecisionCount > 0,
1514
+ candidates.length,
1515
+ matchedCandidateCount,
1516
+ escapedDecisionCount,
1517
+ skippedSamples.length,
1518
+ _nullishCoalesce(options.filename, () => ( "unknown")),
1519
+ escapedSamples.join(",") || "-",
1520
+ skippedSamples.join(",") || "-"
1521
+ );
1348
1522
  const start = node.start + offset;
1349
1523
  const end = node.end - offset;
1350
1524
  if (start >= end || transformed === original) {
@@ -1518,7 +1692,7 @@ function handleEvalTemplateElement(path5, options, updater, handler) {
1518
1692
  }
1519
1693
  }
1520
1694
  function walkEvalExpression(path5, options, updater, handler) {
1521
- const maybeTraverse = _optionalChain([path5, 'optionalAccess', _35 => _35.traverse]);
1695
+ const maybeTraverse = _optionalChain([path5, 'optionalAccess', _48 => _48.traverse]);
1522
1696
  if (typeof maybeTraverse === "function") {
1523
1697
  try {
1524
1698
  return maybeTraverse.call(path5, {
@@ -1530,21 +1704,21 @@ function walkEvalExpression(path5, options, updater, handler) {
1530
1704
  }
1531
1705
  });
1532
1706
  } catch (error) {
1533
- const msg = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _36 => _36.message]), () => ( ""));
1707
+ const msg = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _49 => _49.message]), () => ( ""));
1534
1708
  const scopeError = /pass a scope and parentPath|traversing a Program\/File/i.test(msg);
1535
1709
  if (!scopeError) {
1536
1710
  throw error;
1537
1711
  }
1538
1712
  }
1539
1713
  }
1540
- const getArgs = _optionalChain([path5, 'optionalAccess', _37 => _37.get, 'optionalCall', _38 => _38("arguments")]);
1714
+ const getArgs = _optionalChain([path5, 'optionalAccess', _50 => _50.get, 'optionalCall', _51 => _51("arguments")]);
1541
1715
  if (Array.isArray(getArgs)) {
1542
1716
  for (const arg of getArgs) {
1543
- if (_optionalChain([arg, 'optionalAccess', _39 => _39.isStringLiteral, 'optionalCall', _40 => _40()])) {
1717
+ if (_optionalChain([arg, 'optionalAccess', _52 => _52.isStringLiteral, 'optionalCall', _53 => _53()])) {
1544
1718
  handleEvalStringLiteral(arg, options, updater, handler);
1545
1719
  continue;
1546
1720
  }
1547
- if (_optionalChain([arg, 'optionalAccess', _41 => _41.isTemplateLiteral, 'optionalCall', _42 => _42()])) {
1721
+ if (_optionalChain([arg, 'optionalAccess', _54 => _54.isTemplateLiteral, 'optionalCall', _55 => _55()])) {
1548
1722
  for (const quasi of arg.get("quasis")) {
1549
1723
  handleEvalTemplateElement(quasi, options, updater, handler);
1550
1724
  }
@@ -1552,16 +1726,16 @@ function walkEvalExpression(path5, options, updater, handler) {
1552
1726
  }
1553
1727
  return;
1554
1728
  }
1555
- const nodeArgs = _optionalChain([path5, 'optionalAccess', _43 => _43.node, 'optionalAccess', _44 => _44.arguments]);
1729
+ const nodeArgs = _optionalChain([path5, 'optionalAccess', _56 => _56.node, 'optionalAccess', _57 => _57.arguments]);
1556
1730
  if (Array.isArray(nodeArgs)) {
1557
1731
  for (const n of nodeArgs) {
1558
- if (_optionalChain([n, 'optionalAccess', _45 => _45.type]) === "StringLiteral") {
1732
+ if (_optionalChain([n, 'optionalAccess', _58 => _58.type]) === "StringLiteral") {
1559
1733
  const stub = {
1560
1734
  node: n,
1561
1735
  isStringLiteral: () => true
1562
1736
  };
1563
1737
  handleEvalStringLiteral(stub, options, updater, handler);
1564
- } else if (_optionalChain([n, 'optionalAccess', _46 => _46.type]) === "TemplateLiteral" && Array.isArray(n.quasis)) {
1738
+ } else if (_optionalChain([n, 'optionalAccess', _59 => _59.type]) === "TemplateLiteral" && Array.isArray(n.quasis)) {
1565
1739
  for (const q of n.quasis) {
1566
1740
  const stub = {
1567
1741
  node: q,
@@ -1663,7 +1837,7 @@ var IgnoredExportsTracker = class {
1663
1837
  continue;
1664
1838
  }
1665
1839
  if (exportPath.isExportNamedDeclaration()) {
1666
- const source = _optionalChain([exportPath, 'access', _47 => _47.node, 'access', _48 => _48.source, 'optionalAccess', _49 => _49.value]);
1840
+ const source = _optionalChain([exportPath, 'access', _60 => _60.node, 'access', _61 => _61.source, 'optionalAccess', _62 => _62.value]);
1667
1841
  if (typeof source === "string") {
1668
1842
  for (const spec of exportPath.get("specifiers")) {
1669
1843
  if (!spec.isExportSpecifier()) {
@@ -1730,7 +1904,7 @@ var IgnoredExportsTracker = class {
1730
1904
  continue;
1731
1905
  }
1732
1906
  if (exportPath.isExportAllDeclaration()) {
1733
- const source = _optionalChain([exportPath, 'access', _50 => _50.node, 'access', _51 => _51.source, 'optionalAccess', _52 => _52.value]);
1907
+ const source = _optionalChain([exportPath, 'access', _63 => _63.node, 'access', _64 => _64.source, 'optionalAccess', _65 => _65.value]);
1734
1908
  if (typeof source === "string") {
1735
1909
  for (const exportName of names) {
1736
1910
  propagate.push({
@@ -1831,7 +2005,7 @@ var JsModuleGraph = class {
1831
2005
  }
1832
2006
  for (const exportPath of state.analysis.exportDeclarations) {
1833
2007
  if (exportPath.isExportAllDeclaration() || exportPath.isExportNamedDeclaration()) {
1834
- const source = _optionalChain([exportPath, 'access', _53 => _53.node, 'access', _54 => _54.source, 'optionalAccess', _55 => _55.value]);
2008
+ const source = _optionalChain([exportPath, 'access', _66 => _66.node, 'access', _67 => _67.source, 'optionalAccess', _68 => _68.value]);
1835
2009
  if (typeof source === "string" && !dependencySpecifiers.has(source)) {
1836
2010
  dependencySpecifiers.set(source, []);
1837
2011
  }
@@ -2037,14 +2211,14 @@ var NodePathWalker = class {
2037
2211
  }
2038
2212
  this.visited.add(arg);
2039
2213
  if (arg.isIdentifier()) {
2040
- const binding = _optionalChain([arg, 'optionalAccess', _56 => _56.scope, 'optionalAccess', _57 => _57.getBinding, 'optionalCall', _58 => _58(arg.node.name)]);
2214
+ const binding = _optionalChain([arg, 'optionalAccess', _69 => _69.scope, 'optionalAccess', _70 => _70.getBinding, 'optionalCall', _71 => _71(arg.node.name)]);
2041
2215
  if (binding) {
2042
2216
  this.walkNode(binding.path);
2043
2217
  }
2044
2218
  } else if (arg.isMemberExpression()) {
2045
2219
  const objectPath = arg.get("object");
2046
2220
  if (objectPath.isIdentifier()) {
2047
- const binding = _optionalChain([arg, 'optionalAccess', _59 => _59.scope, 'optionalAccess', _60 => _60.getBinding, 'optionalCall', _61 => _61(objectPath.node.name)]);
2221
+ const binding = _optionalChain([arg, 'optionalAccess', _72 => _72.scope, 'optionalAccess', _73 => _73.getBinding, 'optionalCall', _74 => _74(objectPath.node.name)]);
2048
2222
  if (binding) {
2049
2223
  if (binding.path.isVariableDeclarator()) {
2050
2224
  this.walkVariableDeclarator(binding.path);
@@ -2121,8 +2295,8 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2121
2295
  }
2122
2296
  const objectPath = path5.get("object");
2123
2297
  if (objectPath.isIdentifier()) {
2124
- const scope = _optionalChain([objectPath, 'optionalAccess', _62 => _62.scope]);
2125
- const binding = _optionalChain([scope, 'optionalAccess', _63 => _63.getBinding, 'optionalCall', _64 => _64(objectPath.node.name)]);
2298
+ const scope = _optionalChain([objectPath, 'optionalAccess', _75 => _75.scope]);
2299
+ const binding = _optionalChain([scope, 'optionalAccess', _76 => _76.getBinding, 'optionalCall', _77 => _77(objectPath.node.name)]);
2126
2300
  if (binding) {
2127
2301
  return resolvesToWeappTwIgnore(binding, seen);
2128
2302
  }
@@ -2151,7 +2325,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2151
2325
  const init = bindingPath.get("init");
2152
2326
  if (init && init.node) {
2153
2327
  if (init.isIdentifier()) {
2154
- const target = _optionalChain([binding, 'optionalAccess', _65 => _65.scope, 'optionalAccess', _66 => _66.getBinding, 'optionalCall', _67 => _67(init.node.name)]);
2328
+ const target = _optionalChain([binding, 'optionalAccess', _78 => _78.scope, 'optionalAccess', _79 => _79.getBinding, 'optionalCall', _80 => _80(init.node.name)]);
2155
2329
  if (target) {
2156
2330
  result = resolvesToWeappTwIgnore(target, seen);
2157
2331
  }
@@ -2167,7 +2341,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2167
2341
  const getEffectiveTagPath = (tagPath) => {
2168
2342
  let current = tagPath;
2169
2343
  while (true) {
2170
- if (_optionalChain([current, 'access', _68 => _68.isParenthesizedExpression, 'optionalCall', _69 => _69()]) || current.node.type === "ParenthesizedExpression") {
2344
+ if (_optionalChain([current, 'access', _81 => _81.isParenthesizedExpression, 'optionalCall', _82 => _82()]) || current.node.type === "ParenthesizedExpression") {
2171
2345
  current = current.get("expression");
2172
2346
  continue;
2173
2347
  }
@@ -2179,7 +2353,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2179
2353
  current = current.get("expression");
2180
2354
  continue;
2181
2355
  }
2182
- if (_optionalChain([current, 'access', _70 => _70.isTypeCastExpression, 'optionalCall', _71 => _71()])) {
2356
+ if (_optionalChain([current, 'access', _83 => _83.isTypeCastExpression, 'optionalCall', _84 => _84()])) {
2183
2357
  current = current.get("expression");
2184
2358
  continue;
2185
2359
  }
@@ -2191,7 +2365,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2191
2365
  continue;
2192
2366
  }
2193
2367
  }
2194
- if (_optionalChain([current, 'access', _72 => _72.isCallExpression, 'optionalCall', _73 => _73()]) || current.node.type === "CallExpression") {
2368
+ if (_optionalChain([current, 'access', _85 => _85.isCallExpression, 'optionalCall', _86 => _86()]) || current.node.type === "CallExpression") {
2195
2369
  const callee = current.get("callee");
2196
2370
  current = callee;
2197
2371
  continue;
@@ -2201,7 +2375,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2201
2375
  return current;
2202
2376
  };
2203
2377
  const evaluateTagPath = (tagPath) => {
2204
- if (_optionalChain([tagPath, 'access', _74 => _74.isCallExpression, 'optionalCall', _75 => _75()]) || tagPath.node.type === "CallExpression") {
2378
+ if (_optionalChain([tagPath, 'access', _87 => _87.isCallExpression, 'optionalCall', _88 => _88()]) || tagPath.node.type === "CallExpression") {
2205
2379
  const calleePath = tagPath.get("callee");
2206
2380
  return evaluateTagPath(calleePath);
2207
2381
  }
@@ -2209,7 +2383,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
2209
2383
  if (matcher(tagPath.node.name)) {
2210
2384
  return true;
2211
2385
  }
2212
- const binding = _optionalChain([tagPath, 'optionalAccess', _76 => _76.scope, 'optionalAccess', _77 => _77.getBinding, 'optionalCall', _78 => _78(tagPath.node.name)]);
2386
+ const binding = _optionalChain([tagPath, 'optionalAccess', _89 => _89.scope, 'optionalAccess', _90 => _90.getBinding, 'optionalCall', _91 => _91(tagPath.node.name)]);
2213
2387
  if (binding) {
2214
2388
  return resolvesToWeappTwIgnore(binding, /* @__PURE__ */ new Set());
2215
2389
  }
@@ -2305,11 +2479,11 @@ function analyzeSource(ast, options, handler) {
2305
2479
  return;
2306
2480
  }
2307
2481
  const calleePath = p.get("callee");
2308
- if (calleePath.isIdentifier({ name: "require" }) && !_optionalChain([p, 'optionalAccess', _79 => _79.scope, 'optionalAccess', _80 => _80.hasBinding, 'optionalCall', _81 => _81("require")])) {
2482
+ if (calleePath.isIdentifier({ name: "require" }) && !_optionalChain([p, 'optionalAccess', _92 => _92.scope, 'optionalAccess', _93 => _93.hasBinding, 'optionalCall', _94 => _94("require")])) {
2309
2483
  const args = p.get("arguments");
2310
2484
  if (Array.isArray(args) && args.length > 0) {
2311
2485
  const first = args[0];
2312
- if (_optionalChain([first, 'optionalAccess', _82 => _82.isStringLiteral, 'call', _83 => _83()])) {
2486
+ if (_optionalChain([first, 'optionalAccess', _95 => _95.isStringLiteral, 'call', _96 => _96()])) {
2313
2487
  requireCallPaths.push(first);
2314
2488
  }
2315
2489
  }
@@ -2394,6 +2568,8 @@ function createJsHandler(options) {
2394
2568
  arbitraryValues,
2395
2569
  escapeMap,
2396
2570
  staleClassNameFallback,
2571
+ jsArbitraryValueFallback,
2572
+ tailwindcssMajorVersion,
2397
2573
  jsPreserveClass,
2398
2574
  generateMap,
2399
2575
  needEscaped,
@@ -2416,6 +2592,8 @@ function createJsHandler(options) {
2416
2592
  classNameSet,
2417
2593
  escapeMap,
2418
2594
  staleClassNameFallback,
2595
+ jsArbitraryValueFallback,
2596
+ tailwindcssMajorVersion,
2419
2597
  arbitraryValues,
2420
2598
  jsPreserveClass,
2421
2599
  generateMap,
@@ -2513,7 +2691,7 @@ function shouldSkipLegacyStringLiteral(path5) {
2513
2691
  return true;
2514
2692
  }
2515
2693
  return Boolean(
2516
- t.isBinaryExpression(path5.parent) && (t.isConditionalExpression(_optionalChain([path5, 'access', _84 => _84.parentPath, 'optionalAccess', _85 => _85.parent])) || t.isLogicalExpression(_optionalChain([path5, 'access', _86 => _86.parentPath, 'optionalAccess', _87 => _87.parent])))
2694
+ t.isBinaryExpression(path5.parent) && (t.isConditionalExpression(_optionalChain([path5, 'access', _97 => _97.parentPath, 'optionalAccess', _98 => _98.parent])) || t.isLogicalExpression(_optionalChain([path5, 'access', _99 => _99.parentPath, 'optionalAccess', _100 => _100.parent])))
2517
2695
  );
2518
2696
  }
2519
2697
  function createLegacyTraverseOptions(options, jsTokenUpdater) {
@@ -2814,7 +2992,7 @@ async function customTemplateHandler(rawSource, options) {
2814
2992
  }
2815
2993
  const lowerName = name.toLowerCase();
2816
2994
  const shouldHandleDefault = !disabledDefaultTemplateHandler && (lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass");
2817
- const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _88 => _88(tag, name)]), () => ( false));
2995
+ const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _101 => _101(tag, name)]), () => ( false));
2818
2996
  if (!shouldHandleDefault && !shouldHandleCustom) {
2819
2997
  return;
2820
2998
  }
@@ -2879,7 +3057,7 @@ function resolveRuntimePackageReplacements(option) {
2879
3057
  }
2880
3058
  return Object.keys(normalized).length > 0 ? normalized : void 0;
2881
3059
  }
2882
- function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions) {
3060
+ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
2883
3061
  const {
2884
3062
  cssPreflight,
2885
3063
  cssPreflightRange,
@@ -2898,6 +3076,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2898
3076
  arbitraryValues,
2899
3077
  jsPreserveClass,
2900
3078
  staleClassNameFallback,
3079
+ jsArbitraryValueFallback,
2901
3080
  babelParserOptions,
2902
3081
  ignoreCallExpressionIdentifiers,
2903
3082
  ignoreTaggedTemplateExpressionIdentifiers,
@@ -2928,6 +3107,8 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2928
3107
  arbitraryValues,
2929
3108
  jsPreserveClass,
2930
3109
  staleClassNameFallback,
3110
+ jsArbitraryValueFallback: _nullishCoalesce(jsArbitraryValueFallback, () => ( "auto")),
3111
+ tailwindcssMajorVersion,
2931
3112
  generateMap: true,
2932
3113
  babelParserOptions,
2933
3114
  ignoreCallExpressionIdentifiers,
@@ -2966,7 +3147,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
2966
3147
  if (!patcher) {
2967
3148
  return;
2968
3149
  }
2969
- const cacheOptions = _optionalChain([patcher, 'access', _89 => _89.options, 'optionalAccess', _90 => _90.cache]);
3150
+ const cacheOptions = _optionalChain([patcher, 'access', _102 => _102.options, 'optionalAccess', _103 => _103.cache]);
2970
3151
  if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) {
2971
3152
  return;
2972
3153
  }
@@ -2977,19 +3158,19 @@ async function clearTailwindcssPatcherCache(patcher, options) {
2977
3158
  _logger.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
2978
3159
  }
2979
3160
  }
2980
- if (!_optionalChain([options, 'optionalAccess', _91 => _91.removeDirectory])) {
3161
+ if (!_optionalChain([options, 'optionalAccess', _104 => _104.removeDirectory])) {
2981
3162
  return;
2982
3163
  }
2983
3164
  const cachePaths = /* @__PURE__ */ new Map();
2984
3165
  const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
2985
- if (_optionalChain([normalizedCacheOptions, 'optionalAccess', _92 => _92.path])) {
3166
+ if (_optionalChain([normalizedCacheOptions, 'optionalAccess', _105 => _105.path])) {
2986
3167
  cachePaths.set(normalizedCacheOptions.path, false);
2987
3168
  }
2988
- const privateCachePath = _optionalChain([patcher, 'optionalAccess', _93 => _93.cacheStore, 'optionalAccess', _94 => _94.options, 'optionalAccess', _95 => _95.path]);
3169
+ const privateCachePath = _optionalChain([patcher, 'optionalAccess', _106 => _106.cacheStore, 'optionalAccess', _107 => _107.options, 'optionalAccess', _108 => _108.path]);
2989
3170
  if (privateCachePath) {
2990
3171
  cachePaths.set(privateCachePath, false);
2991
3172
  }
2992
- if (_optionalChain([options, 'optionalAccess', _96 => _96.removeDirectory]) && _optionalChain([normalizedCacheOptions, 'optionalAccess', _97 => _97.dir])) {
3173
+ if (_optionalChain([options, 'optionalAccess', _109 => _109.removeDirectory]) && _optionalChain([normalizedCacheOptions, 'optionalAccess', _110 => _110.dir])) {
2993
3174
  cachePaths.set(normalizedCacheOptions.dir, true);
2994
3175
  }
2995
3176
  if (!cachePaths.size) {
@@ -3000,7 +3181,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3000
3181
  await _promises.rm.call(void 0, cachePath, { force: true, recursive });
3001
3182
  } catch (error) {
3002
3183
  const err = error;
3003
- if (_optionalChain([err, 'optionalAccess', _98 => _98.code]) === "ENOENT") {
3184
+ if (_optionalChain([err, 'optionalAccess', _111 => _111.code]) === "ENOENT") {
3004
3185
  continue;
3005
3186
  }
3006
3187
  _logger.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
@@ -3015,21 +3196,22 @@ function createInternalCompilerContext(opts) {
3015
3196
  );
3016
3197
  ctx.escapeMap = ctx.customReplaceDictionary;
3017
3198
  applyLoggerLevel(ctx.logLevel);
3018
- const twPatcher = _chunk5APD2MNVjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3199
+ const twPatcher = _chunkRYC23C3Kjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3019
3200
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
3020
- if (_optionalChain([twPatcher, 'access', _99 => _99.packageInfo, 'optionalAccess', _100 => _100.version])) {
3201
+ if (_optionalChain([twPatcher, 'access', _112 => _112.packageInfo, 'optionalAccess', _113 => _113.version])) {
3021
3202
  _logger.logger.success(`\u5F53\u524D\u4F7F\u7528 ${_logger.pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${_logger.pc.underline(_logger.pc.bold(_logger.pc.green(twPatcher.packageInfo.version)))}`);
3022
3203
  } else {
3023
3204
  _logger.logger.warn(`${_logger.pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
3024
3205
  }
3025
- _chunk5APD2MNVjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3026
- const cssCalcOptions = _chunk5APD2MNVjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3206
+ _chunkRYC23C3Kjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3207
+ const cssCalcOptions = _chunkRYC23C3Kjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3027
3208
  ctx.cssCalc = cssCalcOptions;
3028
3209
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
3029
3210
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
3030
3211
  ctx,
3031
3212
  customAttributesEntities,
3032
- cssCalcOptions
3213
+ cssCalcOptions,
3214
+ twPatcher.majorVersion
3033
3215
  );
3034
3216
  ctx.styleHandler = styleHandler;
3035
3217
  ctx.jsHandler = jsHandler2;
@@ -3038,11 +3220,11 @@ function createInternalCompilerContext(opts) {
3038
3220
  ctx.twPatcher = twPatcher;
3039
3221
  const refreshTailwindcssPatcher = async (options) => {
3040
3222
  const previousPatcher = ctx.twPatcher;
3041
- if (_optionalChain([options, 'optionalAccess', _101 => _101.clearCache]) !== false) {
3223
+ if (_optionalChain([options, 'optionalAccess', _114 => _114.clearCache]) !== false) {
3042
3224
  await clearTailwindcssPatcherCache(previousPatcher);
3043
3225
  }
3044
3226
  invalidateRuntimeClassSet(previousPatcher);
3045
- const nextPatcher = _chunk5APD2MNVjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3227
+ const nextPatcher = _chunkRYC23C3Kjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3046
3228
  Object.assign(previousPatcher, nextPatcher);
3047
3229
  ctx.twPatcher = previousPatcher;
3048
3230
  return previousPatcher;