weapp-tailwindcss 2.5.2 → 2.6.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.
- package/README.md +2 -8
- package/dist/cli.js +5 -3
- package/dist/cli.mjs +5 -3
- package/dist/defaults-0d9846f4.js +139 -0
- package/dist/defaults-c7f00aae.mjs +133 -0
- package/dist/defaults.js +10 -0
- package/dist/defaults.mjs +2 -0
- package/dist/{shared-ae7dd073.js → dic-05980807.js} +0 -58
- package/dist/{shared-7c88fb94.mjs → dic-3790a3a4.mjs} +1 -57
- package/dist/gulp.js +5 -3
- package/dist/gulp.mjs +5 -3
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/dist/{options-ad127e0c.js → options-6a265426.js} +21 -140
- package/dist/{options-1e3a224a.mjs → options-800ea85a.mjs} +14 -132
- package/dist/postcss/cssVars.d.ts +5 -0
- package/dist/postcss/mp.d.ts +4 -0
- package/dist/postcss-53e2ad95.mjs +351 -0
- package/dist/postcss-cf8b998a.js +359 -0
- package/dist/postcss.js +3 -2
- package/dist/postcss.mjs +3 -2
- package/dist/replace.js +8 -7
- package/dist/replace.mjs +4 -2
- package/dist/shared-4eed0e5c.js +62 -0
- package/dist/shared-686bfc32.mjs +59 -0
- package/dist/types.d.ts +4 -0
- package/dist/vite.js +6 -4
- package/dist/vite.mjs +5 -3
- package/dist/webpack.js +6 -4
- package/dist/webpack.mjs +5 -3
- package/package.json +37 -31
- package/dist/postcss-9a63df9d.mjs +0 -115
- package/dist/postcss-fbdc673b.js +0 -123
|
@@ -6,10 +6,11 @@ var generate = require('@babel/generator');
|
|
|
6
6
|
var parser = require('@babel/parser');
|
|
7
7
|
var traverse = require('@babel/traverse');
|
|
8
8
|
var replace = require('./replace.js');
|
|
9
|
-
var
|
|
9
|
+
var defaults = require('./defaults-0d9846f4.js');
|
|
10
10
|
var postcss = require('postcss');
|
|
11
|
-
var postcss$1 = require('./postcss-
|
|
11
|
+
var postcss$1 = require('./postcss-cf8b998a.js');
|
|
12
12
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
13
|
+
var dic = require('./dic-05980807.js');
|
|
13
14
|
var path = require('node:path');
|
|
14
15
|
var fs = require('node:fs');
|
|
15
16
|
var semver = require('semver');
|
|
@@ -86,52 +87,6 @@ function createDefu(merger) {
|
|
|
86
87
|
}
|
|
87
88
|
const defu = createDefu();
|
|
88
89
|
|
|
89
|
-
function isRegexp(value) {
|
|
90
|
-
return Object.prototype.toString.call(value) === '[object RegExp]';
|
|
91
|
-
}
|
|
92
|
-
function isMap(value) {
|
|
93
|
-
return Object.prototype.toString.call(value) === '[object Map]';
|
|
94
|
-
}
|
|
95
|
-
const noop = () => { };
|
|
96
|
-
function groupBy(arr, cb) {
|
|
97
|
-
if (!Array.isArray(arr)) {
|
|
98
|
-
throw new TypeError('expected an array for first argument');
|
|
99
|
-
}
|
|
100
|
-
if (typeof cb !== 'function') {
|
|
101
|
-
throw new TypeError('expected a function for second argument');
|
|
102
|
-
}
|
|
103
|
-
const result = {};
|
|
104
|
-
for (const item of arr) {
|
|
105
|
-
const bucketCategory = cb(item);
|
|
106
|
-
const bucket = result[bucketCategory];
|
|
107
|
-
if (Array.isArray(bucket)) {
|
|
108
|
-
result[bucketCategory].push(item);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
result[bucketCategory] = [item];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
function getGroupedEntries(entries, options) {
|
|
117
|
-
const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
|
|
118
|
-
const groupedEntries = groupBy(entries, ([file]) => {
|
|
119
|
-
if (cssMatcher(file)) {
|
|
120
|
-
return 'css';
|
|
121
|
-
}
|
|
122
|
-
else if (htmlMatcher(file)) {
|
|
123
|
-
return 'html';
|
|
124
|
-
}
|
|
125
|
-
else if (jsMatcher(file) || wxsMatcher(file)) {
|
|
126
|
-
return 'js';
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
return 'other';
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return groupedEntries;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
90
|
function escapeStringRegexp(str) {
|
|
136
91
|
if (typeof str !== 'string') {
|
|
137
92
|
throw new TypeError('Expected a string');
|
|
@@ -148,7 +103,7 @@ function getSourceString(input) {
|
|
|
148
103
|
if (typeof input === 'string') {
|
|
149
104
|
result = input;
|
|
150
105
|
}
|
|
151
|
-
else if (isRegexp(input)) {
|
|
106
|
+
else if (defaults.isRegexp(input)) {
|
|
152
107
|
result = input.source;
|
|
153
108
|
}
|
|
154
109
|
else {
|
|
@@ -164,7 +119,7 @@ function makePattern(arr) {
|
|
|
164
119
|
if (typeof cur === 'string') {
|
|
165
120
|
acc.push(cur);
|
|
166
121
|
}
|
|
167
|
-
else if (isRegexp(cur)) {
|
|
122
|
+
else if (defaults.isRegexp(cur)) {
|
|
168
123
|
acc.push(handleRegexp(cur));
|
|
169
124
|
}
|
|
170
125
|
return acc;
|
|
@@ -174,7 +129,7 @@ function makePattern(arr) {
|
|
|
174
129
|
else if (typeof arr === 'string') {
|
|
175
130
|
pattern = arr;
|
|
176
131
|
}
|
|
177
|
-
else if (isRegexp(arr)) {
|
|
132
|
+
else if (defaults.isRegexp(arr)) {
|
|
178
133
|
pattern = handleRegexp(arr);
|
|
179
134
|
}
|
|
180
135
|
return pattern;
|
|
@@ -229,10 +184,11 @@ function handleValue(str, node, options) {
|
|
|
229
184
|
const escapeMap = options.escapeMap;
|
|
230
185
|
const allowDoubleQuotes = (_a = options.arbitraryValues) === null || _a === void 0 ? void 0 : _a.allowDoubleQuotes;
|
|
231
186
|
const ctx = options.mangleContext;
|
|
187
|
+
const jsPreserveClass = options.jsPreserveClass;
|
|
232
188
|
const arr = splitCode(str, allowDoubleQuotes);
|
|
233
189
|
let rawStr = str;
|
|
234
190
|
for (const v of arr) {
|
|
235
|
-
if (set.has(v)) {
|
|
191
|
+
if (set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v))) {
|
|
236
192
|
let ignoreFlag = false;
|
|
237
193
|
if (Array.isArray(node.leadingComments)) {
|
|
238
194
|
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
@@ -286,95 +242,19 @@ function jsHandler(rawSource, options) {
|
|
|
286
242
|
});
|
|
287
243
|
}
|
|
288
244
|
function createjsHandler(options) {
|
|
289
|
-
const { mangleContext, arbitraryValues, minifiedJs, escapeMap } = options;
|
|
245
|
+
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass } = options;
|
|
290
246
|
return (rawSource, set) => {
|
|
291
247
|
return jsHandler(rawSource, {
|
|
292
248
|
classNameSet: set,
|
|
293
249
|
minifiedJs,
|
|
294
250
|
escapeMap,
|
|
295
251
|
arbitraryValues,
|
|
296
|
-
mangleContext
|
|
252
|
+
mangleContext,
|
|
253
|
+
jsPreserveClass
|
|
297
254
|
});
|
|
298
255
|
};
|
|
299
256
|
}
|
|
300
257
|
|
|
301
|
-
const defaultOptions = {
|
|
302
|
-
cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
|
|
303
|
-
htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
|
|
304
|
-
jsMatcher: (file) => {
|
|
305
|
-
if (file.includes('node_modules')) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
return /.+\.[cm]?js?$/.test(file);
|
|
309
|
-
},
|
|
310
|
-
mainCssChunkMatcher: (file, appType) => {
|
|
311
|
-
switch (appType) {
|
|
312
|
-
case 'uni-app': {
|
|
313
|
-
return /^common\/main/.test(file);
|
|
314
|
-
}
|
|
315
|
-
case 'uni-app-vite': {
|
|
316
|
-
return file.startsWith('app') || /^common\/main/.test(file);
|
|
317
|
-
}
|
|
318
|
-
case 'mpx': {
|
|
319
|
-
return file.startsWith('app');
|
|
320
|
-
}
|
|
321
|
-
case 'taro': {
|
|
322
|
-
return file.startsWith('app');
|
|
323
|
-
}
|
|
324
|
-
case 'remax': {
|
|
325
|
-
return file.startsWith('app');
|
|
326
|
-
}
|
|
327
|
-
case 'rax': {
|
|
328
|
-
return file.startsWith('bundle');
|
|
329
|
-
}
|
|
330
|
-
case 'native': {
|
|
331
|
-
return file.startsWith('app');
|
|
332
|
-
}
|
|
333
|
-
case 'kbone': {
|
|
334
|
-
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
335
|
-
}
|
|
336
|
-
default: {
|
|
337
|
-
return true;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
wxsMatcher: (file) => {
|
|
342
|
-
return false;
|
|
343
|
-
},
|
|
344
|
-
cssPreflight: {
|
|
345
|
-
'box-sizing': 'border-box',
|
|
346
|
-
'border-width': '0',
|
|
347
|
-
'border-style': 'solid',
|
|
348
|
-
'border-color': 'currentColor'
|
|
349
|
-
},
|
|
350
|
-
cssPreflightRange: 'view',
|
|
351
|
-
replaceUniversalSelectorWith: 'view',
|
|
352
|
-
disabled: false,
|
|
353
|
-
customRuleCallback: noop,
|
|
354
|
-
onLoad: noop,
|
|
355
|
-
onStart: noop,
|
|
356
|
-
onEnd: noop,
|
|
357
|
-
onUpdate: noop,
|
|
358
|
-
customAttributes: {},
|
|
359
|
-
customReplaceDictionary: shared.SimpleMappingChars2String,
|
|
360
|
-
supportCustomLengthUnitsPatch: {
|
|
361
|
-
units: ['rpx'],
|
|
362
|
-
dangerousOptions: {
|
|
363
|
-
gteVersion: '3.0.0',
|
|
364
|
-
lengthUnitsFilePath: 'lib/util/dataTypes.js',
|
|
365
|
-
packageName: 'tailwindcss',
|
|
366
|
-
variableName: 'lengthUnits',
|
|
367
|
-
overwrite: true
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
appType: undefined,
|
|
371
|
-
arbitraryValues: {
|
|
372
|
-
allowDoubleQuotes: false
|
|
373
|
-
},
|
|
374
|
-
cssChildCombinatorReplaceValue: 'view + view',
|
|
375
|
-
inlineWxs: false
|
|
376
|
-
};
|
|
377
|
-
|
|
378
258
|
function generateCode(match, options = {}) {
|
|
379
259
|
const ast = parser.parseExpression(match);
|
|
380
260
|
traverse__default["default"](ast, {
|
|
@@ -578,7 +458,7 @@ function getInstalledPkgJsonPath(options) {
|
|
|
578
458
|
}
|
|
579
459
|
function createPatch(options) {
|
|
580
460
|
if (options === false) {
|
|
581
|
-
return noop;
|
|
461
|
+
return defaults.noop;
|
|
582
462
|
}
|
|
583
463
|
return () => {
|
|
584
464
|
try {
|
|
@@ -719,23 +599,23 @@ function getOptions(options = {}) {
|
|
|
719
599
|
options.supportCustomLengthUnitsPatch = undefined;
|
|
720
600
|
}
|
|
721
601
|
if (options.customReplaceDictionary === 'simple') {
|
|
722
|
-
options.customReplaceDictionary =
|
|
602
|
+
options.customReplaceDictionary = dic.SimpleMappingChars2String;
|
|
723
603
|
}
|
|
724
604
|
else if (options.customReplaceDictionary === 'complex') {
|
|
725
|
-
options.customReplaceDictionary =
|
|
605
|
+
options.customReplaceDictionary = dic.MappingChars2String;
|
|
726
606
|
}
|
|
727
607
|
normalizeMatcher(options, 'cssMatcher');
|
|
728
608
|
normalizeMatcher(options, 'htmlMatcher');
|
|
729
609
|
normalizeMatcher(options, 'jsMatcher');
|
|
730
610
|
normalizeMatcher(options, 'wxsMatcher');
|
|
731
611
|
normalizeMatcher(options, 'mainCssChunkMatcher');
|
|
732
|
-
const result = defu(options, defaultOptions, {
|
|
612
|
+
const result = defu(options, defaults.defaultOptions, {
|
|
733
613
|
minifiedJs: isProd()
|
|
734
614
|
});
|
|
735
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs } = result;
|
|
615
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass } = result;
|
|
736
616
|
result.escapeMap = customReplaceDictionary;
|
|
737
617
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
738
|
-
const customAttributesEntities = isMap(options.customAttributes)
|
|
618
|
+
const customAttributesEntities = defaults.isMap(options.customAttributes)
|
|
739
619
|
? [...options.customAttributes.entries()]
|
|
740
620
|
: Object.entries(customAttributes);
|
|
741
621
|
const { escapeMap, minifiedJs } = result;
|
|
@@ -748,14 +628,16 @@ function getOptions(options = {}) {
|
|
|
748
628
|
replaceUniversalSelectorWith,
|
|
749
629
|
escapeMap,
|
|
750
630
|
mangleContext,
|
|
751
|
-
cssChildCombinatorReplaceValue
|
|
631
|
+
cssChildCombinatorReplaceValue,
|
|
632
|
+
injectAdditionalCssVarScope
|
|
752
633
|
});
|
|
753
634
|
result.styleHandler = styleHandler;
|
|
754
635
|
const jsHandler = createjsHandler({
|
|
755
636
|
minifiedJs,
|
|
756
637
|
escapeMap,
|
|
757
638
|
mangleContext,
|
|
758
|
-
arbitraryValues
|
|
639
|
+
arbitraryValues,
|
|
640
|
+
jsPreserveClass
|
|
759
641
|
});
|
|
760
642
|
result.jsHandler = jsHandler;
|
|
761
643
|
const templeteHandler = createTempleteHandler({
|
|
@@ -773,5 +655,4 @@ function getOptions(options = {}) {
|
|
|
773
655
|
|
|
774
656
|
exports.createPatch = createPatch;
|
|
775
657
|
exports.createTailwindcssPatcher = createTailwindcssPatcher;
|
|
776
|
-
exports.getGroupedEntries = getGroupedEntries;
|
|
777
658
|
exports.getOptions = getOptions;
|
|
@@ -4,10 +4,11 @@ import generate from '@babel/generator';
|
|
|
4
4
|
import { parse, parseExpression } from '@babel/parser';
|
|
5
5
|
import traverse from '@babel/traverse';
|
|
6
6
|
import { replaceJs as replaceWxml } from './replace.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { i as isRegexp, n as noop, d as defaultOptions, a as isMap } from './defaults-c7f00aae.mjs';
|
|
8
8
|
import postcss from 'postcss';
|
|
9
|
-
import { p as postcssWeappTailwindcss } from './postcss-
|
|
9
|
+
import { p as postcssWeappTailwindcss } from './postcss-53e2ad95.mjs';
|
|
10
10
|
import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
|
|
11
|
+
import { S as SimpleMappingChars2String, M as MappingChars2String } from './dic-3790a3a4.mjs';
|
|
11
12
|
import path from 'node:path';
|
|
12
13
|
import fs from 'node:fs';
|
|
13
14
|
import { gte } from 'semver';
|
|
@@ -56,52 +57,6 @@ function createDefu(merger) {
|
|
|
56
57
|
}
|
|
57
58
|
const defu = createDefu();
|
|
58
59
|
|
|
59
|
-
function isRegexp(value) {
|
|
60
|
-
return Object.prototype.toString.call(value) === '[object RegExp]';
|
|
61
|
-
}
|
|
62
|
-
function isMap(value) {
|
|
63
|
-
return Object.prototype.toString.call(value) === '[object Map]';
|
|
64
|
-
}
|
|
65
|
-
const noop = () => { };
|
|
66
|
-
function groupBy(arr, cb) {
|
|
67
|
-
if (!Array.isArray(arr)) {
|
|
68
|
-
throw new TypeError('expected an array for first argument');
|
|
69
|
-
}
|
|
70
|
-
if (typeof cb !== 'function') {
|
|
71
|
-
throw new TypeError('expected a function for second argument');
|
|
72
|
-
}
|
|
73
|
-
const result = {};
|
|
74
|
-
for (const item of arr) {
|
|
75
|
-
const bucketCategory = cb(item);
|
|
76
|
-
const bucket = result[bucketCategory];
|
|
77
|
-
if (Array.isArray(bucket)) {
|
|
78
|
-
result[bucketCategory].push(item);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
result[bucketCategory] = [item];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
function getGroupedEntries(entries, options) {
|
|
87
|
-
const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
|
|
88
|
-
const groupedEntries = groupBy(entries, ([file]) => {
|
|
89
|
-
if (cssMatcher(file)) {
|
|
90
|
-
return 'css';
|
|
91
|
-
}
|
|
92
|
-
else if (htmlMatcher(file)) {
|
|
93
|
-
return 'html';
|
|
94
|
-
}
|
|
95
|
-
else if (jsMatcher(file) || wxsMatcher(file)) {
|
|
96
|
-
return 'js';
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return 'other';
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return groupedEntries;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
60
|
function escapeStringRegexp(str) {
|
|
106
61
|
if (typeof str !== 'string') {
|
|
107
62
|
throw new TypeError('Expected a string');
|
|
@@ -199,10 +154,11 @@ function handleValue(str, node, options) {
|
|
|
199
154
|
const escapeMap = options.escapeMap;
|
|
200
155
|
const allowDoubleQuotes = (_a = options.arbitraryValues) === null || _a === void 0 ? void 0 : _a.allowDoubleQuotes;
|
|
201
156
|
const ctx = options.mangleContext;
|
|
157
|
+
const jsPreserveClass = options.jsPreserveClass;
|
|
202
158
|
const arr = splitCode(str, allowDoubleQuotes);
|
|
203
159
|
let rawStr = str;
|
|
204
160
|
for (const v of arr) {
|
|
205
|
-
if (set.has(v)) {
|
|
161
|
+
if (set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v))) {
|
|
206
162
|
let ignoreFlag = false;
|
|
207
163
|
if (Array.isArray(node.leadingComments)) {
|
|
208
164
|
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
@@ -256,95 +212,19 @@ function jsHandler(rawSource, options) {
|
|
|
256
212
|
});
|
|
257
213
|
}
|
|
258
214
|
function createjsHandler(options) {
|
|
259
|
-
const { mangleContext, arbitraryValues, minifiedJs, escapeMap } = options;
|
|
215
|
+
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass } = options;
|
|
260
216
|
return (rawSource, set) => {
|
|
261
217
|
return jsHandler(rawSource, {
|
|
262
218
|
classNameSet: set,
|
|
263
219
|
minifiedJs,
|
|
264
220
|
escapeMap,
|
|
265
221
|
arbitraryValues,
|
|
266
|
-
mangleContext
|
|
222
|
+
mangleContext,
|
|
223
|
+
jsPreserveClass
|
|
267
224
|
});
|
|
268
225
|
};
|
|
269
226
|
}
|
|
270
227
|
|
|
271
|
-
const defaultOptions = {
|
|
272
|
-
cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
|
|
273
|
-
htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
|
|
274
|
-
jsMatcher: (file) => {
|
|
275
|
-
if (file.includes('node_modules')) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
return /.+\.[cm]?js?$/.test(file);
|
|
279
|
-
},
|
|
280
|
-
mainCssChunkMatcher: (file, appType) => {
|
|
281
|
-
switch (appType) {
|
|
282
|
-
case 'uni-app': {
|
|
283
|
-
return /^common\/main/.test(file);
|
|
284
|
-
}
|
|
285
|
-
case 'uni-app-vite': {
|
|
286
|
-
return file.startsWith('app') || /^common\/main/.test(file);
|
|
287
|
-
}
|
|
288
|
-
case 'mpx': {
|
|
289
|
-
return file.startsWith('app');
|
|
290
|
-
}
|
|
291
|
-
case 'taro': {
|
|
292
|
-
return file.startsWith('app');
|
|
293
|
-
}
|
|
294
|
-
case 'remax': {
|
|
295
|
-
return file.startsWith('app');
|
|
296
|
-
}
|
|
297
|
-
case 'rax': {
|
|
298
|
-
return file.startsWith('bundle');
|
|
299
|
-
}
|
|
300
|
-
case 'native': {
|
|
301
|
-
return file.startsWith('app');
|
|
302
|
-
}
|
|
303
|
-
case 'kbone': {
|
|
304
|
-
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
305
|
-
}
|
|
306
|
-
default: {
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
wxsMatcher: (file) => {
|
|
312
|
-
return false;
|
|
313
|
-
},
|
|
314
|
-
cssPreflight: {
|
|
315
|
-
'box-sizing': 'border-box',
|
|
316
|
-
'border-width': '0',
|
|
317
|
-
'border-style': 'solid',
|
|
318
|
-
'border-color': 'currentColor'
|
|
319
|
-
},
|
|
320
|
-
cssPreflightRange: 'view',
|
|
321
|
-
replaceUniversalSelectorWith: 'view',
|
|
322
|
-
disabled: false,
|
|
323
|
-
customRuleCallback: noop,
|
|
324
|
-
onLoad: noop,
|
|
325
|
-
onStart: noop,
|
|
326
|
-
onEnd: noop,
|
|
327
|
-
onUpdate: noop,
|
|
328
|
-
customAttributes: {},
|
|
329
|
-
customReplaceDictionary: SimpleMappingChars2String,
|
|
330
|
-
supportCustomLengthUnitsPatch: {
|
|
331
|
-
units: ['rpx'],
|
|
332
|
-
dangerousOptions: {
|
|
333
|
-
gteVersion: '3.0.0',
|
|
334
|
-
lengthUnitsFilePath: 'lib/util/dataTypes.js',
|
|
335
|
-
packageName: 'tailwindcss',
|
|
336
|
-
variableName: 'lengthUnits',
|
|
337
|
-
overwrite: true
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
appType: undefined,
|
|
341
|
-
arbitraryValues: {
|
|
342
|
-
allowDoubleQuotes: false
|
|
343
|
-
},
|
|
344
|
-
cssChildCombinatorReplaceValue: 'view + view',
|
|
345
|
-
inlineWxs: false
|
|
346
|
-
};
|
|
347
|
-
|
|
348
228
|
function generateCode(match, options = {}) {
|
|
349
229
|
const ast = parseExpression(match);
|
|
350
230
|
traverse(ast, {
|
|
@@ -702,7 +582,7 @@ function getOptions(options = {}) {
|
|
|
702
582
|
const result = defu(options, defaultOptions, {
|
|
703
583
|
minifiedJs: isProd()
|
|
704
584
|
});
|
|
705
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs } = result;
|
|
585
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass } = result;
|
|
706
586
|
result.escapeMap = customReplaceDictionary;
|
|
707
587
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
708
588
|
const customAttributesEntities = isMap(options.customAttributes)
|
|
@@ -718,14 +598,16 @@ function getOptions(options = {}) {
|
|
|
718
598
|
replaceUniversalSelectorWith,
|
|
719
599
|
escapeMap,
|
|
720
600
|
mangleContext,
|
|
721
|
-
cssChildCombinatorReplaceValue
|
|
601
|
+
cssChildCombinatorReplaceValue,
|
|
602
|
+
injectAdditionalCssVarScope
|
|
722
603
|
});
|
|
723
604
|
result.styleHandler = styleHandler;
|
|
724
605
|
const jsHandler = createjsHandler({
|
|
725
606
|
minifiedJs,
|
|
726
607
|
escapeMap,
|
|
727
608
|
mangleContext,
|
|
728
|
-
arbitraryValues
|
|
609
|
+
arbitraryValues,
|
|
610
|
+
jsPreserveClass
|
|
729
611
|
});
|
|
730
612
|
result.jsHandler = jsHandler;
|
|
731
613
|
const templeteHandler = createTempleteHandler({
|
|
@@ -741,4 +623,4 @@ function getOptions(options = {}) {
|
|
|
741
623
|
return result;
|
|
742
624
|
}
|
|
743
625
|
|
|
744
|
-
export { createTailwindcssPatcher as a,
|
|
626
|
+
export { createTailwindcssPatcher as a, createPatch as c, getOptions as g };
|
package/dist/postcss/mp.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Rule } from 'postcss';
|
|
2
2
|
import type { IStyleHandlerOptions } from "../types";
|
|
3
3
|
export declare function testIfVariablesScope(node: Rule, count?: number): boolean;
|
|
4
|
+
export declare function testIfTwBackdrop(node: Rule, count?: number): boolean;
|
|
5
|
+
export declare function makePseudoVarRule(): Rule;
|
|
6
|
+
export declare function remakeCssVarSelector(selectors: string[], cssPreflightRange: IStyleHandlerOptions['cssPreflightRange']): string[];
|
|
7
|
+
export declare function remakeCombinatorSelector(selector: string, cssChildCombinatorReplaceValue: IStyleHandlerOptions['cssChildCombinatorReplaceValue']): string;
|
|
4
8
|
export declare function commonChunkPreflight(node: Rule, options: IStyleHandlerOptions): void;
|