diff --git a/lib/entry-index.js b/lib/entry-index.js index 89c28f2..0e09b10 100644 --- a/lib/entry-index.js +++ b/lib/entry-index.js @@ -19,7 +19,6 @@ const hashToSegments = require('./util/hash-to-segments') const indexV = require('../package.json')['cache-version'].index const { moveFile } = require('@npmcli/fs') -const pMap = require('p-map') const lsStreamConcurrency = 5 module.exports.NotFoundError = class NotFoundError extends Error { @@ -184,6 +183,7 @@ function lsStream (cache) { // Set all this up to run on the stream and then just return the stream Promise.resolve().then(async () => { + const { default: pMap } = await import('p-map') const buckets = await readdirOrEmpty(indexDir) await pMap(buckets, async (bucket) => { const bucketPath = path.join(indexDir, bucket) diff --git a/lib/verify.js b/lib/verify.js index d7423da..dcff3aa 100644 --- a/lib/verify.js +++ b/lib/verify.js @@ -8,7 +8,6 @@ const { truncate, writeFile, } = require('fs/promises') -const pMap = require('p-map') const contentPath = require('./content/path') const fsm = require('fs-minipass') const glob = require('./util/glob.js') @@ -93,6 +92,7 @@ async function fixPerms (cache, opts) { // async function garbageCollect (cache, opts) { opts.log.silly('verify', 'garbage collecting content') + const { default: pMap } = await import('p-map') const indexStream = index.lsStream(cache) const liveContent = new Set() indexStream.on('data', (entry) => { @@ -176,6 +176,7 @@ async function verifyContent (filepath, sri) { async function rebuildIndex (cache, opts) { opts.log.silly('verify', 'rebuilding index') + const { default: pMap } = await import('p-map') const entries = await index.ls(cache) const stats = { missingContent: 0, diff --git a/package.json b/package.json index 599c7e3..3e1f11b 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", + "p-map": "^7.0.2", "ssri": "^12.0.0", "tar": "^7.4.3", "unique-filename": "^4.0.0"