browserslist 4.25.4 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +76 -0
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var bbm = require('baseline-browser-mapping')
|
|
1
2
|
var jsReleases = require('node-releases/data/processed/envs.json')
|
|
2
3
|
var agents = require('caniuse-lite/dist/unpacker/agents').agents
|
|
3
4
|
var e2c = require('electron-to-chromium/versions')
|
|
@@ -593,6 +594,33 @@ function sinceQuery(context, node) {
|
|
|
593
594
|
return filterByYear(Date.UTC(year, month, day, 0, 0, 0), context)
|
|
594
595
|
}
|
|
595
596
|
|
|
597
|
+
function bbmTransform(bbmVersions) {
|
|
598
|
+
var browsers = {
|
|
599
|
+
chrome: 'chrome',
|
|
600
|
+
chrome_android: 'and_chr',
|
|
601
|
+
edge: 'edge',
|
|
602
|
+
firefox: 'firefox',
|
|
603
|
+
firefox_android: 'and_ff',
|
|
604
|
+
safari: 'safari',
|
|
605
|
+
safari_ios: 'ios_saf',
|
|
606
|
+
webview_android: 'android',
|
|
607
|
+
samsunginternet_android: 'samsung',
|
|
608
|
+
opera_android: 'op_mob',
|
|
609
|
+
opera: 'opera',
|
|
610
|
+
qq_android: 'and_qq',
|
|
611
|
+
uc_android: 'and_uc',
|
|
612
|
+
kai_os: 'kaios'
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
return bbmVersions
|
|
616
|
+
.filter(function (version) {
|
|
617
|
+
return Object.keys(browsers).indexOf(version.browser) !== -1
|
|
618
|
+
})
|
|
619
|
+
.map(function (version) {
|
|
620
|
+
return browsers[version.browser] + ' >= ' + version.version
|
|
621
|
+
})
|
|
622
|
+
}
|
|
623
|
+
|
|
596
624
|
function coverQuery(context, node) {
|
|
597
625
|
var coverage = parseFloat(node.coverage)
|
|
598
626
|
var usage = browserslist.usage.global
|
|
@@ -780,6 +808,54 @@ var QUERIES = {
|
|
|
780
808
|
regexp: /^since (\d+)-(\d+)-(\d+)$/i,
|
|
781
809
|
select: sinceQuery
|
|
782
810
|
},
|
|
811
|
+
baseline: {
|
|
812
|
+
matches: ['year', 'availability', 'date', 'downstream', 'kaios'],
|
|
813
|
+
// Matches:
|
|
814
|
+
// baseline 2024
|
|
815
|
+
// baseline newly available
|
|
816
|
+
// baseline widely available
|
|
817
|
+
// baseline widely available on 2024-06-01
|
|
818
|
+
// ...with downstream
|
|
819
|
+
// ...including kaios
|
|
820
|
+
regexp:
|
|
821
|
+
/^baseline\s+(?:(\d+)|(newly|widely)\s+available(?:\s+on\s+(\d{4}-\d{2}-\d{2}))?)?(\s+with\s+downstream)?(\s+including\s+kaios)?$/i,
|
|
822
|
+
select: function (context, node) {
|
|
823
|
+
var baselineVersions
|
|
824
|
+
var includeDownstream = !!node.downstream
|
|
825
|
+
var includeKaiOS = !!node.kaios
|
|
826
|
+
if (node.availability === 'newly' && node.date) {
|
|
827
|
+
throw new BrowserslistError(
|
|
828
|
+
'Using newly available with a date is not supported, please use "widely available on YYYY-MM-DD" and add 30 months to the date you specified.'
|
|
829
|
+
)
|
|
830
|
+
}
|
|
831
|
+
if (node.year) {
|
|
832
|
+
baselineVersions = bbm.getCompatibleVersions({
|
|
833
|
+
targetYear: node.year,
|
|
834
|
+
includeDownstreamBrowsers: includeDownstream,
|
|
835
|
+
includeKaiOS: includeKaiOS
|
|
836
|
+
})
|
|
837
|
+
} else if (node.date) {
|
|
838
|
+
baselineVersions = bbm.getCompatibleVersions({
|
|
839
|
+
widelyAvailableOnDate: node.date,
|
|
840
|
+
includeDownstreamBrowsers: includeDownstream,
|
|
841
|
+
includeKaiOS: includeKaiOS
|
|
842
|
+
})
|
|
843
|
+
} else if (node.availability === 'newly') {
|
|
844
|
+
var future30months = new Date().setMonth(new Date().getMonth() + 30)
|
|
845
|
+
baselineVersions = bbm.getCompatibleVersions({
|
|
846
|
+
widelyAvailableOnDate: future30months,
|
|
847
|
+
includeDownstreamBrowsers: includeDownstream,
|
|
848
|
+
includeKaiOS: includeKaiOS
|
|
849
|
+
})
|
|
850
|
+
} else {
|
|
851
|
+
baselineVersions = bbm.getCompatibleVersions({
|
|
852
|
+
includeDownstreamBrowsers: includeDownstream,
|
|
853
|
+
includeKaiOS: includeKaiOS
|
|
854
|
+
})
|
|
855
|
+
}
|
|
856
|
+
return resolve(bbmTransform(baselineVersions), context)
|
|
857
|
+
}
|
|
858
|
+
},
|
|
783
859
|
popularity: {
|
|
784
860
|
matches: ['sign', 'popularity'],
|
|
785
861
|
regexp: /^(>=?|<=?)\s*(\d+|\d+\.\d+|\.\d+)%$/,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserslist",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caniuse",
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"repository": "browserslist/browserslist",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"baseline-browser-mapping": "^2.8.2",
|
|
29
|
+
"caniuse-lite": "^1.0.30001741",
|
|
30
|
+
"electron-to-chromium": "^1.5.218",
|
|
31
|
+
"node-releases": "^2.0.21",
|
|
31
32
|
"update-browserslist-db": "^1.1.3"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|