first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

222
build/node_modules/browserslist/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,222 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.10.2
* Fix Browserify support.
## 2.10.1
* Fix using Browserslist without `process` (by Andrew Patton).
## 2.10
* Add `< 1%` and `<= 1%` queries support (by August Kaiser).
## 2.9.1
* Fix unknown query on trailing spaces in query.
## 2.9
* Add `last Electron versions` and `last Electron major versions` queries
(by Louis Mouhat).
## 2.8
* Add `since 2016-03` and `since 2016-03-20` queries support (by Andrew Blick).
## 2.7
* Add `since 2016` queries support (by Igor Deryabin).
## 2.6.1
* Fix `Path must be a string` error.
## 2.6
* By default load config from current directory in CLI tool.
## 2.5.1
* Allow `@scope/browserlist-config` config name (by Jamie Connolly).
## 2.5
* Add `extends` query (by YellowKirby).
## 2.4.1
* Throw error if `package.json` contain `browserlist` instead of `browserslist`.
## 2.4
* Add `last n major versions` query (by John Sanders).
## 2.3.3
* Fix browsers support.
## 2.3.2
* Fix `> 0` query for browsers with one version (by Nikolay Solovyov).
## 2.3.1
* Reduce library size.
## 2.3
* Add `unreleased versions` and `unreleased Chrome versions` queries.
## 2.2.2
* Fix `Path must be a string` error (by Pieter Beulque).
## 2.2.1
* Fix security issue with regions dynamic `require`.
## 2.2
* Add region usage statistics support (by Clément P).
## 2.1.5
* Remove Firefox 45 from Firefox ESR.
## 2.1.4
* Use both ESR versions when they actual.
## 2.1.3
* Add warning on first exclude query.
## 2.1.2
* Fix non-Node.js environments support.
## 2.1.1
* Fix CLI arguments parsing.
## 2.1
* Add `>= 5%`, `>= 5% in US` and `>= 5% in my stats` queries.
## 2.0
* `last n versions` returns versions for all browsers, not only main browsers.
* Cache file system operations (by Aarni Koskela).
* Use `caniuse-lite` 1 MB instead of `caniuse-db` 7 MB (by Ben Briggs).
* Add `.browserslistrc` config support.
* Add QQ Browser for Android support.
* Add tests for CLI (by Zhulduz Zhankenova).
## 1.7.7
* Update Firefox ESR.
## 1.7.6
* Fix Android Chrome selection.
## 1.7.5
* Fix combining `not` query with country based statistics.
* Fix `--env` argument in CLI (by Tuure Savuoja).
## 1.7.4
* Speed up browser sorting (by Aarni Koskela).
## 1.7.3
* Fix config finding when directory was passed to `path` (by Aarni Koskela).
## 1.7.2
* Fix config finding algorithm (by Aarni Koskela).
## 1.7.1
* Fix unreleased browsers version detection.
## 1.7
* Add `--config` and `--env` arguments to CLI (by Jarek Rencz).
## 1.6
* Convert Electron version to Chrome (by Kilian Valkhof).
* Fix `0` version mistake in Can I Use data.
## 1.5.2
* Fix browser versions ordering (by Marco Massarotto).
## 1.5.1
* Fix error on `package.json` and `browserslist` in same directory.
## 1.5
* Add `package.json` support (by Stepan Kuzmin).
* Add environments support (by Maksim Semenov and openlibser).
* Add `browserslist-stats.json` file support (by Oleh Aloshkin).
* Add `config` option to CLI (by Evilebot Tnawi).
* Add JSDoc.
* Fix tests on Windows (by Anna Stoliar).
* Dont set custom usage statistics globally.
## 1.4
* Add `defaults` keyword.
## 1.3.6
* Add `UCAndroid` alias to `and_uc` (by Evilebot Tnawi).
## 1.3.5
* Fix Opera Mini support. Use `op_mini all`.
## 1.3.4
* Add space-less `>1%` and `>.5%` syntax support (by Andreas Lind).
## 1.3.3
* Clean `0` versions in some country-based requests.
## 1.3.2
* Update Firefox ESR.
## 1.3.1
* Add Safari TP support.
## 1.3
* Add coverage for specific country (by Joshua Wise).
## 1.2
* Add `browserslist.coverage()` method.
* Add `--coverage` and `-c` argument to CLI.
* Add `-v` argument support to CLI.
* Better error handling in CLI.
## 1.1.3
* Fix jspm support (by Sean Anderson).
## 1.1.2
* Fix jspm support (by Sean Anderson).
## 1.1.1
* Fix space-less `>10%` and `>10% in my stats` queries.
* Normalize error messages.
* Remove development files from npm package.
## 1.1
* Added query against custom browser usage data (by Daniel Rey).
## 1.0.1
* Update Firefox ESR (by Rouven Weßling).
## 1.0
* Remove Opera 12.1 from default query.
* Add `not` keyword and exclude browsers by query.
* Add Microsoft Edge support (by Andrey Polischuk).
* Add CLI for debug and non-JS usage (by Luke Horvat).
* Use own class in Browserslist errors.
## 0.5
* Add version ranges `IE 6-9` (by Ben Briggs).
## 0.4
* Add `config` option and `BROWSERSLIST_CONFIG` environment variable support.
* Add symlink config support.
## 0.3.3
* Fix DynJS compatibility (by Nick Howes).
## 0.3.2
* Fix joined versions on versions query (by Vincent De Oliveira).
## 0.3.1
* Fix global variable leak (by Peter Müller).
## 0.3
* Takes queries from `BROWSERSLIST` environment variable.
## 0.2
* Return Can I Use joined versions as `ios_saf 7.0-7.1`.
## 0.1.3
* Better work with Can I Use joined versions like `ios_saf 7.0-7.1`.
* Browserslist now understands `ios_saf 7.0` or `ios_saf 7`.
## 0.1.2
* Do not create global `browserslist` var (by Maxime Thirouin).
## 0.1.1
* Sort browsers by name and version.
## 0.1
* Initial release.

