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
package/dist/types.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import type { Rule } from 'postcss';
2
- import type { IClassGeneratorOptions, ClassGenerator } from '@tailwindcss-mangle/shared';
2
+ import type { ClassGenerator, IClassGeneratorOptions } from '@tailwindcss-mangle/shared';
3
3
  import type { SourceMap } from 'magic-string';
4
4
  import type { GeneratorResult } from '@babel/generator';
5
5
  import type { ParseError, ParserOptions } from '@babel/parser';
6
6
  import type { UserDefinedOptions as rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
7
7
  import type { Result } from 'postcss-load-config';
8
+ import type { TailwindcssPatcher } from 'tailwindcss-patch';
8
9
  import type { InjectPreflight } from './postcss/preflight';
9
10
  import type { IContext as PostcssContext } from './postcss/plugins/ctx';
10
11
  import type { ICreateCacheReturnType } from "./cache";
@@ -36,16 +37,16 @@ export type IStyleHandlerOptions = {
36
37
  postcssOptions?: PostcssOptions;
37
38
  cssRemoveHoverPseudoClass?: boolean;
38
39
  } & RequiredStyleHandlerOptions;
39
- export type JsHandlerReplaceResult = {
40
+ export interface JsHandlerReplaceResult {
40
41
  code: string;
41
42
  map?: SourceMap;
42
- };
43
+ }
43
44
  export type JsHandlerResult = (JsHandlerReplaceResult | GeneratorResult) & {
44
45
  error?: ParseError;
45
46
  };
46
47
  export type ICustomAttributes = Record<string, ItemOrItemArray<string | RegExp>> | Map<string | RegExp, ItemOrItemArray<string | RegExp>>;
47
48
  export type ICustomAttributesEntities = [string | RegExp, ItemOrItemArray<string | RegExp>][];
48
- export type IJsHandlerOptions = {
49
+ export interface IJsHandlerOptions {
49
50
  escapeMap?: Record<string, string>;
50
51
  classNameSet?: Set<string>;
51
52
  arbitraryValues?: IArbitraryValues;
@@ -57,7 +58,7 @@ export type IJsHandlerOptions = {
57
58
  jsAstTool?: 'babel' | 'ast-grep';
58
59
  unescapeUnicode?: boolean;
59
60
  babelParserOptions?: ParserOptions;
60
- };
61
+ }
61
62
  export interface RawSource {
62
63
  start: number;
63
64
  end: number;
@@ -157,6 +158,7 @@ export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supp
157
158
  customReplaceDictionary: Record<string, string>;
158
159
  setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
159
160
  cache: ICreateCacheReturnType;
161
+ twPatcher: TailwindcssPatcher;
160
162
  }>;
161
163
  export type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'customRuleCallback' | 'disabled'>;
162
164
  export interface IBaseWebpackPlugin {
package/dist/utils.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { InternalUserDefinedOptions } from "./types";
2
2
  export declare function isRegexp(value: unknown): boolean;
3
3
  export declare function isMap(value: unknown): boolean;
4
4
  export declare function regExpTest(arr: (string | RegExp)[] | undefined, str: string): boolean;
5
- export declare const noop: () => void;
5
+ export declare function noop(): void;
6
6
  export declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
7
7
  export declare function getGroupedEntries<T>(entries: [string, T][], options: InternalUserDefinedOptions): Record<"css" | "html" | "js" | "other", [string, T][]>;
8
8
  export declare function removeExt(file: string): string;
@@ -1,8 +1,8 @@
1
- import { g as getOptions, c as createTailwindcssPatcher, _ as __awaiter } from './options-D1IYbX_E.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-SmfRHxH0.mjs';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
- import { b as pluginName } from './index-DC60ES8u.mjs';
5
- import { g as getGroupedEntries, r as removeExt } from './defaults-DOGbAFEj.mjs';
4
+ import { b as pluginName } from './index-BPzIdybK.mjs';
5
+ import { g as getGroupedEntries, r as removeExt } from './defaults-BDivGN-J.mjs';
6
6
  import { c as createDebug } from './index-BEIjgKpF.mjs';
7
7
 
8
8
  const debug = createDebug();
@@ -12,18 +12,15 @@ class UnifiedWebpackPluginV5 {
12
12
  this.appType = this.options.appType;
13
13
  }
14
14
  apply(compiler) {
15
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
15
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
16
16
  if (disabled) {
17
17
  return;
18
18
  }
19
19
  patch === null || patch === void 0 ? void 0 : patch();
20
20
  const { Compilation, sources, NormalModule } = compiler.webpack;
21
21
  const { ConcatSource, RawSource } = sources;
22
- const twPatcher = createTailwindcssPatcher();
23
22
  function getClassSet() {
24
- return twPatcher.getClassSet({
25
- basedir: tailwindcssBasedir
26
- });
23
+ return twPatcher.getClassSet();
27
24
  }
28
25
  onLoad();
29
26
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -31,15 +28,15 @@ class UnifiedWebpackPluginV5 {
31
28
  const WeappTwRuntimeAopLoader = {
32
29
  loader,
33
30
  options: {
34
- getClassSet
31
+ getClassSet,
35
32
  },
36
33
  ident: null,
37
- type: null
34
+ type: null,
38
35
  };
39
36
  compiler.hooks.compilation.tap(pluginName, (compilation) => {
40
37
  NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (loaderContext, module) => {
41
38
  if (isExisted) {
42
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
39
+ const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
43
40
  if (idx > -1) {
44
41
  module.loaders.unshift(WeappTwRuntimeAopLoader);
45
42
  }
@@ -47,7 +44,7 @@ class UnifiedWebpackPluginV5 {
47
44
  });
48
45
  compilation.hooks.processAssets.tapPromise({
49
46
  name: pluginName,
50
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
47
+ stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
51
48
  }, (assets) => __awaiter(this, void 0, void 0, function* () {
52
49
  onStart();
53
50
  debug('start');
@@ -80,7 +77,7 @@ class UnifiedWebpackPluginV5 {
80
77
  }
81
78
  }, () => __awaiter(this, void 0, void 0, function* () {
82
79
  const wxml = yield templateHandler(rawSource, {
83
- runtimeSet
80
+ runtimeSet,
84
81
  });
85
82
  const source = new ConcatSource(wxml);
86
83
  compilation.updateAsset(file, source);
@@ -89,7 +86,7 @@ class UnifiedWebpackPluginV5 {
89
86
  noCachedCount++;
90
87
  return {
91
88
  key: cacheKey,
92
- source
89
+ source,
93
90
  };
94
91
  }));
95
92
  }
@@ -111,10 +108,10 @@ class UnifiedWebpackPluginV5 {
111
108
  }
112
109
  }, () => __awaiter(this, void 0, void 0, function* () {
113
110
  const rawSource = originalSource.source().toString();
114
- const mapFilename = file + '.map';
111
+ const mapFilename = `${file}.map`;
115
112
  const hasMap = Boolean(assets[mapFilename]);
116
113
  const { code, map } = yield jsHandler(rawSource, runtimeSet, {
117
- generateMap: hasMap
114
+ generateMap: hasMap,
118
115
  });
119
116
  const source = new ConcatSource(code);
120
117
  compilation.updateAsset(file, source);
@@ -127,7 +124,7 @@ class UnifiedWebpackPluginV5 {
127
124
  }
128
125
  return {
129
126
  key: cacheKey,
130
- source
127
+ source,
131
128
  };
132
129
  }));
133
130
  }
@@ -152,7 +149,7 @@ class UnifiedWebpackPluginV5 {
152
149
  }
153
150
  }, () => __awaiter(this, void 0, void 0, function* () {
154
151
  const css = yield styleHandler(rawSource, {
155
- isMainChunk: mainCssChunkMatcher(file, this.appType)
152
+ isMainChunk: mainCssChunkMatcher(file, this.appType),
156
153
  });
157
154
  const source = new ConcatSource(css);
158
155
  compilation.updateAsset(file, source);
@@ -161,7 +158,7 @@ class UnifiedWebpackPluginV5 {
161
158
  noCachedCount++;
162
159
  return {
163
160
  key: cacheKey,
164
- source
161
+ source,
165
162
  };
166
163
  }));
167
164
  }
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-BjZGMFOk.js');
3
+ var options = require('./options-DCor-e5I.js');
4
4
  var path = require('node:path');
5
5
  var fs = require('node:fs');
6
- var index = require('./index-6BUjj8Rl.js');
7
- var defaults = require('./defaults-CGBcgdIr.js');
6
+ var index = require('./index-DwZHOkK3.js');
7
+ var defaults = require('./defaults-z7wUEh47.js');
8
8
  var index$1 = require('./index-HC-Qkn0i.js');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -19,18 +19,15 @@ class UnifiedWebpackPluginV5 {
19
19
  this.appType = this.options.appType;
20
20
  }
21
21
  apply(compiler) {
22
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
22
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
23
23
  if (disabled) {
24
24
  return;
25
25
  }
26
26
  patch === null || patch === void 0 ? void 0 : patch();
27
27
  const { Compilation, sources, NormalModule } = compiler.webpack;
28
28
  const { ConcatSource, RawSource } = sources;
29
- const twPatcher = options.createTailwindcssPatcher();
30
29
  function getClassSet() {
31
- return twPatcher.getClassSet({
32
- basedir: tailwindcssBasedir
33
- });
30
+ return twPatcher.getClassSet();
34
31
  }
35
32
  onLoad();
36
33
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -38,15 +35,15 @@ class UnifiedWebpackPluginV5 {
38
35
  const WeappTwRuntimeAopLoader = {
39
36
  loader,
40
37
  options: {
41
- getClassSet
38
+ getClassSet,
42
39
  },
43
40
  ident: null,
44
- type: null
41
+ type: null,
45
42
  };
46
43
  compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
47
44
  NormalModule.getCompilationHooks(compilation).loader.tap(index.pluginName, (loaderContext, module) => {
48
45
  if (isExisted) {
49
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
46
+ const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
50
47
  if (idx > -1) {
51
48
  module.loaders.unshift(WeappTwRuntimeAopLoader);
52
49
  }
@@ -54,7 +51,7 @@ class UnifiedWebpackPluginV5 {
54
51
  });
55
52
  compilation.hooks.processAssets.tapPromise({
56
53
  name: index.pluginName,
57
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
54
+ stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
58
55
  }, (assets) => options.__awaiter(this, void 0, void 0, function* () {
59
56
  onStart();
60
57
  debug('start');
@@ -87,7 +84,7 @@ class UnifiedWebpackPluginV5 {
87
84
  }
88
85
  }, () => options.__awaiter(this, void 0, void 0, function* () {
89
86
  const wxml = yield templateHandler(rawSource, {
90
- runtimeSet
87
+ runtimeSet,
91
88
  });
92
89
  const source = new ConcatSource(wxml);
93
90
  compilation.updateAsset(file, source);
@@ -96,7 +93,7 @@ class UnifiedWebpackPluginV5 {
96
93
  noCachedCount++;
97
94
  return {
98
95
  key: cacheKey,
99
- source
96
+ source,
100
97
  };
101
98
  }));
102
99
  }
@@ -118,10 +115,10 @@ class UnifiedWebpackPluginV5 {
118
115
  }
119
116
  }, () => options.__awaiter(this, void 0, void 0, function* () {
120
117
  const rawSource = originalSource.source().toString();
121
- const mapFilename = file + '.map';
118
+ const mapFilename = `${file}.map`;
122
119
  const hasMap = Boolean(assets[mapFilename]);
123
120
  const { code, map } = yield jsHandler(rawSource, runtimeSet, {
124
- generateMap: hasMap
121
+ generateMap: hasMap,
125
122
  });
126
123
  const source = new ConcatSource(code);
127
124
  compilation.updateAsset(file, source);
@@ -134,7 +131,7 @@ class UnifiedWebpackPluginV5 {
134
131
  }
135
132
  return {
136
133
  key: cacheKey,
137
- source
134
+ source,
138
135
  };
139
136
  }));
140
137
  }
@@ -159,7 +156,7 @@ class UnifiedWebpackPluginV5 {
159
156
  }
160
157
  }, () => options.__awaiter(this, void 0, void 0, function* () {
161
158
  const css = yield styleHandler(rawSource, {
162
- isMainChunk: mainCssChunkMatcher(file, this.appType)
159
+ isMainChunk: mainCssChunkMatcher(file, this.appType),
163
160
  });
164
161
  const source = new ConcatSource(css);
165
162
  compilation.updateAsset(file, source);
@@ -168,7 +165,7 @@ class UnifiedWebpackPluginV5 {
168
165
  noCachedCount++;
169
166
  return {
170
167
  key: cacheKey,
171
- source
168
+ source,
172
169
  };
173
170
  }));
174
171
  }
package/dist/vite.js CHANGED
@@ -2,28 +2,29 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-iiM-deHl.js');
6
- require('./options-BjZGMFOk.js');
5
+ var index = require('./index-CeRMFNvT.js');
6
+ require('./options-DCor-e5I.js');
7
7
  require('magic-string');
8
8
  require('./replace.js');
9
9
  require('@weapp-core/escape');
10
10
  require('@ast-core/escape');
11
- require('./shared-BDew1Ric.js');
11
+ require('./shared-hzYeE1wX.js');
12
12
  require('@weapp-core/regex');
13
13
  require('@babel/generator');
14
14
  require('@babel/traverse');
15
15
  require('@babel/parser');
16
- require('./defaults-CGBcgdIr.js');
16
+ require('./defaults-z7wUEh47.js');
17
17
  require('./defu-Cdz2PomB.js');
18
18
  require('@babel/types');
19
19
  require('htmlparser2');
20
20
  require('postcss');
21
- require('./index-6BUjj8Rl.js');
21
+ require('./index-DwZHOkK3.js');
22
22
  require('@csstools/postcss-is-pseudo-class');
23
23
  require('postcss-rem-to-responsive-pixel');
24
24
  require('postcss-selector-parser');
25
25
  require('node:path');
26
26
  require('node:fs');
27
+ require('node:process');
27
28
  require('semver');
28
29
  require('tailwindcss-patch');
29
30
  require('@tailwindcss-mangle/shared');
package/dist/vite.mjs CHANGED
@@ -1,25 +1,26 @@
1
- export { U as UnifiedViteWeappTailwindcssPlugin } from './index-UGtfFwsf.mjs';
2
- import './options-D1IYbX_E.mjs';
1
+ export { U as UnifiedViteWeappTailwindcssPlugin } from './index-BMv1aBKz.mjs';
2
+ import './options-SmfRHxH0.mjs';
3
3
  import 'magic-string';
4
4
  import './replace.mjs';
5
5
  import '@weapp-core/escape';
6
6
  import '@ast-core/escape';
7
- import './shared-BX0VV-pr.mjs';
7
+ import './shared-DbJl6i6a.mjs';
8
8
  import '@weapp-core/regex';
9
9
  import '@babel/generator';
10
10
  import '@babel/traverse';
11
11
  import '@babel/parser';
12
- import './defaults-DOGbAFEj.mjs';
12
+ import './defaults-BDivGN-J.mjs';
13
13
  import './defu-n46TJT6t.mjs';
14
14
  import '@babel/types';
15
15
  import 'htmlparser2';
16
16
  import 'postcss';
17
- import './index-DC60ES8u.mjs';
17
+ import './index-BPzIdybK.mjs';
18
18
  import '@csstools/postcss-is-pseudo-class';
19
19
  import 'postcss-rem-to-responsive-pixel';
20
20
  import 'postcss-selector-parser';
21
21
  import 'node:path';
22
22
  import 'node:fs';
23
+ import 'node:process';
23
24
  import 'semver';
24
25
  import 'tailwindcss-patch';
25
26
  import '@tailwindcss-mangle/shared';
package/dist/webpack.js CHANGED
@@ -2,28 +2,29 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var v5 = require('./v5-DA4DSMKO.js');
6
- require('./options-BjZGMFOk.js');
5
+ var v5 = require('./v5-ea_QoULz.js');
6
+ require('./options-DCor-e5I.js');
7
7
  require('magic-string');
8
8
  require('./replace.js');
9
9
  require('@weapp-core/escape');
10
10
  require('@ast-core/escape');
11
- require('./shared-BDew1Ric.js');
11
+ require('./shared-hzYeE1wX.js');
12
12
  require('@weapp-core/regex');
13
13
  require('@babel/generator');
14
14
  require('@babel/traverse');
15
15
  require('@babel/parser');
16
- require('./defaults-CGBcgdIr.js');
16
+ require('./defaults-z7wUEh47.js');
17
17
  require('./defu-Cdz2PomB.js');
18
18
  require('@babel/types');
19
19
  require('htmlparser2');
20
20
  require('postcss');
21
- require('./index-6BUjj8Rl.js');
21
+ require('./index-DwZHOkK3.js');
22
22
  require('@csstools/postcss-is-pseudo-class');
23
23
  require('postcss-rem-to-responsive-pixel');
24
24
  require('postcss-selector-parser');
25
25
  require('node:path');
26
26
  require('node:fs');
27
+ require('node:process');
27
28
  require('semver');
28
29
  require('tailwindcss-patch');
29
30
  require('@tailwindcss-mangle/shared');
package/dist/webpack.mjs CHANGED
@@ -1,25 +1,26 @@
1
- export { U as UnifiedWebpackPluginV5 } from './v5-C6FTqEeL.mjs';
2
- import './options-D1IYbX_E.mjs';
1
+ export { U as UnifiedWebpackPluginV5 } from './v5-CQUeTJ2W.mjs';
2
+ import './options-SmfRHxH0.mjs';
3
3
  import 'magic-string';
4
4
  import './replace.mjs';
5
5
  import '@weapp-core/escape';
6
6
  import '@ast-core/escape';
7
- import './shared-BX0VV-pr.mjs';
7
+ import './shared-DbJl6i6a.mjs';
8
8
  import '@weapp-core/regex';
9
9
  import '@babel/generator';
10
10
  import '@babel/traverse';
11
11
  import '@babel/parser';
12
- import './defaults-DOGbAFEj.mjs';
12
+ import './defaults-BDivGN-J.mjs';
13
13
  import './defu-n46TJT6t.mjs';
14
14
  import '@babel/types';
15
15
  import 'htmlparser2';
16
16
  import 'postcss';
17
- import './index-DC60ES8u.mjs';
17
+ import './index-BPzIdybK.mjs';
18
18
  import '@csstools/postcss-is-pseudo-class';
19
19
  import 'postcss-rem-to-responsive-pixel';
20
20
  import 'postcss-selector-parser';
21
21
  import 'node:path';
22
22
  import 'node:fs';
23
+ import 'node:process';
23
24
  import 'semver';
24
25
  import 'tailwindcss-patch';
25
26
  import '@tailwindcss-mangle/shared';
package/dist/webpack4.js CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-BjZGMFOk.js');
5
+ var options = require('./options-DCor-e5I.js');
6
6
  var path = require('node:path');
7
7
  var fs = require('node:fs');
8
8
  var webpackSources = require('webpack-sources');
9
- var index = require('./index-6BUjj8Rl.js');
10
- var defaults = require('./defaults-CGBcgdIr.js');
9
+ var index = require('./index-DwZHOkK3.js');
10
+ var defaults = require('./defaults-z7wUEh47.js');
11
11
  var index$1 = require('./index-HC-Qkn0i.js');
12
12
  require('magic-string');
13
13
  require('./replace.js');
14
14
  require('@weapp-core/escape');
15
15
  require('@ast-core/escape');
16
- require('./shared-BDew1Ric.js');
16
+ require('./shared-hzYeE1wX.js');
17
17
  require('@weapp-core/regex');
18
18
  require('@babel/generator');
19
19
  require('@babel/traverse');
@@ -21,6 +21,7 @@ require('@babel/parser');
21
21
  require('@babel/types');
22
22
  require('htmlparser2');
23
23
  require('postcss');
24
+ require('node:process');
24
25
  require('semver');
25
26
  require('tailwindcss-patch');
26
27
  require('@tailwindcss-mangle/shared');
@@ -44,16 +45,13 @@ class UnifiedWebpackPluginV4 {
44
45
  this.appType = this.options.appType;
45
46
  }
46
47
  apply(compiler) {
47
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
48
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
48
49
  if (disabled) {
49
50
  return;
50
51
  }
51
52
  patch === null || patch === void 0 ? void 0 : patch();
52
- const twPatcher = options.createTailwindcssPatcher();
53
53
  function getClassSet() {
54
- return twPatcher.getClassSet({
55
- basedir: tailwindcssBasedir
56
- });
54
+ return twPatcher.getClassSet();
57
55
  }
58
56
  onLoad();
59
57
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -61,15 +59,15 @@ class UnifiedWebpackPluginV4 {
61
59
  const WeappTwRuntimeAopLoader = {
62
60
  loader,
63
61
  options: {
64
- getClassSet
62
+ getClassSet,
65
63
  },
66
64
  ident: null,
67
- type: null
65
+ type: null,
68
66
  };
69
67
  compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
70
68
  compilation.hooks.normalModuleLoader.tap(index.pluginName, (loaderContext, module) => {
71
69
  if (isExisted) {
72
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
70
+ const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
73
71
  if (idx > -1) {
74
72
  module.loaders.unshift(WeappTwRuntimeAopLoader);
75
73
  }
@@ -109,7 +107,7 @@ class UnifiedWebpackPluginV4 {
109
107
  }
110
108
  }, () => options.__awaiter(this, void 0, void 0, function* () {
111
109
  const wxml = yield templateHandler(rawSource, {
112
- runtimeSet
110
+ runtimeSet,
113
111
  });
114
112
  const source = new webpackSources.ConcatSource(wxml);
115
113
  compilation.updateAsset(file, source);
@@ -118,7 +116,7 @@ class UnifiedWebpackPluginV4 {
118
116
  noCachedCount++;
119
117
  return {
120
118
  key: cacheKey,
121
- source
119
+ source,
122
120
  };
123
121
  }));
124
122
  }
@@ -140,10 +138,10 @@ class UnifiedWebpackPluginV4 {
140
138
  }
141
139
  }, () => options.__awaiter(this, void 0, void 0, function* () {
142
140
  const rawSource = originalSource.source().toString();
143
- const mapFilename = file + '.map';
141
+ const mapFilename = `${file}.map`;
144
142
  const hasMap = Boolean(assets[mapFilename]);
145
143
  const { code, map } = yield jsHandler(rawSource, runtimeSet, {
146
- generateMap: hasMap
144
+ generateMap: hasMap,
147
145
  });
148
146
  const source = new webpackSources.ConcatSource(code);
149
147
  compilation.updateAsset(file, source);
@@ -156,7 +154,7 @@ class UnifiedWebpackPluginV4 {
156
154
  }
157
155
  return {
158
156
  key: cacheKey,
159
- source
157
+ source,
160
158
  };
161
159
  }));
162
160
  }
@@ -181,7 +179,7 @@ class UnifiedWebpackPluginV4 {
181
179
  }
182
180
  }, () => options.__awaiter(this, void 0, void 0, function* () {
183
181
  const css = yield styleHandler(rawSource, {
184
- isMainChunk: mainCssChunkMatcher(file, this.appType)
182
+ isMainChunk: mainCssChunkMatcher(file, this.appType),
185
183
  });
186
184
  const source = new webpackSources.ConcatSource(css);
187
185
  compilation.updateAsset(file, source);
@@ -190,7 +188,7 @@ class UnifiedWebpackPluginV4 {
190
188
  noCachedCount++;
191
189
  return {
192
190
  key: cacheKey,
193
- source
191
+ source,
194
192
  };
195
193
  }));
196
194
  }