weapp-tailwindcss 3.2.1 → 3.3.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 (58) hide show
  1. package/dist/bundlers/vite/index.d.ts +1 -1
  2. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +1 -1
  3. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  4. package/dist/cli.js +12 -11
  5. package/dist/cli.mjs +6 -6
  6. package/dist/{constants-D-YMDg7M.js → constants-CFM1J-h1.js} +3 -3
  7. package/dist/{constants-CcqTvLgQ.mjs → constants-Dy2Dd3Fz.mjs} +3 -3
  8. package/dist/core.d.ts +1 -1
  9. package/dist/core.js +12 -13
  10. package/dist/core.mjs +12 -13
  11. package/dist/css-macro/index.js +2 -2
  12. package/dist/css-macro/index.mjs +2 -2
  13. package/dist/css-macro/postcss.js +8 -8
  14. package/dist/css-macro/postcss.mjs +8 -8
  15. package/dist/{defaults-DOGbAFEj.mjs → defaults-BDivGN-J.mjs} +10 -10
  16. package/dist/{defaults-CGBcgdIr.js → defaults-z7wUEh47.js} +10 -10
  17. package/dist/defaults.js +1 -1
  18. package/dist/defaults.mjs +1 -1
  19. package/dist/extractors/split.d.ts +1 -1
  20. package/dist/gulp.js +7 -5
  21. package/dist/gulp.mjs +7 -5
  22. package/dist/{index-UGtfFwsf.mjs → index-BMv1aBKz.mjs} +13 -16
  23. package/dist/{index-DC60ES8u.mjs → index-BPzIdybK.mjs} +91 -91
  24. package/dist/{index-EnQF5WiI.mjs → index-Bm-88xa7.mjs} +14 -16
  25. package/dist/{index-iiM-deHl.js → index-CeRMFNvT.js} +13 -16
  26. package/dist/{index-6BUjj8Rl.js → index-DwZHOkK3.js} +91 -91
  27. package/dist/{index-BpY7tq3j.js → index-oneQz6yy.js} +20 -22
  28. package/dist/index.js +9 -7
  29. package/dist/index.mjs +9 -7
  30. package/dist/js/handlers.d.ts +1 -1
  31. package/dist/mangle/index.d.ts +1 -1
  32. package/dist/{options-BjZGMFOk.js → options-DCor-e5I.js} +80 -74
  33. package/dist/{options-D1IYbX_E.mjs → options-SmfRHxH0.mjs} +82 -75
  34. package/dist/postcss/plugins/index.d.ts +2 -2
  35. package/dist/postcss/preflight.d.ts +1 -1
  36. package/dist/postcss/selectorParser.d.ts +1 -1
  37. package/dist/postcss/shared.d.ts +1 -1
  38. package/dist/postcss.js +2 -2
  39. package/dist/postcss.mjs +2 -2
  40. package/dist/replace.d.ts +1 -1
  41. package/dist/replace.js +3 -3
  42. package/dist/replace.mjs +3 -3
  43. package/dist/{shared-BX0VV-pr.mjs → shared-DbJl6i6a.mjs} +2 -2
  44. package/dist/{shared-BDew1Ric.js → shared-hzYeE1wX.js} +2 -2
  45. package/dist/tailwindcss/patcher.d.ts +4 -3
  46. package/dist/types.d.ts +7 -5
  47. package/dist/utils.d.ts +1 -1
  48. package/dist/{v5-C6FTqEeL.mjs → v5-CQUeTJ2W.mjs} +16 -19
  49. package/dist/{v5-DA4DSMKO.js → v5-ea_QoULz.js} +16 -19
  50. package/dist/vite.js +6 -5
  51. package/dist/vite.mjs +6 -5
  52. package/dist/webpack.js +6 -5
  53. package/dist/webpack.mjs +6 -5
  54. package/dist/webpack4.js +17 -19
  55. package/dist/webpack4.mjs +17 -19
  56. package/dist/wxml/shared.d.ts +1 -1
  57. package/dist/wxml/utils.d.ts +2 -2
  58. package/package.json +80 -78
@@ -8,13 +8,14 @@ var escape = require('@ast-core/escape');
8
8
  var _babelGenerate = require('@babel/generator');
9
9
  var _babelTraverse = require('@babel/traverse');
10
10
  var parser = require('@babel/parser');
11
- var defaults = require('./defaults-CGBcgdIr.js');
11
+ var defaults = require('./defaults-z7wUEh47.js');
12
12
  var t = require('@babel/types');
