tailwindcss 3.0.5 → 3.0.9
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 +44 -3
- package/README.md +8 -4
- package/lib/css/preflight.css +1 -1
- package/lib/index.js +1 -3
- package/lib/lib/collapseDuplicateDeclarations.js +52 -1
- package/lib/lib/defaultExtractor.js +42 -0
- package/lib/lib/evaluateTailwindFunctions.js +1 -1
- package/lib/lib/expandApplyAtRules.js +87 -15
- package/lib/lib/expandTailwindAtRules.js +2 -24
- package/lib/lib/generateRules.js +4 -1
- package/lib/lib/sharedState.js +33 -4
- package/lib/util/color.js +23 -8
- package/lib/util/resolveConfig.js +9 -1
- package/lib/util/toPath.js +6 -1
- package/package.json +10 -11
- package/peers/index.js +75 -87
- package/src/css/preflight.css +1 -1
- package/src/index.js +1 -7
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +48 -0
- package/src/lib/evaluateTailwindFunctions.js +1 -1
- package/src/lib/expandApplyAtRules.js +90 -19
- package/src/lib/expandTailwindAtRules.js +2 -23
- package/src/lib/generateRules.js +5 -1
- package/src/lib/sharedState.js +40 -4
- package/src/util/color.js +20 -7
- package/src/util/resolveConfig.js +11 -1
- package/src/util/toPath.js +23 -1
- package/stubs/defaultConfig.stub.js +2 -2
- package/lib/lib/setupWatchingContext.js +0 -288
- package/src/lib/setupWatchingContext.js +0 -311
package/peers/index.js
CHANGED
|
@@ -5406,7 +5406,7 @@ var require_processor = __commonJS({
|
|
|
5406
5406
|
var Root = require_root();
|
|
5407
5407
|
var Processor = class {
|
|
5408
5408
|
constructor(plugins = []) {
|
|
5409
|
-
this.version = "8.4.
|
|
5409
|
+
this.version = "8.4.5";
|
|
5410
5410
|
this.plugins = this.normalize(plugins);
|
|
5411
5411
|
}
|
|
5412
5412
|
use(plugin) {
|
|
@@ -23880,25 +23880,6 @@ var require_dist2 = __commonJS({
|
|
|
23880
23880
|
}
|
|
23881
23881
|
});
|
|
23882
23882
|
|
|
23883
|
-
// node_modules/is-resolvable/index.js
|
|
23884
|
-
var require_is_resolvable = __commonJS({
|
|
23885
|
-
"node_modules/is-resolvable/index.js"(exports2, module2) {
|
|
23886
|
-
"use strict";
|
|
23887
|
-
var inspect = require("util").inspect;
|
|
23888
|
-
module2.exports = function isResolvable(moduleId, options) {
|
|
23889
|
-
if (typeof moduleId !== "string") {
|
|
23890
|
-
throw new TypeError(inspect(moduleId) + " is not a string. Expected a valid Node.js module identifier (<string>), for example 'eslint', './index.js', './lib'.");
|
|
23891
|
-
}
|
|
23892
|
-
try {
|
|
23893
|
-
require.resolve(moduleId, options);
|
|
23894
|
-
return true;
|
|
23895
|
-
} catch (err) {
|
|
23896
|
-
return false;
|
|
23897
|
-
}
|
|
23898
|
-
};
|
|
23899
|
-
}
|
|
23900
|
-
});
|
|
23901
|
-
|
|
23902
23883
|
// node_modules/timsort/build/timsort.js
|
|
23903
23884
|
var require_timsort = __commonJS({
|
|
23904
23885
|
"node_modules/timsort/build/timsort.js"(exports2) {
|
|
@@ -29271,7 +29252,7 @@ var require_attributes = __commonJS({
|
|
|
29271
29252
|
if (/\s/.test(value)) {
|
|
29272
29253
|
return boolbase_1.falseFunc;
|
|
29273
29254
|
}
|
|
29274
|
-
var regex = new RegExp("(?:^|\\s)"
|
|
29255
|
+
var regex = new RegExp("(?:^|\\s)".concat(escapeRegex(value), "(?:$|\\s)"), ignoreCase ? "i" : "");
|
|
29275
29256
|
return function element(elem) {
|
|
29276
29257
|
var attr = adapter.getAttributeValue(elem, name);
|
|
29277
29258
|
return attr != null && attr.length >= value.length && regex.test(attr) && next(elem);
|
|
@@ -29520,7 +29501,7 @@ var require_filters = __commonJS({
|
|
|
29520
29501
|
},
|
|
29521
29502
|
"nth-child": function(next, rule, _a) {
|
|
29522
29503
|
var adapter = _a.adapter, equals = _a.equals;
|
|
29523
|
-
var func = nth_check_1.default(rule);
|
|
29504
|
+
var func = (0, nth_check_1.default)(rule);
|
|
29524
29505
|
if (func === boolbase_1.falseFunc)
|
|
29525
29506
|
return boolbase_1.falseFunc;
|
|
29526
29507
|
if (func === boolbase_1.trueFunc)
|
|
@@ -29540,7 +29521,7 @@ var require_filters = __commonJS({
|
|
|
29540
29521
|
},
|
|
29541
29522
|
"nth-last-child": function(next, rule, _a) {
|
|
29542
29523
|
var adapter = _a.adapter, equals = _a.equals;
|
|
29543
|
-
var func = nth_check_1.default(rule);
|
|
29524
|
+
var func = (0, nth_check_1.default)(rule);
|
|
29544
29525
|
if (func === boolbase_1.falseFunc)
|
|
29545
29526
|
return boolbase_1.falseFunc;
|
|
29546
29527
|
if (func === boolbase_1.trueFunc)
|
|
@@ -29560,7 +29541,7 @@ var require_filters = __commonJS({
|
|
|
29560
29541
|
},
|
|
29561
29542
|
"nth-of-type": function(next, rule, _a) {
|
|
29562
29543
|
var adapter = _a.adapter, equals = _a.equals;
|
|
29563
|
-
var func = nth_check_1.default(rule);
|
|
29544
|
+
var func = (0, nth_check_1.default)(rule);
|
|
29564
29545
|
if (func === boolbase_1.falseFunc)
|
|
29565
29546
|
return boolbase_1.falseFunc;
|
|
29566
29547
|
if (func === boolbase_1.trueFunc)
|
|
@@ -29581,7 +29562,7 @@ var require_filters = __commonJS({
|
|
|
29581
29562
|
},
|
|
29582
29563
|
"nth-last-of-type": function(next, rule, _a) {
|
|
29583
29564
|
var adapter = _a.adapter, equals = _a.equals;
|
|
29584
|
-
var func = nth_check_1.default(rule);
|
|
29565
|
+
var func = (0, nth_check_1.default)(rule);
|
|
29585
29566
|
if (func === boolbase_1.falseFunc)
|
|
29586
29567
|
return boolbase_1.falseFunc;
|
|
29587
29568
|
if (func === boolbase_1.trueFunc)
|
|
@@ -29716,10 +29697,10 @@ var require_pseudos = __commonJS({
|
|
|
29716
29697
|
function verifyPseudoArgs(func, name, subselect) {
|
|
29717
29698
|
if (subselect === null) {
|
|
29718
29699
|
if (func.length > 2) {
|
|
29719
|
-
throw new Error("pseudo-selector :"
|
|
29700
|
+
throw new Error("pseudo-selector :".concat(name, " requires an argument"));
|
|
29720
29701
|
}
|
|
29721
29702
|
} else if (func.length === 2) {
|
|
29722
|
-
throw new Error("pseudo-selector :"
|
|
29703
|
+
throw new Error("pseudo-selector :".concat(name, " doesn't have any arguments"));
|
|
29723
29704
|
}
|
|
29724
29705
|
}
|
|
29725
29706
|
exports2.verifyPseudoArgs = verifyPseudoArgs;
|
|
@@ -29761,10 +29742,16 @@ var require_aliases = __commonJS({
|
|
|
29761
29742
|
var require_subselects = __commonJS({
|
|
29762
29743
|
"node_modules/css-select/lib/pseudo-selectors/subselects.js"(exports2) {
|
|
29763
29744
|
"use strict";
|
|
29764
|
-
var __spreadArray = exports2 && exports2.__spreadArray || function(to, from) {
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
|
|
29745
|
+
var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) {
|
|
29746
|
+
if (pack || arguments.length === 2)
|
|
29747
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
29748
|
+
if (ar || !(i in from)) {
|
|
29749
|
+
if (!ar)
|
|
29750
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
29751
|
+
ar[i] = from[i];
|
|
29752
|
+
}
|
|
29753
|
+
}
|
|
29754
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
29768
29755
|
};
|
|
29769
29756
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29770
29757
|
exports2.subselects = exports2.getNextSiblings = exports2.ensureIsTag = exports2.PLACEHOLDER_ELEMENT = void 0;
|
|
@@ -29803,6 +29790,7 @@ var require_subselects = __commonJS({
|
|
|
29803
29790
|
exports2.subselects = {
|
|
29804
29791
|
is,
|
|
29805
29792
|
matches: is,
|
|
29793
|
+
where: is,
|
|
29806
29794
|
not: function(next, token, options, context, compileToken) {
|
|
29807
29795
|
var opts = {
|
|
29808
29796
|
xmlMode: !!options.xmlMode,
|
|
@@ -29842,7 +29830,7 @@ var require_subselects = __commonJS({
|
|
|
29842
29830
|
return function(elem) {
|
|
29843
29831
|
context[0] = elem;
|
|
29844
29832
|
var childs = adapter.getChildren(elem);
|
|
29845
|
-
var nextElements = shouldTestNextSiblings ? __spreadArray(__spreadArray([], childs), getNextSiblings(elem, adapter)) : childs;
|
|
29833
|
+
var nextElements = shouldTestNextSiblings ? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs;
|
|
29846
29834
|
return next(elem) && adapter.existsOne(hasElement, nextElements);
|
|
29847
29835
|
};
|
|
29848
29836
|
}
|
|
@@ -29882,9 +29870,9 @@ var require_pseudo_selectors = __commonJS({
|
|
|
29882
29870
|
}
|
|
29883
29871
|
if (name in aliases_1.aliases) {
|
|
29884
29872
|
if (data != null) {
|
|
29885
|
-
throw new Error("Pseudo "
|
|
29873
|
+
throw new Error("Pseudo ".concat(name, " doesn't have any arguments"));
|
|
29886
29874
|
}
|
|
29887
|
-
var alias = css_what_1.parse(aliases_1.aliases[name], options);
|
|
29875
|
+
var alias = (0, css_what_1.parse)(aliases_1.aliases[name], options);
|
|
29888
29876
|
return subselects_1.subselects.is(next, alias, options, context, compileToken);
|
|
29889
29877
|
}
|
|
29890
29878
|
if (name in filters_1.filters) {
|
|
@@ -29892,14 +29880,14 @@ var require_pseudo_selectors = __commonJS({
|
|
|
29892
29880
|
}
|
|
29893
29881
|
if (name in pseudos_1.pseudos) {
|
|
29894
29882
|
var pseudo_1 = pseudos_1.pseudos[name];
|
|
29895
|
-
pseudos_1.verifyPseudoArgs(pseudo_1, name, data);
|
|
29883
|
+
(0, pseudos_1.verifyPseudoArgs)(pseudo_1, name, data);
|
|
29896
29884
|
return pseudo_1 === boolbase_1.falseFunc ? boolbase_1.falseFunc : next === boolbase_1.trueFunc ? function(elem) {
|
|
29897
29885
|
return pseudo_1(elem, options, data);
|
|
29898
29886
|
} : function(elem) {
|
|
29899
29887
|
return pseudo_1(elem, options, data) && next(elem);
|
|
29900
29888
|
};
|
|
29901
29889
|
}
|
|
29902
|
-
throw new Error("unmatched pseudo-class :"
|
|
29890
|
+
throw new Error("unmatched pseudo-class :".concat(name));
|
|
29903
29891
|
}
|
|
29904
29892
|
exports2.compilePseudoSelector = compilePseudoSelector;
|
|
29905
29893
|
}
|
|
@@ -29921,7 +29909,7 @@ var require_general = __commonJS({
|
|
|
29921
29909
|
case "attribute":
|
|
29922
29910
|
return attributes_1.attributeRules[selector.action](next, selector, options);
|
|
29923
29911
|
case "pseudo":
|
|
29924
|
-
return pseudo_selectors_1.compilePseudoSelector(next, selector, options, context, compileToken);
|
|
29912
|
+
return (0, pseudo_selectors_1.compilePseudoSelector)(next, selector, options, context, compileToken);
|
|
29925
29913
|
case "tag":
|
|
29926
29914
|
return function tag(elem) {
|
|
29927
29915
|
return adapter.getName(elem) === selector.name && next(elem);
|
|
@@ -30023,11 +30011,11 @@ var require_compile2 = __commonJS({
|
|
|
30023
30011
|
var subselects_1 = require_subselects();
|
|
30024
30012
|
function compile(selector, options, context) {
|
|
30025
30013
|
var next = compileUnsafe(selector, options, context);
|
|
30026
|
-
return subselects_1.ensureIsTag(next, options.adapter);
|
|
30014
|
+
return (0, subselects_1.ensureIsTag)(next, options.adapter);
|
|
30027
30015
|
}
|
|
30028
30016
|
exports2.compile = compile;
|
|
30029
30017
|
function compileUnsafe(selector, options, context) {
|
|
30030
|
-
var token = typeof selector === "string" ? css_what_1.parse(selector, options) : selector;
|
|
30018
|
+
var token = typeof selector === "string" ? (0, css_what_1.parse)(selector, options) : selector;
|
|
30031
30019
|
return compileToken(token, options, context);
|
|
30032
30020
|
}
|
|
30033
30021
|
exports2.compileUnsafe = compileUnsafe;
|
|
@@ -30049,7 +30037,7 @@ var require_compile2 = __commonJS({
|
|
|
30049
30037
|
}));
|
|
30050
30038
|
for (var _i = 0, token_1 = token; _i < token_1.length; _i++) {
|
|
30051
30039
|
var t = token_1[_i];
|
|
30052
|
-
if (t.length > 0 && procedure_1.isTraversal(t[0]) && t[0].type !== "descendant") {
|
|
30040
|
+
if (t.length > 0 && (0, procedure_1.isTraversal)(t[0]) && t[0].type !== "descendant") {
|
|
30053
30041
|
} else if (hasContext && !t.some(includesScopePseudo)) {
|
|
30054
30042
|
t.unshift(DESCENDANT_TOKEN);
|
|
30055
30043
|
} else {
|
|
@@ -30088,7 +30076,7 @@ var require_compile2 = __commonJS({
|
|
|
30088
30076
|
function compileRules(rules, options, context) {
|
|
30089
30077
|
var _a;
|
|
30090
30078
|
return rules.reduce(function(previous, rule) {
|
|
30091
|
-
return previous === boolbase_1.falseFunc ? boolbase_1.falseFunc : general_1.compileGeneralSelector(previous, rule, options, context, compileToken);
|
|
30079
|
+
return previous === boolbase_1.falseFunc ? boolbase_1.falseFunc : (0, general_1.compileGeneralSelector)(previous, rule, options, context, compileToken);
|
|
30092
30080
|
}, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.trueFunc);
|
|
30093
30081
|
}
|
|
30094
30082
|
function reduceRules(a, b) {
|
|
@@ -30170,7 +30158,7 @@ var require_lib9 = __commonJS({
|
|
|
30170
30158
|
return function select(query, elements, options) {
|
|
30171
30159
|
var opts = convertOptionFormats(options);
|
|
30172
30160
|
if (typeof query !== "function") {
|
|
30173
|
-
query = compile_1.compileUnsafe(query, opts, elements);
|
|
30161
|
+
query = (0, compile_1.compileUnsafe)(query, opts, elements);
|
|
30174
30162
|
}
|
|
30175
30163
|
var filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings);
|
|
30176
30164
|
return searchFunc(query, filteredElements, opts);
|
|
@@ -30188,8 +30176,9 @@ var require_lib9 = __commonJS({
|
|
|
30188
30176
|
exports2.prepareContext = prepareContext;
|
|
30189
30177
|
function appendNextSiblings(elem, adapter) {
|
|
30190
30178
|
var elems = Array.isArray(elem) ? elem.slice(0) : [elem];
|
|
30191
|
-
|
|
30192
|
-
|
|
30179
|
+
var elemsLength = elems.length;
|
|
30180
|
+
for (var i = 0; i < elemsLength; i++) {
|
|
30181
|
+
var nextSiblings = (0, subselects_1.getNextSiblings)(elems[i], adapter);
|
|
30193
30182
|
elems.push.apply(elems, nextSiblings);
|
|
30194
30183
|
}
|
|
30195
30184
|
return elems;
|
|
@@ -30202,7 +30191,7 @@ var require_lib9 = __commonJS({
|
|
|
30202
30191
|
});
|
|
30203
30192
|
function is(elem, query, options) {
|
|
30204
30193
|
var opts = convertOptionFormats(options);
|
|
30205
|
-
return (typeof query === "function" ? query : compile_1.compile(query, opts))(elem);
|
|
30194
|
+
return (typeof query === "function" ? query : (0, compile_1.compile)(query, opts))(elem);
|
|
30206
30195
|
}
|
|
30207
30196
|
exports2.is = is;
|
|
30208
30197
|
exports2.default = exports2.selectAll;
|
|
@@ -67097,7 +67086,9 @@ var require_parser4 = __commonJS({
|
|
|
67097
67086
|
nextToken = this.nextToken;
|
|
67098
67087
|
}
|
|
67099
67088
|
var hasClass = indexesOf(word, ".").filter(function(i) {
|
|
67100
|
-
|
|
67089
|
+
var escapedDot = word[i - 1] === "\\";
|
|
67090
|
+
var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
|
|
67091
|
+
return !escapedDot && !isKeyframesPercent;
|
|
67101
67092
|
});
|
|
67102
67093
|
var hasId = indexesOf(word, "#").filter(function(i) {
|
|
67103
67094
|
return word[i - 1] !== "\\";
|
|
@@ -70086,18 +70077,9 @@ var require_minifyColor = __commonJS({
|
|
|
70086
70077
|
}
|
|
70087
70078
|
(0, _colord.extend)([_names.default, _minify.default]);
|
|
70088
70079
|
function minifyColor(input, options = {}) {
|
|
70089
|
-
const settings = {
|
|
70090
|
-
supportsAlphaHex: false,
|
|
70091
|
-
supportsTransparent: true,
|
|
70092
|
-
...options
|
|
70093
|
-
};
|
|
70094
70080
|
const instance = (0, _colord.colord)(input);
|
|
70095
70081
|
if (instance.isValid()) {
|
|
70096
|
-
const minified = instance.minify(
|
|
70097
|
-
alphaHex: settings.supportsAlphaHex,
|
|
70098
|
-
transparent: settings.supportsTransparent,
|
|
70099
|
-
name: true
|
|
70100
|
-
});
|
|
70082
|
+
const minified = instance.minify(options);
|
|
70101
70083
|
return minified.length < input.length ? minified : input.toLowerCase();
|
|
70102
70084
|
} else {
|
|
70103
70085
|
return input;
|
|
@@ -70203,21 +70185,29 @@ var require_dist13 = __commonJS({
|
|
|
70203
70185
|
});
|
|
70204
70186
|
return parsed.toString();
|
|
70205
70187
|
}
|
|
70206
|
-
function
|
|
70188
|
+
function addPluginDefaults(options, browsers) {
|
|
70189
|
+
const defaults = {
|
|
70190
|
+
transparent: browsers.some(hasTransparentBug) === false,
|
|
70191
|
+
alphaHex: (0, _caniuseApi.isSupported)("css-rrggbbaa", browsers),
|
|
70192
|
+
name: true
|
|
70193
|
+
};
|
|
70194
|
+
return {
|
|
70195
|
+
...defaults,
|
|
70196
|
+
...options
|
|
70197
|
+
};
|
|
70198
|
+
}
|
|
70199
|
+
function pluginCreator(config = {}) {
|
|
70207
70200
|
return {
|
|
70208
70201
|
postcssPlugin: "postcss-colormin",
|
|
70209
70202
|
prepare(result) {
|
|
70210
|
-
const
|
|
70203
|
+
const resultOptions = result.opts || {};
|
|
70211
70204
|
const browsers = (0, _browserslist.default)(null, {
|
|
70212
|
-
stats:
|
|
70205
|
+
stats: resultOptions.stats,
|
|
70213
70206
|
path: __dirname,
|
|
70214
|
-
env:
|
|
70207
|
+
env: resultOptions.env
|
|
70215
70208
|
});
|
|
70216
|
-
const options = {
|
|
70217
|
-
supportsTransparent: browsers.some(hasTransparentBug) === false,
|
|
70218
|
-
supportsAlphaHex: (0, _caniuseApi.isSupported)("css-rrggbbaa", browsers)
|
|
70219
|
-
};
|
|
70220
70209
|
const cache = {};
|
|
70210
|
+
const options = addPluginDefaults(config, browsers);
|
|
70221
70211
|
return {
|
|
70222
70212
|
OnceExit(css) {
|
|
70223
70213
|
css.walkDecls((decl) => {
|
|
@@ -72140,22 +72130,6 @@ var require_normalize_url = __commonJS({
|
|
|
72140
72130
|
}
|
|
72141
72131
|
});
|
|
72142
72132
|
|
|
72143
|
-
// node_modules/is-absolute-url/index.js
|
|
72144
|
-
var require_is_absolute_url = __commonJS({
|
|
72145
|
-
"node_modules/is-absolute-url/index.js"(exports2, module2) {
|
|
72146
|
-
"use strict";
|
|
72147
|
-
module2.exports = (url) => {
|
|
72148
|
-
if (typeof url !== "string") {
|
|
72149
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``);
|
|
72150
|
-
}
|
|
72151
|
-
if (/^[a-zA-Z]:\\/.test(url)) {
|
|
72152
|
-
return false;
|
|
72153
|
-
}
|
|
72154
|
-
return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
|
|
72155
|
-
};
|
|
72156
|
-
}
|
|
72157
|
-
});
|
|
72158
|
-
|
|
72159
72133
|
// node_modules/postcss-normalize-url/dist/index.js
|
|
72160
72134
|
var require_dist19 = __commonJS({
|
|
72161
72135
|
"node_modules/postcss-normalize-url/dist/index.js"(exports2, module2) {
|
|
@@ -72167,14 +72141,21 @@ var require_dist19 = __commonJS({
|
|
|
72167
72141
|
var _path = _interopRequireDefault(require("path"));
|
|
72168
72142
|
var _postcssValueParser = _interopRequireDefault(require_lib());
|
|
72169
72143
|
var _normalizeUrl = _interopRequireDefault(require_normalize_url());
|
|
72170
|
-
var _isAbsoluteUrl = _interopRequireDefault(require_is_absolute_url());
|
|
72171
72144
|
function _interopRequireDefault(obj) {
|
|
72172
72145
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
72173
72146
|
}
|
|
72174
72147
|
var multiline = /\\[\r\n]/;
|
|
72175
72148
|
var escapeChars = /([\s\(\)"'])/g;
|
|
72149
|
+
var ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
|
|
72150
|
+
var WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\/;
|
|
72151
|
+
function isAbsolute(url) {
|
|
72152
|
+
if (WINDOWS_PATH_REGEX.test(url)) {
|
|
72153
|
+
return false;
|
|
72154
|
+
}
|
|
72155
|
+
return ABSOLUTE_URL_REGEX.test(url);
|
|
72156
|
+
}
|
|
72176
72157
|
function convert(url, options) {
|
|
72177
|
-
if ((
|
|
72158
|
+
if (isAbsolute(url) || url.startsWith("//")) {
|
|
72178
72159
|
let normalizedURL = null;
|
|
72179
72160
|
try {
|
|
72180
72161
|
normalizedURL = (0, _normalizeUrl.default)(url, options);
|
|
@@ -75968,11 +75949,18 @@ var require_dist35 = __commonJS({
|
|
|
75968
75949
|
var _postcss = _interopRequireDefault(require_postcss());
|
|
75969
75950
|
var _yaml = _interopRequireDefault(require_yaml());
|
|
75970
75951
|
var _lilconfig = require_dist2();
|
|
75971
|
-
var _isResolvable = _interopRequireDefault(require_is_resolvable());
|
|
75972
75952
|
function _interopRequireDefault(obj) {
|
|
75973
75953
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
75974
75954
|
}
|
|
75975
75955
|
var cssnano = "cssnano";
|
|
75956
|
+
function isResolvable(moduleId) {
|
|
75957
|
+
try {
|
|
75958
|
+
require.resolve(moduleId);
|
|
75959
|
+
return true;
|
|
75960
|
+
} catch (e) {
|
|
75961
|
+
return false;
|
|
75962
|
+
}
|
|
75963
|
+
}
|
|
75976
75964
|
function resolvePreset(preset) {
|
|
75977
75965
|
let fn, options;
|
|
75978
75966
|
if (Array.isArray(preset)) {
|
|
@@ -75991,11 +75979,11 @@ var require_dist35 = __commonJS({
|
|
|
75991
75979
|
if (typeof fn === "function") {
|
|
75992
75980
|
return fn(options).plugins;
|
|
75993
75981
|
}
|
|
75994
|
-
if ((
|
|
75982
|
+
if (isResolvable(fn)) {
|
|
75995
75983
|
return require(fn)(options).plugins;
|
|
75996
75984
|
}
|
|
75997
75985
|
const sugar = `cssnano-preset-${fn}`;
|
|
75998
|
-
if ((
|
|
75986
|
+
if (isResolvable(sugar)) {
|
|
75999
75987
|
return require(sugar)(options).plugins;
|
|
76000
75988
|
}
|
|
76001
75989
|
throw new Error(`Cannot load preset "${fn}". Please check your configuration for errors and try again.`);
|
|
@@ -76033,12 +76021,12 @@ var require_dist35 = __commonJS({
|
|
|
76033
76021
|
options.plugins.forEach((plugin) => {
|
|
76034
76022
|
if (Array.isArray(plugin)) {
|
|
76035
76023
|
const [pluginDef, opts = {}] = plugin;
|
|
76036
|
-
if (typeof pluginDef === "string" && (
|
|
76024
|
+
if (typeof pluginDef === "string" && isResolvable(pluginDef)) {
|
|
76037
76025
|
options.preset.plugins.push([require(pluginDef), opts]);
|
|
76038
76026
|
} else {
|
|
76039
76027
|
options.preset.plugins.push([pluginDef, opts]);
|
|
76040
76028
|
}
|
|
76041
|
-
} else if (typeof plugin === "string" && (
|
|
76029
|
+
} else if (typeof plugin === "string" && isResolvable(plugin)) {
|
|
76042
76030
|
options.preset.plugins.push([require(plugin), {}]);
|
|
76043
76031
|
} else {
|
|
76044
76032
|
options.preset.plugins.push([plugin, {}]);
|
package/src/css/preflight.css
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import setupTrackingContext from './lib/setupTrackingContext'
|
|
2
|
-
import setupWatchingContext from './lib/setupWatchingContext'
|
|
3
2
|
import processTailwindFeatures from './processTailwindFeatures'
|
|
4
3
|
import { env } from './lib/sharedState'
|
|
5
4
|
|
|
@@ -14,12 +13,7 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
14
13
|
return root
|
|
15
14
|
},
|
|
16
15
|
function (root, result) {
|
|
17
|
-
|
|
18
|
-
env.TAILWIND_MODE === 'watch'
|
|
19
|
-
? setupWatchingContext(configOrPath)
|
|
20
|
-
: setupTrackingContext(configOrPath)
|
|
21
|
-
|
|
22
|
-
processTailwindFeatures(setupContext)(root, result)
|
|
16
|
+
processTailwindFeatures(setupTrackingContext(configOrPath))(root, result)
|
|
23
17
|
},
|
|
24
18
|
env.DEBUG &&
|
|
25
19
|
function (root) {
|
|
@@ -3,6 +3,7 @@ export default function collapseDuplicateDeclarations() {
|
|
|
3
3
|
root.walkRules((node) => {
|
|
4
4
|
let seen = new Map()
|
|
5
5
|
let droppable = new Set([])
|
|
6
|
+
let byProperty = new Map()
|
|
6
7
|
|
|
7
8
|
node.walkDecls((decl) => {
|
|
8
9
|
// This could happen if we have nested selectors. In that case the
|
|
@@ -14,15 +15,79 @@ export default function collapseDuplicateDeclarations() {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
if (seen.has(decl.prop)) {
|
|
17
|
-
|
|
18
|
+
// Exact same value as what we have seen so far
|
|
19
|
+
if (seen.get(decl.prop).value === decl.value) {
|
|
20
|
+
// Keep the last one, drop the one we've seen so far
|
|
21
|
+
droppable.add(seen.get(decl.prop))
|
|
22
|
+
// Override the existing one with the new value. This is necessary
|
|
23
|
+
// so that if we happen to have more than one declaration with the
|
|
24
|
+
// same value, that we keep removing the previous one. Otherwise we
|
|
25
|
+
// will only remove the *first* one.
|
|
26
|
+
seen.set(decl.prop, decl)
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Not the same value, so we need to check if we can merge it so
|
|
31
|
+
// let's collect it first.
|
|
32
|
+
if (!byProperty.has(decl.prop)) {
|
|
33
|
+
byProperty.set(decl.prop, new Set())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
byProperty.get(decl.prop).add(seen.get(decl.prop))
|
|
37
|
+
byProperty.get(decl.prop).add(decl)
|
|
18
38
|
}
|
|
19
39
|
|
|
20
40
|
seen.set(decl.prop, decl)
|
|
21
41
|
})
|
|
22
42
|
|
|
43
|
+
// Drop all the duplicate declarations with the exact same value we've
|
|
44
|
+
// already seen so far.
|
|
23
45
|
for (let decl of droppable) {
|
|
24
46
|
decl.remove()
|
|
25
47
|
}
|
|
48
|
+
|
|
49
|
+
// Analyze the declarations based on its unit, drop all the declarations
|
|
50
|
+
// with the same unit but the last one in the list.
|
|
51
|
+
for (let declarations of byProperty.values()) {
|
|
52
|
+
let byUnit = new Map()
|
|
53
|
+
|
|
54
|
+
for (let decl of declarations) {
|
|
55
|
+
let unit = resolveUnit(decl.value)
|
|
56
|
+
if (unit === null) {
|
|
57
|
+
// We don't have a unit, so should never try and collapse this
|
|
58
|
+
// value. This is because we can't know how to do it in a correct
|
|
59
|
+
// way (e.g.: overrides for older browsers)
|
|
60
|
+
continue
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!byUnit.has(unit)) {
|
|
64
|
+
byUnit.set(unit, new Set())
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
byUnit.get(unit).add(decl)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
for (let declarations of byUnit.values()) {
|
|
71
|
+
// Get all but the last one
|
|
72
|
+
let removableDeclarations = Array.from(declarations).slice(0, -1)
|
|
73
|
+
|
|
74
|
+
for (let decl of removableDeclarations) {
|
|
75
|
+
decl.remove()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
26
79
|
})
|
|
27
80
|
}
|
|
28
81
|
}
|
|
82
|
+
|
|
83
|
+
let UNITLESS_NUMBER = Symbol('unitless-number')
|
|
84
|
+
|
|
85
|
+
function resolveUnit(input) {
|
|
86
|
+
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input)
|
|
87
|
+
|
|
88
|
+
if (result) {
|
|
89
|
+
return result[1] ?? UNITLESS_NUMBER
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return null
|
|
93
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const PATTERNS = [
|
|
2
|
+
/(?:\['([^'\s]+[^<>"'`\s:\\])')/.source, // ['text-lg' -> text-lg
|
|
3
|
+
/(?:\["([^"\s]+[^<>"'`\s:\\])")/.source, // ["text-lg" -> text-lg
|
|
4
|
+
/(?:\[`([^`\s]+[^<>"'`\s:\\])`)/.source, // [`text-lg` -> text-lg
|
|
5
|
+
/([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source, // font-['some_font',sans-serif]
|
|
6
|
+
/([^<>"'`\s]*\[\w*"[^'`\s]*"?\])/.source, // font-["some_font",sans-serif]
|
|
7
|
+
/([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source, // bg-[url('...')]
|
|
8
|
+
/([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source, // bg-[url("...")]
|
|
9
|
+
/([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source, // bg-[url('...'),url('...')]
|
|
10
|
+
/([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source, // bg-[url("..."),url("...")]
|
|
11
|
+
/([^<>"'`\s]*\['[^"'`\s]*'\])/.source, // `content-['hello']` but not `content-['hello']']`
|
|
12
|
+
/([^<>"'`\s]*\["[^"'`\s]*"\])/.source, // `content-["hello"]` but not `content-["hello"]"]`
|
|
13
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source, // `[attr:value]`
|
|
14
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source, // `[content:'hello']` but not `[content:"hello"]`
|
|
15
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source, // `[content:"hello"]` but not `[content:'hello']`
|
|
16
|
+
/([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source, // `fill-[#bada55]`, `fill-[#bada55]/50`
|
|
17
|
+
/([^"'`\s]*[^<>"'`\s:\\])/.source, // `<sm:underline`, `md>:font-bold`
|
|
18
|
+
/([^<>"'`\s]*[^"'`\s:\\])/.source, // `px-1.5`, `uppercase` but not `uppercase:`
|
|
19
|
+
|
|
20
|
+
// Arbitrary properties
|
|
21
|
+
// /([^"\s]*\[[^\s]+?\][^"\s]*)/.source,
|
|
22
|
+
// /([^'\s]*\[[^\s]+?\][^'\s]*)/.source,
|
|
23
|
+
// /([^`\s]*\[[^\s]+?\][^`\s]*)/.source,
|
|
24
|
+
].join('|')
|
|
25
|
+
|
|
26
|
+
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g')
|
|
27
|
+
const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} content
|
|
31
|
+
*/
|
|
32
|
+
export function defaultExtractor(content) {
|
|
33
|
+
let broadMatches = content.matchAll(BROAD_MATCH_GLOBAL_REGEXP)
|
|
34
|
+
let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || []
|
|
35
|
+
let results = [...broadMatches, ...innerMatches].flat().filter((v) => v !== undefined)
|
|
36
|
+
|
|
37
|
+
return results
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Regular utilities
|
|
41
|
+
// {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
|
|
42
|
+
|
|
43
|
+
// Arbitrary values
|
|
44
|
+
// {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
|
|
45
|
+
// arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
|
|
46
|
+
|
|
47
|
+
// Arbitrary properties
|
|
48
|
+
// {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
|
|
@@ -42,7 +42,7 @@ function validatePath(config, path, defaultValue) {
|
|
|
42
42
|
? pathToString(path)
|
|
43
43
|
: path.replace(/^['"]+/g, '').replace(/['"]+$/g, '')
|
|
44
44
|
const pathSegments = Array.isArray(path) ? path : toPath(pathString)
|
|
45
|
-
const value = dlv(config.theme,
|
|
45
|
+
const value = dlv(config.theme, pathSegments, defaultValue)
|
|
46
46
|
|
|
47
47
|
if (value === undefined) {
|
|
48
48
|
let error = `'${pathString}' does not exist in your theme config.`
|