weapp-tailwindcss 4.8.4 → 4.8.5

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 (50) hide show
  1. package/dist/{chunk-7KTLLGAG.mjs → chunk-3XGTIDA6.mjs} +72 -49
  2. package/dist/{chunk-JMYADIPN.mjs → chunk-67CD2S5L.mjs} +1 -1
  3. package/dist/{chunk-6EATUPTN.js → chunk-6CS6EPEP.js} +27 -20
  4. package/dist/{chunk-K234IGOT.js → chunk-AB45L5FP.js} +2 -2
  5. package/dist/{chunk-IHJU6M6B.mjs → chunk-FE63QKGM.mjs} +13 -6
  6. package/dist/chunk-FVSKLXO5.js +29 -0
  7. package/dist/{chunk-WTOLVORM.mjs → chunk-K62QTSOE.mjs} +389 -52
  8. package/dist/{chunk-NLLCK6RM.mjs → chunk-OKBZMEXY.mjs} +11 -4
  9. package/dist/{chunk-AXEKXGG7.js → chunk-P6ACVBPQ.js} +427 -90
  10. package/dist/{chunk-KSHK56CW.mjs → chunk-PSYJXCQJ.mjs} +1 -1
  11. package/dist/{chunk-MG4O3AGN.js → chunk-RA4QKEFU.js} +14 -7
  12. package/dist/{chunk-ZXU4EYKV.js → chunk-RJRLVYVJ.js} +77 -54
  13. package/dist/{chunk-5P342MNS.js → chunk-RXCVTHDO.js} +52 -39
  14. package/dist/chunk-SFQCTDJA.mjs +29 -0
  15. package/dist/{chunk-47NJZTIW.js → chunk-TWBCI2I3.js} +5 -5
  16. package/dist/{chunk-WGLBMNPG.js → chunk-UTZLVU3M.js} +1 -1
  17. package/dist/{chunk-UUVGNRUM.mjs → chunk-WSMJXGQQ.mjs} +36 -23
  18. package/dist/cli.js +217 -20
  19. package/dist/cli.mjs +215 -18
  20. package/dist/core.js +19 -11
  21. package/dist/core.mjs +14 -6
  22. package/dist/css-macro/postcss.js +1 -1
  23. package/dist/css-macro/postcss.mjs +1 -1
  24. package/dist/css-macro.js +1 -1
  25. package/dist/css-macro.mjs +1 -1
  26. package/dist/defaults.js +1 -1
  27. package/dist/defaults.mjs +1 -1
  28. package/dist/gulp.js +6 -5
  29. package/dist/gulp.mjs +5 -4
  30. package/dist/index.js +10 -9
  31. package/dist/index.mjs +8 -7
  32. package/dist/postcss-html-transform.js +1 -1
  33. package/dist/postcss-html-transform.mjs +1 -1
  34. package/dist/presets.js +4 -6
  35. package/dist/presets.mjs +3 -5
  36. package/dist/reset.d.mts +30 -0
  37. package/dist/reset.d.ts +32 -0
  38. package/dist/reset.js +161 -0
  39. package/dist/reset.mjs +161 -0
  40. package/dist/types.js +1 -1
  41. package/dist/types.mjs +1 -1
  42. package/dist/vite.js +7 -6
  43. package/dist/vite.mjs +5 -4
  44. package/dist/webpack.js +8 -7
  45. package/dist/webpack.mjs +6 -5
  46. package/dist/webpack4.js +29 -22
  47. package/dist/webpack4.mjs +14 -7
  48. package/package.json +9 -2
  49. package/dist/chunk-OXASK55Q.js +0 -6
  50. package/dist/chunk-PMF2CCKK.mjs +0 -6