13
13
  var htmlparser2 = require('htmlparser2');
14
14
  var postcss = require('postcss');
15
- var index = require('./index-6BUjj8Rl.js');
15
+ var index = require('./index-DwZHOkK3.js');
16
16
  var path = require('node:path');
17
17
  var fs = require('node:fs');
18
+ require('node:process');
18
19
  var semver = require('semver');
19
20
  var tailwindcssPatch = require('tailwindcss-patch');
20
21
  var shared = require('@tailwindcss-mangle/shared');
@@ -86,16 +87,16 @@ const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
86
87
  function isValidSelector(selector = '') {
87
88
  return validateFilterRE.test(selector);
88
89
  }
89
- const splitCode = (code, allowDoubleQuotes = false) => {
90
+ function splitCode(code, allowDoubleQuotes = false) {
90
91
  const splitter = allowDoubleQuotes ? /\s+/ : /\s+|"/;
91
- return code.split(splitter).filter((element) => isValidSelector(element));
92
- };
92
+ return code.split(splitter).filter(element => isValidSelector(element));
93
+ }
93
94
 
94
95
  function decodeUnicode(s) {
95
96
  return unescape(s.replaceAll(/\\(u[\dA-Fa-f]{4})/gm, '%$1'));
96
97
  }
97
98
  function replaceHandleValue(str, node, options, ms, offset = 0) {
98
- const { classNameSet: set, escapeMap, mangleContext: ctx, needEscaped = false, jsPreserveClass, arbitraryValues, always, unescapeUnicode } = options;
99
+ const { classNameSet: set, escapeMap, mangleContext: ctx, needEscaped = false, jsPreserveClass, arbitraryValues, always, unescapeUnicode, } = options;
99
100
  const allowDoubleQuotes = arbitraryValues === null || arbitraryValues === void 0 ? void 0 : arbitraryValues.allowDoubleQuotes;
100
101
  const arr = splitCode(str, allowDoubleQuotes);
101
102
  let rawStr = str;
@@ -111,15 +112,15 @@ function replaceHandleValue(str, node, options, ms, offset = 0) {
111
112
  if (always || (set && set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v)))) {
112
113
  let ignoreFlag = false;
113
114
  if (Array.isArray(node.leadingComments)) {
114
- ignoreFlag =
115
- node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
115
+ ignoreFlag
116
+ = node.leadingComments.findIndex(x => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
116
117
  }
117
118
  if (!ignoreFlag) {
118
119
  if (ctx) {
119
120
  rawStr = ctx.jsHandler(rawStr);
120
121
  }
121
122
  rawStr = rawStr.replace(new RegExp(regex.escapeStringRegexp(v)), replace.replaceJs(v, {
122
- escapeMap
123
+ escapeMap,
123
124
  }));
124
125
  }
125
126
  }
@@ -169,7 +170,7 @@ function astGrepUpdateString(ast, options, ms) {
169
170
  const text = node.text();
170
171
  replaceHandleValue(text.slice(1, -1), {
171
172
  end: range.end.index - 1,
172
- start: range.start.index + 1
173
+ start: range.start.index + 1,
173
174
  }, Object.assign(Object.assign({}, options), { unescapeUnicode: true }), ms, 0);
174
175
  }
175
176
  const templateNodes = ast.findAll(js.kind('template_string'));
@@ -180,7 +181,7 @@ function astGrepUpdateString(ast, options, ms) {
180
181
  const text = fragment.text();
181
182
  replaceHandleValue(text, {
182
183
  end: range.end.index,
183
- start: range.start.index
184
+ start: range.start.index,
184
185
  }, Object.assign(Object.assign({}, options), { unescapeUnicode: true }), ms, 0);
185
186
  }
186
187
  }
@@ -195,7 +196,7 @@ function jsHandler(rawSource, options) {
195
196
  catch (error) {
196
197
  return {
197
198
  code: rawSource,
198
- error: error
199
+ error: error,
199
200
  };
200
201
  }
201
202
  const traverseOptions = {
@@ -207,7 +208,7 @@ function jsHandler(rawSource, options) {
207
208
  }
208
209
  const n = p.node;
209
210
  replaceHandleValue(n.value, n, Object.assign(Object.assign({}, options), { needEscaped: (_a = options.needEscaped) !== null && _a !== void 0 ? _a : true }), ms, 1);
210
- }
211
+ },
211
212
  },
