Initial upload of bennys production files
This commit is contained in:
1
node_modules/.bin/autoprefixer
generated
vendored
Symbolic link
1
node_modules/.bin/autoprefixer
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../autoprefixer/bin/autoprefixer
|
||||
1
node_modules/.bin/baseline-browser-mapping
generated
vendored
Symbolic link
1
node_modules/.bin/baseline-browser-mapping
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../baseline-browser-mapping/dist/cli.js
|
||||
1
node_modules/.bin/browserslist
generated
vendored
Symbolic link
1
node_modules/.bin/browserslist
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browserslist/cli.js
|
||||
1
node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
node_modules/.bin/nanoid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
node_modules/.bin/update-browserslist-db
generated
vendored
Symbolic link
1
node_modules/.bin/update-browserslist-db
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../update-browserslist-db/cli.js
|
||||
252
node_modules/.package-lock.json
generated
vendored
Normal file
252
node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
{
|
||||
"name": "bennyshouse",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/autoprefixer": {
|
||||
"version": "10.4.21",
|
||||
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz",
|
||||
"integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/autoprefixer"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"browserslist": "^4.24.4",
|
||||
"caniuse-lite": "^1.0.30001702",
|
||||
"fraction.js": "^4.3.7",
|
||||
"normalize-range": "^0.1.2",
|
||||
"picocolors": "^1.1.1",
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
},
|
||||
"bin": {
|
||||
"autoprefixer": "bin/autoprefixer"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.8.16",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.16.tgz",
|
||||
"integrity": "sha512-OMu3BGQ4E7P1ErFsIPpbJh0qvDudM/UuJeHgkAvfWe+0HFJCXh+t/l8L6fVLR55RI/UbKrVLnAXZSVwd9ysWYw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"baseline-browser-mapping": "dist/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/browserslist": {
|
||||
"version": "4.26.3",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.3.tgz",
|
||||
"integrity": "sha512-lAUU+02RFBuCKQPj/P6NgjlbCnLBMp4UtgTx7vNHd3XSIJF87s9a5rA3aH2yw3GS9DqZAUbOtZdCCiZeVRqt0w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.8.9",
|
||||
"caniuse-lite": "^1.0.30001746",
|
||||
"electron-to-chromium": "^1.5.227",
|
||||
"node-releases": "^2.0.21",
|
||||
"update-browserslist-db": "^1.1.3"
|
||||
},
|
||||
"bin": {
|
||||
"browserslist": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001750",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001750.tgz",
|
||||
"integrity": "sha512-cuom0g5sdX6rw00qOoLNSFCJ9/mYIsuSOA+yzpDw8eopiFqcVwQvZHqov0vmEighRxX++cfC0Vg1G+1Iy/mSpQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/caniuse-lite"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.235",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.235.tgz",
|
||||
"integrity": "sha512-i/7ntLFwOdoHY7sgjlTIDo4Sl8EdoTjWIaKinYOVfC6bOp71bmwenyZthWHcasxgHDNWbWxvG9M3Ia116zIaYQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/fraction.js": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
||||
"integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"type": "patreon",
|
||||
"url": "https://github.com/sponsors/rawify"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.11",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
||||
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.23",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.23.tgz",
|
||||
"integrity": "sha512-cCmFDMSm26S6tQSDpBCg/NR8NENrVPhAJSf+XbxBG4rPFaaonlEoE9wHQmun+cls499TQGSb7ZyPBRlzgKfpeg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/normalize-range": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
|
||||
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.6",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
|
||||
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-value-parser": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "4.1.14",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.14.tgz",
|
||||
"integrity": "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
|
||||
"integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"escalade": "^3.2.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"update-browserslist-db": "cli.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"browserslist": ">= 4.21.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
node_modules/autoprefixer/LICENSE
generated
vendored
Normal file
20
node_modules/autoprefixer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
||||
66
node_modules/autoprefixer/README.md
generated
vendored
Normal file
66
node_modules/autoprefixer/README.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# Autoprefixer [![Cult Of Martians][cult-img]][cult]
|
||||
|
||||
<img align="right" width="94" height="71"
|
||||
src="https://postcss.github.io/autoprefixer/logo.svg"
|
||||
title="Autoprefixer logo by Anton Lovchikov">
|
||||
|
||||
[PostCSS] plugin to parse CSS and add vendor prefixes to CSS rules using values
|
||||
from [Can I Use]. It is recommended by Google and used in Twitter and Alibaba.
|
||||
|
||||
Write your CSS rules without vendor prefixes (in fact, forget about them
|
||||
entirely):
|
||||
|
||||
```css
|
||||
::placeholder {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.image {
|
||||
background-image: url(image@1x.png);
|
||||
}
|
||||
@media (min-resolution: 2dppx) {
|
||||
.image {
|
||||
background-image: url(image@2x.png);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Autoprefixer will use the data based on current browser popularity and property
|
||||
support to apply prefixes for you. You can try the [interactive demo]
|
||||
of Autoprefixer.
|
||||
|
||||
```css
|
||||
::-moz-placeholder {
|
||||
color: gray;
|
||||
}
|
||||
::placeholder {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.image {
|
||||
background-image: url(image@1x.png);
|
||||
}
|
||||
@media (-webkit-min-device-pixel-ratio: 2),
|
||||
(min-resolution: 2dppx) {
|
||||
.image {
|
||||
background-image: url(image@2x.png);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Twitter account for news and releases: [@autoprefixer].
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=autoprefixer">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
[interactive demo]: https://autoprefixer.github.io/
|
||||
[@autoprefixer]: https://twitter.com/autoprefixer
|
||||
[Can I Use]: https://caniuse.com/
|
||||
[cult-img]: https://cultofmartians.com/assets/badges/badge.svg
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[cult]: https://cultofmartians.com/tasks/autoprefixer-grid.html
|
||||
|
||||
|
||||
## Docs
|
||||
Read full docs **[here](https://github.com/postcss/autoprefixer#readme)**.
|
||||
22
node_modules/autoprefixer/bin/autoprefixer
generated
vendored
Executable file
22
node_modules/autoprefixer/bin/autoprefixer
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
let mode = process.argv[2]
|
||||
if (mode === '--info') {
|
||||
process.stdout.write(require('../')().info() + '\n')
|
||||
} else if (mode === '--version') {
|
||||
process.stdout.write(
|
||||
'autoprefixer ' + require('../package.json').version + '\n'
|
||||
)
|
||||
} else {
|
||||
process.stdout.write(
|
||||
'autoprefix\n' +
|
||||
'\n' +
|
||||
'Options:\n' +
|
||||
' --info Show target browsers and used prefixes\n' +
|
||||
' --version Show version number\n' +
|
||||
' --help Show help\n' +
|
||||
'\n' +
|
||||
'Usage:\n' +
|
||||
' autoprefixer --info\n'
|
||||
)
|
||||
}
|
||||
1136
node_modules/autoprefixer/data/prefixes.js
generated
vendored
Normal file
1136
node_modules/autoprefixer/data/prefixes.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
node_modules/autoprefixer/lib/at-rule.js
generated
vendored
Normal file
35
node_modules/autoprefixer/lib/at-rule.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
let Prefixer = require('./prefixer')
|
||||
|
||||
class AtRule extends Prefixer {
|
||||
/**
|
||||
* Clone and add prefixes for at-rule
|
||||
*/
|
||||
add(rule, prefix) {
|
||||
let prefixed = prefix + rule.name
|
||||
|
||||
let already = rule.parent.some(
|
||||
i => i.name === prefixed && i.params === rule.params
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let cloned = this.clone(rule, { name: prefixed })
|
||||
return rule.parent.insertBefore(rule, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone node with prefixes
|
||||
*/
|
||||
process(node) {
|
||||
let parent = this.parentPrefix(node)
|
||||
|
||||
for (let prefix of this.prefixes) {
|
||||
if (!parent || parent === prefix) {
|
||||
this.add(node, prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AtRule
|
||||
95
node_modules/autoprefixer/lib/autoprefixer.d.ts
generated
vendored
Normal file
95
node_modules/autoprefixer/lib/autoprefixer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
import { Plugin } from 'postcss'
|
||||
import { Stats } from 'browserslist'
|
||||
|
||||
declare function autoprefixer<T extends string[]>(
|
||||
...args: [...T, autoprefixer.Options]
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare function autoprefixer(
|
||||
browsers: string[],
|
||||
options?: autoprefixer.Options
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare function autoprefixer(
|
||||
options?: autoprefixer.Options
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare namespace autoprefixer {
|
||||
type GridValue = 'autoplace' | 'no-autoplace'
|
||||
|
||||
interface Options {
|
||||
/** environment for `Browserslist` */
|
||||
env?: string
|
||||
|
||||
/** should Autoprefixer use Visual Cascade, if CSS is uncompressed */
|
||||
cascade?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes. */
|
||||
add?: boolean
|
||||
|
||||
/** should Autoprefixer [remove outdated] prefixes */
|
||||
remove?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes for @supports parameters. */
|
||||
supports?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes for flexbox properties */
|
||||
flexbox?: boolean | 'no-2009'
|
||||
|
||||
/** should Autoprefixer add IE 10-11 prefixes for Grid Layout properties */
|
||||
grid?: boolean | GridValue
|
||||
|
||||
/** custom usage statistics for > 10% in my stats browsers query */
|
||||
stats?: Stats
|
||||
|
||||
/**
|
||||
* list of queries for target browsers.
|
||||
* Try to not use it.
|
||||
* The best practice is to use `.browserslistrc` config or `browserslist` key in `package.json`
|
||||
* to share target browsers with Babel, ESLint and Stylelint
|
||||
*/
|
||||
overrideBrowserslist?: string | string[]
|
||||
|
||||
/** do not raise error on unknown browser version in `Browserslist` config. */
|
||||
ignoreUnknownVersions?: boolean
|
||||
}
|
||||
|
||||
interface ExportedAPI {
|
||||
/** Autoprefixer data */
|
||||
data: {
|
||||
browsers: { [browser: string]: object | undefined }
|
||||
prefixes: { [prefixName: string]: object | undefined }
|
||||
}
|
||||
|
||||
/** Autoprefixer default browsers */
|
||||
defaults: string[]
|
||||
|
||||
/** Inspect with default Autoprefixer */
|
||||
info(options?: { from?: string }): string
|
||||
|
||||
options: Options
|
||||
|
||||
browsers: string | string[]
|
||||
}
|
||||
|
||||
/** Autoprefixer data */
|
||||
let data: ExportedAPI['data']
|
||||
|
||||
/** Autoprefixer default browsers */
|
||||
let defaults: ExportedAPI['defaults']
|
||||
|
||||
/** Inspect with default Autoprefixer */
|
||||
let info: ExportedAPI['info']
|
||||
|
||||
let postcss: true
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
AUTOPREFIXER_GRID?: autoprefixer.GridValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = autoprefixer
|
||||
164
node_modules/autoprefixer/lib/autoprefixer.js
generated
vendored
Normal file
164
node_modules/autoprefixer/lib/autoprefixer.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
let browserslist = require('browserslist')
|
||||
let { agents } = require('caniuse-lite/dist/unpacker/agents')
|
||||
let pico = require('picocolors')
|
||||
|
||||
let dataPrefixes = require('../data/prefixes')
|
||||
let Browsers = require('./browsers')
|
||||
let getInfo = require('./info')
|
||||
let Prefixes = require('./prefixes')
|
||||
|
||||
let autoprefixerData = { browsers: agents, prefixes: dataPrefixes }
|
||||
|
||||
const WARNING =
|
||||
'\n' +
|
||||
' Replace Autoprefixer `browsers` option to Browserslist config.\n' +
|
||||
' Use `browserslist` key in `package.json` or `.browserslistrc` file.\n' +
|
||||
'\n' +
|
||||
' Using `browsers` option can cause errors. Browserslist config can\n' +
|
||||
' be used for Babel, Autoprefixer, postcss-normalize and other tools.\n' +
|
||||
'\n' +
|
||||
' If you really need to use option, rename it to `overrideBrowserslist`.\n' +
|
||||
'\n' +
|
||||
' Learn more at:\n' +
|
||||
' https://github.com/browserslist/browserslist#readme\n' +
|
||||
' https://twitter.com/browserslist\n' +
|
||||
'\n'
|
||||
|
||||
function isPlainObject(obj) {
|
||||
return Object.prototype.toString.apply(obj) === '[object Object]'
|
||||
}
|
||||
|
||||
let cache = new Map()
|
||||
|
||||
function timeCapsule(result, prefixes) {
|
||||
if (prefixes.browsers.selected.length === 0) {
|
||||
return
|
||||
}
|
||||
if (prefixes.add.selectors.length > 0) {
|
||||
return
|
||||
}
|
||||
if (Object.keys(prefixes.add).length > 2) {
|
||||
return
|
||||
}
|
||||
/* c8 ignore next 11 */
|
||||
result.warn(
|
||||
'Autoprefixer target browsers do not need any prefixes.' +
|
||||
'You do not need Autoprefixer anymore.\n' +
|
||||
'Check your Browserslist config to be sure that your targets ' +
|
||||
'are set up correctly.\n' +
|
||||
'\n' +
|
||||
' Learn more at:\n' +
|
||||
' https://github.com/postcss/autoprefixer#readme\n' +
|
||||
' https://github.com/browserslist/browserslist#readme\n' +
|
||||
'\n'
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = plugin
|
||||
|
||||
function plugin(...reqs) {
|
||||
let options
|
||||
if (reqs.length === 1 && isPlainObject(reqs[0])) {
|
||||
options = reqs[0]
|
||||
reqs = undefined
|
||||
} else if (reqs.length === 0 || (reqs.length === 1 && !reqs[0])) {
|
||||
reqs = undefined
|
||||
} else if (reqs.length <= 2 && (Array.isArray(reqs[0]) || !reqs[0])) {
|
||||
options = reqs[1]
|
||||
reqs = reqs[0]
|
||||
} else if (typeof reqs[reqs.length - 1] === 'object') {
|
||||
options = reqs.pop()
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (options.browser) {
|
||||
throw new Error(
|
||||
'Change `browser` option to `overrideBrowserslist` in Autoprefixer'
|
||||
)
|
||||
} else if (options.browserslist) {
|
||||
throw new Error(
|
||||
'Change `browserslist` option to `overrideBrowserslist` in Autoprefixer'
|
||||
)
|
||||
}
|
||||
|
||||
if (options.overrideBrowserslist) {
|
||||
reqs = options.overrideBrowserslist
|
||||
} else if (options.browsers) {
|
||||
if (typeof console !== 'undefined' && console.warn) {
|
||||
console.warn(
|
||||
pico.red(WARNING.replace(/`[^`]+`/g, i => pico.yellow(i.slice(1, -1))))
|
||||
)
|
||||
}
|
||||
reqs = options.browsers
|
||||
}
|
||||
|
||||
let brwlstOpts = {
|
||||
env: options.env,
|
||||
ignoreUnknownVersions: options.ignoreUnknownVersions,
|
||||
stats: options.stats
|
||||
}
|
||||
|
||||
function loadPrefixes(opts) {
|
||||
let d = autoprefixerData
|
||||
let browsers = new Browsers(d.browsers, reqs, opts, brwlstOpts)
|
||||
let key = browsers.selected.join(', ') + JSON.stringify(options)
|
||||
|
||||
if (!cache.has(key)) {
|
||||
cache.set(key, new Prefixes(d.prefixes, browsers, options))
|
||||
}
|
||||
|
||||
return cache.get(key)
|
||||
}
|
||||
|
||||
return {
|
||||
browsers: reqs,
|
||||
|
||||
info(opts) {
|
||||
opts = opts || {}
|
||||
opts.from = opts.from || process.cwd()
|
||||
return getInfo(loadPrefixes(opts))
|
||||
},
|
||||
|
||||
options,
|
||||
|
||||
postcssPlugin: 'autoprefixer',
|
||||
prepare(result) {
|
||||
let prefixes = loadPrefixes({
|
||||
env: options.env,
|
||||
from: result.opts.from
|
||||
})
|
||||
|
||||
return {
|
||||
OnceExit(root) {
|
||||
timeCapsule(result, prefixes)
|
||||
if (options.remove !== false) {
|
||||
prefixes.processor.remove(root, result)
|
||||
}
|
||||
if (options.add !== false) {
|
||||
prefixes.processor.add(root, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.postcss = true
|
||||
|
||||
/**
|
||||
* Autoprefixer data
|
||||
*/
|
||||
plugin.data = autoprefixerData
|
||||
|
||||
/**
|
||||
* Autoprefixer default browsers
|
||||
*/
|
||||
plugin.defaults = browserslist.defaults
|
||||
|
||||
/**
|
||||
* Inspect with default Autoprefixer
|
||||
*/
|
||||
plugin.info = () => plugin().info()
|
||||
51
node_modules/autoprefixer/lib/brackets.js
generated
vendored
Normal file
51
node_modules/autoprefixer/lib/brackets.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
function last(array) {
|
||||
return array[array.length - 1]
|
||||
}
|
||||
|
||||
let brackets = {
|
||||
/**
|
||||
* Parse string to nodes tree
|
||||
*/
|
||||
parse(str) {
|
||||
let current = ['']
|
||||
let stack = [current]
|
||||
|
||||
for (let sym of str) {
|
||||
if (sym === '(') {
|
||||
current = ['']
|
||||
last(stack).push(current)
|
||||
stack.push(current)
|
||||
continue
|
||||
}
|
||||
|
||||
if (sym === ')') {
|
||||
stack.pop()
|
||||
current = last(stack)
|
||||
current.push('')
|
||||
continue
|
||||
}
|
||||
|
||||
current[current.length - 1] += sym
|
||||
}
|
||||
|
||||
return stack[0]
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate output string by nodes tree
|
||||
*/
|
||||
stringify(ast) {
|
||||
let result = ''
|
||||
for (let i of ast) {
|
||||
if (typeof i === 'object') {
|
||||
result += `(${brackets.stringify(i)})`
|
||||
continue
|
||||
}
|
||||
|
||||
result += i
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = brackets
|
||||
79
node_modules/autoprefixer/lib/browsers.js
generated
vendored
Normal file
79
node_modules/autoprefixer/lib/browsers.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
let browserslist = require('browserslist')
|
||||
let { agents } = require('caniuse-lite/dist/unpacker/agents')
|
||||
|
||||
let utils = require('./utils')
|
||||
|
||||
class Browsers {
|
||||
constructor(data, requirements, options, browserslistOpts) {
|
||||
this.data = data
|
||||
this.options = options || {}
|
||||
this.browserslistOpts = browserslistOpts || {}
|
||||
this.selected = this.parse(requirements)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all prefixes for default browser data
|
||||
*/
|
||||
static prefixes() {
|
||||
if (this.prefixesCache) {
|
||||
return this.prefixesCache
|
||||
}
|
||||
|
||||
this.prefixesCache = []
|
||||
for (let name in agents) {
|
||||
this.prefixesCache.push(`-${agents[name].prefix}-`)
|
||||
}
|
||||
|
||||
this.prefixesCache = utils
|
||||
.uniq(this.prefixesCache)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
|
||||
return this.prefixesCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is value contain any possible prefix
|
||||
*/
|
||||
static withPrefix(value) {
|
||||
if (!this.prefixesRegexp) {
|
||||
this.prefixesRegexp = new RegExp(this.prefixes().join('|'))
|
||||
}
|
||||
|
||||
return this.prefixesRegexp.test(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Is browser is selected by requirements
|
||||
*/
|
||||
isSelected(browser) {
|
||||
return this.selected.includes(browser)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return browsers selected by requirements
|
||||
*/
|
||||
parse(requirements) {
|
||||
let opts = {}
|
||||
for (let i in this.browserslistOpts) {
|
||||
opts[i] = this.browserslistOpts[i]
|
||||
}
|
||||
opts.path = this.options.from
|
||||
return browserslist(requirements, opts)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefix for selected browser
|
||||
*/
|
||||
prefix(browser) {
|
||||
let [name, version] = browser.split(' ')
|
||||
let data = this.data[name]
|
||||
|
||||
let prefix = data.prefix_exceptions && data.prefix_exceptions[version]
|
||||
if (!prefix) {
|
||||
prefix = data.prefix
|
||||
}
|
||||
return `-${prefix}-`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Browsers
|
||||
187
node_modules/autoprefixer/lib/declaration.js
generated
vendored
Normal file
187
node_modules/autoprefixer/lib/declaration.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
let Browsers = require('./browsers')
|
||||
let Prefixer = require('./prefixer')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Declaration extends Prefixer {
|
||||
/**
|
||||
* Clone and add prefixes for declaration
|
||||
*/
|
||||
add(decl, prefix, prefixes, result) {
|
||||
let prefixed = this.prefixed(decl.prop, prefix)
|
||||
if (
|
||||
this.isAlready(decl, prefixed) ||
|
||||
this.otherPrefixes(decl.value, prefix)
|
||||
) {
|
||||
return undefined
|
||||
}
|
||||
return this.insert(decl, prefix, prefixes, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate indentation to create visual cascade
|
||||
*/
|
||||
calcBefore(prefixes, decl, prefix = '') {
|
||||
let max = this.maxPrefixed(prefixes, decl)
|
||||
let diff = max - utils.removeNote(prefix).length
|
||||
|
||||
let before = decl.raw('before')
|
||||
if (diff > 0) {
|
||||
before += Array(diff).fill(' ').join('')
|
||||
}
|
||||
|
||||
return before
|
||||
}
|
||||
|
||||
/**
|
||||
* Always true, because we already get prefixer by property name
|
||||
*/
|
||||
check(/* decl */) {
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and insert new declaration
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
let cloned = this.set(this.clone(decl), prefix)
|
||||
if (!cloned) return undefined
|
||||
|
||||
let already = decl.parent.some(
|
||||
i => i.prop === cloned.prop && i.value === cloned.value
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
* Did this declaration has this prefix above
|
||||
*/
|
||||
isAlready(decl, prefixed) {
|
||||
let already = this.all.group(decl).up(i => i.prop === prefixed)
|
||||
if (!already) {
|
||||
already = this.all.group(decl).down(i => i.prop === prefixed)
|
||||
}
|
||||
return already
|
||||
}
|
||||
|
||||
/**
|
||||
* Return maximum length of possible prefixed property
|
||||
*/
|
||||
maxPrefixed(prefixes, decl) {
|
||||
if (decl._autoprefixerMax) {
|
||||
return decl._autoprefixerMax
|
||||
}
|
||||
|
||||
let max = 0
|
||||
for (let prefix of prefixes) {
|
||||
prefix = utils.removeNote(prefix)
|
||||
if (prefix.length > max) {
|
||||
max = prefix.length
|
||||
}
|
||||
}
|
||||
decl._autoprefixerMax = max
|
||||
|
||||
return decl._autoprefixerMax
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we use visual cascade for prefixes
|
||||
*/
|
||||
needCascade(decl) {
|
||||
if (!decl._autoprefixerCascade) {
|
||||
decl._autoprefixerCascade =
|
||||
this.all.options.cascade !== false && decl.raw('before').includes('\n')
|
||||
}
|
||||
return decl._autoprefixerCascade
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of prefixed properties to clean old prefixes
|
||||
*/
|
||||
old(prop, prefix) {
|
||||
return [this.prefixed(prop, prefix)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Check `value`, that it contain other prefixes, rather than `prefix`
|
||||
*/
|
||||
otherPrefixes(value, prefix) {
|
||||
for (let other of Browsers.prefixes()) {
|
||||
if (other === prefix) {
|
||||
continue
|
||||
}
|
||||
if (value.includes(other)) {
|
||||
return value.replace(/var\([^)]+\)/, '').includes(other)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Add spaces for visual cascade
|
||||
*/
|
||||
process(decl, result) {
|
||||
if (!this.needCascade(decl)) {
|
||||
super.process(decl, result)
|
||||
return
|
||||
}
|
||||
|
||||
let prefixes = super.process(decl, result)
|
||||
|
||||
if (!prefixes || !prefixes.length) {
|
||||
return
|
||||
}
|
||||
|
||||
this.restoreBefore(decl)
|
||||
decl.raws.before = this.calcBefore(prefixes, decl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove visual cascade
|
||||
*/
|
||||
restoreBefore(decl) {
|
||||
let lines = decl.raw('before').split('\n')
|
||||
let min = lines[lines.length - 1]
|
||||
|
||||
this.all.group(decl).up(prefixed => {
|
||||
let array = prefixed.raw('before').split('\n')
|
||||
let last = array[array.length - 1]
|
||||
if (last.length < min.length) {
|
||||
min = last
|
||||
}
|
||||
})
|
||||
|
||||
lines[lines.length - 1] = min
|
||||
decl.raws.before = lines.join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to declaration
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl.prop = this.prefixed(decl.prop, prefix)
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Declaration
|
||||
49
node_modules/autoprefixer/lib/hacks/align-content.js
generated
vendored
Normal file
49
node_modules/autoprefixer/lib/hacks/align-content.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class AlignContent extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2012 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-line-pack'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2012 spec and ignore prefix for 2009
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2012) {
|
||||
decl.value = AlignContent.oldValues[decl.value] || decl.value
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
if (spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
AlignContent.names = ['align-content', 'flex-line-pack']
|
||||
|
||||
AlignContent.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start',
|
||||
'space-around': 'distribute',
|
||||
'space-between': 'justify'
|
||||
}
|
||||
|
||||
module.exports = AlignContent
|
||||
46
node_modules/autoprefixer/lib/hacks/align-items.js
generated
vendored
Normal file
46
node_modules/autoprefixer/lib/hacks/align-items.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class AlignItems extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-items'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return prefix + 'box-align'
|
||||
}
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-align'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2009 and 2012 specs
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2009 || spec === 2012) {
|
||||
decl.value = AlignItems.oldValues[decl.value] || decl.value
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
AlignItems.names = ['align-items', 'flex-align', 'box-align']
|
||||
|
||||
AlignItems.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start'
|
||||
}
|
||||
|
||||
module.exports = AlignItems
|
||||
56
node_modules/autoprefixer/lib/hacks/align-self.js
generated
vendored
Normal file
56
node_modules/autoprefixer/lib/hacks/align-self.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class AlignSelf extends Declaration {
|
||||
check(decl) {
|
||||
return (
|
||||
decl.parent &&
|
||||
!decl.parent.some(i => {
|
||||
return i.prop && i.prop.startsWith('grid-')
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2012 specs
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-item-align'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2012 spec and ignore prefix for 2009
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2012) {
|
||||
decl.value = AlignSelf.oldValues[decl.value] || decl.value
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
if (spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
AlignSelf.names = ['align-self', 'flex-item-align']
|
||||
|
||||
AlignSelf.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start'
|
||||
}
|
||||
|
||||
module.exports = AlignSelf
|
||||
17
node_modules/autoprefixer/lib/hacks/animation.js
generated
vendored
Normal file
17
node_modules/autoprefixer/lib/hacks/animation.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Animation extends Declaration {
|
||||
/**
|
||||
* Don’t add prefixes for modern values.
|
||||
*/
|
||||
check(decl) {
|
||||
return !decl.value.split(/\s+/).some(i => {
|
||||
let lower = i.toLowerCase()
|
||||
return lower === 'reverse' || lower === 'alternate-reverse'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Animation.names = ['animation', 'animation-direction']
|
||||
|
||||
module.exports = Animation
|
||||
23
node_modules/autoprefixer/lib/hacks/appearance.js
generated
vendored
Normal file
23
node_modules/autoprefixer/lib/hacks/appearance.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('../utils')
|
||||
|
||||
class Appearance extends Declaration {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
|
||||
if (this.prefixes) {
|
||||
this.prefixes = utils.uniq(
|
||||
this.prefixes.map(i => {
|
||||
if (i === '-ms-') {
|
||||
return '-webkit-'
|
||||
}
|
||||
return i
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Appearance.names = ['appearance']
|
||||
|
||||
module.exports = Appearance
|
||||
26
node_modules/autoprefixer/lib/hacks/autofill.js
generated
vendored
Normal file
26
node_modules/autoprefixer/lib/hacks/autofill.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
let Selector = require('../selector')
|
||||
let utils = require('../utils')
|
||||
|
||||
class Autofill extends Selector {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
|
||||
if (this.prefixes) {
|
||||
this.prefixes = utils.uniq(this.prefixes.map(() => '-webkit-'))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return ':-webkit-autofill'
|
||||
}
|
||||
return `:${prefix}autofill`
|
||||
}
|
||||
}
|
||||
|
||||
Autofill.names = [':autofill']
|
||||
|
||||
module.exports = Autofill
|
||||
20
node_modules/autoprefixer/lib/hacks/backdrop-filter.js
generated
vendored
Normal file
20
node_modules/autoprefixer/lib/hacks/backdrop-filter.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('../utils')
|
||||
|
||||
class BackdropFilter extends Declaration {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
|
||||
if (this.prefixes) {
|
||||
this.prefixes = utils.uniq(
|
||||
this.prefixes.map(i => {
|
||||
return i === '-ms-' ? '-webkit-' : i
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BackdropFilter.names = ['backdrop-filter']
|
||||
|
||||
module.exports = BackdropFilter
|
||||
24
node_modules/autoprefixer/lib/hacks/background-clip.js
generated
vendored
Normal file
24
node_modules/autoprefixer/lib/hacks/background-clip.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('../utils')
|
||||
|
||||
class BackgroundClip extends Declaration {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
|
||||
if (this.prefixes) {
|
||||
this.prefixes = utils.uniq(
|
||||
this.prefixes.map(i => {
|
||||
return i === '-ms-' ? '-webkit-' : i
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
check(decl) {
|
||||
return decl.value.toLowerCase() === 'text'
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundClip.names = ['background-clip']
|
||||
|
||||
module.exports = BackgroundClip
|
||||
23
node_modules/autoprefixer/lib/hacks/background-size.js
generated
vendored
Normal file
23
node_modules/autoprefixer/lib/hacks/background-size.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BackgroundSize extends Declaration {
|
||||
/**
|
||||
* Duplication parameter for -webkit- browsers
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let value = decl.value.toLowerCase()
|
||||
if (
|
||||
prefix === '-webkit-' &&
|
||||
!value.includes(' ') &&
|
||||
value !== 'contain' &&
|
||||
value !== 'cover'
|
||||
) {
|
||||
decl.value = decl.value + ' ' + decl.value
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundSize.names = ['background-size']
|
||||
|
||||
module.exports = BackgroundSize
|
||||
40
node_modules/autoprefixer/lib/hacks/block-logical.js
generated
vendored
Normal file
40
node_modules/autoprefixer/lib/hacks/block-logical.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BlockLogical extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
if (prop.includes('-before')) {
|
||||
return prop.replace('-before', '-block-start')
|
||||
}
|
||||
return prop.replace('-after', '-block-end')
|
||||
}
|
||||
|
||||
/**
|
||||
* Use old syntax for -moz- and -webkit-
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prop.includes('-start')) {
|
||||
return prefix + prop.replace('-block-start', '-before')
|
||||
}
|
||||
return prefix + prop.replace('-block-end', '-after')
|
||||
}
|
||||
}
|
||||
|
||||
BlockLogical.names = [
|
||||
'border-block-start',
|
||||
'border-block-end',
|
||||
'margin-block-start',
|
||||
'margin-block-end',
|
||||
'padding-block-start',
|
||||
'padding-block-end',
|
||||
'border-before',
|
||||
'border-after',
|
||||
'margin-before',
|
||||
'margin-after',
|
||||
'padding-before',
|
||||
'padding-after'
|
||||
]
|
||||
|
||||
module.exports = BlockLogical
|
||||
15
node_modules/autoprefixer/lib/hacks/border-image.js
generated
vendored
Normal file
15
node_modules/autoprefixer/lib/hacks/border-image.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BorderImage extends Declaration {
|
||||
/**
|
||||
* Remove fill parameter for prefixed declarations
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl.value = decl.value.replace(/\s+fill(\s)/, '$1')
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
BorderImage.names = ['border-image']
|
||||
|
||||
module.exports = BorderImage
|
||||
40
node_modules/autoprefixer/lib/hacks/border-radius.js
generated
vendored
Normal file
40
node_modules/autoprefixer/lib/hacks/border-radius.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BorderRadius extends Declaration {
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return BorderRadius.toNormal[prop] || prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Change syntax, when add Mozilla prefix
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-moz-') {
|
||||
return prefix + (BorderRadius.toMozilla[prop] || prop)
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
BorderRadius.names = ['border-radius']
|
||||
|
||||
BorderRadius.toMozilla = {}
|
||||
BorderRadius.toNormal = {}
|
||||
|
||||
for (let ver of ['top', 'bottom']) {
|
||||
for (let hor of ['left', 'right']) {
|
||||
let normal = `border-${ver}-${hor}-radius`
|
||||
let mozilla = `border-radius-${ver}${hor}`
|
||||
|
||||
BorderRadius.names.push(normal)
|
||||
BorderRadius.names.push(mozilla)
|
||||
|
||||
BorderRadius.toMozilla[normal] = mozilla
|
||||
BorderRadius.toNormal[mozilla] = normal
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BorderRadius
|
||||
63
node_modules/autoprefixer/lib/hacks/break-props.js
generated
vendored
Normal file
63
node_modules/autoprefixer/lib/hacks/break-props.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BreakProps extends Declaration {
|
||||
/**
|
||||
* Don’t prefix some values
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.prop !== 'break-inside') {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
|
||||
return undefined
|
||||
}
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
if (prop.includes('inside')) {
|
||||
return 'break-inside'
|
||||
}
|
||||
if (prop.includes('before')) {
|
||||
return 'break-before'
|
||||
}
|
||||
return 'break-after'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change name for -webkit- and -moz- prefix
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return `${prefix}column-${prop}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Change prefixed value for avoid-column and avoid-page
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
if (
|
||||
(decl.prop === 'break-inside' && decl.value === 'avoid-column') ||
|
||||
decl.value === 'avoid-page'
|
||||
) {
|
||||
decl.value = 'avoid'
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
BreakProps.names = [
|
||||
'break-inside',
|
||||
'page-break-inside',
|
||||
'column-break-inside',
|
||||
'break-before',
|
||||
'page-break-before',
|
||||
'column-break-before',
|
||||
'break-after',
|
||||
'page-break-after',
|
||||
'column-break-after'
|
||||
]
|
||||
|
||||
module.exports = BreakProps
|
||||
35
node_modules/autoprefixer/lib/hacks/cross-fade.js
generated
vendored
Normal file
35
node_modules/autoprefixer/lib/hacks/cross-fade.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
let list = require('postcss').list
|
||||
|
||||
let Value = require('../value')
|
||||
|
||||
class CrossFade extends Value {
|
||||
replace(string, prefix) {
|
||||
return list
|
||||
.space(string)
|
||||
.map(value => {
|
||||
if (value.slice(0, +this.name.length + 1) !== this.name + '(') {
|
||||
return value
|
||||
}
|
||||
|
||||
let close = value.lastIndexOf(')')
|
||||
let after = value.slice(close + 1)
|
||||
let args = value.slice(this.name.length + 1, close)
|
||||
|
||||
if (prefix === '-webkit-') {
|
||||
let match = args.match(/\d*.?\d+%?/)
|
||||
if (match) {
|
||||
args = args.slice(match[0].length).trim()
|
||||
args += `, ${match[0]}`
|
||||
} else {
|
||||
args += ', 0.5'
|
||||
}
|
||||
}
|
||||
return prefix + this.name + '(' + args + ')' + after
|
||||
})
|
||||
.join(' ')
|
||||
}
|
||||
}
|
||||
|
||||
CrossFade.names = ['cross-fade']
|
||||
|
||||
module.exports = CrossFade
|
||||
65
node_modules/autoprefixer/lib/hacks/display-flex.js
generated
vendored
Normal file
65
node_modules/autoprefixer/lib/hacks/display-flex.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class DisplayFlex extends Value {
|
||||
constructor(name, prefixes) {
|
||||
super(name, prefixes)
|
||||
if (name === 'display-flex') {
|
||||
this.name = 'flex'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Faster check for flex value
|
||||
*/
|
||||
check(decl) {
|
||||
return decl.prop === 'display' && decl.value === this.name
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for old specs
|
||||
*/
|
||||
old(prefix) {
|
||||
let prefixed = this.prefixed(prefix)
|
||||
if (!prefixed) return undefined
|
||||
return new OldValue(this.name, prefixed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value by spec
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
let spec, value
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
|
||||
if (spec === 2009) {
|
||||
if (this.name === 'flex') {
|
||||
value = 'box'
|
||||
} else {
|
||||
value = 'inline-box'
|
||||
}
|
||||
} else if (spec === 2012) {
|
||||
if (this.name === 'flex') {
|
||||
value = 'flexbox'
|
||||
} else {
|
||||
value = 'inline-flexbox'
|
||||
}
|
||||
} else if (spec === 'final') {
|
||||
value = this.name
|
||||
}
|
||||
|
||||
return prefix + value
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefix to value depend on flebox spec version
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
return this.prefixed(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
DisplayFlex.names = ['display-flex', 'inline-flex']
|
||||
|
||||
module.exports = DisplayFlex
|
||||
21
node_modules/autoprefixer/lib/hacks/display-grid.js
generated
vendored
Normal file
21
node_modules/autoprefixer/lib/hacks/display-grid.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
let Value = require('../value')
|
||||
|
||||
class DisplayGrid extends Value {
|
||||
constructor(name, prefixes) {
|
||||
super(name, prefixes)
|
||||
if (name === 'display-grid') {
|
||||
this.name = 'grid'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Faster check for flex value
|
||||
*/
|
||||
check(decl) {
|
||||
return decl.prop === 'display' && decl.value === this.name
|
||||
}
|
||||
}
|
||||
|
||||
DisplayGrid.names = ['display-grid', 'inline-grid']
|
||||
|
||||
module.exports = DisplayGrid
|
||||
26
node_modules/autoprefixer/lib/hacks/file-selector-button.js
generated
vendored
Normal file
26
node_modules/autoprefixer/lib/hacks/file-selector-button.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
let Selector = require('../selector')
|
||||
let utils = require('../utils')
|
||||
|
||||
class FileSelectorButton extends Selector {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
|
||||
if (this.prefixes) {
|
||||
this.prefixes = utils.uniq(this.prefixes.map(() => '-webkit-'))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return '::-webkit-file-upload-button'
|
||||
}
|
||||
return `::${prefix}file-selector-button`
|
||||
}
|
||||
}
|
||||
|
||||
FileSelectorButton.names = ['::file-selector-button']
|
||||
|
||||
module.exports = FileSelectorButton
|
||||
14
node_modules/autoprefixer/lib/hacks/filter-value.js
generated
vendored
Normal file
14
node_modules/autoprefixer/lib/hacks/filter-value.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
let Value = require('../value')
|
||||
|
||||
class FilterValue extends Value {
|
||||
constructor(name, prefixes) {
|
||||
super(name, prefixes)
|
||||
if (name === 'filter-function') {
|
||||
this.name = 'filter'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FilterValue.names = ['filter', 'filter-function']
|
||||
|
||||
module.exports = FilterValue
|
||||
19
node_modules/autoprefixer/lib/hacks/filter.js
generated
vendored
Normal file
19
node_modules/autoprefixer/lib/hacks/filter.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Filter extends Declaration {
|
||||
/**
|
||||
* Check is it Internet Explorer filter
|
||||
*/
|
||||
check(decl) {
|
||||
let v = decl.value
|
||||
return (
|
||||
!v.toLowerCase().includes('alpha(') &&
|
||||
!v.includes('DXImageTransform.Microsoft') &&
|
||||
!v.includes('data:image/svg+xml')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Filter.names = ['filter']
|
||||
|
||||
module.exports = Filter
|
||||
39
node_modules/autoprefixer/lib/hacks/flex-basis.js
generated
vendored
Normal file
39
node_modules/autoprefixer/lib/hacks/flex-basis.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class FlexBasis extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex-basis'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return flex property for 2012 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-preferred-size'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore 2009 spec and use flex property for 2012
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012 || spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
FlexBasis.names = ['flex-basis', 'flex-preferred-size']
|
||||
|
||||
module.exports = FlexBasis
|
||||
72
node_modules/autoprefixer/lib/hacks/flex-direction.js
generated
vendored
Normal file
72
node_modules/autoprefixer/lib/hacks/flex-direction.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class FlexDirection extends Declaration {
|
||||
/**
|
||||
* Use two properties for 2009 spec
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec !== 2009) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
let already = decl.parent.some(
|
||||
i =>
|
||||
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let v = decl.value
|
||||
let dir, orient
|
||||
if (v === 'inherit' || v === 'initial' || v === 'unset') {
|
||||
orient = v
|
||||
dir = v
|
||||
} else {
|
||||
orient = v.includes('row') ? 'horizontal' : 'vertical'
|
||||
dir = v.includes('reverse') ? 'reverse' : 'normal'
|
||||
}
|
||||
|
||||
let cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-orient'
|
||||
cloned.value = orient
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-direction'
|
||||
cloned.value = dir
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex-direction'
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean two properties for 2009 spec
|
||||
*/
|
||||
old(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return [prefix + 'box-orient', prefix + 'box-direction']
|
||||
} else {
|
||||
return super.old(prop, prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FlexDirection.names = ['flex-direction', 'box-direction', 'box-orient']
|
||||
|
||||
module.exports = FlexDirection
|
||||
53
node_modules/autoprefixer/lib/hacks/flex-flow.js
generated
vendored
Normal file
53
node_modules/autoprefixer/lib/hacks/flex-flow.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class FlexFlow extends Declaration {
|
||||
/**
|
||||
* Use two properties for 2009 spec
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec !== 2009) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
let values = decl.value
|
||||
.split(/\s+/)
|
||||
.filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse')
|
||||
if (values.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let already = decl.parent.some(
|
||||
i =>
|
||||
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let value = values[0]
|
||||
let orient = value.includes('row') ? 'horizontal' : 'vertical'
|
||||
let dir = value.includes('reverse') ? 'reverse' : 'normal'
|
||||
|
||||
let cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-orient'
|
||||
cloned.value = orient
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-direction'
|
||||
cloned.value = dir
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
}
|
||||
|
||||
FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient']
|
||||
|
||||
module.exports = FlexFlow
|
||||
30
node_modules/autoprefixer/lib/hacks/flex-grow.js
generated
vendored
Normal file
30
node_modules/autoprefixer/lib/hacks/flex-grow.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class Flex extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return flex property for 2009 and 2012 specs
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return prefix + 'box-flex'
|
||||
}
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-positive'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Flex.names = ['flex-grow', 'flex-positive']
|
||||
|
||||
module.exports = Flex
|
||||
39
node_modules/autoprefixer/lib/hacks/flex-shrink.js
generated
vendored
Normal file
39
node_modules/autoprefixer/lib/hacks/flex-shrink.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class FlexShrink extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex-shrink'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return flex property for 2012 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-negative'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore 2009 spec and use flex property for 2012
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2012 || spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
FlexShrink.names = ['flex-shrink', 'flex-negative']
|
||||
|
||||
module.exports = FlexShrink
|
||||
19
node_modules/autoprefixer/lib/hacks/flex-spec.js
generated
vendored
Normal file
19
node_modules/autoprefixer/lib/hacks/flex-spec.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Return flexbox spec versions by prefix
|
||||
*/
|
||||
module.exports = function (prefix) {
|
||||
let spec
|
||||
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
|
||||
spec = 2009
|
||||
} else if (prefix === '-ms-') {
|
||||
spec = 2012
|
||||
} else if (prefix === '-webkit-') {
|
||||
spec = 'final'
|
||||
}
|
||||
|
||||
if (prefix === '-webkit- 2009') {
|
||||
prefix = '-webkit-'
|
||||
}
|
||||
|
||||
return [spec, prefix]
|
||||
}
|
||||
19
node_modules/autoprefixer/lib/hacks/flex-wrap.js
generated
vendored
Normal file
19
node_modules/autoprefixer/lib/hacks/flex-wrap.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class FlexWrap extends Declaration {
|
||||
/**
|
||||
* Don't add prefix for 2009 spec
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec !== 2009) {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
FlexWrap.names = ['flex-wrap']
|
||||
|
||||
module.exports = FlexWrap
|
||||
54
node_modules/autoprefixer/lib/hacks/flex.js
generated
vendored
Normal file
54
node_modules/autoprefixer/lib/hacks/flex.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
let list = require('postcss').list
|
||||
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class Flex extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return prefix + 'box-flex'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Spec 2009 supports only first argument
|
||||
* Spec 2012 disallows unitless basis
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2009) {
|
||||
decl.value = list.space(decl.value)[0]
|
||||
decl.value = Flex.oldValues[decl.value] || decl.value
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
if (spec === 2012) {
|
||||
let components = list.space(decl.value)
|
||||
if (components.length === 3 && components[2] === '0') {
|
||||
decl.value = components.slice(0, 2).concat('0px').join(' ')
|
||||
}
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Flex.names = ['flex', 'box-flex']
|
||||
|
||||
Flex.oldValues = {
|
||||
auto: '1',
|
||||
none: '0'
|
||||
}
|
||||
|
||||
module.exports = Flex
|
||||
20
node_modules/autoprefixer/lib/hacks/fullscreen.js
generated
vendored
Normal file
20
node_modules/autoprefixer/lib/hacks/fullscreen.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
let Selector = require('../selector')
|
||||
|
||||
class Fullscreen extends Selector {
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return ':-webkit-full-screen'
|
||||
}
|
||||
if (prefix === '-moz-') {
|
||||
return ':-moz-full-screen'
|
||||
}
|
||||
return `:${prefix}fullscreen`
|
||||
}
|
||||
}
|
||||
|
||||
Fullscreen.names = [':fullscreen']
|
||||
|
||||
module.exports = Fullscreen
|
||||
448
node_modules/autoprefixer/lib/hacks/gradient.js
generated
vendored
Normal file
448
node_modules/autoprefixer/lib/hacks/gradient.js
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
let range = require('normalize-range')
|
||||
let parser = require('postcss-value-parser')
|
||||
|
||||
let OldValue = require('../old-value')
|
||||
let utils = require('../utils')
|
||||
let Value = require('../value')
|
||||
|
||||
let IS_DIRECTION = /top|left|right|bottom/gi
|
||||
|
||||
class Gradient extends Value {
|
||||
/**
|
||||
* Do not add non-webkit prefixes for list-style and object
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
let p = decl.prop
|
||||
if (p.includes('mask')) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else if (
|
||||
p === 'list-style' ||
|
||||
p === 'list-style-image' ||
|
||||
p === 'content'
|
||||
) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Get div token from exists parameters
|
||||
*/
|
||||
cloneDiv(params) {
|
||||
for (let i of params) {
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return { after: ' ', type: 'div', value: ',' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Change colors syntax to old webkit
|
||||
*/
|
||||
colorStops(params) {
|
||||
let result = []
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
let pos
|
||||
let param = params[i]
|
||||
let item
|
||||
if (i === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
let color = parser.stringify(param[0])
|
||||
if (param[1] && param[1].type === 'word') {
|
||||
pos = param[1].value
|
||||
} else if (param[2] && param[2].type === 'word') {
|
||||
pos = param[2].value
|
||||
}
|
||||
|
||||
let stop
|
||||
if (i === 1 && (!pos || pos === '0%')) {
|
||||
stop = `from(${color})`
|
||||
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
||||
stop = `to(${color})`
|
||||
} else if (pos) {
|
||||
stop = `color-stop(${pos}, ${color})`
|
||||
} else {
|
||||
stop = `color-stop(${color})`
|
||||
}
|
||||
|
||||
let div = param[param.length - 1]
|
||||
params[i] = [{ type: 'word', value: stop }]
|
||||
if (div.type === 'div' && div.value === ',') {
|
||||
item = params[i].push(div)
|
||||
}
|
||||
result.push(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Change new direction to old
|
||||
*/
|
||||
convertDirection(params) {
|
||||
if (params.length > 0) {
|
||||
if (params[0].value === 'to') {
|
||||
this.fixDirection(params)
|
||||
} else if (params[0].value.includes('deg')) {
|
||||
this.fixAngle(params)
|
||||
} else if (this.isRadial(params)) {
|
||||
this.fixRadial(params)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Add 90 degrees
|
||||
*/
|
||||
fixAngle(params) {
|
||||
let first = params[0].value
|
||||
first = parseFloat(first)
|
||||
first = Math.abs(450 - first) % 360
|
||||
first = this.roundFloat(first, 3)
|
||||
params[0].value = `${first}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace `to top left` to `bottom right`
|
||||
*/
|
||||
fixDirection(params) {
|
||||
params.splice(0, 2)
|
||||
|
||||
for (let param of params) {
|
||||
if (param.type === 'div') {
|
||||
break
|
||||
}
|
||||
if (param.type === 'word') {
|
||||
param.value = this.revertDirection(param.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix radial direction syntax
|
||||
*/
|
||||
fixRadial(params) {
|
||||
let first = []
|
||||
let second = []
|
||||
let a, b, c, i, next
|
||||
|
||||
for (i = 0; i < params.length - 2; i++) {
|
||||
a = params[i]
|
||||
b = params[i + 1]
|
||||
c = params[i + 2]
|
||||
if (a.type === 'space' && b.value === 'at' && c.type === 'space') {
|
||||
next = i + 3
|
||||
break
|
||||
} else {
|
||||
first.push(a)
|
||||
}
|
||||
}
|
||||
|
||||
let div
|
||||
for (i = next; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
div = params[i]
|
||||
break
|
||||
} else {
|
||||
second.push(params[i])
|
||||
}
|
||||
}
|
||||
|
||||
params.splice(0, i, ...second, div, ...first)
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for at word
|
||||
*/
|
||||
isRadial(params) {
|
||||
let state = 'before'
|
||||
for (let param of params) {
|
||||
if (state === 'before' && param.type === 'space') {
|
||||
state = 'at'
|
||||
} else if (state === 'at' && param.value === 'at') {
|
||||
state = 'after'
|
||||
} else if (state === 'after' && param.type === 'space') {
|
||||
return true
|
||||
} else if (param.type === 'div') {
|
||||
break
|
||||
} else {
|
||||
state = 'before'
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace old direction to new
|
||||
*/
|
||||
newDirection(params) {
|
||||
if (params[0].value === 'to') {
|
||||
return params
|
||||
}
|
||||
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
||||
if (!IS_DIRECTION.test(params[0].value)) {
|
||||
return params
|
||||
}
|
||||
|
||||
params.unshift(
|
||||
{
|
||||
type: 'word',
|
||||
value: 'to'
|
||||
},
|
||||
{
|
||||
type: 'space',
|
||||
value: ' '
|
||||
}
|
||||
)
|
||||
|
||||
for (let i = 2; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
break
|
||||
}
|
||||
if (params[i].type === 'word') {
|
||||
params[i].value = this.revertDirection(params[i].value)
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize angle
|
||||
*/
|
||||
normalize(nodes, gradientName) {
|
||||
if (!nodes[0]) return nodes
|
||||
|
||||
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
|
||||
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
|
||||
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
|
||||
} else if (nodes[0].value.includes('deg')) {
|
||||
let num = parseFloat(nodes[0].value)
|
||||
num = range.wrap(0, 360, num)
|
||||
nodes[0].value = `${num}deg`
|
||||
}
|
||||
|
||||
if (
|
||||
gradientName === 'linear-gradient' ||
|
||||
gradientName === 'repeating-linear-gradient'
|
||||
) {
|
||||
let direction = nodes[0].value
|
||||
|
||||
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
|
||||
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
|
||||
if (direction === '0deg' || direction === '0') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
|
||||
} else if (direction === '90deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
|
||||
} else if (direction === '180deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
|
||||
} else if (direction === '270deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
|
||||
}
|
||||
}
|
||||
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert angle unit to deg
|
||||
*/
|
||||
normalizeUnit(str, full) {
|
||||
let num = parseFloat(str)
|
||||
let deg = (num / full) * 360
|
||||
return `${deg}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove old WebKit gradient too
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
let type
|
||||
if (this.name === 'linear-gradient') {
|
||||
type = 'linear'
|
||||
} else if (this.name === 'repeating-linear-gradient') {
|
||||
type = 'repeating-linear'
|
||||
} else if (this.name === 'repeating-radial-gradient') {
|
||||
type = 'repeating-radial'
|
||||
} else {
|
||||
type = 'radial'
|
||||
}
|
||||
let string = '-gradient'
|
||||
let regexp = utils.regexp(
|
||||
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
||||
false
|
||||
)
|
||||
|
||||
return new OldValue(this.name, prefix + this.name, string, regexp)
|
||||
} else {
|
||||
return super.old(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change direction syntax to old webkit
|
||||
*/
|
||||
oldDirection(params) {
|
||||
let div = this.cloneDiv(params[0])
|
||||
|
||||
if (params[0][0].value !== 'to') {
|
||||
return params.unshift([
|
||||
{ type: 'word', value: Gradient.oldDirections.bottom },
|
||||
div
|
||||
])
|
||||
} else {
|
||||
let words = []
|
||||
for (let node of params[0].slice(2)) {
|
||||
if (node.type === 'word') {
|
||||
words.push(node.value.toLowerCase())
|
||||
}
|
||||
}
|
||||
|
||||
words = words.join(' ')
|
||||
let old = Gradient.oldDirections[words] || words
|
||||
|
||||
params[0] = [{ type: 'word', value: old }, div]
|
||||
return params[0]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to old webkit syntax
|
||||
*/
|
||||
oldWebkit(node) {
|
||||
let { nodes } = node
|
||||
let string = parser.stringify(node.nodes)
|
||||
|
||||
if (this.name !== 'linear-gradient') {
|
||||
return false
|
||||
}
|
||||
if (nodes[0] && nodes[0].value.includes('deg')) {
|
||||
return false
|
||||
}
|
||||
if (
|
||||
string.includes('px') ||
|
||||
string.includes('-corner') ||
|
||||
string.includes('-side')
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
let params = [[]]
|
||||
for (let i of nodes) {
|
||||
params[params.length - 1].push(i)
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
params.push([])
|
||||
}
|
||||
}
|
||||
|
||||
this.oldDirection(params)
|
||||
this.colorStops(params)
|
||||
|
||||
node.nodes = []
|
||||
for (let param of params) {
|
||||
node.nodes = node.nodes.concat(param)
|
||||
}
|
||||
|
||||
node.nodes.unshift(
|
||||
{ type: 'word', value: 'linear' },
|
||||
this.cloneDiv(node.nodes)
|
||||
)
|
||||
node.value = '-webkit-gradient'
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Change degrees for webkit prefix
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
let ast = parser(string)
|
||||
for (let node of ast.nodes) {
|
||||
let gradientName = this.name // gradient name
|
||||
if (node.type === 'function' && node.value === gradientName) {
|
||||
node.nodes = this.newDirection(node.nodes)
|
||||
node.nodes = this.normalize(node.nodes, gradientName)
|
||||
if (prefix === '-webkit- old') {
|
||||
let changes = this.oldWebkit(node)
|
||||
if (!changes) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
node.nodes = this.convertDirection(node.nodes)
|
||||
node.value = prefix + node.value
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace first token
|
||||
*/
|
||||
replaceFirst(params, ...words) {
|
||||
let prefix = words.map(i => {
|
||||
if (i === ' ') {
|
||||
return { type: 'space', value: i }
|
||||
}
|
||||
return { type: 'word', value: i }
|
||||
})
|
||||
return prefix.concat(params.slice(1))
|
||||
}
|
||||
|
||||
revertDirection(word) {
|
||||
return Gradient.directions[word.toLowerCase()] || word
|
||||
}
|
||||
|
||||
/**
|
||||
* Round float and save digits under dot
|
||||
*/
|
||||
roundFloat(float, digits) {
|
||||
return parseFloat(float.toFixed(digits))
|
||||
}
|
||||
}
|
||||
|
||||
Gradient.names = [
|
||||
'linear-gradient',
|
||||
'repeating-linear-gradient',
|
||||
'radial-gradient',
|
||||
'repeating-radial-gradient'
|
||||
]
|
||||
|
||||
Gradient.directions = {
|
||||
bottom: 'top',
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
top: 'bottom' // default value
|
||||
}
|
||||
|
||||
// Direction to replace
|
||||
Gradient.oldDirections = {
|
||||
'bottom': 'left top, left bottom',
|
||||
'bottom left': 'right top, left bottom',
|
||||
'bottom right': 'left top, right bottom',
|
||||
'left': 'right top, left top',
|
||||
|
||||
'left bottom': 'right top, left bottom',
|
||||
'left top': 'right bottom, left top',
|
||||
'right': 'left top, right top',
|
||||
'right bottom': 'left top, right bottom',
|
||||
'right top': 'left bottom, right top',
|
||||
'top': 'left bottom, left top',
|
||||
'top left': 'right bottom, left top',
|
||||
'top right': 'left bottom, right top'
|
||||
}
|
||||
|
||||
module.exports = Gradient
|
||||
34
node_modules/autoprefixer/lib/hacks/grid-area.js
generated
vendored
Normal file
34
node_modules/autoprefixer/lib/hacks/grid-area.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('./grid-utils')
|
||||
|
||||
class GridArea extends Declaration {
|
||||
/**
|
||||
* Translate grid-area to separate -ms- prefixed properties
|
||||
*/
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
let values = utils.parse(decl)
|
||||
|
||||
let [rowStart, rowSpan] = utils.translate(values, 0, 2)
|
||||
let [columnStart, columnSpan] = utils.translate(values, 1, 3)
|
||||
|
||||
;[
|
||||
['grid-row', rowStart],
|
||||
['grid-row-span', rowSpan],
|
||||
['grid-column', columnStart],
|
||||
['grid-column-span', columnSpan]
|
||||
].forEach(([prop, value]) => {
|
||||
utils.insertDecl(decl, prop, value)
|
||||
})
|
||||
|
||||
utils.warnTemplateSelectorNotFound(decl, result)
|
||||
utils.warnIfGridRowColumnExists(decl, result)
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
GridArea.names = ['grid-area']
|
||||
|
||||
module.exports = GridArea
|
||||
28
node_modules/autoprefixer/lib/hacks/grid-column-align.js
generated
vendored
Normal file
28
node_modules/autoprefixer/lib/hacks/grid-column-align.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class GridColumnAlign extends Declaration {
|
||||
/**
|
||||
* Do not prefix flexbox values
|
||||
*/
|
||||
check(decl) {
|
||||
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + 'grid-column-align'
|
||||
}
|
||||
}
|
||||
|
||||
GridColumnAlign.names = ['grid-column-align']
|
||||
|
||||
module.exports = GridColumnAlign
|
||||
52
node_modules/autoprefixer/lib/hacks/grid-end.js
generated
vendored
Normal file
52
node_modules/autoprefixer/lib/hacks/grid-end.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
let Declaration = require('../declaration')
|
||||
let { isPureNumber } = require('../utils')
|
||||
|
||||
class GridEnd extends Declaration {
|
||||
/**
|
||||
* Change repeating syntax for IE
|
||||
*/
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
let clonedDecl = this.clone(decl)
|
||||
|
||||
let startProp = decl.prop.replace(/end$/, 'start')
|
||||
let spanProp = prefix + decl.prop.replace(/end$/, 'span')
|
||||
|
||||
if (decl.parent.some(i => i.prop === spanProp)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
clonedDecl.prop = spanProp
|
||||
|
||||
if (decl.value.includes('span')) {
|
||||
clonedDecl.value = decl.value.replace(/span\s/i, '')
|
||||
} else {
|
||||
let startDecl
|
||||
decl.parent.walkDecls(startProp, d => {
|
||||
startDecl = d
|
||||
})
|
||||
if (startDecl) {
|
||||
if (isPureNumber(startDecl.value)) {
|
||||
let value = Number(decl.value) - Number(startDecl.value) + ''
|
||||
clonedDecl.value = value
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
} else {
|
||||
decl.warn(
|
||||
result,
|
||||
`Can not prefix ${decl.prop} (${startProp} is not found)`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
decl.cloneBefore(clonedDecl)
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
GridEnd.names = ['grid-row-end', 'grid-column-end']
|
||||
|
||||
module.exports = GridEnd
|
||||
28
node_modules/autoprefixer/lib/hacks/grid-row-align.js
generated
vendored
Normal file
28
node_modules/autoprefixer/lib/hacks/grid-row-align.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class GridRowAlign extends Declaration {
|
||||
/**
|
||||
* Do not prefix flexbox values
|
||||
*/
|
||||
check(decl) {
|
||||
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + 'grid-row-align'
|
||||
}
|
||||
}
|
||||
|
||||
GridRowAlign.names = ['grid-row-align']
|
||||
|
||||
module.exports = GridRowAlign
|
||||
33
node_modules/autoprefixer/lib/hacks/grid-row-column.js
generated
vendored
Normal file
33
node_modules/autoprefixer/lib/hacks/grid-row-column.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('./grid-utils')
|
||||
|
||||
class GridRowColumn extends Declaration {
|
||||
/**
|
||||
* Translate grid-row / grid-column to separate -ms- prefixed properties
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
let values = utils.parse(decl)
|
||||
let [start, span] = utils.translate(values, 0, 1)
|
||||
|
||||
let hasStartValueSpan = values[0] && values[0].includes('span')
|
||||
|
||||
if (hasStartValueSpan) {
|
||||
span = values[0].join('').replace(/\D/g, '')
|
||||
}
|
||||
|
||||
;[
|
||||
[decl.prop, start],
|
||||
[`${decl.prop}-span`, span]
|
||||
].forEach(([prop, value]) => {
|
||||
utils.insertDecl(decl, prop, value)
|
||||
})
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
GridRowColumn.names = ['grid-row', 'grid-column']
|
||||
|
||||
module.exports = GridRowColumn
|
||||
125
node_modules/autoprefixer/lib/hacks/grid-rows-columns.js
generated
vendored
Normal file
125
node_modules/autoprefixer/lib/hacks/grid-rows-columns.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
let Declaration = require('../declaration')
|
||||
let Processor = require('../processor')
|
||||
let {
|
||||
autoplaceGridItems,
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
prefixTrackProp,
|
||||
prefixTrackValue
|
||||
} = require('./grid-utils')
|
||||
|
||||
class GridRowsColumns extends Declaration {
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
let { parent, prop, value } = decl
|
||||
let isRowProp = prop.includes('rows')
|
||||
let isColumnProp = prop.includes('columns')
|
||||
|
||||
let hasGridTemplate = parent.some(
|
||||
i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
|
||||
)
|
||||
|
||||
/**
|
||||
* Not to prefix rows declaration if grid-template(-areas) is present
|
||||
*/
|
||||
if (hasGridTemplate && isRowProp) {
|
||||
return false
|
||||
}
|
||||
|
||||
let processor = new Processor({ options: {} })
|
||||
let status = processor.gridStatus(parent, result)
|
||||
let gap = getGridGap(decl)
|
||||
gap = inheritGridGap(decl, gap) || gap
|
||||
|
||||
let gapValue = isRowProp ? gap.row : gap.column
|
||||
|
||||
if ((status === 'no-autoplace' || status === true) && !hasGridTemplate) {
|
||||
gapValue = null
|
||||
}
|
||||
|
||||
let prefixValue = prefixTrackValue({
|
||||
gap: gapValue,
|
||||
value
|
||||
})
|
||||
|
||||
/**
|
||||
* Insert prefixes
|
||||
*/
|
||||
decl.cloneBefore({
|
||||
prop: prefixTrackProp({ prefix, prop }),
|
||||
value: prefixValue
|
||||
})
|
||||
|
||||
let autoflow = parent.nodes.find(i => i.prop === 'grid-auto-flow')
|
||||
let autoflowValue = 'row'
|
||||
|
||||
if (autoflow && !processor.disabled(autoflow, result)) {
|
||||
autoflowValue = autoflow.value.trim()
|
||||
}
|
||||
if (status === 'autoplace') {
|
||||
/**
|
||||
* Show warning if grid-template-rows decl is not found
|
||||
*/
|
||||
let rowDecl = parent.nodes.find(i => i.prop === 'grid-template-rows')
|
||||
|
||||
if (!rowDecl && hasGridTemplate) {
|
||||
return undefined
|
||||
} else if (!rowDecl && !hasGridTemplate) {
|
||||
decl.warn(
|
||||
result,
|
||||
'Autoplacement does not work without grid-template-rows property'
|
||||
)
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Show warning if grid-template-columns decl is not found
|
||||
*/
|
||||
let columnDecl = parent.nodes.find(i => {
|
||||
return i.prop === 'grid-template-columns'
|
||||
})
|
||||
if (!columnDecl && !hasGridTemplate) {
|
||||
decl.warn(
|
||||
result,
|
||||
'Autoplacement does not work without grid-template-columns property'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoplace grid items
|
||||
*/
|
||||
if (isColumnProp && !hasGridTemplate) {
|
||||
autoplaceGridItems(decl, result, gap, autoflowValue)
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-ms-') {
|
||||
return prefixTrackProp({ prefix, prop })
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
GridRowsColumns.names = [
|
||||
'grid-template-rows',
|
||||
'grid-template-columns',
|
||||
'grid-rows',
|
||||
'grid-columns'
|
||||
]
|
||||
|
||||
module.exports = GridRowsColumns
|
||||
33
node_modules/autoprefixer/lib/hacks/grid-start.js
generated
vendored
Normal file
33
node_modules/autoprefixer/lib/hacks/grid-start.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class GridStart extends Declaration {
|
||||
/**
|
||||
* Do not add prefix for unsupported value in IE
|
||||
*/
|
||||
check(decl) {
|
||||
let value = decl.value
|
||||
return !value.includes('/') && !value.includes('span')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a final spec property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace('-start', '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let result = super.prefixed(prop, prefix)
|
||||
if (prefix === '-ms-') {
|
||||
result = result.replace('-start', '')
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
GridStart.names = ['grid-row-start', 'grid-column-start']
|
||||
|
||||
module.exports = GridStart
|
||||
84
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
Normal file
84
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
let Declaration = require('../declaration')
|
||||
let {
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
parseGridAreas,
|
||||
prefixTrackProp,
|
||||
prefixTrackValue,
|
||||
warnGridGap,
|
||||
warnMissedAreas
|
||||
} = require('./grid-utils')
|
||||
|
||||
function getGridRows(tpl) {
|
||||
return tpl
|
||||
.trim()
|
||||
.slice(1, -1)
|
||||
.split(/["']\s*["']?/g)
|
||||
}
|
||||
|
||||
class GridTemplateAreas extends Declaration {
|
||||
/**
|
||||
* Translate grid-template-areas to separate -ms- prefixed properties
|
||||
*/
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
let hasColumns = false
|
||||
let hasRows = false
|
||||
let parent = decl.parent
|
||||
let gap = getGridGap(decl)
|
||||
gap = inheritGridGap(decl, gap) || gap
|
||||
|
||||
// remove already prefixed rows
|
||||
// to prevent doubling prefixes
|
||||
parent.walkDecls(/-ms-grid-rows/, i => i.remove())
|
||||
|
||||
// add empty tracks to rows
|
||||
parent.walkDecls(/grid-template-(rows|columns)/, trackDecl => {
|
||||
if (trackDecl.prop === 'grid-template-rows') {
|
||||
hasRows = true
|
||||
let { prop, value } = trackDecl
|
||||
trackDecl.cloneBefore({
|
||||
prop: prefixTrackProp({ prefix, prop }),
|
||||
value: prefixTrackValue({ gap: gap.row, value })
|
||||
})
|
||||
} else {
|
||||
hasColumns = true
|
||||
}
|
||||
})
|
||||
|
||||
let gridRows = getGridRows(decl.value)
|
||||
|
||||
if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-rows',
|
||||
raws: {},
|
||||
value: prefixTrackValue({
|
||||
gap: gap.row,
|
||||
value: `repeat(${gridRows.length}, auto)`
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// warnings
|
||||
warnGridGap({
|
||||
decl,
|
||||
gap,
|
||||
hasColumns,
|
||||
result
|
||||
})
|
||||
|
||||
let areas = parseGridAreas({
|
||||
gap,
|
||||
rows: gridRows
|
||||
})
|
||||
|
||||
warnMissedAreas(areas, decl, result)
|
||||
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
GridTemplateAreas.names = ['grid-template-areas']
|
||||
|
||||
module.exports = GridTemplateAreas
|
||||
69
node_modules/autoprefixer/lib/hacks/grid-template.js
generated
vendored
Normal file
69
node_modules/autoprefixer/lib/hacks/grid-template.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
let Declaration = require('../declaration')
|
||||
let {
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
parseTemplate,
|
||||
warnGridGap,
|
||||
warnMissedAreas
|
||||
} = require('./grid-utils')
|
||||
|
||||
class GridTemplate extends Declaration {
|
||||
/**
|
||||
* Translate grid-template to separate -ms- prefixed properties
|
||||
*/
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
if (decl.parent.some(i => i.prop === '-ms-grid-rows')) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let gap = getGridGap(decl)
|
||||
|
||||
/**
|
||||
* we must insert inherited gap values in some cases:
|
||||
* if we are inside media query && if we have no grid-gap value
|
||||
*/
|
||||
let inheritedGap = inheritGridGap(decl, gap)
|
||||
|
||||
let { areas, columns, rows } = parseTemplate({
|
||||
decl,
|
||||
gap: inheritedGap || gap
|
||||
})
|
||||
|
||||
let hasAreas = Object.keys(areas).length > 0
|
||||
let hasRows = Boolean(rows)
|
||||
let hasColumns = Boolean(columns)
|
||||
|
||||
warnGridGap({
|
||||
decl,
|
||||
gap,
|
||||
hasColumns,
|
||||
result
|
||||
})
|
||||
|
||||
warnMissedAreas(areas, decl, result)
|
||||
|
||||
if ((hasRows && hasColumns) || hasAreas) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-rows',
|
||||
raws: {},
|
||||
value: rows
|
||||
})
|
||||
}
|
||||
|
||||
if (hasColumns) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-columns',
|
||||
raws: {},
|
||||
value: columns
|
||||
})
|
||||
}
|
||||
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
GridTemplate.names = ['grid-template']
|
||||
|
||||
module.exports = GridTemplate
|
||||
1113
node_modules/autoprefixer/lib/hacks/grid-utils.js
generated
vendored
Normal file
1113
node_modules/autoprefixer/lib/hacks/grid-utils.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
48
node_modules/autoprefixer/lib/hacks/image-rendering.js
generated
vendored
Normal file
48
node_modules/autoprefixer/lib/hacks/image-rendering.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class ImageRendering extends Declaration {
|
||||
/**
|
||||
* Add hack only for crisp-edges
|
||||
*/
|
||||
check(decl) {
|
||||
return decl.value === 'pixelated'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'image-rendering'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-ms-') {
|
||||
return '-ms-interpolation-mode'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn on old value
|
||||
*/
|
||||
process(node, result) {
|
||||
return super.process(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property and value for IE
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
if (prefix !== '-ms-') return super.set(decl, prefix)
|
||||
decl.prop = '-ms-interpolation-mode'
|
||||
decl.value = 'nearest-neighbor'
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
ImageRendering.names = ['image-rendering', 'interpolation-mode']
|
||||
|
||||
module.exports = ImageRendering
|
||||
18
node_modules/autoprefixer/lib/hacks/image-set.js
generated
vendored
Normal file
18
node_modules/autoprefixer/lib/hacks/image-set.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
let Value = require('../value')
|
||||
|
||||
class ImageSet extends Value {
|
||||
/**
|
||||
* Use non-standard name for WebKit and Firefox
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
let fixed = super.replace(string, prefix)
|
||||
if (prefix === '-webkit-') {
|
||||
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2')
|
||||
}
|
||||
return fixed
|
||||
}
|
||||
}
|
||||
|
||||
ImageSet.names = ['image-set']
|
||||
|
||||
module.exports = ImageSet
|
||||
34
node_modules/autoprefixer/lib/hacks/inline-logical.js
generated
vendored
Normal file
34
node_modules/autoprefixer/lib/hacks/inline-logical.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class InlineLogical extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
|
||||
}
|
||||
|
||||
/**
|
||||
* Use old syntax for -moz- and -webkit-
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop.replace('-inline', '')
|
||||
}
|
||||
}
|
||||
|
||||
InlineLogical.names = [
|
||||
'border-inline-start',
|
||||
'border-inline-end',
|
||||
'margin-inline-start',
|
||||
'margin-inline-end',
|
||||
'padding-inline-start',
|
||||
'padding-inline-end',
|
||||
'border-start',
|
||||
'border-end',
|
||||
'margin-start',
|
||||
'margin-end',
|
||||
'padding-start',
|
||||
'padding-end'
|
||||
]
|
||||
|
||||
module.exports = InlineLogical
|
||||
61
node_modules/autoprefixer/lib/hacks/intrinsic.js
generated
vendored
Normal file
61
node_modules/autoprefixer/lib/hacks/intrinsic.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
|
||||
function regexp(name) {
|
||||
return new RegExp(`(^|[\\s,(])(${name}($|[\\s),]))`, 'gi')
|
||||
}
|
||||
|
||||
class Intrinsic extends Value {
|
||||
add(decl, prefix) {
|
||||
if (decl.prop.includes('grid') && prefix !== '-webkit-') {
|
||||
return undefined
|
||||
}
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
|
||||
isStretch() {
|
||||
return (
|
||||
this.name === 'stretch' ||
|
||||
this.name === 'fill' ||
|
||||
this.name === 'fill-available'
|
||||
)
|
||||
}
|
||||
|
||||
old(prefix) {
|
||||
let prefixed = prefix + this.name
|
||||
if (this.isStretch()) {
|
||||
if (prefix === '-moz-') {
|
||||
prefixed = '-moz-available'
|
||||
} else if (prefix === '-webkit-') {
|
||||
prefixed = '-webkit-fill-available'
|
||||
}
|
||||
}
|
||||
return new OldValue(this.name, prefixed, prefixed, regexp(prefixed))
|
||||
}
|
||||
|
||||
regexp() {
|
||||
if (!this.regexpCache) this.regexpCache = regexp(this.name)
|
||||
return this.regexpCache
|
||||
}
|
||||
|
||||
replace(string, prefix) {
|
||||
if (prefix === '-moz-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-moz-available$3')
|
||||
}
|
||||
if (prefix === '-webkit-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-webkit-fill-available$3')
|
||||
}
|
||||
return super.replace(string, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Intrinsic.names = [
|
||||
'max-content',
|
||||
'min-content',
|
||||
'fit-content',
|
||||
'fill',
|
||||
'fill-available',
|
||||
'stretch'
|
||||
]
|
||||
|
||||
module.exports = Intrinsic
|
||||
54
node_modules/autoprefixer/lib/hacks/justify-content.js
generated
vendored
Normal file
54
node_modules/autoprefixer/lib/hacks/justify-content.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class JustifyContent extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return prefix + 'box-pack'
|
||||
}
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-pack'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2009 and 2012 specs
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2009 || spec === 2012) {
|
||||
let value = JustifyContent.oldValues[decl.value] || decl.value
|
||||
decl.value = value
|
||||
if (spec !== 2009 || value !== 'distribute') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
} else if (spec === 'final') {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
JustifyContent.names = ['justify-content', 'flex-pack', 'box-pack']
|
||||
|
||||
JustifyContent.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start',
|
||||
'space-around': 'distribute',
|
||||
'space-between': 'justify'
|
||||
}
|
||||
|
||||
module.exports = JustifyContent
|
||||
38
node_modules/autoprefixer/lib/hacks/mask-border.js
generated
vendored
Normal file
38
node_modules/autoprefixer/lib/hacks/mask-border.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class MaskBorder extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return this.name.replace('box-image', 'border')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return flex property for 2012 spec
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let result = super.prefixed(prop, prefix)
|
||||
if (prefix === '-webkit-') {
|
||||
result = result.replace('border', 'box-image')
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
MaskBorder.names = [
|
||||
'mask-border',
|
||||
'mask-border-source',
|
||||
'mask-border-slice',
|
||||
'mask-border-width',
|
||||
'mask-border-outset',
|
||||
'mask-border-repeat',
|
||||
'mask-box-image',
|
||||
'mask-box-image-source',
|
||||
'mask-box-image-slice',
|
||||
'mask-box-image-width',
|
||||
'mask-box-image-outset',
|
||||
'mask-box-image-repeat'
|
||||
]
|
||||
|
||||
module.exports = MaskBorder
|
||||
88
node_modules/autoprefixer/lib/hacks/mask-composite.js
generated
vendored
Normal file
88
node_modules/autoprefixer/lib/hacks/mask-composite.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class MaskComposite extends Declaration {
|
||||
/**
|
||||
* Prefix mask-composite for webkit
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
let isCompositeProp = decl.prop === 'mask-composite'
|
||||
|
||||
let compositeValues
|
||||
|
||||
if (isCompositeProp) {
|
||||
compositeValues = decl.value.split(',')
|
||||
} else {
|
||||
compositeValues = decl.value.match(MaskComposite.regexp) || []
|
||||
}
|
||||
|
||||
compositeValues = compositeValues.map(el => el.trim()).filter(el => el)
|
||||
let hasCompositeValues = compositeValues.length
|
||||
|
||||
let compositeDecl
|
||||
|
||||
if (hasCompositeValues) {
|
||||
compositeDecl = this.clone(decl)
|
||||
compositeDecl.value = compositeValues
|
||||
.map(value => MaskComposite.oldValues[value] || value)
|
||||
.join(', ')
|
||||
|
||||
if (compositeValues.includes('intersect')) {
|
||||
compositeDecl.value += ', xor'
|
||||
}
|
||||
|
||||
compositeDecl.prop = prefix + 'mask-composite'
|
||||
}
|
||||
|
||||
if (isCompositeProp) {
|
||||
if (!hasCompositeValues) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (this.needCascade(decl)) {
|
||||
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
|
||||
return decl.parent.insertBefore(decl, compositeDecl)
|
||||
}
|
||||
|
||||
let cloned = this.clone(decl)
|
||||
cloned.prop = prefix + cloned.prop
|
||||
|
||||
if (hasCompositeValues) {
|
||||
cloned.value = cloned.value.replace(MaskComposite.regexp, '')
|
||||
}
|
||||
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
|
||||
decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
if (!hasCompositeValues) {
|
||||
return decl
|
||||
}
|
||||
|
||||
if (this.needCascade(decl)) {
|
||||
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, compositeDecl)
|
||||
}
|
||||
}
|
||||
|
||||
MaskComposite.names = ['mask', 'mask-composite']
|
||||
|
||||
MaskComposite.oldValues = {
|
||||
add: 'source-over',
|
||||
exclude: 'xor',
|
||||
intersect: 'source-in',
|
||||
subtract: 'source-out'
|
||||
}
|
||||
|
||||
MaskComposite.regexp = new RegExp(
|
||||
`\\s+(${Object.keys(MaskComposite.oldValues).join(
|
||||
'|'
|
||||
)})\\b(?!\\))\\s*(?=[,])`,
|
||||
'ig'
|
||||
)
|
||||
|
||||
module.exports = MaskComposite
|
||||
42
node_modules/autoprefixer/lib/hacks/order.js
generated
vendored
Normal file
42
node_modules/autoprefixer/lib/hacks/order.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class Order extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'order'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec === 2009) {
|
||||
return prefix + 'box-ordinal-group'
|
||||
}
|
||||
if (spec === 2012) {
|
||||
return prefix + 'flex-order'
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix value for 2009 spec
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let spec = flexSpec(prefix)[0]
|
||||
if (spec === 2009 && /\d/.test(decl.value)) {
|
||||
decl.value = (parseInt(decl.value) + 1).toString()
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Order.names = ['order', 'flex-order', 'box-ordinal-group']
|
||||
|
||||
module.exports = Order
|
||||
33
node_modules/autoprefixer/lib/hacks/overscroll-behavior.js
generated
vendored
Normal file
33
node_modules/autoprefixer/lib/hacks/overscroll-behavior.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class OverscrollBehavior extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'overscroll-behavior'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + 'scroll-chaining'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for IE
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
if (decl.value === 'auto') {
|
||||
decl.value = 'chained'
|
||||
} else if (decl.value === 'none' || decl.value === 'contain') {
|
||||
decl.value = 'none'
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
OverscrollBehavior.names = ['overscroll-behavior', 'scroll-chaining']
|
||||
|
||||
module.exports = OverscrollBehavior
|
||||
34
node_modules/autoprefixer/lib/hacks/pixelated.js
generated
vendored
Normal file
34
node_modules/autoprefixer/lib/hacks/pixelated.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
|
||||
class Pixelated extends Value {
|
||||
/**
|
||||
* Different name for WebKit and Firefox
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return new OldValue(this.name, '-webkit-optimize-contrast')
|
||||
}
|
||||
if (prefix === '-moz-') {
|
||||
return new OldValue(this.name, '-moz-crisp-edges')
|
||||
}
|
||||
return super.old(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use non-standard name for WebKit and Firefox
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return string.replace(this.regexp(), '$1-webkit-optimize-contrast')
|
||||
}
|
||||
if (prefix === '-moz-') {
|
||||
return string.replace(this.regexp(), '$1-moz-crisp-edges')
|
||||
}
|
||||
return super.replace(string, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Pixelated.names = ['pixelated']
|
||||
|
||||
module.exports = Pixelated
|
||||
32
node_modules/autoprefixer/lib/hacks/place-self.js
generated
vendored
Normal file
32
node_modules/autoprefixer/lib/hacks/place-self.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
let Declaration = require('../declaration')
|
||||
let utils = require('./grid-utils')
|
||||
|
||||
class PlaceSelf extends Declaration {
|
||||
/**
|
||||
* Translate place-self to separate -ms- prefixed properties
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
// prevent doubling of prefixes
|
||||
if (decl.parent.some(i => i.prop === '-ms-grid-row-align')) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let [[first, second]] = utils.parse(decl)
|
||||
|
||||
if (second) {
|
||||
utils.insertDecl(decl, 'grid-row-align', first)
|
||||
utils.insertDecl(decl, 'grid-column-align', second)
|
||||
} else {
|
||||
utils.insertDecl(decl, 'grid-row-align', first)
|
||||
utils.insertDecl(decl, 'grid-column-align', first)
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
PlaceSelf.names = ['place-self']
|
||||
|
||||
module.exports = PlaceSelf
|
||||
19
node_modules/autoprefixer/lib/hacks/placeholder-shown.js
generated
vendored
Normal file
19
node_modules/autoprefixer/lib/hacks/placeholder-shown.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
let Selector = require('../selector')
|
||||
|
||||
class PlaceholderShown extends Selector {
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-moz-') {
|
||||
return ':-moz-placeholder'
|
||||
} else if (prefix === '-ms-') {
|
||||
return ':-ms-input-placeholder'
|
||||
}
|
||||
return `:${prefix}placeholder-shown`
|
||||
}
|
||||
}
|
||||
|
||||
PlaceholderShown.names = [':placeholder-shown']
|
||||
|
||||
module.exports = PlaceholderShown
|
||||
33
node_modules/autoprefixer/lib/hacks/placeholder.js
generated
vendored
Normal file
33
node_modules/autoprefixer/lib/hacks/placeholder.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
let Selector = require('../selector')
|
||||
|
||||
class Placeholder extends Selector {
|
||||
/**
|
||||
* Add old mozilla to possible prefixes
|
||||
*/
|
||||
possible() {
|
||||
return super.possible().concat(['-moz- old', '-ms- old'])
|
||||
}
|
||||
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return '::-webkit-input-placeholder'
|
||||
}
|
||||
if (prefix === '-ms-') {
|
||||
return '::-ms-input-placeholder'
|
||||
}
|
||||
if (prefix === '-ms- old') {
|
||||
return ':-ms-input-placeholder'
|
||||
}
|
||||
if (prefix === '-moz- old') {
|
||||
return ':-moz-placeholder'
|
||||
}
|
||||
return `::${prefix}placeholder`
|
||||
}
|
||||
}
|
||||
|
||||
Placeholder.names = ['::placeholder']
|
||||
|
||||
module.exports = Placeholder
|
||||
25
node_modules/autoprefixer/lib/hacks/print-color-adjust.js
generated
vendored
Normal file
25
node_modules/autoprefixer/lib/hacks/print-color-adjust.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class PrintColorAdjust extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'print-color-adjust'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for WebKit-based browsers
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-moz-') {
|
||||
return 'color-adjust'
|
||||
} else {
|
||||
return prefix + 'print-color-adjust'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PrintColorAdjust.names = ['print-color-adjust', 'color-adjust']
|
||||
|
||||
module.exports = PrintColorAdjust
|
||||
23
node_modules/autoprefixer/lib/hacks/text-decoration-skip-ink.js
generated
vendored
Normal file
23
node_modules/autoprefixer/lib/hacks/text-decoration-skip-ink.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TextDecorationSkipInk extends Declaration {
|
||||
/**
|
||||
* Change prefix for ink value
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
if (decl.prop === 'text-decoration-skip-ink' && decl.value === 'auto') {
|
||||
decl.prop = prefix + 'text-decoration-skip'
|
||||
decl.value = 'ink'
|
||||
return decl
|
||||
} else {
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextDecorationSkipInk.names = [
|
||||
'text-decoration-skip-ink',
|
||||
'text-decoration-skip'
|
||||
]
|
||||
|
||||
module.exports = TextDecorationSkipInk
|
||||
25
node_modules/autoprefixer/lib/hacks/text-decoration.js
generated
vendored
Normal file
25
node_modules/autoprefixer/lib/hacks/text-decoration.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
const BASIC = [
|
||||
'none',
|
||||
'underline',
|
||||
'overline',
|
||||
'line-through',
|
||||
'blink',
|
||||
'inherit',
|
||||
'initial',
|
||||
'unset'
|
||||
]
|
||||
|
||||
class TextDecoration extends Declaration {
|
||||
/**
|
||||
* Do not add prefixes for basic values.
|
||||
*/
|
||||
check(decl) {
|
||||
return decl.value.split(/\s+/).some(i => !BASIC.includes(i))
|
||||
}
|
||||
}
|
||||
|
||||
TextDecoration.names = ['text-decoration']
|
||||
|
||||
module.exports = TextDecoration
|
||||
14
node_modules/autoprefixer/lib/hacks/text-emphasis-position.js
generated
vendored
Normal file
14
node_modules/autoprefixer/lib/hacks/text-emphasis-position.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TextEmphasisPosition extends Declaration {
|
||||
set(decl, prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '')
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
TextEmphasisPosition.names = ['text-emphasis-position']
|
||||
|
||||
module.exports = TextEmphasisPosition
|
||||
79
node_modules/autoprefixer/lib/hacks/transform-decl.js
generated
vendored
Normal file
79
node_modules/autoprefixer/lib/hacks/transform-decl.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TransformDecl extends Declaration {
|
||||
/**
|
||||
* Is transform contain 3D commands
|
||||
*/
|
||||
contain3d(decl) {
|
||||
if (decl.prop === 'transform-origin') {
|
||||
return false
|
||||
}
|
||||
|
||||
for (let func of TransformDecl.functions3d) {
|
||||
if (decl.value.includes(`${func}(`)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't add prefix for IE in keyframes
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (prefix === '-ms-') {
|
||||
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
} else if (prefix === '-o-') {
|
||||
if (!this.contain3d(decl)) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
} else {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively check all parents for @keyframes
|
||||
*/
|
||||
keyframeParents(decl) {
|
||||
let { parent } = decl
|
||||
while (parent) {
|
||||
if (parent.type === 'atrule' && parent.name === 'keyframes') {
|
||||
return true
|
||||
}
|
||||
;({ parent } = parent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace rotateZ to rotate for IE 9
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl = super.set(decl, prefix)
|
||||
if (prefix === '-ms-') {
|
||||
decl.value = decl.value.replace(/rotatez/gi, 'rotate')
|
||||
}
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
TransformDecl.names = ['transform', 'transform-origin']
|
||||
|
||||
TransformDecl.functions3d = [
|
||||
'matrix3d',
|
||||
'translate3d',
|
||||
'translateZ',
|
||||
'scale3d',
|
||||
'scaleZ',
|
||||
'rotate3d',
|
||||
'rotateX',
|
||||
'rotateY',
|
||||
'perspective'
|
||||
]
|
||||
|
||||
module.exports = TransformDecl
|
||||
33
node_modules/autoprefixer/lib/hacks/user-select.js
generated
vendored
Normal file
33
node_modules/autoprefixer/lib/hacks/user-select.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class UserSelect extends Declaration {
|
||||
/**
|
||||
* Avoid prefixing all in IE
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.value === 'all' && prefix === '-ms-') {
|
||||
return undefined
|
||||
} else if (
|
||||
decl.value === 'contain' &&
|
||||
(prefix === '-moz-' || prefix === '-webkit-')
|
||||
) {
|
||||
return undefined
|
||||
} else {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change prefixed value for IE
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
if (prefix === '-ms-' && decl.value === 'contain') {
|
||||
decl.value = 'element'
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
UserSelect.names = ['user-select']
|
||||
|
||||
module.exports = UserSelect
|
||||
42
node_modules/autoprefixer/lib/hacks/writing-mode.js
generated
vendored
Normal file
42
node_modules/autoprefixer/lib/hacks/writing-mode.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class WritingMode extends Declaration {
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (prefix === '-ms-') {
|
||||
let cloned = this.set(this.clone(decl), prefix)
|
||||
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
let direction = 'ltr'
|
||||
|
||||
decl.parent.nodes.forEach(i => {
|
||||
if (i.prop === 'direction') {
|
||||
if (i.value === 'rtl' || i.value === 'ltr') direction = i.value
|
||||
}
|
||||
})
|
||||
|
||||
cloned.value = WritingMode.msValues[direction][decl.value] || decl.value
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
}
|
||||
|
||||
WritingMode.names = ['writing-mode']
|
||||
|
||||
WritingMode.msValues = {
|
||||
ltr: {
|
||||
'horizontal-tb': 'lr-tb',
|
||||
'vertical-lr': 'tb-lr',
|
||||
'vertical-rl': 'tb-rl'
|
||||
},
|
||||
rtl: {
|
||||
'horizontal-tb': 'rl-tb',
|
||||
'vertical-lr': 'bt-lr',
|
||||
'vertical-rl': 'bt-rl'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WritingMode
|
||||
123
node_modules/autoprefixer/lib/info.js
generated
vendored
Normal file
123
node_modules/autoprefixer/lib/info.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
let browserslist = require('browserslist')
|
||||
|
||||
function capitalize(str) {
|
||||
return str.slice(0, 1).toUpperCase() + str.slice(1)
|
||||
}
|
||||
|
||||
const NAMES = {
|
||||
and_chr: 'Chrome for Android',
|
||||
and_ff: 'Firefox for Android',
|
||||
and_qq: 'QQ Browser',
|
||||
and_uc: 'UC for Android',
|
||||
baidu: 'Baidu Browser',
|
||||
ie: 'IE',
|
||||
ie_mob: 'IE Mobile',
|
||||
ios_saf: 'iOS Safari',
|
||||
kaios: 'KaiOS Browser',
|
||||
op_mini: 'Opera Mini',
|
||||
op_mob: 'Opera Mobile',
|
||||
samsung: 'Samsung Internet'
|
||||
}
|
||||
|
||||
function prefix(name, prefixes, note) {
|
||||
let out = ` ${name}`
|
||||
if (note) out += ' *'
|
||||
out += ': '
|
||||
out += prefixes.map(i => i.replace(/^-(.*)-$/g, '$1')).join(', ')
|
||||
out += '\n'
|
||||
return out
|
||||
}
|
||||
|
||||
module.exports = function (prefixes) {
|
||||
if (prefixes.browsers.selected.length === 0) {
|
||||
return 'No browsers selected'
|
||||
}
|
||||
|
||||
let versions = {}
|
||||
for (let browser of prefixes.browsers.selected) {
|
||||
let parts = browser.split(' ')
|
||||
let name = parts[0]
|
||||
let version = parts[1]
|
||||
|
||||
name = NAMES[name] || capitalize(name)
|
||||
if (versions[name]) {
|
||||
versions[name].push(version)
|
||||
} else {
|
||||
versions[name] = [version]
|
||||
}
|
||||
}
|
||||
|
||||
let out = 'Browsers:\n'
|
||||
for (let browser in versions) {
|
||||
let list = versions[browser]
|
||||
list = list.sort((a, b) => parseFloat(b) - parseFloat(a))
|
||||
out += ` ${browser}: ${list.join(', ')}\n`
|
||||
}
|
||||
|
||||
let coverage = browserslist.coverage(prefixes.browsers.selected)
|
||||
let round = Math.round(coverage * 100) / 100.0
|
||||
out += `\nThese browsers account for ${round}% of all users globally\n`
|
||||
|
||||
let atrules = []
|
||||
for (let name in prefixes.add) {
|
||||
let data = prefixes.add[name]
|
||||
if (name[0] === '@' && data.prefixes) {
|
||||
atrules.push(prefix(name, data.prefixes))
|
||||
}
|
||||
}
|
||||
if (atrules.length > 0) {
|
||||
out += `\nAt-Rules:\n${atrules.sort().join('')}`
|
||||
}
|
||||
|
||||
let selectors = []
|
||||
for (let selector of prefixes.add.selectors) {
|
||||
if (selector.prefixes) {
|
||||
selectors.push(prefix(selector.name, selector.prefixes))
|
||||
}
|
||||
}
|
||||
if (selectors.length > 0) {
|
||||
out += `\nSelectors:\n${selectors.sort().join('')}`
|
||||
}
|
||||
|
||||
let values = []
|
||||
let props = []
|
||||
let hadGrid = false
|
||||
for (let name in prefixes.add) {
|
||||
let data = prefixes.add[name]
|
||||
if (name[0] !== '@' && data.prefixes) {
|
||||
let grid = name.indexOf('grid-') === 0
|
||||
if (grid) hadGrid = true
|
||||
props.push(prefix(name, data.prefixes, grid))
|
||||
}
|
||||
|
||||
if (!Array.isArray(data.values)) {
|
||||
continue
|
||||
}
|
||||
for (let value of data.values) {
|
||||
let grid = value.name.includes('grid')
|
||||
if (grid) hadGrid = true
|
||||
let string = prefix(value.name, value.prefixes, grid)
|
||||
if (!values.includes(string)) {
|
||||
values.push(string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (props.length > 0) {
|
||||
out += `\nProperties:\n${props.sort().join('')}`
|
||||
}
|
||||
if (values.length > 0) {
|
||||
out += `\nValues:\n${values.sort().join('')}`
|
||||
}
|
||||
if (hadGrid) {
|
||||
out += '\n* - Prefixes will be added only on grid: true option.\n'
|
||||
}
|
||||
|
||||
if (!atrules.length && !selectors.length && !props.length && !values.length) {
|
||||
out +=
|
||||
"\nAwesome! Your browsers don't require any vendor prefixes." +
|
||||
'\nNow you can remove Autoprefixer from build steps.'
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
67
node_modules/autoprefixer/lib/old-selector.js
generated
vendored
Normal file
67
node_modules/autoprefixer/lib/old-selector.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
class OldSelector {
|
||||
constructor(selector, prefix) {
|
||||
this.prefix = prefix
|
||||
this.prefixed = selector.prefixed(this.prefix)
|
||||
this.regexp = selector.regexp(this.prefix)
|
||||
|
||||
this.prefixeds = selector
|
||||
.possible()
|
||||
.map(x => [selector.prefixed(x), selector.regexp(x)])
|
||||
|
||||
this.unprefixed = selector.name
|
||||
this.nameRegexp = selector.regexp()
|
||||
}
|
||||
|
||||
/**
|
||||
* Does rule contain an unnecessary prefixed selector
|
||||
*/
|
||||
check(rule) {
|
||||
if (!rule.selector.includes(this.prefixed)) {
|
||||
return false
|
||||
}
|
||||
if (!rule.selector.match(this.regexp)) {
|
||||
return false
|
||||
}
|
||||
if (this.isHack(rule)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Is rule a hack without unprefixed version bottom
|
||||
*/
|
||||
isHack(rule) {
|
||||
let index = rule.parent.index(rule) + 1
|
||||
let rules = rule.parent.nodes
|
||||
|
||||
while (index < rules.length) {
|
||||
let before = rules[index].selector
|
||||
if (!before) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (before.includes(this.unprefixed) && before.match(this.nameRegexp)) {
|
||||
return false
|
||||
}
|
||||
|
||||
let some = false
|
||||
for (let [string, regexp] of this.prefixeds) {
|
||||
if (before.includes(string) && before.match(regexp)) {
|
||||
some = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!some) {
|
||||
return true
|
||||
}
|
||||
|
||||
index += 1
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OldSelector
|
||||
22
node_modules/autoprefixer/lib/old-value.js
generated
vendored
Normal file
22
node_modules/autoprefixer/lib/old-value.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
let utils = require('./utils')
|
||||
|
||||
class OldValue {
|
||||
constructor(unprefixed, prefixed, string, regexp) {
|
||||
this.unprefixed = unprefixed
|
||||
this.prefixed = prefixed
|
||||
this.string = string || prefixed
|
||||
this.regexp = regexp || utils.regexp(prefixed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check, that value contain old value
|
||||
*/
|
||||
check(value) {
|
||||
if (value.includes(this.string)) {
|
||||
return !!value.match(this.regexp)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OldValue
|
||||
144
node_modules/autoprefixer/lib/prefixer.js
generated
vendored
Normal file
144
node_modules/autoprefixer/lib/prefixer.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
let vendor = require('./vendor')
|
||||
|
||||
/**
|
||||
* Recursively clone objects
|
||||
*/
|
||||
function clone(obj, parent) {
|
||||
let cloned = new obj.constructor()
|
||||
|
||||
for (let i of Object.keys(obj || {})) {
|
||||
let value = obj[i]
|
||||
if (i === 'parent' && typeof value === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent
|
||||
}
|
||||
} else if (i === 'source' || i === null) {
|
||||
cloned[i] = value
|
||||
} else if (Array.isArray(value)) {
|
||||
cloned[i] = value.map(x => clone(x, cloned))
|
||||
} else if (
|
||||
i !== '_autoprefixerPrefix' &&
|
||||
i !== '_autoprefixerValues' &&
|
||||
i !== 'proxyCache'
|
||||
) {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
value = clone(value, cloned)
|
||||
}
|
||||
cloned[i] = value
|
||||
}
|
||||
}
|
||||
|
||||
return cloned
|
||||
}
|
||||
|
||||
class Prefixer {
|
||||
constructor(name, prefixes, all) {
|
||||
this.prefixes = prefixes
|
||||
this.name = name
|
||||
this.all = all
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone node and clean autprefixer custom caches
|
||||
*/
|
||||
static clone(node, overrides) {
|
||||
let cloned = clone(node)
|
||||
for (let name in overrides) {
|
||||
cloned[name] = overrides[name]
|
||||
}
|
||||
return cloned
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hack to selected names
|
||||
*/
|
||||
static hack(klass) {
|
||||
if (!this.hacks) {
|
||||
this.hacks = {}
|
||||
}
|
||||
return klass.names.map(name => {
|
||||
this.hacks[name] = klass
|
||||
return this.hacks[name]
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Load hacks for some names
|
||||
*/
|
||||
static load(name, prefixes, all) {
|
||||
let Klass = this.hacks && this.hacks[name]
|
||||
if (Klass) {
|
||||
return new Klass(name, prefixes, all)
|
||||
} else {
|
||||
return new this(name, prefixes, all)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for Prefixer.clone
|
||||
*/
|
||||
clone(node, overrides) {
|
||||
return Prefixer.clone(node, overrides)
|
||||
}
|
||||
|
||||
/**
|
||||
* Find prefix in node parents
|
||||
*/
|
||||
parentPrefix(node) {
|
||||
let prefix
|
||||
|
||||
if (typeof node._autoprefixerPrefix !== 'undefined') {
|
||||
prefix = node._autoprefixerPrefix
|
||||
} else if (node.type === 'decl' && node.prop[0] === '-') {
|
||||
prefix = vendor.prefix(node.prop)
|
||||
} else if (node.type === 'root') {
|
||||
prefix = false
|
||||
} else if (
|
||||
node.type === 'rule' &&
|
||||
node.selector.includes(':-') &&
|
||||
/:(-\w+-)/.test(node.selector)
|
||||
) {
|
||||
prefix = node.selector.match(/:(-\w+-)/)[1]
|
||||
} else if (node.type === 'atrule' && node.name[0] === '-') {
|
||||
prefix = vendor.prefix(node.name)
|
||||
} else {
|
||||
prefix = this.parentPrefix(node.parent)
|
||||
}
|
||||
|
||||
if (!Browsers.prefixes().includes(prefix)) {
|
||||
prefix = false
|
||||
}
|
||||
|
||||
node._autoprefixerPrefix = prefix
|
||||
|
||||
return node._autoprefixerPrefix
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone node with prefixes
|
||||
*/
|
||||
process(node, result) {
|
||||
if (!this.check(node)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let parent = this.parentPrefix(node)
|
||||
|
||||
let prefixes = this.prefixes.filter(
|
||||
prefix => !parent || parent === utils.removeNote(prefix)
|
||||
)
|
||||
|
||||
let added = []
|
||||
for (let prefix of prefixes) {
|
||||
if (this.add(node, prefix, added.concat([prefix]), result)) {
|
||||
added.push(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
return added
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prefixer
|
||||
428
node_modules/autoprefixer/lib/prefixes.js
generated
vendored
Normal file
428
node_modules/autoprefixer/lib/prefixes.js
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
let AtRule = require('./at-rule')
|
||||
let Browsers = require('./browsers')
|
||||
let Declaration = require('./declaration')
|
||||
let hackAlignContent = require('./hacks/align-content')
|
||||
let hackAlignItems = require('./hacks/align-items')
|
||||
let hackAlignSelf = require('./hacks/align-self')
|
||||
let hackAnimation = require('./hacks/animation')
|
||||
let hackAppearance = require('./hacks/appearance')
|
||||
let hackAutofill = require('./hacks/autofill')
|
||||
let hackBackdropFilter = require('./hacks/backdrop-filter')
|
||||
let hackBackgroundClip = require('./hacks/background-clip')
|
||||
let hackBackgroundSize = require('./hacks/background-size')
|
||||
let hackBlockLogical = require('./hacks/block-logical')
|
||||
let hackBorderImage = require('./hacks/border-image')
|
||||
let hackBorderRadius = require('./hacks/border-radius')
|
||||
let hackBreakProps = require('./hacks/break-props')
|
||||
let hackCrossFade = require('./hacks/cross-fade')
|
||||
let hackDisplayFlex = require('./hacks/display-flex')
|
||||
let hackDisplayGrid = require('./hacks/display-grid')
|
||||
let hackFileSelectorButton = require('./hacks/file-selector-button')
|
||||
let hackFilter = require('./hacks/filter')
|
||||
let hackFilterValue = require('./hacks/filter-value')
|
||||
let hackFlex = require('./hacks/flex')
|
||||
let hackFlexBasis = require('./hacks/flex-basis')
|
||||
let hackFlexDirection = require('./hacks/flex-direction')
|
||||
let hackFlexFlow = require('./hacks/flex-flow')
|
||||
let hackFlexGrow = require('./hacks/flex-grow')
|
||||
let hackFlexShrink = require('./hacks/flex-shrink')
|
||||
let hackFlexWrap = require('./hacks/flex-wrap')
|
||||
let hackFullscreen = require('./hacks/fullscreen')
|
||||
let hackGradient = require('./hacks/gradient')
|
||||
let hackGridArea = require('./hacks/grid-area')
|
||||
let hackGridColumnAlign = require('./hacks/grid-column-align')
|
||||
let hackGridEnd = require('./hacks/grid-end')
|
||||
let hackGridRowAlign = require('./hacks/grid-row-align')
|
||||
let hackGridRowColumn = require('./hacks/grid-row-column')
|
||||
let hackGridRowsColumns = require('./hacks/grid-rows-columns')
|
||||
let hackGridStart = require('./hacks/grid-start')
|
||||
let hackGridTemplate = require('./hacks/grid-template')
|
||||
let hackGridTemplateAreas = require('./hacks/grid-template-areas')
|
||||
let hackImageRendering = require('./hacks/image-rendering')
|
||||
let hackImageSet = require('./hacks/image-set')
|
||||
let hackInlineLogical = require('./hacks/inline-logical')
|
||||
let hackIntrinsic = require('./hacks/intrinsic')
|
||||
let hackJustifyContent = require('./hacks/justify-content')
|
||||
let hackMaskBorder = require('./hacks/mask-border')
|
||||
let hackMaskComposite = require('./hacks/mask-composite')
|
||||
let hackOrder = require('./hacks/order')
|
||||
let hackOverscrollBehavior = require('./hacks/overscroll-behavior')
|
||||
let hackPixelated = require('./hacks/pixelated')
|
||||
let hackPlaceSelf = require('./hacks/place-self')
|
||||
let hackPlaceholder = require('./hacks/placeholder')
|
||||
let hackPlaceholderShown = require('./hacks/placeholder-shown')
|
||||
let hackPrintColorAdjust = require('./hacks/print-color-adjust')
|
||||
let hackTextDecoration = require('./hacks/text-decoration')
|
||||
let hackTextDecorationSkipInk = require('./hacks/text-decoration-skip-ink')
|
||||
let hackTextEmphasisPosition = require('./hacks/text-emphasis-position')
|
||||
let hackTransformDecl = require('./hacks/transform-decl')
|
||||
let hackUserSelect = require('./hacks/user-select')
|
||||
let hackWritingMode = require('./hacks/writing-mode')
|
||||
let Processor = require('./processor')
|
||||
let Resolution = require('./resolution')
|
||||
let Selector = require('./selector')
|
||||
let Supports = require('./supports')
|
||||
let Transition = require('./transition')
|
||||
let utils = require('./utils')
|
||||
let Value = require('./value')
|
||||
let vendor = require('./vendor')
|
||||
|
||||
Selector.hack(hackAutofill)
|
||||
Selector.hack(hackFullscreen)
|
||||
Selector.hack(hackPlaceholder)
|
||||
Selector.hack(hackPlaceholderShown)
|
||||
Selector.hack(hackFileSelectorButton)
|
||||
Declaration.hack(hackFlex)
|
||||
Declaration.hack(hackOrder)
|
||||
Declaration.hack(hackFilter)
|
||||
Declaration.hack(hackGridEnd)
|
||||
Declaration.hack(hackAnimation)
|
||||
Declaration.hack(hackFlexFlow)
|
||||
Declaration.hack(hackFlexGrow)
|
||||
Declaration.hack(hackFlexWrap)
|
||||
Declaration.hack(hackGridArea)
|
||||
Declaration.hack(hackPlaceSelf)
|
||||
Declaration.hack(hackGridStart)
|
||||
Declaration.hack(hackAlignSelf)
|
||||
Declaration.hack(hackAppearance)
|
||||
Declaration.hack(hackFlexBasis)
|
||||
Declaration.hack(hackMaskBorder)
|
||||
Declaration.hack(hackMaskComposite)
|
||||
Declaration.hack(hackAlignItems)
|
||||
Declaration.hack(hackUserSelect)
|
||||
Declaration.hack(hackFlexShrink)
|
||||
Declaration.hack(hackBreakProps)
|
||||
Declaration.hack(hackWritingMode)
|
||||
Declaration.hack(hackBorderImage)
|
||||
Declaration.hack(hackAlignContent)
|
||||
Declaration.hack(hackBorderRadius)
|
||||
Declaration.hack(hackBlockLogical)
|
||||
Declaration.hack(hackGridTemplate)
|
||||
Declaration.hack(hackInlineLogical)
|
||||
Declaration.hack(hackGridRowAlign)
|
||||
Declaration.hack(hackTransformDecl)
|
||||
Declaration.hack(hackFlexDirection)
|
||||
Declaration.hack(hackImageRendering)
|
||||
Declaration.hack(hackBackdropFilter)
|
||||
Declaration.hack(hackBackgroundClip)
|
||||
Declaration.hack(hackTextDecoration)
|
||||
Declaration.hack(hackJustifyContent)
|
||||
Declaration.hack(hackBackgroundSize)
|
||||
Declaration.hack(hackGridRowColumn)
|
||||
Declaration.hack(hackGridRowsColumns)
|
||||
Declaration.hack(hackGridColumnAlign)
|
||||
Declaration.hack(hackOverscrollBehavior)
|
||||
Declaration.hack(hackGridTemplateAreas)
|
||||
Declaration.hack(hackPrintColorAdjust)
|
||||
Declaration.hack(hackTextEmphasisPosition)
|
||||
Declaration.hack(hackTextDecorationSkipInk)
|
||||
Value.hack(hackGradient)
|
||||
Value.hack(hackIntrinsic)
|
||||
Value.hack(hackPixelated)
|
||||
Value.hack(hackImageSet)
|
||||
Value.hack(hackCrossFade)
|
||||
Value.hack(hackDisplayFlex)
|
||||
Value.hack(hackDisplayGrid)
|
||||
Value.hack(hackFilterValue)
|
||||
|
||||
let declsCache = new Map()
|
||||
|
||||
class Prefixes {
|
||||
constructor(data, browsers, options = {}) {
|
||||
this.data = data
|
||||
this.browsers = browsers
|
||||
this.options = options
|
||||
;[this.add, this.remove] = this.preprocess(this.select(this.data))
|
||||
this.transition = new Transition(this)
|
||||
this.processor = new Processor(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clone instance to remove all prefixes
|
||||
*/
|
||||
cleaner() {
|
||||
if (this.cleanerCache) {
|
||||
return this.cleanerCache
|
||||
}
|
||||
|
||||
if (this.browsers.selected.length) {
|
||||
let empty = new Browsers(this.browsers.data, [])
|
||||
this.cleanerCache = new Prefixes(this.data, empty, this.options)
|
||||
} else {
|
||||
return this
|
||||
}
|
||||
|
||||
return this.cleanerCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Declaration loader with caching
|
||||
*/
|
||||
decl(prop) {
|
||||
if (!declsCache.has(prop)) {
|
||||
declsCache.set(prop, Declaration.load(prop))
|
||||
}
|
||||
|
||||
return declsCache.get(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Group declaration by unprefixed property to check them
|
||||
*/
|
||||
group(decl) {
|
||||
let rule = decl.parent
|
||||
let index = rule.index(decl)
|
||||
let { length } = rule.nodes
|
||||
let unprefixed = this.unprefixed(decl.prop)
|
||||
|
||||
let checker = (step, callback) => {
|
||||
index += step
|
||||
while (index >= 0 && index < length) {
|
||||
let other = rule.nodes[index]
|
||||
if (other.type === 'decl') {
|
||||
if (step === -1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (this.unprefixed(other.prop) !== unprefixed) {
|
||||
break
|
||||
} else if (callback(other) === true) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (step === +1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index += step
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return {
|
||||
down(callback) {
|
||||
return checker(+1, callback)
|
||||
},
|
||||
up(callback) {
|
||||
return checker(-1, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize prefix for remover
|
||||
*/
|
||||
normalize(prop) {
|
||||
return this.decl(prop).normalize(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
prop = vendor.unprefixed(prop)
|
||||
return this.decl(prop).prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache prefixes data to fast CSS processing
|
||||
*/
|
||||
preprocess(selected) {
|
||||
let add = {
|
||||
'@supports': new Supports(Prefixes, this),
|
||||
'selectors': []
|
||||
}
|
||||
for (let name in selected.add) {
|
||||
let prefixes = selected.add[name]
|
||||
if (name === '@keyframes' || name === '@viewport') {
|
||||
add[name] = new AtRule(name, prefixes, this)
|
||||
} else if (name === '@resolution') {
|
||||
add[name] = new Resolution(name, prefixes, this)
|
||||
} else if (this.data[name].selector) {
|
||||
add.selectors.push(Selector.load(name, prefixes, this))
|
||||
} else {
|
||||
let props = this.data[name].props
|
||||
|
||||
if (props) {
|
||||
let value = Value.load(name, prefixes, this)
|
||||
for (let prop of props) {
|
||||
if (!add[prop]) {
|
||||
add[prop] = { values: [] }
|
||||
}
|
||||
add[prop].values.push(value)
|
||||
}
|
||||
} else {
|
||||
let values = (add[name] && add[name].values) || []
|
||||
add[name] = Declaration.load(name, prefixes, this)
|
||||
add[name].values = values
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let remove = { selectors: [] }
|
||||
for (let name in selected.remove) {
|
||||
let prefixes = selected.remove[name]
|
||||
if (this.data[name].selector) {
|
||||
let selector = Selector.load(name, prefixes)
|
||||
for (let prefix of prefixes) {
|
||||
remove.selectors.push(selector.old(prefix))
|
||||
}
|
||||
} else if (name === '@keyframes' || name === '@viewport') {
|
||||
for (let prefix of prefixes) {
|
||||
let prefixed = `@${prefix}${name.slice(1)}`
|
||||
remove[prefixed] = { remove: true }
|
||||
}
|
||||
} else if (name === '@resolution') {
|
||||
remove[name] = new Resolution(name, prefixes, this)
|
||||
} else {
|
||||
let props = this.data[name].props
|
||||
if (props) {
|
||||
let value = Value.load(name, [], this)
|
||||
for (let prefix of prefixes) {
|
||||
let old = value.old(prefix)
|
||||
if (old) {
|
||||
for (let prop of props) {
|
||||
if (!remove[prop]) {
|
||||
remove[prop] = {}
|
||||
}
|
||||
if (!remove[prop].values) {
|
||||
remove[prop].values = []
|
||||
}
|
||||
remove[prop].values.push(old)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let p of prefixes) {
|
||||
let olds = this.decl(name).old(name, p)
|
||||
if (name === 'align-self') {
|
||||
let a = add[name] && add[name].prefixes
|
||||
if (a) {
|
||||
if (p === '-webkit- 2009' && a.includes('-webkit-')) {
|
||||
continue
|
||||
} else if (p === '-webkit-' && a.includes('-webkit- 2009')) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let prefixed of olds) {
|
||||
if (!remove[prefixed]) {
|
||||
remove[prefixed] = {}
|
||||
}
|
||||
remove[prefixed].remove = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [add, remove]
|
||||
}
|
||||
|
||||
/**
|
||||
* Select prefixes from data, which is necessary for selected browsers
|
||||
*/
|
||||
select(list) {
|
||||
let selected = { add: {}, remove: {} }
|
||||
|
||||
for (let name in list) {
|
||||
let data = list[name]
|
||||
let add = data.browsers.map(i => {
|
||||
let params = i.split(' ')
|
||||
return {
|
||||
browser: `${params[0]} ${params[1]}`,
|
||||
note: params[2]
|
||||
}
|
||||
})
|
||||
|
||||
let notes = add
|
||||
.filter(i => i.note)
|
||||
.map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
|
||||
notes = utils.uniq(notes)
|
||||
|
||||
add = add
|
||||
.filter(i => this.browsers.isSelected(i.browser))
|
||||
.map(i => {
|
||||
let prefix = this.browsers.prefix(i.browser)
|
||||
if (i.note) {
|
||||
return `${prefix} ${i.note}`
|
||||
} else {
|
||||
return prefix
|
||||
}
|
||||
})
|
||||
add = this.sort(utils.uniq(add))
|
||||
|
||||
if (this.options.flexbox === 'no-2009') {
|
||||
add = add.filter(i => !i.includes('2009'))
|
||||
}
|
||||
|
||||
let all = data.browsers.map(i => this.browsers.prefix(i))
|
||||
if (data.mistakes) {
|
||||
all = all.concat(data.mistakes)
|
||||
}
|
||||
all = all.concat(notes)
|
||||
all = utils.uniq(all)
|
||||
|
||||
if (add.length) {
|
||||
selected.add[name] = add
|
||||
if (add.length < all.length) {
|
||||
selected.remove[name] = all.filter(i => !add.includes(i))
|
||||
}
|
||||
} else {
|
||||
selected.remove[name] = all
|
||||
}
|
||||
}
|
||||
|
||||
return selected
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort vendor prefixes
|
||||
*/
|
||||
sort(prefixes) {
|
||||
return prefixes.sort((a, b) => {
|
||||
let aLength = utils.removeNote(a).length
|
||||
let bLength = utils.removeNote(b).length
|
||||
|
||||
if (aLength === bLength) {
|
||||
return b.length - a.length
|
||||
} else {
|
||||
return bLength - aLength
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
unprefixed(prop) {
|
||||
let value = this.normalize(vendor.unprefixed(prop))
|
||||
if (value === 'flex-direction') {
|
||||
value = 'flex-flow'
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values, which must be prefixed in selected property
|
||||
*/
|
||||
values(type, prop) {
|
||||
let data = this[type]
|
||||
|
||||
let global = data['*'] && data['*'].values
|
||||
let values = data[prop] && data[prop].values
|
||||
|
||||
if (global && values) {
|
||||
return utils.uniq(global.concat(values))
|
||||
} else {
|
||||
return global || values || []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prefixes
|
||||
709
node_modules/autoprefixer/lib/processor.js
generated
vendored
Normal file
709
node_modules/autoprefixer/lib/processor.js
generated
vendored
Normal file
@@ -0,0 +1,709 @@
|
||||
let parser = require('postcss-value-parser')
|
||||
|
||||
let Value = require('./value')
|
||||
let insertAreas = require('./hacks/grid-utils').insertAreas
|
||||
|
||||
const OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i
|
||||
const OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i
|
||||
const IGNORE_NEXT = /(!\s*)?autoprefixer:\s*ignore\s+next/i
|
||||
const GRID_REGEX = /(!\s*)?autoprefixer\s*grid:\s*(on|off|(no-)?autoplace)/i
|
||||
|
||||
const SIZES = [
|
||||
'width',
|
||||
'height',
|
||||
'min-width',
|
||||
'max-width',
|
||||
'min-height',
|
||||
'max-height',
|
||||
'inline-size',
|
||||
'min-inline-size',
|
||||
'max-inline-size',
|
||||
'block-size',
|
||||
'min-block-size',
|
||||
'max-block-size'
|
||||
]
|
||||
|
||||
function hasGridTemplate(decl) {
|
||||
return decl.parent.some(
|
||||
i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
|
||||
)
|
||||
}
|
||||
|
||||
function hasRowsAndColumns(decl) {
|
||||
let hasRows = decl.parent.some(i => i.prop === 'grid-template-rows')
|
||||
let hasColumns = decl.parent.some(i => i.prop === 'grid-template-columns')
|
||||
return hasRows && hasColumns
|
||||
}
|
||||
|
||||
class Processor {
|
||||
constructor(prefixes) {
|
||||
this.prefixes = prefixes
|
||||
}
|
||||
|
||||
/**
|
||||
* Add necessary prefixes
|
||||
*/
|
||||
add(css, result) {
|
||||
// At-rules
|
||||
let resolution = this.prefixes.add['@resolution']
|
||||
let keyframes = this.prefixes.add['@keyframes']
|
||||
let viewport = this.prefixes.add['@viewport']
|
||||
let supports = this.prefixes.add['@supports']
|
||||
|
||||
css.walkAtRules(rule => {
|
||||
if (rule.name === 'keyframes') {
|
||||
if (!this.disabled(rule, result)) {
|
||||
return keyframes && keyframes.process(rule)
|
||||
}
|
||||
} else if (rule.name === 'viewport') {
|
||||
if (!this.disabled(rule, result)) {
|
||||
return viewport && viewport.process(rule)
|
||||
}
|
||||
} else if (rule.name === 'supports') {
|
||||
if (
|
||||
this.prefixes.options.supports !== false &&
|
||||
!this.disabled(rule, result)
|
||||
) {
|
||||
return supports.process(rule)
|
||||
}
|
||||
} else if (rule.name === 'media' && rule.params.includes('-resolution')) {
|
||||
if (!this.disabled(rule, result)) {
|
||||
return resolution && resolution.process(rule)
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
})
|
||||
|
||||
// Selectors
|
||||
css.walkRules(rule => {
|
||||
if (this.disabled(rule, result)) return undefined
|
||||
|
||||
return this.prefixes.add.selectors.map(selector => {
|
||||
return selector.process(rule, result)
|
||||
})
|
||||
})
|
||||
|
||||
function insideGrid(decl) {
|
||||
return decl.parent.nodes.some(node => {
|
||||
if (node.type !== 'decl') return false
|
||||
let displayGrid =
|
||||
node.prop === 'display' && /(inline-)?grid/.test(node.value)
|
||||
let gridTemplate = node.prop.startsWith('grid-template')
|
||||
let gridGap = /^grid-([A-z]+-)?gap/.test(node.prop)
|
||||
return displayGrid || gridTemplate || gridGap
|
||||
})
|
||||
}
|
||||
|
||||
let gridPrefixes =
|
||||
this.gridStatus(css, result) &&
|
||||
this.prefixes.add['grid-area'] &&
|
||||
this.prefixes.add['grid-area'].prefixes
|
||||
|
||||
css.walkDecls(decl => {
|
||||
if (this.disabledDecl(decl, result)) return undefined
|
||||
|
||||
let parent = decl.parent
|
||||
let prop = decl.prop
|
||||
let value = decl.value
|
||||
|
||||
if (prop === 'color-adjust') {
|
||||
if (parent.every(i => i.prop !== 'print-color-adjust')) {
|
||||
result.warn(
|
||||
'Replace color-adjust to print-color-adjust. ' +
|
||||
'The color-adjust shorthand is currently deprecated.',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
} else if (prop === 'grid-row-span') {
|
||||
result.warn(
|
||||
'grid-row-span is not part of final Grid Layout. Use grid-row.',
|
||||
{ node: decl }
|
||||
)
|
||||
return undefined
|
||||
} else if (prop === 'grid-column-span') {
|
||||
result.warn(
|
||||
'grid-column-span is not part of final Grid Layout. Use grid-column.',
|
||||
{ node: decl }
|
||||
)
|
||||
return undefined
|
||||
} else if (prop === 'display' && value === 'box') {
|
||||
result.warn(
|
||||
'You should write display: flex by final spec ' +
|
||||
'instead of display: box',
|
||||
{ node: decl }
|
||||
)
|
||||
return undefined
|
||||
} else if (prop === 'text-emphasis-position') {
|
||||
if (value === 'under' || value === 'over') {
|
||||
result.warn(
|
||||
'You should use 2 values for text-emphasis-position ' +
|
||||
'For example, `under left` instead of just `under`.',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
} else if (prop === 'text-decoration-skip' && value === 'ink') {
|
||||
result.warn(
|
||||
'Replace text-decoration-skip: ink to ' +
|
||||
'text-decoration-skip-ink: auto, because spec had been changed',
|
||||
{ node: decl }
|
||||
)
|
||||
} else {
|
||||
if (gridPrefixes && this.gridStatus(decl, result)) {
|
||||
if (decl.value === 'subgrid') {
|
||||
result.warn('IE does not support subgrid', { node: decl })
|
||||
}
|
||||
if (/^(align|justify|place)-items$/.test(prop) && insideGrid(decl)) {
|
||||
let fixed = prop.replace('-items', '-self')
|
||||
result.warn(
|
||||
`IE does not support ${prop} on grid containers. ` +
|
||||
`Try using ${fixed} on child elements instead: ` +
|
||||
`${decl.parent.selector} > * { ${fixed}: ${decl.value} }`,
|
||||
{ node: decl }
|
||||
)
|
||||
} else if (
|
||||
/^(align|justify|place)-content$/.test(prop) &&
|
||||
insideGrid(decl)
|
||||
) {
|
||||
result.warn(`IE does not support ${decl.prop} on grid containers`, {
|
||||
node: decl
|
||||
})
|
||||
} else if (prop === 'display' && decl.value === 'contents') {
|
||||
result.warn(
|
||||
'Please do not use display: contents; ' +
|
||||
'if you have grid setting enabled',
|
||||
{ node: decl }
|
||||
)
|
||||
return undefined
|
||||
} else if (decl.prop === 'grid-gap') {
|
||||
let status = this.gridStatus(decl, result)
|
||||
if (
|
||||
status === 'autoplace' &&
|
||||
!hasRowsAndColumns(decl) &&
|
||||
!hasGridTemplate(decl)
|
||||
) {
|
||||
result.warn(
|
||||
'grid-gap only works if grid-template(-areas) is being ' +
|
||||
'used or both rows and columns have been declared ' +
|
||||
'and cells have not been manually ' +
|
||||
'placed inside the explicit grid',
|
||||
{ node: decl }
|
||||
)
|
||||
} else if (
|
||||
(status === true || status === 'no-autoplace') &&
|
||||
!hasGridTemplate(decl)
|
||||
) {
|
||||
result.warn(
|
||||
'grid-gap only works if grid-template(-areas) is being used',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
} else if (prop === 'grid-auto-columns') {
|
||||
result.warn('grid-auto-columns is not supported by IE', {
|
||||
node: decl
|
||||
})
|
||||
return undefined
|
||||
} else if (prop === 'grid-auto-rows') {
|
||||
result.warn('grid-auto-rows is not supported by IE', { node: decl })
|
||||
return undefined
|
||||
} else if (prop === 'grid-auto-flow') {
|
||||
let hasRows = parent.some(i => i.prop === 'grid-template-rows')
|
||||
let hasCols = parent.some(i => i.prop === 'grid-template-columns')
|
||||
|
||||
if (hasGridTemplate(decl)) {
|
||||
result.warn('grid-auto-flow is not supported by IE', {
|
||||
node: decl
|
||||
})
|
||||
} else if (value.includes('dense')) {
|
||||
result.warn('grid-auto-flow: dense is not supported by IE', {
|
||||
node: decl
|
||||
})
|
||||
} else if (!hasRows && !hasCols) {
|
||||
result.warn(
|
||||
'grid-auto-flow works only if grid-template-rows and ' +
|
||||
'grid-template-columns are present in the same rule',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
return undefined
|
||||
} else if (value.includes('auto-fit')) {
|
||||
result.warn('auto-fit value is not supported by IE', {
|
||||
node: decl,
|
||||
word: 'auto-fit'
|
||||
})
|
||||
return undefined
|
||||
} else if (value.includes('auto-fill')) {
|
||||
result.warn('auto-fill value is not supported by IE', {
|
||||
node: decl,
|
||||
word: 'auto-fill'
|
||||
})
|
||||
return undefined
|
||||
} else if (prop.startsWith('grid-template') && value.includes('[')) {
|
||||
result.warn(
|
||||
'Autoprefixer currently does not support line names. ' +
|
||||
'Try using grid-template-areas instead.',
|
||||
{ node: decl, word: '[' }
|
||||
)
|
||||
}
|
||||
}
|
||||
if (value.includes('radial-gradient')) {
|
||||
if (OLD_RADIAL.test(decl.value)) {
|
||||
result.warn(
|
||||
'Gradient has outdated direction syntax. ' +
|
||||
'New syntax is like `closest-side at 0 0` ' +
|
||||
'instead of `0 0, closest-side`.',
|
||||
{ node: decl }
|
||||
)
|
||||
} else {
|
||||
let ast = parser(value)
|
||||
|
||||
for (let i of ast.nodes) {
|
||||
if (i.type === 'function' && i.value === 'radial-gradient') {
|
||||
for (let word of i.nodes) {
|
||||
if (word.type === 'word') {
|
||||
if (word.value === 'cover') {
|
||||
result.warn(
|
||||
'Gradient has outdated direction syntax. ' +
|
||||
'Replace `cover` to `farthest-corner`.',
|
||||
{ node: decl }
|
||||
)
|
||||
} else if (word.value === 'contain') {
|
||||
result.warn(
|
||||
'Gradient has outdated direction syntax. ' +
|
||||
'Replace `contain` to `closest-side`.',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (value.includes('linear-gradient')) {
|
||||
if (OLD_LINEAR.test(value)) {
|
||||
result.warn(
|
||||
'Gradient has outdated direction syntax. ' +
|
||||
'New syntax is like `to left` instead of `right`.',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SIZES.includes(decl.prop)) {
|
||||
if (!decl.value.includes('-fill-available')) {
|
||||
if (decl.value.includes('fill-available')) {
|
||||
result.warn(
|
||||
'Replace fill-available to stretch, ' +
|
||||
'because spec had been changed',
|
||||
{ node: decl }
|
||||
)
|
||||
} else if (decl.value.includes('fill')) {
|
||||
let ast = parser(value)
|
||||
if (ast.nodes.some(i => i.type === 'word' && i.value === 'fill')) {
|
||||
result.warn(
|
||||
'Replace fill to stretch, because spec had been changed',
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let prefixer
|
||||
|
||||
if (decl.prop === 'transition' || decl.prop === 'transition-property') {
|
||||
// Transition
|
||||
return this.prefixes.transition.add(decl, result)
|
||||
} else if (decl.prop === 'align-self') {
|
||||
// align-self flexbox or grid
|
||||
let display = this.displayType(decl)
|
||||
if (display !== 'grid' && this.prefixes.options.flexbox !== false) {
|
||||
prefixer = this.prefixes.add['align-self']
|
||||
if (prefixer && prefixer.prefixes) {
|
||||
prefixer.process(decl)
|
||||
}
|
||||
}
|
||||
if (this.gridStatus(decl, result) !== false) {
|
||||
prefixer = this.prefixes.add['grid-row-align']
|
||||
if (prefixer && prefixer.prefixes) {
|
||||
return prefixer.process(decl, result)
|
||||
}
|
||||
}
|
||||
} else if (decl.prop === 'justify-self') {
|
||||
// justify-self flexbox or grid
|
||||
if (this.gridStatus(decl, result) !== false) {
|
||||
prefixer = this.prefixes.add['grid-column-align']
|
||||
if (prefixer && prefixer.prefixes) {
|
||||
return prefixer.process(decl, result)
|
||||
}
|
||||
}
|
||||
} else if (decl.prop === 'place-self') {
|
||||
prefixer = this.prefixes.add['place-self']
|
||||
if (
|
||||
prefixer &&
|
||||
prefixer.prefixes &&
|
||||
this.gridStatus(decl, result) !== false
|
||||
) {
|
||||
return prefixer.process(decl, result)
|
||||
}
|
||||
} else {
|
||||
// Properties
|
||||
prefixer = this.prefixes.add[decl.prop]
|
||||
if (prefixer && prefixer.prefixes) {
|
||||
return prefixer.process(decl, result)
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
})
|
||||
|
||||
// Insert grid-area prefixes. We need to be able to store the different
|
||||
// rules as a data and hack API is not enough for this
|
||||
if (this.gridStatus(css, result)) {
|
||||
insertAreas(css, this.disabled)
|
||||
}
|
||||
|
||||
// Values
|
||||
return css.walkDecls(decl => {
|
||||
if (this.disabledValue(decl, result)) return
|
||||
|
||||
let unprefixed = this.prefixes.unprefixed(decl.prop)
|
||||
let list = this.prefixes.values('add', unprefixed)
|
||||
if (Array.isArray(list)) {
|
||||
for (let value of list) {
|
||||
if (value.process) value.process(decl, result)
|
||||
}
|
||||
}
|
||||
Value.save(this.prefixes, decl)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for control comment and global options
|
||||
*/
|
||||
disabled(node, result) {
|
||||
if (!node) return false
|
||||
|
||||
if (node._autoprefixerDisabled !== undefined) {
|
||||
return node._autoprefixerDisabled
|
||||
}
|
||||
|
||||
if (node.parent) {
|
||||
let p = node.prev()
|
||||
if (p && p.type === 'comment' && IGNORE_NEXT.test(p.text)) {
|
||||
node._autoprefixerDisabled = true
|
||||
node._autoprefixerSelfDisabled = true
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
let value = null
|
||||
if (node.nodes) {
|
||||
let status
|
||||
node.each(i => {
|
||||
if (i.type !== 'comment') return
|
||||
if (/(!\s*)?autoprefixer:\s*(off|on)/i.test(i.text)) {
|
||||
if (typeof status !== 'undefined') {
|
||||
result.warn(
|
||||
'Second Autoprefixer control comment ' +
|
||||
'was ignored. Autoprefixer applies control ' +
|
||||
'comment to whole block, not to next rules.',
|
||||
{ node: i }
|
||||
)
|
||||
} else {
|
||||
status = /on/i.test(i.text)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (status !== undefined) {
|
||||
value = !status
|
||||
}
|
||||
}
|
||||
if (!node.nodes || value === null) {
|
||||
if (node.parent) {
|
||||
let isParentDisabled = this.disabled(node.parent, result)
|
||||
if (node.parent._autoprefixerSelfDisabled === true) {
|
||||
value = false
|
||||
} else {
|
||||
value = isParentDisabled
|
||||
}
|
||||
} else {
|
||||
value = false
|
||||
}
|
||||
}
|
||||
node._autoprefixerDisabled = value
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
*/
|
||||
disabledDecl(node, result) {
|
||||
if (node.type === 'decl' && this.gridStatus(node, result) === false) {
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (node.type === 'decl' && this.prefixes.options.flexbox === false) {
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
*/
|
||||
disabledValue(node, result) {
|
||||
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (node.type === 'decl' && node.prop === 'content') {
|
||||
return true
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Is it flebox or grid rule
|
||||
*/
|
||||
displayType(decl) {
|
||||
for (let i of decl.parent.nodes) {
|
||||
if (i.prop !== 'display') {
|
||||
continue
|
||||
}
|
||||
|
||||
if (i.value.includes('flex')) {
|
||||
return 'flex'
|
||||
}
|
||||
|
||||
if (i.value.includes('grid')) {
|
||||
return 'grid'
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grid option via control comment
|
||||
*/
|
||||
gridStatus(node, result) {
|
||||
if (!node) return false
|
||||
|
||||
if (node._autoprefixerGridStatus !== undefined) {
|
||||
return node._autoprefixerGridStatus
|
||||
}
|
||||
|
||||
let value = null
|
||||
if (node.nodes) {
|
||||
let status
|
||||
node.each(i => {
|
||||
if (i.type !== 'comment') return
|
||||
if (GRID_REGEX.test(i.text)) {
|
||||
let hasAutoplace = /:\s*autoplace/i.test(i.text)
|
||||
let noAutoplace = /no-autoplace/i.test(i.text)
|
||||
if (typeof status !== 'undefined') {
|
||||
result.warn(
|
||||
'Second Autoprefixer grid control comment was ' +
|
||||
'ignored. Autoprefixer applies control comments to the whole ' +
|
||||
'block, not to the next rules.',
|
||||
{ node: i }
|
||||
)
|
||||
} else if (hasAutoplace) {
|
||||
status = 'autoplace'
|
||||
} else if (noAutoplace) {
|
||||
status = true
|
||||
} else {
|
||||
status = /on/i.test(i.text)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (status !== undefined) {
|
||||
value = status
|
||||
}
|
||||
}
|
||||
|
||||
if (node.type === 'atrule' && node.name === 'supports') {
|
||||
let params = node.params
|
||||
if (params.includes('grid') && params.includes('auto')) {
|
||||
value = false
|
||||
}
|
||||
}
|
||||
|
||||
if (!node.nodes || value === null) {
|
||||
if (node.parent) {
|
||||
let isParentGrid = this.gridStatus(node.parent, result)
|
||||
if (node.parent._autoprefixerSelfDisabled === true) {
|
||||
value = false
|
||||
} else {
|
||||
value = isParentGrid
|
||||
}
|
||||
} else if (typeof this.prefixes.options.grid !== 'undefined') {
|
||||
value = this.prefixes.options.grid
|
||||
} else if (typeof process.env.AUTOPREFIXER_GRID !== 'undefined') {
|
||||
if (process.env.AUTOPREFIXER_GRID === 'autoplace') {
|
||||
value = 'autoplace'
|
||||
} else {
|
||||
value = true
|
||||
}
|
||||
} else {
|
||||
value = false
|
||||
}
|
||||
}
|
||||
|
||||
node._autoprefixerGridStatus = value
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize spaces in cascade declaration group
|
||||
*/
|
||||
reduceSpaces(decl) {
|
||||
let stop = false
|
||||
this.prefixes.group(decl).up(() => {
|
||||
stop = true
|
||||
return true
|
||||
})
|
||||
if (stop) {
|
||||
return
|
||||
}
|
||||
|
||||
let parts = decl.raw('before').split('\n')
|
||||
let prevMin = parts[parts.length - 1].length
|
||||
let diff = false
|
||||
|
||||
this.prefixes.group(decl).down(other => {
|
||||
parts = other.raw('before').split('\n')
|
||||
let last = parts.length - 1
|
||||
|
||||
if (parts[last].length > prevMin) {
|
||||
if (diff === false) {
|
||||
diff = parts[last].length - prevMin
|
||||
}
|
||||
|
||||
parts[last] = parts[last].slice(0, -diff)
|
||||
other.raws.before = parts.join('\n')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unnecessary pefixes
|
||||
*/
|
||||
remove(css, result) {
|
||||
// At-rules
|
||||
let resolution = this.prefixes.remove['@resolution']
|
||||
|
||||
css.walkAtRules((rule, i) => {
|
||||
if (this.prefixes.remove[`@${rule.name}`]) {
|
||||
if (!this.disabled(rule, result)) {
|
||||
rule.parent.removeChild(i)
|
||||
}
|
||||
} else if (
|
||||
rule.name === 'media' &&
|
||||
rule.params.includes('-resolution') &&
|
||||
resolution
|
||||
) {
|
||||
resolution.clean(rule)
|
||||
}
|
||||
})
|
||||
|
||||
// Selectors
|
||||
css.walkRules((rule, i) => {
|
||||
if (this.disabled(rule, result)) return
|
||||
|
||||
for (let checker of this.prefixes.remove.selectors) {
|
||||
if (checker.check(rule)) {
|
||||
rule.parent.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return css.walkDecls((decl, i) => {
|
||||
if (this.disabled(decl, result)) return
|
||||
|
||||
let rule = decl.parent
|
||||
let unprefixed = this.prefixes.unprefixed(decl.prop)
|
||||
|
||||
// Transition
|
||||
if (decl.prop === 'transition' || decl.prop === 'transition-property') {
|
||||
this.prefixes.transition.remove(decl)
|
||||
}
|
||||
|
||||
// Properties
|
||||
if (
|
||||
this.prefixes.remove[decl.prop] &&
|
||||
this.prefixes.remove[decl.prop].remove
|
||||
) {
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return this.prefixes.normalize(other.prop) === unprefixed
|
||||
})
|
||||
|
||||
if (unprefixed === 'flex-flow') {
|
||||
notHack = true
|
||||
}
|
||||
|
||||
if (decl.prop === '-webkit-box-orient') {
|
||||
let hacks = { 'flex-direction': true, 'flex-flow': true }
|
||||
if (!decl.parent.some(j => hacks[j.prop])) return
|
||||
}
|
||||
|
||||
if (notHack && !this.withHackValue(decl)) {
|
||||
if (decl.raw('before').includes('\n')) {
|
||||
this.reduceSpaces(decl)
|
||||
}
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Values
|
||||
for (let checker of this.prefixes.values('remove', unprefixed)) {
|
||||
if (!checker.check) continue
|
||||
if (!checker.check(decl.value)) continue
|
||||
|
||||
unprefixed = checker.unprefixed
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return other.value.includes(unprefixed)
|
||||
})
|
||||
|
||||
if (notHack) {
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Some rare old values, which is not in standard
|
||||
*/
|
||||
withHackValue(decl) {
|
||||
return (
|
||||
(decl.prop === '-webkit-background-clip' && decl.value === 'text') ||
|
||||
// Do not remove -webkit-box-orient when -webkit-line-clamp is present.
|
||||
// https://github.com/postcss/autoprefixer/issues/1510
|
||||
(decl.prop === '-webkit-box-orient' &&
|
||||
decl.parent.some(d => d.prop === '-webkit-line-clamp'))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Processor
|
||||
97
node_modules/autoprefixer/lib/resolution.js
generated
vendored
Normal file
97
node_modules/autoprefixer/lib/resolution.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
let FractionJs = require('fraction.js')
|
||||
|
||||
let Prefixer = require('./prefixer')
|
||||
let utils = require('./utils')
|
||||
|
||||
const REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpcm|dpi|x)/gi
|
||||
const SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpcm|dpi|x)/i
|
||||
|
||||
class Resolution extends Prefixer {
|
||||
/**
|
||||
* Remove prefixed queries
|
||||
*/
|
||||
clean(rule) {
|
||||
if (!this.bad) {
|
||||
this.bad = []
|
||||
for (let prefix of this.prefixes) {
|
||||
this.bad.push(this.prefixName(prefix, 'min'))
|
||||
this.bad.push(this.prefixName(prefix, 'max'))
|
||||
}
|
||||
}
|
||||
|
||||
rule.params = utils.editList(rule.params, queries => {
|
||||
return queries.filter(query => this.bad.every(i => !query.includes(i)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed query name
|
||||
*/
|
||||
prefixName(prefix, name) {
|
||||
if (prefix === '-moz-') {
|
||||
return name + '--moz-device-pixel-ratio'
|
||||
} else {
|
||||
return prefix + name + '-device-pixel-ratio'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed query
|
||||
*/
|
||||
prefixQuery(prefix, name, colon, value, units) {
|
||||
value = new FractionJs(value)
|
||||
|
||||
// 1dpcm = 2.54dpi
|
||||
// 1dppx = 96dpi
|
||||
if (units === 'dpi') {
|
||||
value = value.div(96)
|
||||
} else if (units === 'dpcm') {
|
||||
value = value.mul(2.54).div(96)
|
||||
}
|
||||
value = value.simplify()
|
||||
|
||||
if (prefix === '-o-') {
|
||||
value = value.n + '/' + value.d
|
||||
}
|
||||
return this.prefixName(prefix, name) + colon + value
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixed queries
|
||||
*/
|
||||
process(rule) {
|
||||
let parent = this.parentPrefix(rule)
|
||||
let prefixes = parent ? [parent] : this.prefixes
|
||||
|
||||
rule.params = utils.editList(rule.params, (origin, prefixed) => {
|
||||
for (let query of origin) {
|
||||
if (
|
||||
!query.includes('min-resolution') &&
|
||||
!query.includes('max-resolution')
|
||||
) {
|
||||
prefixed.push(query)
|
||||
continue
|
||||
}
|
||||
|
||||
for (let prefix of prefixes) {
|
||||
let processed = query.replace(REGEXP, str => {
|
||||
let parts = str.match(SPLIT)
|
||||
return this.prefixQuery(
|
||||
prefix,
|
||||
parts[1],
|
||||
parts[2],
|
||||
parts[3],
|
||||
parts[4]
|
||||
)
|
||||
})
|
||||
prefixed.push(processed)
|
||||
}
|
||||
prefixed.push(query)
|
||||
}
|
||||
|
||||
return utils.uniq(prefixed)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Resolution
|
||||
150
node_modules/autoprefixer/lib/selector.js
generated
vendored
Normal file
150
node_modules/autoprefixer/lib/selector.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
let { list } = require('postcss')
|
||||
|
||||
let Browsers = require('./browsers')
|
||||
let OldSelector = require('./old-selector')
|
||||
let Prefixer = require('./prefixer')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Selector extends Prefixer {
|
||||
constructor(name, prefixes, all) {
|
||||
super(name, prefixes, all)
|
||||
this.regexpCache = new Map()
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and add prefixes for at-rule
|
||||
*/
|
||||
add(rule, prefix) {
|
||||
let prefixeds = this.prefixeds(rule)
|
||||
|
||||
if (this.already(rule, prefixeds, prefix)) {
|
||||
return
|
||||
}
|
||||
|
||||
let cloned = this.clone(rule, { selector: prefixeds[this.name][prefix] })
|
||||
rule.parent.insertBefore(rule, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
* Is rule already prefixed before
|
||||
*/
|
||||
already(rule, prefixeds, prefix) {
|
||||
let index = rule.parent.index(rule) - 1
|
||||
|
||||
while (index >= 0) {
|
||||
let before = rule.parent.nodes[index]
|
||||
|
||||
if (before.type !== 'rule') {
|
||||
return false
|
||||
}
|
||||
|
||||
let some = false
|
||||
for (let key in prefixeds[this.name]) {
|
||||
let prefixed = prefixeds[this.name][key]
|
||||
if (before.selector === prefixed) {
|
||||
if (prefix === key) {
|
||||
return true
|
||||
} else {
|
||||
some = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!some) {
|
||||
return false
|
||||
}
|
||||
|
||||
index -= 1
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Is rule selectors need to be prefixed
|
||||
*/
|
||||
check(rule) {
|
||||
if (rule.selector.includes(this.name)) {
|
||||
return !!rule.selector.match(this.regexp())
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return function to fast find prefixed selector
|
||||
*/
|
||||
old(prefix) {
|
||||
return new OldSelector(this, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* All possible prefixes
|
||||
*/
|
||||
possible() {
|
||||
return Browsers.prefixes()
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of selector
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
return this.name.replace(/^(\W*)/, `$1${prefix}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all possible selector prefixes
|
||||
*/
|
||||
prefixeds(rule) {
|
||||
if (rule._autoprefixerPrefixeds) {
|
||||
if (rule._autoprefixerPrefixeds[this.name]) {
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
} else {
|
||||
rule._autoprefixerPrefixeds = {}
|
||||
}
|
||||
|
||||
let prefixeds = {}
|
||||
if (rule.selector.includes(',')) {
|
||||
let ruleParts = list.comma(rule.selector)
|
||||
let toProcess = ruleParts.filter(el => el.includes(this.name))
|
||||
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = toProcess
|
||||
.map(el => this.replace(el, prefix))
|
||||
.join(', ')
|
||||
}
|
||||
} else {
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = this.replace(rule.selector, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
rule._autoprefixerPrefixeds[this.name] = prefixeds
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy loadRegExp for name
|
||||
*/
|
||||
regexp(prefix) {
|
||||
if (!this.regexpCache.has(prefix)) {
|
||||
let name = prefix ? this.prefixed(prefix) : this.name
|
||||
this.regexpCache.set(
|
||||
prefix,
|
||||
new RegExp(`(^|[^:"'=])${utils.escapeRegexp(name)}`, 'gi')
|
||||
)
|
||||
}
|
||||
|
||||
return this.regexpCache.get(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace selectors by prefixed one
|
||||
*/
|
||||
replace(selector, prefix) {
|
||||
return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Selector
|
||||
302
node_modules/autoprefixer/lib/supports.js
generated
vendored
Normal file
302
node_modules/autoprefixer/lib/supports.js
generated
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
let featureQueries = require('caniuse-lite/data/features/css-featurequeries.js')
|
||||
let feature = require('caniuse-lite/dist/unpacker/feature')
|
||||
let { parse } = require('postcss')
|
||||
|
||||
let brackets = require('./brackets')
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
let Value = require('./value')
|
||||
|
||||
let data = feature(featureQueries)
|
||||
|
||||
let supported = []
|
||||
for (let browser in data.stats) {
|
||||
let versions = data.stats[browser]
|
||||
for (let version in versions) {
|
||||
let support = versions[version]
|
||||
if (/y/.test(support)) {
|
||||
supported.push(browser + ' ' + version)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Supports {
|
||||
constructor(Prefixes, all) {
|
||||
this.Prefixes = Prefixes
|
||||
this.all = all
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixes
|
||||
*/
|
||||
add(nodes, all) {
|
||||
return nodes.map(i => {
|
||||
if (this.isProp(i)) {
|
||||
let prefixed = this.prefixed(i[0])
|
||||
if (prefixed.length > 1) {
|
||||
return this.convert(prefixed)
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
if (typeof i === 'object') {
|
||||
return this.add(i, all)
|
||||
}
|
||||
|
||||
return i
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean brackets with one child
|
||||
*/
|
||||
cleanBrackets(nodes) {
|
||||
return nodes.map(i => {
|
||||
if (typeof i !== 'object') {
|
||||
return i
|
||||
}
|
||||
|
||||
if (i.length === 1 && typeof i[0] === 'object') {
|
||||
return this.cleanBrackets(i[0])
|
||||
}
|
||||
|
||||
return this.cleanBrackets(i)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add " or " between properties and convert it to brackets format
|
||||
*/
|
||||
convert(progress) {
|
||||
let result = ['']
|
||||
for (let i of progress) {
|
||||
result.push([`${i.prop}: ${i.value}`])
|
||||
result.push(' or ')
|
||||
}
|
||||
result[result.length - 1] = ''
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Check global options
|
||||
*/
|
||||
disabled(node) {
|
||||
if (!this.all.options.grid) {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (this.all.options.flexbox === false) {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if prefixed property has no unprefixed
|
||||
*/
|
||||
isHack(all, unprefixed) {
|
||||
let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
|
||||
return !check.test(all)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "not" word
|
||||
*/
|
||||
isNot(node) {
|
||||
return typeof node === 'string' && /not\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "or" word
|
||||
*/
|
||||
isOr(node) {
|
||||
return typeof node === 'string' && /\s*or\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is (prop: value)
|
||||
*/
|
||||
isProp(node) {
|
||||
return (
|
||||
typeof node === 'object' &&
|
||||
node.length === 1 &&
|
||||
typeof node[0] === 'string'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress value functions into a string nodes
|
||||
*/
|
||||
normalize(nodes) {
|
||||
if (typeof nodes !== 'object') {
|
||||
return nodes
|
||||
}
|
||||
|
||||
nodes = nodes.filter(i => i !== '')
|
||||
|
||||
if (typeof nodes[0] === 'string') {
|
||||
let firstNode = nodes[0].trim()
|
||||
|
||||
if (
|
||||
firstNode.includes(':') ||
|
||||
firstNode === 'selector' ||
|
||||
firstNode === 'not selector'
|
||||
) {
|
||||
return [brackets.stringify(nodes)]
|
||||
}
|
||||
}
|
||||
return nodes.map(i => this.normalize(i))
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse string into declaration property and value
|
||||
*/
|
||||
parse(str) {
|
||||
let parts = str.split(':')
|
||||
let prop = parts[0]
|
||||
let value = parts[1]
|
||||
if (!value) value = ''
|
||||
return [prop.trim(), value.trim()]
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Declaration with all necessary prefixes
|
||||
*/
|
||||
prefixed(str) {
|
||||
let rule = this.virtual(str)
|
||||
if (this.disabled(rule.first)) {
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
let result = { warn: () => null }
|
||||
|
||||
let prefixer = this.prefixer().add[rule.first.prop]
|
||||
prefixer && prefixer.process && prefixer.process(rule.first, result)
|
||||
|
||||
for (let decl of rule.nodes) {
|
||||
for (let value of this.prefixer().values('add', rule.first.prop)) {
|
||||
value.process(decl)
|
||||
}
|
||||
Value.save(this.all, decl)
|
||||
}
|
||||
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixer only with @supports supported browsers
|
||||
*/
|
||||
prefixer() {
|
||||
if (this.prefixerCache) {
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
let filtered = this.all.browsers.selected.filter(i => {
|
||||
return supported.includes(i)
|
||||
})
|
||||
|
||||
let browsers = new Browsers(
|
||||
this.all.browsers.data,
|
||||
filtered,
|
||||
this.all.options
|
||||
)
|
||||
this.prefixerCache = new this.Prefixes(
|
||||
this.all.data,
|
||||
browsers,
|
||||
this.all.options
|
||||
)
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixed declaration
|
||||
*/
|
||||
process(rule) {
|
||||
let ast = brackets.parse(rule.params)
|
||||
ast = this.normalize(ast)
|
||||
ast = this.remove(ast, rule.params)
|
||||
ast = this.add(ast, rule.params)
|
||||
ast = this.cleanBrackets(ast)
|
||||
rule.params = brackets.stringify(ast)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all unnecessary prefixes
|
||||
*/
|
||||
remove(nodes, all) {
|
||||
let i = 0
|
||||
while (i < nodes.length) {
|
||||
if (
|
||||
!this.isNot(nodes[i - 1]) &&
|
||||
this.isProp(nodes[i]) &&
|
||||
this.isOr(nodes[i + 1])
|
||||
) {
|
||||
if (this.toRemove(nodes[i][0], all)) {
|
||||
nodes.splice(i, 2)
|
||||
continue
|
||||
}
|
||||
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
|
||||
if (typeof nodes[i] === 'object') {
|
||||
nodes[i] = this.remove(nodes[i], all)
|
||||
}
|
||||
|
||||
i += 1
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we need to remove node
|
||||
*/
|
||||
toRemove(str, all) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let unprefixed = this.all.unprefixed(prop)
|
||||
|
||||
let cleaner = this.all.cleaner()
|
||||
|
||||
if (
|
||||
cleaner.remove[prop] &&
|
||||
cleaner.remove[prop].remove &&
|
||||
!this.isHack(all, unprefixed)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
for (let checker of cleaner.values('remove', unprefixed)) {
|
||||
if (checker.check(value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create virtual rule to process it by prefixer
|
||||
*/
|
||||
virtual(str) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let rule = parse('a{}').first
|
||||
rule.append({ prop, raws: { before: '' }, value })
|
||||
return rule
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Supports
|
||||
329
node_modules/autoprefixer/lib/transition.js
generated
vendored
Normal file
329
node_modules/autoprefixer/lib/transition.js
generated
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
let { list } = require('postcss')
|
||||
let parser = require('postcss-value-parser')
|
||||
|
||||
let Browsers = require('./browsers')
|
||||
let vendor = require('./vendor')
|
||||
|
||||
class Transition {
|
||||
constructor(prefixes) {
|
||||
this.props = ['transition', 'transition-property']
|
||||
this.prefixes = prefixes
|
||||
}
|
||||
|
||||
/**
|
||||
* Process transition and add prefixes for all necessary properties
|
||||
*/
|
||||
add(decl, result) {
|
||||
let prefix, prop
|
||||
let add = this.prefixes.add[decl.prop]
|
||||
let vendorPrefixes = this.ruleVendorPrefixes(decl)
|
||||
let declPrefixes = vendorPrefixes || (add && add.prefixes) || []
|
||||
|
||||
let params = this.parse(decl.value)
|
||||
let names = params.map(i => this.findProp(i))
|
||||
let added = []
|
||||
|
||||
if (names.some(i => i[0] === '-')) {
|
||||
return
|
||||
}
|
||||
|
||||
for (let param of params) {
|
||||
prop = this.findProp(param)
|
||||
if (prop[0] === '-') continue
|
||||
|
||||
let prefixer = this.prefixes.add[prop]
|
||||
if (!prefixer || !prefixer.prefixes) continue
|
||||
|
||||
for (prefix of prefixer.prefixes) {
|
||||
if (vendorPrefixes && !vendorPrefixes.some(p => prefix.includes(p))) {
|
||||
continue
|
||||
}
|
||||
|
||||
let prefixed = this.prefixes.prefixed(prop, prefix)
|
||||
if (prefixed !== '-ms-transform' && !names.includes(prefixed)) {
|
||||
if (!this.disabled(prop, prefix)) {
|
||||
added.push(this.clone(prop, prefixed, param))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
params = params.concat(added)
|
||||
let value = this.stringify(params)
|
||||
|
||||
let webkitClean = this.stringify(
|
||||
this.cleanFromUnprefixed(params, '-webkit-')
|
||||
)
|
||||
if (declPrefixes.includes('-webkit-')) {
|
||||
this.cloneBefore(decl, `-webkit-${decl.prop}`, webkitClean)
|
||||
}
|
||||
this.cloneBefore(decl, decl.prop, webkitClean)
|
||||
if (declPrefixes.includes('-o-')) {
|
||||
let operaClean = this.stringify(this.cleanFromUnprefixed(params, '-o-'))
|
||||
this.cloneBefore(decl, `-o-${decl.prop}`, operaClean)
|
||||
}
|
||||
|
||||
for (prefix of declPrefixes) {
|
||||
if (prefix !== '-webkit-' && prefix !== '-o-') {
|
||||
let prefixValue = this.stringify(
|
||||
this.cleanOtherPrefixes(params, prefix)
|
||||
)
|
||||
this.cloneBefore(decl, prefix + decl.prop, prefixValue)
|
||||
}
|
||||
}
|
||||
|
||||
if (value !== decl.value && !this.already(decl, decl.prop, value)) {
|
||||
this.checkForWarning(result, decl)
|
||||
decl.cloneBefore()
|
||||
decl.value = value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does we already have this declaration
|
||||
*/
|
||||
already(decl, prop, value) {
|
||||
return decl.parent.some(i => i.prop === prop && i.value === value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Show transition-property warning
|
||||
*/
|
||||
checkForWarning(result, decl) {
|
||||
if (decl.prop !== 'transition-property') {
|
||||
return
|
||||
}
|
||||
|
||||
let isPrefixed = false
|
||||
let hasAssociatedProp = false
|
||||
|
||||
decl.parent.each(i => {
|
||||
if (i.type !== 'decl') {
|
||||
return undefined
|
||||
}
|
||||
if (i.prop.indexOf('transition-') !== 0) {
|
||||
return undefined
|
||||
}
|
||||
let values = list.comma(i.value)
|
||||
// check if current Rule's transition-property comma separated value list needs prefixes
|
||||
if (i.prop === 'transition-property') {
|
||||
values.forEach(value => {
|
||||
let lookup = this.prefixes.add[value]
|
||||
if (lookup && lookup.prefixes && lookup.prefixes.length > 0) {
|
||||
isPrefixed = true
|
||||
}
|
||||
})
|
||||
return undefined
|
||||
}
|
||||
// check if another transition-* prop in current Rule has comma separated value list
|
||||
hasAssociatedProp = hasAssociatedProp || values.length > 1
|
||||
return false
|
||||
})
|
||||
|
||||
if (isPrefixed && hasAssociatedProp) {
|
||||
decl.warn(
|
||||
result,
|
||||
'Replace transition-property to transition, ' +
|
||||
'because Autoprefixer could not support ' +
|
||||
'any cases of transition-property ' +
|
||||
'and other transition-*'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all non-webkit prefixes and unprefixed params if we have prefixed
|
||||
*/
|
||||
cleanFromUnprefixed(params, prefix) {
|
||||
let remove = params
|
||||
.map(i => this.findProp(i))
|
||||
.filter(i => i.slice(0, prefix.length) === prefix)
|
||||
.map(i => this.prefixes.unprefixed(i))
|
||||
|
||||
let result = []
|
||||
for (let param of params) {
|
||||
let prop = this.findProp(param)
|
||||
let p = vendor.prefix(prop)
|
||||
if (!remove.includes(prop) && (p === prefix || p === '')) {
|
||||
result.push(param)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
cleanOtherPrefixes(params, prefix) {
|
||||
return params.filter(param => {
|
||||
let current = vendor.prefix(this.findProp(param))
|
||||
return current === '' || current === prefix
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return new param array with different name
|
||||
*/
|
||||
clone(origin, name, param) {
|
||||
let result = []
|
||||
let changed = false
|
||||
for (let i of param) {
|
||||
if (!changed && i.type === 'word' && i.value === origin) {
|
||||
result.push({ type: 'word', value: name })
|
||||
changed = true
|
||||
} else {
|
||||
result.push(i)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Add declaration if it is not exist
|
||||
*/
|
||||
cloneBefore(decl, prop, value) {
|
||||
if (!this.already(decl, prop, value)) {
|
||||
decl.cloneBefore({ prop, value })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check property for disabled by option
|
||||
*/
|
||||
disabled(prop, prefix) {
|
||||
let other = ['order', 'justify-content', 'align-self', 'align-content']
|
||||
if (prop.includes('flex') || other.includes(prop)) {
|
||||
if (this.prefixes.options.flexbox === false) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.prefixes.options.flexbox === 'no-2009') {
|
||||
return prefix.includes('2009')
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Find or create separator
|
||||
*/
|
||||
div(params) {
|
||||
for (let param of params) {
|
||||
for (let node of param) {
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
return { after: ' ', type: 'div', value: ',' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Find property name
|
||||
*/
|
||||
findProp(param) {
|
||||
let prop = param[0].value
|
||||
if (/^\d/.test(prop)) {
|
||||
for (let [i, token] of param.entries()) {
|
||||
if (i !== 0 && token.type === 'word') {
|
||||
return token.value
|
||||
}
|
||||
}
|
||||
}
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse properties list to array
|
||||
*/
|
||||
parse(value) {
|
||||
let ast = parser(value)
|
||||
let result = []
|
||||
let param = []
|
||||
for (let node of ast.nodes) {
|
||||
param.push(node)
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
result.push(param)
|
||||
param = []
|
||||
}
|
||||
}
|
||||
result.push(param)
|
||||
return result.filter(i => i.length > 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process transition and remove all unnecessary properties
|
||||
*/
|
||||
remove(decl) {
|
||||
let params = this.parse(decl.value)
|
||||
params = params.filter(i => {
|
||||
let prop = this.prefixes.remove[this.findProp(i)]
|
||||
return !prop || !prop.remove
|
||||
})
|
||||
let value = this.stringify(params)
|
||||
|
||||
if (decl.value === value) {
|
||||
return
|
||||
}
|
||||
|
||||
if (params.length === 0) {
|
||||
decl.remove()
|
||||
return
|
||||
}
|
||||
|
||||
let double = decl.parent.some(i => {
|
||||
return i.prop === decl.prop && i.value === value
|
||||
})
|
||||
let smaller = decl.parent.some(i => {
|
||||
return i !== decl && i.prop === decl.prop && i.value.length > value.length
|
||||
})
|
||||
|
||||
if (double || smaller) {
|
||||
decl.remove()
|
||||
return
|
||||
}
|
||||
|
||||
decl.value = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if transition prop is inside vendor specific rule
|
||||
*/
|
||||
ruleVendorPrefixes(decl) {
|
||||
let { parent } = decl
|
||||
|
||||
if (parent.type !== 'rule') {
|
||||
return false
|
||||
} else if (!parent.selector.includes(':-')) {
|
||||
return false
|
||||
}
|
||||
|
||||
let selectors = Browsers.prefixes().filter(s =>
|
||||
parent.selector.includes(':' + s)
|
||||
)
|
||||
|
||||
return selectors.length > 0 ? selectors : false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return properties string from array
|
||||
*/
|
||||
stringify(params) {
|
||||
if (params.length === 0) {
|
||||
return ''
|
||||
}
|
||||
let nodes = []
|
||||
for (let param of params) {
|
||||
if (param[param.length - 1].type !== 'div') {
|
||||
param.push(this.div(params))
|
||||
}
|
||||
nodes = nodes.concat(param)
|
||||
}
|
||||
if (nodes[0].type === 'div') {
|
||||
nodes = nodes.slice(1)
|
||||
}
|
||||
if (nodes[nodes.length - 1].type === 'div') {
|
||||
nodes = nodes.slice(0, +-2 + 1 || undefined)
|
||||
}
|
||||
return parser.stringify({ nodes })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Transition
|
||||
93
node_modules/autoprefixer/lib/utils.js
generated
vendored
Normal file
93
node_modules/autoprefixer/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
let { list } = require('postcss')
|
||||
|
||||
/**
|
||||
* Throw special error, to tell beniary,
|
||||
* that this error is from Autoprefixer.
|
||||
*/
|
||||
module.exports.error = function (text) {
|
||||
let err = new Error(text)
|
||||
err.autoprefixer = true
|
||||
throw err
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array, that doesn’t contain duplicates.
|
||||
*/
|
||||
module.exports.uniq = function (array) {
|
||||
return [...new Set(array)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Return "-webkit-" on "-webkit- old"
|
||||
*/
|
||||
module.exports.removeNote = function (string) {
|
||||
if (!string.includes(' ')) {
|
||||
return string
|
||||
}
|
||||
|
||||
return string.split(' ')[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape RegExp symbols
|
||||
*/
|
||||
module.exports.escapeRegexp = function (string) {
|
||||
return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return regexp to check, that CSS string contain word
|
||||
*/
|
||||
module.exports.regexp = function (word, escape = true) {
|
||||
if (escape) {
|
||||
word = this.escapeRegexp(word)
|
||||
}
|
||||
return new RegExp(`(^|[\\s,(])(${word}($|[\\s(,]))`, 'gi')
|
||||
}
|
||||
|
||||
/**
|
||||
* Change comma list
|
||||
*/
|
||||
module.exports.editList = function (value, callback) {
|
||||
let origin = list.comma(value)
|
||||
let changed = callback(origin, [])
|
||||
|
||||
if (origin === changed) {
|
||||
return value
|
||||
}
|
||||
|
||||
let join = value.match(/,\s*/)
|
||||
join = join ? join[0] : ', '
|
||||
return changed.join(join)
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the selector into parts.
|
||||
* It returns 3 level deep array because selectors can be comma
|
||||
* separated (1), space separated (2), and combined (3)
|
||||
* @param {String} selector selector string
|
||||
* @return {Array<Array<Array>>} 3 level deep array of split selector
|
||||
* @see utils.test.js for examples
|
||||
*/
|
||||
module.exports.splitSelector = function (selector) {
|
||||
return list.comma(selector).map(i => {
|
||||
return list.space(i).map(k => {
|
||||
return k.split(/(?=\.|#)/g)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if a given value only contains numbers.
|
||||
* @param {*} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
module.exports.isPureNumber = function (value) {
|
||||
if (typeof value === 'number') {
|
||||
return true
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
return /^[0-9]+$/.test(value)
|
||||
}
|
||||
return false
|
||||
}
|
||||
125
node_modules/autoprefixer/lib/value.js
generated
vendored
Normal file
125
node_modules/autoprefixer/lib/value.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
let OldValue = require('./old-value')
|
||||
let Prefixer = require('./prefixer')
|
||||
let utils = require('./utils')
|
||||
let vendor = require('./vendor')
|
||||
|
||||
class Value extends Prefixer {
|
||||
/**
|
||||
* Clone decl for each prefixed values
|
||||
*/
|
||||
static save(prefixes, decl) {
|
||||
let prop = decl.prop
|
||||
let result = []
|
||||
|
||||
for (let prefix in decl._autoprefixerValues) {
|
||||
let value = decl._autoprefixerValues[prefix]
|
||||
|
||||
if (value === decl.value) {
|
||||
continue
|
||||
}
|
||||
|
||||
let item
|
||||
let propPrefix = vendor.prefix(prop)
|
||||
|
||||
if (propPrefix === '-pie-') {
|
||||
continue
|
||||
}
|
||||
|
||||
if (propPrefix === prefix) {
|
||||
item = decl.value = value
|
||||
result.push(item)
|
||||
continue
|
||||
}
|
||||
|
||||
let prefixed = prefixes.prefixed(prop, prefix)
|
||||
let rule = decl.parent
|
||||
|
||||
if (!rule.every(i => i.prop !== prefixed)) {
|
||||
result.push(item)
|
||||
continue
|
||||
}
|
||||
|
||||
let trimmed = value.replace(/\s+/, ' ')
|
||||
let already = rule.some(
|
||||
i => i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed
|
||||
)
|
||||
|
||||
if (already) {
|
||||
result.push(item)
|
||||
continue
|
||||
}
|
||||
|
||||
let cloned = this.clone(decl, { value })
|
||||
item = decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
result.push(item)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Save values with next prefixed token
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
if (!decl._autoprefixerValues) {
|
||||
decl._autoprefixerValues = {}
|
||||
}
|
||||
let value = decl._autoprefixerValues[prefix] || this.value(decl)
|
||||
|
||||
let before
|
||||
do {
|
||||
before = value
|
||||
value = this.replace(value, prefix)
|
||||
if (value === false) return
|
||||
} while (value !== before)
|
||||
|
||||
decl._autoprefixerValues[prefix] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Is declaration need to be prefixed
|
||||
*/
|
||||
check(decl) {
|
||||
let value = decl.value
|
||||
if (!value.includes(this.name)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return !!value.match(this.regexp())
|
||||
}
|
||||
|
||||
/**
|
||||
* Return function to fast find prefixed value
|
||||
*/
|
||||
old(prefix) {
|
||||
return new OldValue(this.name, prefix + this.name)
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy regexp loading
|
||||
*/
|
||||
regexp() {
|
||||
return this.regexpCache || (this.regexpCache = utils.regexp(this.name))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefix to values in string
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
return string.replace(this.regexp(), `$1${prefix}$2`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value with comments if it was not changed
|
||||
*/
|
||||
value(decl) {
|
||||
if (decl.raws.value && decl.raws.value.value === decl.value) {
|
||||
return decl.raws.value.raw
|
||||
} else {
|
||||
return decl.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Value
|
||||
14
node_modules/autoprefixer/lib/vendor.js
generated
vendored
Normal file
14
node_modules/autoprefixer/lib/vendor.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
prefix(prop) {
|
||||
let match = prop.match(/^(-\w+-)/)
|
||||
if (match) {
|
||||
return match[0]
|
||||
}
|
||||
|
||||
return ''
|
||||
},
|
||||
|
||||
unprefixed(prop) {
|
||||
return prop.replace(/^-\w+-/, '')
|
||||
}
|
||||
}
|
||||
49
node_modules/autoprefixer/package.json
generated
vendored
Normal file
49
node_modules/autoprefixer/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "autoprefixer",
|
||||
"version": "10.4.21",
|
||||
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
},
|
||||
"keywords": [
|
||||
"autoprefixer",
|
||||
"css",
|
||||
"prefix",
|
||||
"postcss",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"main": "lib/autoprefixer.js",
|
||||
"bin": "bin/autoprefixer",
|
||||
"types": "lib/autoprefixer.d.ts",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/autoprefixer"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"repository": "postcss/autoprefixer",
|
||||
"bugs": {
|
||||
"url": "https://github.com/postcss/autoprefixer/issues"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"browserslist": "^4.24.4",
|
||||
"caniuse-lite": "^1.0.30001702",
|
||||
"fraction.js": "^4.3.7",
|
||||
"normalize-range": "^0.1.2",
|
||||
"picocolors": "^1.1.1",
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
}
|
||||
}
|
||||
201
node_modules/baseline-browser-mapping/LICENSE.txt
generated
vendored
Normal file
201
node_modules/baseline-browser-mapping/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
431
node_modules/baseline-browser-mapping/README.md
generated
vendored
Normal file
431
node_modules/baseline-browser-mapping/README.md
generated
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
# [`baseline-browser-mapping`](https://github.com/web-platform-dx/web-features/packages/baseline-browser-mapping)
|
||||
|
||||
By the [W3C WebDX Community Group](https://www.w3.org/community/webdx/) and contributors.
|
||||
|
||||
`baseline-browser-mapping` provides:
|
||||
|
||||
- An `Array` of browsers compatible with Baseline Widely available and Baseline year feature sets via the [`getCompatibleVersions()` function](#get-baseline-widely-available-browser-versions-or-baseline-year-browser-versions).
|
||||
- An `Array`, `Object` or `CSV` as a string describing the Baseline feature set support of all browser versions included in the module's data set via the [`getAllVersions()` function](#get-data-for-all-browser-versions).
|
||||
|
||||
You can use `baseline-browser-mapping` to help you determine minimum browser version support for your chosen Baseline feature set; or to analyse the level of support for different Baseline feature sets in your site's traffic by joining the data with your analytics data.
|
||||
|
||||
## Install for local development
|
||||
|
||||
To install the package, run:
|
||||
|
||||
`npm install --save-dev baseline-browser-mapping`
|
||||
|
||||
`baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for core browser version selection, but the data is pre-packaged and minified. This package checks for updates to those modules and the supported [downstream browsers](#downstream-browsers) on a daily basis and is updated frequently. Consider adding a script to your `package.json` to update `basesline-browser-mapping` and using it as part of your build process to ensure your data is as up to date as possible:
|
||||
|
||||
```javascript
|
||||
"scripts": [
|
||||
"refresh-baseline-browser-mapping": "npm i --save-dev baseline-browser-mapping@latest"
|
||||
]
|
||||
```
|
||||
|
||||
If your installed version of `baseline-browser-mapping` is greater than 2 months old, you will receive a console warning advising you to update to the latest version.
|
||||
|
||||
## Importing `baseline-browser-mapping`
|
||||
|
||||
This module exposes two functions: `getCompatibleVersions()` and `getAllVersions()`, both which can be imported directly from `baseline-browser-mapping`:
|
||||
|
||||
```javascript
|
||||
import {
|
||||
getCompatibleVersions,
|
||||
getAllVersions,
|
||||
} from "baseline-browser-mapping";
|
||||
```
|
||||
|
||||
If you want to load the script and data directly in a web page without hosting it yourself, consider using a CDN:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {
|
||||
getCompatibleVersions,
|
||||
getAllVersions,
|
||||
} from "https://cdn.jsdelivr.net/npm/baseline-browser-mapping";
|
||||
</script>
|
||||
```
|
||||
|
||||
## Get Baseline Widely available browser versions or Baseline year browser versions
|
||||
|
||||
To get the current list of minimum browser versions compatible with Baseline Widely available features from the core browser set, call the `getCompatibleVersions()` function:
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions();
|
||||
```
|
||||
|
||||
Executed on 7th March 2025, the above code returns the following browser versions:
|
||||
|
||||
```javascript
|
||||
[
|
||||
{ browser: "chrome", version: "105", release_date: "2022-09-02" },
|
||||
{
|
||||
browser: "chrome_android",
|
||||
version: "105",
|
||||
release_date: "2022-09-02",
|
||||
},
|
||||
{ browser: "edge", version: "105", release_date: "2022-09-02" },
|
||||
{ browser: "firefox", version: "104", release_date: "2022-08-23" },
|
||||
{
|
||||
browser: "firefox_android",
|
||||
version: "104",
|
||||
release_date: "2022-08-23",
|
||||
},
|
||||
{ browser: "safari", version: "15.6", release_date: "2022-09-02" },
|
||||
{
|
||||
browser: "safari_ios",
|
||||
version: "15.6",
|
||||
release_date: "2022-09-02",
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The minimum versions of each browser are not necessarily the final release before the Widely available cutoff date of `TODAY - 30 MONTHS`. Some earlier versions will have supported the full Widely available feature set.
|
||||
|
||||
### `getCompatibleVersions()` configuration options
|
||||
|
||||
`getCompatibleVersions()` accepts an `Object` as an argument with configuration options. The defaults are as follows:
|
||||
|
||||
```javascript
|
||||
{
|
||||
targetYear: undefined,
|
||||
widelyAvailableOnDate: undefined,
|
||||
includeDownstreamBrowsers: false,
|
||||
listAllCompatibleVersions: false
|
||||
}
|
||||
```
|
||||
|
||||
#### `targetYear`
|
||||
|
||||
The `targetYear` option returns the minimum browser versions compatible with all **Baseline Newly available** features at the end of the specified calendar year. For example, calling:
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions({
|
||||
targetYear: 2020,
|
||||
});
|
||||
```
|
||||
|
||||
Returns the following versions:
|
||||
|
||||
```javascript
|
||||
[
|
||||
{ browser: "chrome", version: "87", release_date: "2020-11-19" },
|
||||
{
|
||||
browser: "chrome_android",
|
||||
version: "87",
|
||||
release_date: "2020-11-19",
|
||||
},
|
||||
{ browser: "edge", version: "87", release_date: "2020-11-19" },
|
||||
{ browser: "firefox", version: "83", release_date: "2020-11-17" },
|
||||
{
|
||||
browser: "firefox_android",
|
||||
version: "83",
|
||||
release_date: "2020-11-17",
|
||||
},
|
||||
{ browser: "safari", version: "14", release_date: "2020-09-16" },
|
||||
{ browser: "safari_ios", version: "14", release_date: "2020-09-16" },
|
||||
];
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The minimum version of each browser is not necessarily the final version released in that calendar year. In the above example, Firefox 84 was the final version released in 2020; however Firefox 83 supported all of the features that were interoperable at the end of 2020.
|
||||
> [!WARNING]
|
||||
> You cannot use `targetYear` and `widelyAavailableDate` together. Please only use one of these options at a time.
|
||||
|
||||
#### `widelyAvailableOnDate`
|
||||
|
||||
The `widelyAvailableOnDate` option returns the minimum versions compatible with Baseline Widely available on a specified date in the format `YYYY-MM-DD`:
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions({
|
||||
widelyAvailableOnDate: `2023-04-05`,
|
||||
});
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> This option is useful if you provide a versioned library that targets Baseline Widely available on each version's release date and you need to provide a statement on minimum supported browser versions in your documentation.
|
||||
|
||||
#### `includeDownstreamBrowsers`
|
||||
|
||||
Setting `includeDownstreamBrowsers` to `true` will include browsers outside of the Baseline core browser set where it is possible to map those browsers to an upstream Chromium or Gecko version:
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions({
|
||||
includeDownstreamBrowsers: true,
|
||||
});
|
||||
```
|
||||
|
||||
For more information on downstream browsers, see [the section on downstream browsers](#downstream-browsers) below.
|
||||
|
||||
#### `includeKaiOS`
|
||||
|
||||
KaiOS is an operating system and app framework based on the Gecko engine from Firefox. KaiOS is based on the Gecko engine and feature support can be derived from the upstream Gecko version that each KaiOS version implements. However KaiOS requires other considerations beyond feature compatibility to ensure a good user experience as it runs on device types that do not have either mouse and keyboard or touch screen input in the way that all the other browsers supported by this module do.
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions({
|
||||
includeDownstreamBrowsers: true,
|
||||
includeKaiOS: true,
|
||||
});
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Including KaiOS requires you to include all downstream browsers using the `includeDownstreamBrowsers` option.
|
||||
|
||||
#### `listAllCompatibleVersions`
|
||||
|
||||
Setting `listAllCompatibleVersions` to true will include the minimum versions of each compatible browser, and all the subsequent versions:
|
||||
|
||||
```javascript
|
||||
getCompatibleVersions({
|
||||
listAllCompatibleVersions: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Get data for all browser versions
|
||||
|
||||
You may want to obtain data on all the browser versions available in this module for use in an analytics solution or dashboard. To get details of each browser version's level of Baseline support, call the `getAllVersions()` function:
|
||||
|
||||
```javascript
|
||||
import { getAllVersions } from "baseline-browser-mapping";
|
||||
|
||||
getAllVersions();
|
||||
```
|
||||
|
||||
By default, this function returns an `Array` of `Objects` and excludes downstream browsers:
|
||||
|
||||
```javascript
|
||||
[
|
||||
...
|
||||
{
|
||||
browser: "firefox_android", // Browser name
|
||||
version: "125", // Browser version
|
||||
release_date: "2024-04-16", // Release date
|
||||
year: 2023, // Baseline year feature set the version supports
|
||||
wa_compatible: true // Whether the browser version supports Widely available
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
For browser versions in `@mdn/browser-compat-data` that were released before Baseline can be defined, i.e. Baseline 2015, the `year` property is always the string: `"pre_baseline"`.
|
||||
|
||||
### Understanding which browsers support Newly available features
|
||||
|
||||
You may want to understand which recent browser versions support all Newly available features. You can replace the `wa_compatible` property with a `supports` property using the `useSupport` option:
|
||||
|
||||
```javascript
|
||||
getAllVersions({
|
||||
useSupports: true,
|
||||
});
|
||||
```
|
||||
|
||||
The `supports` property is optional and has two possible values:
|
||||
|
||||
- `widely` for browser versions that support all Widely available features.
|
||||
- `newly` for browser versions that support all Newly available features.
|
||||
|
||||
Browser versions that do not support Widely or Newly available will not include the `support` property in the `array` or `object` outputs, and in the CSV output, the `support` column will contain an empty string. Browser versions that support all Newly available features also support all Widely available features.
|
||||
|
||||
### `getAllVersions()` Configuration options
|
||||
|
||||
`getAllVersions()` accepts an `Object` as an argument with configuration options. The defaults are as follows:
|
||||
|
||||
```javascript
|
||||
{
|
||||
includeDownstreamBrowsers: false,
|
||||
outputFormat: "array"
|
||||
}
|
||||
```
|
||||
|
||||
#### `includeDownstreamBrowsers` (in `getAllVersions()` output)
|
||||
|
||||
As with `getCompatibleVersions()`, you can set `includeDownstreamBrowsers` to `true` to include the Chromium and Gecko downstream browsers [listed below](#list-of-downstream-browsers).
|
||||
|
||||
```javascript
|
||||
getAllVersions({
|
||||
includeDownstreamBrowsers: true,
|
||||
});
|
||||
```
|
||||
|
||||
Downstream browsers include the same properties as core browsers, as well as the `engine`they use and `engine_version`, for example:
|
||||
|
||||
```javascript
|
||||
[
|
||||
...
|
||||
{
|
||||
browser: "samsunginternet_android",
|
||||
version: "27.0",
|
||||
release_date: "2024-11-06",
|
||||
engine: "Blink",
|
||||
engine_version: "125",
|
||||
year: 2023,
|
||||
supports: "widely"
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
#### `includeKaiOS` (in `getAllVersions()` output)
|
||||
|
||||
As with `getCompatibleVersions()` you can include KaiOS in your output. The same requirement to have `includeDownstreamBrowsers: true` applies.
|
||||
|
||||
```javascript
|
||||
getAllVersions({
|
||||
includeDownstreamBrowsers: true,
|
||||
includeKaiOS: true,
|
||||
});
|
||||
```
|
||||
|
||||
#### `outputFormat`
|
||||
|
||||
By default, this function returns an `Array` of `Objects` which can be manipulated in Javascript or output to JSON.
|
||||
|
||||
To return an `Object` that nests keys , set `outputFormat` to `object`:
|
||||
|
||||
```javascript
|
||||
getAllVersions({
|
||||
outputFormat: "object",
|
||||
});
|
||||
```
|
||||
|
||||
In thise case, `getAllVersions()` returns a nested object with the browser [IDs listed below](#list-of-downstream-browsers) as keys, and versions as keys within them:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"chrome": {
|
||||
"53": {
|
||||
"year": 2016,
|
||||
"release_date": "2016-09-07"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Downstream browsers will include extra fields for `engine` and `engine_versions`
|
||||
|
||||
```javascript
|
||||
{
|
||||
...
|
||||
"webview_android": {
|
||||
"53": {
|
||||
"year": 2016,
|
||||
"release_date": "2016-09-07",
|
||||
"engine": "Blink",
|
||||
"engine_version": "53"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
To return a `String` in CSV format, set `outputFormat` to `csv`:
|
||||
|
||||
```javascript
|
||||
getAllVersions({
|
||||
outputFormat: "csv",
|
||||
});
|
||||
```
|
||||
|
||||
`getAllVersions` returns a `String` with a header row and comma-separated values for each browser version that you can write to a file or pass to another service. Core browsers will have "NULL" as the value for their `engine` and `engine_version`:
|
||||
|
||||
```csv
|
||||
"browser","version","year","supports","release_date","engine","engine_version"
|
||||
...
|
||||
"chrome","24","pre_baseline","","2013-01-10","NULL","NULL"
|
||||
...
|
||||
"chrome","53","2016","","2016-09-07","NULL","NULL"
|
||||
...
|
||||
"firefox","135","2024","widely","2025-02-04","NULL","NULL"
|
||||
"firefox","136","2024","newly","2025-03-04","NULL","NULL"
|
||||
...
|
||||
"ya_android","20.12","2020","year_only","2020-12-20","Blink","87"
|
||||
...
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The above example uses `"includeDownstreamBrowsers": true`
|
||||
|
||||
### Static resources
|
||||
|
||||
The outputs of `getAllVersions()` are available as JSON or CSV files generated on a daily basis and hosted on GitHub pages:
|
||||
|
||||
- Core browsers only
|
||||
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_array.json)
|
||||
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_object.json)
|
||||
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions.csv)
|
||||
- Core browsers only, with `supports` property
|
||||
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_array_with_supports.json)
|
||||
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_object_with_supports.json)
|
||||
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_with_supports.csv)
|
||||
- Including downstream browsers
|
||||
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_array.json)
|
||||
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_object.json)
|
||||
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions.csv)
|
||||
- Including downstream browsers with `supports` property
|
||||
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_array_with_supports.json)
|
||||
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_object_with_supports.json)
|
||||
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_with_supports.csv)
|
||||
|
||||
These files are updated on a daily basis.
|
||||
|
||||
## CLI
|
||||
|
||||
`baseline-browser-mapping` includes a command line interface that exposes the same data and options as the `getCompatibleVersions()` function. To learn more about using the CLI, run:
|
||||
|
||||
```sh
|
||||
npx baseline-browser-mapping --help
|
||||
```
|
||||
|
||||
## Downstream browsers
|
||||
|
||||
### Limitations
|
||||
|
||||
The browser versions in this module come from two different sources:
|
||||
|
||||
- MDN's `browser-compat-data` module.
|
||||
- Parsed user agent strings provided by [useragents.io](https://useragents.io/)
|
||||
|
||||
MDN `browser-compat-data` is an authoritative source of information for the browsers it contains. The release dates for the Baseline core browser set and the mapping of downstream browsers to Chromium versions should be considered accurate.
|
||||
|
||||
Browser mappings from useragents.io are provided on a best effort basis. They assume that browser vendors are accurately stating the Chromium version they have implemented. The initial set of version mappings was derived from a bulk export in November 2024. This version was iterated over with a Regex match looking for a major Chrome version and a corresponding version of the browser in question, e.g.:
|
||||
|
||||
`Mozilla/5.0 (Linux; U; Android 10; en-US; STK-L21 Build/HUAWEISTK-L21) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.58 UCBrowser/13.8.2.1324 Mobile Safari/537.36`
|
||||
|
||||
Shows UC Browser Mobile 13.8 implementing Chromium 100, and:
|
||||
|
||||
`Mozilla/5.0 (Linux; arm_64; Android 11; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.123 YaBrowser/24.10.2.123.00 SA/3 Mobile Safari/537.36`
|
||||
|
||||
Shows Yandex Browser Mobile 24.10 implementing Chromium 128. The Chromium version from this string is mapped to the corresponding Chrome version from MDN `browser-compat-data`.
|
||||
|
||||
> [!NOTE]
|
||||
> Where possible, approximate release dates have been included based on useragents.io "first seen" data. useragents.io does not have "first seen" dates prior to June 2020. However, these browsers' Baseline compatibility is determined by their Chromium or Gecko version, so their release dates are more informative than critical.
|
||||
|
||||
This data is updated on a daily basis using a [script](https://github.com/web-platform-dx/web-features/tree/main/scripts/refresh-downstream.ts) triggered by a GitHub [action](https://github.com/web-platform-dx/web-features/tree/main/.github/workflows/refresh_downstream.yml). Useragents.io provides a private API for this module which exposes the last 7 days of newly seen user agents for the currently tracked browsers. If a new major version of one of the tracked browsers is encountered with a Chromium version that meets or exceeds the previous latest version of that browser, it is added to the [src/data/downstream-browsers.json](src/data/downstream-browsers.json) file with the date it was first seen by useragents.io as its release date.
|
||||
|
||||
KaiOS is an exception - its upstream version mappings are handled separately from the other browsers because they happen very infrequently.
|
||||
|
||||
### List of downstream browsers
|
||||
|
||||
| Browser | ID | Core | Source |
|
||||
| --------------------- | ------------------------- | ------- | ------------------------- |
|
||||
| Chrome | `chrome` | `true` | MDN `browser-compat-data` |
|
||||
| Chrome for Android | `chrome_android` | `true` | MDN `browser-compat-data` |
|
||||
| Edge | `edge` | `true` | MDN `browser-compat-data` |
|
||||
| Firefox | `firefox` | `true` | MDN `browser-compat-data` |
|
||||
| Firefox for Android | `firefox_android` | `true` | MDN `browser-compat-data` |
|
||||
| Safari | `safari` | `true` | MDN `browser-compat-data` |
|
||||
| Safari on iOS | `safari_ios` | `true` | MDN `browser-compat-data` |
|
||||
| Opera | `opera` | `false` | MDN `browser-compat-data` |
|
||||
| Opera Android | `opera_android` | `false` | MDN `browser-compat-data` |
|
||||
| Samsung Internet | `samsunginternet_android` | `false` | MDN `browser-compat-data` |
|
||||
| WebView Android | `webview_android` | `false` | MDN `browser-compat-data` |
|
||||
| QQ Browser Mobile | `qq_android` | `false` | useragents.io |
|
||||
| UC Browser Mobile | `uc_android` | `false` | useragents.io |
|
||||
| Yandex Browser Mobile | `ya_android` | `false` | useragents.io |
|
||||
| KaiOS | `kai_os` | `false` | Manual |
|
||||
| Facebook for Android | `facebook_android` | `false` | useragents.io |
|
||||
| Instagram for Android | `instagram_android` | `false` | useragents.io |
|
||||
|
||||
> [!NOTE]
|
||||
> All the non-core browsers currently included implement Chromium or Gecko. Their inclusion in any of the above methods is based on the Baseline feature set supported by the Chromium or Gecko version they implement, not their release date.
|
||||
2
node_modules/baseline-browser-mapping/dist/cli.js
generated
vendored
Executable file
2
node_modules/baseline-browser-mapping/dist/cli.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import{parseArgs as e}from"node:util";import{exit as a}from"node:process";import{getCompatibleVersions as s}from"./index.js";const n=process.argv.slice(2),{values:o}=e({args:n,options:{"target-year":{type:"string"},"widely-available-on-date":{type:"string"},"include-downstream-browsers":{type:"boolean"},"list-all-compatible-versions":{type:"boolean"},"include-kaios":{type:"boolean"},help:{type:"boolean",short:"h"}},strict:!0});o.help&&(console.log("\nGet Baseline Widely available browser versions or Baseline year browser versions.\n\nUsage: baseline-browser-mapping [options]\n\nOptions:\n --target-year Pass a year between 2015 and the current year to get browser versions compatible \n with all Newly Available features as of the end of the year specified.\n --widely-available-on-date Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely \n available on the specified date.\n --include-downstream-browsers Whether to include browsers that use the same engines as a core Baseline browser.\n --include-kaios Whether to include KaiOS in downstream browsers. Requires --include-downstream-browsers.\n --list-all-compatible-versions Whether to include only the minimum compatible browser versions or all compatible versions.\n -h, --help Show help\n\nExamples:\n npx baseline-browser-mapping --target-year 2020\n npx baseline-browser-mapping --widely-available-on-date 2023-04-05\n npx baseline-browser-mapping --include-downstream-browsers\n npx baseline-browser-mapping --list-all-compatible-versions\n".trim()),a(0)),console.log(s({targetYear:o["target-year"]?Number.parseInt(o["target-year"]):void 0,widelyAvailableOnDate:o["widely-available-on-date"],includeDownstreamBrowsers:o["include-downstream-browsers"],listAllCompatibleVersions:o["list-all-compatible-versions"],includeKaiOS:o["include-kaios"]}));
|
||||
1
node_modules/baseline-browser-mapping/dist/index.cjs
generated
vendored
Normal file
1
node_modules/baseline-browser-mapping/dist/index.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
node_modules/baseline-browser-mapping/dist/index.d.ts
generated
vendored
Normal file
90
node_modules/baseline-browser-mapping/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
type BrowserVersion = {
|
||||
browser: string;
|
||||
version: string;
|
||||
release_date?: string;
|
||||
engine?: string;
|
||||
engine_version?: string;
|
||||
};
|
||||
interface AllBrowsersBrowserVersion extends BrowserVersion {
|
||||
year: number | string;
|
||||
supports?: string;
|
||||
wa_compatible?: boolean;
|
||||
}
|
||||
type NestedBrowserVersions = {
|
||||
[browser: string]: {
|
||||
[version: string]: AllBrowsersBrowserVersion;
|
||||
};
|
||||
};
|
||||
type Options = {
|
||||
/**
|
||||
* Whether to include only the minimum compatible browser versions or all compatible versions.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
listAllCompatibleVersions?: boolean;
|
||||
/**
|
||||
* Whether to include browsers that use the same engines as a core Baseline browser.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
includeDownstreamBrowsers?: boolean;
|
||||
/**
|
||||
* Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely available on the specified date.
|
||||
* If left undefined and a `targetYear` is not passed, defaults to Widely available as of the current date.
|
||||
* > NOTE: cannot be used with `targetYear`.
|
||||
*/
|
||||
widelyAvailableOnDate?: string | number;
|
||||
/**
|
||||
* Pass a year between 2015 and the current year to get browser versions compatible with all
|
||||
* Newly Available features as of the end of the year specified.
|
||||
* > NOTE: cannot be used with `widelyAvailableOnDate`.
|
||||
*/
|
||||
targetYear?: number;
|
||||
/**
|
||||
* Pass a boolean that determines whether KaiOS is included in browser mappings. KaiOS implements
|
||||
* the Gecko engine used in Firefox. However, KaiOS also has a different interaction paradigm to
|
||||
* other browsers and requires extra consideration beyond simple feature compatibility to provide
|
||||
* an optimal user experience. Defaults to `false`.
|
||||
*/
|
||||
includeKaiOS?: boolean;
|
||||
};
|
||||
/**
|
||||
* Returns browser versions compatible with specified Baseline targets.
|
||||
* Defaults to returning the minimum versions of the core browser set that support Baseline Widely available.
|
||||
* Takes an optional configuration `Object` with four optional properties:
|
||||
* - `listAllCompatibleVersions`: `false` (default) or `false`
|
||||
* - `includeDownstreamBrowsers`: `false` (default) or `false`
|
||||
* - `widelyAvailableOnDate`: date in format `YYYY-MM-DD`
|
||||
* - `targetYear`: year in format `YYYY`
|
||||
*/
|
||||
export declare function getCompatibleVersions(userOptions?: Options): BrowserVersion[];
|
||||
type AllVersionsOptions = {
|
||||
/**
|
||||
* Whether to return the output as a JavaScript `Array` (`"array"`), `Object` (`"object"`) or a CSV string (`"csv"`).
|
||||
* Defaults to `"array"`.
|
||||
*/
|
||||
outputFormat?: string;
|
||||
/**
|
||||
* Whether to include browsers that use the same engines as a core Baseline browser.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
includeDownstreamBrowsers?: boolean;
|
||||
/**
|
||||
* Whether to use the new "supports" property in place of "wa_compatible"
|
||||
* Defaults to `false`
|
||||
*/
|
||||
useSupports?: boolean;
|
||||
/**
|
||||
* Whether to include KaiOS in the output. KaiOS implements the Gecko engine used in Firefox.
|
||||
* However, KaiOS also has a different interaction paradigm to other browsers and requires extra
|
||||
* consideration beyond simple feature compatibility to provide an optimal user experience.
|
||||
*/
|
||||
includeKaiOS?: boolean;
|
||||
};
|
||||
/**
|
||||
* Returns all browser versions known to this module with their level of Baseline support as a JavaScript `Array` (`"array"`), `Object` (`"object"`) or a CSV string (`"csv"`).
|
||||
* Takes an optional configuration `Object` with three optional properties:
|
||||
* - `includeDownstreamBrowsers`: `true` (default) or `false`
|
||||
* - `outputFormat`: `"array"` (default), `"object"` or `"csv"`
|
||||
* - `useSupports`: `false` (default) or `true`, replaces `wa_compatible` property with optional `supports` property which returns `widely` or `newly` available when present.
|
||||
*/
|
||||
export declare function getAllVersions(userOptions?: AllVersionsOptions): AllBrowsersBrowserVersion[] | NestedBrowserVersions | string;
|
||||
export {};
|
||||
1
node_modules/baseline-browser-mapping/dist/index.js
generated
vendored
Normal file
1
node_modules/baseline-browser-mapping/dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
61
node_modules/baseline-browser-mapping/package.json
generated
vendored
Normal file
61
node_modules/baseline-browser-mapping/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "baseline-browser-mapping",
|
||||
"main": "./dist/index.cjs",
|
||||
"version": "2.8.16",
|
||||
"description": "A library for obtaining browser versions with their maximum supported Baseline feature set and Widely Available status.",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./legacy": {
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"jsdelivr": "./dist/index.js",
|
||||
"files": [
|
||||
"dist/*",
|
||||
"!dist/scripts/*",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"types": "./dist/index.d.ts",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"baseline-browser-mapping": "./dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"fix-cli-permissions": "output=$(npx baseline-browser-mapping 2>&1); path=$(printf '%s\n' \"$output\" | sed -n 's/^sh: \\(.*\\): Permission denied$/\\1/p'); if [ -n \"$path\" ]; then echo \"Permission denied for: $path\"; echo \"Removing $path ...\"; rm -rf \"$path\"; else echo \"$output\"; fi",
|
||||
"test:format": "npx prettier --check .",
|
||||
"test:lint": "npx eslint .",
|
||||
"test:bcb": "mkdir test-bcb && cd test-bcb && npm init -y && npm i ../../baseline-browser-mapping browserslist browserslist-config-baseline &&jq '. += {\"browserslist\":[\"extends browserslist-config-baseline\"]}' package.json >p && mv p package.json && npx browserslist && cd ../ && rm -rf test-bcb",
|
||||
"test:browserslist": "mkdir test-browserslist && cd test-browserslist && npm init -y && npm i ../../baseline-browser-mapping browserslist &&jq '. += {\"browserslist\":[\"baseline widely available with downstream\"]}' package.json >p && mv p package.json && npx browserslist && cd ../ && rm -rf test-browserslist",
|
||||
"test:jasmine": "npx jasmine",
|
||||
"test": "npm run build && npm run fix-cli-permissions && rm -rf test-browserslist test-bcb && npm run test:format && npm run test:lint && npx jasmine && npm run test:browserslist && npm run test:bcb",
|
||||
"build": "rm -rf dist; npx prettier . --write; rollup -c; rm -rf ./dist/scripts/expose-data.d.ts ./dist/cli.d.ts",
|
||||
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts",
|
||||
"refresh-static": "npx tsx scripts/refresh-static.ts",
|
||||
"update-data-file": "npx tsx scripts/update-data-file.ts; npx prettier ./src/data/data.js --write",
|
||||
"update-data-dependencies": "npm i @mdn/browser-compat-data@latest web-features@latest -D",
|
||||
"check-data-changes": "git diff --name-only | grep -q '^src/data/data.js$' && echo 'changes-available=TRUE' || echo 'changes-available=FALSE'"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^7.1.12",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.3",
|
||||
"@types/node": "^22.15.17",
|
||||
"eslint-plugin-new-with-error": "^5.0.0",
|
||||
"jasmine": "^5.8.0",
|
||||
"jasmine-spec-reporter": "^7.0.0",
|
||||
"prettier": "^3.5.3",
|
||||
"rollup": "^4.44.0",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"typescript-eslint": "^8.35.0",
|
||||
"web-features": "^3.4.0"
|
||||
},
|
||||
"repository": "git+https://github.com/web-platform-dx/baseline-browser-mapping.git"
|
||||
}
|
||||
20
node_modules/browserslist/LICENSE
generated
vendored
Normal file
20
node_modules/browserslist/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2014 Andrey Sitnik <andrey@sitnik.ru> and other contributors
|
||||
|
||||
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.
|
||||
65
node_modules/browserslist/README.md
generated
vendored
Normal file
65
node_modules/browserslist/README.md
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Browserslist
|
||||
|
||||
<img width="120" height="120" alt="Browserslist logo by Anton Popov"
|
||||
src="https://browsersl.ist/logo.svg" align="right">
|
||||
|
||||
The config to share target browsers and Node.js versions between different
|
||||
front-end tools. It is used in:
|
||||
|
||||
* [Autoprefixer]
|
||||
* [Babel]
|
||||
* [postcss-preset-env]
|
||||
* [eslint-plugin-compat]
|
||||
* [stylelint-no-unsupported-browser-features]
|
||||
* [postcss-normalize]
|
||||
* [obsolete-webpack-plugin]
|
||||
|
||||
All tools will find target browsers automatically,
|
||||
when you add the following to `package.json`:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"defaults and fully supports es6-module",
|
||||
"maintained node versions"
|
||||
]
|
||||
```
|
||||
|
||||
Or in `.browserslistrc` config:
|
||||
|
||||
```yaml
|
||||
# Browsers that we support
|
||||
|
||||
defaults and fully supports es6-module
|
||||
maintained node versions
|
||||
```
|
||||
|
||||
Developers set their version lists using queries like `last 2 versions`
|
||||
to be free from updating versions manually.
|
||||
Browserslist will use [`caniuse-lite`] with [Can I Use] data for this queries.
|
||||
|
||||
You can check how config works at our playground: [`browsersl.ist`](https://browsersl.ist/)
|
||||
|
||||
<a href="https://browsersl.ist/">
|
||||
<img src="/img/screenshot.webp" alt="browsersl.ist website">
|
||||
</a>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<div align="center">
|
||||
<a href="https://evilmartians.com/?utm_source=browserslist"><img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a> <a href="https://cube.dev/?ref=eco-browserslist-github"><img src="https://user-images.githubusercontent.com/986756/154330861-d79ab8ec-aacb-4af8-9e17-1b28f1eccb01.svg" alt="Supported by Cube" width="227" height="46"></a>
|
||||
</div>
|
||||
|
||||
[stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
|
||||
[obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
|
||||
[eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
|
||||
[Browserslist Example]: https://github.com/browserslist/browserslist-example
|
||||
[postcss-preset-env]: https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
|
||||
[postcss-normalize]: https://github.com/csstools/postcss-normalize
|
||||
[`browsersl.ist`]: https://browsersl.ist/
|
||||
[`caniuse-lite`]: https://github.com/ben-eb/caniuse-lite
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[Can I Use]: https://caniuse.com/
|
||||
[Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
|
||||
|
||||
## Docs
|
||||
Read full docs **[here](https://github.com/browserslist/browserslist#readme)**.
|
||||
54
node_modules/browserslist/browser.js
generated
vendored
Normal file
54
node_modules/browserslist/browser.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
function noop() {}
|
||||
|
||||
module.exports = {
|
||||
loadQueries: function loadQueries() {
|
||||
throw new BrowserslistError(
|
||||
'Sharable configs are not supported in client-side build of Browserslist'
|
||||
)
|
||||
},
|
||||
|
||||
getStat: function getStat(opts) {
|
||||
return opts.stats
|
||||
},
|
||||
|
||||
loadConfig: function loadConfig(opts) {
|
||||
if (opts.config) {
|
||||
throw new BrowserslistError(
|
||||
'Browserslist config are not supported in client-side build'
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
loadCountry: function loadCountry() {
|
||||
throw new BrowserslistError(
|
||||
'Country statistics are not supported ' +
|
||||
'in client-side build of Browserslist'
|
||||
)
|
||||
},
|
||||
|
||||
loadFeature: function loadFeature() {
|
||||
throw new BrowserslistError(
|
||||
'Supports queries are not available in client-side build of Browserslist'
|
||||
)
|
||||
},
|
||||
|
||||
currentNode: function currentNode(resolve, context) {
|
||||
return resolve(['maintained node versions'], context)[0]
|
||||
},
|
||||
|
||||
parseConfig: noop,
|
||||
|
||||
readConfig: noop,
|
||||
|
||||
findConfig: noop,
|
||||
|
||||
findConfigFile: noop,
|
||||
|
||||
clearCaches: noop,
|
||||
|
||||
oldDataWarning: noop,
|
||||
|
||||
env: {}
|
||||
}
|
||||
156
node_modules/browserslist/cli.js
generated
vendored
Executable file
156
node_modules/browserslist/cli.js
generated
vendored
Executable file
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require('fs')
|
||||
var updateDb = require('update-browserslist-db')
|
||||
|
||||
var browserslist = require('./')
|
||||
var pkg = require('./package.json')
|
||||
|
||||
var args = process.argv.slice(2)
|
||||
|
||||
var USAGE =
|
||||
'Usage:\n' +
|
||||
' npx browserslist\n' +
|
||||
' npx browserslist "QUERIES"\n' +
|
||||
' npx browserslist --json "QUERIES"\n' +
|
||||
' npx browserslist --config="path/to/browserlist/file"\n' +
|
||||
' npx browserslist --coverage "QUERIES"\n' +
|
||||
' npx browserslist --coverage=US "QUERIES"\n' +
|
||||
' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
|
||||
' npx browserslist --env="environment name defined in config"\n' +
|
||||
' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
|
||||
' npx browserslist --mobile-to-desktop\n' +
|
||||
' npx browserslist --ignore-unknown-versions\n'
|
||||
|
||||
function isArg(arg) {
|
||||
return args.some(function (str) {
|
||||
return str === arg || str.indexOf(arg + '=') === 0
|
||||
})
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
process.stderr.write('browserslist: ' + msg + '\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (isArg('--help') || isArg('-h')) {
|
||||
process.stdout.write(pkg.description + '.\n\n' + USAGE + '\n')
|
||||
} else if (isArg('--version') || isArg('-v')) {
|
||||
process.stdout.write('browserslist ' + pkg.version + '\n')
|
||||
} else if (isArg('--update-db')) {
|
||||
/* c8 ignore next 8 */
|
||||
process.stdout.write(
|
||||
'The --update-db command is deprecated.\n' +
|
||||
'Please use npx update-browserslist-db@latest instead.\n'
|
||||
)
|
||||
process.stdout.write('Browserslist DB update will still be made.\n')
|
||||
updateDb(function (str) {
|
||||
process.stdout.write(str)
|
||||
})
|
||||
} else {
|
||||
var mode = 'browsers'
|
||||
var opts = {}
|
||||
var queries
|
||||
var areas
|
||||
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (args[i][0] !== '-') {
|
||||
queries = args[i].replace(/^["']|["']$/g, '')
|
||||
continue
|
||||
}
|
||||
|
||||
var arg = args[i].split('=')
|
||||
var name = arg[0]
|
||||
var value = arg[1]
|
||||
|
||||
if (value) value = value.replace(/^["']|["']$/g, '')
|
||||
|
||||
if (name === '--config' || name === '-b') {
|
||||
opts.config = value
|
||||
} else if (name === '--env' || name === '-e') {
|
||||
opts.env = value
|
||||
} else if (name === '--stats' || name === '-s') {
|
||||
opts.stats = value
|
||||
} else if (name === '--coverage' || name === '-c') {
|
||||
if (mode !== 'json') mode = 'coverage'
|
||||
if (value) {
|
||||
areas = value.split(',')
|
||||
} else {
|
||||
areas = ['global']
|
||||
}
|
||||
} else if (name === '--json') {
|
||||
mode = 'json'
|
||||
} else if (name === '--mobile-to-desktop') {
|
||||
/* c8 ignore next */
|
||||
opts.mobileToDesktop = true
|
||||
} else if (name === '--ignore-unknown-versions') {
|
||||
/* c8 ignore next */
|
||||
opts.ignoreUnknownVersions = true
|
||||
} else {
|
||||
error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
|
||||
}
|
||||
}
|
||||
|
||||
var browsers
|
||||
try {
|
||||
browsers = browserslist(queries, opts)
|
||||
} catch (e) {
|
||||
if (e.name === 'BrowserslistError') {
|
||||
error(e.message)
|
||||
} /* c8 ignore start */ else {
|
||||
throw e
|
||||
} /* c8 ignore end */
|
||||
}
|
||||
|
||||
var coverage
|
||||
if (mode === 'browsers') {
|
||||
browsers.forEach(function (browser) {
|
||||
process.stdout.write(browser + '\n')
|
||||
})
|
||||
} else if (areas) {
|
||||
coverage = areas.map(function (area) {
|
||||
var stats
|
||||
if (area !== 'global') {
|
||||
stats = area
|
||||
} else if (opts.stats) {
|
||||
stats = JSON.parse(fs.readFileSync(opts.stats))
|
||||
}
|
||||
var result = browserslist.coverage(browsers, stats)
|
||||
var round = Math.round(result * 100) / 100.0
|
||||
|
||||
return [area, round]
|
||||
})
|
||||
|
||||
if (mode === 'coverage') {
|
||||
var prefix = 'These browsers account for '
|
||||
process.stdout.write(prefix)
|
||||
coverage.forEach(function (data, index) {
|
||||
var area = data[0]
|
||||
var round = data[1]
|
||||
var end = 'globally'
|
||||
if (area && area !== 'global') {
|
||||
end = 'in the ' + area.toUpperCase()
|
||||
} else if (opts.stats) {
|
||||
end = 'in custom statistics'
|
||||
}
|
||||
|
||||
if (index !== 0) {
|
||||
process.stdout.write(prefix.replace(/./g, ' '))
|
||||
}
|
||||
|
||||
process.stdout.write(round + '% of all users ' + end + '\n')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === 'json') {
|
||||
var data = { browsers: browsers }
|
||||
if (coverage) {
|
||||
data.coverage = coverage.reduce(function (object, j) {
|
||||
object[j[0]] = j[1]
|
||||
return object
|
||||
}, {})
|
||||
}
|
||||
process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user