@@ -0,0 +1,30 @@
1
+ import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
+
3
+ interface ResetOptions {
4
+ /**
5
+ * 控制 `button` reset 的注入与选择器,传入 `false` 可跳过该规则。
6
+ */
7
+ buttonReset?: false | ResetConfig;
8
+ /**
9
+ * 控制 `image` reset(同时覆盖 `<image>` 与 `<img>`)。
10
+ */
11
+ imageReset?: false | ResetConfig;
12
+ /**
13
+ * 额外的 reset 规则,可根据业务自定义。
14
+ */
15
+ extraResets?: ResetConfig[];
16
+ }
17
+ interface ResetConfig {
18
+ selectors?: string[];
19
+ declarations?: Record<string, string | number | false | null | undefined>;
20
+ pseudo?: Record<string, string | number | false | null | undefined>;
21
+ }
22
+ declare const reset: {
23
+ (options: ResetOptions): {
24
+ handler: tailwindcss_types_config.PluginCreator;
25
+ config?: Partial<tailwindcss_types_config.Config>;
26
+ };
27
+ __isOptionsFunction: true;
28
+ };
29
+
30
+ export { type ResetConfig, type ResetOptions, reset as default, reset };
@@ -0,0 +1,32 @@
1
+ import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
+
3
+ interface ResetOptions {
4
+ /**
5
+ * 控制 `button` reset 的注入与选择器,传入 `false` 可跳过该规则。
6
+ */
7
+ buttonReset?: false | ResetConfig;
8
+ /**
9
+ * 控制 `image` reset(同时覆盖 `<image>` 与 `<img>`)。
10
+ */
11
+ imageReset?: false | ResetConfig;
12
+ /**
13
+ * 额外的 reset 规则,可根据业务自定义。
14
+ */
15
+ extraResets?: ResetConfig[];
16
+ }
17
+ interface ResetConfig {
18
+ selectors?: string[];
19
+ declarations?: Record<string, string | number | false | null | undefined>;
20
+ pseudo?: Record<string, string | number | false | null | undefined>;
21
+ }
22
+ declare const reset: {
23
+ (options: ResetOptions): {
24
+ handler: tailwindcss_types_config.PluginCreator;
25
+ config?: Partial<tailwindcss_types_config.Config>;
26
+ };
27
+ __isOptionsFunction: true;
28
+ };
29
+
30
+ // @ts-ignore
31
+ export = reset;
32
+ export { type ResetConfig, type ResetOptions, reset };
package/dist/reset.js ADDED
@@ -0,0 +1,161 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }require('./chunk-UTZLVU3M.js');
2
+
3
+ // src/reset/index.ts
4
+ var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
5
+ var DEFAULT_BUTTON_RESET_SELECTORS = ["button"];
6
+ var DEFAULT_BUTTON_DECLARATIONS = {
7
+ padding: "0",
8
+ backgroundColor: "transparent",
9
+ fontSize: "inherit",
10
+ lineHeight: "inherit",
11
+ color: "inherit",
12
+ borderWidth: "0"
13
+ };
14
+ var BUTTON_RESET_PSEUDO_DECLARATIONS = {
15
+ border: "none"
16
+ };
17
+ var DEFAULT_IMAGE_RESET_SELECTORS = ["image", "img"];
18
+ var DEFAULT_IMAGE_DECLARATIONS = {
19
+ display: "block",
20
+ borderWidth: "0",
21
+ backgroundColor: "transparent",
22
+ maxWidth: "100%",
23
+ height: "auto"
24
+ };
25
+ function normalizeResetSelectors(option, defaults) {
26
+ const resolved = _optionalChain([option, 'optionalAccess', _ => _.selectors, 'optionalAccess', _2 => _2.length]) ? option.selectors : defaults;
27
+ const normalized = [];
28
+ for (const selector of resolved) {
29
+ const trimmed = selector.trim();
30
+ if (!trimmed || normalized.includes(trimmed)) {
31
+ continue;
32
+ }
33
+ normalized.push(trimmed);
34
+ }
35
+ return normalized.length ? normalized : void 0;
36
+ }
37
+ function convertSelectorForBase(selector) {
38
+ if (selector.startsWith(".")) {
39
+ const className = selector.slice(1);
40
+ if (className.length > 0) {
41
+ return `[class~="${className}"]`;
42
+ }
43
+ }
44
+ if (selector.startsWith("#")) {
45
+ const id = selector.slice(1);
46
+ if (id.length > 0) {
47
+ return `[id="${id}"]`;
48
+ }
49
+ }
50
+ return selector;
51
+ }
52
+ function normalizeDeclarations(option, defaults) {
53
+ const normalized = { ...defaults };
54
+ const overrides = _optionalChain([option, 'optionalAccess', _3 => _3.declarations]);
55
+ if (!overrides) {
56
+ return normalized;
57
+ }
58
+ const entries = Object.entries(overrides);
59
+ for (const [prop, value] of entries) {
60
+ const resolved = normalizeDeclarationValue(value);
61
+ if (resolved === void 0) {
62
+ delete normalized[prop];
63
+ } else {
64
+ normalized[prop] = resolved;
65
+ }
66
+ }
67
+ return normalized;
68
+ }
69
+ function normalizePseudo(option, defaults) {
70
+ const normalized = defaults ? { ...defaults } : {};
71
+ const overrides = _optionalChain([option, 'optionalAccess', _4 => _4.pseudo]);
72
+ if (!overrides) {
73
+ return Object.keys(normalized).length ? normalized : void 0;
74
+ }
75
+ const entries = Object.entries(overrides);
76
+ for (const [prop, value] of entries) {
77
+ const resolved = normalizeDeclarationValue(value);
78
+ if (resolved === void 0) {
79
+ delete normalized[prop];
80
+ } else {
81
+ normalized[prop] = resolved;
82
+ }
83
+ }
84
+ return Object.keys(normalized).length ? normalized : void 0;
85
+ }
86
+ function normalizeDeclarationValue(value) {
87
+ if (value === false || value === null || value === void 0) {
88
+ return void 0;
89
+ }
90
+ return typeof value === "number" ? value.toString() : value;
91
+ }
92
+ function createResetRule(option, defaults) {
93
+ if (option === false) {
94
+ return void 0;
95
+ }
96
+ const selectors = normalizeResetSelectors(option, defaults.selectors);
97
+ if (!selectors) {
98
+ return void 0;
99
+ }
100
+ const declarations = normalizeDeclarations(_nullishCoalesce(option, () => ( {})), defaults.declarations);
101
+ if (Object.keys(declarations).length === 0) {
102
+ return void 0;
103
+ }
104
+ const pseudo = normalizePseudo(_nullishCoalesce(option, () => ( {})), defaults.pseudo);
105
+ return {
106
+ selectors: selectors.map(convertSelectorForBase),
107
+ declarations,
108
+ pseudo
109
+ };
110
+ }
111
+ var reset = _plugin2.default.withOptions(
112
+ (options) => {
113
+ const rules = [];
114
+ const buttonRule = createResetRule(_optionalChain([options, 'optionalAccess', _5 => _5.buttonReset]), {
115
+ selectors: DEFAULT_BUTTON_RESET_SELECTORS,
116
+ declarations: DEFAULT_BUTTON_DECLARATIONS,
117
+ pseudo: BUTTON_RESET_PSEUDO_DECLARATIONS
118
+ });
119
+ if (buttonRule) {
120
+ rules.push(buttonRule);
121
+ }
122
+ const imageRule = createResetRule(_optionalChain([options, 'optionalAccess', _6 => _6.imageReset]), {
123
+ selectors: DEFAULT_IMAGE_RESET_SELECTORS,
124
+ declarations: DEFAULT_IMAGE_DECLARATIONS
125
+ });
126
+ if (imageRule) {
127
+ rules.push(imageRule);
128
+ }
129
+ for (const extra of _nullishCoalesce(_optionalChain([options, 'optionalAccess', _7 => _7.extraResets]), () => ( []))) {
130
+ const normalized = createResetRule(extra, {
131
+ selectors: _nullishCoalesce(extra.selectors, () => ( [])),
132
+ declarations: {}
133
+ });
134
+ if (normalized) {
135
+ rules.push(normalized);
136
+ }
137
+ }
138
+ return ({ addBase }) => {
139
+ if (!rules.length) {
140
+ return;
141
+ }
142
+ const baseRules = {};
143
+ for (const rule of rules) {
144
+ baseRules[rule.selectors.join(",")] = rule.declarations;
145
+ if (rule.pseudo) {
146
+ const pseudoSelectors = rule.selectors.map((selector) => `${selector}::after`).join(",");
147
+ baseRules[pseudoSelectors] = rule.pseudo;
148
+ }
149
+ }
150
+ addBase(baseRules);
151
+ };
152
+ },
153
+ () => {
154
+ return {};
155
+ }
156
+ );
157
+ var reset_default = reset;
158
+
159
+
160
+
161
+ exports.default = reset_default; exports.reset = reset;
package/dist/reset.mjs ADDED
@@ -0,0 +1,161 @@
1
+ import "./chunk-67CD2S5L.mjs";
2
+
3
+ // src/reset/index.ts
4
+ import plugin from "tailwindcss/plugin";
5
+ var DEFAULT_BUTTON_RESET_SELECTORS = ["button"];
6
+ var DEFAULT_BUTTON_DECLARATIONS = {
7
+ padding: "0",
8
+ backgroundColor: "transparent",
9
+ fontSize: "inherit",
10
+ lineHeight: "inherit",
11
+ color: "inherit",
12
+ borderWidth: "0"
13
+ };
14
+ var BUTTON_RESET_PSEUDO_DECLARATIONS = {
15
+ border: "none"
16
+ };
17
+ var DEFAULT_IMAGE_RESET_SELECTORS = ["image", "img"];
18
+ var DEFAULT_IMAGE_DECLARATIONS = {
19
+ display: "block",
20
+ borderWidth: "0",
21
+ backgroundColor: "transparent",
22
+ maxWidth: "100%",
23
+ height: "auto"
24
+ };
25
+ function normalizeResetSelectors(option, defaults) {
26
+ const resolved = option?.selectors?.length ? option.selectors : defaults;
27
+ const normalized = [];
28
+ for (const selector of resolved) {
29
+ const trimmed = selector.trim();
30
+ if (!trimmed || normalized.includes(trimmed)) {
31
+ continue;
32
+ }
33
+ normalized.push(trimmed);
34
+ }
35
+ return normalized.length ? normalized : void 0;
36
+ }
37
+ function convertSelectorForBase(selector) {
38
+ if (selector.startsWith(".")) {
39
+ const className = selector.slice(1);
40
+ if (className.length > 0) {
41
+ return `[class~="${className}"]`;
42
+ }
43
+ }
44
+ if (selector.startsWith("#")) {
45
+ const id = selector.slice(1);
46
+ if (id.length > 0) {
47
+ return `[id="${id}"]`;
48
+ }
49
+ }
50
+ return selector;
51
+ }
52
+ function normalizeDeclarations(option, defaults) {
53
+ const normalized = { ...defaults };
54
+ const overrides = option?.declarations;
55
+ if (!overrides) {
56
+ return normalized;
57
+ }
58
+ const entries = Object.entries(overrides);
59
+ for (const [prop, value] of entries) {
60
+ const resolved = normalizeDeclarationValue(value);
61
+ if (resolved === void 0) {
62
+ delete normalized[prop];
63
+ } else {
64
+ normalized[prop] = resolved;
65
+ }
66
+ }
67
+ return normalized;
68
+ }
69
+ function normalizePseudo(option, defaults) {
70
+ const normalized = defaults ? { ...defaults } : {};
71
+ const overrides = option?.pseudo;
72
+ if (!overrides) {
73
+ return Object.keys(normalized).length ? normalized : void 0;
74
+ }
75
+ const entries = Object.entries(overrides);
76
+ for (const [prop, value] of entries) {
77
+ const resolved = normalizeDeclarationValue(value);
78
+ if (resolved === void 0) {
79
+ delete normalized[prop];
80
+ } else {
81
+ normalized[prop] = resolved;
82
+ }
83
+ }
84
+ return Object.keys(normalized).length ? normalized : void 0;
85
+ }
86
+ function normalizeDeclarationValue(value) {
87
+ if (value === false || value === null || value === void 0) {
88
+ return void 0;
89
+ }
90
+ return typeof value === "number" ? value.toString() : value;
91
+ }
92
+ function createResetRule(option, defaults) {
93
+ if (option === false) {
94
+ return void 0;
95
+ }
96
+ const selectors = normalizeResetSelectors(option, defaults.selectors);
97
+ if (!selectors) {
98
+ return void 0;
99
+ }
100
+ const declarations = normalizeDeclarations(option ?? {}, defaults.declarations);
101
+ if (Object.keys(declarations).length === 0) {
102
+ return void 0;
103
+ }
104
+ const pseudo = normalizePseudo(option ?? {}, defaults.pseudo);
105
+ return {
106
+ selectors: selectors.map(convertSelectorForBase),
107
+ declarations,
108
+ pseudo
109
+ };
110
+ }
111
+ var reset = plugin.withOptions(
112
+ (options) => {
113
+ const rules = [];
114
+ const buttonRule = createResetRule(options?.buttonReset, {
115
+ selectors: DEFAULT_BUTTON_RESET_SELECTORS,
116
+ declarations: DEFAULT_BUTTON_DECLARATIONS,
117
+ pseudo: BUTTON_RESET_PSEUDO_DECLARATIONS
118
+ });
119
+ if (buttonRule) {
120
+ rules.push(buttonRule);
121
+ }
122
+ const imageRule = createResetRule(options?.imageReset, {
123
+ selectors: DEFAULT_IMAGE_RESET_SELECTORS,
124
+ declarations: DEFAULT_IMAGE_DECLARATIONS
125
+ });
126
+ if (imageRule) {
127
+ rules.push(imageRule);
128
+ }
129
+ for (const extra of options?.extraResets ?? []) {
130
+ const normalized = createResetRule(extra, {
131
+ selectors: extra.selectors ?? [],
132
+ declarations: {}
133
+ });
134
+ if (normalized) {
135
+ rules.push(normalized);
136
+ }
137
+ }
138
+ return ({ addBase }) => {
139
+ if (!rules.length) {
140
+ return;
141
+ }
142
+ const baseRules = {};
143
+ for (const rule of rules) {
144
+ baseRules[rule.selectors.join(",")] = rule.declarations;
145
+ if (rule.pseudo) {
146
+ const pseudoSelectors = rule.selectors.map((selector) => `${selector}::after`).join(",");
147
+ baseRules[pseudoSelectors] = rule.pseudo;
148
+ }
149
+ }
150
+ addBase(baseRules);
151
+ };
152
+ },
153
+ () => {
154
+ return {};
155
+ }
156
+ );
157
+ var reset_default = reset;
158
+ export {
159
+ reset_default as default,
160
+ reset
161
+ };
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use strict";require('./chunk-O2IOQ3BD.js');
2
- require('./chunk-WGLBMNPG.js');
2
+ require('./chunk-UTZLVU3M.js');
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
- import "./chunk-JMYADIPN.mjs";
2
+ import "./chunk-67CD2S5L.mjs";
package/dist/vite.js CHANGED
@@ -1,13 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5P342MNSjs = require('./chunk-5P342MNS.js');
4
- require('./chunk-K234IGOT.js');
3
+ var _chunkRXCVTHDOjs = require('./chunk-RXCVTHDO.js');
4
+ require('./chunk-AB45L5FP.js');
5
5
  require('./chunk-LTJQUORK.js');
