From 5e940d93204883884fcca9780dbe96157061b716 Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 23 Apr 2020 16:09:04 -0700 Subject: update @npmcli/arborist, dedupe/organize metadeps This adds support for Arborist.audit() --- node_modules/p-map/index.d.ts | 4 +++- node_modules/p-map/index.js | 12 ++++++------ node_modules/p-map/license | 2 +- node_modules/p-map/package.json | 33 +++++++++++++++++---------------- node_modules/p-map/readme.md | 26 ++++++++------------------ 5 files changed, 35 insertions(+), 42 deletions(-) (limited to 'node_modules/p-map') diff --git a/node_modules/p-map/index.d.ts b/node_modules/p-map/index.d.ts index 8f796295d..bcbe0afce 100644 --- a/node_modules/p-map/index.d.ts +++ b/node_modules/p-map/index.d.ts @@ -3,6 +3,8 @@ declare namespace pMap { /** Number of concurrently pending promises returned by `mapper`. + Must be an integer from 1 and up or `Infinity`. + @default Infinity */ readonly concurrency?: number; @@ -21,7 +23,7 @@ declare namespace pMap { @param element - Iterated element. @param index - Index of the element in the source array. */ - type Mapper = ( + type Mapper = ( element: Element, index: number ) => NewElement | Promise; diff --git a/node_modules/p-map/index.js b/node_modules/p-map/index.js index 5a8aeb256..c11a28512 100644 --- a/node_modules/p-map/index.js +++ b/node_modules/p-map/index.js @@ -14,11 +14,11 @@ module.exports = async ( throw new TypeError('Mapper function is required'); } - if (!(typeof concurrency === 'number' && concurrency >= 1)) { - throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); + if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) { + throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`); } - const ret = []; + const result = []; const errors = []; const iterator = iterable[Symbol.iterator](); let isRejected = false; @@ -32,7 +32,7 @@ module.exports = async ( } const nextItem = iterator.next(); - const i = currentIndex; + const index = currentIndex; currentIndex++; if (nextItem.done) { @@ -42,7 +42,7 @@ module.exports = async ( if (!stopOnError && errors.length !== 0) { reject(new AggregateError(errors)); } else { - resolve(ret); + resolve(result); } } @@ -54,7 +54,7 @@ module.exports = async ( (async () => { try { const element = await nextItem.value; - ret[i] = await mapper(element, i); + result[index] = await mapper(element, index); resolvingCount--; next(); } catch (error) { diff --git a/node_modules/p-map/license b/node_modules/p-map/license index e7af2f771..fa7ceba3e 100644 --- a/node_modules/p-map/license +++ b/node_modules/p-map/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) 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: diff --git a/node_modules/p-map/package.json b/node_modules/p-map/package.json index 21aff08b2..5d61ae6a1 100644 --- a/node_modules/p-map/package.json +++ b/node_modules/p-map/package.json @@ -1,31 +1,31 @@ { - "_from": "p-map@^3.0.0", - "_id": "p-map@3.0.0", + "_from": "p-map@^4.0.0", + "_id": "p-map@4.0.0", "_inBundle": false, - "_integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "_integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "_location": "/p-map", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "p-map@^3.0.0", + "raw": "p-map@^4.0.0", "name": "p-map", "escapedName": "p-map", - "rawSpec": "^3.0.0", + "rawSpec": "^4.0.0", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "^4.0.0" }, "_requiredBy": [ - "/npm-registry-fetch/cacache" + "/cacache" ], - "_resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "_shasum": "d704d9af8a2ba684e2600d9a215983d4141a979d", - "_spec": "p-map@^3.0.0", - "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-registry-fetch/node_modules/cacache", + "_resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "_shasum": "bb2f95a5eda2ec168ec9274e06a747c3e2904d2b", + "_spec": "p-map@^4.0.0", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/cacache", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/p-map/issues" @@ -42,16 +42,17 @@ "in-range": "^2.0.0", "random-int": "^2.0.0", "time-span": "^3.1.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "tsd": "^0.7.4", + "xo": "^0.27.2" }, "engines": { - "node": ">=8" + "node": ">=10" }, "files": [ "index.js", "index.d.ts" ], + "funding": "https://github.com/sponsors/sindresorhus", "homepage": "https://github.com/sindresorhus/p-map#readme", "keywords": [ "promise", @@ -80,5 +81,5 @@ "scripts": { "test": "xo && ava && tsd" }, - "version": "3.0.0" + "version": "4.0.0" } diff --git a/node_modules/p-map/readme.md b/node_modules/p-map/readme.md index 4941cb773..53a371574 100644 --- a/node_modules/p-map/readme.md +++ b/node_modules/p-map/readme.md @@ -4,14 +4,12 @@ Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently. - ## Install ``` $ npm install p-map ``` - ## Usage ```js @@ -61,19 +59,24 @@ Type: `object` ##### concurrency -Type: `number`
-Default: `Infinity`
+Type: `number` (Integer)\ +Default: `Infinity`\ Minimum: `1` Number of concurrently pending promises returned by `mapper`. ##### stopOnError -Type: `boolean`
+Type: `boolean`\ Default: `true` When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises. +## p-map for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of p-map and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-p-map?utm_source=npm-p-map&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## Related @@ -84,16 +87,3 @@ When set to `false`, instead of stopping when a promise rejects, it will wait fo - [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially - [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control - [Moreā€¦](https://github.com/sindresorhus/promise-fun) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
-- cgit v1.2.3