weapp-tailwindcss 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/cli.js +12 -11
- package/dist/cli.mjs +6 -6
- package/dist/{constants-D-YMDg7M.js → constants-CFM1J-h1.js} +3 -3
- package/dist/{constants-CcqTvLgQ.mjs → constants-Dy2Dd3Fz.mjs} +3 -3
- package/dist/core.d.ts +1 -1
- package/dist/core.js +12 -13
- package/dist/core.mjs +12 -13
- package/dist/css-macro/index.js +2 -2
- package/dist/css-macro/index.mjs +2 -2
- package/dist/css-macro/postcss.js +8 -8
- package/dist/css-macro/postcss.mjs +8 -8
- package/dist/{defaults-DOGbAFEj.mjs → defaults-BDivGN-J.mjs} +10 -10
- package/dist/{defaults-CGBcgdIr.js → defaults-z7wUEh47.js} +10 -10
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/extractors/split.d.ts +1 -1
- package/dist/gulp.js +7 -5
- package/dist/gulp.mjs +7 -5
- package/dist/{index-UGtfFwsf.mjs → index-BMv1aBKz.mjs} +13 -16
- package/dist/{index-DC60ES8u.mjs → index-BPzIdybK.mjs} +91 -91
- package/dist/{index-EnQF5WiI.mjs → index-Bm-88xa7.mjs} +14 -16
- package/dist/{index-iiM-deHl.js → index-CeRMFNvT.js} +13 -16
- package/dist/{index-6BUjj8Rl.js → index-DwZHOkK3.js} +91 -91
- package/dist/{index-BpY7tq3j.js → index-oneQz6yy.js} +20 -22
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/dist/js/handlers.d.ts +1 -1
- package/dist/mangle/index.d.ts +1 -1
- package/dist/{options-BjZGMFOk.js → options-DCor-e5I.js} +80 -74
- package/dist/{options-D1IYbX_E.mjs → options-SmfRHxH0.mjs} +82 -75
- package/dist/postcss/plugins/index.d.ts +2 -2
- package/dist/postcss/preflight.d.ts +1 -1
- package/dist/postcss/selectorParser.d.ts +1 -1
- package/dist/postcss/shared.d.ts +1 -1
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/replace.d.ts +1 -1
- package/dist/replace.js +3 -3
- package/dist/replace.mjs +3 -3
- package/dist/{shared-BX0VV-pr.mjs → shared-DbJl6i6a.mjs} +2 -2
- package/dist/{shared-BDew1Ric.js → shared-hzYeE1wX.js} +2 -2
- package/dist/tailwindcss/patcher.d.ts +4 -3
- package/dist/types.d.ts +7 -5
- package/dist/utils.d.ts +1 -1
- package/dist/{v5-C6FTqEeL.mjs → v5-CQUeTJ2W.mjs} +16 -19
- package/dist/{v5-DA4DSMKO.js → v5-ea_QoULz.js} +16 -19
- package/dist/vite.js +6 -5
- package/dist/vite.mjs +6 -5
- package/dist/webpack.js +6 -5
- package/dist/webpack.mjs +6 -5
- package/dist/webpack4.js +17 -19
- package/dist/webpack4.mjs +17 -19
- package/dist/wxml/shared.d.ts +1 -1
- package/dist/wxml/utils.d.ts +2 -2
- package/package.json +80 -78
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
4
|
-
var index = require('./index-
|
|
5
|
-
var defaults = require('./defaults-
|
|
3
|
+
var options = require('./options-DCor-e5I.js');
|
|
4
|
+
var index = require('./index-DwZHOkK3.js');
|
|
5
|
+
var defaults = require('./defaults-z7wUEh47.js');
|
|
6
6
|
var index$1 = require('./index-HC-Qkn0i.js');
|
|
7
7
|
|
|
8
8
|
const debug = index$1.createDebug();
|
|
9
9
|
function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
10
10
|
const opts = options.getOptions(options$1);
|
|
11
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache,
|
|
11
|
+
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet, cache, twPatcher, } = opts;
|
|
12
12
|
if (disabled) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
16
|
-
const twPatcher = options.createTailwindcssPatcher();
|
|
17
16
|
onLoad();
|
|
18
17
|
return {
|
|
19
18
|
name: index.vitePluginName,
|
|
@@ -24,9 +23,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
24
23
|
onStart();
|
|
25
24
|
const entries = Object.entries(bundle);
|
|
26
25
|
const groupedEntries = defaults.getGroupedEntries(entries, opts);
|
|
27
|
-
const runtimeSet = twPatcher.getClassSet(
|
|
28
|
-
basedir: tailwindcssBasedir
|
|
29
|
-
});
|
|
26
|
+
const runtimeSet = twPatcher.getClassSet();
|
|
30
27
|
setMangleRuntimeSet(runtimeSet);
|
|
31
28
|
debug('get runtimeSet, class count: %d', runtimeSet.size);
|
|
32
29
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -47,14 +44,14 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
47
44
|
}
|
|
48
45
|
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
49
46
|
originalSource.source = yield templateHandler(oldVal, {
|
|
50
|
-
runtimeSet
|
|
47
|
+
runtimeSet,
|
|
51
48
|
});
|
|
52
49
|
onUpdate(file, oldVal, originalSource.source);
|
|
53
50
|
debug('html handle: %s', file);
|
|
54
51
|
noCachedCount++;
|
|
55
52
|
return {
|
|
56
53
|
key: file,
|
|
57
|
-
source: originalSource.source
|
|
54
|
+
source: originalSource.source,
|
|
58
55
|
};
|
|
59
56
|
}));
|
|
60
57
|
}
|
|
@@ -77,10 +74,10 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
77
74
|
return false;
|
|
78
75
|
}
|
|
79
76
|
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const mapFilename = file
|
|
77
|
+
const mapFilename = `${file}.map`;
|
|
81
78
|
const hasMap = Boolean(bundle[mapFilename]);
|
|
82
79
|
const { code, map } = yield jsHandler(rawSource, runtimeSet, {
|
|
83
|
-
generateMap: hasMap
|
|
80
|
+
generateMap: hasMap,
|
|
84
81
|
});
|
|
85
82
|
originalSource.code = code;
|
|
86
83
|
onUpdate(file, rawSource, code);
|
|
@@ -91,7 +88,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
91
88
|
}
|
|
92
89
|
return {
|
|
93
90
|
key: file,
|
|
94
|
-
source: code
|
|
91
|
+
source: code,
|
|
95
92
|
};
|
|
96
93
|
}));
|
|
97
94
|
}
|
|
@@ -115,7 +112,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
115
112
|
}
|
|
116
113
|
}, () => options.__awaiter(this, void 0, void 0, function* () {
|
|
117
114
|
const css = yield styleHandler(rawSource, {
|
|
118
|
-
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType)
|
|
115
|
+
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
119
116
|
});
|
|
120
117
|
originalSource.source = css;
|
|
121
118
|
onUpdate(file, rawSource, css);
|
|
@@ -123,7 +120,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
123
120
|
noCachedCount++;
|
|
124
121
|
return {
|
|
125
122
|
key: file,
|
|
126
|
-
source: css
|
|
123
|
+
source: css,
|
|
127
124
|
};
|
|
128
125
|
}));
|
|
129
126
|
}
|
|
@@ -132,7 +129,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
132
129
|
onEnd();
|
|
133
130
|
debug('end');
|
|
134
131
|
});
|
|
135
|
-
}
|
|
132
|
+
},
|
|
136
133
|
};
|
|
137
134
|
}
|
|
138
135
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
4
4
|
var postcssRem2rpx = require('postcss-rem-to-responsive-pixel');
|
|
5
5
|
var selectorParser = require('postcss-selector-parser');
|
|
6
|
-
var shared = require('./shared-
|
|
6
|
+
var shared = require('./shared-hzYeE1wX.js');
|
|
7
7
|
var postcss = require('postcss');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -12,7 +12,7 @@ var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIs
|
|
|
12
12
|
var postcssRem2rpx__default = /*#__PURE__*/_interopDefaultCompat(postcssRem2rpx);
|
|
13
13
|
var selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function createRuleTransform(rule, options) {
|
|
16
16
|
const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
|
|
17
17
|
const transform = (selectors) => {
|
|
18
18
|
selectors.walk((selector) => {
|
|
@@ -20,19 +20,19 @@ const createRuleTransform = (rule, options) => {
|
|
|
20
20
|
selector.value = shared.composeIsPseudo(cssSelectorReplacement.universal);
|
|
21
21
|
}
|
|
22
22
|
if (cssRemoveHoverPseudoClass && selector.type === 'selector') {
|
|
23
|
-
const node = selector.nodes.find(
|
|
23
|
+
const node = selector.nodes.find(x => x.type === 'pseudo' && x.value === ':hover');
|
|
24
24
|
node && selector.remove();
|
|
25
25
|
}
|
|
26
|
-
if (selector.type === 'pseudo'
|
|
27
|
-
selector.value === ':root'
|
|
28
|
-
cssSelectorReplacement
|
|
29
|
-
cssSelectorReplacement.root) {
|
|
26
|
+
if (selector.type === 'pseudo'
|
|
27
|
+
&& selector.value === ':root'
|
|
28
|
+
&& cssSelectorReplacement
|
|
29
|
+
&& cssSelectorReplacement.root) {
|
|
30
30
|
selector.value = shared.composeIsPseudo(cssSelectorReplacement.root);
|
|
31
31
|
}
|
|
32
32
|
if (selector.type === 'class') {
|
|
33
33
|
selector.value = shared.internalCssSelectorReplacer(selector.value, {
|
|
34
34
|
escapeMap,
|
|
35
|
-
mangleContext
|
|
35
|
+
mangleContext,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -41,17 +41,17 @@ const createRuleTransform = (rule, options) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
return transform;
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
}
|
|
45
|
+
function getRuleTransformer(rule, options) {
|
|
46
46
|
return selectorParser__default["default"](createRuleTransform(rule, options));
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
}
|
|
48
|
+
function ruleTransformSync(rule, options) {
|
|
49
49
|
const transformer = getRuleTransformer(rule, options);
|
|
50
50
|
return transformer.transformSync(rule, {
|
|
51
51
|
lossless: false,
|
|
52
|
-
updateSelector: true
|
|
52
|
+
updateSelector: true,
|
|
53
53
|
});
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
function isOnlyBeforeAndAfterPseudoElement(node) {
|
|
56
56
|
let b = false;
|
|
57
57
|
let a = false;
|
|
@@ -85,219 +85,219 @@ const fallbackRemove = selectorParser__default["default"]((selectors) => {
|
|
|
85
85
|
var cssVars = [
|
|
86
86
|
{
|
|
87
87
|
prop: '--tw-border-spacing-x',
|
|
88
|
-
value: '0'
|
|
88
|
+
value: '0',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
prop: '--tw-border-spacing-y',
|
|
92
|
-
value: '0'
|
|
92
|
+
value: '0',
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
prop: '--tw-translate-x',
|
|
96
|
-
value: '0'
|
|
96
|
+
value: '0',
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
prop: '--tw-translate-y',
|
|
100
|
-
value: '0'
|
|
100
|
+
value: '0',
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
prop: '--tw-rotate',
|
|
104
|
-
value: '0'
|
|
104
|
+
value: '0',
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
prop: '--tw-skew-x',
|
|
108
|
-
value: '0'
|
|
108
|
+
value: '0',
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
prop: '--tw-skew-y',
|
|
112
|
-
value: '0'
|
|
112
|
+
value: '0',
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
prop: '--tw-scale-x',
|
|
116
|
-
value: '1'
|
|
116
|
+
value: '1',
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
prop: '--tw-scale-y',
|
|
120
|
-
value: '1'
|
|
120
|
+
value: '1',
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
prop: '--tw-pan-x',
|
|
124
|
-
value: ' '
|
|
124
|
+
value: ' ',
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
prop: '--tw-pan-y',
|
|
128
|
-
value: ' '
|
|
128
|
+
value: ' ',
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
prop: '--tw-pinch-zoom',
|
|
132
|
-
value: ' '
|
|
132
|
+
value: ' ',
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
prop: '--tw-scroll-snap-strictness',
|
|
136
|
-
value: 'proximity'
|
|
136
|
+
value: 'proximity',
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
prop: '--tw-gradient-from-position',
|
|
140
|
-
value: ' '
|
|
140
|
+
value: ' ',
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
prop: '--tw-gradient-via-position',
|
|
144
|
-
value: ' '
|
|
144
|
+
value: ' ',
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
prop: '--tw-gradient-to-position',
|
|
148
|
-
value: ' '
|
|
148
|
+
value: ' ',
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
prop: '--tw-ordinal',
|
|
152
|
-
value: ' '
|
|
152
|
+
value: ' ',
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
prop: '--tw-slashed-zero',
|
|
156
|
-
value: ' '
|
|
156
|
+
value: ' ',
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
prop: '--tw-numeric-figure',
|
|
160
|
-
value: ' '
|
|
160
|
+
value: ' ',
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
prop: '--tw-numeric-spacing',
|
|
164
|
-
value: ' '
|
|
164
|
+
value: ' ',
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
prop: '--tw-numeric-fraction',
|
|
168
|
-
value: ' '
|
|
168
|
+
value: ' ',
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
prop: '--tw-ring-inset',
|
|
172
|
-
value: ' '
|
|
172
|
+
value: ' ',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
prop: '--tw-ring-offset-width',
|
|
176
|
-
value: '0px'
|
|
176
|
+
value: '0px',
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
prop: '--tw-ring-offset-color',
|
|
180
|
-
value: '#fff'
|
|
180
|
+
value: '#fff',
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
183
|
prop: '--tw-ring-color',
|
|
184
|
-
value: 'rgb(59 130 246 / 0.5)'
|
|
184
|
+
value: 'rgb(59 130 246 / 0.5)',
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
187
|
prop: '--tw-ring-offset-shadow',
|
|
188
|
-
value: '0 0 #0000'
|
|
188
|
+
value: '0 0 #0000',
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
prop: '--tw-ring-shadow',
|
|
192
|
-
value: '0 0 #0000'
|
|
192
|
+
value: '0 0 #0000',
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
195
|
prop: '--tw-shadow',
|
|
196
|
-
value: '0 0 #0000'
|
|
196
|
+
value: '0 0 #0000',
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
199
|
prop: '--tw-shadow-colored',
|
|
200
|
-
value: '0 0 #0000'
|
|
200
|
+
value: '0 0 #0000',
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
203
|
prop: '--tw-blur',
|
|
204
|
-
value: ' '
|
|
204
|
+
value: ' ',
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
prop: '--tw-brightness',
|
|
208
|
-
value: ' '
|
|
208
|
+
value: ' ',
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
211
|
prop: '--tw-contrast',
|
|
212
|
-
value: ' '
|
|
212
|
+
value: ' ',
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
215
|
prop: '--tw-grayscale',
|
|
216
|
-
value: ' '
|
|
216
|
+
value: ' ',
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
219
|
prop: '--tw-hue-rotate',
|
|
220
|
-
value: ' '
|
|
220
|
+
value: ' ',
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
prop: '--tw-invert',
|
|
224
|
-
value: ' '
|
|
224
|
+
value: ' ',
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
prop: '--tw-saturate',
|
|
228
|
-
value: ' '
|
|
228
|
+
value: ' ',
|
|
229
229
|
},
|
|
230
230
|
{
|
|
231
231
|
prop: '--tw-sepia',
|
|
232
|
-
value: ' '
|
|
232
|
+
value: ' ',
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
235
|
prop: '--tw-drop-shadow',
|
|
236
|
-
value: ' '
|
|
236
|
+
value: ' ',
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
prop: '--tw-backdrop-blur',
|
|
240
|
-
value: ' '
|
|
240
|
+
value: ' ',
|
|
241
241
|
},
|
|
242
242
|
{
|
|
243
243
|
prop: '--tw-backdrop-brightness',
|
|
244
|
-
value: ' '
|
|
244
|
+
value: ' ',
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
247
|
prop: '--tw-backdrop-contrast',
|
|
248
|
-
value: ' '
|
|
248
|
+
value: ' ',
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
prop: '--tw-backdrop-grayscale',
|
|
252
|
-
value: ' '
|
|
252
|
+
value: ' ',
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
255
|
prop: '--tw-backdrop-hue-rotate',
|
|
256
|
-
value: ' '
|
|
256
|
+
value: ' ',
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
259
|
prop: '--tw-backdrop-invert',
|
|
260
|
-
value: ' '
|
|
260
|
+
value: ' ',
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
263
|
prop: '--tw-backdrop-opacity',
|
|
264
|
-
value: ' '
|
|
264
|
+
value: ' ',
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
267
|
prop: '--tw-backdrop-saturate',
|
|
268
|
-
value: ' '
|
|
268
|
+
value: ' ',
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
prop: '--tw-backdrop-sepia',
|
|
272
|
-
value: ' '
|
|
272
|
+
value: ' ',
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
275
|
prop: '--tw-contain-size',
|
|
276
|
-
value: ' '
|
|
276
|
+
value: ' ',
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
prop: '--tw-contain-layout',
|
|
280
|
-
value: ' '
|
|
280
|
+
value: ' ',
|
|
281
281
|
},
|
|
282
282
|
{
|
|
283
283
|
prop: '--tw-contain-paint',
|
|
284
|
-
value: ' '
|
|
284
|
+
value: ' ',
|
|
285
285
|
},
|
|
286
286
|
{
|
|
287
287
|
prop: '--tw-contain-style',
|
|
288
|
-
value: ' '
|
|
289
|
-
}
|
|
288
|
+
value: ' ',
|
|
289
|
+
},
|
|
290
290
|
];
|
|
291
291
|
|
|
292
292
|
const initialNodes = cssVars.map((x) => {
|
|
293
293
|
return new postcss.Declaration({
|
|
294
294
|
prop: x.prop,
|
|
295
|
-
value: x.value
|
|
295
|
+
value: x.value,
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
const PATTERNS = [
|
|
299
299
|
/:not\(template\)\s*[~+]\s*:not\(template\)/.source,
|
|
300
|
-
/:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source
|
|
300
|
+
/:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source,
|
|
301
301
|
].join('|');
|
|
302
302
|
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
|
|
303
303
|
function testIfVariablesScope(node, count = 2) {
|
|
@@ -334,32 +334,32 @@ function testIfTwBackdrop(node, count = 2) {
|
|
|
334
334
|
}
|
|
335
335
|
function makePseudoVarRule() {
|
|
336
336
|
const pseudoVarRule = new postcss.Rule({
|
|
337
|
-
selector: '::before,::after'
|
|
337
|
+
selector: '::before,::after',
|
|
338
338
|
});
|
|
339
339
|
pseudoVarRule.append(new postcss.Declaration({
|
|
340
340
|
prop: '--tw-content',
|
|
341
|
-
value: '""'
|
|
341
|
+
value: '""',
|
|
342
342
|
}));
|
|
343
343
|
return pseudoVarRule;
|
|
344
344
|
}
|
|
345
345
|
function remakeCssVarSelector(selectors, options) {
|
|
346
346
|
const { cssPreflightRange, cssSelectorReplacement } = options;
|
|
347
|
-
if (cssPreflightRange === 'all'
|
|
348
|
-
!selectors.includes(':not(not)')) {
|
|
347
|
+
if (cssPreflightRange === 'all'
|
|
348
|
+
&& !selectors.includes(':not(not)')) {
|
|
349
349
|
selectors.push(':not(not)');
|
|
350
350
|
}
|
|
351
351
|
if (cssSelectorReplacement) {
|
|
352
352
|
if (Array.isArray(cssSelectorReplacement.universal)) {
|
|
353
353
|
if (!cssSelectorReplacement.universal.every((x) => {
|
|
354
354
|
return selectors.includes(x);
|
|
355
|
-
})
|
|
356
|
-
!selectors.includes('*')) {
|
|
355
|
+
})
|
|
356
|
+
&& !selectors.includes('*')) {
|
|
357
357
|
selectors.unshift('*');
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
else if (typeof cssSelectorReplacement.universal === 'string'
|
|
361
|
-
!selectors.includes(cssSelectorReplacement.universal)
|
|
362
|
-
!selectors.includes('*')) {
|
|
360
|
+
else if (typeof cssSelectorReplacement.universal === 'string'
|
|
361
|
+
&& !selectors.includes(cssSelectorReplacement.universal)
|
|
362
|
+
&& !selectors.includes('*')) {
|
|
363
363
|
selectors.unshift('*');
|
|
364
364
|
}
|
|
365
365
|
}
|
|
@@ -369,7 +369,7 @@ function remakeCombinatorSelector(selector, cssChildCombinatorReplaceValue) {
|
|
|
369
369
|
let childCombinatorReplaceValue = 'view + view';
|
|
370
370
|
if (Array.isArray(cssChildCombinatorReplaceValue) && cssChildCombinatorReplaceValue.length > 0) {
|
|
371
371
|
const x = shared.composeIsPseudo(cssChildCombinatorReplaceValue);
|
|
372
|
-
childCombinatorReplaceValue = x +
|
|
372
|
+
childCombinatorReplaceValue = `${x} + ${x}`;
|
|
373
373
|
}
|
|
374
374
|
else if (typeof cssChildCombinatorReplaceValue === 'string') {
|
|
375
375
|
childCombinatorReplaceValue = cssChildCombinatorReplaceValue;
|
|
@@ -390,7 +390,7 @@ function commonChunkPreflight(node, options) {
|
|
|
390
390
|
if (injectAdditionalCssVarScope && testIfTwBackdrop(node)) {
|
|
391
391
|
const syntheticRule = new postcss.Rule({
|
|
392
392
|
selectors: ['*', '::after', '::before'],
|
|
393
|
-
nodes: initialNodes
|
|
393
|
+
nodes: initialNodes,
|
|
394
394
|
});
|
|
395
395
|
syntheticRule.selectors = remakeCssVarSelector(syntheticRule.selectors, options);
|
|
396
396
|
node.before(syntheticRule);
|
|
@@ -407,11 +407,11 @@ const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
|
|
|
407
407
|
const WEAPP_TW_REQUIRED_NODE_VERSION = '16.6.0';
|
|
408
408
|
|
|
409
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)));
|
|
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
412
|
}
|
|
413
413
|
const postcssWeappTailwindcssPrePlugin = (options = {
|
|
414
|
-
isMainChunk: true
|
|
414
|
+
isMainChunk: true,
|
|
415
415
|
}) => {
|
|
416
416
|
const { isMainChunk } = options;
|
|
417
417
|
const p = {
|
|
@@ -428,7 +428,7 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
428
428
|
atRule.remove();
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
}
|
|
431
|
+
},
|
|
432
432
|
};
|
|
433
433
|
if (isMainChunk) {
|
|
434
434
|
p.Once = (root) => {
|
|
@@ -442,11 +442,11 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
442
442
|
postcssWeappTailwindcssPrePlugin.postcss = true;
|
|
443
443
|
|
|
444
444
|
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
445
|
-
isMainChunk: true
|
|
445
|
+
isMainChunk: true,
|
|
446
446
|
}) => {
|
|
447
447
|
const { customRuleCallback, isMainChunk, ctx } = options;
|
|
448
448
|
const p = {
|
|
449
|
-
postcssPlugin
|
|
449
|
+
postcssPlugin,
|
|
450
450
|
};
|
|
451
451
|
if (isMainChunk) {
|
|
452
452
|
p.OnceExit = (root) => {
|
|
@@ -455,14 +455,14 @@ const postcssWeappTailwindcssPostPlugin = (options = {
|
|
|
455
455
|
if (ctx.isVariablesScope(rule)) {
|
|
456
456
|
fallbackRemove.transformSync(rule, {
|
|
457
457
|
updateSelector: true,
|
|
458
|
-
lossless: false
|
|
458
|
+
lossless: false,
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
else if (testIfVariablesScope(rule)) {
|
|
463
463
|
fallbackRemove.transformSync(rule, {
|
|
464
464
|
updateSelector: true,
|
|
465
|
-
lossless: false
|
|
465
|
+
lossless: false,
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
468
|
});
|
|
@@ -490,7 +490,7 @@ function createContext() {
|
|
|
490
490
|
return {
|
|
491
491
|
variablesScopeWeakMap,
|
|
492
492
|
isVariablesScope,
|
|
493
|
-
markVariablesScope
|
|
493
|
+
markVariablesScope,
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
|
|
@@ -502,8 +502,8 @@ function getPlugins(options) {
|
|
|
502
502
|
...((_b = (_a = options.postcssOptions) === null || _a === void 0 ? void 0 : _a.plugins) !== null && _b !== void 0 ? _b : []),
|
|
503
503
|
postcssWeappTailwindcssPrePlugin(options),
|
|
504
504
|
postcssIsPseudoClass__default["default"]({
|
|
505
|
-
specificityMatchingName: 'weapp-tw-ig'
|
|
506
|
-
})
|
|
505
|
+
specificityMatchingName: 'weapp-tw-ig',
|
|
506
|
+
}),
|
|
507
507
|
];
|
|
508
508
|
if (options.rem2rpx) {
|
|
509
509
|
plugins.push(postcssRem2rpx__default["default"](typeof options.rem2rpx === 'object'
|
|
@@ -511,7 +511,7 @@ function getPlugins(options) {
|
|
|
511
511
|
: {
|
|
512
512
|
rootValue: 32,
|
|
513
513
|
propList: ['*'],
|
|
514
|
-
transformUnit: 'rpx'
|
|
514
|
+
transformUnit: 'rpx',
|
|
515
515
|
}));
|
|
516
516
|
}
|
|
517
517
|
plugins.push(postcssWeappTailwindcssPostPlugin(options));
|