6
- require('./chunk-AXEKXGG7.js');
7
- require('./chunk-ZXU4EYKV.js');
6
+ require('./chunk-FVSKLXO5.js');
7
+ require('./chunk-P6ACVBPQ.js');
8
+ require('./chunk-RJRLVYVJ.js');
8
9
  require('./chunk-ZSTF2AEN.js');
9
10
  require('./chunk-UW3WHSZ5.js');
10
- require('./chunk-WGLBMNPG.js');
11
+ require('./chunk-UTZLVU3M.js');
11
12
 
12
13
 
13
- exports.UnifiedViteWeappTailwindcssPlugin = _chunk5P342MNSjs.UnifiedViteWeappTailwindcssPlugin;
14
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkRXCVTHDOjs.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-UUVGNRUM.mjs";
3
+ } from "./chunk-WSMJXGQQ.mjs";
4
4
  import "./chunk-JW7P34IH.mjs";
5
5
  import "./chunk-RRHPTTCP.mjs";
6
- import "./chunk-WTOLVORM.mjs";
7
- import "./chunk-7KTLLGAG.mjs";
6
+ import "./chunk-SFQCTDJA.mjs";
7
+ import "./chunk-K62QTSOE.mjs";
8
+ import "./chunk-3XGTIDA6.mjs";
8
9
  import "./chunk-DKPIYG24.mjs";
