'use strict';
var multimatch = require('multimatch');
var browserslist = require('browserslist');
var caniuse = require('caniuse-lite');
var postcss = require('postcss');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var multimatch__default = /*#__PURE__*/_interopDefaultLegacy(multimatch);
var browserslist__default = /*#__PURE__*/_interopDefaultLegacy(browserslist);
var caniuse__namespace = /*#__PURE__*/_interopNamespace(caniuse);
/**
* No description available.
*
* See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet
*/
// This feature is only in HTML, so we don't lint it
/**
* @type {import('../features').Feature}
*/
var alternateStylesheet = {};
/**
* Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`.
*
* See: https://caniuse.com/background-attachment
*/
/**
* @type {import('../features').Feature}
*/
var backgroundAttachment = {
'background-attachment': [
'fixed',
'local',
],
};
/**
* Non-standard method of clipping a background image to the foreground text.
*
* See: https://caniuse.com/background-clip-text
*/
/**
* @type {import('../features').Feature}
*/
var backgroundClipText = {
'background-clip': 'text',
'-webkit-background-clip': 'text',
};
var backgroundImgOpts = {
'background-clip': true,
'background-origin': true,
'background-size': true,
};
var backgroundPositionXY = {
'background-position-x': true,
'background-position-y': true,
};
/**
* Allows CSS background images to be repeated without clipping.
*
* See: https://caniuse.com/background-repeat-round-space
*/
/**
* @type {import('../features').Feature}
*/
var backgroundRepeatRoundSpace = {
'background-repeat': ['round', 'space'],
};
var borderImage = {
'border-image': true,
'border-image-outset': true,
'border-image-repeat': true,
'border-image-slice': true,
'border-image-source': true,
'border-image-width': true,
};
var borderRadius = {
'border-radius': true,
'border-top-left-radius': true,
'border-top-right-radius': true,
'border-bottom-right-radius': true,
'border-bottom-left-radius': true,
};
var calc = {
'': 'calc(',
};
/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */
/**
* @param {string} browserKey
* @param {string[]} [versions]
* @return {string}
*/
function formatBrowserName(browserKey, versions) {
const entry = caniuse.agents[browserKey];
const browserName = entry ? entry.browser : null;
if (!versions) {
return browserName || '';
}
return (`${browserName} (${versions.join(',')})`);
}
/**
*
* @param {FeatureCheck|FeatureCheck[]} check
* @param {?string|undefined} candidate
*/
function performFeatureCheck(check, candidate) {
if (check == null || candidate == null) return false;
if (check instanceof RegExp) {
return check.test(candidate);
}
switch (typeof check) {
case 'string':
return candidate.includes(check);
case 'function':
return check(candidate);
case 'boolean':
return check;
case 'object':
if (Array.isArray(check)) {
return check.some((c) => performFeatureCheck(c, candidate));
}
// Fallthrough
default:
console.error(check);
throw new TypeError(`Unexpected feature check: ${check}`);
}
}
/**
* @param {FeatureCheck|FeatureCheck[]} selector
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkSelector(selector) {
return (rule) => rule.type === 'rule'
&& performFeatureCheck(selector, rule.selector);
}
/**
* @param {FeatureCheck|FeatureCheck[]} [name]
* @param {FeatureCheck|FeatureCheck[]} [parameters]
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkAtRule(name, parameters) {
return (rule) => rule.type === 'atrule'
&& performFeatureCheck(name, rule.name)
&& (!parameters || performFeatureCheck(parameters, rule.params));
}
/**
* @see https://drafts.csswg.org/css-values/#lengths
* @see https://drafts.csswg.org/css-values/#number-value
* @param {string[]} units
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
function checkCSSLengthUnits(...units) {
const regexp = new RegExp(`(\\+-)?[\\d.]*\\.?\\d+(e(\\+-)?\\d+)?(${units.join('|')})`, 'i');
return (rule) => (
(rule.type === 'decl') ? performFeatureCheck(regexp, rule.value)
: ((rule.type === 'atrule') ? performFeatureCheck(regexp, rule.params)
: false));
}
/**
* Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts.
* @see https://caniuse.com/ch-unit
* @type {import('../features').Feature}
*/
var chUnit = checkCSSLengthUnits('ch');
var cssAll = {
'all': true,
};
var cssAnimation = {
'animation': true,
'animation-name': true,
'animation-duration': true,
'animation-timing-function': true,
'animation-iteration-count': true,
'animation-direction': true,
'animation-play-state': true,
'animation-delay': true,
'animation-fill-mode': true,
};
// @keyframes isn't checked for, but if you try to use it,
// you'll still get a warning anyway because of the 'animation' property
var cssAnyLink = checkSelector([':any-link', ':-webkit-any-link']);
var cssAppearance = {
'appearance': true,
'-webkit-appearance': true,
'-moz-appearance': true,
};
var cssAtCounterStyle = checkAtRule('counter-style');
var cssAutofill = checkSelector([':autofill', ':-webkit-autofill']);
var cssBackdropFilter = {
'backdrop-filter': true,
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var cssBackgroundOffsets = (rule) => {
if (rule.type !== 'decl') return false;
if (rule.prop !== 'background-position') return false;
return postcss.list.space(rule.value).length > 2;
};
var cssBackgroundblendmode = {
'background-blend-mode': true,
};
/**
* Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line).
*
* See: https://caniuse.com/css-boxdecorationbreak
*/
/**
* @type {import('../features').Feature}
*/
var cssBoxdecorationbreak = {
'box-decoration-break': true,
'-webkit-box-decoration-break': true,
};
var cssBoxshadow = {
'box-shadow': true,
};
/**
* @param {import('postcss').ChildNode} rule
* @return {boolean}
*/
var cssCanvas = (rule) => {
if (rule.type !== 'decl') return false;
if (!rule.prop.startsWith('background')) return false;
return rule.value.startsWith('-webkit-canvas');
};
/**
* The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area.
*
* See: https://caniuse.com/css-caret-color
*/
/**
* @type {import('../features').Feature}
*/
var cssCaretColor = {
'caret-color': true,
};
/**
* The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered.
*
* See: https://caniuse.com/css-cascade-layers
*/
/**
* @type {import('../features').Feature}
*/
var cssCascadeLayers = checkAtRule('layer');
/**
* Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `` and ``.
*
* See: https://caniuse.com/css-case-insensitive
*/
/**
* @type {import('../features').Feature}
*/
var cssCaseInsensitive = (rule) => {
if (rule.type !== 'rule') { return false; }
if (/\[.*i]/.test(rule.selector)) { return true; }
return false;
};
var cssClipPath = {
'clip-path': true,
};
/**
* The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images.
*
* See: https://caniuse.com/css-color-adjust
*/
/**
* @type {import('../features').Feature}
*/
var cssColorAdjust = {
'print-color-adjust': true,
'-webkit-print-color-adjust': true,
};
/**
* The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space.
*
* See: https://caniuse.com/css-color-function
*/
/**
* @type {import('../features').Feature}
*/
var cssColorFunction = {
'': 'color(',
};
const REGEX$2 = /(^|[^-])(repeating-)?conic-gradient/;
var cssConicGradients = {
'background': REGEX$2,
'background-image': REGEX$2,
'border-image': REGEX$2,
'border-image-source': REGEX$2,
'content': REGEX$2,
'cursor': REGEX$2,
'list-style': REGEX$2,
'list-style-image': REGEX$2,
};
/**
* Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container.
*
* See: https://caniuse.com/css-container-queries
*/
/**
* @type {import('../features').Feature}
*/
var cssContainerQueries = checkAtRule('container');
var cssContainerQueriesStyle = checkAtRule('container', 'style(');
var cssContainerQueryUnits = checkCSSLengthUnits(
'cqw',
'cqh',
'cqi',
'cqb',
'cqmin',
'cqmax',
);
/**
* The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering.
*
* See: https://caniuse.com/css-containment
*/
/**
* @type {import('../features').Feature}
*/
var cssContainment = {
'contain': true,
};
/**
* Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport.
*
* See: https://caniuse.com/css-content-visibility
*/
/**
* @type {import('../features').Feature}
*/
var cssContentVisibility = {
'content-visibility': true,
};
var cssCounters = {
'counter-reset': true,
'counter-increment': true,
'': 'counter(',
};
/**
* Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`.
*
* See: https://caniuse.com/css-crisp-edges
*/
/**
* @type {import('../features').Feature}
*/
var cssCrispEdges = {
'image-rendering': ['crisp-edges', 'pixelated'],
};
/**
* Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value.
*
* See: https://caniuse.com/css-cross-fade
*/
/**
* @type {import('../features').Feature}
*/
var cssCrossFade = {
'': [
'cross-fade(',
'-webkit-cross-fade(',
],
};
/**
* The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `