weapp-tailwindcss 4.5.1 → 4.6.0

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 (71) hide show
  1. package/dist/{chunk-CCXN3K4T.js → chunk-7CGHD2TI.js} +17 -15
  2. package/dist/{chunk-P54HILYW.mjs → chunk-7PGHZOTU.mjs} +88 -221
  3. package/dist/chunk-AXLRUW5H.js +776 -0
  4. package/dist/{chunk-PLMJW644.js → chunk-DWAEHRHN.js} +1 -4
  5. package/dist/{chunk-NHB7NFQC.js → chunk-E5PXIHDN.js} +1 -1
  6. package/dist/chunk-FB5P4TRH.js +70 -0
  7. package/dist/{chunk-7NGYHFX4.js → chunk-FVA7Y2YU.js} +21 -19
  8. package/dist/{chunk-FOSGDQZ7.js → chunk-I7FYDXN6.js} +3 -5
  9. package/dist/chunk-IY2OKZE6.mjs +773 -0
  10. package/dist/{chunk-3ICGFLVO.mjs → chunk-JG5LBGLH.mjs} +27 -7
  11. package/dist/{chunk-FWIGQ4RY.mjs → chunk-KHILYAA4.mjs} +1 -1
  12. package/dist/chunk-LTJQUORK.js +32 -0
  13. package/dist/{chunk-QOHOLLWR.js → chunk-M6DWZX4H.js} +31 -11
  14. package/dist/{chunk-4JDQJ2K4.mjs → chunk-MXVUK23K.mjs} +14 -12
  15. package/dist/{chunk-VJKW7COS.js → chunk-OVDIACVK.js} +94 -230
  16. package/dist/{chunk-H4JTYYOI.mjs → chunk-RRHPTTCP.mjs} +0 -11
  17. package/dist/{chunk-7KER5VQX.mjs → chunk-TTDQ4TK2.mjs} +14 -12
  18. package/dist/{chunk-Q67IXIAH.mjs → chunk-VSRDBMDB.mjs} +1 -4
  19. package/dist/{chunk-IHKVNALD.mjs → chunk-YLNOOPZL.mjs} +3 -5
  20. package/dist/chunk-YPBRGP6K.mjs +70 -0
  21. package/dist/cli.js +11 -7
  22. package/dist/cli.mjs +11 -7
  23. package/dist/core.d.mts +0 -1
  24. package/dist/core.d.ts +0 -1
  25. package/dist/core.js +23 -11
  26. package/dist/core.mjs +21 -9
  27. package/dist/css-macro/postcss.js +1 -1
  28. package/dist/css-macro/postcss.mjs +1 -1
  29. package/dist/css-macro.js +1 -1
  30. package/dist/css-macro.mjs +1 -1
  31. package/dist/defaults.d.mts +0 -1
  32. package/dist/defaults.d.ts +0 -1
  33. package/dist/defaults.js +3 -3
  34. package/dist/defaults.mjs +2 -2
  35. package/dist/escape.d.mts +0 -1
  36. package/dist/escape.d.ts +0 -1
  37. package/dist/escape.js +3 -3
  38. package/dist/escape.mjs +2 -2
  39. package/dist/gulp.d.mts +0 -1
  40. package/dist/gulp.d.ts +0 -1
  41. package/dist/gulp.js +9 -7
  42. package/dist/gulp.mjs +8 -6
  43. package/dist/index.d.mts +1 -2
  44. package/dist/index.d.ts +1 -2
  45. package/dist/index.js +11 -9
  46. package/dist/index.mjs +10 -8
  47. package/dist/postcss-html-transform.js +1 -1
  48. package/dist/postcss-html-transform.mjs +1 -1
  49. package/dist/presets.d.mts +9 -2
  50. package/dist/presets.d.ts +9 -2
  51. package/dist/presets.js +68 -14
  52. package/dist/presets.mjs +66 -12
  53. package/dist/types.d.mts +10 -30
  54. package/dist/types.d.ts +10 -30
  55. package/dist/types.js +1 -1
  56. package/dist/types.mjs +1 -1
  57. package/dist/vite.d.mts +0 -1
  58. package/dist/vite.d.ts +0 -1
  59. package/dist/vite.js +9 -7
  60. package/dist/vite.mjs +8 -6
  61. package/dist/weapp-tw-runtime-loader.js +4 -1
  62. package/dist/webpack.d.mts +0 -1
  63. package/dist/webpack.d.ts +0 -1
  64. package/dist/webpack.js +9 -7
  65. package/dist/webpack.mjs +8 -6
  66. package/dist/webpack4.d.mts +0 -1
  67. package/dist/webpack4.d.ts +0 -1
  68. package/dist/webpack4.js +21 -18
  69. package/dist/webpack4.mjs +17 -14
  70. package/package.json +7 -8
  71. package/dist/chunk-2NRTWL47.js +0 -43
