weapp-tailwindcss 4.7.7 → 4.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-APVOYXRF.mjs → chunk-6HQQYIBT.mjs} +1 -1
- package/dist/{chunk-2WZP7EXP.js → chunk-6J63FRIY.js} +115 -50
- package/dist/{chunk-FZNEB7RC.mjs → chunk-6NAX73ZA.mjs} +2 -2
- package/dist/{chunk-MNKR7BNZ.mjs → chunk-DMJK47DW.mjs} +1 -1
- package/dist/{chunk-KGKHHXRC.mjs → chunk-G7MXWOBI.mjs} +93 -28
- package/dist/{chunk-MGHX7SCL.js → chunk-GCF5VD66.js} +11 -11
- package/dist/{chunk-VLM4KUZA.js → chunk-HPUZNQ4G.js} +4 -4
- package/dist/{chunk-PP6KHC2I.js → chunk-LJ5AQYTF.js} +6 -6
- package/dist/{chunk-VPQLMV42.mjs → chunk-OQ5PKCFN.mjs} +1 -1
- package/dist/{chunk-XVJBQIVY.mjs → chunk-PYXTMD6B.mjs} +3 -1
- package/dist/{chunk-USAH2CX5.js → chunk-SMYOFNHJ.js} +3 -1
- package/dist/{chunk-MMBZHHNL.js → chunk-UCPNYFTI.js} +2 -2
- package/dist/{chunk-X5SXNF7I.js → chunk-ZSTADQDZ.js} +10 -10
- package/dist/cli.js +17 -14
- package/dist/cli.mjs +8 -5
- package/dist/core.js +10 -10
- package/dist/core.mjs +3 -3
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +4 -4
- package/dist/index.js +8 -8
- package/dist/index.mjs +6 -6
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +3 -3
- package/dist/presets.mjs +1 -1
- package/dist/types.d.mts +1 -5
- package/dist/types.d.ts +1 -5
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/webpack.js +6 -6
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.js +13 -13
- package/dist/webpack4.mjs +3 -3
- package/package.json +5 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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
|
|
3
|
+
var _chunkHPUZNQ4Gjs = require('./chunk-HPUZNQ4G.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkSMYOFNHJjs = require('./chunk-SMYOFNHJ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -282,8 +282,8 @@ var vitePluginName = "weapp-tailwindcss:adaptor";
|
|
|
282
282
|
var WEAPP_TW_REQUIRED_NODE_VERSION = "18.17.0";
|
|
283
283
|
var DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
284
284
|
"tailwind-merge": "@weapp-tailwindcss/merge",
|
|
285
|
-
"class-variance-authority": "@weapp-tailwindcss/
|
|
286
|
-
"tailwind-variants": "@weapp-tailwindcss/
|
|
285
|
+
"class-variance-authority": "@weapp-tailwindcss/cva",
|
|
286
|
+
"tailwind-variants": "@weapp-tailwindcss/variants"
|
|
287
287
|
};
|
|
288
288
|
|
|
289
289
|
// src/context/index.ts
|
|
@@ -544,14 +544,60 @@ function handleEvalTemplateElement(path2, options, updater, handler) {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
function walkEvalExpression(path2, options, updater, handler) {
|
|
547
|
-
path2.traverse
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
547
|
+
const maybeTraverse = _optionalChain([path2, 'optionalAccess', _17 => _17.traverse]);
|
|
548
|
+
if (typeof maybeTraverse === "function") {
|
|
549
|
+
try {
|
|
550
|
+
return maybeTraverse.call(path2, {
|
|
551
|
+
StringLiteral(innerPath) {
|
|
552
|
+
handleEvalStringLiteral(innerPath, options, updater, handler);
|
|
553
|
+
},
|
|
554
|
+
TemplateElement(innerPath) {
|
|
555
|
+
handleEvalTemplateElement(innerPath, options, updater, handler);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
} catch (error) {
|
|
559
|
+
const msg = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _18 => _18.message]), () => ( ""));
|
|
560
|
+
const scopeError = /pass a scope and parentPath|traversing a Program\/File/i.test(msg);
|
|
561
|
+
if (!scopeError) {
|
|
562
|
+
throw error;
|
|
563
|
+
}
|
|
553
564
|
}
|
|
554
|
-
}
|
|
565
|
+
}
|
|
566
|
+
const getArgs = _optionalChain([path2, 'optionalAccess', _19 => _19.get, 'optionalCall', _20 => _20("arguments")]);
|
|
567
|
+
if (Array.isArray(getArgs)) {
|
|
568
|
+
for (const arg of getArgs) {
|
|
569
|
+
if (_optionalChain([arg, 'optionalAccess', _21 => _21.isStringLiteral, 'optionalCall', _22 => _22()])) {
|
|
570
|
+
handleEvalStringLiteral(arg, options, updater, handler);
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
if (_optionalChain([arg, 'optionalAccess', _23 => _23.isTemplateLiteral, 'optionalCall', _24 => _24()])) {
|
|
574
|
+
for (const quasi of arg.get("quasis")) {
|
|
575
|
+
handleEvalTemplateElement(quasi, options, updater, handler);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const nodeArgs = _optionalChain([path2, 'optionalAccess', _25 => _25.node, 'optionalAccess', _26 => _26.arguments]);
|
|
582
|
+
if (Array.isArray(nodeArgs)) {
|
|
583
|
+
for (const n of nodeArgs) {
|
|
584
|
+
if (_optionalChain([n, 'optionalAccess', _27 => _27.type]) === "StringLiteral") {
|
|
585
|
+
const stub = {
|
|
586
|
+
node: n,
|
|
587
|
+
isStringLiteral: () => true
|
|
588
|
+
};
|
|
589
|
+
handleEvalStringLiteral(stub, options, updater, handler);
|
|
590
|
+
} else if (_optionalChain([n, 'optionalAccess', _28 => _28.type]) === "TemplateLiteral" && Array.isArray(n.quasis)) {
|
|
591
|
+
for (const q of n.quasis) {
|
|
592
|
+
const stub = {
|
|
593
|
+
node: q,
|
|
594
|
+
isTemplateElement: () => true
|
|
595
|
+
};
|
|
596
|
+
handleEvalTemplateElement(stub, options, updater, handler);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
555
601
|
}
|
|
556
602
|
|
|
557
603
|
// src/js/handlers.ts
|
|
@@ -650,10 +696,10 @@ function shouldTransformClassName(candidate, {
|
|
|
650
696
|
if (!classNameSet.has(candidate)) {
|
|
651
697
|
return false;
|
|
652
698
|
}
|
|
653
|
-
return !_optionalChain([jsPreserveClass, 'optionalCall',
|
|
699
|
+
return !_optionalChain([jsPreserveClass, 'optionalCall', _29 => _29(candidate)]);
|
|
654
700
|
}
|
|
655
701
|
function extractLiteralValue(path2, { unescapeUnicode, arbitraryValues }) {
|
|
656
|
-
const allowDoubleQuotes = _optionalChain([arbitraryValues, 'optionalAccess',
|
|
702
|
+
const allowDoubleQuotes = _optionalChain([arbitraryValues, 'optionalAccess', _30 => _30.allowDoubleQuotes]);
|
|
657
703
|
let offset = 0;
|
|
658
704
|
let original;
|
|
659
705
|
if (path2.isStringLiteral()) {
|
|
@@ -741,6 +787,12 @@ var JsTokenUpdater = class {
|
|
|
741
787
|
this.tokens.push(...args);
|
|
742
788
|
return this;
|
|
743
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* 待写入的 token 数量。
|
|
792
|
+
*/
|
|
793
|
+
get length() {
|
|
794
|
+
return this.tokens.length;
|
|
795
|
+
}
|
|
744
796
|
map(callbackfn) {
|
|
745
797
|
this.tokens = this.tokens.map(callbackfn);
|
|
746
798
|
return this;
|
|
@@ -847,7 +899,7 @@ var JsModuleGraph = class {
|
|
|
847
899
|
continue;
|
|
848
900
|
}
|
|
849
901
|
if (exportPath.isExportNamedDeclaration()) {
|
|
850
|
-
const source = _optionalChain([exportPath, 'access',
|
|
902
|
+
const source = _optionalChain([exportPath, 'access', _31 => _31.node, 'access', _32 => _32.source, 'optionalAccess', _33 => _33.value]);
|
|
851
903
|
if (typeof source === "string") {
|
|
852
904
|
for (const spec of exportPath.get("specifiers")) {
|
|
853
905
|
if (!spec.isExportSpecifier()) {
|
|
@@ -914,7 +966,7 @@ var JsModuleGraph = class {
|
|
|
914
966
|
continue;
|
|
915
967
|
}
|
|
916
968
|
if (exportPath.isExportAllDeclaration()) {
|
|
917
|
-
const source = _optionalChain([exportPath, 'access',
|
|
969
|
+
const source = _optionalChain([exportPath, 'access', _34 => _34.node, 'access', _35 => _35.source, 'optionalAccess', _36 => _36.value]);
|
|
918
970
|
if (typeof source === "string") {
|
|
919
971
|
for (const exportName of names) {
|
|
920
972
|
propagate.push({
|
|
@@ -966,7 +1018,7 @@ var JsModuleGraph = class {
|
|
|
966
1018
|
}
|
|
967
1019
|
for (const exportPath of state.analysis.exportDeclarations) {
|
|
968
1020
|
if (exportPath.isExportAllDeclaration() || exportPath.isExportNamedDeclaration()) {
|
|
969
|
-
const source = _optionalChain([exportPath, 'access',
|
|
1021
|
+
const source = _optionalChain([exportPath, 'access', _37 => _37.node, 'access', _38 => _38.source, 'optionalAccess', _39 => _39.value]);
|
|
970
1022
|
if (typeof source === "string" && !dependencySpecifiers.has(source)) {
|
|
971
1023
|
dependencySpecifiers.set(source, []);
|
|
972
1024
|
}
|
|
@@ -1085,14 +1137,14 @@ var NodePathWalker = class {
|
|
|
1085
1137
|
}
|
|
1086
1138
|
this.visited.add(arg);
|
|
1087
1139
|
if (arg.isIdentifier()) {
|
|
1088
|
-
const binding = arg.scope.getBinding(arg.node.name);
|
|
1140
|
+
const binding = _optionalChain([arg, 'optionalAccess', _40 => _40.scope, 'optionalAccess', _41 => _41.getBinding, 'optionalCall', _42 => _42(arg.node.name)]);
|
|
1089
1141
|
if (binding) {
|
|
1090
1142
|
this.walkNode(binding.path);
|
|
1091
1143
|
}
|
|
1092
1144
|
} else if (arg.isMemberExpression()) {
|
|
1093
1145
|
const objectPath = arg.get("object");
|
|
1094
1146
|
if (objectPath.isIdentifier()) {
|
|
1095
|
-
const binding = arg.scope.getBinding(objectPath.node.name);
|
|
1147
|
+
const binding = _optionalChain([arg, 'optionalAccess', _43 => _43.scope, 'optionalAccess', _44 => _44.getBinding, 'optionalCall', _45 => _45(objectPath.node.name)]);
|
|
1096
1148
|
if (binding) {
|
|
1097
1149
|
if (binding.path.isVariableDeclarator()) {
|
|
1098
1150
|
this.walkVariableDeclarator(binding.path);
|
|
@@ -1292,7 +1344,8 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1292
1344
|
}
|
|
1293
1345
|
const objectPath = path2.get("object");
|
|
1294
1346
|
if (objectPath.isIdentifier()) {
|
|
1295
|
-
const
|
|
1347
|
+
const scope = _optionalChain([objectPath, 'optionalAccess', _46 => _46.scope]);
|
|
1348
|
+
const binding = _optionalChain([scope, 'optionalAccess', _47 => _47.getBinding, 'optionalCall', _48 => _48(objectPath.node.name)]);
|
|
1296
1349
|
if (binding) {
|
|
1297
1350
|
return resolvesToWeappTwIgnore(binding, seen);
|
|
1298
1351
|
}
|
|
@@ -1321,7 +1374,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1321
1374
|
const init = bindingPath.get("init");
|
|
1322
1375
|
if (init && init.node) {
|
|
1323
1376
|
if (init.isIdentifier()) {
|
|
1324
|
-
const target = binding.scope.getBinding(init.node.name);
|
|
1377
|
+
const target = _optionalChain([binding, 'optionalAccess', _49 => _49.scope, 'optionalAccess', _50 => _50.getBinding, 'optionalCall', _51 => _51(init.node.name)]);
|
|
1325
1378
|
if (target) {
|
|
1326
1379
|
result = resolvesToWeappTwIgnore(target, seen);
|
|
1327
1380
|
}
|
|
@@ -1337,7 +1390,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1337
1390
|
const getEffectiveTagPath = (tagPath) => {
|
|
1338
1391
|
let current = tagPath;
|
|
1339
1392
|
while (true) {
|
|
1340
|
-
if (_optionalChain([current, 'access',
|
|
1393
|
+
if (_optionalChain([current, 'access', _52 => _52.isParenthesizedExpression, 'optionalCall', _53 => _53()]) || current.node.type === "ParenthesizedExpression") {
|
|
1341
1394
|
current = current.get("expression");
|
|
1342
1395
|
continue;
|
|
1343
1396
|
}
|
|
@@ -1349,7 +1402,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1349
1402
|
current = current.get("expression");
|
|
1350
1403
|
continue;
|
|
1351
1404
|
}
|
|
1352
|
-
if (_optionalChain([current, 'access',
|
|
1405
|
+
if (_optionalChain([current, 'access', _54 => _54.isTypeCastExpression, 'optionalCall', _55 => _55()])) {
|
|
1353
1406
|
current = current.get("expression");
|
|
1354
1407
|
continue;
|
|
1355
1408
|
}
|
|
@@ -1361,7 +1414,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1361
1414
|
continue;
|
|
1362
1415
|
}
|
|
1363
1416
|
}
|
|
1364
|
-
if (_optionalChain([current, 'access',
|
|
1417
|
+
if (_optionalChain([current, 'access', _56 => _56.isCallExpression, 'optionalCall', _57 => _57()]) || current.node.type === "CallExpression") {
|
|
1365
1418
|
const callee = current.get("callee");
|
|
1366
1419
|
current = callee;
|
|
1367
1420
|
continue;
|
|
@@ -1371,7 +1424,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1371
1424
|
return current;
|
|
1372
1425
|
};
|
|
1373
1426
|
const evaluateTagPath = (tagPath) => {
|
|
1374
|
-
if (_optionalChain([tagPath, 'access',
|
|
1427
|
+
if (_optionalChain([tagPath, 'access', _58 => _58.isCallExpression, 'optionalCall', _59 => _59()]) || tagPath.node.type === "CallExpression") {
|
|
1375
1428
|
const calleePath = tagPath.get("callee");
|
|
1376
1429
|
return evaluateTagPath(calleePath);
|
|
1377
1430
|
}
|
|
@@ -1379,7 +1432,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
1379
1432
|
if (matcher(tagPath.node.name)) {
|
|
1380
1433
|
return true;
|
|
1381
1434
|
}
|
|
1382
|
-
const binding = tagPath.scope.getBinding(tagPath.node.name);
|
|
1435
|
+
const binding = _optionalChain([tagPath, 'optionalAccess', _60 => _60.scope, 'optionalAccess', _61 => _61.getBinding, 'optionalCall', _62 => _62(tagPath.node.name)]);
|
|
1383
1436
|
if (binding) {
|
|
1384
1437
|
return resolvesToWeappTwIgnore(binding, /* @__PURE__ */ new Set());
|
|
1385
1438
|
}
|
|
@@ -1419,22 +1472,27 @@ var EXPRESSION_WRAPPER_PREFIX = "(\n";
|
|
|
1419
1472
|
var EXPRESSION_WRAPPER_SUFFIX = "\n)";
|
|
1420
1473
|
var parseCache = new (0, _lrucache.LRUCache)(
|
|
1421
1474
|
{
|
|
1422
|
-
max:
|
|
1475
|
+
max: 1024
|
|
1423
1476
|
}
|
|
1424
1477
|
);
|
|
1425
1478
|
function genCacheKey(source, options) {
|
|
1479
|
+
if (typeof options === "string") {
|
|
1480
|
+
return source + options;
|
|
1481
|
+
}
|
|
1426
1482
|
return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
|
|
1427
1483
|
}
|
|
1428
|
-
function babelParse(code,
|
|
1429
|
-
const cacheKey =
|
|
1484
|
+
function babelParse(code, opts = {}) {
|
|
1485
|
+
const { cache, cacheKey, ...rest } = opts;
|
|
1486
|
+
const cacheKeyString = genCacheKey(code, _nullishCoalesce(cacheKey, () => ( rest)));
|
|
1430
1487
|
let result;
|
|
1431
1488
|
if (cache) {
|
|
1432
|
-
result = parseCache.get(
|
|
1489
|
+
result = parseCache.get(cacheKeyString);
|
|
1433
1490
|
}
|
|
1434
1491
|
if (!result) {
|
|
1435
|
-
|
|
1492
|
+
const { cache: _cache, cacheKey: _cacheKey, ...parseOptions } = opts;
|
|
1493
|
+
result = _parser.parse.call(void 0, code, parseOptions);
|
|
1436
1494
|
if (cache) {
|
|
1437
|
-
parseCache.set(
|
|
1495
|
+
parseCache.set(cacheKeyString, result);
|
|
1438
1496
|
}
|
|
1439
1497
|
}
|
|
1440
1498
|
return result;
|
|
@@ -1457,6 +1515,7 @@ function analyzeSource(ast, options, handler) {
|
|
|
1457
1515
|
matcher: isIgnoredTaggedTemplate,
|
|
1458
1516
|
names: options.ignoreTaggedTemplateExpressionIdentifiers
|
|
1459
1517
|
});
|
|
1518
|
+
const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
|
|
1460
1519
|
const targetPaths = [];
|
|
1461
1520
|
const importDeclarations = /* @__PURE__ */ new Set();
|
|
1462
1521
|
const exportDeclarations = /* @__PURE__ */ new Set();
|
|
@@ -1496,16 +1555,18 @@ function analyzeSource(ast, options, handler) {
|
|
|
1496
1555
|
return;
|
|
1497
1556
|
}
|
|
1498
1557
|
const calleePath = p.get("callee");
|
|
1499
|
-
if (calleePath.isIdentifier({ name: "require" }) && !p.scope.hasBinding("require")) {
|
|
1558
|
+
if (calleePath.isIdentifier({ name: "require" }) && !_optionalChain([p, 'optionalAccess', _63 => _63.scope, 'optionalAccess', _64 => _64.hasBinding, 'optionalCall', _65 => _65("require")])) {
|
|
1500
1559
|
const args = p.get("arguments");
|
|
1501
1560
|
if (Array.isArray(args) && args.length > 0) {
|
|
1502
1561
|
const first = args[0];
|
|
1503
|
-
if (_optionalChain([first, 'optionalAccess',
|
|
1562
|
+
if (_optionalChain([first, 'optionalAccess', _66 => _66.isStringLiteral, 'call', _67 => _67()])) {
|
|
1504
1563
|
requireCallPaths.push(first);
|
|
1505
1564
|
}
|
|
1506
1565
|
}
|
|
1507
1566
|
}
|
|
1508
|
-
|
|
1567
|
+
if (needScope) {
|
|
1568
|
+
walker.walkCallExpression(p);
|
|
1569
|
+
}
|
|
1509
1570
|
}
|
|
1510
1571
|
},
|
|
1511
1572
|
ImportDeclaration: {
|
|
@@ -1519,7 +1580,7 @@ function analyzeSource(ast, options, handler) {
|
|
|
1519
1580
|
}
|
|
1520
1581
|
}
|
|
1521
1582
|
};
|
|
1522
|
-
traverse(ast, traverseOptions);
|
|
1583
|
+
traverse(ast, { ...traverseOptions, noScope: !needScope });
|
|
1523
1584
|
return {
|
|
1524
1585
|
walker,
|
|
1525
1586
|
jsTokenUpdater,
|
|
@@ -1532,7 +1593,6 @@ function analyzeSource(ast, options, handler) {
|
|
|
1532
1593
|
};
|
|
1533
1594
|
}
|
|
1534
1595
|
function processUpdatedSource(rawSource, options, analysis) {
|
|
1535
|
-
const ms = new (0, _magicstring2.default)(rawSource);
|
|
1536
1596
|
const { targetPaths, jsTokenUpdater, ignoredPaths } = analysis;
|
|
1537
1597
|
const replacementTokens = [];
|
|
1538
1598
|
for (const path2 of targetPaths) {
|
|
@@ -1555,6 +1615,10 @@ function processUpdatedSource(rawSource, options, analysis) {
|
|
|
1555
1615
|
...collectModuleSpecifierReplacementTokens(analysis, options.moduleSpecifierReplacements)
|
|
1556
1616
|
);
|
|
1557
1617
|
}
|
|
1618
|
+
if (jsTokenUpdater.length + replacementTokens.length === 0) {
|
|
1619
|
+
return new (0, _magicstring2.default)(rawSource);
|
|
1620
|
+
}
|
|
1621
|
+
const ms = new (0, _magicstring2.default)(rawSource);
|
|
1558
1622
|
jsTokenUpdater.push(...replacementTokens).filter((token) => !ignoredPaths.has(token.path)).updateMagicString(ms);
|
|
1559
1623
|
return ms;
|
|
1560
1624
|
}
|
|
@@ -1894,7 +1958,7 @@ function generateCode(match, options = {}) {
|
|
|
1894
1958
|
if (t.isMemberExpression(path2.parent)) {
|
|
1895
1959
|
return;
|
|
1896
1960
|
}
|
|
1897
|
-
if (t.isBinaryExpression(path2.parent) && (t.isConditionalExpression(_optionalChain([path2, 'access',
|
|
1961
|
+
if (t.isBinaryExpression(path2.parent) && (t.isConditionalExpression(_optionalChain([path2, 'access', _68 => _68.parentPath, 'optionalAccess', _69 => _69.parent])) || t.isLogicalExpression(_optionalChain([path2, 'access', _70 => _70.parentPath, 'optionalAccess', _71 => _71.parent])))) {
|
|
1898
1962
|
return;
|
|
1899
1963
|
}
|
|
1900
1964
|
jsTokenUpdater.addToken(
|
|
@@ -2007,7 +2071,7 @@ async function customTemplateHandler(rawSource, options) {
|
|
|
2007
2071
|
}
|
|
2008
2072
|
const lowerName = name.toLowerCase();
|
|
2009
2073
|
const shouldHandleDefault = !disabledDefaultTemplateHandler && (lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass");
|
|
2010
|
-
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall',
|
|
2074
|
+
const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _72 => _72(tag, name)]), () => ( false));
|
|
2011
2075
|
if (!shouldHandleDefault && !shouldHandleCustom) {
|
|
2012
2076
|
return;
|
|
2013
2077
|
}
|
|
@@ -2202,19 +2266,20 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
2202
2266
|
if (!patcher) {
|
|
2203
2267
|
return;
|
|
2204
2268
|
}
|
|
2205
|
-
const cacheOptions = _optionalChain([patcher, 'access',
|
|
2206
|
-
if (cacheOptions == null ||
|
|
2269
|
+
const cacheOptions = _optionalChain([patcher, 'access', _73 => _73.options, 'optionalAccess', _74 => _74.cache]);
|
|
2270
|
+
if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) {
|
|
2207
2271
|
return;
|
|
2208
2272
|
}
|
|
2209
2273
|
const cachePaths = /* @__PURE__ */ new Map();
|
|
2210
2274
|
const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
|
|
2211
|
-
if (_optionalChain([normalizedCacheOptions, 'optionalAccess',
|
|
2275
|
+
if (_optionalChain([normalizedCacheOptions, 'optionalAccess', _75 => _75.path])) {
|
|
2212
2276
|
cachePaths.set(normalizedCacheOptions.path, false);
|
|
2213
2277
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2278
|
+
const privateCachePath = _optionalChain([patcher, 'optionalAccess', _76 => _76.cacheStore, 'optionalAccess', _77 => _77.options, 'optionalAccess', _78 => _78.path]);
|
|
2279
|
+
if (privateCachePath) {
|
|
2280
|
+
cachePaths.set(privateCachePath, false);
|
|
2216
2281
|
}
|
|
2217
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
2282
|
+
if (_optionalChain([options, 'optionalAccess', _79 => _79.removeDirectory]) && _optionalChain([normalizedCacheOptions, 'optionalAccess', _80 => _80.dir])) {
|
|
2218
2283
|
cachePaths.set(normalizedCacheOptions.dir, true);
|
|
2219
2284
|
}
|
|
2220
2285
|
if (!cachePaths.size) {
|
|
@@ -2225,7 +2290,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
2225
2290
|
await _promises.rm.call(void 0, cachePath, { force: true, recursive });
|
|
2226
2291
|
} catch (error) {
|
|
2227
2292
|
const err = error;
|
|
2228
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
2293
|
+
if (_optionalChain([err, 'optionalAccess', _81 => _81.code]) === "ENOENT") {
|
|
2229
2294
|
continue;
|
|
2230
2295
|
}
|
|
2231
2296
|
_logger.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
@@ -2235,14 +2300,14 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
2235
2300
|
function getCompilerContext(opts) {
|
|
2236
2301
|
const ctx = _chunkUW3WHSZ5js.defuOverrideArray.call(void 0,
|
|
2237
2302
|
opts,
|
|
2238
|
-
|
|
2303
|
+
_chunkSMYOFNHJjs.getDefaultOptions.call(void 0, ),
|
|
2239
2304
|
{}
|
|
2240
2305
|
);
|
|
2241
2306
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
2242
2307
|
applyLoggerLevel(ctx.logLevel);
|
|
2243
|
-
const twPatcher =
|
|
2308
|
+
const twPatcher = _chunkHPUZNQ4Gjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
|
|
2244
2309
|
logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
|
|
2245
|
-
if (_optionalChain([twPatcher, 'access',
|
|
2310
|
+
if (_optionalChain([twPatcher, 'access', _82 => _82.packageInfo, 'optionalAccess', _83 => _83.version])) {
|
|
2246
2311
|
_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)))}`);
|
|
2247
2312
|
} else {
|
|
2248
2313
|
_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`);
|
|
@@ -2266,11 +2331,11 @@ function getCompilerContext(opts) {
|
|
|
2266
2331
|
ctx.twPatcher = twPatcher;
|
|
2267
2332
|
const refreshTailwindcssPatcher = async (options) => {
|
|
2268
2333
|
const previousPatcher = ctx.twPatcher;
|
|
2269
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
2334
|
+
if (_optionalChain([options, 'optionalAccess', _84 => _84.clearCache]) !== false) {
|
|
2270
2335
|
await clearTailwindcssPatcherCache(previousPatcher);
|
|
2271
2336
|
}
|
|
2272
2337
|
invalidateRuntimeClassSet(previousPatcher);
|
|
2273
|
-
const nextPatcher =
|
|
2338
|
+
const nextPatcher = _chunkHPUZNQ4Gjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
|
|
2274
2339
|
Object.assign(previousPatcher, nextPatcher);
|
|
2275
2340
|
ctx.twPatcher = previousPatcher;
|
|
2276
2341
|
return previousPatcher;
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
getCompilerContext,
|
|
17
17
|
pluginName,
|
|
18
18
|
refreshTailwindRuntimeState
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-G7MXWOBI.mjs";
|
|
20
20
|
import {
|
|
21
21
|
getGroupedEntries
|
|
22
22
|
} from "./chunk-ZNKIYZRQ.mjs";
|
|
23
23
|
import {
|
|
24
24
|
__dirname
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-DMJK47DW.mjs";
|
|
26
26
|
|
|
27
27
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
28
28
|
import fs from "fs";
|
|
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
5
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/tsup@8.5.
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.1_@swc+h_d92aa008e7d0cb6e2dab5bcd2ea8592f/node_modules/tsup/assets/esm_shims.js
|
|
9
9
|
import path from "path";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
var getFilename = () => fileURLToPath(import.meta.url);
|