weapp-tailwindcss 4.5.2 → 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 (73) hide show
  1. package/dist/{chunk-FOUWGCIJ.js → chunk-7CGHD2TI.js} +17 -15
  2. package/dist/{chunk-L4AXTSIM.mjs → chunk-7PGHZOTU.mjs} +10 -30
  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-ZUH5ZA7D.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-CKTI35D3.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-TGTFIOJU.js → chunk-M6DWZX4H.js} +31 -11
  14. package/dist/{chunk-GGIH6WLF.mjs → chunk-MXVUK23K.mjs} +14 -12
  15. package/dist/{chunk-A3TJT6B6.js → chunk-OVDIACVK.js} +19 -39
  16. package/dist/{chunk-H4JTYYOI.mjs → chunk-RRHPTTCP.mjs} +0 -11
  17. package/dist/{chunk-WFZ73Q6S.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 -8
  22. package/dist/cli.mjs +11 -8
  23. package/dist/core.d.mts +0 -1
  24. package/dist/core.d.ts +0 -1
  25. package/dist/core.js +23 -12
  26. package/dist/core.mjs +21 -10
  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 -8
  42. package/dist/gulp.mjs +8 -7
  43. package/dist/index.d.mts +1 -2
  44. package/dist/index.d.ts +1 -2
  45. package/dist/index.js +11 -10
  46. package/dist/index.mjs +10 -9
  47. package/dist/postcss-html-transform.js +1 -1
  48. package/dist/postcss-html-transform.mjs +1 -1
  49. package/dist/presets.d.mts +0 -1
  50. package/dist/presets.d.ts +0 -1
  51. package/dist/presets.js +17 -23
  52. package/dist/presets.mjs +16 -22
  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 -8
  60. package/dist/vite.mjs +8 -7
  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 -8
  65. package/dist/webpack.mjs +8 -7
  66. package/dist/webpack4.d.mts +0 -1
  67. package/dist/webpack4.d.ts +0 -1
  68. package/dist/webpack4.js +21 -19
  69. package/dist/webpack4.mjs +17 -15
  70. package/package.json +7 -8
  71. package/dist/chunk-2NRTWL47.js +0 -43
  72. package/dist/chunk-KBR4YB6N.js +0 -178
  73. package/dist/chunk-S2WEN6NJ.mjs +0 -175
package/dist/presets.js CHANGED
@@ -3,11 +3,11 @@
3
3
  var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
4
 
5
5
 
6
- var _chunkKBR4YB6Njs = require('./chunk-KBR4YB6N.js');
6
+ var _chunkAXLRUW5Hjs = require('./chunk-AXLRUW5H.js');
7
7
 
8
8
 
9
9
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
10
- require('./chunk-NHB7NFQC.js');
10
+ require('./chunk-E5PXIHDN.js');
11
11
 
12
12
  // src/presets.ts
13
13
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
@@ -23,19 +23,16 @@ function uniAppX(options) {
23
23
  rem2rpx: options.rem2rpx,
24
24
  tailwindcssBasedir: options.base,
25
25
  tailwindcssPatcherOptions: {
26
- patch: {
26
+ cwd: options.base,
27
+ tailwind: {
27
28
  cwd: options.base,
28
29
  resolve: options.resolve,
29
- tailwindcss: {
30
- // @ts-ignore
31
- cwd: options.base,
32
- v3: {
33
- cwd: options.base
34
- },
35
- v4: {
36
- base: options.base,
37
- cssEntries: options.cssEntries
38
- }
30
+ v3: {
31
+ cwd: options.base
32
+ },
33
+ v4: {
34
+ base: options.base,
35
+ cssEntries: options.cssEntries
39
36
  }
40
37
  }
41
38
  },
@@ -59,7 +56,7 @@ function toCssEntries(entries) {
59
56
  return Array.isArray(entries) ? entries : [entries];
60
57
  }
61
58
  function hbuilderx(options = {}) {
62
- const baseDir = _chunkKBR4YB6Njs.resolveTailwindcssBasedir.call(void 0, options.base);
59
+ const baseDir = _chunkAXLRUW5Hjs.resolveTailwindcssBasedir.call(void 0, options.base);
63
60
  const cssEntries = toCssEntries(options.cssEntries);
64
61
  const tailwindConfig = {
65
62
  v2: {
@@ -85,19 +82,16 @@ function hbuilderx(options = {}) {
85
82
  tailwindConfig.version = 4;
86
83
  patchTailwindConfig.version = 4;
87
84
  }
88
- const patchOptions = {
89
- basedir: baseDir,
90
- cwd: baseDir,
91
- tailwindcss: patchTailwindConfig
92
- };
93
- if (options.resolve) {
94
- patchOptions.resolve = options.resolve;
95
- }
85
+ const resolvedTailwind = options.resolve ? {
86
+ ...patchTailwindConfig,
87
+ resolve: options.resolve
88
+ } : patchTailwindConfig;
96
89
  const preset = {
97
90
  tailwindcssBasedir: baseDir,
98
91
  tailwindcss: tailwindConfig,
99
92
  tailwindcssPatcherOptions: {
100
- patch: patchOptions
93
+ cwd: baseDir,
94
+ tailwind: resolvedTailwind
101
95
  }
102
96
  };
103
97
  if (options.rem2rpx !== void 0) {
package/dist/presets.mjs CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-PMF2CCKK.mjs";
4
4
  import {
5
5
  resolveTailwindcssBasedir
6
- } from "./chunk-S2WEN6NJ.mjs";
6
+ } from "./chunk-IY2OKZE6.mjs";
7
7
  import {
8
8
  defuOverrideArray
9
9
  } from "./chunk-ZNKIYZRQ.mjs";
10
- import "./chunk-FWIGQ4RY.mjs";
10
+ import "./chunk-KHILYAA4.mjs";
11
11
 
12
12
  // src/presets.ts
13
13
  import process from "process";
@@ -23,19 +23,16 @@ function uniAppX(options) {
23
23
  rem2rpx: options.rem2rpx,
24
24
  tailwindcssBasedir: options.base,
25
25
  tailwindcssPatcherOptions: {
26
- patch: {
26
+ cwd: options.base,
27
+ tailwind: {
27
28
  cwd: options.base,
28
29
  resolve: options.resolve,
29
- tailwindcss: {
30
- // @ts-ignore
31
- cwd: options.base,
32
- v3: {
33
- cwd: options.base
34
- },
35
- v4: {
36
- base: options.base,
37
- cssEntries: options.cssEntries
38
- }
30
+ v3: {
31
+ cwd: options.base
32
+ },
33
+ v4: {
34
+ base: options.base,
35
+ cssEntries: options.cssEntries
39
36
  }
40
37
  }
41
38
  },
@@ -85,19 +82,16 @@ function hbuilderx(options = {}) {
85
82
  tailwindConfig.version = 4;
86
83
  patchTailwindConfig.version = 4;
87
84
  }
88
- const patchOptions = {
89
- basedir: baseDir,
90
- cwd: baseDir,
91
- tailwindcss: patchTailwindConfig
92
- };
93
- if (options.resolve) {
94
- patchOptions.resolve = options.resolve;
95
- }
85
+ const resolvedTailwind = options.resolve ? {
86
+ ...patchTailwindConfig,
87
+ resolve: options.resolve
88
+ } : patchTailwindConfig;
96
89
  const preset = {
97
90
  tailwindcssBasedir: baseDir,
98
91
  tailwindcss: tailwindConfig,
99
92
  tailwindcssPatcherOptions: {
100
- patch: patchOptions
93
+ cwd: baseDir,
94
+ tailwind: resolvedTailwind
101
95
  }
102
96
  };
103
97
  if (options.rem2rpx !== void 0) {
package/dist/types.d.mts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { ParserOptions, ParseError } from '@babel/parser';
2
- import { IMangleOptions, IMangleScopeContext } from '@weapp-tailwindcss/mangle';
3
- export { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
4
2
  import { CssPreflightOptions, CssCalcOptions, Rem2rpxOptions, Px2rpxOptions, PresetEnvOptions, LoadedPostcssOptions, CustomRuleCallback, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
5
3
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
4
  import { SourceMap } from 'magic-string';
7
5
  import { Result, Root, Document } from 'postcss';
8
- import { PatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcherOptions, TailwindcssPatcher } from 'tailwindcss-patch';
6
+ import { TailwindcssPatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
9
7
  import { Buffer } from 'node:buffer';
10
8
  import { sources } from 'webpack';
11
9
  import { LRUCache } from 'lru-cache';
@@ -258,7 +256,7 @@ interface UserDefinedOptions {
258
256
  * @version `^4.0.0`
259
257
  * @group 0.重要配置
260
258
  */
261
- tailwindcss?: PatchOptions['tailwindcss'];
259
+ tailwindcss?: TailwindcssPatchOptions['tailwind'];
262
260
  /**
263
261
  * 指定 tailwindcss@4 的入口 CSS。
264
262
  *
@@ -499,7 +497,7 @@ interface UserDefinedOptions {
499
497
  *
500
498
  * @group 3.一般配置
501
499
  */
502
- tailwindcssPatcherOptions?: TailwindcssPatcherOptions;
500
+ tailwindcssPatcherOptions?: TailwindcssPatchOptions;
503
501
  /**
504
502
  * 控制命令行日志输出级别。
505
503
  *
@@ -521,17 +519,6 @@ interface UserDefinedOptions {
521
519
  * :::
522
520
  */
523
521
  jsAstTool?: 'babel' | 'ast-grep';
524
- /**
525
- * 是否对指定范围的类名执行压缩混淆。
526
- *
527
- * @group 4.即将废弃配置
528
- * @remarks
529
- * 默认关闭,可参考 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle) 获取完整配置。
530
- * :::danger
531
- * 此配置将在 `5.x` 中移除,功能已迁移至 [`tailwindcss-mangle`](https://github.com/sonofmagic/tailwindcss-mangle)。
532
- * :::
533
- */
534
- mangle?: boolean | IMangleOptions;
535
522
  /**
536
523
  * 自定义 PostCSS 规则的处理回调。
537
524
  *
@@ -542,11 +529,9 @@ interface UserDefinedOptions {
542
529
 
543
530
  type ItemOrItemArray<T> = T | T[];
544
531
 
532
+ type AsyncableMethod<T> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> | Awaited<R> : never;
533
+
545
534
  type AppType = 'uni-app' | 'uni-app-vite' | 'taro' | 'remax' | 'rax' | 'native' | 'kbone' | 'mpx' | 'weapp-vite';
546
- interface InternalCssSelectorReplacerOptions {
547
- mangleContext?: IMangleScopeContext;
548
- escapeMap?: Record<string, string>;
549
- }
550
535
  interface LinkedJsModuleResult {
551
536
  code: string;
552
537
  }
@@ -564,20 +549,17 @@ type ICustomAttributes = Record<string, ItemOrItemArray<string | RegExp>> | Map<
564
549
  type ICustomAttributesEntities = [string | RegExp, ItemOrItemArray<string | RegExp>][];
565
550
  interface TailwindcssPatcherLike {
566
551
  packageInfo: TailwindcssPatcher['packageInfo'];
567
- majorVersion?: number;
552
+ majorVersion?: TailwindcssPatcher['majorVersion'];
568
553
  patch: TailwindcssPatcher['patch'];
569
- getClassSet: TailwindcssPatcher['getClassSet'];
570
- getClassSetV3: TailwindcssPatcher['getClassSetV3'];
554
+ getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
555
+ getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
571
556
  extract: TailwindcssPatcher['extract'];
572
- cacheOptions?: TailwindcssPatcher['cacheOptions'];
573
- patchOptions?: TailwindcssPatcher['patchOptions'];
574
- rawOptions?: TailwindcssPatcher['rawOptions'];
557
+ options?: TailwindcssPatcher['options'];
575
558
  }
576
559
  interface IJsHandlerOptions {
577
560
  escapeMap?: Record<string, string>;
578
561
  classNameSet?: Set<string>;
579
562
  arbitraryValues?: IArbitraryValues;
580
- mangleContext?: IMangleScopeContext;
581
563
  jsPreserveClass?: (keyword: string) => boolean | undefined;
582
564
  needEscaped?: boolean;
583
565
  generateMap?: boolean;
@@ -624,7 +606,6 @@ interface ICommonReplaceOptions {
624
606
  interface ITemplateHandlerOptions extends ICommonReplaceOptions {
625
607
  customAttributesEntities?: ICustomAttributesEntities;
626
608
  escapeMap?: Record<string, string>;
627
- mangleContext?: IMangleScopeContext;
628
609
  inlineWxs?: boolean;
629
610
  jsHandler?: JsHandler;
630
611
  runtimeSet?: Set<string>;
@@ -639,7 +620,6 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
639
620
  jsHandler: JsHandler;
640
621
  escapeMap: Record<string, string>;
641
622
  customReplaceDictionary: Record<string, string>;
642
- setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
643
623
  cache: ICreateCacheReturnType;
644
624
  twPatcher: TailwindcssPatcherLike;
645
625
  }>;
@@ -677,4 +657,4 @@ interface JsModuleGraphOptions {
677
657
  maxDepth?: number;
678
658
  }
679
659
 
680
- export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
660
+ export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
package/dist/types.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { ParserOptions, ParseError } from '@babel/parser';
2
- import { IMangleOptions, IMangleScopeContext } from '@weapp-tailwindcss/mangle';
3
- export { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
4
2
  import { CssPreflightOptions, CssCalcOptions, Rem2rpxOptions, Px2rpxOptions, PresetEnvOptions, LoadedPostcssOptions, CustomRuleCallback, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
5
3
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
4
  import { SourceMap } from 'magic-string';
7
5
  import { Result, Root, Document } from 'postcss';
8
- import { PatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcherOptions, TailwindcssPatcher } from 'tailwindcss-patch';
6
+ import { TailwindcssPatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
9
7
  import { Buffer } from 'node:buffer';
10
8
  import { sources } from 'webpack';
11
9
  import { LRUCache } from 'lru-cache';
@@ -258,7 +256,7 @@ interface UserDefinedOptions {
258
256
  * @version `^4.0.0`
259
257
  * @group 0.重要配置
260
258
  */
261
- tailwindcss?: PatchOptions['tailwindcss'];
259
+ tailwindcss?: TailwindcssPatchOptions['tailwind'];
262
260
  /**
263
261
  * 指定 tailwindcss@4 的入口 CSS。
264
262
  *
@@ -499,7 +497,7 @@ interface UserDefinedOptions {
499
497
  *
500
498
  * @group 3.一般配置
501
499
  */
502
- tailwindcssPatcherOptions?: TailwindcssPatcherOptions;
500
+ tailwindcssPatcherOptions?: TailwindcssPatchOptions;
503
501
  /**
504
502
  * 控制命令行日志输出级别。
505
503
  *
@@ -521,17 +519,6 @@ interface UserDefinedOptions {
521
519
  * :::
522
520
  */
523
521
  jsAstTool?: 'babel' | 'ast-grep';
524
- /**
525
- * 是否对指定范围的类名执行压缩混淆。
526
- *
527
- * @group 4.即将废弃配置
528
- * @remarks
529
- * 默认关闭,可参考 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle) 获取完整配置。
530
- * :::danger
531
- * 此配置将在 `5.x` 中移除,功能已迁移至 [`tailwindcss-mangle`](https://github.com/sonofmagic/tailwindcss-mangle)。
532
- * :::
533
- */
534
- mangle?: boolean | IMangleOptions;
535
522
  /**
536
523
  * 自定义 PostCSS 规则的处理回调。
537
524
  *
@@ -542,11 +529,9 @@ interface UserDefinedOptions {
542
529
 
543
530
  type ItemOrItemArray<T> = T | T[];
544
531
 
532
+ type AsyncableMethod<T> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> | Awaited<R> : never;
533
+
545
534
  type AppType = 'uni-app' | 'uni-app-vite' | 'taro' | 'remax' | 'rax' | 'native' | 'kbone' | 'mpx' | 'weapp-vite';
546
- interface InternalCssSelectorReplacerOptions {
547
- mangleContext?: IMangleScopeContext;
548
- escapeMap?: Record<string, string>;
549
- }
550
535
  interface LinkedJsModuleResult {
551
536
  code: string;
552
537
  }
@@ -564,20 +549,17 @@ type ICustomAttributes = Record<string, ItemOrItemArray<string | RegExp>> | Map<
564
549
  type ICustomAttributesEntities = [string | RegExp, ItemOrItemArray<string | RegExp>][];
565
550
  interface TailwindcssPatcherLike {
566
551
  packageInfo: TailwindcssPatcher['packageInfo'];
567
- majorVersion?: number;
552
+ majorVersion?: TailwindcssPatcher['majorVersion'];
568
553
  patch: TailwindcssPatcher['patch'];
569
- getClassSet: TailwindcssPatcher['getClassSet'];
570
- getClassSetV3: TailwindcssPatcher['getClassSetV3'];
554
+ getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
555
+ getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
571
556
  extract: TailwindcssPatcher['extract'];
572
- cacheOptions?: TailwindcssPatcher['cacheOptions'];
573
- patchOptions?: TailwindcssPatcher['patchOptions'];
574
- rawOptions?: TailwindcssPatcher['rawOptions'];
557
+ options?: TailwindcssPatcher['options'];
575
558
  }
576
559
  interface IJsHandlerOptions {
577
560
  escapeMap?: Record<string, string>;
578
561
  classNameSet?: Set<string>;
579
562
  arbitraryValues?: IArbitraryValues;
580
- mangleContext?: IMangleScopeContext;
581
563
  jsPreserveClass?: (keyword: string) => boolean | undefined;
582
564
  needEscaped?: boolean;
583
565
  generateMap?: boolean;
@@ -624,7 +606,6 @@ interface ICommonReplaceOptions {
624
606
  interface ITemplateHandlerOptions extends ICommonReplaceOptions {
625
607
  customAttributesEntities?: ICustomAttributesEntities;
626
608
  escapeMap?: Record<string, string>;
627
- mangleContext?: IMangleScopeContext;
628
609
  inlineWxs?: boolean;
629
610
  jsHandler?: JsHandler;
630
611
  runtimeSet?: Set<string>;
@@ -639,7 +620,6 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
639
620
  jsHandler: JsHandler;
640
621
  escapeMap: Record<string, string>;
641
622
  customReplaceDictionary: Record<string, string>;
642
- setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
643
623
  cache: ICreateCacheReturnType;
644
624
  twPatcher: TailwindcssPatcherLike;
645
625
  }>;
@@ -677,4 +657,4 @@ interface JsModuleGraphOptions {
677
657
  maxDepth?: number;
678
658
  }
679
659
 
680
- export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
660
+ export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use strict";require('./chunk-O2IOQ3BD.js');
2
- require('./chunk-NHB7NFQC.js');
2
+ require('./chunk-E5PXIHDN.js');
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
- import "./chunk-FWIGQ4RY.mjs";
2
+ import "./chunk-KHILYAA4.mjs";
package/dist/vite.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { UserDefinedOptions } from './types.mjs';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { UserDefinedOptions } from './types.js';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
package/dist/vite.js CHANGED
@@ -1,15 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZUH5ZA7Djs = require('./chunk-ZUH5ZA7D.js');
3
+ var _chunkFVA7Y2YUjs = require('./chunk-FVA7Y2YU.js');
4
4
  require('./chunk-WVKK6TBL.js');
5
- require('./chunk-2NRTWL47.js');
5
+ require('./chunk-LTJQUORK.js');
6
+ require('./chunk-FB5P4TRH.js');
6
7
  require('./chunk-OGROHM4L.js');
7
- require('./chunk-A3TJT6B6.js');
8
- require('./chunk-PLMJW644.js');
9
- require('./chunk-KBR4YB6N.js');
10
- require('./chunk-FOSGDQZ7.js');
8
+ require('./chunk-OVDIACVK.js');
9
+ require('./chunk-DWAEHRHN.js');
10
+ require('./chunk-AXLRUW5H.js');
11
+ require('./chunk-I7FYDXN6.js');
11
12
  require('./chunk-UW3WHSZ5.js');
12
- require('./chunk-NHB7NFQC.js');
13
+ require('./chunk-E5PXIHDN.js');
13
14
 
14
15
 
15
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkZUH5ZA7Djs.UnifiedViteWeappTailwindcssPlugin;
16
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkFVA7Y2YUjs.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-WFZ73Q6S.mjs";
3
+ } from "./chunk-TTDQ4TK2.mjs";
4
4
  import "./chunk-34T2BFTJ.mjs";
5
- import "./chunk-H4JTYYOI.mjs";
5
+ import "./chunk-RRHPTTCP.mjs";
6
+ import "./chunk-YPBRGP6K.mjs";
6
7
  import "./chunk-CMUA5KCO.mjs";
7
- import "./chunk-L4AXTSIM.mjs";
8
- import "./chunk-Q67IXIAH.mjs";
9
- import "./chunk-S2WEN6NJ.mjs";
10
- import "./chunk-IHKVNALD.mjs";
8
+ import "./chunk-7PGHZOTU.mjs";
9
+ import "./chunk-VSRDBMDB.mjs";
10
+ import "./chunk-IY2OKZE6.mjs";
11
+ import "./chunk-YLNOOPZL.mjs";
11
12
  import "./chunk-ZNKIYZRQ.mjs";
12
- import "./chunk-FWIGQ4RY.mjs";
13
+ import "./chunk-KHILYAA4.mjs";
13
14
  export {
14
15
  UnifiedViteWeappTailwindcssPlugin
15
16
  };
@@ -3,7 +3,10 @@ var _loaderutils = require('loader-utils'); var _loaderutils2 = _interopRequireD
3
3
  var WeappTwRuntimeAopLoader = function(source) {
4
4
  var _a;
5
5
  const opt = _loaderutils2.default.getOptions(this);
6
- (_a = opt == null ? void 0 : opt.getClassSet) == null ? void 0 : _a.call(opt);
6
+ const maybePromise = (_a = opt == null ? void 0 : opt.getClassSet) == null ? void 0 : _a.call(opt);
7
+ if (maybePromise && typeof maybePromise.then === "function") {
8
+ return Promise.resolve(maybePromise).then(() => source);
9
+ }
7
10
  return source;
8
11
  };
9
12
  var weapp_tw_runtime_loader_default = WeappTwRuntimeAopLoader;
@@ -1,7 +1,6 @@
1
1
  import { Compiler } from 'webpack';
2
2
  import { IBaseWebpackPlugin, InternalUserDefinedOptions, AppType, UserDefinedOptions } from './types.mjs';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
package/dist/webpack.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Compiler } from 'webpack';
2
2
  import { IBaseWebpackPlugin, InternalUserDefinedOptions, AppType, UserDefinedOptions } from './types.js';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
package/dist/webpack.js CHANGED
@@ -1,16 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFOUWGCIJjs = require('./chunk-FOUWGCIJ.js');
3
+ var _chunk7CGHD2TIjs = require('./chunk-7CGHD2TI.js');
4
4
  require('./chunk-6GP37C26.js');
5
5
  require('./chunk-WVKK6TBL.js');
6
- require('./chunk-2NRTWL47.js');
6
+ require('./chunk-LTJQUORK.js');
7
+ require('./chunk-FB5P4TRH.js');
7
8
  require('./chunk-OGROHM4L.js');
8
- require('./chunk-A3TJT6B6.js');
9
- require('./chunk-PLMJW644.js');
10
- require('./chunk-KBR4YB6N.js');
11
- require('./chunk-FOSGDQZ7.js');
9
+ require('./chunk-OVDIACVK.js');
10
+ require('./chunk-DWAEHRHN.js');
11
+ require('./chunk-AXLRUW5H.js');
12
+ require('./chunk-I7FYDXN6.js');
12
13
  require('./chunk-UW3WHSZ5.js');
13
- require('./chunk-NHB7NFQC.js');
14
+ require('./chunk-E5PXIHDN.js');
14
15
 
15
16
 
16
- exports.UnifiedWebpackPluginV5 = _chunkFOUWGCIJjs.UnifiedWebpackPluginV5;
17
+ exports.UnifiedWebpackPluginV5 = _chunk7CGHD2TIjs.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5
3
- } from "./chunk-GGIH6WLF.mjs";
3
+ } from "./chunk-MXVUK23K.mjs";
4
4
  import "./chunk-2F7HOQQY.mjs";
5
5
  import "./chunk-34T2BFTJ.mjs";
6
- import "./chunk-H4JTYYOI.mjs";
6
+ import "./chunk-RRHPTTCP.mjs";
7
+ import "./chunk-YPBRGP6K.mjs";
7
8
  import "./chunk-CMUA5KCO.mjs";
8
- import "./chunk-L4AXTSIM.mjs";
9
- import "./chunk-Q67IXIAH.mjs";
10
- import "./chunk-S2WEN6NJ.mjs";
11
- import "./chunk-IHKVNALD.mjs";
9
+ import "./chunk-7PGHZOTU.mjs";
10
+ import "./chunk-VSRDBMDB.mjs";
11
+ import "./chunk-IY2OKZE6.mjs";
12
+ import "./chunk-YLNOOPZL.mjs";
12
13
  import "./chunk-ZNKIYZRQ.mjs";
13
- import "./chunk-FWIGQ4RY.mjs";
14
+ import "./chunk-KHILYAA4.mjs";
14
15
  export {
15
16
  UnifiedWebpackPluginV5
16
17
  };
@@ -1,7 +1,6 @@
1
1
  import { Compiler } from 'webpack4';
2
2
  import { IBaseWebpackPlugin, InternalUserDefinedOptions, AppType, UserDefinedOptions } from './types.mjs';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
@@ -1,7 +1,6 @@
1
1
  import { Compiler } from 'webpack4';
2
2
  import { IBaseWebpackPlugin, InternalUserDefinedOptions, AppType, UserDefinedOptions } from './types.js';
3
3
  import '@babel/parser';
4
- import '@weapp-tailwindcss/mangle';
5
4
  import '@weapp-tailwindcss/postcss';
6
5
  import 'magic-string';
7
6
  import 'postcss';
package/dist/webpack4.js CHANGED
@@ -7,31 +7,34 @@ var _chunk6GP37C26js = require('./chunk-6GP37C26.js');
7
7
  var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
8
8
 
9
9
 
10
+ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
10
11
 
11
- var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
12
+
13
+
14
+ var _chunkFB5P4TRHjs = require('./chunk-FB5P4TRH.js');
12
15
 
13
16
 
14
17
  var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
15
18
 
16
19
 
17
- var _chunkA3TJT6B6js = require('./chunk-A3TJT6B6.js');
18
- require('./chunk-PLMJW644.js');
19
- require('./chunk-KBR4YB6N.js');
20
- require('./chunk-FOSGDQZ7.js');
20
+ var _chunkOVDIACVKjs = require('./chunk-OVDIACVK.js');
21
+ require('./chunk-DWAEHRHN.js');
22
+ require('./chunk-AXLRUW5H.js');
23
+ require('./chunk-I7FYDXN6.js');
21
24
 
22
25
 
23
26
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
24
- require('./chunk-NHB7NFQC.js');
27
+ require('./chunk-E5PXIHDN.js');
25
28
 
26
29
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
27
30
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
28
31
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
29
32
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
30
33
  var _webpacksources = require('webpack-sources');
31
- var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
34
+ var debug = _chunkFB5P4TRHjs.createDebug.call(void 0, );
32
35
  var UnifiedWebpackPluginV4 = class {
33
36
  constructor(options = {}) {
34
- this.options = _chunkA3TJT6B6js.getCompilerContext.call(void 0, options);
37
+ this.options = _chunkOVDIACVKjs.getCompilerContext.call(void 0, options);
35
38
  this.appType = this.options.appType;
36
39
  }
37
40
  apply(compiler) {
@@ -45,7 +48,6 @@ var UnifiedWebpackPluginV4 = class {
45
48
  styleHandler,
46
49
  templateHandler,
47
50
  jsHandler,
48
- setMangleRuntimeSet,
49
51
  runtimeLoaderPath,
50
52
  cache,
51
53
  twPatcher
@@ -53,11 +55,10 @@ var UnifiedWebpackPluginV4 = class {
53
55
  if (disabled) {
54
56
  return;
55
57
  }
56
- twPatcher.patch();
57
- function getClassSetInLoader() {
58
- if (twPatcher.majorVersion !== 4) {
59
- return twPatcher.getClassSetV3();
60
- }
58
+ const patchPromise = Promise.resolve(twPatcher.patch());
59
+ async function getClassSetInLoader() {
60
+ await patchPromise;
61
+ await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
61
62
  }
62
63
  onLoad();
63
64
  const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
@@ -81,6 +82,7 @@ var UnifiedWebpackPluginV4 = class {
81
82
  });
82
83
  });
83
84
  compiler.hooks.emit.tapPromise(_chunkOGROHM4Ljs.pluginName, async (compilation) => {
85
+ await patchPromise;
84
86
  onStart();
85
87
  debug("start");
86
88
  for (const chunk of compilation.chunks) {
@@ -143,8 +145,7 @@ var UnifiedWebpackPluginV4 = class {
143
145
  }
144
146
  };
145
147
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
146
- const runtimeSet = await twPatcher.getClassSet();
147
- setMangleRuntimeSet(runtimeSet);
148
+ const runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
148
149
  debug("get runtimeSet, class count: %d", runtimeSet.size);
149
150
  const tasks = [];
150
151
  if (Array.isArray(groupedEntries.html)) {
@@ -153,7 +154,7 @@ var UnifiedWebpackPluginV4 = class {
153
154
  const rawSource = originalSource.source().toString();
154
155
  const cacheKey = file;
155
156
  tasks.push(
156
- _chunk2NRTWL47js.processCachedTask.call(void 0, {
157
+ _chunkLTJQUORKjs.processCachedTask.call(void 0, {
157
158
  cache,
158
159
  cacheKey,
159
160
  rawSource,
@@ -188,7 +189,7 @@ var UnifiedWebpackPluginV4 = class {
188
189
  const initialValue = assetSource.source();
189
190
  const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
190
191
  const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
191
- await _chunk2NRTWL47js.processCachedTask.call(void 0, {
192
+ await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
192
193
  cache,
193
194
  cacheKey,
194
195
  rawSource: initialRawSource,
@@ -226,7 +227,7 @@ var UnifiedWebpackPluginV4 = class {
226
227
  const rawSource = originalSource.source().toString();
227
228
  const cacheKey = file;
228
229
  tasks.push(
229
- _chunk2NRTWL47js.processCachedTask.call(void 0, {
230
+ _chunkLTJQUORKjs.processCachedTask.call(void 0, {
230
231
  cache,
231
232
  cacheKey,
232
233
  rawSource,
@@ -237,6 +238,7 @@ var UnifiedWebpackPluginV4 = class {
237
238
  debug("css cache hit: %s", file);
238
239
  },
239
240
  transform: async () => {
241
+ await patchPromise;
240
242
  const { css } = await styleHandler(rawSource, {
241
243
  isMainChunk: mainCssChunkMatcher(file, this.appType),
242
244
  postcssOptions: {