20
build/node_modules/browserslist/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2014 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.

455
build/node_modules/browserslist/README.md generated vendored Normal file
View File

@@ -0,0 +1,455 @@
# Browserslist
<img align="right" width="120" height="120"
src="./logo.svg" alt="Browserslist logo by Anton Lovchikov">
Library to share target browsers between different front-end tools.
It is used in:
* [Autoprefixer]
* [babel-preset-env]
(external config in `package.json` or `browserslist` files supported in 2.0)
* [postcss-preset-env]
* [eslint-plugin-compat]
* [stylelint-no-unsupported-browser-features]
* [postcss-normalize]
All tools that rely on Browserslist will find its config automatically,
when you add the following to `package.json`:
```json
{
"browserslist": [
"> 1%",
"last 2 versions"
]
}
```
Or in `.browserslistrc` config:
```yaml
# Browsers that we support
> 1%
Last 2 versions
IE 10 # sorry
```
Developers set browsers list in queries like `last 2 version`
to be free from updating browser versions manually.
Browserslist will use [Can I Use] data for this queries.
Browserslist will take browsers queries from tool option,
`browserslist` config, `.browserslistrc` config,
`browserslist` section in `package.json` or environment variables.
You can test Browserslist queries in [online demo].
<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>
[stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
[eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
[postcss-preset-env]: https://github.com/jonathantneal/postcss-preset-env
[babel-preset-env]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
[postcss-normalize]: https://github.com/jonathantneal/postcss-normalize
[Autoprefixer]: https://github.com/postcss/autoprefixer
[online demo]: http://browserl.ist/
[Can I Use]: http://caniuse.com/
## Tools
* [`browserslist-useragent`] checks browser by user agent string
to match Browserslist target browsers query.
* [`caniuse-api`] returns browsers which support some specific feature.
* Run `npx browserslist` in your project directory to see projects
target browsers. This CLI tool is built-in and available in any project
with Autoprefixer.
[`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
[`caniuse-api`]: https://github.com/Nyalab/caniuse-api
## Queries
Browserslist will use browsers query from one of this sources:
1. Tool options. For example `browsers` option in Autoprefixer.
2. `BROWSERSLIST` environment variable.
3. `browserslist` config file in current or parent directories.
3. `.browserslistrc` config file in current or parent directories.
4. `browserslist` key in `package.json` file in current or parent directories.
**We recommend this way.**
5. If the above methods did not produce a valid result
Browserslist will use defaults: `> 1%, last 2 versions, Firefox ESR`.
You can specify the versions by queries (case insensitive):
* `last 2 versions`: the last 2 versions for each browser.
* `last 2 Chrome versions`: the last 2 versions of Chrome browser.
* `> 5%`: versions selected by global usage statistics.
`>=`, `<` and `<=` work too.
* `> 5% in US`: uses USA usage statistics. It accepts [two-letter country code].
* `> 5% in alt-AS`: uses Asia region usage statistics. List of all region codes
can be found at [`caniuse-lite/data/regions`].
* `> 5% in my stats`: uses [custom usage data].
* `extends browserslist-config-mycompany`: take queries from
`browserslist-config-mycompany` npm package.
* `ie 6-8`: selects an inclusive range of versions.
* `Firefox > 20`: versions of Firefox newer than 20.
`>=`, `<` and `<=` work too.
* `iOS 7`: the iOS browser version 7 directly.
* `Firefox ESR`: the latest [Firefox ESR] version.
* `unreleased versions` or `unreleased Chrome versions`:
alpha and beta versions.
* `last 2 major versions` or `last 2 iOS major versions`:
all minor/patch releases of last 2 major versions.
* `since 2013`: all versions released since year 2013
(also `since 2013-03` and `since 2013-03-10`).
* `not ie <= 8`: exclude browsers selected by previous queries.
You can add `not ` to any query.
### Debug
Run `npx browserslist` in project directory to see what browsers was selected
by your queries.
```sh
$ npx browserslist
and_chr 61
and_ff 56
and_qq 1.2
and_uc 11.4
android 56
baidu 7.12
bb 10
chrome 62
edge 16
firefox 56
ios_saf 11
opera 48
safari 11
samsung 5
```
### Notes
Browserslist works with separated versions of browsers.
You should avoid queries like `Firefox > 0`.
Multiple criteria are combined as a boolean `OR`. A browser version must match
at least one of the criteria to be selected.
All queries are based on the [Can I Use] support table,
e.g. `last 3 iOS versions` might select `8.4, 9.2, 9.3` (mixed major and minor),
whereas `last 3 Chrome versions` might select `50, 49, 48` (major only).
[`caniuse-lite/data/regions`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/regions
[two-letter country code]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
[custom usage data]: #custom-usage-data
[Can I Use]: http://caniuse.com/
### Browsers
Names are case insensitive:
* `Android` for Android WebView.
* `Baidu` for Baidu Browser.
* `BlackBerry` or `bb` for Blackberry browser.
* `Chrome` for Google Chrome.
* `ChromeAndroid` or `and_chr` for Chrome for Android
* `Edge` for Microsoft Edge.
* `Electron` for Electron framework. It will be converted to Chrome version.
* `Explorer` or `ie` for Internet Explorer.
* `ExplorerMobile` or `ie_mob` for Internet Explorer Mobile.
* `Firefox` or `ff` for Mozilla Firefox.
* `FirefoxAndroid` or `and_ff` for Firefox for Android.
* `iOS` or `ios_saf` for iOS Safari.
* `Opera` for Opera.
* `OperaMini` or `op_mini` for Opera Mini.
* `OperaMobile` or `op_mob` for Opera Mobile.
* `QQAndroid` or `and_qq` for QQ Browser for Android.
* `Safari` for desktop Safari.
* `Samsung` for Samsung Internet.
* `UCAndroid` or `and_uc` for UC Browser for Android.
## `package.json`
If you want to reduce config files in project root, you can specify
browsers in `package.json` with `browserslist` key:
```json
{
"private": true,
"dependencies": {
"autoprefixer": "^6.5.4"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
```
## Config File
Browserslist config should be named `.browserslistrc` or `browserslist`
and have browsers queries split by a new line. Comments starts with `#` symbol:
```yaml
# Browsers that we support
> 1%
Last 2 versions
IE 8 # sorry
```
Browserslist will check config in every directory in `path`.
So, if tool process `app/styles/main.css`, you can put config to root,
`app/` or `app/styles`.
You can specify direct path in `BROWSERSLIST_CONFIG` environment variables.
## Shareable Configs
You can use the following query to reference an exported Browserslist config
from another package:
```json
"browserslist": [
"extends browserslist-config-mycompany"
]
```
For security reasons, external configuration only supports packages that have
the `browserslist-config-` prefix. npm scoped packages are also supported, by
naming or prefixing the module with `@scope/browserslist-config`, such as
`@scope/browserslist-config` or `@scope/browserslist-config-mycompany`.
If you dont accept Browserslist queries from users, you can disable the
validation by using the `dangerousExtend` option:
```js
browserslist(queries, { path, dangerousExtend: true })
```
Because this uses `npm`'s resolution, you can also reference specific files
in a package:
```json
"browserslist": [
"extends browserslist-config-mycompany/desktop",
"extends browserslist-config-mycompany/mobile"
]
```
When writing a shared Browserslist package, just export an array.
`browserslist-config-mycompany/index.js`:
```js
module.exports = [
'last 2 versions',
'ie 9'
]
```
## Environment Variables
If some tool use Browserslist inside, you can change browsers settings
by [environment variables]:
* `BROWSERSLIST` with browsers queries.
```sh
BROWSERSLIST="> 5%" gulp css
```
* `BROWSERSLIST_CONFIG` with path to config file.
```sh
BROWSERSLIST_CONFIG=./config/browserslist gulp css
```
* `BROWSERSLIST_ENV` with environments string.
```sh
BROWSERSLIST_ENV="development" gulp css
```
* `BROWSERSLIST_STATS` with path to the custom usage data
for `> 1% in my stats` query.
```sh
BROWSERSLIST_STATS=./config/usage_data.json gulp css
```
* `BROWSERSLIST_DISABLE_CACHE` if you want to disable config reading cache.
```sh
BROWSERSLIST_DISABLE_CACHE=1 gulp css
```
[environment variables]: https://en.wikipedia.org/wiki/Environment_variable
## Environments
You can also specify different browser queries for various environments.
Browserslist will choose query according to `BROWSERSLIST_ENV` or `NODE_ENV`
variables. If none of them is declared, Browserslist will firstly look
for `development` queries and then use defaults.
In `package.json`:
```js
"browserslist": {
"production": [
"last 2 version",
"ie 9"
],
"development": [
"last 1 version"
]
}
```
In `.browserslistrc` config:
```ini
[production]
last 2 version
ie 9
[development]
last 1 version
```
## Custom Usage Data
If you have a website, you can query against the usage statistics of your site:
1. Import your Google Analytics data into [Can I Use].
Press `Import…` button in Settings page.
2. Open browser DevTools on [Can I Use] and paste this snippet
into the browser console:
```js
var e=document.createElement('a');e.setAttribute('href', 'data:text/plain;charset=utf-8,'+encodeURIComponent(JSON.stringify(JSON.parse(localStorage['usage-data-by-id'])[localStorage['config-primary_usage']])));e.setAttribute('download','stats.json');document.body.appendChild(e);e.click();document.body.removeChild(e);
```
3. Save the data to a `browserslist-stats.json` file in your project.
Of course, you can generate usage statistics file by any other method.
File format should be like:
```js
{
"ie": {
"6": 0.01,
"7": 0.4,
"8": 1.5
},
"chrome": {
},
}
```
Note that you can query against your custom usage data
while also querying against global or regional data.
For example, the query `> 1% in my stats, > 5% in US, 10%` is permitted.
[Can I Use]: http://caniuse.com/
## Webpack
If you plan to use Browserslist on client-side (e. g., tools like CodePen)
Browserslist could take big part of your bundle (150 KB).
But the biggest part of this size will be region usage statistics, which could
be useless for you. `IgnorePlugin` could cut it:
```js
const webpackConfig = {
plugins: [
new webpack.IgnorePlugin(/caniuse-lite\/data\/regions/)
]
}
```
This plugin will reduce Browserslist size from 150 KB to 6 KB. But you loose
`> 1% in US` queries support.
## JS API
```js
var browserslist = require('browserslist');
// Your CSS/JS build tool code
var process = function (source, opts) {
var browsers = browserslist(opts.browsers, {
stats: opts.stats,
path: opts.file,
env: opts.env
});
// Your code to add features for selected browsers
}
```
Queries can be a string `"> 5%, last 1 version"`
or an array `['> 5%', 'last 1 version']`.
If a query is missing, Browserslist will look for a config file.
You can provide a `path` option (that can be a file) to find the config file
relatively to it.
For non-JS environment and debug purpose you can use CLI tool:
```sh
browserslist "> 1%, last 2 versions"
```
## Coverage
You can get total users coverage for selected browsers by JS API:
```js
browserslist.coverage(browserslist('> 1%')) //=> 81.4
```
```js
browserslist.coverage(browserslist('> 1% in US'), 'US') //=> 83.1
```
Or by CLI:
```sh
$ browserslist --coverage "> 1%"
These browsers account for 81.4% of all users globally
```
```sh
$ browserslist --coverage=US "> 1% in US"
These browsers account for 83.1% of all users in the US
```
## Internal caches
Browserslist caches the configuration it reads from `package.json` and
`browserslist` files, as well as knowledge about the existence of files,
for the duration of the hosting process.
To clear these caches, use:
```js
browserslist.clearCaches();
```
To disable the caching altogether, set the `BROWSERSLIST_DISABLE_CACHE`
environment variable.

103
build/node_modules/browserslist/cli.js generated vendored Executable file
View File

@@ -0,0 +1,103 @@
#!/usr/bin/env node
var browserslist = require('./')
var pkg = require('./package.json')
var args = process.argv.slice(2)
var USAGE = 'Usage:\n' +
' ' + pkg.name + '\n' +
' ' + pkg.name + ' "QUERIES"\n' +
' ' + pkg.name + ' --config="path/to/browserlist/file"\n' +
' ' + pkg.name + ' --coverage "QUERIES"\n' +
' ' + pkg.name + ' --coverage=US "QUERIES"\n' +
' ' + pkg.name + ' --env="environment name defined in config"\n' +
' ' + pkg.name + ' --stats="path/to/browserlist/stats/file"'
function isArg (arg) {
return args.some(function (str) {
return str === arg || str.indexOf(arg + '=') === 0
})
}
function error (msg) {
process.stderr.write(pkg.name + ': ' + 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(pkg.name + ' ' + pkg.version + '\n')
} else {
var mode = 'browsers'
var opts = { }
var queries
var country
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') {
mode = 'coverage'
if (value) country = value
} else {
error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
}
}
if (!queries && !opts.config) {
if (browserslist.findConfig(process.cwd())) {
opts.path = process.cwd()
} else {
error(
'Browserslist config did not found. ' +
'Define queries or config path.' +
'\n\n' + USAGE
)
}
}
var browsers
try {
browsers = browserslist(queries, opts)
} catch (e) {
if (e.name === 'BrowserslistError') {
error(e.message)
} else {
throw e
}
}
if (mode === 'browsers') {
browsers.forEach(function (browser) {
process.stdout.write(browser + '\n')
})
} else {
var result = browserslist.coverage(browsers, country)
var round = Math.round(result * 100) / 100.0
var end = 'globally'
if (country && country !== 'global') {
end = 'in the ' + country.toUpperCase()
}
process.stdout.write(
'These browsers account for ' + round + '% of all users ' +
end + '\n')
}
}

869
build/node_modules/browserslist/index.js generated vendored Normal file
View File

@@ -0,0 +1,869 @@
var process = require('process')
var path = require('path')
var e2c = require('electron-to-chromium/versions')
var fs = require('fs')
var agents = require('caniuse-lite/dist/unpacker/agents').agents
var region = require('caniuse-lite/dist/unpacker/region').default
function normalize (versions) {
return versions.filter(function (version) {
return typeof version === 'string'
})
}
function nameMapper (name) {
return function mapName (version) {
return name + ' ' + version
}
}
function getMajor (version) {
return parseInt(version.split('.')[0])
}
function getMajorVersions (released, number) {
if (released.length === 0) return []
var minimum = getMajor(released[released.length - 1]) - parseInt(number) + 1
var selected = []
for (var i = released.length - 1; i >= 0; i--) {
if (minimum > getMajor(released[i])) break
selected.unshift(released[i])
}
return selected
}
var env = process && process.env ? process.env : { }
var FLOAT_RANGE = /^\d+(\.\d+)?(-\d+(\.\d+)?)*$/
var IS_SECTION = /^\s*\[(.+)\]\s*$/
function uniq (array) {
var filtered = []
for (var i = 0; i < array.length; i++) {
if (filtered.indexOf(array[i]) === -1) filtered.push(array[i])
}
return filtered
}
function BrowserslistError (message) {
this.name = 'BrowserslistError'
this.message = message || ''
this.browserslist = true
if (Error.captureStackTrace) {
Error.captureStackTrace(this, BrowserslistError)
}
}
BrowserslistError.prototype = Error.prototype
// Helpers
function fillUsage (result, name, data) {
for (var i in data) {
result[name + ' ' + i] = data[i]
}
}
var filenessCache = {}
var configCache = {}
function isFile (file) {
if (file in filenessCache) {
return filenessCache[file]
}
var result = fs.existsSync(file) && fs.statSync(file).isFile()
if (!env.BROWSERSLIST_DISABLE_CACHE) {
filenessCache[file] = result
}
return result
}
function eachParent (file, callback) {
var loc = path.resolve(file)
do {
var result = callback(loc)
if (typeof result !== 'undefined') return result
} while (loc !== (loc = path.dirname(loc)))
return undefined
}
function getStat (opts) {
if (opts.stats) {
return opts.stats
} else if (env.BROWSERSLIST_STATS) {
return env.BROWSERSLIST_STATS
} else if (opts.path && path.resolve) {
return eachParent(opts.path, function (dir) {
var file = path.join(dir, 'browserslist-stats.json')
return isFile(file) ? file : undefined
})
}
return undefined
}
function parsePackage (file) {
var config = JSON.parse(fs.readFileSync(file))
if (config.browserlist && !config.browserslist) {
throw new BrowserslistError(
'`browserlist` key instead of `browserslist` in ' + file)
}
var list = config.browserslist
if (typeof list === 'object' && list.length) {
list = { defaults: list }
}
return list
}
function pickEnv (config, opts) {
if (typeof config !== 'object') return config
var name
if (typeof opts.env === 'string') {
name = opts.env
} else if (env.BROWSERSLIST_ENV) {
name = env.BROWSERSLIST_ENV
} else if (env.NODE_ENV) {
name = env.NODE_ENV
} else {
name = 'development'
}
return config[name] || config.defaults
}
function generateFilter (sign, version) {
version = parseFloat(version)
if (sign === '>') {
return function (v) {
return parseFloat(v) > version
}
} else if (sign === '>=') {
return function (v) {
return parseFloat(v) >= version
}
} else if (sign === '<') {
return function (v) {
return parseFloat(v) < version
}
} else {
return function (v) {
return parseFloat(v) <= version
}
}
}
function compareStrings (a, b) {
if (a < b) return -1
if (a > b) return +1
return 0
}
function resolve (queries, context) {
return queries.reduce(function (result, selection, index) {
selection = selection.trim()
if (selection === '') return result
var isExclude = selection.indexOf('not ') === 0
if (isExclude) {
if (index === 0) {
throw new BrowserslistError(
'Write any browsers query (for instance, `defaults`) ' +
'before `' + selection + '`')
}
selection = selection.slice(4)
}
for (var i = 0; i < QUERIES.length; i++) {
var type = QUERIES[i]
var match = selection.match(type.regexp)
if (match) {
var args = [context].concat(match.slice(1))
var array = type.select.apply(browserslist, args)
if (isExclude) {
array = array.concat(array.map(function (j) {
return j.replace(/\s\d+/, ' 0')
}))
return result.filter(function (j) {
return array.indexOf(j) === -1
})
}
return result.concat(array)
}
}
throw new BrowserslistError('Unknown browser query `' + selection + '`')
}, [])
}
/**
* Return array of browsers by selection queries.
*
* @param {(string|string[])} [queries=browserslist.defaults] Browser queries.
* @param {object} opts Options.
* @param {string} [opts.path="."] Path to processed file.
* It will be used to find config files.
* @param {string} [opts.env="development"] Processing environment.
* It will be used to take right
* queries from config file.
* @param {string} [opts.config] Path to config file with queries.
* @param {object} [opts.stats] Custom browser usage statistics
* for "> 1% in my stats" query.
* @return {string[]} Array with browser names in Can I Use.
*
* @example
* browserslist('IE >= 10, IE 8') //=> ['ie 11', 'ie 10', 'ie 8']
*/
function browserslist (queries, opts) {
if (typeof opts === 'undefined') opts = { }
if (!opts.hasOwnProperty('path')) {
opts.path = path.resolve ? path.resolve('.') : '.'
}
if (typeof queries === 'undefined' || queries === null) {
if (env.BROWSERSLIST) {
queries = env.BROWSERSLIST
} else if (opts.config || env.BROWSERSLIST_CONFIG) {
var file = opts.config || env.BROWSERSLIST_CONFIG
if (path.basename(file) === 'package.json') {
queries = pickEnv(parsePackage(file), opts)
} else {
queries = pickEnv(browserslist.readConfig(file), opts)
}
} else if (opts.path) {
queries = pickEnv(browserslist.findConfig(opts.path), opts)
}
}
if (typeof queries === 'undefined' || queries === null) {
queries = browserslist.defaults
}
if (typeof queries === 'string') {
queries = queries.split(/,\s*/)
}
if (!Array.isArray(queries)) {
throw new BrowserslistError(
'Browser queries must be an array. Got ' + typeof queries + '.')
}
var context = { dangerousExtend: opts.dangerousExtend }
var stats = getStat(opts)
if (stats) {
if (typeof stats === 'string') {
try {
stats = JSON.parse(fs.readFileSync(stats))
} catch (e) {
throw new BrowserslistError('Can\'t read ' + stats)
}
}
if ('dataByBrowser' in stats) {
stats = stats.dataByBrowser
}
context.customUsage = { }
for (var browser in stats) {
fillUsage(context.customUsage, browser, stats[browser])
}
}
var result = resolve(queries, context).map(function (i) {
var parts = i.split(' ')
var name = parts[0]
var version = parts[1]
if (version === '0') {
return name + ' ' + byName(name).versions[0]
} else {
return i
}
}).sort(function (name1, name2) {
name1 = name1.split(' ')
name2 = name2.split(' ')
if (name1[0] === name2[0]) {
if (FLOAT_RANGE.test(name1[1]) && FLOAT_RANGE.test(name2[1])) {
return parseFloat(name2[1]) - parseFloat(name1[1])
} else {
return compareStrings(name2[1], name1[1])
}
} else {
return compareStrings(name1[0], name2[0])
}
})
return uniq(result)
}
function normalizeVersion (data, version) {
if (data.versions.indexOf(version) !== -1) {
return version
} else if (browserslist.versionAliases[data.name][version]) {
return browserslist.versionAliases[data.name][version]
} else if (data.versions.length === 1) {
return data.versions[0]
} else {
return false
}
}
function loadCountryStatistics (country) {
country = country.replace(/[^\w-]/g, '')
if (!browserslist.usage[country]) {
var usage = { }
// eslint-disable-next-line security/detect-non-literal-require
var compressed = require('caniuse-lite/data/regions/' + country + '.js')
var data = region(compressed)
for (var i in data) {
fillUsage(usage, i, data[i])
}
browserslist.usage[country] = usage
}
}
// Will be filled by Can I Use data below
browserslist.data = { }
browserslist.usage = {
global: { },
custom: null
}
// Default browsers query
browserslist.defaults = [
'> 1%',
'last 2 versions',
'Firefox ESR'
]
// Browser names aliases
browserslist.aliases = {
fx: 'firefox',
ff: 'firefox',
ios: 'ios_saf',
explorer: 'ie',
blackberry: 'bb',
explorermobile: 'ie_mob',
operamini: 'op_mini',
operamobile: 'op_mob',
chromeandroid: 'and_chr',
firefoxandroid: 'and_ff',
ucandroid: 'and_uc',
qqandroid: 'and_qq'
}
// Aliases to work with joined versions like `ios_saf 7.0-7.1`
browserslist.versionAliases = { }
// Get browser data by alias or case insensitive name
function byName (name) {
name = name.toLowerCase()
name = browserslist.aliases[name] || name
return browserslist.data[name]
}
// Get browser data by alias or case insensitive name and throw error
// on unknown browser
function checkName (name) {
var data = byName(name)
if (!data) throw new BrowserslistError('Unknown browser ' + name)
return data
}
// Read and parse config
browserslist.readConfig = function (file) {
if (!isFile(file)) {
throw new BrowserslistError('Can\'t read ' + file + ' config')
}
return browserslist.parseConfig(fs.readFileSync(file))
}
// Find config, read file and parse it
browserslist.findConfig = function (from) {
if (!path.resolve) return undefined
from = path.resolve(from)
var cacheKey = isFile(from) ? path.dirname(from) : from
if (cacheKey in configCache) {
return configCache[cacheKey]
}
var resolved = eachParent(from, function (dir) {
var config = path.join(dir, 'browserslist')
var pkg = path.join(dir, 'package.json')
var rc = path.join(dir, '.browserslistrc')
var pkgBrowserslist
if (isFile(pkg)) {
try {
pkgBrowserslist = parsePackage(pkg)
} catch (e) {
if (e.name === 'BrowserslistError') throw e
console.warn('[Browserslist] Could not parse ' + pkg + '. Ignoring it.')
}
}
if (isFile(config) && pkgBrowserslist) {
throw new BrowserslistError(
dir + ' contains both browserslist and package.json with browsers')
} else if (isFile(rc) && pkgBrowserslist) {
throw new BrowserslistError(
dir + ' contains both .browserslistrc and package.json with browsers')
} else if (isFile(config) && isFile(rc)) {
throw new BrowserslistError(
dir + ' contains both .browserslistrc and browserslist')
} else if (isFile(config)) {
return browserslist.readConfig(config)
} else if (isFile(rc)) {
return browserslist.readConfig(rc)
} else {
return pkgBrowserslist
}
})
if (!env.BROWSERSLIST_DISABLE_CACHE) {
configCache[cacheKey] = resolved
}
return resolved
}
/**
* Return browsers market coverage.
*
* @param {string[]} browsers Browsers names in Can I Use.
* @param {string} [country="global"] Which country statistics should be used.
*
* @return {number} Total market coverage for all selected browsers.
*
* @example
* browserslist.coverage(browserslist('> 1% in US'), 'US') //=> 83.1
*/
browserslist.coverage = function (browsers, country) {
if (country && country !== 'global') {
if (country.length > 2) {
country = country.toLowerCase()
} else {
country = country.toUpperCase()
}
loadCountryStatistics(country)
} else {
country = 'global'
}
return browsers.reduce(function (all, i) {
var usage = browserslist.usage[country][i]
if (usage === undefined) {
usage = browserslist.usage[country][i.replace(/ [\d.]+$/, ' 0')]
}
return all + (usage || 0)
}, 0)
}
// Return array of queries from config content
browserslist.parseConfig = function (string) {
var result = { defaults: [] }
var section = 'defaults'
string.toString()
.replace(/#[^\n]*/g, '')
.split(/\n/)
.map(function (line) {
return line.trim()
})
.filter(function (line) {
return line !== ''
})
.forEach(function (line) {
if (IS_SECTION.test(line)) {
section = line.match(IS_SECTION)[1].trim()
result[section] = result[section] || []
} else {
result[section].push(line)
}
})
return result
}
// Clear internal caches
browserslist.clearCaches = function () {
filenessCache = {}
configCache = {}
}
var QUERIES = [
{
regexp: /^last\s+(\d+)\s+major versions?$/i,
select: function (context, versions) {
return Object.keys(agents).reduce(function (selected, name) {
var data = byName(name)
if (!data) return selected
var array = getMajorVersions(data.released, versions)
array = array.map(nameMapper(data.name))
return selected.concat(array)
}, [])
}
},
{
regexp: /^last\s+(\d+)\s+versions?$/i,
select: function (context, versions) {
return Object.keys(agents).reduce(function (selected, name) {
var data = byName(name)
if (!data) return selected
var array = data.released.slice(-versions)
array = array.map(nameMapper(data.name))
return selected.concat(array)
}, [])
}
},
{
regexp: /^last\s+(\d+)\s+electron\s+major versions?$/i,
select: function (context, versions) {
var validVersions = getMajorVersions(Object.keys(e2c).reverse(), versions)
return validVersions.map(function (i) {
return 'chrome ' + e2c[i]
})
}
},
{
regexp: /^last\s+(\d+)\s+(\w+)\s+major versions?$/i,
select: function (context, versions, name) {
var data = checkName(name)
var validVersions = getMajorVersions(data.released, versions)
return validVersions.map(nameMapper(data.name))
}
},
{
regexp: /^last\s+(\d+)\s+electron\s+versions?$/i,
select: function (context, versions) {
return Object.keys(e2c).reverse().slice(-versions).map(function (i) {
return 'chrome ' + e2c[i]
})
}
},
{
regexp: /^last\s+(\d+)\s+(\w+)\s+versions?$/i,
select: function (context, versions, name) {
var data = checkName(name)
return data.released.slice(-versions).map(nameMapper(data.name))
}
},
{
regexp: /^unreleased\s+versions$/i,
select: function () {
return Object.keys(agents).reduce(function (selected, name) {
var data = byName(name)
if (!data) return selected
var array = data.versions.filter(function (v) {
return data.released.indexOf(v) === -1
})
array = array.map(nameMapper(data.name))
return selected.concat(array)
}, [])
}
},
{
regexp: /^unreleased\s+electron\s+versions?$/i,
select: function () {
return []
}
},
{
regexp: /^unreleased\s+(\w+)\s+versions?$/i,
select: function (context, name) {
var data = checkName(name)
return data.versions.filter(function (v) {
return data.released.indexOf(v) === -1
}).map(nameMapper(data.name))
}
},
{
regexp: /^since (\d+)(?:-(\d+))?(?:-(\d+))?$/i,
select: function (context, year, month, date) {
year = parseInt(year)
month = parseInt(month || '01') - 1
date = parseInt(date || '01')
var since = Date.UTC(year, month, date, 0, 0, 0) / 1000
return Object.keys(agents).reduce(function (selected, name) {
var data = byName(name)
if (!data) return selected
var versions = Object.keys(data.releaseDate).filter(function (v) {
return data.releaseDate[v] >= since
})
return selected.concat(versions.map(nameMapper(data.name)))
}, [])
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%$/,
select: function (context, sign, popularity) {
popularity = parseFloat(popularity)
var usage = browserslist.usage.global
return Object.keys(usage).reduce(function (result, version) {
if (sign === '>') {
if (usage[version] > popularity) {
result.push(version)
}
} else if (sign === '<') {
if (usage[version] < popularity) {
result.push(version)
}
} else if (sign === '<=') {
if (usage[version] <= popularity) {
result.push(version)
}
} else if (usage[version] >= popularity) {
result.push(version)
}
return result
}, [])
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%\s+in\s+my\s+stats$/,
select: function (context, sign, popularity) {
popularity = parseFloat(popularity)
if (!context.customUsage) {
throw new BrowserslistError('Custom usage statistics was not provided')
}
var usage = context.customUsage
return Object.keys(usage).reduce(function (result, version) {
if (sign === '>') {
if (usage[version] > popularity) {
result.push(version)
}
} else if (sign === '<') {
if (usage[version] < popularity) {
result.push(version)
}
} else if (sign === '<=') {
if (usage[version] <= popularity) {
result.push(version)
}
} else if (usage[version] >= popularity) {
result.push(version)
}
return result
}, [])
}
},
{
regexp: /^(>=?|<=?)\s*(\d*\.?\d+)%\s+in\s+((alt-)?\w\w)$/,
select: function (context, sign, popularity, place) {
popularity = parseFloat(popularity)
if (place.length === 2) {
place = place.toUpperCase()
} else {
place = place.toLowerCase()
}
loadCountryStatistics(place)
var usage = browserslist.usage[place]
return Object.keys(usage).reduce(function (result, version) {
if (sign === '>') {
if (usage[version] > popularity) {
result.push(version)
}
} else if (sign === '<') {
if (usage[version] < popularity) {
result.push(version)
}
} else if (sign === '<=') {
if (usage[version] <= popularity) {
result.push(version)
}
} else if (usage[version] >= popularity) {
result.push(version)
}
return result
}, [])
}
},
{
regexp: /^electron\s+([\d.]+)\s*-\s*([\d.]+)$/i,
select: function (context, from, to) {
if (!e2c[from]) {
throw new BrowserslistError('Unknown version ' + from + ' of electron')
}
if (!e2c[to]) {
throw new BrowserslistError('Unknown version ' + to + ' of electron')
}
from = parseFloat(from)
to = parseFloat(to)
return Object.keys(e2c).filter(function (i) {
var parsed = parseFloat(i)
return parsed >= from && parsed <= to
}).map(function (i) {
return 'chrome ' + e2c[i]
})
}
},
{
regexp: /^(\w+)\s+([\d.]+)\s*-\s*([\d.]+)$/i,
select: function (context, name, from, to) {
var data = checkName(name)
from = parseFloat(normalizeVersion(data, from) || from)
to = parseFloat(normalizeVersion(data, to) || to)
function filter (v) {
var parsed = parseFloat(v)
return parsed >= from && parsed <= to
}
return data.released.filter(filter).map(nameMapper(data.name))
}
},
{
regexp: /^electron\s*(>=?|<=?)\s*([\d.]+)$/i,
select: function (context, sign, version) {
return Object.keys(e2c)
.filter(generateFilter(sign, version))
.map(function (i) {
return 'chrome ' + e2c[i]
})
}
},
{
regexp: /^(\w+)\s*(>=?|<=?)\s*([\d.]+)$/,
select: function (context, name, sign, version) {
var data = checkName(name)
var alias = browserslist.versionAliases[data.name][version]
if (alias) {
version = alias
}
return data.released
.filter(generateFilter(sign, version))
.map(function (v) {
return data.name + ' ' + v
})
}
},
{
regexp: /^(firefox|ff|fx)\s+esr$/i,
select: function () {
return ['firefox 52']
}
},
{
regexp: /(operamini|op_mini)\s+all/i,
select: function () {
return ['op_mini all']
}
},
{
regexp: /^electron\s+([\d.]+)$/i,
select: function (context, version) {
var chrome = e2c[version]
if (!chrome) {
throw new BrowserslistError(
'Unknown version ' + version + ' of electron')
}
return ['chrome ' + chrome]
}
},
{
regexp: /^(\w+)\s+(tp|[\d.]+)$/i,
select: function (context, name, version) {
if (/^tp$/i.test(version)) version = 'TP'
var data = checkName(name)
var alias = normalizeVersion(data, version)
if (alias) {
version = alias
} else {
if (version.indexOf('.') === -1) {
alias = version + '.0'
} else if (/\.0$/.test(version)) {
alias = version.replace(/\.0$/, '')
}
alias = normalizeVersion(data, alias)
if (alias) {
version = alias
} else {
throw new BrowserslistError(
'Unknown version ' + version + ' of ' + name)
}
}
return [data.name + ' ' + version]
}
},
{
regexp: /^extends (.+)$/i,
select: function (context, name) {
if (!context.dangerousExtend) checkExtend(name)
// eslint-disable-next-line security/detect-non-literal-require
var queries = require(name)
if (!Array.isArray(queries)) {
throw new BrowserslistError(
'`' + name + '` config exports not an array of queries')
}
return resolve(queries, context)
}
},
{
regexp: /^defaults$/i,
select: function () {
return browserslist(browserslist.defaults)
}
}
]
var CONFIG_PATTERN = /^browserslist-config-/
var SCOPED_CONFIG__PATTERN = /@[^./]+\/browserslist-config(-|$)/
function checkExtend (name) {
var use = ' Use `dangerousExtend` option to disable.'
if (!CONFIG_PATTERN.test(name) && !SCOPED_CONFIG__PATTERN.test(name)) {
throw new BrowserslistError(
'Browserslist config needs `browserslist-config-` prefix. ' + use)
}
if (name.indexOf('.') !== -1) {
throw new BrowserslistError(
'`.` not allowed in Browserslist config name. ' + use)
}
if (name.indexOf('node_modules') !== -1) {
throw new BrowserslistError(
'`node_modules` not allowed in Browserslist config.' + use)
}
}
// Get and convert Can I Use data
(function () {
for (var name in agents) {
var browser = agents[name]
browserslist.data[name] = {
name: name,
versions: normalize(agents[name].versions),
released: normalize(agents[name].versions.slice(0, -3)),
releaseDate: agents[name].release_date
}
fillUsage(browserslist.usage.global, name, browser.usage_global)
browserslist.versionAliases[name] = { }
for (var i = 0; i < browser.versions.length; i++) {
var full = browser.versions[i]
if (!full) continue
if (full.indexOf('-') !== -1) {
var interval = full.split('-')
for (var j = 0; j < interval.length; j++) {
browserslist.versionAliases[name][interval[j]] = full
}
}
}
}
}())
module.exports = browserslist

127
build/node_modules/browserslist/package.json generated vendored Normal file
View File

@@ -0,0 +1,127 @@
{
"_args": [
[
"browserslist@2.10.2",
"/Users/asciidisco/Desktop/asciidisco.com/build"
]
],
"_from": "browserslist@2.10.2",
"_id": "browserslist@2.10.2",
"_inBundle": false,
"_integrity": "sha512-laXHudMWp4ZLgmObmAHZEzkP7Te4lzUyueSZabSuWTImaQznFhFm42SDRmwutfpAOHqDB4fJKGWSZdyrf5TsXg==",
"_location": "/browserslist",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "browserslist@2.10.2",
"name": "browserslist",
"escapedName": "browserslist",
"rawSpec": "2.10.2",
"saveSpec": null,
"fetchSpec": "2.10.2"
},
"_requiredBy": [
"/autoprefixer"
],
"_resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.10.2.tgz",
"_spec": "2.10.2",
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
"author": {
"name": "Andrey Sitnik",
"email": "andrey@sitnik.ru"
},
"bin": {
"browserslist": "./cli.js"
},
"browser": {
"process": false,
"path": false,
"fs": false
},
"bugs": {
"url": "https://github.com/ai/browserslist/issues"
},
"dependencies": {
"caniuse-lite": "^1.0.30000784",
"electron-to-chromium": "^1.3.30"
},
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
"devDependencies": {
"cross-spawn": "^5.1.0",
"eslint": "^4.14.0",
"eslint-ci": "^0.1.1",
"eslint-config-logux": "^17.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-es5": "^1.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.5.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-standard": "^3.0.1",
"jest": "^22.0.4",
"lint-staged": "^6.0.0",
"pre-commit": "^1.1.3",
"size-limit": "^0.13.2",
"yaspeller-ci": "^1.0.0"
},
"eslintConfig": {
"extends": "eslint-config-logux/browser",
"rules": {
"security/detect-unsafe-regex": "off",
"global-require": "off"
},
"overrides": {
"files": [
"*.test.js"
],
"rules": {
"es5/no-arrow-functions": "off"
}
}
},
"homepage": "https://github.com/ai/browserslist#readme",
"jest": {
"testEnvironment": "node",
"coverageThreshold": {
"global": {
"statements": 100
}
},
"modulePathIgnorePatterns": [
"<rootDir>/test/fixtures"
]
},
"keywords": [
"caniuse",
"browsers",
"target"
],
"license": "MIT",
"lint-staged": {
"*.md": "yaspeller-ci",
"*.js": "eslint"
},
"name": "browserslist",
"pre-commit": [
"lint-staged"
],
"repository": {
"type": "git",
"url": "git+https://github.com/ai/browserslist.git"
},
"scripts": {
"lint": "eslint-ci *.js test/*.js __mocks__/*.js",
"lint-staged": "lint-staged",
"spellcheck": "yaspeller-ci README.md CHANGELOG.md",
"test": "jest --coverage && yarn lint && yarn spellcheck && size-limit"
},
"size-limit": [
{
"path": "index.js",
"limit": "160 KB"
}
],
"version": "2.10.2"
}