212
213
  TemplateElement: {
213
214
  enter(p) {
@@ -216,7 +217,7 @@ function jsHandler(rawSource, options) {
216
217
  }
217
218
  const n = p.node;
218
219
  replaceHandleValue(n.value.raw, n, Object.assign(Object.assign({}, options), { needEscaped: false }), ms, 0);
219
- }
220
+ },
220
221
  },
221
222
  CallExpression: {
222
223
  enter(p) {
@@ -236,7 +237,7 @@ function jsHandler(rawSource, options) {
236
237
  }
237
238
  }
238
239
  }
239
- }
240
+ },
240
241
  },
241
242
  TemplateElement: {
242
243
  enter(s) {
@@ -252,16 +253,16 @@ function jsHandler(rawSource, options) {
252
253
  }
253
254
  }
254
255
  }
255
- }
256
- }
256
+ },
257
+ },
257
258
  });
258
259
  }
259
- }
260
- }
260
+ },
261
+ },
261
262
  };
262
263
  traverse(ast, traverseOptions);
263
264
  return {
264
- code: ms.toString()
265
+ code: ms.toString(),
265
266
  };
266
267
  }
267
268
  function jsHandlerAsync(rawSource, options) {
@@ -275,12 +276,12 @@ function jsHandlerAsync(rawSource, options) {
275
276
  }
276
277
  catch (_a) {
277
278
  return {
278
- code: rawSource
279
+ code: rawSource,
279
280
  };
280
281
  }
281
282
  yield astGrepUpdateString(ast, options, ms);
282
283
  return {
283
- code: ms.toString()
284
+ code: ms.toString(),
284
285
  };
285
286
  });
286
287
  }
@@ -295,7 +296,7 @@ function createJsHandler(options) {
295
296
  jsPreserveClass,
296
297
  generateMap,
297
298
  jsAstTool,
298
- babelParserOptions
299
+ babelParserOptions,
299
300
  });
300
301
  if (opts.jsAstTool === 'ast-grep') {
301
302
  return jsHandlerAsync(rawSource, opts);
@@ -323,10 +324,10 @@ function generateCode(match, options = {}) {
323
324
  escapeMap: options.escapeMap,
324
325
  classNameSet: options.runtimeSet,
325
326
  needEscaped: true,
326
- always: true
327
+ always: true,
327
328
  }, ms, 1);
328
329
  },
329
- noScope: true
330
+ noScope: true,
330
331
  });
331
332
  return ms.toString();
332
333
  }
@@ -343,7 +344,7 @@ function extract(original, reg) {
343
344
  sources.push({
344
345
  start,
345
346
  end,
346
- raw: match[1]
347
+ raw: match[1],
347
348
  });
348
349
  match = reg.exec(original);
349
350
  }
@@ -363,7 +364,7 @@ function templateReplacer(original, options = {}) {
363
364
  resultArray.push(replace.replaceJs(before, {
364
365
  keepEOL: true,
365
366
  escapeMap: options.escapeMap,
366
- mangleContext: options.mangleContext
367
+ mangleContext: options.mangleContext,
367
368
  }));
368
369
  p = m.start;
369
370
  if (m.raw.trim().length > 0) {
@@ -381,7 +382,7 @@ function templateReplacer(original, options = {}) {
381
382
  resultArray.push(replace.replaceJs(after, {
382
383
  keepEOL: true,
383
384
  escapeMap: options.escapeMap,
384
- mangleContext: options.mangleContext
385
+ mangleContext: options.mangleContext,
385
386
  }));
386
387
  }
387
388
  }
@@ -391,7 +392,7 @@ function templateReplacer(original, options = {}) {
391
392
  return replace.replaceJs(original, {
392
393
  keepEOL: false,
393
394
  escapeMap: options.escapeMap,
394
- mangleContext: options.mangleContext
395
+ mangleContext: options.mangleContext,
395
396
  });
396
397
  }
397
398
  }
@@ -418,7 +419,7 @@ function isPropsMatch(props, attr) {
418
419
  }
