tailwindcss 3.1.6 → 3.1.7
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 +18 -2
- 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 +37 -34
- package/lib/lib/expandApplyAtRules.js +45 -42
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +80 -70
- 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 +55 -52
- 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 +8 -8
- package/peers/index.js +13 -4
- package/resolveConfig.d.ts +3 -0
- package/src/lib/generateRules.js +5 -1
- package/src/lib/setupContextUtils.js +4 -2
- package/src/util/cloneNodes.js +5 -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
|
}
|
|
@@ -179,12 +188,12 @@ function applyVariant(variant, matches, context) {
|
|
|
179
188
|
}
|
|
180
189
|
// Register arbitrary variants
|
|
181
190
|
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
|
182
|
-
let selector = (0, _dataTypes
|
|
183
|
-
if (!(0, _setupContextUtils
|
|
191
|
+
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
|
192
|
+
if (!(0, _setupContextUtils.isValidVariantFormatString)(selector)) {
|
|
184
193
|
return [];
|
|
185
194
|
}
|
|
186
195
|
isArbitraryVariant = true;
|
|
187
|
-
let fn = (0, _setupContextUtils
|
|
196
|
+
let fn = (0, _setupContextUtils.parseVariant)(selector);
|
|
188
197
|
let sort = Array.from(context.variantOrder.values()).pop() << 1n;
|
|
189
198
|
context.variantMap.set(variant, [
|
|
190
199
|
[
|
|
@@ -197,14 +206,14 @@ function applyVariant(variant, matches, context) {
|
|
|
197
206
|
if (context.variantMap.has(variant)) {
|
|
198
207
|
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
|
199
208
|
let result = [];
|
|
200
|
-
for (let [meta,
|
|
209
|
+
for (let [meta, rule] of matches){
|
|
201
210
|
// Don't generate variants for user css
|
|
202
211
|
if (meta.layer === "user") {
|
|
203
212
|
continue;
|
|
204
213
|
}
|
|
205
214
|
let container = _postcss.default.root({
|
|
206
215
|
nodes: [
|
|
207
|
-
|
|
216
|
+
rule.clone()
|
|
208
217
|
]
|
|
209
218
|
});
|
|
210
219
|
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
|
@@ -258,7 +267,7 @@ function applyVariant(variant, matches, context) {
|
|
|
258
267
|
// It can happen that a list of format strings is returned from within the function. In that
|
|
259
268
|
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
260
269
|
if (Array.isArray(ruleWithVariant)) {
|
|
261
|
-
for (let [idx,
|
|
270
|
+
for (let [idx, variantFunction1] of ruleWithVariant.entries()){
|
|
262
271
|
// This is a little bit scary since we are pushing to an array of items that we are
|
|
263
272
|
// currently looping over. However, you can also think of it like a processing queue
|
|
264
273
|
// where you keep handling jobs until everything is done and each job can queue more
|
|
@@ -269,7 +278,7 @@ function applyVariant(variant, matches, context) {
|
|
|
269
278
|
// then this might be the place too look at. One potential solution to this problem is
|
|
270
279
|
// reserving additional X places for these 'unknown' variants in between.
|
|
271
280
|
variantSort | BigInt(idx << ruleWithVariant.length),
|
|
272
|
-
|
|
281
|
+
variantFunction1,
|
|
273
282
|
// If the clone has been modified we have to pass that back
|
|
274
283
|
// though so each rule can use the modified container
|
|
275
284
|
clone.clone(),
|
|
@@ -298,7 +307,7 @@ function applyVariant(variant, matches, context) {
|
|
|
298
307
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
299
308
|
// However, plugin authors probably also prepend or append certain
|
|
300
309
|
// classes, pseudos, ids, ...
|
|
301
|
-
let rebuiltBase = (0, _postcssSelectorParser
|
|
310
|
+
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
302
311
|
selectors.walkClasses((classNode)=>{
|
|
303
312
|
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
|
304
313
|
});
|
|
@@ -345,7 +354,7 @@ function applyVariant(variant, matches, context) {
|
|
|
345
354
|
}
|
|
346
355
|
function parseRules(rule, cache, options = {}) {
|
|
347
356
|
// PostCSS node
|
|
348
|
-
if (!(0, _isPlainObject
|
|
357
|
+
if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
|
|
349
358
|
return [
|
|
350
359
|
[
|
|
351
360
|
rule
|
|
@@ -359,7 +368,7 @@ function parseRules(rule, cache, options = {}) {
|
|
|
359
368
|
}
|
|
360
369
|
// Simple object
|
|
361
370
|
if (!cache.has(rule)) {
|
|
362
|
-
cache.set(rule, (0, _parseObjectStyles
|
|
371
|
+
cache.set(rule, (0, _parseObjectStyles.default)(rule));
|
|
363
372
|
}
|
|
364
373
|
return [
|
|
365
374
|
cache.get(rule),
|
|
@@ -420,10 +429,10 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
420
429
|
if (!isValidPropName(property)) {
|
|
421
430
|
return null;
|
|
422
431
|
}
|
|
423
|
-
if (!(0, _isValidArbitraryValue
|
|
432
|
+
if (!(0, _isValidArbitraryValue.default)(value)) {
|
|
424
433
|
return null;
|
|
425
434
|
}
|
|
426
|
-
let normalized = (0, _dataTypes
|
|
435
|
+
let normalized = (0, _dataTypes.normalize)(value);
|
|
427
436
|
if (!isParsableCssValue(property, normalized)) {
|
|
428
437
|
return null;
|
|
429
438
|
}
|
|
@@ -434,7 +443,7 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
434
443
|
layer: "utilities"
|
|
435
444
|
},
|
|
436
445
|
()=>({
|
|
437
|
-
[(0, _nameClass
|
|
446
|
+
[(0, _nameClass.asClass)(classCandidate)]: {
|
|
438
447
|
[property]: normalized
|
|
439
448
|
}
|
|
440
449
|
}),
|
|
@@ -481,18 +490,21 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
481
490
|
}
|
|
482
491
|
}
|
|
483
492
|
function splitWithSeparator(input, separator) {
|
|
484
|
-
if (input ===
|
|
493
|
+
if (input === _sharedState.NOT_ON_DEMAND) {
|
|
485
494
|
return [
|
|
486
|
-
|
|
495
|
+
_sharedState.NOT_ON_DEMAND
|
|
487
496
|
];
|
|
488
497
|
}
|
|
489
|
-
return Array.from((0, _splitAtTopLevelOnlyJs
|
|
498
|
+
return Array.from((0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator));
|
|
490
499
|
}
|
|
491
500
|
function* recordCandidates(matches, classCandidate) {
|
|
492
501
|
for (const match of matches){
|
|
502
|
+
var ref;
|
|
503
|
+
var ref1;
|
|
493
504
|
match[1].raws.tailwind = {
|
|
494
505
|
...match[1].raws.tailwind,
|
|
495
|
-
classCandidate
|
|
506
|
+
classCandidate,
|
|
507
|
+
preserveSource: (ref1 = (ref = match[0].options) === null || ref === void 0 ? void 0 : ref.preserveSource) !== null && ref1 !== void 0 ? ref1 : false
|
|
496
508
|
};
|
|
497
509
|
yield match;
|
|
498
510
|
}
|
|
@@ -505,10 +517,10 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
505
517
|
important = true;
|
|
506
518
|
classCandidate = classCandidate.slice(1);
|
|
507
519
|
}
|
|
508
|
-
if ((0, _featureFlags
|
|
520
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
|
509
521
|
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
|
510
522
|
let base = variants.slice().reverse().join(separator);
|
|
511
|
-
for (let part of (0, _splitAtTopLevelOnlyJs
|
|
523
|
+
for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
|
512
524
|
yield* resolveMatches(base + separator + part, context, original);
|
|
513
525
|
}
|
|
514
526
|
}
|
|
@@ -550,18 +562,18 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
550
562
|
}
|
|
551
563
|
}
|
|
552
564
|
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
|
553
|
-
let
|
|
554
|
-
let [
|
|
555
|
-
for (let
|
|
565
|
+
let ruleSet1 = plugin;
|
|
566
|
+
let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
|
|
567
|
+
for (let rule1 of rules1){
|
|
556
568
|
matchesPerPlugin.push([
|
|
557
569
|
{
|
|
558
570
|
...sort,
|
|
559
571
|
options: {
|
|
560
572
|
...sort.options,
|
|
561
|
-
...
|
|
573
|
+
...options1
|
|
562
574
|
}
|
|
563
575
|
},
|
|
564
|
-
|
|
576
|
+
rule1
|
|
565
577
|
]);
|
|
566
578
|
}
|
|
567
579
|
}
|
|
@@ -595,11 +607,11 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
595
607
|
}
|
|
596
608
|
let messages = [];
|
|
597
609
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
598
|
-
for (let
|
|
599
|
-
let
|
|
610
|
+
for (let type1 of group){
|
|
611
|
+
let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
600
612
|
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
601
613
|
.join("\n")).join("\n\n");
|
|
602
|
-
messages.push(` Use \`${candidate.replace("[", `[${
|
|
614
|
+
messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
|
|
603
615
|
break;
|
|
604
616
|
}
|
|
605
617
|
}
|
|
@@ -621,34 +633,34 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
621
633
|
for (let variant of variants){
|
|
622
634
|
matches = applyVariant(variant, matches, context);
|
|
623
635
|
}
|
|
624
|
-
for (let
|
|
625
|
-
|
|
626
|
-
...
|
|
636
|
+
for (let match of matches){
|
|
637
|
+
match[1].raws.tailwind = {
|
|
638
|
+
...match[1].raws.tailwind,
|
|
627
639
|
candidate
|
|
628
640
|
};
|
|
629
641
|
// Apply final format selector
|
|
630
|
-
if (
|
|
631
|
-
let finalFormat = (0, _formatVariantSelector
|
|
642
|
+
if (match[0].collectedFormats) {
|
|
643
|
+
let finalFormat = (0, _formatVariantSelector.formatVariantSelector)("&", ...match[0].collectedFormats);
|
|
632
644
|
let container = _postcss.default.root({
|
|
633
645
|
nodes: [
|
|
634
|
-
|
|
646
|
+
match[1].clone()
|
|
635
647
|
]
|
|
636
648
|
});
|
|
637
649
|
container.walkRules((rule)=>{
|
|
638
650
|
var ref;
|
|
639
651
|
if (inKeyframes(rule)) return;
|
|
640
|
-
var
|
|
641
|
-
rule.selector = (0, _formatVariantSelector
|
|
652
|
+
var ref1;
|
|
653
|
+
rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, {
|
|
642
654
|
selector: rule.selector,
|
|
643
655
|
candidate: original,
|
|
644
|
-
base: candidate.split(new RegExp(`\\${(
|
|
645
|
-
isArbitraryVariant:
|
|
656
|
+
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(),
|
|
657
|
+
isArbitraryVariant: match[0].isArbitraryVariant,
|
|
646
658
|
context
|
|
647
659
|
});
|
|
648
660
|
});
|
|
649
|
-
|
|
661
|
+
match[1] = container.nodes[0];
|
|
650
662
|
}
|
|
651
|
-
yield
|
|
663
|
+
yield match;
|
|
652
664
|
}
|
|
653
665
|
}
|
|
654
666
|
}
|
|
@@ -718,5 +730,3 @@ function generateRules(candidates, context) {
|
|
|
718
730
|
function isArbitraryValue(input) {
|
|
719
731
|
return input.startsWith("[") && input.endsWith("]");
|
|
720
732
|
}
|
|
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
|
/**
|