browserslist 4.11.0 → 4.11.1
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/CHANGELOG.md +3 -0
- package/node.js +2 -3
- package/package.json +5 -5
- package/update-db.js +26 -23
package/CHANGELOG.md
CHANGED
package/node.js
CHANGED
|
@@ -342,10 +342,9 @@ module.exports = {
|
|
|
342
342
|
var halfYearAgo = Date.now() - TIME_TO_UPDATE_CANIUSE
|
|
343
343
|
|
|
344
344
|
if (latest !== 0 && latest < halfYearAgo) {
|
|
345
|
-
var command = 'npx browserslist --update-db'
|
|
346
345
|
console.warn(
|
|
347
|
-
'Browserslist: caniuse-lite is outdated. ' +
|
|
348
|
-
'
|
|
346
|
+
'Browserslist: caniuse-lite is outdated. Please run:\n' +
|
|
347
|
+
'npx browserslist@latest --update-db'
|
|
349
348
|
)
|
|
350
349
|
}
|
|
351
350
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserslist",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caniuse",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"repository": "browserslist/browserslist",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"caniuse-lite": "^1.0.
|
|
19
|
-
"electron-to-chromium": "^1.3.
|
|
20
|
-
"node-releases": "^1.1.
|
|
21
|
-
"pkg-up": "^
|
|
18
|
+
"caniuse-lite": "^1.0.30001038",
|
|
19
|
+
"electron-to-chromium": "^1.3.390",
|
|
20
|
+
"node-releases": "^1.1.53",
|
|
21
|
+
"pkg-up": "^2.0.0"
|
|
22
22
|
},
|
|
23
23
|
"bin": "./cli.js",
|
|
24
24
|
"browser": {
|
package/update-db.js
CHANGED
|
@@ -19,12 +19,13 @@ function detectLockfile () {
|
|
|
19
19
|
var lockfileYarn = path.join(rootDir, 'yarn.lock')
|
|
20
20
|
var lockfilePnpm = path.join(rootDir, 'pnpm-lock.yaml')
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/* istanbul ignore next */
|
|
23
|
+
if (fs.existsSync(lockfilePnpm)) {
|
|
24
|
+
return { mode: 'pnpm', file: lockfilePnpm }
|
|
25
|
+
} else if (fs.existsSync(lockfileNpm)) {
|
|
23
26
|
return { mode: 'npm', file: lockfileNpm }
|
|
24
27
|
} else if (fs.existsSync(lockfileYarn)) {
|
|
25
28
|
return { mode: 'yarn', file: lockfileYarn }
|
|
26
|
-
} else if (fs.existsSync(lockfilePnpm)) {
|
|
27
|
-
return { mode: 'pnpm', file: lockfilePnpm }
|
|
28
29
|
} else {
|
|
29
30
|
throw new BrowserslistError(
|
|
30
31
|
'No lockfile found. Run "npm install", "yarn install" or "pnpm install"'
|
|
@@ -34,7 +35,11 @@ function detectLockfile () {
|
|
|
34
35
|
|
|
35
36
|
function getCurrentVersion (lock) {
|
|
36
37
|
var match
|
|
37
|
-
|
|
38
|
+
/* istanbul ignore if */
|
|
39
|
+
if (lock.mode === 'pnpm') {
|
|
40
|
+
match = /\/caniuse-lite\/([^:]+):/.exec(lock.content)
|
|
41
|
+
if (match[1]) return match[1]
|
|
42
|
+
} else if (lock.mode === 'npm') {
|
|
38
43
|
var dependencies = JSON.parse(lock.content).dependencies
|
|
39
44
|
if (dependencies && dependencies['caniuse-lite']) {
|
|
40
45
|
return dependencies['caniuse-lite'].version
|
|
@@ -42,9 +47,6 @@ function getCurrentVersion (lock) {
|
|
|
42
47
|
} else if (lock.mode === 'yarn') {
|
|
43
48
|
match = /caniuse-lite@[^:]+:\n\s+version\s+"([^"]+)"/.exec(lock.content)
|
|
44
49
|
if (match[1]) return match[1]
|
|
45
|
-
} else if (lock.mode === 'pnpm') {
|
|
46
|
-
match = /\/caniuse-lite\/([^:]+):/.exec(lock.content)
|
|
47
|
-
if (match[1]) return match[1]
|
|
48
50
|
}
|
|
49
51
|
return null
|
|
50
52
|
}
|
|
@@ -62,22 +64,8 @@ function updateLockfile (lock, latest) {
|
|
|
62
64
|
} else {
|
|
63
65
|
var lines = lock.content.split('\n')
|
|
64
66
|
var i
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (lines[i].indexOf('caniuse-lite@') !== -1) {
|
|
68
|
-
lines[i + 1] = lines[i + 1].replace(
|
|
69
|
-
/version "[^"]+"/, 'version "' + latest.version + '"'
|
|
70
|
-
)
|
|
71
|
-
lines[i + 2] = lines[i + 2].replace(
|
|
72
|
-
/resolved "[^"]+"/, 'resolved "' + latest.dist.tarball + '"'
|
|
73
|
-
)
|
|
74
|
-
lines[i + 3] = lines[i + 3].replace(
|
|
75
|
-
/integrity .+/, 'integrity ' + latest.dist.integrity
|
|
76
|
-
)
|
|
77
|
-
i += 4
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
} else if (lock.mode === 'pnpm') {
|
|
67
|
+
/* istanbul ignore if */
|
|
68
|
+
if (lock.mode === 'pnpm') {
|
|
81
69
|
for (i = 0; i < lines.length; i++) {
|
|
82
70
|
if (lines[i].indexOf('caniuse-lite:') >= 0) {
|
|
83
71
|
lines[i] = lines[i].replace(/: .*$/, ': ' + latest.version)
|
|
@@ -94,6 +82,21 @@ function updateLockfile (lock, latest) {
|
|
|
94
82
|
}
|
|
95
83
|
}
|
|
96
84
|
}
|
|
85
|
+
} else if (lock.mode === 'yarn') {
|
|
86
|
+
for (i = 0; i < lines.length; i++) {
|
|
87
|
+
if (lines[i].indexOf('caniuse-lite@') !== -1) {
|
|
88
|
+
lines[i + 1] = lines[i + 1].replace(
|
|
89
|
+
/version "[^"]+"/, 'version "' + latest.version + '"'
|
|
90
|
+
)
|
|
91
|
+
lines[i + 2] = lines[i + 2].replace(
|
|
92
|
+
/resolved "[^"]+"/, 'resolved "' + latest.dist.tarball + '"'
|
|
93
|
+
)
|
|
94
|
+
lines[i + 3] = lines[i + 3].replace(
|
|
95
|
+
/integrity .+/, 'integrity ' + latest.dist.integrity
|
|
96
|
+
)
|
|
97
|
+
i += 4
|
|
98
|
+
}
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
101
|
return lines.join('\n')
|
|
99
102
|
}
|