9
10
  import "./chunk-ZNKIYZRQ.mjs";
10
- import "./chunk-JMYADIPN.mjs";
11
+ import "./chunk-67CD2S5L.mjs";
11
12
  export {
12
13
  UnifiedViteWeappTailwindcssPlugin
13
14
  };
package/dist/webpack.js CHANGED
@@ -1,16 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk6EATUPTNjs = require('./chunk-6EATUPTN.js');
5
- require('./chunk-47NJZTIW.js');
6
- require('./chunk-K234IGOT.js');
4
+ var _chunk6CS6EPEPjs = require('./chunk-6CS6EPEP.js');
5
+ require('./chunk-TWBCI2I3.js');
6
+ require('./chunk-AB45L5FP.js');
7
7
  require('./chunk-LTJQUORK.js');
8
- require('./chunk-AXEKXGG7.js');
9
- require('./chunk-ZXU4EYKV.js');
8
+ require('./chunk-FVSKLXO5.js');
9
+ require('./chunk-P6ACVBPQ.js');
10
+ require('./chunk-RJRLVYVJ.js');
10
11
  require('./chunk-ZSTF2AEN.js');
11
12
  require('./chunk-UW3WHSZ5.js');
12
- require('./chunk-WGLBMNPG.js');
13
+ require('./chunk-UTZLVU3M.js');
13
14
 
