browserslist 4.17.4 → 4.17.5

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/update-db.js +48 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.17.4",
3
+ "version": "4.17.5",
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.30001265",
19
- "electron-to-chromium": "^1.3.867",
18
+ "caniuse-lite": "^1.0.30001271",
19
+ "electron-to-chromium": "^1.3.878",
20
20
  "escalade": "^3.1.1",
21
- "node-releases": "^2.0.0",
21
+ "node-releases": "^2.0.1",
22
22
  "picocolors": "^1.0.0"
23
23
  },
24
24
  "engines": {
package/update-db.js CHANGED
@@ -164,7 +164,19 @@ function updatePnpmLockfile (lock, latest) {
164
164
  for (i = 0; i < lines.length; i++) {
165
165
  if (lines[i].indexOf('caniuse-lite:') >= 0) {
166
166
  lineParts = lines[i].split(/:\s?/, 2)
167
- versions[lineParts[1]] = true
167
+ if (lineParts[1].indexOf('/') >= 0) {
168
+ var sublineParts = lineParts[1].split(/([/:])/)
169
+ for (j = 0; j < sublineParts.length; j++) {
170
+ if (sublineParts[j].indexOf('caniuse-lite') >= 0) {
171
+ versions[sublineParts[j + 2]] = true
172
+ sublineParts[j + 2] = latest.version
173
+ break
174
+ }
175
+ }
176
+ lineParts[1] = sublineParts.join('')
177
+ } else {
178
+ versions[lineParts[1]] = true
179
+ }
168
180
  lines[i] = lineParts[0] + ': ' + latest.version
169
181
  } else if (lines[i].indexOf('/caniuse-lite') >= 0) {
170
182
  lineParts = lines[i].split(/([/:])/)
@@ -179,7 +191,8 @@ function updatePnpmLockfile (lock, latest) {
179
191
  for (i = i + 1; i < lines.length; i++) {
180
192
  if (lines[i].indexOf('integrity: ') !== -1) {
181
193
  lines[i] = lines[i].replace(
182
- /integrity: .+/, 'integrity: ' + latest.dist.integrity
194
+ /integrity: .+/,
195
+ 'integrity: ' + latest.dist.integrity
183
196
  )
184
197
  } else if (lines[i].indexOf(' /') !== -1) {
185
198
  break
@@ -204,11 +217,13 @@ function updateLockfile (lock, latest) {
204
217
  function updatePackageManually (print, lock, latest) {
205
218
  var lockfileData = updateLockfile(lock, latest)
206
219
  var caniuseVersions = Object.keys(lockfileData.versions).sort()
207
- if (caniuseVersions.length === 1 &&
208
- caniuseVersions[0] === latest.version) {
220
+ if (caniuseVersions.length === 1 && caniuseVersions[0] === latest.version) {
209
221
  print(
210
- 'Installed version: ' + pico.bold(pico.green(latest.version)) + '\n' +
211
- pico.bold(pico.green('caniuse-lite is up to date')) + '\n'
222
+ 'Installed version: ' +
223
+ pico.bold(pico.green(latest.version)) +
224
+ '\n' +
225
+ pico.bold(pico.green('caniuse-lite is up to date')) +
226
+ '\n'
212
227
  )
213
228
  return
214
229
  }
@@ -218,17 +233,18 @@ function updatePackageManually (print, lock, latest) {
218
233
  }
219
234
  print(
220
235
  'Installed version' +
221
- (caniuseVersions.length === 1 ? ': ' : 's: ') +
222
- pico.bold(pico.red(caniuseVersions.join(', '))) +
223
- '\n' +
224
- 'Removing old caniuse-lite from lock file\n'
236
+ (caniuseVersions.length === 1 ? ': ' : 's: ') +
237
+ pico.bold(pico.red(caniuseVersions.join(', '))) +
238
+ '\n' +
239
+ 'Removing old caniuse-lite from lock file\n'
225
240
  )
226
241
  fs.writeFileSync(lock.file, lockfileData.content)
227
242
 
228
243
  var install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'
229
244
  print(
230
245
  'Installing new caniuse-lite version\n' +
231
- pico.yellow('$ ' + install + ' caniuse-lite') + '\n'
246
+ pico.yellow('$ ' + install + ' caniuse-lite') +
247
+ '\n'
232
248
  )
233
249
  try {
234
250
  childProcess.execSync(install + ' caniuse-lite')
@@ -236,9 +252,12 @@ function updatePackageManually (print, lock, latest) {
236
252
  print(
237
253
  pico.red(
238
254
  '\n' +
239
- e.stack + '\n\n' +
240
- 'Problem with `' + install + ' caniuse-lite` call. ' +
241
- 'Run it manually.\n'
255
+ e.stack +
256
+ '\n\n' +
257
+ 'Problem with `' +
258
+ install +
259
+ ' caniuse-lite` call. ' +
260
+ 'Run it manually.\n'
242
261
  )
243
262
  )
244
263
  process.exit(1)
@@ -247,7 +266,8 @@ function updatePackageManually (print, lock, latest) {
247
266
  var del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall'
248
267
  print(
249
268
  'Cleaning package.json dependencies from caniuse-lite\n' +
250
- pico.yellow('$ ' + del + ' caniuse-lite') + '\n'
269
+ pico.yellow('$ ' + del + ' caniuse-lite') +
270
+ '\n'
251
271
  )
252
272
  childProcess.execSync(del + ' caniuse-lite')
253
273
  }
@@ -264,15 +284,14 @@ module.exports = function updateDB (print) {
264
284
  browsersListRetrievalError = e
265
285
  }
266
286
 
267
- print(
268
- 'Latest version: ' + pico.bold(pico.green(latest.version)) + '\n'
269
- )
287
+ print('Latest version: ' + pico.bold(pico.green(latest.version)) + '\n')
270
288
 
271
289
  if (lock.mode === 'yarn' && lock.version !== 1) {
272
290
  var update = 'yarn up -R'
273
291
  print(
274
292
  'Updating caniuse-lite version\n' +
275
- pico.yellow('$ ' + update + ' caniuse-lite') + '\n'
293
+ pico.yellow('$ ' + update + ' caniuse-lite') +
294
+ '\n'
276
295
  )
277
296
  try {
278
297
  childProcess.execSync(update + ' caniuse-lite')
@@ -280,9 +299,12 @@ module.exports = function updateDB (print) {
280
299
  print(
281
300
  pico.red(
282
301
  '\n' +
283
- e.stack + '\n\n' +
284
- 'Problem with `' + update + ' caniuse-lite` call. ' +
285
- 'Run it manually.\n'
302
+ e.stack +
303
+ '\n\n' +
304
+ 'Problem with `' +
305
+ update +
306
+ ' caniuse-lite` call. ' +
307
+ 'Run it manually.\n'
286
308
  )
287
309
  )
288
310
  process.exit(1)
@@ -306,9 +328,10 @@ module.exports = function updateDB (print) {
306
328
  print(
307
329
  pico.red(
308
330
  '\n' +
309
- browsersListRetrievalError.stack + '\n\n' +
310
- 'Problem with browser list retrieval.\n' +
311
- 'Target browser changes won’t be shown.\n'
331
+ browsersListRetrievalError.stack +
332
+ '\n\n' +
333
+ 'Problem with browser list retrieval.\n' +
334
+ 'Target browser changes won’t be shown.\n'
312
335
  )
313
336
  )
314
337
  } else {