419
420
  function customTemplateHandler(rawSource, options) {
420
421
  return __awaiter(this, void 0, void 0, function* () {
421
- const { customAttributesEntities = [], disabledDefaultTemplateHandler, inlineWxs, runtimeSet, jsHandler } = options !== null && options !== void 0 ? options : {};
422
+ const { customAttributesEntities = [], disabledDefaultTemplateHandler, inlineWxs, runtimeSet, jsHandler, } = options !== null && options !== void 0 ? options : {};
422
423
  const s = new MagicString__default["default"](rawSource);
423
424
  let tag = '';
424
425
  const wxsArray = [];
@@ -431,8 +432,8 @@ function customTemplateHandler(rawSource, options) {
431
432
  function update() {
432
433
  s.update(parser.startIndex + name.length + 2, parser.endIndex - 1, templateReplacer(value, Object.assign(Object.assign({}, options), { quote })));
433
434
  }
434
- if (!disabledDefaultTemplateHandler &&
435
- (name === 'class' || name === 'hover-class' || name === 'virtualHostClass' || name === 'virtualhostclass')) {
435
+ if (!disabledDefaultTemplateHandler
436
+ && (name === 'class' || name === 'hover-class' || name === 'virtualHostClass' || name === 'virtualhostclass')) {
436
437
  update();
437
438
  }
438
439
  for (const [t, props] of customAttributesEntities) {
@@ -457,15 +458,15 @@ function customTemplateHandler(rawSource, options) {
457
458
  wxsArray.push({
458
459
  data,
459
460
  endIndex: parser.endIndex + 1,
460
- startIndex: parser.startIndex
461
+ startIndex: parser.startIndex,
461
462
  });
462
463
  }
463
464
  },
464
465
  onclosetag() {
465
466
  tag = '';
466
- }
467
+ },
467
468
  }, {
468
- xmlMode: true
469
+ xmlMode: true,
469
470
  });
470
471
  parser.write(s.original);
471
472
  parser.end();
@@ -487,7 +488,7 @@ function styleHandler(rawSource, options) {
487
488
  var _a, _b;
488
489
  return (yield postcss__default["default"](index.getPlugins(options))
489
490
  .process(rawSource, (_b = (_a = options.postcssOptions) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {
490
- from: undefined
491
+ from: undefined,
491
492
  })
492
493
  .async()).css;
493
494
  });
@@ -498,7 +499,7 @@ function createStyleHandler(options) {
498
499
  };
499
500
  }
500
501
 
501
- const createInjectPreflight = (options) => {
502
+ function createInjectPreflight(options) {
502
503
  const result = [];
503
504
  if (options && typeof options === 'object') {
504
505
  const entries = Object.entries(options);
@@ -506,7 +507,7 @@ const createInjectPreflight = (options) => {
506
507
  if (value !== false) {
507
508
  result.push({
508
509
  prop,
509
- value: value.toString()
510
+ value: value.toString(),
510
511
  });
511
512
  }
512
513
  }
@@ -514,7 +515,7 @@ const createInjectPreflight = (options) => {
514
515
  return () => {
515
516
  return result;
516
517
  };
517
- };
518
+ }
518
519
 
519
520
  function findAstNode(content, options) {
520
521
  const DOPTS = options.dangerousOptions;
@@ -523,11 +524,11 @@ function findAstNode(content, options) {
523
524
  let changed = false;
524
525
  traverse(ast, {
525
526
  Identifier(path) {
526
- if (path.node.name === DOPTS.variableName &&
527
- t__namespace.isVariableDeclarator(path.parent) &&
528
- t__namespace.isArrayExpression(path.parent.init)) {
527
+ if (path.node.name === DOPTS.variableName
528
+ && t__namespace.isVariableDeclarator(path.parent)
529
+ && t__namespace.isArrayExpression(path.parent.init)) {
529
530
  arrayRef = path.parent.init;
530
- const set = new Set(path.parent.init.elements.map((x) => x.value));
531
+ const set = new Set(path.parent.init.elements.map(x => x.value));
531
532
  for (let i = 0; i < options.units.length; i++) {
532
533
  const unit = options.units[i];
533
534
  if (!set.has(unit)) {
@@ -535,24 +536,24 @@ function findAstNode(content, options) {
535
536
  if (t__namespace.isStringLiteral(x)) {
536
537
  return {
537
538
  type: x === null || x === void 0 ? void 0 : x.type,
538
- value: x === null || x === void 0 ? void 0 : x.value
539
+ value: x === null || x === void 0 ? void 0 : x.value,
539
540
  };
540
541
  }
541
542
  return x;
542
543
  });
543
544
  path.parent.init.elements.push({
544
545
  type: 'StringLiteral',
545
- value: unit
546
+ value: unit,
546
547
  });
547
548
  changed = true;
548
549
  }
549
550
  }
550
551
  }
551
- }
552
+ },
552
553
  });
553
554
  return {
554
555
  arrayRef,
555
- changed
556
+ changed,
556
557
  };
557
558
  }
558
559
 
@@ -561,7 +562,7 @@ function getInstalledPkgJsonPath(options) {
561
562
  try {
562
563
  const tmpJsonPath = tailwindcssPatch.requireResolve(`${dangerousOptions.packageName}/package.json`, {
563
564
  paths: options.paths,
564
- basedir: options.basedir
565
+ basedir: options.basedir,
565
566
  });
566
567
  return tmpJsonPath;
567
568
  }
@@ -580,7 +581,7 @@ function createPatch(options) {
580
581
  return internalPatch(getInstalledPkgJsonPath(options), options);
581
582
  }
582
583
  catch (error) {
583
- console.warn(`patch tailwindcss failed:` + error.message);
584
+ console.warn(`patch tailwindcss failed: ${error.message}`);
584
585
  }
585
586
  };
586
587
  }
@@ -590,14 +591,14 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
590
591
  const DOPTS = dangerousOptions;
591
592
  const dataTypesFilePath = path__default["default"].resolve(rootDir, DOPTS.lengthUnitsFilePath);
592
593
  const dataTypesFileContent = fs__default["default"].readFileSync(dataTypesFilePath, {
593
- encoding: 'utf8'
594
+ encoding: 'utf8',
594
595
  });
595
596
  const { arrayRef, changed } = findAstNode(dataTypesFileContent, options);
596
597
  if (arrayRef && changed) {
597
598
  const { code } = generate(arrayRef, {
598
599
  jsescOption: {
599
- quotes: 'single'
600
- }
600
+ quotes: 'single',
601
+ },
601
602
  });
602
603
  if (arrayRef.start && arrayRef.end) {
603
604
  const prev = dataTypesFileContent.slice(0, arrayRef.start);
@@ -605,7 +606,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
605
606
  const newCode = prev + code + next;
606
607
  if (DOPTS.overwrite) {
607
608
  fs__default["default"].writeFileSync((_a = DOPTS.destPath) !== null && _a !== void 0 ? _a : dataTypesFilePath, newCode, {
608
- encoding: 'utf8'
609
+ encoding: 'utf8',
609
610
  });
610
611
  console.log('patch tailwindcss for custom length unit successfully!');
611
612
  }
@@ -613,7 +614,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
613
614
  return code;
614
615
  }
615
616
  }
616
- function internalPatch(pkgJsonPath, options, overwrite = true) {
617
+ function internalPatch(pkgJsonPath, options) {
617
618
  if (pkgJsonPath) {
618
619
  const pkgJson = JSON.parse(fs__default["default"].readFileSync(pkgJsonPath, 'utf8'));
619
620
  const dangerousOptions = options.dangerousOptions;
@@ -621,17 +622,18 @@ function internalPatch(pkgJsonPath, options, overwrite = true) {
621
622
  if (semver.gte(version, dangerousOptions.gteVersion)) {
622
623
  const rootDir = path__default["default"].dirname(pkgJsonPath);
623
624
  const dataTypes = monkeyPatchForSupportingCustomUnit(rootDir, options);
624
- const result = tailwindcssPatch.monkeyPatchForExposingContext(rootDir, {
625
- overwrite,
626
- version
627
- });
628
- return Object.assign(Object.assign({}, result), { dataTypes });
625
+ return {
626
+ dataTypes,
627
+ };
629
628
  }
630
629
  }
631
630
  }
632
- function createTailwindcssPatcher() {
631
+ function createTailwindcssPatcher(basedir) {
633
632
  return new tailwindcssPatch.TailwindcssPatcher({
634
- cache: true
633
+ cache: true,
634
+ patch: {
635
+ basedir,
636
+ },
635
637
  });
636
638
  }
637
639
 
@@ -645,7 +647,7 @@ const defaultMangleContext = {
645
647
  filter: shared.defaultMangleClassFilter,
646
648
  cssHandler: getSelf,
647
649
  jsHandler: getSelf,
648
- wxmlHandler: getSelf
650
+ wxmlHandler: getSelf,
649
651
  };
650
652
  function useMangleStore() {
651
653
  const ctx = Object.assign({}, defaultMangleContext);
@@ -668,7 +670,7 @@ function useMangleStore() {
668
670
  if (options === true) {
669
671
  options = {
670
672
  classGenerator: {},
671
- mangleClassFilter: shared.defaultMangleClassFilter
673
+ mangleClassFilter: shared.defaultMangleClassFilter,
672
674
  };
673
675
  }
674
676
  ctx.classGenerator = new shared.ClassGenerator(options.classGenerator);
@@ -697,7 +699,7 @@ function useMangleStore() {
697
699
  mangleContext: ctx,
698
700
  resetMangle,
699
701
  initMangle,
700
- setMangleRuntimeSet
702
+ setMangleRuntimeSet,
701
703
  };
702
704
  }
703
705
 
@@ -707,7 +709,7 @@ function createCache(options) {
707
709
  const instance = new lruCache.LRUCache({
708
710
  max: 1024,
709
711
  ttl: 0,
710
- ttlAutopurge: false
712
+ ttlAutopurge: false,
711
713
  });
712
714
  return {
713
715
  hashMap,
@@ -735,13 +737,13 @@ function createCache(options) {
735
737
  if (hit) {
736
738
  this.setHashValue(key, {
737
739
  changed: hash !== hit.hash,
738
- hash
740
+ hash,
739
741
  });
740
742
  }
741
743
  else {
742
744
  this.setHashValue(key, {
743
745
  changed: true,
744
- hash
746
+ hash,
745
747
  });
746
748
  }
747
749
  return this;
@@ -771,14 +773,14 @@ function createCache(options) {
771
773
  }
772
774
  }
773
775
  });
774
- }
776
+ },
775
777
  };
776
778
  }
777
779
 
778
780
  function getOptions(opts) {
779
781
  const result = defaults.defuOverrideArray(opts, defaults.defaultOptions, {});
780
782
  result.escapeMap = result.customReplaceDictionary;
781
- const { cssPreflight, customRuleCallback, cssPreflightRange, customAttributes, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, cssSelectorReplacement, rem2rpx, cache, jsAstTool, babelParserOptions, postcssOptions, cssRemoveHoverPseudoClass, escapeMap, mangle } = result;
783
+ const { cssPreflight, customRuleCallback, cssPreflightRange, customAttributes, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, cssSelectorReplacement, rem2rpx, cache, jsAstTool, babelParserOptions, postcssOptions, cssRemoveHoverPseudoClass, escapeMap, mangle, tailwindcssBasedir, } = result;
782
784
  const cssInjectPreflight = createInjectPreflight(cssPreflight);
783
785
  const customAttributesEntities = defaults.isMap(customAttributes)
784
786
  ? [...customAttributes.entries()]
@@ -796,7 +798,7 @@ function getOptions(opts) {
796
798
  cssSelectorReplacement,
797
799
  rem2rpx,
798
800
  postcssOptions,
799
- cssRemoveHoverPseudoClass
801
+ cssRemoveHoverPseudoClass,
800
802
  });
801
803
  const jsHandler = createJsHandler({
802
804
  escapeMap,
@@ -805,7 +807,7 @@ function getOptions(opts) {
805
807
  jsPreserveClass,
806
808
  generateMap: true,
807
809
  jsAstTool,
808
- babelParserOptions
810
+ babelParserOptions,
809
811
  });
810
812
  const templateHandler = createTemplateHandler({
811
813
  customAttributesEntities,
@@ -813,18 +815,22 @@ function getOptions(opts) {
813
815
  mangleContext,
814
816
  inlineWxs,
815
817
  jsHandler,
816
- disabledDefaultTemplateHandler
818
+ disabledDefaultTemplateHandler,
817
819
  });
818
820
  result.styleHandler = styleHandler;
819
821
  result.jsHandler = jsHandler;
820
822
  result.templateHandler = templateHandler;
821
- result.patch = createPatch(supportCustomLengthUnitsPatch);
823
+ const twPatcher = createTailwindcssPatcher(tailwindcssBasedir);
824
+ result.patch = () => {
825
+ createPatch(supportCustomLengthUnitsPatch)();
826
+ twPatcher.patch();
827
+ };
822
828
  result.setMangleRuntimeSet = setMangleRuntimeSet;
823
829
  result.cache = cache === undefined || typeof cache === 'boolean' ? createCache(cache) : cache;
830
+ result.twPatcher = twPatcher;
824
831
  return result;
825
832
  }
826
833
 
827
834
  exports.__awaiter = __awaiter;
828
- exports.createPatch = createPatch;
829
835
  exports.createTailwindcssPatcher = createTailwindcssPatcher;
830
836
  exports.getOptions = getOptions;