weapp-tailwindcss 3.3.7 → 3.4.0-alpha.1

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 (138) hide show
  1. package/dist/chunk-23B34GUU.js +126 -0
  2. package/dist/chunk-33GCHXV2.js +953 -0
  3. package/dist/chunk-556KTBON.js +31 -0
  4. package/dist/chunk-6Z776ZWK.js +43 -0
  5. package/dist/chunk-75EWCRQW.mjs +13 -0
  6. package/dist/chunk-76AXDOI5.js +173 -0
  7. package/dist/chunk-77FRX3XG.js +30 -0
  8. package/dist/chunk-AB467PG7.mjs +43 -0
  9. package/dist/chunk-D7TNNBED.js +95 -0
  10. package/dist/chunk-E7XGHGC7.mjs +62 -0
  11. package/dist/chunk-F7IR3ASC.mjs +152 -0
  12. package/dist/chunk-GUE4UCRJ.mjs +126 -0
  13. package/dist/chunk-H62TECOL.js +216 -0
  14. package/dist/chunk-HBQASQKY.js +13 -0
  15. package/dist/chunk-IOYI6MSW.mjs +533 -0
  16. package/dist/chunk-JMMU4NZL.mjs +173 -0
  17. package/dist/chunk-KR2M4GD3.mjs +953 -0
  18. package/dist/chunk-LYLCSEZ7.js +152 -0
  19. package/dist/chunk-NVFWRLOI.mjs +27 -0
  20. package/dist/chunk-ODCGCGWM.js +533 -0
  21. package/dist/chunk-ORMKM6ZA.mjs +30 -0
  22. package/dist/chunk-S2GPPMOJ.js +27 -0
  23. package/dist/chunk-SRLZU2YE.mjs +95 -0
  24. package/dist/chunk-U2UGOG3R.js +62 -0
  25. package/dist/chunk-VECXHWWG.mjs +31 -0
  26. package/dist/chunk-Z3EH2XYL.mjs +216 -0
  27. package/dist/cli.d.mts +2 -0
  28. package/dist/cli.d.ts +2 -1
  29. package/dist/cli.js +32 -51
  30. package/dist/cli.mjs +34 -46
  31. package/dist/core.d.mts +22 -0
  32. package/dist/core.d.ts +16 -2
  33. package/dist/core.js +43 -63
  34. package/dist/core.mjs +46 -62
  35. package/dist/css-macro/index.d.mts +18 -0
  36. package/dist/css-macro/index.d.ts +7 -4
  37. package/dist/css-macro/index.js +37 -34
  38. package/dist/css-macro/index.mjs +35 -28
  39. package/dist/css-macro/postcss.d.mts +7 -0
  40. package/dist/css-macro/postcss.d.ts +5 -3
  41. package/dist/css-macro/postcss.js +54 -45
  42. package/dist/css-macro/postcss.mjs +54 -45
  43. package/dist/defaults.d.mts +16 -0
  44. package/dist/defaults.d.ts +16 -2
  45. package/dist/defaults.js +6 -9
  46. package/dist/defaults.mjs +9 -4
  47. package/dist/gulp.d.mts +26 -0
  48. package/dist/gulp.d.ts +26 -1
  49. package/dist/gulp.js +12 -37
  50. package/dist/gulp.mjs +15 -32
  51. package/dist/index.d.mts +17 -0
  52. package/dist/index.d.ts +17 -4
  53. package/dist/index.js +23 -44
  54. package/dist/index.mjs +23 -34
  55. package/dist/postcss.d.mts +23 -0
  56. package/dist/postcss.d.ts +23 -1
  57. package/dist/postcss.js +10 -24
  58. package/dist/postcss.mjs +17 -8
  59. package/dist/replace.d.mts +19 -0
  60. package/dist/replace.d.ts +19 -3
  61. package/dist/replace.js +30 -50
  62. package/dist/replace.mjs +30 -26
  63. package/dist/types-DSNuiOhH.d.mts +519 -0
  64. package/dist/types-DSNuiOhH.d.ts +519 -0
  65. package/dist/vite.d.mts +22 -0
  66. package/dist/vite.d.ts +22 -1
  67. package/dist/vite.js +12 -35
  68. package/dist/vite.mjs +15 -30
  69. package/dist/weapp-tw-runtime-loader.d.mts +7 -0
  70. package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
  71. package/dist/weapp-tw-runtime-loader.js +12 -12
  72. package/dist/weapp-tw-runtime-loader.mjs +12 -8
  73. package/dist/webpack.d.mts +26 -0
  74. package/dist/webpack.d.ts +26 -1
  75. package/dist/webpack.js +12 -35
  76. package/dist/webpack.mjs +15 -30
  77. package/dist/webpack4.d.mts +27 -0
  78. package/dist/webpack4.d.ts +27 -1
  79. package/dist/webpack4.js +205 -192
  80. package/dist/webpack4.mjs +211 -189
  81. package/package.json +18 -19
  82. package/dist/babel/index.d.ts +0 -16
  83. package/dist/bundlers/gulp/index.d.ts +0 -8
  84. package/dist/bundlers/vite/index.d.ts +0 -3
  85. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
  86. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
  87. package/dist/bundlers/webpack/index.d.ts +0 -1
  88. package/dist/cache/index.d.ts +0 -32
  89. package/dist/constants-CFM1J-h1.js +0 -42
  90. package/dist/constants-Dy2Dd3Fz.mjs +0 -36
  91. package/dist/constants.d.ts +0 -7
  92. package/dist/css-macro/constants.d.ts +0 -14
  93. package/dist/debug/index.d.ts +0 -2
  94. package/dist/defaults-DUZZvtdg.mjs +0 -149
  95. package/dist/defaults-syv_N3uk.js +0 -156
  96. package/dist/defu-Cdz2PomB.js +0 -60
  97. package/dist/defu-n46TJT6t.mjs +0 -57
  98. package/dist/env.d.ts +0 -2
  99. package/dist/escape.d.ts +0 -4
  100. package/dist/extractors/split.d.ts +0 -3
  101. package/dist/index-B8TOcVAt.js +0 -130
  102. package/dist/index-BEIjgKpF.mjs +0 -11
  103. package/dist/index-BKZH-Gxq.mjs +0 -134
  104. package/dist/index-BPzIdybK.mjs +0 -513
  105. package/dist/index-Bc61v7B0.mjs +0 -124
  106. package/dist/index-DXeB6ex8.js +0 -136
  107. package/dist/index-DwZHOkK3.js +0 -526
  108. package/dist/index-HC-Qkn0i.js +0 -17
  109. package/dist/js/handlers.d.ts +0 -13
  110. package/dist/js/index.d.ts +0 -7
  111. package/dist/mangle/index.d.ts +0 -8
  112. package/dist/options-BHJnjA_a.mjs +0 -981
  113. package/dist/options-DAp5AdGz.js +0 -1014
  114. package/dist/options.d.ts +0 -2
  115. package/dist/postcss/cssVars.d.ts +0 -5
  116. package/dist/postcss/index.d.ts +0 -3
  117. package/dist/postcss/mp.d.ts +0 -8
  118. package/dist/postcss/plugins/ctx.d.ts +0 -6
  119. package/dist/postcss/plugins/index.d.ts +0 -7
  120. package/dist/postcss/plugins/post.d.ts +0 -5
  121. package/dist/postcss/plugins/pre.d.ts +0 -5
  122. package/dist/postcss/preflight.d.ts +0 -3
  123. package/dist/postcss/selectorParser.d.ts +0 -6
  124. package/dist/postcss/shared.d.ts +0 -3
  125. package/dist/postcss/symbols.d.ts +0 -1
  126. package/dist/reg.d.ts +0 -1
  127. package/dist/shared-DbJl6i6a.mjs +0 -25
  128. package/dist/shared-hzYeE1wX.js +0 -28
  129. package/dist/tailwindcss/patcher.d.ts +0 -8
  130. package/dist/tailwindcss/supportCustomUnit.d.ts +0 -6
  131. package/dist/types.d.ts +0 -179
  132. package/dist/utils.d.ts +0 -18
  133. package/dist/v5-B9S3lBOs.mjs +0 -174
  134. package/dist/v5-QURRYPNk.js +0 -181
  135. package/dist/wxml/Tokenizer.d.ts +0 -31
  136. package/dist/wxml/index.d.ts +0 -2
  137. package/dist/wxml/shared.d.ts +0 -2
  138. package/dist/wxml/utils.d.ts +0 -9
@@ -0,0 +1,152 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkHBQASQKYjs = require('./chunk-HBQASQKY.js');
4
+
5
+
6
+ var _chunk33GCHXV2js = require('./chunk-33GCHXV2.js');
7
+
8
+
9
+
10
+ var _chunkU2UGOG3Rjs = require('./chunk-U2UGOG3R.js');
11
+
12
+ // src/bundlers/gulp/index.ts
13
+ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
14
+ var _buffer = require('buffer');
15
+ var debug = _chunkHBQASQKYjs.createDebug.call(void 0, );
16
+ var Transform = _stream2.default.Transform;
17
+ function createPlugins(options = {}) {
18
+ const opts = _chunk33GCHXV2js.getOptions.call(void 0, options);
19
+ const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
20
+ let runtimeSet = /* @__PURE__ */ new Set();
21
+ patch == null ? void 0 : patch();
22
+ function transformWxss(options2 = {}) {
23
+ return new Transform({
24
+ objectMode: true,
25
+ transform(file, encoding, callback) {
26
+ return _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
27
+ runtimeSet = twPatcher.getClassSet();
28
+ setMangleRuntimeSet(runtimeSet);
29
+ const error = null;
30
+ if (file.contents) {
31
+ const rawSource = file.contents.toString();
32
+ const hash = cache.computeHash(rawSource);
33
+ cache.calcHashValueChanged(file.path, hash);
34
+ yield cache.process(
35
+ file.path,
36
+ () => {
37
+ const source = cache.get(file.path);
38
+ if (source) {
39
+ file.contents = _buffer.Buffer.from(source);
40
+ debug("css cache hit: %s", file.path);
41
+ } else {
42
+ return false;
43
+ }
44
+ },
45
+ () => _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
46
+ const code = yield styleHandler(rawSource, _chunkU2UGOG3Rjs.__spreadValues.call(void 0, {
47
+ isMainChunk: true
48
+ }, options2));
49
+ file.contents = _buffer.Buffer.from(code);
50
+ debug("css handle: %s", file.path);
51
+ return {
52
+ key: file.path,
53
+ source: code
54
+ };
55
+ })
56
+ );
57
+ }
58
+ callback(error, file);
59
+ });
60
+ }
61
+ // construct(callback) {
62
+ // debug('transformWxss start')
63
+ // callback()
64
+ // }
65
+ });
66
+ }
67
+ function transformJs(options2 = {}) {
68
+ return new Transform({
69
+ objectMode: true,
70
+ transform(file, encoding, callback) {
71
+ return _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
72
+ const error = null;
73
+ if (file.contents) {
74
+ const rawSource = file.contents.toString();
75
+ const hash = cache.computeHash(rawSource);
76
+ cache.calcHashValueChanged(file.path, hash);
77
+ yield cache.process(
78
+ file.path,
79
+ () => {
80
+ const source = cache.get(file.path);
81
+ if (source) {
82
+ file.contents = _buffer.Buffer.from(source);
83
+ debug("js cache hit: %s", file.path);
84
+ } else {
85
+ return false;
86
+ }
87
+ },
88
+ () => _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
89
+ const { code } = yield jsHandler(rawSource, runtimeSet, options2);
90
+ file.contents = _buffer.Buffer.from(code);
91
+ debug("js handle: %s", file.path);
92
+ return {
93
+ key: file.path,
94
+ source: code
95
+ };
96
+ })
97
+ );
98
+ }
99
+ callback(error, file);
100
+ });
101
+ }
102
+ });
103
+ }
104
+ function transformWxml(options2 = {}) {
105
+ return new Transform({
106
+ objectMode: true,
107
+ transform(file, encoding, callback) {
108
+ return _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
109
+ const error = null;
110
+ if (file.contents) {
111
+ const rawSource = file.contents.toString();
112
+ const hash = cache.computeHash(rawSource);
113
+ cache.calcHashValueChanged(file.path, hash);
114
+ yield cache.process(
115
+ file.path,
116
+ () => {
117
+ const source = cache.get(file.path);
118
+ if (source) {
119
+ file.contents = _buffer.Buffer.from(source);
120
+ debug("html cache hit: %s", file.path);
121
+ } else {
122
+ return false;
123
+ }
124
+ },
125
+ () => _chunkU2UGOG3Rjs.__async.call(void 0, this, null, function* () {
126
+ const code = yield templateHandler(rawSource, _chunkU2UGOG3Rjs.__spreadValues.call(void 0, {
127
+ runtimeSet
128
+ }, options2));
129
+ file.contents = _buffer.Buffer.from(code);
130
+ debug("html handle: %s", file.path);
131
+ return {
132
+ key: file.path,
133
+ source: code
134
+ };
135
+ })
136
+ );
137
+ }
138
+ callback(error, file);
139
+ });
140
+ }
141
+ });
142
+ }
143
+ return {
144
+ transformWxss,
145
+ transformWxml,
146
+ transformJs
147
+ };
148
+ }
149
+
150
+
151
+
152
+ exports.createPlugins = createPlugins;
@@ -0,0 +1,27 @@
1
+ import {
2
+ escape_exports
3
+ } from "./chunk-VECXHWWG.mjs";
4
+
5
+ // src/wxml/shared.ts
6
+ function replaceWxml(original, options = {
7
+ keepEOL: false,
8
+ escapeMap: escape_exports.SimpleMappingChars2String
9
+ }) {
10
+ const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
11
+ let res = original;
12
+ if (!keepEOL) {
13
+ res = res.replaceAll(/[\n\r]+/g, "");
14
+ }
15
+ if (mangleContext) {
16
+ res = mangleContext.wxmlHandler(res);
17
+ }
18
+ res = (0, escape_exports.escape)(res, {
19
+ map: escapeMap,
20
+ ignoreHead
21
+ });
22
+ return res;
23
+ }
24
+
25
+ export {
26
+ replaceWxml
27
+ };
@@ -0,0 +1,533 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunk77FRX3XGjs = require('./chunk-77FRX3XG.js');
5
+
6
+ // src/constants.ts
7
+ var postcssPlugin = "postcss-weapp-tailwindcss-rename-plugin";
8
+ var pluginName = "weapp-tailwindcss-webpack-plugin";
9
+ var vitePluginName = "vite-plugin-uni-app-weapp-tailwindcss-adaptor";
10
+ var WEAPP_TW_REQUIRED_NODE_VERSION = "16.6.0";
11
+
12
+ // src/postcss/selectorParser.ts
13
+ var _postcssselectorparser = require('postcss-selector-parser'); var _postcssselectorparser2 = _interopRequireDefault(_postcssselectorparser);
14
+ function createRuleTransform(rule, options) {
15
+ const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
16
+ const transform = (selectors) => {
17
+ selectors.walk((selector) => {
18
+ if (selector.type === "universal" && cssSelectorReplacement && cssSelectorReplacement.universal) {
19
+ selector.value = _chunk77FRX3XGjs.composeIsPseudo.call(void 0, cssSelectorReplacement.universal);
20
+ }
21
+ if (cssRemoveHoverPseudoClass && selector.type === "selector") {
22
+ const node = selector.nodes.find((x) => x.type === "pseudo" && x.value === ":hover");
23
+ node && selector.remove();
24
+ }
25
+ if (selector.type === "pseudo" && selector.value === ":root" && cssSelectorReplacement && cssSelectorReplacement.root) {
26
+ selector.value = _chunk77FRX3XGjs.composeIsPseudo.call(void 0, cssSelectorReplacement.root);
27
+ }
28
+ if (selector.type === "class") {
29
+ selector.value = _chunk77FRX3XGjs.internalCssSelectorReplacer.call(void 0, selector.value, {
30
+ escapeMap,
31
+ mangleContext
32
+ });
33
+ }
34
+ });
35
+ if (selectors.length === 0) {
36
+ rule.remove();
37
+ }
38
+ };
39
+ return transform;
40
+ }
41
+ function getRuleTransformer(rule, options) {
42
+ return _postcssselectorparser2.default.call(void 0, createRuleTransform(rule, options));
43
+ }
44
+ function ruleTransformSync(rule, options) {
45
+ const transformer = getRuleTransformer(rule, options);
46
+ return transformer.transformSync(rule, {
47
+ lossless: false,
48
+ updateSelector: true
49
+ });
50
+ }
51
+ function isOnlyBeforeAndAfterPseudoElement(node) {
52
+ let b = false;
53
+ let a = false;
54
+ _postcssselectorparser2.default.call(void 0, (selectors) => {
55
+ selectors.walkPseudos((s) => {
56
+ var _a;
57
+ if (((_a = s.parent) == null ? void 0 : _a.length) === 1) {
58
+ if (/^:?:before$/.test(s.value)) {
59
+ b = true;
60
+ }
61
+ if (/^:?:after$/.test(s.value)) {
62
+ a = true;
63
+ }
64
+ }
65
+ });
66
+ }).astSync(node);
67
+ return b && a;
68
+ }
69
+ var fallbackRemove = _postcssselectorparser2.default.call(void 0, (selectors) => {
70
+ selectors.walk((selector) => {
71
+ var _a, _b;
72
+ if (selector.type === "universal") {
73
+ (_a = selector.parent) == null ? void 0 : _a.remove();
74
+ }
75
+ if (selector.type === "pseudo" && selector.value === ":is") {
76
+ (_b = selector.parent) == null ? void 0 : _b.remove();
77
+ }
78
+ });
79
+ });
80
+
81
+ // src/postcss/mp.ts
82
+ var _postcss = require('postcss');
83
+
84
+ // src/postcss/cssVars.ts
85
+ var cssVars_default = [
86
+ {
87
+ prop: "--tw-border-spacing-x",
88
+ value: "0"
89
+ },
90
+ {
91
+ prop: "--tw-border-spacing-y",
92
+ value: "0"
93
+ },
94
+ {
95
+ prop: "--tw-translate-x",
96
+ value: "0"
97
+ },
98
+ {
99
+ prop: "--tw-translate-y",
100
+ value: "0"
101
+ },
102
+ {
103
+ prop: "--tw-rotate",
104
+ value: "0"
105
+ },
106
+ {
107
+ prop: "--tw-skew-x",
108
+ value: "0"
109
+ },
110
+ {
111
+ prop: "--tw-skew-y",
112
+ value: "0"
113
+ },
114
+ {
115
+ prop: "--tw-scale-x",
116
+ value: "1"
117
+ },
118
+ {
119
+ prop: "--tw-scale-y",
120
+ value: "1"
121
+ },
122
+ {
123
+ prop: "--tw-pan-x",
124
+ value: " "
125
+ },
126
+ {
127
+ prop: "--tw-pan-y",
128
+ value: " "
129
+ },
130
+ {
131
+ prop: "--tw-pinch-zoom",
132
+ value: " "
133
+ },
134
+ {
135
+ prop: "--tw-scroll-snap-strictness",
136
+ value: "proximity"
137
+ },
138
+ {
139
+ prop: "--tw-gradient-from-position",
140
+ value: " "
141
+ },
142
+ {
143
+ prop: "--tw-gradient-via-position",
144
+ value: " "
145
+ },
146
+ {
147
+ prop: "--tw-gradient-to-position",
148
+ value: " "
149
+ },
150
+ {
151
+ prop: "--tw-ordinal",
152
+ value: " "
153
+ },
154
+ {
155
+ prop: "--tw-slashed-zero",
156
+ value: " "
157
+ },
158
+ {
159
+ prop: "--tw-numeric-figure",
160
+ value: " "
161
+ },
162
+ {
163
+ prop: "--tw-numeric-spacing",
164
+ value: " "
165
+ },
166
+ {
167
+ prop: "--tw-numeric-fraction",
168
+ value: " "
169
+ },
170
+ {
171
+ prop: "--tw-ring-inset",
172
+ value: " "
173
+ },
174
+ {
175
+ prop: "--tw-ring-offset-width",
176
+ value: "0px"
177
+ },
178
+ {
179
+ prop: "--tw-ring-offset-color",
180
+ value: "#fff"
181
+ },
182
+ {
183
+ prop: "--tw-ring-color",
184
+ value: "rgb(59 130 246 / 0.5)"
185
+ },
186
+ {
187
+ prop: "--tw-ring-offset-shadow",
188
+ value: "0 0 #0000"
189
+ },
190
+ {
191
+ prop: "--tw-ring-shadow",
192
+ value: "0 0 #0000"
193
+ },
194
+ {
195
+ prop: "--tw-shadow",
196
+ value: "0 0 #0000"
197
+ },
198
+ {
199
+ prop: "--tw-shadow-colored",
200
+ value: "0 0 #0000"
201
+ },
202
+ {
203
+ prop: "--tw-blur",
204
+ value: " "
205
+ },
206
+ {
207
+ prop: "--tw-brightness",
208
+ value: " "
209
+ },
210
+ {
211
+ prop: "--tw-contrast",
212
+ value: " "
213
+ },
214
+ {
215
+ prop: "--tw-grayscale",
216
+ value: " "
217
+ },
218
+ {
219
+ prop: "--tw-hue-rotate",
220
+ value: " "
221
+ },
222
+ {
223
+ prop: "--tw-invert",
224
+ value: " "
225
+ },
226
+ {
227
+ prop: "--tw-saturate",
228
+ value: " "
229
+ },
230
+ {
231
+ prop: "--tw-sepia",
232
+ value: " "
233
+ },
234
+ {
235
+ prop: "--tw-drop-shadow",
236
+ value: " "
237
+ },
238
+ {
239
+ prop: "--tw-backdrop-blur",
240
+ value: " "
241
+ },
242
+ {
243
+ prop: "--tw-backdrop-brightness",
244
+ value: " "
245
+ },
246
+ {
247
+ prop: "--tw-backdrop-contrast",
248
+ value: " "
249
+ },
250
+ {
251
+ prop: "--tw-backdrop-grayscale",
252
+ value: " "
253
+ },
254
+ {
255
+ prop: "--tw-backdrop-hue-rotate",
256
+ value: " "
257
+ },
258
+ {
259
+ prop: "--tw-backdrop-invert",
260
+ value: " "
261
+ },
262
+ {
263
+ prop: "--tw-backdrop-opacity",
264
+ value: " "
265
+ },
266
+ {
267
+ prop: "--tw-backdrop-saturate",
268
+ value: " "
269
+ },
270
+ {
271
+ prop: "--tw-backdrop-sepia",
272
+ value: " "
273
+ },
274
+ {
275
+ prop: "--tw-contain-size",
276
+ value: " "
277
+ },
278
+ {
279
+ prop: "--tw-contain-layout",
280
+ value: " "
281
+ },
282
+ {
283
+ prop: "--tw-contain-paint",
284
+ value: " "
285
+ },
286
+ {
287
+ prop: "--tw-contain-style",
288
+ value: " "
289
+ }
290
+ ];
291
+
292
+ // src/postcss/mp.ts
293
+ var initialNodes = cssVars_default.map((x) => {
294
+ return new (0, _postcss.Declaration)({
295
+ prop: x.prop,
296
+ value: x.value
297
+ });
298
+ });
299
+ var PATTERNS = [
300
+ /:not\(template\)\s*[~+]\s*:not\(template\)/.source,
301
+ /:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source
302
+ ].join("|");
303
+ var BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, "g");
304
+ function testIfVariablesScope(node, count = 2) {
305
+ if (isOnlyBeforeAndAfterPseudoElement(node)) {
306
+ const nodes = node.nodes;
307
+ let c = 0;
308
+ for (const tryTestDecl of nodes) {
309
+ if (tryTestDecl && tryTestDecl.type === "decl" && tryTestDecl.prop.startsWith("--tw-")) {
310
+ c++;
311
+ }
312
+ if (c >= count) {
313
+ return true;
314
+ }
315
+ }
316
+ return false;
317
+ }
318
+ return false;
319
+ }
320
+ function testIfTwBackdrop(node, count = 2) {
321
+ if (node.type === "rule" && node.selector === "::backdrop") {
322
+ const nodes = node.nodes;
323
+ let c = 0;
324
+ for (const tryTestDecl of nodes) {
325
+ if (tryTestDecl && tryTestDecl.type === "decl" && tryTestDecl.prop.startsWith("--tw-")) {
326
+ c++;
327
+ }
328
+ if (c >= count) {
329
+ return true;
330
+ }
331
+ }
332
+ return false;
333
+ }
334
+ return false;
335
+ }
336
+ function makePseudoVarRule() {
337
+ const pseudoVarRule = new (0, _postcss.Rule)({
338
+ // selectors: ['::before', '::after'],
339
+ selector: "::before,::after"
340
+ });
341
+ pseudoVarRule.append(
342
+ new (0, _postcss.Declaration)({
343
+ prop: "--tw-content",
344
+ value: '""'
345
+ })
346
+ );
347
+ return pseudoVarRule;
348
+ }
349
+ function remakeCssVarSelector(selectors, options) {
350
+ const { cssPreflightRange, cssSelectorReplacement } = options;
351
+ if (cssPreflightRange === "all" && !selectors.includes(":not(not)")) {
352
+ selectors.push(":not(not)");
353
+ }
354
+ if (cssSelectorReplacement) {
355
+ if (Array.isArray(cssSelectorReplacement.universal)) {
356
+ if (!cssSelectorReplacement.universal.every((x) => {
357
+ return selectors.includes(x);
358
+ }) && !selectors.includes("*")) {
359
+ selectors.unshift("*");
360
+ }
361
+ } else if (typeof cssSelectorReplacement.universal === "string" && !selectors.includes(cssSelectorReplacement.universal) && !selectors.includes("*")) {
362
+ selectors.unshift("*");
363
+ }
364
+ }
365
+ return selectors;
366
+ }
367
+ function remakeCombinatorSelector(selector, cssChildCombinatorReplaceValue) {
368
+ let childCombinatorReplaceValue = "view + view";
369
+ if (Array.isArray(cssChildCombinatorReplaceValue) && cssChildCombinatorReplaceValue.length > 0) {
370
+ const x = _chunk77FRX3XGjs.composeIsPseudo.call(void 0, cssChildCombinatorReplaceValue);
371
+ childCombinatorReplaceValue = `${x} + ${x}`;
372
+ } else if (typeof cssChildCombinatorReplaceValue === "string") {
373
+ childCombinatorReplaceValue = cssChildCombinatorReplaceValue;
374
+ }
375
+ return selector.replaceAll(BROAD_MATCH_GLOBAL_REGEXP, childCombinatorReplaceValue);
376
+ }
377
+ function commonChunkPreflight(node, options) {
378
+ const { ctx, cssChildCombinatorReplaceValue, cssInjectPreflight, injectAdditionalCssVarScope } = options;
379
+ node.selector = remakeCombinatorSelector(node.selector, cssChildCombinatorReplaceValue);
380
+ if (testIfVariablesScope(node)) {
381
+ ctx == null ? void 0 : ctx.markVariablesScope(node);
382
+ node.selectors = remakeCssVarSelector(node.selectors, options);
383
+ node.before(makePseudoVarRule());
384
+ if (typeof cssInjectPreflight === "function") {
385
+ node.append(...cssInjectPreflight());
386
+ }
387
+ }
388
+ if (injectAdditionalCssVarScope && testIfTwBackdrop(node)) {
389
+ const syntheticRule = new (0, _postcss.Rule)({
390
+ selectors: ["*", "::after", "::before"],
391
+ nodes: initialNodes
392
+ });
393
+ syntheticRule.selectors = remakeCssVarSelector(syntheticRule.selectors, options);
394
+ node.before(syntheticRule);
395
+ node.before(makePseudoVarRule());
396
+ if (typeof cssInjectPreflight === "function") {
397
+ syntheticRule.append(...cssInjectPreflight());
398
+ }
399
+ }
400
+ }
401
+
402
+ // src/postcss/plugins/pre.ts
403
+ function isAtMediaHover(atRule) {
404
+ return /media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name) || atRule.name === "media" && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params);
405
+ }
406
+ var postcssWeappTailwindcssPrePlugin = (options = {
407
+ isMainChunk: true
408
+ }) => {
409
+ const { isMainChunk } = options;
410
+ const p = {
411
+ postcssPlugin,
412
+ Rule(rule) {
413
+ ruleTransformSync(rule, options);
414
+ },
415
+ AtRule(atRule) {
416
+ if (isAtMediaHover(atRule)) {
417
+ if (atRule.nodes) {
418
+ atRule.replaceWith(atRule.nodes);
419
+ } else {
420
+ atRule.remove();
421
+ }
422
+ }
423
+ }
424
+ };
425
+ if (isMainChunk) {
426
+ p.Once = (root) => {
427
+ root.walkRules((rule) => {
428
+ commonChunkPreflight(rule, options);
429
+ });
430
+ };
431
+ }
432
+ return p;
433
+ };
434
+ postcssWeappTailwindcssPrePlugin.postcss = true;
435
+
436
+ // src/postcss/plugins/post.ts
437
+ var postcssWeappTailwindcssPostPlugin = (options = {
438
+ isMainChunk: true
439
+ }) => {
440
+ const { customRuleCallback, isMainChunk, ctx } = options;
441
+ const p = {
442
+ postcssPlugin
443
+ };
444
+ if (isMainChunk) {
445
+ p.OnceExit = (root) => {
446
+ root.walkRules((rule) => {
447
+ if (ctx) {
448
+ if (ctx.isVariablesScope(rule)) {
449
+ fallbackRemove.transformSync(rule, {
450
+ updateSelector: true,
451
+ lossless: false
452
+ });
453
+ }
454
+ } else if (testIfVariablesScope(rule)) {
455
+ fallbackRemove.transformSync(rule, {
456
+ updateSelector: true,
457
+ lossless: false
458
+ });
459
+ }
460
+ });
461
+ };
462
+ }
463
+ if (typeof customRuleCallback === "function") {
464
+ p.Rule = (rule) => {
465
+ customRuleCallback(rule, options);
466
+ };
467
+ }
468
+ return p;
469
+ };
470
+ postcssWeappTailwindcssPostPlugin.postcss = true;
471
+
472
+ // src/postcss/plugins/index.ts
473
+ var _postcssispseudoclass = require('@csstools/postcss-is-pseudo-class'); var _postcssispseudoclass2 = _interopRequireDefault(_postcssispseudoclass);
474
+ var _postcssremtoresponsivepixel = require('postcss-rem-to-responsive-pixel'); var _postcssremtoresponsivepixel2 = _interopRequireDefault(_postcssremtoresponsivepixel);
475
+
476
+ // src/postcss/symbols.ts
477
+ var VariablesScopeSymbol = Symbol("VariablesScope");
478
+
479
+ // src/postcss/plugins/ctx.ts
480
+ function createContext() {
481
+ const variablesScopeWeakMap = /* @__PURE__ */ new WeakMap();
482
+ function isVariablesScope(rule) {
483
+ return variablesScopeWeakMap.get(rule) === VariablesScopeSymbol;
484
+ }
485
+ function markVariablesScope(rule) {
486
+ variablesScopeWeakMap.set(rule, VariablesScopeSymbol);
487
+ }
488
+ return {
489
+ variablesScopeWeakMap,
490
+ isVariablesScope,
491
+ markVariablesScope
492
+ };
493
+ }
494
+
495
+ // src/postcss/plugins/index.ts
496
+
497
+
498
+ function getPlugins(options) {
499
+ var _a, _b;
500
+ const ctx = createContext();
501
+ options.ctx = ctx;
502
+ const plugins = [
503
+ ...(_b = (_a = options.postcssOptions) == null ? void 0 : _a.plugins) != null ? _b : [],
504
+ postcssWeappTailwindcssPrePlugin(options),
505
+ _postcssispseudoclass2.default.call(void 0, {
506
+ specificityMatchingName: "weapp-tw-ig"
507
+ })
508
+ ];
509
+ if (options.rem2rpx) {
510
+ plugins.push(
511
+ _postcssremtoresponsivepixel2.default.call(void 0,
512
+ typeof options.rem2rpx === "object" ? options.rem2rpx : {
513
+ rootValue: 32,
514
+ propList: ["*"],
515
+ transformUnit: "rpx"
516
+ }
517
+ )
518
+ );
519
+ }
520
+ plugins.push(postcssWeappTailwindcssPostPlugin(options));
521
+ return plugins;
522
+ }
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+ exports.pluginName = pluginName; exports.vitePluginName = vitePluginName; exports.WEAPP_TW_REQUIRED_NODE_VERSION = WEAPP_TW_REQUIRED_NODE_VERSION; exports.postcssWeappTailwindcssPrePlugin = postcssWeappTailwindcssPrePlugin; exports.postcssWeappTailwindcssPostPlugin = postcssWeappTailwindcssPostPlugin; exports.getPlugins = getPlugins; exports.default = _postcssispseudoclass2.default; exports.default2 = _postcssremtoresponsivepixel2.default;