diff --git a/node_modules/@npmcli/installed-package-contents/index.js b/node_modules/@npmcli/installed-package-contents/index.js index fa81551fed4b..30427fe28c10 100755 --- a/node_modules/@npmcli/installed-package-contents/index.js +++ b/node_modules/@npmcli/installed-package-contents/index.js @@ -22,6 +22,7 @@ const fs = require('fs') const readFile = promisify(fs.readFile) const readdir = promisify(fs.readdir) const stat = promisify(fs.stat) +const lstat = promisify(fs.lstat) const {relative, resolve, basename, dirname} = require('path') const normalizePackageBin = require('npm-normalize-package-bin') @@ -131,6 +132,18 @@ const pkgContents = async ({ const recursePromises = [] + // if we didn't get withFileTypes support, tack that on + if (typeof dirEntries[0] === 'string') { + // use a map so we can return a promise, but we mutate dirEntries in place + // this is much slower than getting the entries from the readdir call, + // but polyfills support for node versions before 10.10 + await Promise.all(dirEntries.map(async (name, index) => { + const p = resolve(path, name) + const st = await lstat(p) + dirEntries[index] = Object.assign(st, {name}) + })) + } + for (const entry of dirEntries) { const p = resolve(path, entry.name) if (entry.isDirectory() === false) { diff --git a/node_modules/@npmcli/installed-package-contents/package.json b/node_modules/@npmcli/installed-package-contents/package.json index e101dbcffe72..13916308f99d 100644 --- a/node_modules/@npmcli/installed-package-contents/package.json +++ b/node_modules/@npmcli/installed-package-contents/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/installed-package-contents", - "version": "1.0.6", + "version": "1.0.7", "description": "Get the list of files installed in a package in node_modules, including bundled dependencies", "author": "Isaac Z. Schlueter (https://izs.me)", "main": "index.js", @@ -16,16 +16,16 @@ "postpublish": "git push origin --follow-tags" }, "tap": { - "check-coverage": true + "check-coverage": true, + "color": true }, "devDependencies": { + "require-inject": "^1.4.4", "tap": "^14.11.0" }, "dependencies": { "npm-bundled": "^1.1.1", - "npm-normalize-package-bin": "^1.0.1", - "read-package-json-fast": "^2.0.1", - "readdir-scoped-modules": "^1.1.0" + "npm-normalize-package-bin": "^1.0.1" }, "repository": "git+https://github.com/npm/installed-package-contents", "files": [ diff --git a/package-lock.json b/package-lock.json index 93c93a51f01f..f1d01b49ff00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -361,6 +361,7 @@ "@npmcli/arborist": "^2.2.1", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", + "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/run-script": "^1.8.2", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", @@ -775,15 +776,13 @@ } }, "node_modules/@npmcli/installed-package-contents": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.6.tgz", - "integrity": "sha512-mpAxU8XZbhyqD1N9/fw1vS5wpKTWREDpUrTPdyQUJOT1PRXIM+DsK3Tpiftvvfi1lmvrRD2HusE2ohgGKvo3UA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz", + "integrity": "sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==", "inBundle": true, "dependencies": { "npm-bundled": "^1.1.1", - "npm-normalize-package-bin": "^1.0.1", - "read-package-json-fast": "^2.0.1", - "readdir-scoped-modules": "^1.1.0" + "npm-normalize-package-bin": "^1.0.1" }, "bin": { "installed-package-contents": "index.js" @@ -10032,14 +10031,12 @@ } }, "@npmcli/installed-package-contents": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.6.tgz", - "integrity": "sha512-mpAxU8XZbhyqD1N9/fw1vS5wpKTWREDpUrTPdyQUJOT1PRXIM+DsK3Tpiftvvfi1lmvrRD2HusE2ohgGKvo3UA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz", + "integrity": "sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==", "requires": { "npm-bundled": "^1.1.1", - "npm-normalize-package-bin": "^1.0.1", - "read-package-json-fast": "^2.0.1", - "readdir-scoped-modules": "^1.1.0" + "npm-normalize-package-bin": "^1.0.1" } }, "@npmcli/map-workspaces": { diff --git a/package.json b/package.json index 4cc113826236..a682846985f5 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@npmcli/arborist": "^2.2.1", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", + "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/run-script": "^1.8.2", "abbrev": "~1.1.1", "ansicolors": "~0.3.2",