browserslist
- Version 4.24.4
- Published
- 64.9 kB
- 4 dependencies
- MIT license
Install
npm i browserslist
yarn add browserslist
pnpm add browserslist
Overview
Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
Variables
variable aliases
let aliases: { [alias: string]: string };
Browser names aliases.
variable cache
let cache: { [feature: string]: { [name: string]: { [version: string]: string } } };
variable data
let data: { [browser: string]: { name: string; versions: string[]; released: string[]; releaseDate: { [version: string]: number }; };};
variable defaults
let defaults: readonly string[];
Default browsers query
variable desktopNames
let desktopNames: { [browser: string]: string };
Can I Use only provides a few versions for some browsers (e.g.
and_chr
).Fallback to a similar browser for unknown versions.
variable nodeVersions
let nodeVersions: string[];
variable usage
let usage: { [country: string]: Usage; global?: Usage; custom?: Usage | null };
variable versionAliases
let versionAliases: { [browser: string]: { [version: string]: string } };
Aliases to work with joined versions like
ios_saf 7.0-7.1
.
Functions
function browserslist
browserslist: typeof browserslist;
Return array of browsers by selection queries.
browserslist('IE >= 10, IE 8') //=> ['ie 11', 'ie 10', 'ie 8']Parameter queries
Browser queries.
Parameter opts
Options.
Returns
Array with browser names in Can I Use.
function clearCaches
clearCaches: () => void;
function coverage
coverage: (browsers: readonly string[], stats?: StatsOptions) => number;
Return browsers market coverage.
browserslist.coverage(browserslist('> 1% in US'), 'US') //=> 83.1Parameter browsers
Browsers names in Can I Use.
Parameter stats
Which statistics should be used.
Returns
Total market coverage for all selected browsers.
function findConfig
findConfig: (...pathSegments: string[]) => Config | undefined;
function findConfigFile
findConfigFile: (...pathSegments: string[]) => string | undefined;
function loadConfig
loadConfig: (options: LoadConfigOptions) => string[] | undefined;
Return queries for specific file inside the project.
browserslist.loadConfig({file: process.cwd()}) ?? browserslist.defaults
function parse
parse: ( queries?: string | readonly string[] | null, opts?: browserslist.Options) => Query[];
Get queries AST to analyze the config content.
Parameter queries
Browser queries.
Parameter opts
Options.
Returns
An array of the data of each query in the config.
function parseConfig
parseConfig: (string: string) => Config;
function readConfig
readConfig: (file: string) => Config;
Interfaces
interface LoadConfigOptions
interface LoadConfigOptions {}
interface Options
interface Options {}
property config
config?: string;
Path to config file with queries.
property dangerousExtend
dangerousExtend?: boolean;
Disable security checks for extend query.
property env
env?: string;
Processing environment. It will be used to take right queries from config file.
property ignoreUnknownVersions
ignoreUnknownVersions?: boolean;
Do not throw on unknown version in direct query.
property mobileToDesktop
mobileToDesktop?: boolean;
Alias mobile browsers to the desktop version when Can I Use doesn’t have data about the specified version.
property path
path?: string | false;
Path to processed file. It will be used to find config files.
property stats
stats?: Stats | string;
Custom browser usage statistics for "> 1% in my stats" query.
property throwOnMissing
throwOnMissing?: boolean;
Throw an error if env is not found.
interface Query
interface Query {}
interface Stats
interface Stats {}
index signature
[browser: string]: { [version: string]: number;};
interface Usage
interface Usage {}
index signature
[version: string]: number;
Type Aliases
type Config
type Config = { defaults: string[]; [section: string]: string[] | undefined;};
type StatsOptions
type StatsOptions = string | 'my stats' | Stats | { dataByBrowser: Stats };
Which statistics should be used. Country code or custom statistics. Pass
"my stats"
to load statistics fromBrowserslist
files.
Namespaces
namespace global
namespace global {}
namespace global.NodeJS
namespace global.NodeJS {}
interface ProcessEnv
interface ProcessEnv {}
property BROWSERSLIST
BROWSERSLIST?: string;
property BROWSERSLIST_CONFIG
BROWSERSLIST_CONFIG?: string;
property BROWSERSLIST_DANGEROUS_EXTEND
BROWSERSLIST_DANGEROUS_EXTEND?: string;
property BROWSERSLIST_DISABLE_CACHE
BROWSERSLIST_DISABLE_CACHE?: string;
property BROWSERSLIST_ENV
BROWSERSLIST_ENV?: string;
property BROWSERSLIST_IGNORE_OLD_DATA
BROWSERSLIST_IGNORE_OLD_DATA?: string;
property BROWSERSLIST_ROOT_PATH
BROWSERSLIST_ROOT_PATH?: string;
property BROWSERSLIST_STATS
BROWSERSLIST_STATS?: string;
Package Files (1)
Dependencies (4)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/browserslist
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/browserslist)
- HTML<a href="https://www.jsdocs.io/package/browserslist"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3571 ms. - Missing or incorrect documentation? Open an issue for this package.