@@ -1,20 +1,19 @@
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 _chunkPLMJW644js = require('./chunk-PLMJW644.js');
3
+ var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
4
4
 
5
5
 
6
- var _chunkFOSGDQZ7js = require('./chunk-FOSGDQZ7.js');
6
+ var _chunkAXLRUW5Hjs = require('./chunk-AXLRUW5H.js');
7
7
 
8
8
 
9
+ var _chunkI7FYDXN6js = require('./chunk-I7FYDXN6.js');
9
10
 
10
- var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
11
11
 
12
12
 
13
- var _chunkNHB7NFQCjs = require('./chunk-NHB7NFQC.js');
13
+ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
14
14
 
15
15
  // src/context/index.ts
16
16
  var _logger = require('@weapp-tailwindcss/logger');
17
- var _mangle = require('@weapp-tailwindcss/mangle');
18
17
 
19
18
  // src/cache/index.ts
20
19
  var _lrucache = require('lru-cache');
@@ -244,7 +243,7 @@ function getReplacement(candidate, escapeMap) {
244
243
  if (!escapeMap) {
245
244
  let cached2 = defaultReplacementCache.get(candidate);
246
245
  if (cached2 === void 0) {
247
- cached2 = _chunkPLMJW644js.replaceWxml.call(void 0, candidate, { escapeMap });
246
+ cached2 = _chunkDWAEHRHNjs.replaceWxml.call(void 0, candidate, { escapeMap });
248
247
  defaultReplacementCache.set(candidate, cached2);
249
248
  }
250
249
  return cached2;
@@ -256,7 +255,7 @@ function getReplacement(candidate, escapeMap) {
256
255
  }
257
256
  let cached = store.get(candidate);
258
257
  if (cached === void 0) {
259
- cached = _chunkPLMJW644js.replaceWxml.call(void 0, candidate, { escapeMap });
258
+ cached = _chunkDWAEHRHNjs.replaceWxml.call(void 0, candidate, { escapeMap });
260
259
  store.set(candidate, cached);
261
260
  }
262
261
  return cached;
@@ -280,15 +279,15 @@ function shouldTransformClassName(candidate, {
280
279
  }
281
280
  return !_optionalChain([jsPreserveClass, 'optionalCall', _7 => _7(candidate)]);
282
281
  }
283
- function extractLiteralValue(path2, { unescapeUnicode, arbitraryValues }) {
282
+ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
284
283
  const allowDoubleQuotes = _optionalChain([arbitraryValues, 'optionalAccess', _8 => _8.allowDoubleQuotes]);
285
284
  let offset = 0;
286
285
  let original;
287
- if (path2.isStringLiteral()) {
286
+ if (path.isStringLiteral()) {
288
287
  offset = 1;
289
- original = path2.node.value;
290
- } else if (path2.isTemplateElement()) {
291
- original = path2.node.value.raw;
288
+ original = path.node.value;
289
+ } else if (path.isTemplateElement()) {
290
+ original = path.node.value.raw;
292
291
  } else {
293
292
  original = "";
294
293
  }
@@ -303,18 +302,17 @@ function extractLiteralValue(path2, { unescapeUnicode, arbitraryValues }) {
303
302
  original
304
303
  };
305
304
  }
306
- function replaceHandleValue(path2, options) {
305
+ function replaceHandleValue(path, options) {
307
306
  const {
308
307
  escapeMap,
309
- mangleContext,
310
308
  needEscaped = false
311
309
  } = options;
312
310
  const { classNameSet, alwaysEscape } = options;
313
311
  if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)) {
314
312
  return void 0;
315
313
  }
316
- const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path2, options);
317
- if (hasIgnoreComment(path2.node)) {
314
+ const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
315
+ if (hasIgnoreComment(path.node)) {
318
316
  return void 0;
319
317
  }
320
318
  const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
@@ -323,19 +321,10 @@ function replaceHandleValue(path2, options) {
323
321
  }
324
322
  let transformed = literal;
325
323
  let mutated = false;
326
- let normalised = false;
327
324
  for (const candidate of candidates) {
328
325
  if (!shouldTransformClassName(candidate, options)) {
329
326
  continue;
330
327
  }
331
- if (mangleContext && !normalised) {
332
- const mangled = mangleContext.jsHandler(transformed);
333
- if (mangled !== transformed) {
334
- transformed = mangled;
335
- mutated = true;
336
- }
337
- normalised = true;
338
- }
339
328
  if (!transformed.includes(candidate)) {
340
329
  continue;
341
330
  }
@@ -347,7 +336,7 @@ function replaceHandleValue(path2, options) {
347
336
  mutated = true;
348
337
  }
349
338
  }
350
- const node = path2.node;
339
+ const node = path.node;
351
340
  if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") {
352
341
  return void 0;
353
342
  }
@@ -361,7 +350,7 @@ function replaceHandleValue(path2, options) {
361
350
  start,
362
351
  end,
363
352
  value,
364
- path: path2
353
+ path
365
354
  };
366
355
  }
367
356
 
@@ -673,35 +662,35 @@ var NodePathWalker = class {
673
662
  this.visited = /* @__PURE__ */ new WeakSet();
674
663
  this.isIgnoredCallIdentifier = createNameMatcher(this.ignoreCallExpressionIdentifiers, { exact: true });
675
664
  }
676
- walkVariableDeclarator(path2) {
677
- const init = path2.get("init");
665
+ walkVariableDeclarator(path) {
666
+ const init = path.get("init");
678
667
  this.walkNode(init);
679
668
  }
680
- walkTemplateLiteral(path2) {
681
- for (const exp of path2.get("expressions")) {
669
+ walkTemplateLiteral(path) {
670
+ for (const exp of path.get("expressions")) {
682
671
  this.walkNode(exp);
683
672
  }
684
- for (const quasis of path2.get("quasis")) {
673
+ for (const quasis of path.get("quasis")) {
685
674
  this.callback(quasis);
686
675
  }
687
676
  }
688
- walkStringLiteral(path2) {
689
- this.callback(path2);
677
+ walkStringLiteral(path) {
678
+ this.callback(path);
690
679
  }
691
- walkBinaryExpression(path2) {
692
- const left = path2.get("left");
680
+ walkBinaryExpression(path) {
681
+ const left = path.get("left");
693
682
  this.walkNode(left);
694
- const right = path2.get("right");
683
+ const right = path.get("right");
695
684
  this.walkNode(right);
696
685
  }
697
- walkLogicalExpression(path2) {
698
- const left = path2.get("left");
686
+ walkLogicalExpression(path) {
687
+ const left = path.get("left");
699
688
  this.walkNode(left);
700
- const right = path2.get("right");
689
+ const right = path.get("right");
701
690
  this.walkNode(right);
702
691
  }
703
- walkObjectExpression(path2) {
704
- const props = path2.get("properties");
692
+ walkObjectExpression(path) {
693
+ const props = path.get("properties");
705
694
  for (const prop of props) {
706
695
  if (prop.isObjectProperty()) {
707
696
  const key = prop.get("key");
@@ -711,8 +700,8 @@ var NodePathWalker = class {
711
700
  }
712
701
  }
713
702
  }
714
- walkArrayExpression(path2) {
715
- const elements = path2.get("elements");
703
+ walkArrayExpression(path) {
704
+ const elements = path.get("elements");
716
705
  for (const element of elements) {
717
706
  this.walkNode(element);
718
707
  }
@@ -785,33 +774,33 @@ var NodePathWalker = class {
785
774
  /**
786
775
  * Walk the arguments of a desired call expression so their bindings can be analysed.
787
776
  */
788
- walkCallExpression(path2) {
789
- const calleePath = path2.get("callee");
777
+ walkCallExpression(path) {
778
+ const calleePath = path.get("callee");
790
779
  if (calleePath.isIdentifier() && this.isIgnoredCallIdentifier(calleePath.node.name)) {
791
- for (const arg of path2.get("arguments")) {
780
+ for (const arg of path.get("arguments")) {
792
781
  this.walkNode(arg);
793
782
  }
794
783
  }
795
784
  }
796
- walkExportDeclaration(path2) {
797
- if (path2.isExportDeclaration()) {
798
- if (path2.isExportNamedDeclaration()) {
799
- this.walkExportNamedDeclaration(path2);
800
- } else if (path2.isExportDefaultDeclaration()) {
801
- this.walkExportDefaultDeclaration(path2);
802
- } else if (path2.isExportAllDeclaration()) {
803
- this.walkExportAllDeclaration(path2);
785
+ walkExportDeclaration(path) {
786
+ if (path.isExportDeclaration()) {
787
+ if (path.isExportNamedDeclaration()) {
788
+ this.walkExportNamedDeclaration(path);
789
+ } else if (path.isExportDefaultDeclaration()) {
790
+ this.walkExportDefaultDeclaration(path);
791
+ } else if (path.isExportAllDeclaration()) {
792
+ this.walkExportAllDeclaration(path);
804
793
  }
805
794
  }
806
795
  }
807
- walkExportNamedDeclaration(path2) {
808
- const declaration = path2.get("declaration");
796
+ walkExportNamedDeclaration(path) {
797
+ const declaration = path.get("declaration");
809
798
  if (declaration.isVariableDeclaration()) {
810
799
  for (const decl of declaration.get("declarations")) {
811
800
  this.walkNode(decl);
812
801
  }
813
802
  }
814
- const specifiers = path2.get("specifiers");
803
+ const specifiers = path.get("specifiers");
815
804
  for (const spec of specifiers) {
816
805
  if (spec.isExportSpecifier()) {
817
806
  const local = spec.get("local");
@@ -821,20 +810,20 @@ var NodePathWalker = class {
821
810
  }
822
811
  }
823
812
  }
824
- walkExportDefaultDeclaration(path2) {
825
- const decl = path2.get("declaration");
813
+ walkExportDefaultDeclaration(path) {
814
+ const decl = path.get("declaration");
826
815
  if (decl.isIdentifier()) {
827
816
  this.walkNode(decl);
828
817
  } else {
829
818
  this.walkNode(decl);
830
819
  }
831
820
  }
832
- walkExportAllDeclaration(path2) {
833
- const source = path2.get("source");
821
+ walkExportAllDeclaration(path) {
822
+ const source = path.get("source");
834
823
  if (source.isStringLiteral()) {
835
824
  this.imports.add(
836
825
  {
837
- declaration: path2,
826
+ declaration: path,
838
827
  source: source.node.value,
839
828
  type: "ExportAllDeclaration"
840
829
  }
@@ -877,15 +866,15 @@ function isEvalPath(p) {
877
866
  }
878
867
  return false;
879
868
  }
880
- function createEvalReplacementToken(path2, updated) {
881
- const node = path2.node;
869
+ function createEvalReplacementToken(path, updated) {
870
+ const node = path.node;
882
871
  let offset = 0;
883
872
  let original;
884
- if (path2.isStringLiteral()) {
873
+ if (path.isStringLiteral()) {
885
874
  offset = 1;
886
- original = path2.node.value;
887
- } else if (path2.isTemplateElement()) {
888
- original = path2.node.value.raw;
875
+ original = path.node.value;
876
+ } else if (path.isTemplateElement()) {
877
+ original = path.node.value.raw;
889
878
  } else {
890
879
  original = "";
891
880
  }
@@ -900,16 +889,16 @@ function createEvalReplacementToken(path2, updated) {
900
889
  if (original === updated) {
901
890
  return void 0;
902
891
  }
903
- const value = path2.isStringLiteral() ? _escape.jsStringEscape.call(void 0, updated) : updated;
892
+ const value = path.isStringLiteral() ? _escape.jsStringEscape.call(void 0, updated) : updated;
904
893
  return {
905
894
  start,
906
895
  end,
907
896
  value,
908
- path: path2
897
+ path
909
898
  };
910
899
  }
911
- function handleEvalStringLiteral(path2, options, updater) {
912
- const { code } = jsHandler(path2.node.value, {
900
+ function handleEvalStringLiteral(path, options, updater) {
901
+ const { code } = jsHandler(path.node.value, {
913
902
  ...options,
914
903
  needEscaped: false,
915
904
  generateMap: false
@@ -917,26 +906,26 @@ function handleEvalStringLiteral(path2, options, updater) {
917
906
  if (!code) {
918
907
  return;
919
908
  }
920
- const token = createEvalReplacementToken(path2, code);
909
+ const token = createEvalReplacementToken(path, code);
921
910
  if (token) {
922
911
  updater.addToken(token);
923
912
  }
924
913
  }
925
- function handleEvalTemplateElement(path2, options, updater) {
926
- const { code } = jsHandler(path2.node.value.raw, {
914
+ function handleEvalTemplateElement(path, options, updater) {
915
+ const { code } = jsHandler(path.node.value.raw, {
927
916
  ...options,
928
917
  generateMap: false
929
918
  });
930
919
  if (!code) {
931
920
  return;
932
921
  }
933
- const token = createEvalReplacementToken(path2, code);
922
+ const token = createEvalReplacementToken(path, code);
934
923
  if (token) {
935
924
  updater.addToken(token);
936
925
  }
937
926
  }
938
- function walkEvalExpression(path2, options, updater) {
939
- path2.traverse({
927
+ function walkEvalExpression(path, options, updater) {
928
+ path.traverse({
940
929
  StringLiteral(innerPath) {
941
930
  handleEvalStringLiteral(innerPath, options, updater);
942
931
  },
@@ -951,9 +940,9 @@ function analyzeSource(ast, options) {
951
940
  const walker = new NodePathWalker(
952
941
  {
953
942
  ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
954
- callback(path2) {
955
- if (path2.isStringLiteral() || path2.isTemplateElement()) {
956
- ignoredPaths.add(path2);
943
+ callback(path) {
944
+ if (path.isStringLiteral() || path.isTemplateElement()) {
945
+ ignoredPaths.add(path);
957
946
  }
958
947
  }
959
948
  }
@@ -1024,15 +1013,15 @@ function processUpdatedSource(rawSource, options, analysis) {
1024
1013
  const ms = new (0, _magicstring2.default)(rawSource);
1025
1014
  const { targetPaths, jsTokenUpdater, ignoredPaths } = analysis;
1026
1015
  const replacementTokens = [];
1027
- for (const path2 of targetPaths) {
1028
- if (ignoredPaths.has(path2)) {
1016
+ for (const path of targetPaths) {
1017
+ if (ignoredPaths.has(path)) {
1029
1018
  continue;
1030
1019
  }
1031
1020
  const token = replaceHandleValue(
1032
- path2,
1021
+ path,
1033
1022
  {
1034
1023
  ...options,
1035
- needEscaped: path2.isStringLiteral() ? _nullishCoalesce(options.needEscaped, () => ( true)) : false
1024
+ needEscaped: path.isStringLiteral() ? _nullishCoalesce(options.needEscaped, () => ( true)) : false
1036
1025
  }
1037
1026
  );
1038
1027
  if (token) {
@@ -1081,11 +1070,13 @@ function jsHandler(rawSource, options) {
1081
1070
  // src/js/index.ts
1082
1071
  function createJsHandler(options) {
1083
1072
  const {
1084
- mangleContext,
1085
1073
  arbitraryValues,
1086
1074
  escapeMap,
1087
1075
  jsPreserveClass,
1088
1076
  generateMap,
1077
+ needEscaped,
1078
+ alwaysEscape,
1079
+ unescapeUnicode,
1089
1080
  babelParserOptions,
1090
1081
  ignoreCallExpressionIdentifiers,
1091
1082
  ignoreTaggedTemplateExpressionIdentifiers,
@@ -1102,9 +1093,11 @@ function createJsHandler(options) {
1102
1093
  classNameSet,
1103
1094
  escapeMap,
1104
1095
  arbitraryValues,
1105
- mangleContext,
1106
1096
  jsPreserveClass,
1107
1097
  generateMap,
1098
+ needEscaped,
1099
+ alwaysEscape,
1100
+ unescapeUnicode,
1108
1101
  babelParserOptions,
1109
1102
  ignoreCallExpressionIdentifiers,
1110
1103
  ignoreTaggedTemplateExpressionIdentifiers,
@@ -1284,18 +1277,17 @@ function generateCode(match, options = {}) {
1284
1277
  const ast = _parser.parseExpression.call(void 0, match);
1285
1278
  const jsTokenUpdater = new JsTokenUpdater();
1286
1279
  traverse(ast, {
1287
- StringLiteral(path2) {
1288
- if (t.isMemberExpression(path2.parent)) {
1280
+ StringLiteral(path) {
1281
+ if (t.isMemberExpression(path.parent)) {
1289
1282
  return;
1290
1283
  }
1291
- if (t.isBinaryExpression(path2.parent) && (t.isConditionalExpression(_optionalChain([path2, 'access', _18 => _18.parentPath, 'optionalAccess', _19 => _19.parent])) || t.isLogicalExpression(_optionalChain([path2, 'access', _20 => _20.parentPath, 'optionalAccess', _21 => _21.parent])))) {
1284
+ if (t.isBinaryExpression(path.parent) && (t.isConditionalExpression(_optionalChain([path, 'access', _18 => _18.parentPath, 'optionalAccess', _19 => _19.parent])) || t.isLogicalExpression(_optionalChain([path, 'access', _20 => _20.parentPath, 'optionalAccess', _21 => _21.parent])))) {
1292
1285
  return;
1293
1286
  }
1294
1287
  jsTokenUpdater.addToken(
1295
1288
  replaceHandleValue(
1296
- path2,
1289
+ path,
1297
1290
  {
1298
- mangleContext: options.mangleContext,
1299
1291
  escapeMap: options.escapeMap,
1300
1292
  classNameSet: options.runtimeSet,
1301
1293
  needEscaped: true,
@@ -1319,10 +1311,9 @@ function handleEachClassFragment(ms, tokens, options = {}) {
1319
1311
  if (token.start > previousEnd) {
1320
1312
  const gap = ms.slice(previousEnd, token.start);
1321
1313
  if (isAllWhitespace(gap)) {
1322
- ms.update(previousEnd, token.start, _chunkPLMJW644js.replaceWxml.call(void 0, gap, {
1314
+ ms.update(previousEnd, token.start, _chunkDWAEHRHNjs.replaceWxml.call(void 0, gap, {
1323
1315
  keepEOL: false,
1324
1316
  escapeMap: options.escapeMap,
1325
- mangleContext: options.mangleContext,
1326
1317
  ignoreHead: true
1327
1318
  }));
1328
1319
  }
@@ -1331,10 +1322,9 @@ function handleEachClassFragment(ms, tokens, options = {}) {
1331
1322
  if (token.expressions.length > 0) {
1332
1323
  for (const exp of token.expressions) {
1333
1324
  if (exp.start > token.start && p < exp.start) {
1334
- ms.update(p, exp.start, _chunkPLMJW644js.replaceWxml.call(void 0, ms.slice(p, exp.start), {
1325
+ ms.update(p, exp.start, _chunkDWAEHRHNjs.replaceWxml.call(void 0, ms.slice(p, exp.start), {
1335
1326
  keepEOL: true,
1336
1327
  escapeMap: options.escapeMap,
1337
- mangleContext: options.mangleContext,
1338
1328
  // 首的str才会被转译
1339
1329
  // example: 2xl:xx 2x{{y}}
1340
1330
  ignoreHead: p > 0
@@ -1345,18 +1335,16 @@ function handleEachClassFragment(ms, tokens, options = {}) {
1345
1335
  p = exp.end;
1346
1336
  }
1347
1337
  if (token.end > p) {
1348
- ms.update(p, token.end, _chunkPLMJW644js.replaceWxml.call(void 0, ms.slice(p, token.end), {
1338
+ ms.update(p, token.end, _chunkDWAEHRHNjs.replaceWxml.call(void 0, ms.slice(p, token.end), {
1349
1339
  keepEOL: false,
1350
1340
  escapeMap: options.escapeMap,
1351
- mangleContext: options.mangleContext,
1352
1341
  ignoreHead: true
1353
1342
  }));
1354
1343
  }
1355
1344
  } else {
1356
- ms.update(token.start, token.end, _chunkPLMJW644js.replaceWxml.call(void 0, token.value, {
1345
+ ms.update(token.start, token.end, _chunkDWAEHRHNjs.replaceWxml.call(void 0, token.value, {
1357
1346
  keepEOL: false,
1358
1347
  escapeMap: options.escapeMap,
1359
- mangleContext: options.mangleContext,
1360
1348
  ignoreHead: false
1361
1349
  }));
1362
1350
  }
@@ -1367,10 +1355,9 @@ function handleEachClassFragment(ms, tokens, options = {}) {
1367
1355
  if (lastToken.end < ms.original.length) {
1368
1356
  const gap = ms.slice(lastToken.end, ms.original.length);
1369
1357
  if (isAllWhitespace(gap)) {
1370
- ms.update(lastToken.end, ms.original.length, _chunkPLMJW644js.replaceWxml.call(void 0, gap, {
1358
+ ms.update(lastToken.end, ms.original.length, _chunkDWAEHRHNjs.replaceWxml.call(void 0, gap, {
1371
1359
  keepEOL: false,
1372
1360
  escapeMap: options.escapeMap,
1373
- mangleContext: options.mangleContext,
1374
1361
  ignoreHead: true
1375
1362
  }));
1376
1363
  }
@@ -1527,7 +1514,7 @@ function createTemplateHandler(options = {}) {
1527
1514
  }
1528
1515
 
1529
1516
  // src/context/handlers.ts
1530
- function createHandlersFromContext(ctx, mangleContext, customAttributesEntities, cssCalcOptions) {
1517
+ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions) {
1531
1518
  const {
1532
1519
  cssPreflight,
1533
1520
  customRuleCallback,
@@ -1556,7 +1543,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
1556
1543
  customRuleCallback,
1557
1544
  cssPreflightRange,
1558
1545
  escapeMap,
1559
- mangleContext,
1560
1546
  cssChildCombinatorReplaceValue,
1561
1547
  injectAdditionalCssVarScope,
1562
1548
  cssSelectorReplacement,
@@ -1571,7 +1557,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
1571
1557
  });
1572
1558
  const jsHandler2 = createJsHandler({
1573
1559
  escapeMap,
1574
- mangleContext,
1575
1560
  arbitraryValues,
1576
1561
  jsPreserveClass,
1577
1562
  generateMap: true,
@@ -1583,7 +1568,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
1583
1568
  const templateHandler = createTemplateHandler({
1584
1569
  customAttributesEntities,
1585
1570
  escapeMap,
1586
- mangleContext,
1587
1571
  inlineWxs,
1588
1572
  jsHandler: jsHandler2,
1589
1573
  disabledDefaultTemplateHandler
@@ -1607,122 +1591,6 @@ function applyLoggerLevel(logLevel) {
1607
1591
  _logger.logger.level = _nullishCoalesce(loggerLevelMap[_nullishCoalesce(logLevel, () => ( "info"))], () => ( loggerLevelMap.info));
1608
1592
  }
1609
1593
 
1610
- // src/tailwindcss/index.ts
1611
- var _localpkg = require('local-pkg');
1612
-
1613
- // src/tailwindcss/patcher.ts
1614
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
1615
- var _process = require('process'); var _process2 = _interopRequireDefault(_process);
1616
-
1617
- var _shared = require('@weapp-tailwindcss/shared');
1618
- var _tailwindcsspatch = require('tailwindcss-patch');
1619
- function createFallbackTailwindcssPatcher() {
1620
- const packageInfo = {
1621
- name: "tailwindcss",
1622
- version: void 0,
1623
- rootPath: "",
1624
- packageJsonPath: "",
1625
- packageJson: {}
1626
- };
1627
- return {
1628
- packageInfo,
1629
- majorVersion: 0,
1630
- patch() {
1631
- },
1632
- async getClassSet() {
1633
- return /* @__PURE__ */ new Set();
1634
- },
1635
- getClassSetV3() {
1636
- return /* @__PURE__ */ new Set();
1637
- },
1638
- async extract(_options) {
1639
- const classSet = /* @__PURE__ */ new Set();
1640
- return {
1641
- classList: [],
1642
- classSet
1643
- };
1644
- }
1645
- };
1646
- }
1647
- var hasLoggedMissingTailwind = false;
1648
- function createTailwindcssPatcher(options) {
1649
- const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
1650
- const cache = {};
1651
- if (cacheDir) {
1652
- if (_path2.default.isAbsolute(cacheDir)) {
1653
- cache.dir = cacheDir;
1654
- } else if (basedir) {
1655
- cache.dir = _path2.default.resolve(basedir, cacheDir);
1656
- } else {
1657
- cache.dir = _path2.default.resolve(_process2.default.cwd(), cacheDir);
1658
- }
1659
- }
1660
- const resolvedOptions = _shared.defuOverrideArray.call(void 0,
1661
- tailwindcssPatcherOptions,
1662
- {
1663
- cache,
1664
- patch: {
1665
- basedir,
1666
- applyPatches: {
1667
- exportContext: true,
1668
- extendLengthUnits: supportCustomLengthUnitsPatch
1669
- },
1670
- tailwindcss,
1671
- resolve: {
1672
- paths: [
1673
- _chunkNHB7NFQCjs.importMetaUrl
1674
- ]
1675
- }
1676
- }
1677
- }
1678
- );
1679
- try {
1680
- return new (0, _tailwindcsspatch.TailwindcssPatcher)(resolvedOptions);
1681
- } catch (error) {
1682
- if (error instanceof Error && /tailwindcss not found/i.test(error.message)) {
1683
- if (!hasLoggedMissingTailwind) {
1684
- _logger.logger.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
1685
- hasLoggedMissingTailwind = true;
1686
- }
1687
- return createFallbackTailwindcssPatcher();
1688
- }
1689
- throw error;
1690
- }
1691
- }
1692
-
1693
- // src/context/tailwindcss.ts
1694
- function createTailwindcssPatcherFromContext(ctx) {
1695
- const {
1696
- tailwindcssBasedir,
1697
- supportCustomLengthUnitsPatch,
1698
- tailwindcss,
1699
- tailwindcssPatcherOptions,
1700
- cssEntries,
1701
- appType
1702
- } = ctx;
1703
- const defaultTailwindcssConfig = {
1704
- v4: {
1705
- base: tailwindcssBasedir,
1706
- cssEntries
1707
- }
1708
- };
1709
- if (_optionalChain([cssEntries, 'optionalAccess', _22 => _22.length]) && (tailwindcss == null || tailwindcss.version == null)) {
1710
- defaultTailwindcssConfig.version = 4;
1711
- }
1712
- return createTailwindcssPatcher(
1713
- {
1714
- basedir: tailwindcssBasedir,
1715
- cacheDir: appType === "mpx" ? "node_modules/tailwindcss-patch/.cache" : void 0,
1716
- supportCustomLengthUnitsPatch: _nullishCoalesce(supportCustomLengthUnitsPatch, () => ( true)),
1717
- tailwindcss: _chunkUW3WHSZ5js.defuOverrideArray.call(void 0,
1718
- tailwindcss,
1719
- defaultTailwindcssConfig
1720
- ),
1721
- tailwindcssPatcherOptions
1722
- }
1723
- );
1724
- }
1725
-
1726
1594
  // src/context/index.ts
1727
1595
  var DEFAULT_SPACING_VARIABLE = "--spacing";
1728
1596
  function matchesSpacingToken(token) {
@@ -1762,13 +1630,13 @@ function ensureSpacingIncluded(value) {
1762
1630
  function getCompilerContext(opts) {
1763
1631
  const ctx = _chunkUW3WHSZ5js.defuOverrideArray.call(void 0,
1764
1632
  opts,
1765
- _chunkFOSGDQZ7js.getDefaultOptions.call(void 0, ),
1633
+ _chunkI7FYDXN6js.getDefaultOptions.call(void 0, ),
1766
1634
  {}
1767
1635
  );
1768
1636
  ctx.escapeMap = ctx.customReplaceDictionary;
1769
1637
  applyLoggerLevel(ctx.logLevel);
1770
- const twPatcher = createTailwindcssPatcherFromContext(ctx);
1771
- if (_optionalChain([twPatcher, 'access', _23 => _23.packageInfo, 'optionalAccess', _24 => _24.version])) {
1638
+ const twPatcher = _chunkAXLRUW5Hjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
1639
+ if (_optionalChain([twPatcher, 'access', _22 => _22.packageInfo, 'optionalAccess', _23 => _23.version])) {
1772
1640
  _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)))}`);
1773
1641
  } else {
1774
1642
  _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`);
@@ -1779,18 +1647,14 @@ function getCompilerContext(opts) {
1779
1647
  }
1780
1648
  ctx.cssCalc = cssCalcOptions;
1781
1649
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
1782
- const { initMangle, mangleContext, setMangleRuntimeSet } = _mangle.useMangleStore.call(void 0, );
1783
- initMangle(ctx.mangle);
1784
1650
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
1785
1651
  ctx,
1786
- mangleContext,
1787
1652
  customAttributesEntities,
1788
1653
  cssCalcOptions
1789
1654
  );
1790
1655
  ctx.styleHandler = styleHandler;
1791
1656
  ctx.jsHandler = jsHandler2;
1792
1657
  ctx.templateHandler = templateHandler;
1793
- ctx.setMangleRuntimeSet = setMangleRuntimeSet;
1794
1658
  ctx.cache = initializeCache(ctx.cache);
1795
1659
  ctx.twPatcher = twPatcher;
1796
1660
  return ctx;
@@ -1,13 +1,3 @@
1
- // src/debug/index.ts
2
- import _createDebug from "debug";
3
- var _debug = _createDebug("weapp-tw");
4
- function createDebug(prefix) {
5
- function debug(formatter, ...args) {
6
- return _debug((prefix ?? "") + formatter, ...args);
7
- }
8
- return debug;
9
- }
10
-
11
1
  // src/bundlers/shared/cache.ts
12
2
  async function processCachedTask({
13
3
  cache,
@@ -38,6 +28,5 @@ async function processCachedTask({
38
28
  }
39
29
 
40
30
  export {
41
- createDebug,
42
31
  processCachedTask
43
32
  };