diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-08 23:22:39 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-08 23:24:48 +0300 |
commit | e1822cf277336728f1d5696ffe0db3ea6e700d9e (patch) | |
tree | dbbb828941efa61a62b9f71b374cfb507b851cae /node_modules | |
parent | 27be528ebb9801f8cccbfd30c19ddea4537adf8a (diff) |
@npmcli/installed-package-contents@1.0.7
Diffstat (limited to 'node_modules')
-rwxr-xr-x | node_modules/@npmcli/installed-package-contents/index.js | 13 | ||||
-rw-r--r-- | node_modules/@npmcli/installed-package-contents/package.json | 10 |
2 files changed, 18 insertions, 5 deletions
diff --git a/node_modules/@npmcli/installed-package-contents/index.js b/node_modules/@npmcli/installed-package-contents/index.js index fa81551fe..30427fe28 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 e101dbcff..13916308f 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 <i@izs.me> (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": [ |