14
15
 
15
16
 
16
- exports.UnifiedWebpackPluginV5 = _chunk6EATUPTNjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunk6EATUPTNjs.weappTailwindcssPackageDir;
17
+ exports.UnifiedWebpackPluginV5 = _chunk6CS6EPEPjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunk6CS6EPEPjs.weappTailwindcssPackageDir;
package/dist/webpack.mjs CHANGED
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5,
3
3
  weappTailwindcssPackageDir
4
- } from "./chunk-IHJU6M6B.mjs";
5
- import "./chunk-KSHK56CW.mjs";
4
+ } from "./chunk-FE63QKGM.mjs";
5
+ import "./chunk-PSYJXCQJ.mjs";
6
6
  import "./chunk-JW7P34IH.mjs";
7
7
  import "./chunk-RRHPTTCP.mjs";
8
- import "./chunk-WTOLVORM.mjs";
9
- import "./chunk-7KTLLGAG.mjs";
8
+ import "./chunk-SFQCTDJA.mjs";
9
+ import "./chunk-K62QTSOE.mjs";
10
+ import "./chunk-3XGTIDA6.mjs";
10
11
  import "./chunk-DKPIYG24.mjs";
11
12
  import "./chunk-ZNKIYZRQ.mjs";
12
- import "./chunk-JMYADIPN.mjs";
13
+ import "./chunk-67CD2S5L.mjs";
13
14
  export {
14
15
  UnifiedWebpackPluginV5,
15
16
  weappTailwindcssPackageDir
package/dist/webpack4.js CHANGED
@@ -1,41 +1,43 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
3
 
4
- var _chunk47NJZTIWjs = require('./chunk-47NJZTIW.js');
4
+ var _chunkTWBCI2I3js = require('./chunk-TWBCI2I3.js');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkK234IGOTjs = require('./chunk-K234IGOT.js');
10
+ var _chunkAB45L5FPjs = require('./chunk-AB45L5FP.js');
11
11
 
12
12
 
13
13
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
14
14
 
15
15
 
16
+ var _chunkFVSKLXO5js = require('./chunk-FVSKLXO5.js');
16
17
 
17
18
 
18
19
 
19
20
 
20
21
 
21
- var _chunkAXEKXGG7js = require('./chunk-AXEKXGG7.js');
22
- require('./chunk-ZXU4EYKV.js');
22
+
23
+ var _chunkP6ACVBPQjs = require('./chunk-P6ACVBPQ.js');
24
+ require('./chunk-RJRLVYVJ.js');
23
25
  require('./chunk-ZSTF2AEN.js');
24
26
 
25
27
 
26
28
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
27
- require('./chunk-WGLBMNPG.js');
29
+ require('./chunk-UTZLVU3M.js');
28
30
 
29
31
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
30
32
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
31
33
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
32
34
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
33
35
  var _webpacksources = require('webpack-sources');
34
- var debug = _chunkAXEKXGG7js.createDebug.call(void 0, );
35
- var weappTailwindcssPackageDir = _chunkK234IGOTjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
36
+ var debug = _chunkP6ACVBPQjs.createDebug.call(void 0, );
37
+ var weappTailwindcssPackageDir = _chunkAB45L5FPjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
36
38
  var UnifiedWebpackPluginV4 = class {
37
39
  constructor(options = {}) {
38
- this.options = _chunkAXEKXGG7js.getCompilerContext.call(void 0, options);
40
+ this.options = _chunkP6ACVBPQjs.getCompilerContext.call(void 0, options);
39
41
  this.userSpecifiedRewriteCssImports = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
40
42
  this.appType = this.options.appType;
41
43
  }
@@ -60,23 +62,28 @@ var UnifiedWebpackPluginV4 = class {
60
62
  }
61
63
  const shouldRewriteCssImports = this.options.rewriteCssImports !== false && (this.userSpecifiedRewriteCssImports || (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4);
62
64
  if (shouldRewriteCssImports) {
63
- _chunk47NJZTIWjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
65
+ _chunkTWBCI2I3js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
64
66
  pkgDir: weappTailwindcssPackageDir,
65
67
  enabled: true
66
68
  });
67
69
  }
70
+ const patchRecorderState = _chunkFVSKLXO5js.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
71
+ source: "runtime",
72
+ cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
73
+ });
68
74
  const runtimeState = {
69
75
  twPatcher: initialTwPatcher,
70
- patchPromise: _chunkAXEKXGG7js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
71
- refreshTailwindcssPatcher
76
+ patchPromise: patchRecorderState.patchPromise,
77
+ refreshTailwindcssPatcher,
78
+ onPatchCompleted: patchRecorderState.onPatchCompleted
72
79
  };
