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