tailwindcss 3.1.5 → 3.1.8
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/CHANGELOG.md +36 -8
- package/README.md +6 -3
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +78 -75
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +194 -187
- package/lib/featureFlags.js +14 -7
- package/lib/index.js +9 -6
- package/lib/lib/cacheInvalidation.js +18 -15
- package/lib/lib/collapseAdjacentRules.js +14 -11
- package/lib/lib/collapseDuplicateDeclarations.js +11 -8
- package/lib/lib/defaultExtractor.js +38 -35
- package/lib/lib/detectNesting.js +4 -1
- package/lib/lib/evaluateTailwindFunctions.js +75 -44
- package/lib/lib/expandApplyAtRules.js +50 -42
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +81 -73
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +10 -7
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +15 -7
- package/lib/lib/resolveDefaultsAtRules.js +92 -85
- package/lib/lib/setupContextUtils.js +109 -97
- package/lib/lib/setupTrackingContext.js +82 -75
- package/lib/lib/sharedState.js +15 -8
- package/lib/lib/substituteScreenAtRules.js +8 -5
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +7 -4
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +6 -4
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +5 -2
- package/lib/util/cloneDeep.js +4 -1
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +11 -3
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +5 -3
- package/lib/util/createUtilityPlugin.js +13 -10
- package/lib/util/dataTypes.js +27 -19
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +12 -9
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +21 -14
- package/lib/util/getAllConfigs.js +12 -9
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/isValidArbitraryValue.js +33 -24
- package/lib/util/log.js +12 -5
- package/lib/util/nameClass.js +16 -8
- package/lib/util/negateValue.js +4 -1
- package/lib/util/normalizeConfig.js +26 -23
- package/lib/util/normalizeScreens.js +17 -2
- package/lib/util/parseAnimationValue.js +42 -39
- package/lib/util/parseBoxShadowValue.js +12 -4
- package/lib/util/parseDependency.js +35 -32
- package/lib/util/parseObjectStyles.js +14 -11
- package/lib/util/pluginUtils.js +28 -20
- package/lib/util/prefixSelector.js +6 -3
- package/lib/util/removeAlphaVariables.js +13 -2
- package/lib/util/resolveConfig.js +56 -53
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +16 -13
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +10 -7
- package/lib/util/validateConfig.js +5 -2
- package/lib/util/withAlphaVariable.js +30 -22
- package/package.json +10 -10
- package/peers/index.js +950 -825
- package/resolveConfig.d.ts +3 -0
- package/src/lib/evaluateTailwindFunctions.js +41 -15
- package/src/lib/expandApplyAtRules.js +6 -0
- package/src/lib/generateRules.js +6 -5
- package/src/lib/setupContextUtils.js +4 -2
- package/src/util/cloneNodes.js +5 -1
- package/src/util/resolveConfig.js +1 -1
package/lib/lib/generateRules.js
CHANGED
|
@@ -2,37 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
resolveMatches: ()=>resolveMatches,
|
|
13
|
+
generateRules: ()=>generateRules
|
|
14
|
+
});
|
|
15
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
16
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
17
|
+
const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
|
|
18
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
|
|
19
|
+
const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
|
|
20
|
+
const _pluginUtils = require("../util/pluginUtils");
|
|
21
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
22
|
+
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
|
23
|
+
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
24
|
+
const _nameClass = require("../util/nameClass");
|
|
25
|
+
const _dataTypes = require("../util/dataTypes");
|
|
26
|
+
const _setupContextUtils = require("./setupContextUtils");
|
|
27
|
+
const _isValidArbitraryValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
28
|
+
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
|
29
|
+
const _featureFlags = require("../featureFlags");
|
|
21
30
|
function _interopRequireDefault(obj) {
|
|
22
31
|
return obj && obj.__esModule ? obj : {
|
|
23
32
|
default: obj
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
function _getRequireWildcardCache() {
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
36
|
if (typeof WeakMap !== "function") return null;
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
33
42
|
}
|
|
34
|
-
function _interopRequireWildcard(obj) {
|
|
35
|
-
if (obj && obj.__esModule) {
|
|
43
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
45
|
return obj;
|
|
37
46
|
}
|
|
38
47
|
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
@@ -40,14 +49,14 @@ function _interopRequireWildcard(obj) {
|
|
|
40
49
|
default: obj
|
|
41
50
|
};
|
|
42
51
|
}
|
|
43
|
-
var cache = _getRequireWildcardCache();
|
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
53
|
if (cache && cache.has(obj)) {
|
|
45
54
|
return cache.get(obj);
|
|
46
55
|
}
|
|
47
56
|
var newObj = {};
|
|
48
57
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
58
|
for(var key in obj){
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
59
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
51
60
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
52
61
|
if (desc && (desc.get || desc.set)) {
|
|
53
62
|
Object.defineProperty(newObj, key, desc);
|
|
@@ -62,7 +71,7 @@ function _interopRequireWildcard(obj) {
|
|
|
62
71
|
}
|
|
63
72
|
return newObj;
|
|
64
73
|
}
|
|
65
|
-
let classNameParser = (0, _postcssSelectorParser
|
|
74
|
+
let classNameParser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
66
75
|
return selectors.first.filter(({ type })=>type === "class").pop().value;
|
|
67
76
|
});
|
|
68
77
|
function getClassNameFromSelector(selector) {
|
|
@@ -121,7 +130,7 @@ function applyPrefix(matches, context) {
|
|
|
121
130
|
// Not doing this will cause `-tw-top-1` to generate the class `.tw--top-1`
|
|
122
131
|
// The disconnect between candidate <-> class can cause @apply to hard crash.
|
|
123
132
|
let shouldPrependNegative = classCandidate.startsWith("-");
|
|
124
|
-
r.selector = (0, _prefixSelector
|
|
133
|
+
r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector, shouldPrependNegative);
|
|
125
134
|
});
|
|
126
135
|
match[1] = container.nodes[0];
|
|
127
136
|
}
|
|
@@ -140,7 +149,7 @@ function applyImportant(matches, classCandidate) {
|
|
|
140
149
|
]
|
|
141
150
|
});
|
|
142
151
|
container.walkRules((r)=>{
|
|
143
|
-
r.selector = (0, _pluginUtils
|
|
152
|
+
r.selector = (0, _pluginUtils.updateAllClasses)(r.selector, (className)=>{
|
|
144
153
|
if (className === classCandidate) {
|
|
145
154
|
return `!${className}`;
|
|
146
155
|
}
|
|
@@ -171,7 +180,6 @@ function applyVariant(variant, matches, context) {
|
|
|
171
180
|
return matches;
|
|
172
181
|
}
|
|
173
182
|
let args;
|
|
174
|
-
let isArbitraryVariant = false;
|
|
175
183
|
// Find partial arbitrary variants
|
|
176
184
|
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
|
177
185
|
args = variant.slice(variant.lastIndexOf("[") + 1, -1);
|
|
@@ -179,12 +187,11 @@ function applyVariant(variant, matches, context) {
|
|
|
179
187
|
}
|
|
180
188
|
// Register arbitrary variants
|
|
181
189
|
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
|
182
|
-
let selector = (0, _dataTypes
|
|
183
|
-
if (!(0, _setupContextUtils
|
|
190
|
+
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
|
191
|
+
if (!(0, _setupContextUtils.isValidVariantFormatString)(selector)) {
|
|
184
192
|
return [];
|
|
185
193
|
}
|
|
186
|
-
|
|
187
|
-
let fn = (0, _setupContextUtils).parseVariant(selector);
|
|
194
|
+
let fn = (0, _setupContextUtils.parseVariant)(selector);
|
|
188
195
|
let sort = Array.from(context.variantOrder.values()).pop() << 1n;
|
|
189
196
|
context.variantMap.set(variant, [
|
|
190
197
|
[
|
|
@@ -197,14 +204,14 @@ function applyVariant(variant, matches, context) {
|
|
|
197
204
|
if (context.variantMap.has(variant)) {
|
|
198
205
|
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
|
199
206
|
let result = [];
|
|
200
|
-
for (let [meta,
|
|
207
|
+
for (let [meta, rule] of matches){
|
|
201
208
|
// Don't generate variants for user css
|
|
202
209
|
if (meta.layer === "user") {
|
|
203
210
|
continue;
|
|
204
211
|
}
|
|
205
212
|
let container = _postcss.default.root({
|
|
206
213
|
nodes: [
|
|
207
|
-
|
|
214
|
+
rule.clone()
|
|
208
215
|
]
|
|
209
216
|
});
|
|
210
217
|
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
|
@@ -258,7 +265,7 @@ function applyVariant(variant, matches, context) {
|
|
|
258
265
|
// It can happen that a list of format strings is returned from within the function. In that
|
|
259
266
|
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
260
267
|
if (Array.isArray(ruleWithVariant)) {
|
|
261
|
-
for (let [idx,
|
|
268
|
+
for (let [idx, variantFunction1] of ruleWithVariant.entries()){
|
|
262
269
|
// This is a little bit scary since we are pushing to an array of items that we are
|
|
263
270
|
// currently looping over. However, you can also think of it like a processing queue
|
|
264
271
|
// where you keep handling jobs until everything is done and each job can queue more
|
|
@@ -269,7 +276,7 @@ function applyVariant(variant, matches, context) {
|
|
|
269
276
|
// then this might be the place too look at. One potential solution to this problem is
|
|
270
277
|
// reserving additional X places for these 'unknown' variants in between.
|
|
271
278
|
variantSort | BigInt(idx << ruleWithVariant.length),
|
|
272
|
-
|
|
279
|
+
variantFunction1,
|
|
273
280
|
// If the clone has been modified we have to pass that back
|
|
274
281
|
// though so each rule can use the modified container
|
|
275
282
|
clone.clone(),
|
|
@@ -298,7 +305,7 @@ function applyVariant(variant, matches, context) {
|
|
|
298
305
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
299
306
|
// However, plugin authors probably also prepend or append certain
|
|
300
307
|
// classes, pseudos, ids, ...
|
|
301
|
-
let rebuiltBase = (0, _postcssSelectorParser
|
|
308
|
+
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
302
309
|
selectors.walkClasses((classNode)=>{
|
|
303
310
|
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
|
304
311
|
});
|
|
@@ -332,7 +339,7 @@ function applyVariant(variant, matches, context) {
|
|
|
332
339
|
...meta,
|
|
333
340
|
sort: variantSort | meta.sort,
|
|
334
341
|
collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats),
|
|
335
|
-
isArbitraryVariant
|
|
342
|
+
isArbitraryVariant: isArbitraryValue(variant)
|
|
336
343
|
},
|
|
337
344
|
clone.nodes[0],
|
|
338
345
|
];
|
|
@@ -345,7 +352,7 @@ function applyVariant(variant, matches, context) {
|
|
|
345
352
|
}
|
|
346
353
|
function parseRules(rule, cache, options = {}) {
|
|
347
354
|
// PostCSS node
|
|
348
|
-
if (!(0, _isPlainObject
|
|
355
|
+
if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
|
|
349
356
|
return [
|
|
350
357
|
[
|
|
351
358
|
rule
|
|
@@ -359,7 +366,7 @@ function parseRules(rule, cache, options = {}) {
|
|
|
359
366
|
}
|
|
360
367
|
// Simple object
|
|
361
368
|
if (!cache.has(rule)) {
|
|
362
|
-
cache.set(rule, (0, _parseObjectStyles
|
|
369
|
+
cache.set(rule, (0, _parseObjectStyles.default)(rule));
|
|
363
370
|
}
|
|
364
371
|
return [
|
|
365
372
|
cache.get(rule),
|
|
@@ -420,10 +427,10 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
420
427
|
if (!isValidPropName(property)) {
|
|
421
428
|
return null;
|
|
422
429
|
}
|
|
423
|
-
if (!(0, _isValidArbitraryValue
|
|
430
|
+
if (!(0, _isValidArbitraryValue.default)(value)) {
|
|
424
431
|
return null;
|
|
425
432
|
}
|
|
426
|
-
let normalized = (0, _dataTypes
|
|
433
|
+
let normalized = (0, _dataTypes.normalize)(value);
|
|
427
434
|
if (!isParsableCssValue(property, normalized)) {
|
|
428
435
|
return null;
|
|
429
436
|
}
|
|
@@ -434,7 +441,7 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
434
441
|
layer: "utilities"
|
|
435
442
|
},
|
|
436
443
|
()=>({
|
|
437
|
-
[(0, _nameClass
|
|
444
|
+
[(0, _nameClass.asClass)(classCandidate)]: {
|
|
438
445
|
[property]: normalized
|
|
439
446
|
}
|
|
440
447
|
}),
|
|
@@ -481,18 +488,21 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
481
488
|
}
|
|
482
489
|
}
|
|
483
490
|
function splitWithSeparator(input, separator) {
|
|
484
|
-
if (input ===
|
|
491
|
+
if (input === _sharedState.NOT_ON_DEMAND) {
|
|
485
492
|
return [
|
|
486
|
-
|
|
493
|
+
_sharedState.NOT_ON_DEMAND
|
|
487
494
|
];
|
|
488
495
|
}
|
|
489
|
-
return Array.from((0, _splitAtTopLevelOnlyJs
|
|
496
|
+
return Array.from((0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator));
|
|
490
497
|
}
|
|
491
498
|
function* recordCandidates(matches, classCandidate) {
|
|
492
499
|
for (const match of matches){
|
|
500
|
+
var ref;
|
|
501
|
+
var ref1;
|
|
493
502
|
match[1].raws.tailwind = {
|
|
494
503
|
...match[1].raws.tailwind,
|
|
495
|
-
classCandidate
|
|
504
|
+
classCandidate,
|
|
505
|
+
preserveSource: (ref1 = (ref = match[0].options) === null || ref === void 0 ? void 0 : ref.preserveSource) !== null && ref1 !== void 0 ? ref1 : false
|
|
496
506
|
};
|
|
497
507
|
yield match;
|
|
498
508
|
}
|
|
@@ -505,10 +515,10 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
505
515
|
important = true;
|
|
506
516
|
classCandidate = classCandidate.slice(1);
|
|
507
517
|
}
|
|
508
|
-
if ((0, _featureFlags
|
|
518
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
|
509
519
|
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
|
510
520
|
let base = variants.slice().reverse().join(separator);
|
|
511
|
-
for (let part of (0, _splitAtTopLevelOnlyJs
|
|
521
|
+
for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
|
512
522
|
yield* resolveMatches(base + separator + part, context, original);
|
|
513
523
|
}
|
|
514
524
|
}
|
|
@@ -550,18 +560,18 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
550
560
|
}
|
|
551
561
|
}
|
|
552
562
|
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
|
553
|
-
let
|
|
554
|
-
let [
|
|
555
|
-
for (let
|
|
563
|
+
let ruleSet1 = plugin;
|
|
564
|
+
let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
|
|
565
|
+
for (let rule1 of rules1){
|
|
556
566
|
matchesPerPlugin.push([
|
|
557
567
|
{
|
|
558
568
|
...sort,
|
|
559
569
|
options: {
|
|
560
570
|
...sort.options,
|
|
561
|
-
...
|
|
571
|
+
...options1
|
|
562
572
|
}
|
|
563
573
|
},
|
|
564
|
-
|
|
574
|
+
rule1
|
|
565
575
|
]);
|
|
566
576
|
}
|
|
567
577
|
}
|
|
@@ -595,11 +605,11 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
595
605
|
}
|
|
596
606
|
let messages = [];
|
|
597
607
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
598
|
-
for (let
|
|
599
|
-
let
|
|
608
|
+
for (let type1 of group){
|
|
609
|
+
let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
600
610
|
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
601
611
|
.join("\n")).join("\n\n");
|
|
602
|
-
messages.push(` Use \`${candidate.replace("[", `[${
|
|
612
|
+
messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
|
|
603
613
|
break;
|
|
604
614
|
}
|
|
605
615
|
}
|
|
@@ -621,34 +631,34 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
621
631
|
for (let variant of variants){
|
|
622
632
|
matches = applyVariant(variant, matches, context);
|
|
623
633
|
}
|
|
624
|
-
for (let
|
|
625
|
-
|
|
626
|
-
...
|
|
634
|
+
for (let match of matches){
|
|
635
|
+
match[1].raws.tailwind = {
|
|
636
|
+
...match[1].raws.tailwind,
|
|
627
637
|
candidate
|
|
628
638
|
};
|
|
629
639
|
// Apply final format selector
|
|
630
|
-
if (
|
|
631
|
-
let finalFormat = (0, _formatVariantSelector
|
|
640
|
+
if (match[0].collectedFormats) {
|
|
641
|
+
let finalFormat = (0, _formatVariantSelector.formatVariantSelector)("&", ...match[0].collectedFormats);
|
|
632
642
|
let container = _postcss.default.root({
|
|
633
643
|
nodes: [
|
|
634
|
-
|
|
644
|
+
match[1].clone()
|
|
635
645
|
]
|
|
636
646
|
});
|
|
637
647
|
container.walkRules((rule)=>{
|
|
638
648
|
var ref;
|
|
639
649
|
if (inKeyframes(rule)) return;
|
|
640
|
-
var
|
|
641
|
-
rule.selector = (0, _formatVariantSelector
|
|
650
|
+
var ref1;
|
|
651
|
+
rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, {
|
|
642
652
|
selector: rule.selector,
|
|
643
653
|
candidate: original,
|
|
644
|
-
base: candidate.split(new RegExp(`\\${(
|
|
645
|
-
isArbitraryVariant:
|
|
654
|
+
base: candidate.split(new RegExp(`\\${(ref1 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref1 !== void 0 ? ref1 : ":"}(?![^[]*\\])`)).pop(),
|
|
655
|
+
isArbitraryVariant: match[0].isArbitraryVariant,
|
|
646
656
|
context
|
|
647
657
|
});
|
|
648
658
|
});
|
|
649
|
-
|
|
659
|
+
match[1] = container.nodes[0];
|
|
650
660
|
}
|
|
651
|
-
yield
|
|
661
|
+
yield match;
|
|
652
662
|
}
|
|
653
663
|
}
|
|
654
664
|
}
|
|
@@ -718,5 +728,3 @@ function generateRules(candidates, context) {
|
|
|
718
728
|
function isArbitraryValue(input) {
|
|
719
729
|
return input.startsWith("[") && input.endsWith("]");
|
|
720
730
|
}
|
|
721
|
-
exports.resolveMatches = resolveMatches;
|
|
722
|
-
exports.generateRules = generateRules;
|
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>getModuleDependencies
|
|
8
|
+
});
|
|
9
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
11
|
+
const _resolve = /*#__PURE__*/ _interopRequireDefault(require("resolve"));
|
|
12
|
+
const _detective = /*#__PURE__*/ _interopRequireDefault(require("detective"));
|
|
13
|
+
function _interopRequireDefault(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function createModule(file) {
|
|
19
|
+
const source = _fs.default.readFileSync(file, "utf-8");
|
|
20
|
+
const requires = (0, _detective.default)(source);
|
|
21
|
+
return {
|
|
22
|
+
file,
|
|
23
|
+
requires
|
|
24
|
+
};
|
|
25
|
+
}
|
|
10
26
|
function getModuleDependencies(entryFile) {
|
|
11
27
|
const rootModule = createModule(entryFile);
|
|
12
28
|
const modules = [
|
|
@@ -33,16 +49,3 @@ function getModuleDependencies(entryFile) {
|
|
|
33
49
|
}
|
|
34
50
|
return modules;
|
|
35
51
|
}
|
|
36
|
-
function _interopRequireDefault(obj) {
|
|
37
|
-
return obj && obj.__esModule ? obj : {
|
|
38
|
-
default: obj
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function createModule(file) {
|
|
42
|
-
const source = _fs.default.readFileSync(file, "utf-8");
|
|
43
|
-
const requires = (0, _detective).default(source);
|
|
44
|
-
return {
|
|
45
|
-
file,
|
|
46
|
-
requires
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>normalizeTailwindDirectives
|
|
8
|
+
});
|
|
9
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
7
15
|
function normalizeTailwindDirectives(root) {
|
|
8
16
|
let tailwindDirectives = new Set();
|
|
9
17
|
let layerDirectives = new Set();
|
|
@@ -77,8 +85,3 @@ function normalizeTailwindDirectives(root) {
|
|
|
77
85
|
applyDirectives
|
|
78
86
|
};
|
|
79
87
|
}
|
|
80
|
-
function _interopRequireDefault(obj) {
|
|
81
|
-
return obj && obj.__esModule ? obj : {
|
|
82
|
-
default: obj
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
}
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>expandApplyAtRules
|
|
8
|
+
});
|
|
11
9
|
function partitionRules(root) {
|
|
12
10
|
if (!root.walkAtRules) return;
|
|
13
11
|
let applyParents = new Set();
|
|
@@ -17,10 +15,10 @@ function partitionRules(root) {
|
|
|
17
15
|
if (applyParents.size === 0) {
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
|
-
for (let
|
|
18
|
+
for (let rule of applyParents){
|
|
21
19
|
let nodeGroups = [];
|
|
22
20
|
let lastGroup = [];
|
|
23
|
-
for (let node of
|
|
21
|
+
for (let node of rule.nodes){
|
|
24
22
|
if (node.type === "atrule" && node.name === "apply") {
|
|
25
23
|
if (lastGroup.length > 0) {
|
|
26
24
|
nodeGroups.push(lastGroup);
|
|
@@ -42,12 +40,17 @@ function partitionRules(root) {
|
|
|
42
40
|
for (let group of [
|
|
43
41
|
...nodeGroups
|
|
44
42
|
].reverse()){
|
|
45
|
-
let clone =
|
|
43
|
+
let clone = rule.clone({
|
|
46
44
|
nodes: []
|
|
47
45
|
});
|
|
48
46
|
clone.append(group);
|
|
49
|
-
|
|
47
|
+
rule.after(clone);
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
rule.remove();
|
|
52
50
|
}
|
|
53
51
|
}
|
|
52
|
+
function expandApplyAtRules() {
|
|
53
|
+
return (root)=>{
|
|
54
|
+
partitionRules(root);
|
|
55
|
+
};
|
|
56
|
+
}
|
package/lib/lib/regex.js
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
pattern: ()=>pattern,
|
|
13
|
+
withoutCapturing: ()=>withoutCapturing,
|
|
14
|
+
any: ()=>any,
|
|
15
|
+
optional: ()=>optional,
|
|
16
|
+
zeroOrMore: ()=>zeroOrMore,
|
|
17
|
+
nestedBrackets: ()=>nestedBrackets,
|
|
18
|
+
escape: ()=>escape
|
|
19
|
+
});
|
|
12
20
|
const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
|
|
13
21
|
const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
|
|
14
22
|
/**
|