weapp-tailwindcss 2.3.3 → 2.4.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/README.md +63 -596
- package/dist/babel/index.d.ts +3 -4
- package/dist/cli.js +7 -7
- package/dist/cli.mjs +7 -7
- package/dist/gulp/index.d.ts +1 -1
- package/dist/gulp.js +8 -8
- package/dist/gulp.mjs +8 -8
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/dist/js/index.d.ts +1 -1
- package/dist/{options-3a695e84.js → options-450d76c2.js} +179 -195
- package/dist/{options-ed6f4a3a.mjs → options-5c083791.mjs} +179 -195
- package/dist/postcss/plugin.d.ts +2 -2
- package/dist/{postcss-dc9eeafc.js → postcss-0c103b15.js} +5 -6
- package/dist/{postcss-1f9a5153.mjs → postcss-e3fcf6f1.mjs} +5 -6
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/replace.d.ts +2 -3
- package/dist/replace.js +2 -2
- package/dist/replace.mjs +3 -3
- package/dist/{shared-eae1dc7a.mjs → shared-89ea7f77.mjs} +59 -60
- package/dist/{shared-c2953d9d.js → shared-9744fdd1.js} +59 -60
- package/dist/tailwindcss/patcher.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -3
- package/dist/vite.js +7 -7
- package/dist/vite.mjs +7 -7
- package/dist/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/webpack.js +9 -9
- package/dist/webpack.mjs +9 -9
- package/dist/wxml/index.d.ts +2 -3
- package/package.json +13 -17
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var shared = require('./shared-c2953d9d.js');
|
|
4
3
|
var micromatch = require('micromatch');
|
|
4
|
+
var t = require('@babel/types');
|
|
5
5
|
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 shared = require('./shared-9744fdd1.js');
|
|
10
10
|
var postcss = require('postcss');
|
|
11
|
-
var postcss$1 = require('./postcss-
|
|
11
|
+
var postcss$1 = require('./postcss-0c103b15.js');
|
|
12
12
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
13
|
-
var path = require('path');
|
|
14
|
-
var fs = require('fs');
|
|
13
|
+
var path = require('node:path');
|
|
14
|
+
var fs = require('node:fs');
|
|
15
15
|
var semver = require('semver');
|
|
16
16
|
var tailwindcssPatch = require('tailwindcss-patch');
|
|
17
17
|
|
|
@@ -35,9 +35,9 @@ function _interopNamespaceCompat(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
|
|
38
39
|
var generate__default = /*#__PURE__*/_interopDefaultCompat(generate);
|
|
39
40
|
var traverse__default = /*#__PURE__*/_interopDefaultCompat(traverse);
|
|
40
|
-
var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
|
|
41
41
|
var postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
|
|
42
42
|
var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
|
|
43
43
|
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
@@ -85,6 +85,145 @@ function createDefu(merger) {
|
|
|
85
85
|
}
|
|
86
86
|
const defu = createDefu();
|
|
87
87
|
|
|
88
|
+
const isProd = () => process.env.NODE_ENV === 'production';
|
|
89
|
+
|
|
90
|
+
function handleValue(str, node, options) {
|
|
91
|
+
const set = options.classNameSet;
|
|
92
|
+
const escapeMap = options.escapeMap;
|
|
93
|
+
const arr = shared.splitCode(str);
|
|
94
|
+
let rawStr = str;
|
|
95
|
+
for (const v of arr) {
|
|
96
|
+
if (set.has(v)) {
|
|
97
|
+
let ignoreFlag = false;
|
|
98
|
+
if (Array.isArray(node.leadingComments)) {
|
|
99
|
+
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
100
|
+
}
|
|
101
|
+
if (!ignoreFlag) {
|
|
102
|
+
const { jsHandler } = shared.useStore();
|
|
103
|
+
rawStr = jsHandler(rawStr);
|
|
104
|
+
rawStr = rawStr.replaceAll(new RegExp(shared.escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
|
|
105
|
+
escapeMap
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return rawStr;
|
|
111
|
+
}
|
|
112
|
+
function jsHandler(rawSource, options) {
|
|
113
|
+
var _a;
|
|
114
|
+
const ast = parser.parse(rawSource, {
|
|
115
|
+
sourceType: 'unambiguous'
|
|
116
|
+
});
|
|
117
|
+
const topt = {
|
|
118
|
+
StringLiteral: {
|
|
119
|
+
enter(p) {
|
|
120
|
+
const n = p.node;
|
|
121
|
+
n.value = handleValue(n.value, n, options);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
TemplateElement: {
|
|
125
|
+
enter(p) {
|
|
126
|
+
const n = p.node;
|
|
127
|
+
n.value.raw = handleValue(n.value.raw, n, options);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
CallExpression: {
|
|
131
|
+
enter(p) {
|
|
132
|
+
const n = p.node;
|
|
133
|
+
if (t__namespace.isIdentifier(n.callee) && n.callee.name === 'eval' && t__namespace.isStringLiteral(n.arguments[0])) {
|
|
134
|
+
const res = jsHandler(n.arguments[0].value, options);
|
|
135
|
+
if (res.code) {
|
|
136
|
+
n.arguments[0].value = res.code;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
noScope: true
|
|
142
|
+
};
|
|
143
|
+
traverse__default["default"](ast, topt);
|
|
144
|
+
return generate__default["default"](ast, {
|
|
145
|
+
minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function createjsHandler(options) {
|
|
149
|
+
return (rawSource, set) => {
|
|
150
|
+
return jsHandler(rawSource, {
|
|
151
|
+
classNameSet: set,
|
|
152
|
+
minifiedJs: options.minifiedJs,
|
|
153
|
+
escapeMap: options.escapeMap
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const defaultOptions = {
|
|
159
|
+
cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
|
|
160
|
+
htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
|
|
161
|
+
jsMatcher: (file) => {
|
|
162
|
+
if (file.includes('node_modules')) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
return /.+\.[cm]?js?$/.test(file);
|
|
166
|
+
},
|
|
167
|
+
mainCssChunkMatcher: (file, appType) => {
|
|
168
|
+
switch (appType) {
|
|
169
|
+
case 'uni-app': {
|
|
170
|
+
return /^common\/main/.test(file);
|
|
171
|
+
}
|
|
172
|
+
case 'uni-app-vite': {
|
|
173
|
+
return file.startsWith('app') || /^common\/main/.test(file);
|
|
174
|
+
}
|
|
175
|
+
case 'mpx': {
|
|
176
|
+
return file.startsWith('app');
|
|
177
|
+
}
|
|
178
|
+
case 'taro': {
|
|
179
|
+
return file.startsWith('app');
|
|
180
|
+
}
|
|
181
|
+
case 'remax': {
|
|
182
|
+
return file.startsWith('app');
|
|
183
|
+
}
|
|
184
|
+
case 'rax': {
|
|
185
|
+
return file.startsWith('bundle');
|
|
186
|
+
}
|
|
187
|
+
case 'native': {
|
|
188
|
+
return file.startsWith('app');
|
|
189
|
+
}
|
|
190
|
+
case 'kbone': {
|
|
191
|
+
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
192
|
+
}
|
|
193
|
+
default: {
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
cssPreflight: {
|
|
199
|
+
'box-sizing': 'border-box',
|
|
200
|
+
'border-width': '0',
|
|
201
|
+
'border-style': 'solid',
|
|
202
|
+
'border-color': 'currentColor'
|
|
203
|
+
},
|
|
204
|
+
cssPreflightRange: 'view',
|
|
205
|
+
replaceUniversalSelectorWith: 'view',
|
|
206
|
+
disabled: false,
|
|
207
|
+
customRuleCallback: shared.noop,
|
|
208
|
+
onLoad: shared.noop,
|
|
209
|
+
onStart: shared.noop,
|
|
210
|
+
onEnd: shared.noop,
|
|
211
|
+
onUpdate: shared.noop,
|
|
212
|
+
customAttributes: {},
|
|
213
|
+
customReplaceDictionary: shared.SimpleMappingChars2String,
|
|
214
|
+
supportCustomLengthUnitsPatch: {
|
|
215
|
+
units: ['rpx'],
|
|
216
|
+
dangerousOptions: {
|
|
217
|
+
gteVersion: '3.0.0',
|
|
218
|
+
lengthUnitsFilePath: 'lib/util/dataTypes.js',
|
|
219
|
+
packageName: 'tailwindcss',
|
|
220
|
+
variableName: 'lengthUnits',
|
|
221
|
+
overwrite: true
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
appType: undefined
|
|
225
|
+
};
|
|
226
|
+
|
|
88
227
|
function generateCode(match, options = {}) {
|
|
89
228
|
const ast = parser.parseExpression(match);
|
|
90
229
|
traverse__default["default"](ast, {
|
|
@@ -93,10 +232,8 @@ function generateCode(match, options = {}) {
|
|
|
93
232
|
if (t__namespace.isMemberExpression(path.parent)) {
|
|
94
233
|
return;
|
|
95
234
|
}
|
|
96
|
-
if (t__namespace.isBinaryExpression(path.parent)) {
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
235
|
+
if (t__namespace.isBinaryExpression(path.parent) && t__namespace.isConditionalExpression((_a = path.parentPath) === null || _a === void 0 ? void 0 : _a.parent)) {
|
|
236
|
+
return;
|
|
100
237
|
}
|
|
101
238
|
path.node.value = replace.replaceJs(path.node.value, options);
|
|
102
239
|
},
|
|
@@ -131,7 +268,7 @@ function extractSource(original) {
|
|
|
131
268
|
}
|
|
132
269
|
function templeteReplacer(original, options = {}) {
|
|
133
270
|
const sources = extractSource(original);
|
|
134
|
-
if (sources.length) {
|
|
271
|
+
if (sources.length > 0) {
|
|
135
272
|
const resultArray = [];
|
|
136
273
|
let p = 0;
|
|
137
274
|
for (let i = 0; i < sources.length; i++) {
|
|
@@ -142,7 +279,7 @@ function templeteReplacer(original, options = {}) {
|
|
|
142
279
|
escapeMap: options.escapeMap
|
|
143
280
|
}));
|
|
144
281
|
p = m.start;
|
|
145
|
-
if (m.raw.trim().length) {
|
|
282
|
+
if (m.raw.trim().length > 0) {
|
|
146
283
|
const code = generateCode(m.raw, options);
|
|
147
284
|
const source = `{{${code}}}`;
|
|
148
285
|
m.source = source;
|
|
@@ -161,7 +298,7 @@ function templeteReplacer(original, options = {}) {
|
|
|
161
298
|
}
|
|
162
299
|
}
|
|
163
300
|
return resultArray
|
|
164
|
-
.filter(
|
|
301
|
+
.filter(Boolean)
|
|
165
302
|
.join('')
|
|
166
303
|
.trim();
|
|
167
304
|
}
|
|
@@ -184,8 +321,7 @@ function customTempleteHandler(rawSource, options = {}) {
|
|
|
184
321
|
const regexps = shared.makeCustomAttributes(options.customAttributesEntities);
|
|
185
322
|
if (regexps) {
|
|
186
323
|
if (Array.isArray(regexps)) {
|
|
187
|
-
for (
|
|
188
|
-
const regexp = regexps[i];
|
|
324
|
+
for (const regexp of regexps) {
|
|
189
325
|
source = source.replace(regexp.tagRegexp, (m0) => {
|
|
190
326
|
return m0.replace(regexp.attrRegexp, (m1, className) => {
|
|
191
327
|
return m1.replace(className, templeteReplacer(className, options));
|
|
@@ -218,8 +354,7 @@ const createInjectPreflight = (options) => {
|
|
|
218
354
|
const result = [];
|
|
219
355
|
if (options && typeof options === 'object') {
|
|
220
356
|
const entries = Object.entries(options);
|
|
221
|
-
for (
|
|
222
|
-
const [prop, value] = entries[i];
|
|
357
|
+
for (const [prop, value] of entries) {
|
|
223
358
|
if (value !== false) {
|
|
224
359
|
result.push({
|
|
225
360
|
prop,
|
|
@@ -240,30 +375,26 @@ function findAstNode(content, options) {
|
|
|
240
375
|
let changed = false;
|
|
241
376
|
traverse__default["default"](ast, {
|
|
242
377
|
Identifier(path) {
|
|
243
|
-
if (path.node.name === DOPTS.variableName) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
value: x === null || x === void 0 ? void 0 : x.value
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
return x;
|
|
259
|
-
});
|
|
260
|
-
path.parent.init.elements.push({
|
|
261
|
-
type: 'StringLiteral',
|
|
262
|
-
value: unit
|
|
263
|
-
});
|
|
264
|
-
changed = true;
|
|
378
|
+
if (path.node.name === DOPTS.variableName && t__namespace.isVariableDeclarator(path.parent) && t__namespace.isArrayExpression(path.parent.init)) {
|
|
379
|
+
arrayRef = path.parent.init;
|
|
380
|
+
const set = new Set(path.parent.init.elements.map((x) => x.value));
|
|
381
|
+
for (let i = 0; i < options.units.length; i++) {
|
|
382
|
+
const unit = options.units[i];
|
|
383
|
+
if (!set.has(unit)) {
|
|
384
|
+
path.parent.init.elements = path.parent.init.elements.map((x) => {
|
|
385
|
+
if (t__namespace.isStringLiteral(x)) {
|
|
386
|
+
return {
|
|
387
|
+
type: x === null || x === void 0 ? void 0 : x.type,
|
|
388
|
+
value: x === null || x === void 0 ? void 0 : x.value
|
|
389
|
+
};
|
|
265
390
|
}
|
|
266
|
-
|
|
391
|
+
return x;
|
|
392
|
+
});
|
|
393
|
+
path.parent.init.elements.push({
|
|
394
|
+
type: 'StringLiteral',
|
|
395
|
+
value: unit
|
|
396
|
+
});
|
|
397
|
+
changed = true;
|
|
267
398
|
}
|
|
268
399
|
}
|
|
269
400
|
}
|
|
@@ -309,7 +440,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
|
|
|
309
440
|
const DOPTS = dangerousOptions;
|
|
310
441
|
const dataTypesFilePath = path__default["default"].resolve(rootDir, DOPTS.lengthUnitsFilePath);
|
|
311
442
|
const dataTypesFileContent = fs__default["default"].readFileSync(dataTypesFilePath, {
|
|
312
|
-
encoding: '
|
|
443
|
+
encoding: 'utf8'
|
|
313
444
|
});
|
|
314
445
|
const { arrayRef, changed } = findAstNode(dataTypesFileContent, options);
|
|
315
446
|
if (arrayRef && changed) {
|
|
@@ -324,7 +455,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
|
|
|
324
455
|
const newCode = prev + code + next;
|
|
325
456
|
if (DOPTS.overwrite) {
|
|
326
457
|
fs__default["default"].writeFileSync((_a = DOPTS.destPath) !== null && _a !== void 0 ? _a : dataTypesFilePath, newCode, {
|
|
327
|
-
encoding: '
|
|
458
|
+
encoding: 'utf8'
|
|
328
459
|
});
|
|
329
460
|
console.log('patch tailwindcss for custom length unit successfully!');
|
|
330
461
|
}
|
|
@@ -352,148 +483,6 @@ function createTailwindcssPatcher() {
|
|
|
352
483
|
});
|
|
353
484
|
}
|
|
354
485
|
|
|
355
|
-
const isProd = () => process.env.NODE_ENV === 'production';
|
|
356
|
-
|
|
357
|
-
function handleValue(str, node, options) {
|
|
358
|
-
const set = options.classNameSet;
|
|
359
|
-
const escapeMap = options.escapeMap;
|
|
360
|
-
const arr = shared.splitCode(str);
|
|
361
|
-
let rawStr = str;
|
|
362
|
-
for (let i = 0; i < arr.length; i++) {
|
|
363
|
-
const v = arr[i];
|
|
364
|
-
if (set.has(v)) {
|
|
365
|
-
let ignoreFlag = false;
|
|
366
|
-
if (Array.isArray(node.leadingComments)) {
|
|
367
|
-
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
368
|
-
}
|
|
369
|
-
if (!ignoreFlag) {
|
|
370
|
-
const { jsHandler } = shared.useStore();
|
|
371
|
-
rawStr = jsHandler(rawStr);
|
|
372
|
-
rawStr = rawStr.replace(new RegExp(shared.escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
|
|
373
|
-
escapeMap
|
|
374
|
-
}));
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return rawStr;
|
|
379
|
-
}
|
|
380
|
-
function jsHandler(rawSource, options) {
|
|
381
|
-
var _a;
|
|
382
|
-
const ast = parser.parse(rawSource, {
|
|
383
|
-
sourceType: 'unambiguous'
|
|
384
|
-
});
|
|
385
|
-
const topt = {
|
|
386
|
-
StringLiteral: {
|
|
387
|
-
enter(p) {
|
|
388
|
-
const n = p.node;
|
|
389
|
-
n.value = handleValue(n.value, n, options);
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
TemplateElement: {
|
|
393
|
-
enter(p) {
|
|
394
|
-
const n = p.node;
|
|
395
|
-
n.value.raw = handleValue(n.value.raw, n, options);
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
CallExpression: {
|
|
399
|
-
enter(p) {
|
|
400
|
-
const n = p.node;
|
|
401
|
-
if (t__namespace.isIdentifier(n.callee) && n.callee.name === 'eval') {
|
|
402
|
-
if (t__namespace.isStringLiteral(n.arguments[0])) {
|
|
403
|
-
const res = jsHandler(n.arguments[0].value, options);
|
|
404
|
-
if (res.code) {
|
|
405
|
-
n.arguments[0].value = res.code;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
noScope: true
|
|
412
|
-
};
|
|
413
|
-
traverse__default["default"](ast, topt);
|
|
414
|
-
return generate__default["default"](ast, {
|
|
415
|
-
minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
function createjsHandler(options) {
|
|
419
|
-
return (rawSource, set) => {
|
|
420
|
-
return jsHandler(rawSource, {
|
|
421
|
-
classNameSet: set,
|
|
422
|
-
minifiedJs: options.minifiedJs,
|
|
423
|
-
escapeMap: options.escapeMap
|
|
424
|
-
});
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
const defaultOptions = {
|
|
429
|
-
cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
|
|
430
|
-
htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
|
|
431
|
-
jsMatcher: (file) => {
|
|
432
|
-
if (file.includes('node_modules')) {
|
|
433
|
-
return false;
|
|
434
|
-
}
|
|
435
|
-
return /.+\.[cm]?[jt]sx?$/.test(file);
|
|
436
|
-
},
|
|
437
|
-
mainCssChunkMatcher: (file, appType) => {
|
|
438
|
-
switch (appType) {
|
|
439
|
-
case 'uni-app': {
|
|
440
|
-
return /^common\/main/.test(file);
|
|
441
|
-
}
|
|
442
|
-
case 'uni-app-vite': {
|
|
443
|
-
return /^app/.test(file) || /^common\/main/.test(file);
|
|
444
|
-
}
|
|
445
|
-
case 'mpx': {
|
|
446
|
-
return /^app/.test(file);
|
|
447
|
-
}
|
|
448
|
-
case 'taro': {
|
|
449
|
-
return /^app/.test(file);
|
|
450
|
-
}
|
|
451
|
-
case 'remax': {
|
|
452
|
-
return /^app/.test(file);
|
|
453
|
-
}
|
|
454
|
-
case 'rax': {
|
|
455
|
-
return /^bundle/.test(file);
|
|
456
|
-
}
|
|
457
|
-
case 'native': {
|
|
458
|
-
return /^app/.test(file);
|
|
459
|
-
}
|
|
460
|
-
case 'kbone': {
|
|
461
|
-
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
462
|
-
}
|
|
463
|
-
default: {
|
|
464
|
-
return true;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
cssPreflight: {
|
|
469
|
-
'box-sizing': 'border-box',
|
|
470
|
-
'border-width': '0',
|
|
471
|
-
'border-style': 'solid',
|
|
472
|
-
'border-color': 'currentColor'
|
|
473
|
-
},
|
|
474
|
-
cssPreflightRange: 'view',
|
|
475
|
-
replaceUniversalSelectorWith: 'view',
|
|
476
|
-
disabled: false,
|
|
477
|
-
customRuleCallback: shared.noop,
|
|
478
|
-
onLoad: shared.noop,
|
|
479
|
-
onStart: shared.noop,
|
|
480
|
-
onEnd: shared.noop,
|
|
481
|
-
onUpdate: shared.noop,
|
|
482
|
-
customAttributes: {},
|
|
483
|
-
customReplaceDictionary: shared.SimpleMappingChars2String,
|
|
484
|
-
supportCustomLengthUnitsPatch: {
|
|
485
|
-
units: ['rpx'],
|
|
486
|
-
dangerousOptions: {
|
|
487
|
-
gteVersion: '3.0.0',
|
|
488
|
-
lengthUnitsFilePath: 'lib/util/dataTypes.js',
|
|
489
|
-
packageName: 'tailwindcss',
|
|
490
|
-
variableName: 'lengthUnits',
|
|
491
|
-
overwrite: true
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
appType: undefined
|
|
495
|
-
};
|
|
496
|
-
|
|
497
486
|
function createGlobMatcher(pattern) {
|
|
498
487
|
return function (file) {
|
|
499
488
|
return micromatch.isMatch(file, pattern);
|
|
@@ -535,17 +524,12 @@ function getOptions(options = {}, modules = ['style', 'templete', 'patch', 'js']
|
|
|
535
524
|
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch } = result;
|
|
536
525
|
result.escapeMap = customReplaceDictionary;
|
|
537
526
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
customAttributesEntities = Array.from(options.customAttributes.entries());
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
customAttributesEntities = Object.entries(customAttributes);
|
|
544
|
-
}
|
|
527
|
+
const customAttributesEntities = shared.isMap(options.customAttributes) ? [...options.customAttributes.entries()] : Object.entries(customAttributes);
|
|
528
|
+
const { escapeMap, minifiedJs } = result;
|
|
545
529
|
if (registerModules.templete) {
|
|
546
530
|
result.templeteHandler = createTempleteHandler({
|
|
547
531
|
customAttributesEntities,
|
|
548
|
-
escapeMap
|
|
532
|
+
escapeMap
|
|
549
533
|
});
|
|
550
534
|
}
|
|
551
535
|
if (registerModules.style) {
|
|
@@ -554,13 +538,13 @@ function getOptions(options = {}, modules = ['style', 'templete', 'patch', 'js']
|
|
|
554
538
|
customRuleCallback,
|
|
555
539
|
cssPreflightRange,
|
|
556
540
|
replaceUniversalSelectorWith,
|
|
557
|
-
escapeMap
|
|
541
|
+
escapeMap
|
|
558
542
|
});
|
|
559
543
|
}
|
|
560
544
|
if (registerModules.js) {
|
|
561
545
|
result.jsHandler = createjsHandler({
|
|
562
|
-
minifiedJs
|
|
563
|
-
escapeMap
|
|
546
|
+
minifiedJs,
|
|
547
|
+
escapeMap
|
|
564
548
|
});
|
|
565
549
|
}
|
|
566
550
|
if (registerModules.patch) {
|