uapte
This commit is contained in:
142
node_modules/postcss-merge-rules/CHANGELOG.md
generated
vendored
Normal file
142
node_modules/postcss-merge-rules/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
# 2.1.2
|
||||
|
||||
* Performance improvements; no compatibility checking for simple selectors,
|
||||
cached compatibility lookups, and early exit on compatibility mismatches
|
||||
(thanks to @akx).
|
||||
|
||||
# 2.1.1
|
||||
|
||||
* Resolves an issue with `2.1.0` where `browserslist` was not being installed
|
||||
correctly on older Node versions.
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* Rules are now merged based on supported browsers, which uses `browserslist`
|
||||
& `caniuse-api`. The browsers should be supplied by the standard means of
|
||||
[configuring `browserslist`][browserslist], either using config files or
|
||||
via environment variables.
|
||||
|
||||
[browserslist]: https://github.com/ai/browserslist#config-file
|
||||
|
||||
# 2.0.11
|
||||
|
||||
* Resolves an issue where partially identical properties would be removed from
|
||||
a rule erroneously; for example `color: #fff` would be removed if the other
|
||||
rule contained `background-color: #fff`.
|
||||
|
||||
# 2.0.10
|
||||
|
||||
* Replaces the internal list of vendor prefixes with the `vendors` module
|
||||
(now, some less widely used prefixes are supported).
|
||||
|
||||
# 2.0.9
|
||||
|
||||
* Resolves an issue where the module would merge rules that had colliding
|
||||
vendor prefixed properties and specification properties.
|
||||
|
||||
# 2.0.8
|
||||
|
||||
* Resolves an issue where selectors inside `@keyframes` would be merged,
|
||||
causing a break in Safari.
|
||||
|
||||
# 2.0.7
|
||||
|
||||
* Resolves an issue where merging was not respecting property order, in cases
|
||||
where both shorthand definitions and longhand definitions existed. Now,
|
||||
these cases will not be merged (thanks to @11bit).
|
||||
|
||||
# 2.0.6
|
||||
|
||||
* Fixes an issue where forward merging was not checking that the merge candidate
|
||||
was safe to merge (either contains no vendor prefixes,
|
||||
or the same vendor prefixes).
|
||||
|
||||
# 2.0.5
|
||||
|
||||
* Replaced PostCSS' `cloneBefore` with custom clone method to handle `null`
|
||||
values properly.
|
||||
|
||||
# 2.0.4
|
||||
|
||||
* Fixes a crash when cloning a `null` object property (thanks to @JMoxey).
|
||||
|
||||
# 2.0.3
|
||||
|
||||
* Fixed an issue where the module was incorrectly merging across `@font-face`
|
||||
at-rules.
|
||||
|
||||
# 2.0.2
|
||||
|
||||
* Fixed an issue where keyframes with the same name were being merged together
|
||||
incorrectly.
|
||||
|
||||
# 2.0.1
|
||||
|
||||
* Fixed a crash when `rule.nodes` was not defined.
|
||||
|
||||
# 2.0.0
|
||||
|
||||
* Upgraded to PostCSS 5.
|
||||
|
||||
# 1.3.6
|
||||
|
||||
* Minor boost in performance with reduced stringify passes.
|
||||
|
||||
# 1.3.5
|
||||
|
||||
* Improves merging of adjacent rules with identical selectors.
|
||||
|
||||
# 1.3.4
|
||||
|
||||
* Fixes an issue where in some cases, non-adjacent rule merging was being
|
||||
performed.
|
||||
|
||||
# 1.3.3
|
||||
|
||||
* Fixes an issue where the wildcard hack (`*zoom: 1`) was being propagated to
|
||||
other properties erroneously.
|
||||
* Better merging logic in some cases.
|
||||
|
||||
# 1.3.2
|
||||
|
||||
* Fixes a behaviour in which comment nodes were being processed by the
|
||||
partial declaration merging logic.
|
||||
|
||||
# 1.3.1
|
||||
|
||||
* Fixes a behaviour in which rule adjacent forward nodes were not being type
|
||||
checked before they were merged.
|
||||
* Compatibility fixes for the PostCSS plugin guidelines.
|
||||
|
||||
# 1.3.0
|
||||
|
||||
* Better support for merging properties without the existance of a shorthand
|
||||
override.
|
||||
* Can now 'merge forward' adjacent rules as well as the previous 'merge behind'
|
||||
behaviour, leading to better compression.
|
||||
|
||||
# 1.2.2
|
||||
|
||||
* Fixed an issue where the plugin crashed if node.parent was undefined.
|
||||
|
||||
# 1.2.1
|
||||
|
||||
* Fixed a bug where media queries were being merged when their parameters were
|
||||
different.
|
||||
|
||||
# 1.2.0
|
||||
|
||||
* Now uses the PostCSS `4.1` plugin API.
|
||||
|
||||
# 1.1.1
|
||||
|
||||
* Bugfix of last release, now difference is calculated in both directions.
|
||||
|
||||
# 1.1.0
|
||||
|
||||
* Less eager moving of properties, to avoid cases where moving a longhand
|
||||
property would allow a shorthand property to override it.
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Initial release.
|
||||
22
node_modules/postcss-merge-rules/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/postcss-merge-rules/LICENSE-MIT
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
109
node_modules/postcss-merge-rules/README.md
generated
vendored
Normal file
109
node_modules/postcss-merge-rules/README.md
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# [postcss][postcss]-merge-rules [][ci] [][npm] [][deps]
|
||||
|
||||
> Merge CSS rules with PostCSS.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/postcss-merge-rules) do:
|
||||
|
||||
```
|
||||
npm install postcss-merge-rules --save
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
This module will attempt to merge *adjacent* CSS rules:
|
||||
|
||||
### By declarations
|
||||
|
||||
#### Input
|
||||
|
||||
```css
|
||||
a {
|
||||
color: blue;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
p {
|
||||
color: blue;
|
||||
font-weight: bold
|
||||
}
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```css
|
||||
a,p {
|
||||
color: blue;
|
||||
font-weight: bold
|
||||
}
|
||||
```
|
||||
|
||||
### By selectors
|
||||
|
||||
#### Input
|
||||
|
||||
```css
|
||||
a {
|
||||
color: blue
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: bold
|
||||
}
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```css
|
||||
a {
|
||||
color: blue;
|
||||
font-weight: bold
|
||||
}
|
||||
```
|
||||
|
||||
### By partial declarations
|
||||
|
||||
#### Input
|
||||
|
||||
```css
|
||||
a {
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
p {
|
||||
color: blue;
|
||||
font-weight: bold
|
||||
}
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```css
|
||||
a,p {
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
p {
|
||||
color: blue
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
|
||||
examples for your environment.
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are welcome. If you add functionality, then please add unit tests
|
||||
to cover it.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Briggs](http://beneb.info)
|
||||
|
||||
[ci]: https://travis-ci.org/ben-eb/postcss-merge-rules
|
||||
[deps]: https://gemnasium.com/ben-eb/postcss-merge-rules
|
||||
[npm]: http://badge.fury.io/js/postcss-merge-rules
|
||||
[postcss]: https://github.com/postcss/postcss
|
||||
270
node_modules/postcss-merge-rules/dist/index.js
generated
vendored
Normal file
270
node_modules/postcss-merge-rules/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _browserslist = require('browserslist');
|
||||
|
||||
var _browserslist2 = _interopRequireDefault(_browserslist);
|
||||
|
||||
var _postcss = require('postcss');
|
||||
|
||||
var _postcss2 = _interopRequireDefault(_postcss);
|
||||
|
||||
var _vendors = require('vendors');
|
||||
|
||||
var _vendors2 = _interopRequireDefault(_vendors);
|
||||
|
||||
var _clone = require('./lib/clone');
|
||||
|
||||
var _clone2 = _interopRequireDefault(_clone);
|
||||
|
||||
var _ensureCompatibility = require('./lib/ensureCompatibility');
|
||||
|
||||
var _ensureCompatibility2 = _interopRequireDefault(_ensureCompatibility);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var prefixes = _vendors2.default.map(function (v) {
|
||||
return '-' + v + '-';
|
||||
});
|
||||
|
||||
function intersect(a, b, not) {
|
||||
return a.filter(function (c) {
|
||||
var index = ~b.indexOf(c);
|
||||
return not ? !index : index;
|
||||
});
|
||||
}
|
||||
|
||||
var different = function different(a, b) {
|
||||
return intersect(a, b, true).concat(intersect(b, a, true));
|
||||
};
|
||||
var filterPrefixes = function filterPrefixes(selector) {
|
||||
return intersect(prefixes, selector);
|
||||
};
|
||||
|
||||
function sameVendor(selectorsA, selectorsB) {
|
||||
var same = function same(selectors) {
|
||||
return selectors.map(filterPrefixes).join();
|
||||
};
|
||||
return same(selectorsA) === same(selectorsB);
|
||||
}
|
||||
|
||||
var noVendor = function noVendor(selector) {
|
||||
return !filterPrefixes(selector).length;
|
||||
};
|
||||
|
||||
function sameParent(ruleA, ruleB) {
|
||||
var hasParent = ruleA.parent && ruleB.parent;
|
||||
var sameType = hasParent && ruleA.parent.type === ruleB.parent.type;
|
||||
// If an at rule, ensure that the parameters are the same
|
||||
if (hasParent && ruleA.parent.type !== 'root' && ruleB.parent.type !== 'root') {
|
||||
sameType = sameType && ruleA.parent.params === ruleB.parent.params && ruleA.parent.name === ruleB.parent.name;
|
||||
}
|
||||
return hasParent ? sameType : true;
|
||||
}
|
||||
|
||||
function canMerge(ruleA, ruleB, browsers, compatibilityCache) {
|
||||
var a = ruleA.selectors;
|
||||
var b = ruleB.selectors;
|
||||
|
||||
var selectors = a.concat(b);
|
||||
|
||||
if (!(0, _ensureCompatibility2.default)(selectors, browsers, compatibilityCache)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var parent = sameParent(ruleA, ruleB);
|
||||
var name = ruleA.parent.name;
|
||||
|
||||
if (parent && name && ~name.indexOf('keyframes')) {
|
||||
return false;
|
||||
}
|
||||
return parent && (selectors.every(noVendor) || sameVendor(a, b));
|
||||
}
|
||||
|
||||
var getDecls = function getDecls(rule) {
|
||||
return rule.nodes ? rule.nodes.map(String) : [];
|
||||
};
|
||||
var joinSelectors = function joinSelectors() {
|
||||
for (var _len = arguments.length, rules = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
rules[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return rules.map(function (s) {
|
||||
return s.selector;
|
||||
}).join();
|
||||
};
|
||||
|
||||
function ruleLength() {
|
||||
for (var _len2 = arguments.length, rules = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
rules[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return rules.map(function (r) {
|
||||
return r.nodes.length ? String(r) : '';
|
||||
}).join('').length;
|
||||
}
|
||||
|
||||
function splitProp(prop) {
|
||||
var parts = prop.split('-');
|
||||
var base = void 0,
|
||||
rest = void 0;
|
||||
// Treat vendor prefixed properties as if they were unprefixed;
|
||||
// moving them when combined with non-prefixed properties can
|
||||
// cause issues. e.g. moving -webkit-background-clip when there
|
||||
// is a background shorthand definition.
|
||||
if (prop[0] === '-') {
|
||||
base = parts[2];
|
||||
rest = parts.slice(3);
|
||||
} else {
|
||||
base = parts[0];
|
||||
rest = parts.slice(1);
|
||||
}
|
||||
return [base, rest];
|
||||
}
|
||||
|
||||
function isConflictingProp(propA, propB) {
|
||||
if (propA === propB) {
|
||||
return true;
|
||||
}
|
||||
var a = splitProp(propA);
|
||||
var b = splitProp(propB);
|
||||
return a[0] === b[0] && a[1].length !== b[1].length;
|
||||
}
|
||||
|
||||
function hasConflicts(declProp, notMoved) {
|
||||
return notMoved.some(function (prop) {
|
||||
return isConflictingProp(prop, declProp);
|
||||
});
|
||||
}
|
||||
|
||||
function partialMerge(first, second) {
|
||||
var _this = this;
|
||||
|
||||
var intersection = intersect(getDecls(first), getDecls(second));
|
||||
if (!intersection.length) {
|
||||
return second;
|
||||
}
|
||||
var nextRule = second.next();
|
||||
if (nextRule && nextRule.type === 'rule' && canMerge(second, nextRule)) {
|
||||
var nextIntersection = intersect(getDecls(second), getDecls(nextRule));
|
||||
if (nextIntersection.length > intersection.length) {
|
||||
first = second;second = nextRule;intersection = nextIntersection;
|
||||
}
|
||||
}
|
||||
var recievingBlock = (0, _clone2.default)(second);
|
||||
recievingBlock.selector = joinSelectors(first, second);
|
||||
recievingBlock.nodes = [];
|
||||
second.parent.insertBefore(second, recievingBlock);
|
||||
var difference = different(getDecls(first), getDecls(second));
|
||||
var filterConflicts = function filterConflicts(decls, intersectn) {
|
||||
var willNotMove = [];
|
||||
return decls.reduce(function (willMove, decl) {
|
||||
var intersects = ~intersectn.indexOf(decl);
|
||||
var prop = decl.split(':')[0];
|
||||
var base = prop.split('-')[0];
|
||||
var canMove = difference.every(function (d) {
|
||||
return d.split(':')[0] !== base;
|
||||
});
|
||||
if (intersects && canMove && !hasConflicts(prop, willNotMove)) {
|
||||
willMove.push(decl);
|
||||
} else {
|
||||
willNotMove.push(prop);
|
||||
}
|
||||
return willMove;
|
||||
}, []);
|
||||
};
|
||||
intersection = filterConflicts(getDecls(first).reverse(), intersection);
|
||||
intersection = filterConflicts(getDecls(second), intersection);
|
||||
var firstClone = (0, _clone2.default)(first);
|
||||
var secondClone = (0, _clone2.default)(second);
|
||||
var moveDecl = function moveDecl(callback) {
|
||||
return function (decl) {
|
||||
if (~intersection.indexOf(String(decl))) {
|
||||
callback.call(_this, decl);
|
||||
}
|
||||
};
|
||||
};
|
||||
firstClone.walkDecls(moveDecl(function (decl) {
|
||||
decl.remove();
|
||||
recievingBlock.append(decl);
|
||||
}));
|
||||
secondClone.walkDecls(moveDecl(function (decl) {
|
||||
return decl.remove();
|
||||
}));
|
||||
var merged = ruleLength(firstClone, recievingBlock, secondClone);
|
||||
var original = ruleLength(first, second);
|
||||
if (merged < original) {
|
||||
first.replaceWith(firstClone);
|
||||
second.replaceWith(secondClone);
|
||||
[firstClone, recievingBlock, secondClone].forEach(function (r) {
|
||||
if (!r.nodes.length) {
|
||||
r.remove();
|
||||
}
|
||||
});
|
||||
if (!secondClone.parent) {
|
||||
return recievingBlock;
|
||||
}
|
||||
return secondClone;
|
||||
} else {
|
||||
recievingBlock.remove();
|
||||
return second;
|
||||
}
|
||||
}
|
||||
|
||||
function selectorMerger(browsers, compatibilityCache) {
|
||||
var cache = null;
|
||||
return function (rule) {
|
||||
// Prime the cache with the first rule, or alternately ensure that it is
|
||||
// safe to merge both declarations before continuing
|
||||
if (!cache || !canMerge(rule, cache, browsers, compatibilityCache)) {
|
||||
cache = rule;
|
||||
return;
|
||||
}
|
||||
// Ensure that we don't deduplicate the same rule; this is sometimes
|
||||
// caused by a partial merge
|
||||
if (cache === rule) {
|
||||
cache = rule;
|
||||
return;
|
||||
}
|
||||
// Merge when declarations are exactly equal
|
||||
// e.g. h1 { color: red } h2 { color: red }
|
||||
if (getDecls(rule).join(';') === getDecls(cache).join(';')) {
|
||||
rule.selector = joinSelectors(cache, rule);
|
||||
cache.remove();
|
||||
cache = rule;
|
||||
return;
|
||||
}
|
||||
// Merge when both selectors are exactly equal
|
||||
// e.g. a { color: blue } a { font-weight: bold }
|
||||
if (cache.selector === rule.selector) {
|
||||
var cached = getDecls(cache);
|
||||
rule.walk(function (decl) {
|
||||
if (~cached.indexOf(String(decl))) {
|
||||
return decl.remove();
|
||||
}
|
||||
decl.moveTo(cache);
|
||||
});
|
||||
rule.remove();
|
||||
return;
|
||||
}
|
||||
// Partial merge: check if the rule contains a subset of the last; if
|
||||
// so create a joined selector with the subset, if smaller.
|
||||
cache = partialMerge(cache, rule);
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = _postcss2.default.plugin('postcss-merge-rules', function () {
|
||||
return function (css, result) {
|
||||
var opts = result.opts;
|
||||
|
||||
var browsers = (0, _browserslist2.default)(null, {
|
||||
stats: opts && opts.stats,
|
||||
path: opts && opts.from,
|
||||
env: opts && opts.env
|
||||
});
|
||||
var compatibilityCache = {};
|
||||
css.walkRules(selectorMerger(browsers, compatibilityCache));
|
||||
};
|
||||
});
|
||||
module.exports = exports['default'];
|
||||
35
node_modules/postcss-merge-rules/dist/lib/clone.js
generated
vendored
Normal file
35
node_modules/postcss-merge-rules/dist/lib/clone.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var clone = function clone(obj, parent) {
|
||||
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
var cloned = new obj.constructor();
|
||||
for (var i in obj) {
|
||||
if (!{}.hasOwnProperty.call(obj, i)) {
|
||||
continue;
|
||||
}
|
||||
var value = obj[i];
|
||||
if (i === 'parent' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent;
|
||||
}
|
||||
} else if (i === 'source') {
|
||||
cloned[i] = value;
|
||||
} else if (value instanceof Array) {
|
||||
cloned[i] = value.map(function (j) {
|
||||
return clone(j, cloned);
|
||||
});
|
||||
} else {
|
||||
cloned[i] = clone(value, cloned);
|
||||
}
|
||||
}
|
||||
return cloned;
|
||||
};
|
||||
|
||||
exports.default = clone;
|
||||
module.exports = exports['default'];
|
||||
140
node_modules/postcss-merge-rules/dist/lib/ensureCompatibility.js
generated
vendored
Normal file
140
node_modules/postcss-merge-rules/dist/lib/ensureCompatibility.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.pseudoElements = undefined;
|
||||
exports.default = ensureCompatibility;
|
||||
|
||||
var _caniuseApi = require('caniuse-api');
|
||||
|
||||
var _postcssSelectorParser = require('postcss-selector-parser');
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var simpleSelectorRe = /^#?[-._a-z0-9 ]+$/i;
|
||||
|
||||
var cssSel2 = 'css-sel2';
|
||||
var cssSel3 = 'css-sel3';
|
||||
var cssGencontent = 'css-gencontent';
|
||||
var cssFirstLetter = 'css-first-letter';
|
||||
var cssFirstLine = 'css-first-line';
|
||||
var cssInOutOfRange = 'css-in-out-of-range';
|
||||
|
||||
var pseudoElements = exports.pseudoElements = {
|
||||
':active': cssSel2,
|
||||
':after': cssGencontent,
|
||||
':before': cssGencontent,
|
||||
':checked': cssSel3,
|
||||
':default': 'css-default-pseudo',
|
||||
':dir': 'css-dir-pseudo',
|
||||
':disabled': cssSel3,
|
||||
':empty': cssSel3,
|
||||
':enabled': cssSel3,
|
||||
':first-child': cssSel2,
|
||||
':first-letter': cssFirstLetter,
|
||||
':first-line': cssFirstLine,
|
||||
':first-of-type': cssSel3,
|
||||
':focus': cssSel2,
|
||||
':focus-within': 'css-focus-within',
|
||||
':has': 'css-has',
|
||||
':hover': cssSel2,
|
||||
':in-range': cssInOutOfRange,
|
||||
':indeterminate': 'css-indeterminate-pseudo',
|
||||
':lang': cssSel2,
|
||||
':last-child': cssSel3,
|
||||
':last-of-type': cssSel3,
|
||||
':matches': 'css-matches-pseudo',
|
||||
':not': cssSel3,
|
||||
':nth-child': cssSel3,
|
||||
':nth-last-child': cssSel3,
|
||||
':nth-last-of-type': cssSel3,
|
||||
':nth-of-type': cssSel3,
|
||||
':only-child': cssSel3,
|
||||
':only-of-type': cssSel3,
|
||||
':optional': 'css-optional-pseudo',
|
||||
':out-of-range': cssInOutOfRange,
|
||||
':placeholder-shown': 'css-placeholder-shown',
|
||||
':root': cssSel3,
|
||||
':target': cssSel3,
|
||||
'::after': cssGencontent,
|
||||
'::backdrop': 'dialog',
|
||||
'::before': cssGencontent,
|
||||
'::first-letter': cssFirstLetter,
|
||||
'::first-line': cssFirstLine,
|
||||
'::marker': 'css-marker-pseudo',
|
||||
'::placeholder': 'css-placeholder',
|
||||
'::selection': 'css-selection'
|
||||
};
|
||||
|
||||
function isCssMixin(selector) {
|
||||
return selector[selector.length - 1] === ':';
|
||||
}
|
||||
|
||||
function ensureCompatibility(selectors, browsers, compatibilityCache) {
|
||||
// Should not merge mixins
|
||||
if (selectors.some(isCssMixin)) {
|
||||
return false;
|
||||
}
|
||||
return selectors.every(function (selector) {
|
||||
if (simpleSelectorRe.test(selector)) {
|
||||
return true;
|
||||
}
|
||||
if (compatibilityCache && selector in compatibilityCache) {
|
||||
return compatibilityCache[selector];
|
||||
}
|
||||
var compatible = true;
|
||||
(0, _postcssSelectorParser2.default)(function (ast) {
|
||||
ast.walk(function (node) {
|
||||
var type = node.type,
|
||||
value = node.value;
|
||||
|
||||
if (type === 'pseudo') {
|
||||
var entry = pseudoElements[value];
|
||||
if (entry && compatible) {
|
||||
compatible = (0, _caniuseApi.isSupported)(entry, browsers);
|
||||
}
|
||||
}
|
||||
if (type === 'combinator') {
|
||||
if (~value.indexOf('~')) {
|
||||
compatible = (0, _caniuseApi.isSupported)(cssSel3, browsers);
|
||||
}
|
||||
if (~value.indexOf('>') || ~value.indexOf('+')) {
|
||||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers);
|
||||
}
|
||||
}
|
||||
if (type === 'attribute' && node.attribute) {
|
||||
// [foo]
|
||||
if (!node.operator) {
|
||||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers);
|
||||
}
|
||||
|
||||
if (value) {
|
||||
// [foo="bar"], [foo~="bar"], [foo|="bar"]
|
||||
if (~['=', '~=', '|='].indexOf(node.operator)) {
|
||||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers);
|
||||
}
|
||||
// [foo^="bar"], [foo$="bar"], [foo*="bar"]
|
||||
if (~['^=', '$=', '*='].indexOf(node.operator)) {
|
||||
compatible = (0, _caniuseApi.isSupported)(cssSel3, browsers);
|
||||
}
|
||||
}
|
||||
|
||||
// [foo="bar" i]
|
||||
if (node.insensitive) {
|
||||
compatible = (0, _caniuseApi.isSupported)('css-case-insensitive', browsers);
|
||||
}
|
||||
}
|
||||
if (!compatible) {
|
||||
// If this node was not compatible,
|
||||
// break out early from walking the rest
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}).process(selector);
|
||||
if (compatibilityCache) {
|
||||
compatibilityCache[selector] = compatible;
|
||||
}
|
||||
return compatible;
|
||||
});
|
||||
}
|
||||
113
node_modules/postcss-merge-rules/package.json
generated
vendored
Normal file
113
node_modules/postcss-merge-rules/package.json
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"_from": "postcss-merge-rules@^2.0.3",
|
||||
"_id": "postcss-merge-rules@2.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-0d9d+qexrMO+VT8OnhDofGG19yE=",
|
||||
"_location": "/postcss-merge-rules",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-merge-rules@^2.0.3",
|
||||
"name": "postcss-merge-rules",
|
||||
"escapedName": "postcss-merge-rules",
|
||||
"rawSpec": "^2.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-2.1.2.tgz",
|
||||
"_shasum": "d1df5dfaa7b1acc3be553f0e9e10e87c61b5f721",
|
||||
"_spec": "postcss-merge-rules@^2.0.3",
|
||||
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/t-latehome/wp-content/plugins/opal-estate-pro/node_modules/cssnano",
|
||||
"author": {
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-register"
|
||||
},
|
||||
"browserslist": {
|
||||
"chrome58": [
|
||||
"Chrome 58"
|
||||
],
|
||||
"edge15": [
|
||||
"Edge 15"
|
||||
],
|
||||
"ie6": [
|
||||
"IE 6"
|
||||
],
|
||||
"ie7": [
|
||||
"IE 7"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ben-eb/postcss-merge-rules/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"browserslist": "^1.5.2",
|
||||
"caniuse-api": "^1.5.2",
|
||||
"postcss": "^5.0.4",
|
||||
"postcss-selector-parser": "^2.2.2",
|
||||
"vendors": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Merge CSS rules with PostCSS.",
|
||||
"devDependencies": {
|
||||
"ava": "^0.17.0",
|
||||
"babel-cli": "^6.3.17",
|
||||
"babel-core": "^6.3.26",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-istanbul": "^2.0.0",
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"babel-preset-es2015-loose": "^7.0.0",
|
||||
"babel-preset-stage-0": "^6.3.13",
|
||||
"babel-register": "^6.9.0",
|
||||
"cross-env": "^2.0.1",
|
||||
"del-cli": "^0.2.0",
|
||||
"eslint": "^3.0.0",
|
||||
"eslint-config-cssnano": "^3.0.0",
|
||||
"eslint-plugin-babel": "^3.3.0",
|
||||
"eslint-plugin-import": "^2.0.1",
|
||||
"nyc": "^10.0.0",
|
||||
"postcss-discard-comments": "^2.0.4",
|
||||
"postcss-simple-vars": "^3.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "cssnano"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/ben-eb/postcss-merge-rules",
|
||||
"keywords": [
|
||||
"css",
|
||||
"optimise",
|
||||
"postcss",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"name": "postcss-merge-rules",
|
||||
"nyc": {
|
||||
"sourceMap": false,
|
||||
"instrument": false
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ben-eb/postcss-merge-rules.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"pretest": "eslint src",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "cross-env BABEL_ENV=test nyc ava src/__tests__",
|
||||
"test-012": "cross-env BABEL_ENV=test nyc ava src/__tests__"
|
||||
},
|
||||
"version": "2.1.2"
|
||||
}
|
||||
Reference in New Issue
Block a user