73
80
  const refreshRuntimeState = async (force) => {
74
- await _chunkAXEKXGG7js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
81
+ await _chunkP6ACVBPQjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
75
82
  };
76
83
  async function getClassSetInLoader() {
77
84
  await refreshRuntimeState(true);
78
85
  await runtimeState.patchPromise;
79
- await _chunkAXEKXGG7js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
86
+ await _chunkP6ACVBPQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
80
87
  }
81
88
  onLoad();
82
89
  const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
@@ -94,8 +101,8 @@ var UnifiedWebpackPluginV4 = class {
94
101
  ident: null,
95
102
  type: null
96
103
  });
97
- compiler.hooks.compilation.tap(_chunkAXEKXGG7js.pluginName, (compilation) => {
98
- compilation.hooks.normalModuleLoader.tap(_chunkAXEKXGG7js.pluginName, (_loaderContext, module) => {
104
+ compiler.hooks.compilation.tap(_chunkP6ACVBPQjs.pluginName, (compilation) => {
105
+ compilation.hooks.normalModuleLoader.tap(_chunkP6ACVBPQjs.pluginName, (_loaderContext, module) => {
99
106
  if (isExisted) {
100
107
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
101
108
  if (idx > -1) {
@@ -106,7 +113,7 @@ var UnifiedWebpackPluginV4 = class {
106
113
  }
107
114
  });
108
115
  });
109
- compiler.hooks.emit.tapPromise(_chunkAXEKXGG7js.pluginName, async (compilation) => {
116
+ compiler.hooks.emit.tapPromise(_chunkP6ACVBPQjs.pluginName, async (compilation) => {
110
117
  await runtimeState.patchPromise;
111
118
  onStart();
112
119
  debug("start");
@@ -121,13 +128,13 @@ var UnifiedWebpackPluginV4 = class {
121
128
  const jsAssets = /* @__PURE__ */ new Map();
122
129
  for (const [file] of entries) {
123
130
  if (this.options.jsMatcher(file) || this.options.wxsMatcher(file)) {
124
- const absolute = _chunkK234IGOTjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
131
+ const absolute = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
125
132
  jsAssets.set(absolute, file);
126
133
  }
127
134
  }
128
135
  const moduleGraphOptions = {
129
136
  resolve(specifier, importer) {
130
- return _chunkK234IGOTjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
137
+ return _chunkAB45L5FPjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
131
138
  },
132
139
  load: (id) => {
133
140
  const assetName = jsAssets.get(id);
@@ -172,7 +179,7 @@ var UnifiedWebpackPluginV4 = class {
172
179
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
173
180
  await refreshRuntimeState(true);
174
181
  await runtimeState.patchPromise;
175
- const runtimeSet = await _chunkAXEKXGG7js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
182
+ const runtimeSet = await _chunkP6ACVBPQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
176
183
  debug("get runtimeSet, class count: %d", runtimeSet.size);
177
184
  const tasks = [];
178
185
  if (Array.isArray(groupedEntries.html)) {
@@ -209,14 +216,14 @@ var UnifiedWebpackPluginV4 = class {
209
216
  const jsTaskFactories = [];
210
217
  if (Array.isArray(groupedEntries.js)) {
211
218
  for (const [file] of groupedEntries.js) {
212
- const cacheKey = _chunk47NJZTIWjs.getCacheKey.call(void 0, file);
219
+ const cacheKey = _chunkTWBCI2I3js.getCacheKey.call(void 0, file);
213
220
  const assetSource = compilation.assets[file];
214
221
  if (!assetSource) {
215
222
  continue;
216
223
  }
217
224
  const initialValue = assetSource.source();
218
225
  const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
219
- const absoluteFile = _chunkK234IGOTjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
226
+ const absoluteFile = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
220
227
  jsTaskFactories.push(async () => {
221
228
  await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
222
229
  cache,
@@ -289,7 +296,7 @@ var UnifiedWebpackPluginV4 = class {
289
296
  );
290
297
  }
291
298
  }
292
- _chunkK234IGOTjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
299
+ _chunkAB45L5FPjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
293
300
  await Promise.all(tasks);
294
301
  debug("end");
295
302
  onEnd();