weapp-tailwindcss 3.3.7 → 3.4.0-alpha.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.
- package/dist/chunk-257YPDSI.mjs +173 -0
- package/dist/chunk-75EWCRQW.mjs +13 -0
- package/dist/chunk-AB467PG7.mjs +43 -0
- package/dist/chunk-E7XGHGC7.mjs +62 -0
- package/dist/chunk-GUE4UCRJ.mjs +126 -0
- package/dist/chunk-IOYI6MSW.mjs +533 -0
- package/dist/chunk-LDWI65M5.mjs +152 -0
- package/dist/chunk-NVFWRLOI.mjs +27 -0
- package/dist/chunk-ORMKM6ZA.mjs +30 -0
- package/dist/chunk-PC4B5JJB.mjs +953 -0
- package/dist/chunk-SRLZU2YE.mjs +95 -0
- package/dist/chunk-VECXHWWG.mjs +31 -0
- package/dist/chunk-VN37QGSM.mjs +216 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +1760 -52
- package/dist/cli.mjs +34 -46
- package/dist/core.d.mts +22 -0
- package/dist/core.d.ts +16 -2
- package/dist/core.js +1775 -62
- package/dist/core.mjs +46 -62
- package/dist/css-macro/index.d.mts +18 -0
- package/dist/css-macro/index.d.ts +7 -4
- package/dist/css-macro/index.js +140 -30
- package/dist/css-macro/index.mjs +35 -28
- package/dist/css-macro/postcss.d.mts +7 -0
- package/dist/css-macro/postcss.d.ts +5 -3
- package/dist/css-macro/postcss.js +99 -46
- package/dist/css-macro/postcss.mjs +54 -45
- package/dist/defaults.d.mts +16 -0
- package/dist/defaults.d.ts +16 -2
- package/dist/defaults.js +208 -7
- package/dist/defaults.mjs +9 -4
- package/dist/gulp.d.mts +26 -0
- package/dist/gulp.d.ts +26 -1
- package/dist/gulp.js +1898 -40
- package/dist/gulp.mjs +15 -32
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +2291 -44
- package/dist/index.mjs +23 -34
- package/dist/postcss.d.mts +23 -0
- package/dist/postcss.d.ts +23 -1
- package/dist/postcss.js +598 -22
- package/dist/postcss.mjs +17 -8
- package/dist/replace.d.mts +19 -0
- package/dist/replace.d.ts +19 -3
- package/dist/replace.js +93 -42
- package/dist/replace.mjs +30 -26
- package/dist/types-DSNuiOhH.d.mts +519 -0
- package/dist/types-DSNuiOhH.d.ts +519 -0
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -1
- package/dist/vite.js +1947 -38
- package/dist/vite.mjs +15 -30
- package/dist/weapp-tw-runtime-loader.d.mts +7 -0
- package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
- package/dist/weapp-tw-runtime-loader.js +41 -14
- package/dist/weapp-tw-runtime-loader.mjs +12 -8
- package/dist/webpack.d.mts +26 -0
- package/dist/webpack.d.ts +26 -1
- package/dist/webpack.js +1994 -38
- package/dist/webpack.mjs +15 -30
- package/dist/webpack4.d.mts +27 -0
- package/dist/webpack4.d.ts +27 -1
- package/dist/webpack4.js +1979 -191
- package/dist/webpack4.mjs +211 -189
- package/package.json +18 -19
- package/dist/babel/index.d.ts +0 -16
- package/dist/bundlers/gulp/index.d.ts +0 -8
- package/dist/bundlers/vite/index.d.ts +0 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
- package/dist/bundlers/webpack/index.d.ts +0 -1
- package/dist/cache/index.d.ts +0 -32
- package/dist/constants-CFM1J-h1.js +0 -42
- package/dist/constants-Dy2Dd3Fz.mjs +0 -36
- package/dist/constants.d.ts +0 -7
- package/dist/css-macro/constants.d.ts +0 -14
- package/dist/debug/index.d.ts +0 -2
- package/dist/defaults-DUZZvtdg.mjs +0 -149
- package/dist/defaults-syv_N3uk.js +0 -156
- package/dist/defu-Cdz2PomB.js +0 -60
- package/dist/defu-n46TJT6t.mjs +0 -57
- package/dist/env.d.ts +0 -2
- package/dist/escape.d.ts +0 -4
- package/dist/extractors/split.d.ts +0 -3
- package/dist/index-B8TOcVAt.js +0 -130
- package/dist/index-BEIjgKpF.mjs +0 -11
- package/dist/index-BKZH-Gxq.mjs +0 -134
- package/dist/index-BPzIdybK.mjs +0 -513
- package/dist/index-Bc61v7B0.mjs +0 -124
- package/dist/index-DXeB6ex8.js +0 -136
- package/dist/index-DwZHOkK3.js +0 -526
- package/dist/index-HC-Qkn0i.js +0 -17
- package/dist/js/handlers.d.ts +0 -13
- package/dist/js/index.d.ts +0 -7
- package/dist/mangle/index.d.ts +0 -8
- package/dist/options-BHJnjA_a.mjs +0 -981
- package/dist/options-DAp5AdGz.js +0 -1014
- package/dist/options.d.ts +0 -2
- package/dist/postcss/cssVars.d.ts +0 -5
- package/dist/postcss/index.d.ts +0 -3
- package/dist/postcss/mp.d.ts +0 -8
- package/dist/postcss/plugins/ctx.d.ts +0 -6
- package/dist/postcss/plugins/index.d.ts +0 -7
- package/dist/postcss/plugins/post.d.ts +0 -5
- package/dist/postcss/plugins/pre.d.ts +0 -5
- package/dist/postcss/preflight.d.ts +0 -3
- package/dist/postcss/selectorParser.d.ts +0 -6
- package/dist/postcss/shared.d.ts +0 -3
- package/dist/postcss/symbols.d.ts +0 -1
- package/dist/reg.d.ts +0 -1
- package/dist/shared-DbJl6i6a.mjs +0 -25
- package/dist/shared-hzYeE1wX.js +0 -28
- package/dist/tailwindcss/patcher.d.ts +0 -8
- package/dist/tailwindcss/supportCustomUnit.d.ts +0 -6
- package/dist/types.d.ts +0 -179
- package/dist/utils.d.ts +0 -18
- package/dist/v5-B9S3lBOs.mjs +0 -174
- package/dist/v5-QURRYPNk.js +0 -181
- package/dist/wxml/Tokenizer.d.ts +0 -31
- package/dist/wxml/index.d.ts +0 -2
- package/dist/wxml/shared.d.ts +0 -2
- package/dist/wxml/utils.d.ts +0 -9
package/dist/index-DwZHOkK3.js
DELETED
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
4
|
-
var postcssRem2rpx = require('postcss-rem-to-responsive-pixel');
|
|
5
|
-
var selectorParser = require('postcss-selector-parser');
|
|
6
|
-
var shared = require('./shared-hzYeE1wX.js');
|
|
7
|
-
var postcss = require('postcss');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
|
|
12
|
-
var postcssRem2rpx__default = /*#__PURE__*/_interopDefaultCompat(postcssRem2rpx);
|
|
13
|
-
var selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
|
|
14
|
-
|
|
15
|
-
function createRuleTransform(rule, options) {
|
|
16
|
-
const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
|
|
17
|
-
const transform = (selectors) => {
|
|
18
|
-
selectors.walk((selector) => {
|
|
19
|
-
if (selector.type === 'universal' && cssSelectorReplacement && cssSelectorReplacement.universal) {
|
|
20
|
-
selector.value = shared.composeIsPseudo(cssSelectorReplacement.universal);
|
|
21
|
-
}
|
|
22
|
-
if (cssRemoveHoverPseudoClass && selector.type === 'selector') {
|
|
23
|
-
const node = selector.nodes.find(x => x.type === 'pseudo' && x.value === ':hover');
|
|
24
|
-
node && selector.remove();
|
|
25
|
-
}
|
|
26
|
-
if (selector.type === 'pseudo'
|
|
27
|
-
&& selector.value === ':root'
|
|
28
|
-
&& cssSelectorReplacement
|
|
29
|
-
&& cssSelectorReplacement.root) {
|
|
30
|
-
selector.value = shared.composeIsPseudo(cssSelectorReplacement.root);
|
|
31
|
-
}
|
|
32
|
-
if (selector.type === 'class') {
|
|
33
|
-
selector.value = shared.internalCssSelectorReplacer(selector.value, {
|
|
34
|
-
escapeMap,
|
|
35
|
-
mangleContext,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
if (selectors.length === 0) {
|
|
40
|
-
rule.remove();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return transform;
|
|
44
|
-
}
|
|
45
|
-
function getRuleTransformer(rule, options) {
|
|
46
|
-
return selectorParser__default["default"](createRuleTransform(rule, options));
|
|
47
|
-
}
|
|
48
|
-
function ruleTransformSync(rule, options) {
|
|
49
|
-
const transformer = getRuleTransformer(rule, options);
|
|
50
|
-
return transformer.transformSync(rule, {
|
|
51
|
-
lossless: false,
|
|
52
|
-
updateSelector: true,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function isOnlyBeforeAndAfterPseudoElement(node) {
|
|
56
|
-
let b = false;
|
|
57
|
-
let a = false;
|
|
58
|
-
selectorParser__default["default"]((selectors) => {
|
|
59
|
-
selectors.walkPseudos((s) => {
|
|
60
|
-
var _a;
|
|
61
|
-
if (((_a = s.parent) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
62
|
-
if (/^:?:before$/.test(s.value)) {
|
|
63
|
-
b = true;
|
|
64
|
-
}
|
|
65
|
-
if (/^:?:after$/.test(s.value)) {
|
|
66
|
-
a = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}).astSync(node);
|
|
71
|
-
return b && a;
|
|
72
|
-
}
|
|
73
|
-
const fallbackRemove = selectorParser__default["default"]((selectors) => {
|
|
74
|
-
selectors.walk((selector) => {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
if (selector.type === 'universal') {
|
|
77
|
-
(_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
78
|
-
}
|
|
79
|
-
if (selector.type === 'pseudo' && selector.value === ':is') {
|
|
80
|
-
(_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
var cssVars = [
|
|
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
|
-
const initialNodes = cssVars.map((x) => {
|
|
293
|
-
return new postcss.Declaration({
|
|
294
|
-
prop: x.prop,
|
|
295
|
-
value: x.value,
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
const PATTERNS = [
|
|
299
|
-
/:not\(template\)\s*[~+]\s*:not\(template\)/.source,
|
|
300
|
-
/:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source,
|
|
301
|
-
].join('|');
|
|
302
|
-
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
|
|
303
|
-
function testIfVariablesScope(node, count = 2) {
|
|
304
|
-
if (isOnlyBeforeAndAfterPseudoElement(node)) {
|
|
305
|
-
const nodes = node.nodes;
|
|
306
|
-
let c = 0;
|
|
307
|
-
for (const tryTestDecl of nodes) {
|
|
308
|
-
if (tryTestDecl && tryTestDecl.type === 'decl' && tryTestDecl.prop.startsWith('--tw-')) {
|
|
309
|
-
c++;
|
|
310
|
-
}
|
|
311
|
-
if (c >= count) {
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
function testIfTwBackdrop(node, count = 2) {
|
|
320
|
-
if (node.type === 'rule' && node.selector === '::backdrop') {
|
|
321
|
-
const nodes = node.nodes;
|
|
322
|
-
let c = 0;
|
|
323
|
-
for (const tryTestDecl of nodes) {
|
|
324
|
-
if (tryTestDecl && tryTestDecl.type === 'decl' && tryTestDecl.prop.startsWith('--tw-')) {
|
|
325
|
-
c++;
|
|
326
|
-
}
|
|
327
|
-
if (c >= count) {
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
function makePseudoVarRule() {
|
|
336
|
-
const pseudoVarRule = new postcss.Rule({
|
|
337
|
-
selector: '::before,::after',
|
|
338
|
-
});
|
|
339
|
-
pseudoVarRule.append(new postcss.Declaration({
|
|
340
|
-
prop: '--tw-content',
|
|
341
|
-
value: '""',
|
|
342
|
-
}));
|
|
343
|
-
return pseudoVarRule;
|
|
344
|
-
}
|
|
345
|
-
function remakeCssVarSelector(selectors, options) {
|
|
346
|
-
const { cssPreflightRange, cssSelectorReplacement } = options;
|
|
347
|
-
if (cssPreflightRange === 'all'
|
|
348
|
-
&& !selectors.includes(':not(not)')) {
|
|
349
|
-
selectors.push(':not(not)');
|
|
350
|
-
}
|
|
351
|
-
if (cssSelectorReplacement) {
|
|
352
|
-
if (Array.isArray(cssSelectorReplacement.universal)) {
|
|
353
|
-
if (!cssSelectorReplacement.universal.every((x) => {
|
|
354
|
-
return selectors.includes(x);
|
|
355
|
-
})
|
|
356
|
-
&& !selectors.includes('*')) {
|
|
357
|
-
selectors.unshift('*');
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
else if (typeof cssSelectorReplacement.universal === 'string'
|
|
361
|
-
&& !selectors.includes(cssSelectorReplacement.universal)
|
|
362
|
-
&& !selectors.includes('*')) {
|
|
363
|
-
selectors.unshift('*');
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return selectors;
|
|
367
|
-
}
|
|
368
|
-
function remakeCombinatorSelector(selector, cssChildCombinatorReplaceValue) {
|
|
369
|
-
let childCombinatorReplaceValue = 'view + view';
|
|
370
|
-
if (Array.isArray(cssChildCombinatorReplaceValue) && cssChildCombinatorReplaceValue.length > 0) {
|
|
371
|
-
const x = shared.composeIsPseudo(cssChildCombinatorReplaceValue);
|
|
372
|
-
childCombinatorReplaceValue = `${x} + ${x}`;
|
|
373
|
-
}
|
|
374
|
-
else if (typeof cssChildCombinatorReplaceValue === 'string') {
|
|
375
|
-
childCombinatorReplaceValue = cssChildCombinatorReplaceValue;
|
|
376
|
-
}
|
|
377
|
-
return selector.replaceAll(BROAD_MATCH_GLOBAL_REGEXP, childCombinatorReplaceValue);
|
|
378
|
-
}
|
|
379
|
-
function commonChunkPreflight(node, options) {
|
|
380
|
-
const { ctx, cssChildCombinatorReplaceValue, cssInjectPreflight, injectAdditionalCssVarScope } = options;
|
|
381
|
-
node.selector = remakeCombinatorSelector(node.selector, cssChildCombinatorReplaceValue);
|
|
382
|
-
if (testIfVariablesScope(node)) {
|
|
383
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.markVariablesScope(node);
|
|
384
|
-
node.selectors = remakeCssVarSelector(node.selectors, options);
|
|
385
|
-
node.before(makePseudoVarRule());
|
|
386
|
-
if (typeof cssInjectPreflight === 'function') {
|
|
387
|
-
node.append(...cssInjectPreflight());
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (injectAdditionalCssVarScope && testIfTwBackdrop(node)) {
|
|
391
|
-
const syntheticRule = new postcss.Rule({
|
|
392
|
-
selectors: ['*', '::after', '::before'],
|
|
393
|
-
nodes: initialNodes,
|
|
394
|
-
});
|
|
395
|
-
syntheticRule.selectors = remakeCssVarSelector(syntheticRule.selectors, options);
|
|
396
|
-
node.before(syntheticRule);
|
|
397
|
-
node.before(makePseudoVarRule());
|
|
398
|
-
if (typeof cssInjectPreflight === 'function') {
|
|
399
|
-
syntheticRule.append(...cssInjectPreflight());
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
|
|
405
|
-
const pluginName = 'weapp-tailwindcss-webpack-plugin';
|
|
406
|
-
const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
|
|
407
|
-
const WEAPP_TW_REQUIRED_NODE_VERSION = '16.6.0';
|
|
408
|
-
|
|
409
|
-
function isAtMediaHover(atRule) {
|
|
410
|
-
return (/media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name)
|
|
411
|
-
|| (atRule.name === 'media' && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params)));
|
|
412
|
-
}
|
|
413
|
-
const postcssWeappTailwindcssPrePlugin = (options = {
|
|
414
|
-
isMainChunk: true,
|
|
415
|
-
}) => {
|
|
416
|
-
const { isMainChunk } = options;
|
|
417
|
-
const p = {
|
|
418
|
-
postcssPlugin,
|
|
419
|
-
Rule(rule) {
|
|
420
|
-
ruleTransformSync(rule, options);
|
|
421
|
-
},
|
|
422
|
-
AtRule(atRule) {
|
|
423
|
-
if (isAtMediaHover(atRule)) {
|
|
424
|
-
if (atRule.nodes) {
|
|
425
|
-
atRule.replaceWith(atRule.nodes);
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
atRule.remove();
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
};
|
|
433
|
-
if (isMainChunk) {
|
|
434
|
-
p.Once = (root) => {
|
|
435
|
-
root.walkRules((rule) => {
|
|
436
|
-
commonChunkPreflight(rule, options);
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
return p;
|
|
441
|
-
};
|
|
442
|
-
postcssWeappTailwindcssPrePlugin.postcss = true;
|
|
443
|
-
|
|
444
|
-
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
445
|
-
isMainChunk: true,
|
|
446
|
-
}) => {
|
|
447
|
-
const { customRuleCallback, isMainChunk, ctx } = options;
|
|
448
|
-
const p = {
|
|
449
|
-
postcssPlugin,
|
|
450
|
-
};
|
|
451
|
-
if (isMainChunk) {
|
|
452
|
-
p.OnceExit = (root) => {
|
|
453
|
-
root.walkRules((rule) => {
|
|
454
|
-
if (ctx) {
|
|
455
|
-
if (ctx.isVariablesScope(rule)) {
|
|
456
|
-
fallbackRemove.transformSync(rule, {
|
|
457
|
-
updateSelector: true,
|
|
458
|
-
lossless: false,
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
else if (testIfVariablesScope(rule)) {
|
|
463
|
-
fallbackRemove.transformSync(rule, {
|
|
464
|
-
updateSelector: true,
|
|
465
|
-
lossless: false,
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
if (typeof customRuleCallback === 'function') {
|
|
472
|
-
p.Rule = (rule) => {
|
|
473
|
-
customRuleCallback(rule, options);
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
return p;
|
|
477
|
-
};
|
|
478
|
-
postcssWeappTailwindcssPostPlugin.postcss = true;
|
|
479
|
-
|
|
480
|
-
const VariablesScopeSymbol = Symbol('VariablesScope');
|
|
481
|
-
|
|
482
|
-
function createContext() {
|
|
483
|
-
const variablesScopeWeakMap = new WeakMap();
|
|
484
|
-
function isVariablesScope(rule) {
|
|
485
|
-
return variablesScopeWeakMap.get(rule) === VariablesScopeSymbol;
|
|
486
|
-
}
|
|
487
|
-
function markVariablesScope(rule) {
|
|
488
|
-
variablesScopeWeakMap.set(rule, VariablesScopeSymbol);
|
|
489
|
-
}
|
|
490
|
-
return {
|
|
491
|
-
variablesScopeWeakMap,
|
|
492
|
-
isVariablesScope,
|
|
493
|
-
markVariablesScope,
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function getPlugins(options) {
|
|
498
|
-
var _a, _b;
|
|
499
|
-
const ctx = createContext();
|
|
500
|
-
options.ctx = ctx;
|
|
501
|
-
const plugins = [
|
|
502
|
-
...((_b = (_a = options.postcssOptions) === null || _a === void 0 ? void 0 : _a.plugins) !== null && _b !== void 0 ? _b : []),
|
|
503
|
-
postcssWeappTailwindcssPrePlugin(options),
|
|
504
|
-
postcssIsPseudoClass__default["default"]({
|
|
505
|
-
specificityMatchingName: 'weapp-tw-ig',
|
|
506
|
-
}),
|
|
507
|
-
];
|
|
508
|
-
if (options.rem2rpx) {
|
|
509
|
-
plugins.push(postcssRem2rpx__default["default"](typeof options.rem2rpx === 'object'
|
|
510
|
-
? options.rem2rpx
|
|
511
|
-
: {
|
|
512
|
-
rootValue: 32,
|
|
513
|
-
propList: ['*'],
|
|
514
|
-
transformUnit: 'rpx',
|
|
515
|
-
}));
|
|
516
|
-
}
|
|
517
|
-
plugins.push(postcssWeappTailwindcssPostPlugin(options));
|
|
518
|
-
return plugins;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
exports.WEAPP_TW_REQUIRED_NODE_VERSION = WEAPP_TW_REQUIRED_NODE_VERSION;
|
|
522
|
-
exports.getPlugins = getPlugins;
|
|
523
|
-
exports.pluginName = pluginName;
|
|
524
|
-
exports.postcssWeappTailwindcssPostPlugin = postcssWeappTailwindcssPostPlugin;
|
|
525
|
-
exports.postcssWeappTailwindcssPrePlugin = postcssWeappTailwindcssPrePlugin;
|
|
526
|
-
exports.vitePluginName = vitePluginName;
|
package/dist/index-HC-Qkn0i.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _createDebug = require('debug');
|
|
4
|
-
|
|
5
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
6
|
-
|
|
7
|
-
var _createDebug__default = /*#__PURE__*/_interopDefaultCompat(_createDebug);
|
|
8
|
-
|
|
9
|
-
const _debug = _createDebug__default["default"]('weapp-tw');
|
|
10
|
-
function createDebug(prefix) {
|
|
11
|
-
function debug(formatter, ...args) {
|
|
12
|
-
return _debug(('') + formatter, ...args);
|
|
13
|
-
}
|
|
14
|
-
return debug;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.createDebug = createDebug;
|
package/dist/js/handlers.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type MagicString from 'magic-string';
|
|
2
|
-
import type { IJsHandlerOptions } from "../types";
|
|
3
|
-
interface ReplaceNode {
|
|
4
|
-
leadingComments?: {
|
|
5
|
-
value: string;
|
|
6
|
-
}[] | null | undefined;
|
|
7
|
-
start?: number | null;
|
|
8
|
-
end?: number | null;
|
|
9
|
-
}
|
|
10
|
-
export declare function toUnicodeEscapedString(str: string): string;
|
|
11
|
-
export declare function toUnicodeEscapedString2(str: string): string;
|
|
12
|
-
export declare function replaceHandleValue(str: string, node: ReplaceNode, options: IJsHandlerOptions, ms: MagicString, offset?: number): string;
|
|
13
|
-
export {};
|
package/dist/js/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CreateJsHandlerOptions, IJsHandlerOptions, JsHandlerResult } from "../types";
|
|
2
|
-
export declare function jsHandler(rawSource: string, options: IJsHandlerOptions): JsHandlerResult;
|
|
3
|
-
export declare function jsHandlerAsync(rawSource: string, options: IJsHandlerOptions): Promise<JsHandlerResult>;
|
|
4
|
-
export declare function createJsHandler(options: CreateJsHandlerOptions): {
|
|
5
|
-
(rawSource: string, set: Set<string>, options?: CreateJsHandlerOptions): JsHandlerResult | Promise<JsHandlerResult>;
|
|
6
|
-
sync: (rawSource: string, set: Set<string>, options?: CreateJsHandlerOptions) => JsHandlerResult;
|
|
7
|
-
};
|
package/dist/mangle/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IMangleScopeContext, UserDefinedOptions } from "../types";
|
|
2
|
-
export declare const defaultMangleContext: IMangleScopeContext;
|
|
3
|
-
export declare function useMangleStore(): {
|
|
4
|
-
mangleContext: IMangleScopeContext;
|
|
5
|
-
resetMangle: () => IMangleScopeContext;
|
|
6
|
-
initMangle: (options: UserDefinedOptions['mangle']) => void;
|
|
7
|
-
setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
|
|
8
|
-
};
|