diff --git a/.github/workflows/create-cli-deps-pr.yml b/.github/workflows/create-cli-deps-pr.yml new file mode 100644 index 0000000000000..ec5397aa89e9d --- /dev/null +++ b/.github/workflows/create-cli-deps-pr.yml @@ -0,0 +1,42 @@ +name: "Create CLI Deps PR" + +on: + workflow_dispatch: + inputs: + npmVersion: + description: "NPM Version" + required: true + default: '"6.x.x" or "latest"' + +jobs: + create-pull-request: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.NPM_ROBOT_USER_PAT }} + NPM_VERSION: ${{ github.event.inputs.npmVersion }} + steps: + - name: Checkout npm/node + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: master + repository: "npm/node" + token: ${{ secrets.NPM_ROBOT_USER_PAT }} + - name: Run dependency updates and create PR + run: | + npm_tag="" + if [ "$NPM_VERSION" == "latest" ] + then + npm_tag=`npm view npm@latest version` + else + npm_tag="$NPM_VERSION" + fi + + git config user.name "npm-robot" + git config user.email "ops+robot@npmjs.com" + git checkout -b "npm-$npm_tag" + ./tools/update-npm.sh "$npm_tag" + git push origin "npm-$npm_tag" + gh_release_body=`gh release view v"$npm_tag" -R npm/cli` + echo $gh_release_body + gh pr create -R "npm/node" -B "$base_branch" -H "npm:$release_branch_name" --title "deps(cli): upgrade npm to $npm_version" --body "$gh_release_body" diff --git a/.gitignore b/.gitignore index e704f5ad3484b..cbcf027f30343 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ npm-debug.log /coverage /*.tgz /.editorconfig +.vscode/ \ No newline at end of file diff --git a/AUTHORS b/AUTHORS index 723042e779904..f7e19d0c26b09 100644 --- a/AUTHORS +++ b/AUTHORS @@ -777,3 +777,8 @@ wangsai Luke Hefson mrmlnc Juan Picado +Kevin Cormier +Nariyasu Heseri +rethab +Spencer Wilson <5624115+spencerwilson@users.noreply.github.com> +Daniel Park diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9c2d48d3e39..def5daee027f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,72 @@ +## v7.15.0 (2021-05-27) + +### FEATURES + +* [`399ff8cbc`](https://github.com/npm/cli/commit/399ff8cbccd5198f637518ccafa86c43bab47a4a) + [#3312](https://github.com/npm/cli/issues/3312) + feat(link): add workspace support + ([@isaacs](https://github.com/isaacs)) + +### BUG FIXES + +* [`46a9bcbcb`](https://github.com/npm/cli/commit/46a9bcbcb0bb2435dca6f45a61b8631f580c7f06) + [#3282](https://github.com/npm/cli/issues/3282) + fix(docs): proper postinstall script file name + ([@KevinFCormier](https://github.com/KevinFCormier)) +* [`83590d40f`](https://github.com/npm/cli/commit/83590d40f94347f21714dbd158b9ddcad9c82de9) + [#3272](https://github.com/npm/cli/issues/3272) + fix(ls): show relative paths from root + ([@isaacs](https://github.com/isaacs)) +* [`a574b518a`](https://github.com/npm/cli/commit/a574b518ae5b8f0664ed388cf1be6288d8c2e68d) + [#3304](https://github.com/npm/cli/issues/3304) + fix(completion): restore IFS even if `npm completion` returns error + ([@NariyasuHeseri](https://github.com/NariyasuHeseri)) +* [`554e8a5cd`](https://github.com/npm/cli/commit/554e8a5cd7034052a59a9ada31e4b8f73712211a) + [#3311](https://github.com/npm/cli/issues/3311) + set audit exit code properly + ([@isaacs](https://github.com/isaacs)) +* [`4a4fbe33c`](https://github.com/npm/cli/commit/4a4fbe33c51413adcd558b4af6f1e204b1b87e41) + [#3268](https://github.com/npm/cli/issues/3268) + [#3285](https://github.com/npm/cli/issues/3285) + fix(publish): skip private workspaces + ([@ruyadorno](https://github.com/ruyadorno)) + +### DOCUMENTATION + +* [`3c53d631f`](https://github.com/npm/cli/commit/3c53d631f557cf2484e2f6a6172c44e36aea4817) + [#3307](https://github.com/npm/cli/issues/3307) + fix(docs): typo in package-lock.json docs + ([@rethab](https://github.com/rethab)) +* [`96367f93f`](https://github.com/npm/cli/commit/96367f93f46c24494d084c8b8d34e4de9cd375da) + rebuild npm-pack doc + ([@isaacs](https://github.com/isaacs)) +* [`64b13dd10`](https://github.com/npm/cli/commit/64b13dd1082b6ca7eac4e8e329bfdd8cd8daf157) + [#3313](https://github.com/npm/cli/issues/3313) + Drop stale Python 3<->node-gyp remark + ([@spencerwilson](https://github.com/spencerwilson)) + +### DEPENDENCIES + +* [`7b56bfdf3`](https://github.com/npm/cli/commit/7b56bfdf3f2ac67a926fc7893b883a16b46eb3fd) + `cacache@15.2.0`: + * feat: allow fully deleting indices + * feat: add a validateEntry option to compact + * chore: lint + * chore: use standard npm style release scripts +* [`dbbc151a3`](https://github.com/npm/cli/commit/dbbc151a3bcf89e2627dc267063edd185ead1cb8) + `npm-audit-report@2.1.5`: + * fix(exit-code): account for null auditLevel default (#46) +* [`5b2604507`](https://github.com/npm/cli/commit/5b26045076477d3d350f539e60adf48a80376fda) + chore(package-lock): update devDependencies + ([@Gar](https://github.com/Gar)) + +### AUTOMATION + +* [`3d5df0082`](https://github.com/npm/cli/commit/3d5df0082ae904dacdea8644286e8362d4a2ed50) + [#3294](https://github.com/npm/cli/issues/3294) + chore(ci): move node release PR workflow to cli repo + ([@gimli01](https://github.com/gimli01)) + ## v7.14.0 (2021-05-20) ### FEATURES diff --git a/docs/content/commands/npm-link.md b/docs/content/commands/npm-link.md index e48be396ade1b..b1c6066768a99 100644 --- a/docs/content/commands/npm-link.md +++ b/docs/content/commands/npm-link.md @@ -99,6 +99,16 @@ relevant metadata by running `npm install --package-lock-only`. If you _want_ to save the `file:` reference in your `package.json` and `package-lock.json` files, you can use `npm link --save` to do so. +### Workspace Usage + +`npm link --workspace ` will link the relevant package as a +dependency of the specified workspace(s). Note that It may actually be +linked into the parent project's `node_modules` folder, if there are no +conflicting dependencies. + +`npm link --workspace ` will create a global link to the specified +workspace(s). + ### Configuration @@ -261,6 +271,38 @@ commands that modify your local installation, eg, `install`, `update`, Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: false +* Type: Boolean + +Enable running a command in the context of **all** the configured +workspaces. + +This value is not exported to the environment for child processes. + ### See Also diff --git a/docs/content/commands/npm-pack.md b/docs/content/commands/npm-pack.md index ff90bd74472b4..04a22a5d854b4 100644 --- a/docs/content/commands/npm-pack.md +++ b/docs/content/commands/npm-pack.md @@ -27,6 +27,15 @@ commands that modify your local installation, eg, `install`, `update`, Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +Not supported by all npm commands. + #### `workspace` * Default: diff --git a/docs/content/commands/npm.md b/docs/content/commands/npm.md index 2d86aa62c0080..7ff1cc490707e 100644 --- a/docs/content/commands/npm.md +++ b/docs/content/commands/npm.md @@ -62,10 +62,8 @@ requires compiling of C++ Code, npm will use [node-gyp](https://github.com/nodejs/node-gyp) for that task. For a Unix system, [node-gyp](https://github.com/nodejs/node-gyp) needs Python, make and a buildchain like GCC. On Windows, -Python and Microsoft Visual Studio C++ are needed. Python 3 is -not supported by [node-gyp](https://github.com/nodejs/node-gyp). -For more information visit -[the node-gyp repository](https://github.com/nodejs/node-gyp) and +Python and Microsoft Visual Studio C++ are needed. For more information +visit [the node-gyp repository](https://github.com/nodejs/node-gyp) and the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki). ### Directories diff --git a/docs/content/configuring-npm/package-lock-json.md b/docs/content/configuring-npm/package-lock-json.md index 4d994bbc8c0a2..c06540fb3ffae 100644 --- a/docs/content/configuring-npm/package-lock-json.md +++ b/docs/content/configuring-npm/package-lock-json.md @@ -36,8 +36,8 @@ various purposes: Both of these files have the same format, and perform similar functions in the root of a project. -The difference is that `package-lock.json` is that it cannot be published, -and it will be ignored if found in any place other than the root project. +The difference is that `package-lock.json` cannot be published, and it will +be ignored if found in any place other than the root project. In contrast, [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) allows publication, and defines the dependency tree from the point encountered. diff --git a/docs/content/using-npm/scripts.md b/docs/content/using-npm/scripts.md index 82cde7d79094d..3869334f6cc5a 100644 --- a/docs/content/using-npm/scripts.md +++ b/docs/content/using-npm/scripts.md @@ -304,7 +304,7 @@ For example, if your package.json contains this: { "scripts" : { "install" : "scripts/install.js", - "postinstall" : "scripts/postinstall.js", + "postinstall" : "scripts/install.js", "uninstall" : "scripts/uninstall.js" } } diff --git a/lib/base-command.js b/lib/base-command.js index e1efcff5832b3..843fb2d4b1358 100644 --- a/lib/base-command.js +++ b/lib/base-command.js @@ -7,6 +7,7 @@ class BaseCommand { this.wrapWidth = 80 this.npm = npm this.workspaces = null + this.workspacePaths = null } get name () { diff --git a/lib/link.js b/lib/link.js index 60665a9964fab..47fe4b17a272b 100644 --- a/lib/link.js +++ b/lib/link.js @@ -10,8 +10,8 @@ const semver = require('semver') const reifyFinish = require('./utils/reify-finish.js') -const BaseCommand = require('./base-command.js') -class Link extends BaseCommand { +const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js') +class Link extends ArboristWorkspaceCmd { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get description () { return 'Symlink a package folder' @@ -46,6 +46,7 @@ class Link extends BaseCommand { 'bin-links', 'fund', 'dry-run', + ...super.params, ] } @@ -143,12 +144,16 @@ class Link extends BaseCommand { log: this.npm.log, add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`), save, + workspaces: this.workspaces, }) await reifyFinish(this.npm, localArb) } async linkPkg () { + const wsp = this.workspacePaths + const paths = wsp && wsp.length ? wsp : [this.npm.prefix] + const add = paths.map(path => `file:${path}`) const globalTop = resolve(this.npm.globalDir, '..') const arb = new Arborist({ ...this.npm.flatOptions, @@ -157,7 +162,7 @@ class Link extends BaseCommand { global: true, }) await arb.reify({ - add: [`file:${this.npm.prefix}`], + add, log: this.npm.log, }) await reifyFinish(this.npm, arb) diff --git a/lib/ls.js b/lib/ls.js index 4e504912a0175..d92b73ddfcdbb 100644 --- a/lib/ls.js +++ b/lib/ls.js @@ -1,4 +1,5 @@ -const { resolve } = require('path') +const { resolve, relative, sep } = require('path') +const relativePrefix = `.${sep}` const { EOL } = require('os') const archy = require('archy') @@ -298,6 +299,9 @@ const getHumanOutputItem = (node, { args, color, global, long }) => { ? chalk.yellow.bgBlack : chalk.red.bgBlack const missingMsg = `UNMET ${isOptional(node) ? 'OPTIONAL ' : ''}DEPENDENCY` + const targetLocation = node.root + ? relative(node.root.realpath, node.realpath) + : node.targetLocation const label = ( node[_missing] @@ -321,7 +325,7 @@ const getHumanOutputItem = (node, { args, color, global, long }) => { : '' ) + (isGitNode(node) ? ` (${node.resolved})` : '') + - (node.isLink ? ` -> ${node.realpath}` : '') + + (node.isLink ? ` -> ${relativePrefix}${targetLocation}` : '') + (long ? `${EOL}${node.package.description || ''}` : '') return augmentItemWithIncludeMetadata(node, { label, nodes: [] }) @@ -445,6 +449,9 @@ const augmentNodesWithMetadata = ({ // revisit that node in tree traversal logic, so we make it so that // we have a diff obj for deduped nodes: if (seenNodes.has(node.path)) { + const { realpath, root } = node + const targetLocation = root ? relative(root.realpath, realpath) + : node.targetLocation node = { name: node.name, version: node.version, @@ -453,6 +460,7 @@ const augmentNodesWithMetadata = ({ path: node.path, isLink: node.isLink, realpath: node.realpath, + targetLocation, [_type]: node[_type], [_invalid]: node[_invalid], [_missing]: node[_missing], diff --git a/lib/publish.js b/lib/publish.js index 1693ea7d97c2a..3cb8b0627e974 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -7,6 +7,7 @@ const runScript = require('@npmcli/run-script') const pacote = require('pacote') const npa = require('npm-package-arg') const npmFetch = require('npm-registry-fetch') +const chalk = require('chalk') const otplease = require('./utils/otplease.js') const { getContents, logTar } = require('./utils/tar.js') @@ -154,10 +155,29 @@ class Publish extends BaseCommand { const results = {} const json = this.npm.config.get('json') const silent = log.level === 'silent' + const noop = a => a + const color = this.npm.color ? chalk : { green: noop, bold: noop } const workspaces = await getWorkspaces(filters, { path: this.npm.localPrefix }) + for (const [name, workspace] of workspaces.entries()) { - const pkgContents = await this.publish([workspace]) + let pkgContents + try { + pkgContents = await this.publish([workspace]) + } catch (err) { + if (err.code === 'EPRIVATE') { + log.warn( + 'publish', + `Skipping workspace ${ + color.green(name) + }, marked as ${ + color.bold('private') + }` + ) + continue + } + throw err + } // This needs to be in-line w/ the rest of the output that non-JSON // publish generates if (!silent && !json) diff --git a/lib/utils/completion.sh b/lib/utils/completion.sh index c549b31c96493..a3e5143991edd 100755 --- a/lib/utils/completion.sh +++ b/lib/utils/completion.sh @@ -18,11 +18,15 @@ if type complete &>/dev/null; then fi local si="$IFS" - IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ + if ! IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ COMP_LINE="$COMP_LINE" \ COMP_POINT="$COMP_POINT" \ npm completion -- "${words[@]}" \ - 2>/dev/null)) || return $? + 2>/dev/null)); then + local ret=$? + IFS="$si" + return $ret + fi IFS="$si" if type __ltrim_colon_completions &>/dev/null; then __ltrim_colon_completions "${words[cword]}" @@ -49,11 +53,16 @@ elif type compctl &>/dev/null; then read -l line read -ln point si="$IFS" - IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + if ! IFS=$'\n' reply=($(COMP_CWORD="$cword" \ COMP_LINE="$line" \ COMP_POINT="$point" \ npm completion -- "${words[@]}" \ - 2>/dev/null)) || return $? + 2>/dev/null)); then + + local ret=$? + IFS="$si" + return $ret + fi IFS="$si" } compctl -K _npm_completion npm diff --git a/lib/utils/reify-output.js b/lib/utils/reify-output.js index ddad32121e8b4..bf3fa7fb2e13d 100644 --- a/lib/utils/reify-output.js +++ b/lib/utils/reify-output.js @@ -18,10 +18,6 @@ const auditError = require('./audit-error.js') // TODO: output JSON if flatOptions.json is true const reifyOutput = (npm, arb) => { - // don't print any info in --silent mode - if (log.levels[log.level] > log.levels.error) - return - const { diff, actualTree } = arb // note: fails and crashes if we're running audit fix and there was an error @@ -29,6 +25,13 @@ const reifyOutput = (npm, arb) => { // stuff in that case! const auditReport = auditError(npm, arb.auditReport) ? null : arb.auditReport + // don't print any info in --silent mode, but we still need to + // set the exitCode properly from the audit report, if we have one. + if (log.levels[log.level] > log.levels.error) { + getAuditReport(npm, auditReport) + return + } + const summary = { added: 0, removed: 0, @@ -68,6 +71,8 @@ const reifyOutput = (npm, arb) => { if (npm.flatOptions.json) { if (auditReport) { + // call this to set the exit code properly + getAuditReport(npm, auditReport) summary.audit = npm.command === 'audit' ? auditReport : auditReport.toJSON().metadata } @@ -83,11 +88,25 @@ const reifyOutput = (npm, arb) => { // at the end if there's still stuff, because it's silly for `npm audit` // to tell you to run `npm audit` for details. otherwise, use the summary // report. if we get here, we know it's not quiet or json. +// If the loglevel is set higher than 'error', then we just run the report +// to get the exitCode set appropriately. const printAuditReport = (npm, report) => { + const res = getAuditReport(npm, report) + if (!res || !res.report) + return + npm.output(`\n${res.report}`) +} + +const getAuditReport = (npm, report) => { if (!report) return - const reporter = npm.command !== 'audit' ? 'install' : 'detail' + // when in silent mode, we print nothing. the JSON output is + // going to just JSON.stringify() the report object. + const reporter = log.levels[log.level] > log.levels.error ? 'quiet' + : npm.flatOptions.json ? 'quiet' + : npm.command !== 'audit' ? 'install' + : 'detail' const defaultAuditLevel = npm.command !== 'audit' ? 'none' : 'low' const auditLevel = npm.flatOptions.auditLevel || defaultAuditLevel @@ -96,8 +115,9 @@ const printAuditReport = (npm, report) => { ...npm.flatOptions, auditLevel, }) - process.exitCode = process.exitCode || res.exitCode - npm.output('\n' + res.report) + if (npm.command === 'audit') + process.exitCode = process.exitCode || res.exitCode + return res } const packagesChangedMessage = (npm, { added, removed, changed, audited }) => { diff --git a/lib/workspaces/arborist-cmd.js b/lib/workspaces/arborist-cmd.js index b12c0ee47b19f..337e7f9d8f932 100644 --- a/lib/workspaces/arborist-cmd.js +++ b/lib/workspaces/arborist-cmd.js @@ -17,6 +17,7 @@ class ArboristCmd extends BaseCommand { getWorkspaces(filters, { path: this.npm.localPrefix }) .then(workspaces => { this.workspaces = [...workspaces.keys()] + this.workspacePaths = [...workspaces.values()] this.exec(args, cb) }) .catch(er => cb(er)) diff --git a/node_modules/.gitignore b/node_modules/.gitignore index c532421428d49..a1aae51f99877 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -77,7 +77,6 @@ package-lock.json /color-support /comma-separated-tokens /commondir -/contains-path /convert-source-map /correct-license-metadata /coveralls @@ -201,6 +200,7 @@ package-lock.json /js-yaml /jsdom /jsesc +/json-parse-better-errors /json-parse-errback /json-stable-stringify-without-jsonify /json5 @@ -214,6 +214,7 @@ package-lock.json /lodash.clonedeep /lodash.flatten /lodash.flattendeep +/lodash.merge /lodash.truncate /lodash.uniq /log-driver @@ -262,6 +263,7 @@ package-lock.json /picomatch /pify /pkg-dir +/pkg-up /prebuild-install /prelude-ls /process-on-spawn @@ -284,8 +286,6 @@ package-lock.json /remark-parse /remark-squeeze-paragraphs /repeat-string -/request-promise-core -/request-promise-native /require-directory /require-from-string /require-main-filename @@ -309,7 +309,6 @@ package-lock.json /sprintf-js /stack-utils /state-toggle -/stealthy-require /string.prototype.trimend /string.prototype.trimstart /strip-bom diff --git a/node_modules/cacache/README.md b/node_modules/cacache/README.md index 0c315595abd34..6dc11babfa62a 100644 --- a/node_modules/cacache/README.md +++ b/node_modules/cacache/README.md @@ -458,13 +458,17 @@ cacache.rm.all(cachePath).then(() => { }) ``` -#### `> cacache.rm.entry(cache, key) -> Promise` +#### `> cacache.rm.entry(cache, key, [opts]) -> Promise` Alias: `cacache.rm` Removes the index entry for `key`. Content will still be accessible if requested directly by content address ([`get.stream.byDigest`](#get-stream)). +By default, this appends a new entry to the index with an integrity of `null`. +If `opts.removeFully` is set to `true` then the index file itself will be +physically deleted rather than appending a `null`. + To remove the content itself (which might still be used by other entries), use [`rm.content`](#rm-content). Or, to safely vacuum any unused content, use [`verify`](#verify). @@ -491,12 +495,21 @@ cacache.rm.content(cachePath, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => { }) ``` -#### `> cacache.index.compact(cache, key, matchFn) -> Promise` +#### `> cacache.index.compact(cache, key, matchFn, [opts]) -> Promise` Uses `matchFn`, which must be a synchronous function that accepts two entries and returns a boolean indicating whether or not the two entries match, to deduplicate all entries in the cache for the given `key`. +If `opts.validateEntry` is provided, it will be called as a function with the +only parameter being a single index entry. The function must return a Boolean, +if it returns `true` the entry is considered valid and will be kept in the index, +if it returns `false` the entry will be removed from the index. + +If `opts.validateEntry` is not provided, however, every entry in the index will +be deduplicated and kept until the first `null` integrity is reached, removing +all entries that were written before the `null`. + The deduplicated list of entries is both written to the index, replacing the existing content, and returned in the Promise. diff --git a/node_modules/cacache/get.js b/node_modules/cacache/get.js index b6bae1e504eba..fe710bbd68def 100644 --- a/node_modules/cacache/get.js +++ b/node_modules/cacache/get.js @@ -32,18 +32,18 @@ function getData (byDigest, cache, key, opts = {}) { metadata: memoized.entry.metadata, data: memoized.data, integrity: memoized.entry.integrity, - size: memoized.entry.size + size: memoized.entry.size, } ) } return (byDigest ? Promise.resolve(null) : index.find(cache, key, opts)).then( (entry) => { - if (!entry && !byDigest) { + if (!entry && !byDigest) throw new index.NotFoundError(cache, key) - } + return read(cache, byDigest ? key : entry.integrity, { integrity, - size + size, }) .then((data) => byDigest @@ -52,15 +52,15 @@ function getData (byDigest, cache, key, opts = {}) { data, metadata: entry.metadata, size: entry.size, - integrity: entry.integrity + integrity: entry.integrity, } ) .then((res) => { - if (memoize && byDigest) { + if (memoize && byDigest) memo.put.byDigest(cache, key, res, opts) - } else if (memoize) { + else if (memoize) memo.put(cache, entry, res.data, opts) - } + return res }) } @@ -86,16 +86,16 @@ function getDataSync (byDigest, cache, key, opts = {}) { metadata: memoized.entry.metadata, data: memoized.data, integrity: memoized.entry.integrity, - size: memoized.entry.size + size: memoized.entry.size, } } const entry = !byDigest && index.find.sync(cache, key, opts) - if (!entry && !byDigest) { + if (!entry && !byDigest) throw new index.NotFoundError(cache, key) - } + const data = read.sync(cache, byDigest ? key : entry.integrity, { integrity: integrity, - size: size + size: size, }) const res = byDigest ? data @@ -103,13 +103,13 @@ function getDataSync (byDigest, cache, key, opts = {}) { metadata: entry.metadata, data: data, size: entry.size, - integrity: entry.integrity + integrity: entry.integrity, } - if (memoize && byDigest) { + if (memoize && byDigest) memo.put.byDigest(cache, key, res, opts) - } else if (memoize) { + else if (memoize) memo.put(cache, entry, res.data, opts) - } + return res } @@ -129,17 +129,16 @@ const getMemoizedStream = (memoized) => { function getStream (cache, key, opts = {}) { const { memoize, size } = opts const memoized = memo.get(cache, key, opts) - if (memoized && memoize !== false) { + if (memoized && memoize !== false) return getMemoizedStream(memoized) - } const stream = new Pipeline() index .find(cache, key) .then((entry) => { - if (!entry) { + if (!entry) throw new index.NotFoundError(cache, key) - } + stream.emit('metadata', entry.metadata) stream.emit('integrity', entry.integrity) stream.emit('size', entry.size) @@ -178,9 +177,9 @@ function getStreamDigest (cache, integrity, opts = {}) { return stream } else { const stream = read.readStream(cache, integrity, opts) - if (!memoize) { + if (!memoize) return stream - } + const memoStream = new Collect.PassThrough() memoStream.on('collect', data => memo.put.byDigest( cache, @@ -197,11 +196,10 @@ module.exports.info = info function info (cache, key, opts = {}) { const { memoize } = opts const memoized = memo.get(cache, key, opts) - if (memoized && memoize !== false) { + if (memoized && memoize !== false) return Promise.resolve(memoized.entry) - } else { + else return index.find(cache, key) - } } module.exports.hasContent = read.hasContent @@ -224,9 +222,9 @@ function copy (byDigest, cache, key, dest, opts = {}) { ? Promise.resolve(null) : index.find(cache, key, opts) ).then((entry) => { - if (!entry && !byDigest) { + if (!entry && !byDigest) throw new index.NotFoundError(cache, key) - } + return read .copy(cache, byDigest ? key : entry.integrity, dest, opts) .then(() => { @@ -235,7 +233,7 @@ function copy (byDigest, cache, key, dest, opts = {}) { : { metadata: entry.metadata, size: entry.size, - integrity: entry.integrity + integrity: entry.integrity, } }) }) @@ -248,7 +246,7 @@ function copy (byDigest, cache, key, dest, opts = {}) { : { metadata: res.metadata, size: res.size, - integrity: res.integrity + integrity: res.integrity, } }) }) diff --git a/node_modules/cacache/lib/content/read.js b/node_modules/cacache/lib/content/read.js index 7cc16482d44c8..034e8eee05b10 100644 --- a/node_modules/cacache/lib/content/read.js +++ b/node_modules/cacache/lib/content/read.js @@ -20,17 +20,16 @@ function read (cache, integrity, opts = {}) { // get size return lstat(cpath).then(stat => ({ stat, cpath, sri })) }).then(({ stat, cpath, sri }) => { - if (typeof size === 'number' && stat.size !== size) { + if (typeof size === 'number' && stat.size !== size) throw sizeError(size, stat.size) - } - if (stat.size > MAX_SINGLE_READ_SIZE) { + + if (stat.size > MAX_SINGLE_READ_SIZE) return readPipeline(cpath, stat.size, sri, new Pipeline()).concat() - } return readFile(cpath, null).then((data) => { - if (!ssri.checkData(data, sri)) { + if (!ssri.checkData(data, sri)) throw integrityError(sri, cpath) - } + return data }) }) @@ -40,11 +39,11 @@ const readPipeline = (cpath, size, sri, stream) => { stream.push( new fsm.ReadStream(cpath, { size, - readSize: MAX_SINGLE_READ_SIZE + readSize: MAX_SINGLE_READ_SIZE, }), ssri.integrityStream({ integrity: sri, - size + size, }) ) return stream @@ -56,13 +55,11 @@ function readSync (cache, integrity, opts = {}) { const { size } = opts return withContentSriSync(cache, integrity, (cpath, sri) => { const data = fs.readFileSync(cpath) - if (typeof size === 'number' && size !== data.length) { + if (typeof size === 'number' && size !== data.length) throw sizeError(size, data.length) - } - if (ssri.checkData(data, sri)) { + if (ssri.checkData(data, sri)) return data - } throw integrityError(sri, cpath) }) @@ -78,9 +75,9 @@ function readStream (cache, integrity, opts = {}) { // just lstat to ensure it exists return lstat(cpath).then((stat) => ({ stat, cpath, sri })) }).then(({ stat, cpath, sri }) => { - if (typeof size === 'number' && size !== stat.size) { + if (typeof size === 'number' && size !== stat.size) return stream.emit('error', sizeError(size, stat.size)) - } + readPipeline(cpath, stat.size, sri, stream) }, er => stream.emit('error', er)) @@ -109,22 +106,21 @@ function copySync (cache, integrity, dest) { module.exports.hasContent = hasContent function hasContent (cache, integrity) { - if (!integrity) { + if (!integrity) return Promise.resolve(false) - } + return withContentSri(cache, integrity, (cpath, sri) => { return lstat(cpath).then((stat) => ({ size: stat.size, sri, stat })) }).catch((err) => { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return false - } + if (err.code === 'EPERM') { /* istanbul ignore else */ - if (process.platform !== 'win32') { + if (process.platform !== 'win32') throw err - } else { + else return false - } } }) } @@ -132,24 +128,23 @@ function hasContent (cache, integrity) { module.exports.hasContent.sync = hasContentSync function hasContentSync (cache, integrity) { - if (!integrity) { + if (!integrity) return false - } + return withContentSriSync(cache, integrity, (cpath, sri) => { try { const stat = fs.lstatSync(cpath) return { size: stat.size, sri, stat } } catch (err) { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return false - } + if (err.code === 'EPERM') { /* istanbul ignore else */ - if (process.platform !== 'win32') { + if (process.platform !== 'win32') throw err - } else { + else return false - } } } }) @@ -167,7 +162,8 @@ function withContentSri (cache, integrity, fn) { const cpath = contentPath(cache, digests[0]) return fn(cpath, digests[0]) } else { - // Can't use race here because a generic error can happen before a ENOENT error, and can happen before a valid result + // Can't use race here because a generic error can happen before + // a ENOENT error, and can happen before a valid result return Promise .all(digests.map((meta) => { return withContentSri(cache, meta, fn) @@ -184,15 +180,13 @@ function withContentSri (cache, integrity, fn) { .then((results) => { // Return the first non error if it is found const result = results.find((r) => !(r instanceof Error)) - if (result) { + if (result) return result - } // Throw the No matching content found error const enoentError = results.find((r) => r.code === 'ENOENT') - if (enoentError) { + if (enoentError) throw enoentError - } // Throw generic error throw results.find((r) => r instanceof Error) diff --git a/node_modules/cacache/lib/content/rm.js b/node_modules/cacache/lib/content/rm.js index 50612364e9b48..6a3d1a3d02340 100644 --- a/node_modules/cacache/lib/content/rm.js +++ b/node_modules/cacache/lib/content/rm.js @@ -11,10 +11,9 @@ module.exports = rm function rm (cache, integrity) { return hasContent(cache, integrity).then((content) => { // ~pretty~ sure we can't end up with a content lacking sri, but be safe - if (content && content.sri) { + if (content && content.sri) return rimraf(contentPath(cache, content.sri)).then(() => true) - } else { + else return false - } }) } diff --git a/node_modules/cacache/lib/content/write.js b/node_modules/cacache/lib/content/write.js index e8f3e3534940c..dde1bd1dd5dae 100644 --- a/node_modules/cacache/lib/content/write.js +++ b/node_modules/cacache/lib/content/write.js @@ -22,16 +22,15 @@ module.exports = write function write (cache, data, opts = {}) { const { algorithms, size, integrity } = opts - if (algorithms && algorithms.length > 1) { + if (algorithms && algorithms.length > 1) throw new Error('opts.algorithms only supports a single algorithm for now') - } - if (typeof size === 'number' && data.length !== size) { + + if (typeof size === 'number' && data.length !== size) return Promise.reject(sizeError(size, data.length)) - } + const sri = ssri.fromData(data, algorithms ? { algorithms } : {}) - if (integrity && !ssri.checkData(data, integrity, opts)) { + if (integrity && !ssri.checkData(data, integrity, opts)) return Promise.reject(checksumError(integrity, sri)) - } return disposer(makeTmp(cache, opts), makeTmpDisposer, (tmp) => { @@ -112,13 +111,17 @@ function pipeToTmp (inputStream, cache, tmpTarget, opts) { const hashStream = ssri.integrityStream({ integrity: opts.integrity, algorithms: opts.algorithms, - size: opts.size + size: opts.size, + }) + hashStream.on('integrity', i => { + integrity = i + }) + hashStream.on('size', s => { + size = s }) - hashStream.on('integrity', i => { integrity = i }) - hashStream.on('size', s => { size = s }) const outStream = new fsm.WriteStream(tmpTarget, { - flags: 'wx' + flags: 'wx', }) // NB: this can throw if the hashStream has a problem with @@ -132,21 +135,23 @@ function pipeToTmp (inputStream, cache, tmpTarget, opts) { return pipeline.promise() .then(() => ({ integrity, size })) - .catch(er => rimraf(tmpTarget).then(() => { throw er })) + .catch(er => rimraf(tmpTarget).then(() => { + throw er + })) } function makeTmp (cache, opts) { const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) return fixOwner.mkdirfix(cache, path.dirname(tmpTarget)).then(() => ({ target: tmpTarget, - moved: false + moved: false, })) } function makeTmpDisposer (tmp) { - if (tmp.moved) { + if (tmp.moved) return Promise.resolve() - } + return rimraf(tmp.target) } diff --git a/node_modules/cacache/lib/entry-index.js b/node_modules/cacache/lib/entry-index.js index 8827ebb541b2d..71aac5ed75b14 100644 --- a/node_modules/cacache/lib/entry-index.js +++ b/node_modules/cacache/lib/entry-index.js @@ -14,7 +14,9 @@ const fixOwner = require('./util/fix-owner') const hashToSegments = require('./util/hash-to-segments') const indexV = require('../package.json')['cache-version'].index const moveFile = require('@npmcli/move-file') -const rimraf = util.promisify(require('rimraf')) +const _rimraf = require('rimraf') +const rimraf = util.promisify(_rimraf) +rimraf.sync = _rimraf.sync const appendFile = util.promisify(fs.appendFile) const readFile = util.promisify(fs.readFile) @@ -35,15 +37,30 @@ module.exports.compact = compact async function compact (cache, key, matchFn, opts = {}) { const bucket = bucketPath(cache, key) const entries = await bucketEntries(bucket) - // reduceRight because the bottom-most result is the newest + const newEntries = [] + // we loop backwards because the bottom-most result is the newest // since we add new entries with appendFile - const newEntries = entries.reduceRight((acc, newEntry) => { - if (!acc.find((oldEntry) => matchFn(oldEntry, newEntry))) { - acc.push(newEntry) - } - - return acc - }, []) + for (let i = entries.length - 1; i >= 0; --i) { + const entry = entries[i] + // a null integrity could mean either a delete was appended + // or the user has simply stored an index that does not map + // to any content. we determine if the user wants to keep the + // null integrity based on the validateEntry function passed in options. + // if the integrity is null and no validateEntry is provided, we break + // as we consider the null integrity to be a deletion of everything + // that came before it. + if (entry.integrity === null && !opts.validateEntry) + break + + // if this entry is valid, and it is either the first entry or + // the newEntries array doesn't already include an entry that + // matches this one based on the provided matchFn, then we add + // it to the beginning of our list + if ((!opts.validateEntry || opts.validateEntry(entry) === true) && + (newEntries.length === 0 || + !newEntries.find((oldEntry) => matchFn(oldEntry, entry)))) + newEntries.unshift(entry) + } const newIndex = '\n' + newEntries.map((entry) => { const stringified = JSON.stringify(entry) @@ -56,14 +73,13 @@ async function compact (cache, key, matchFn, opts = {}) { await fixOwner.mkdirfix(cache, path.dirname(target)) return { target, - moved: false + moved: false, } } const teardown = async (tmp) => { - if (!tmp.moved) { + if (!tmp.moved) return rimraf(tmp.target) - } } const write = async (tmp) => { @@ -76,16 +92,20 @@ async function compact (cache, key, matchFn, opts = {}) { try { await fixOwner.chownr(cache, bucket) } catch (err) { - if (err.code !== 'ENOENT') { + if (err.code !== 'ENOENT') throw err - } } } // write the file atomically await disposer(setup(), teardown, write) - return newEntries.map((entry) => formatEntry(cache, entry, true)) + // we reverse the list we generated such that the newest + // entries come first in order to make looping through them easier + // the true passed to formatEntry tells it to keep null + // integrity values, if they made it this far it's because + // validateEntry returned true, and as such we should return it + return newEntries.reverse().map((entry) => formatEntry(cache, entry, true)) } module.exports.insert = insert @@ -98,7 +118,7 @@ function insert (cache, key, integrity, opts = {}) { integrity: integrity && ssri.stringify(integrity), time: Date.now(), size, - metadata + metadata, } return fixOwner .mkdirfix(cache, path.dirname(bucket)) @@ -110,14 +130,15 @@ function insert (cache, key, integrity, opts = {}) { // another while still preserving the string length of the JSON in // question. So, we just slap the length in there and verify it on read. // - // Thanks to @isaacs for the whiteboarding session that ended up with this. + // Thanks to @isaacs for the whiteboarding session that ended up with + // this. return appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`) }) .then(() => fixOwner.chownr(cache, bucket)) .catch((err) => { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return undefined - } + throw err // There's a class of race conditions that happen when things get deleted // during fixOwner, or between the two mkdirfix/chownr calls. @@ -140,7 +161,7 @@ function insertSync (cache, key, integrity, opts = {}) { integrity: integrity && ssri.stringify(integrity), time: Date.now(), size, - metadata + metadata, } fixOwner.mkdirfix.sync(cache, path.dirname(bucket)) const stringified = JSON.stringify(entry) @@ -148,9 +169,8 @@ function insertSync (cache, key, integrity, opts = {}) { try { fixOwner.chownr.sync(cache, bucket) } catch (err) { - if (err.code !== 'ENOENT') { + if (err.code !== 'ENOENT') throw err - } } return formatEntry(cache, entry) } @@ -162,19 +182,17 @@ function find (cache, key) { return bucketEntries(bucket) .then((entries) => { return entries.reduce((latest, next) => { - if (next && next.key === key) { + if (next && next.key === key) return formatEntry(cache, next) - } else { + else return latest - } }, null) }) .catch((err) => { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return null - } else { + else throw err - } }) } @@ -184,31 +202,37 @@ function findSync (cache, key) { const bucket = bucketPath(cache, key) try { return bucketEntriesSync(bucket).reduce((latest, next) => { - if (next && next.key === key) { + if (next && next.key === key) return formatEntry(cache, next) - } else { + else return latest - } }, null) } catch (err) { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return null - } else { + else throw err - } } } module.exports.delete = del -function del (cache, key, opts) { - return insert(cache, key, null, opts) +function del (cache, key, opts = {}) { + if (!opts.removeFully) + return insert(cache, key, null, opts) + + const bucket = bucketPath(cache, key) + return rimraf(bucket) } module.exports.delete.sync = delSync -function delSync (cache, key, opts) { - return insertSync(cache, key, null, opts) +function delSync (cache, key, opts = {}) { + if (!opts.removeFully) + return insertSync(cache, key, null, opts) + + const bucket = bucketPath(cache, key) + return rimraf.sync(bucket) } module.exports.lsStream = lsStream @@ -239,12 +263,12 @@ function lsStream (cache) { // reduced is a map of key => entry for (const entry of reduced.values()) { const formatted = formatEntry(cache, entry) - if (formatted) { + if (formatted) stream.write(formatted) - } } }).catch(err => { - if (err.code === 'ENOENT') { return undefined } + if (err.code === 'ENOENT') + return undefined throw err }) }) @@ -288,9 +312,9 @@ function bucketEntriesSync (bucket, filter) { function _bucketEntries (data, filter) { const entries = [] data.split('\n').forEach((entry) => { - if (!entry) { + if (!entry) return - } + const pieces = entry.split('\t') if (!pieces[1] || hashEntry(pieces[1]) !== pieces[0]) { // Hash is no good! Corruption or malice? Doesn't matter! @@ -304,9 +328,8 @@ function _bucketEntries (data, filter) { // Entry is corrupted! return } - if (obj) { + if (obj) entries.push(obj) - } }) return entries } @@ -348,24 +371,23 @@ function hash (str, digest) { function formatEntry (cache, entry, keepAll) { // Treat null digests as deletions. They'll shadow any previous entries. - if (!entry.integrity && !keepAll) { + if (!entry.integrity && !keepAll) return null - } + return { key: entry.key, integrity: entry.integrity, path: entry.integrity ? contentPath(cache, entry.integrity) : undefined, size: entry.size, time: entry.time, - metadata: entry.metadata + metadata: entry.metadata, } } function readdirOrEmpty (dir) { return readdir(dir).catch((err) => { - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return [] - } throw err }) diff --git a/node_modules/cacache/lib/memoization.js b/node_modules/cacache/lib/memoization.js index 185141d8eadad..d5465f39fc581 100644 --- a/node_modules/cacache/lib/memoization.js +++ b/node_modules/cacache/lib/memoization.js @@ -8,7 +8,7 @@ const MAX_AGE = 3 * 60 * 1000 const MEMOIZED = new LRU({ max: MAX_SIZE, maxAge: MAX_AGE, - length: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length + length: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length, }) module.exports.clearMemoized = clearMemoized @@ -62,13 +62,12 @@ class ObjProxy { } function pickMem (opts) { - if (!opts || !opts.memoize) { + if (!opts || !opts.memoize) return MEMOIZED - } else if (opts.memoize.get && opts.memoize.set) { + else if (opts.memoize.get && opts.memoize.set) return opts.memoize - } else if (typeof opts.memoize === 'object') { + else if (typeof opts.memoize === 'object') return new ObjProxy(opts.memoize) - } else { + else return MEMOIZED - } } diff --git a/node_modules/cacache/lib/util/disposer.js b/node_modules/cacache/lib/util/disposer.js index 8a24ad2f2a2a2..aa8aed54da551 100644 --- a/node_modules/cacache/lib/util/disposer.js +++ b/node_modules/cacache/lib/util/disposer.js @@ -8,9 +8,9 @@ function disposer (creatorFn, disposerFn, fn) { .then( // disposer resolved, do something with original fn's promise () => { - if (shouldThrow) { + if (shouldThrow) throw result - } + return result }, // Disposer fn failed, crash process diff --git a/node_modules/cacache/lib/util/fix-owner.js b/node_modules/cacache/lib/util/fix-owner.js index 9afa638a8c839..90ffece524f54 100644 --- a/node_modules/cacache/lib/util/fix-owner.js +++ b/node_modules/cacache/lib/util/fix-owner.js @@ -49,9 +49,8 @@ function fixOwner (cache, filepath) { const { uid, gid } = owner // No need to override if it's already what we used. - if (self.uid === uid && self.gid === gid) { + if (self.uid === uid && self.gid === gid) return - } return inflight('fixOwner: fixing ownership on ' + filepath, () => chownr( @@ -59,9 +58,9 @@ function fixOwner (cache, filepath) { typeof uid === 'number' ? uid : self.uid, typeof gid === 'number' ? gid : self.gid ).catch((err) => { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return null - } + throw err }) ) @@ -94,9 +93,9 @@ function fixOwnerSync (cache, filepath) { ) } catch (err) { // only catch ENOENT, any other error is a problem. - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return null - } + throw err } } @@ -111,14 +110,13 @@ function mkdirfix (cache, p, cb) { return Promise.resolve(inferOwner(cache)).then(() => { return mkdirp(p) .then((made) => { - if (made) { + if (made) return fixOwner(cache, made).then(() => made) - } }) .catch((err) => { - if (err.code === 'EEXIST') { + if (err.code === 'EEXIST') return fixOwner(cache, p).then(() => null) - } + throw err }) }) @@ -138,8 +136,7 @@ function mkdirfixSync (cache, p) { if (err.code === 'EEXIST') { fixOwnerSync(cache, p) return null - } else { + } else throw err - } } } diff --git a/node_modules/cacache/lib/util/move-file.js b/node_modules/cacache/lib/util/move-file.js index 84130b2e9ffb8..c3f9e35eb99c7 100644 --- a/node_modules/cacache/lib/util/move-file.js +++ b/node_modules/cacache/lib/util/move-file.js @@ -38,19 +38,17 @@ function moveFile (src, dest) { } else if (err.code === 'EEXIST' || err.code === 'EBUSY') { // file already exists, so whatever return resolve() - } else { + } else return reject(err) - } - } else { + } else return resolve() - } }) }) .then(() => { // content should never change for any reason, so make it read-only return Promise.all([ unlink(src), - !isWindows && chmod(dest, '0444') + !isWindows && chmod(dest, '0444'), ]) }) .catch(() => { diff --git a/node_modules/cacache/lib/verify.js b/node_modules/cacache/lib/verify.js index 5a011a3f1d2cb..e9d679eceaf51 100644 --- a/node_modules/cacache/lib/verify.js +++ b/node_modules/cacache/lib/verify.js @@ -24,7 +24,7 @@ const readFile = util.promisify(fs.readFile) const verifyOpts = (opts) => ({ concurrency: 20, log: { silly () {} }, - ...opts + ...opts, }) module.exports = verify @@ -40,7 +40,7 @@ function verify (cache, opts) { rebuildIndex, cleanTmp, writeVerifile, - markEndTime + markEndTime, ] return steps @@ -54,9 +54,9 @@ function verify (cache, opts) { stats[k] = s[k] }) const end = new Date() - if (!stats.runTime) { + if (!stats.runTime) stats.runTime = {} - } + stats.runTime[label] = end - start return Promise.resolve(stats) }) @@ -108,9 +108,9 @@ function garbageCollect (cache, opts) { const indexStream = index.lsStream(cache) const liveContent = new Set() indexStream.on('data', (entry) => { - if (opts.filter && !opts.filter(entry)) { + if (opts.filter && !opts.filter(entry)) return - } + liveContent.add(entry.integrity.toString()) }) return new Promise((resolve, reject) => { @@ -120,14 +120,14 @@ function garbageCollect (cache, opts) { return glob(path.join(contentDir, '**'), { follow: false, nodir: true, - nosort: true + nosort: true, }).then((files) => { return Promise.resolve({ verifiedContent: 0, reclaimedCount: 0, reclaimedSize: 0, badContentCount: 0, - keptSize: 0 + keptSize: 0, }).then((stats) => pMap( files, @@ -171,14 +171,14 @@ function verifyContent (filepath, sri) { .then((s) => { const contentInfo = { size: s.size, - valid: true + valid: true, } return ssri .checkStream(new fsm.ReadStream(filepath), sri) .catch((err) => { - if (err.code !== 'EINTEGRITY') { + if (err.code !== 'EINTEGRITY') throw err - } + return rimraf(filepath).then(() => { contentInfo.valid = false }) @@ -186,9 +186,9 @@ function verifyContent (filepath, sri) { .then(() => contentInfo) }) .catch((err) => { - if (err.code === 'ENOENT') { + if (err.code === 'ENOENT') return { size: 0, valid: false } - } + throw err }) } @@ -199,7 +199,7 @@ function rebuildIndex (cache, opts) { const stats = { missingContent: 0, rejectedEntries: 0, - totalEntries: 0 + totalEntries: 0, } const buckets = {} for (const k in entries) { @@ -209,9 +209,9 @@ function rebuildIndex (cache, opts) { const entry = entries[k] const excluded = opts.filter && !opts.filter(entry) excluded && stats.rejectedEntries++ - if (buckets[hashed] && !excluded) { + if (buckets[hashed] && !excluded) buckets[hashed].push(entry) - } else if (buckets[hashed] && excluded) { + else if (buckets[hashed] && excluded) { // skip } else if (excluded) { buckets[hashed] = [] @@ -244,7 +244,7 @@ function rebuildBucket (cache, bucket, stats, opts) { return index .insert(cache, entry.key, entry.integrity, { metadata: entry.metadata, - size: entry.size + size: entry.size, }) .then(() => { stats.totalEntries++ diff --git a/node_modules/cacache/package.json b/node_modules/cacache/package.json index aefa5aae42585..3c2e65c0404a0 100644 --- a/node_modules/cacache/package.json +++ b/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "15.1.0", + "version": "15.2.0", "cache-version": { "content": "2", "index": "5" @@ -13,15 +13,17 @@ ], "scripts": { "benchmarks": "node test/benchmarks", - "lint": "standard", - "postrelease": "npm publish", - "posttest": "npm run lint", - "prepublishOnly": "git push --follow-tags", - "prerelease": "npm t", - "release": "standard-version -s", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", "test": "tap", + "snap": "tap", "coverage": "tap", - "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test" + "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", + "lint": "npm run npmclilint -- \"*.*js\" \"lib/**/*.*js\" \"test/**/*.*js\"", + "npmclilint": "npmcli-lint", + "lintfix": "npm run lint -- --fix", + "postsnap": "npm run lintfix --" }, "repository": "https://github.com/npm/cacache", "keywords": [ @@ -39,23 +41,6 @@ "disk cache", "disk storage" ], - "author": { - "name": "Kat Marchán", - "email": "kzm@sykosomatic.org", - "twitter": "maybekatz" - }, - "contributors": [ - { - "name": "Charlotte Spencer", - "email": "charlottelaspencer@gmail.com", - "twitter": "charlotteis" - }, - { - "name": "Rebecca Turner", - "email": "me@re-becca.org", - "twitter": "ReBeccaOrg" - } - ], "license": "ISC", "dependencies": { "@npmcli/move-file": "^1.0.1", @@ -77,11 +62,10 @@ "unique-filename": "^1.1.1" }, "devDependencies": { + "@npmcli/lint": "^1.0.1", "benchmark": "^2.1.4", "chalk": "^4.0.0", "require-inject": "^1.4.4", - "standard": "^14.3.1", - "standard-version": "^7.1.0", "tacks": "^1.3.0", "tap": "^15.0.9" }, diff --git a/node_modules/cacache/put.js b/node_modules/cacache/put.js index eb21aa867173f..84e9562bc33ab 100644 --- a/node_modules/cacache/put.js +++ b/node_modules/cacache/put.js @@ -9,7 +9,7 @@ const Pipeline = require('minipass-pipeline') const putOpts = (opts) => ({ algorithms: ['sha512'], - ...opts + ...opts, }) module.exports = putData @@ -21,9 +21,9 @@ function putData (cache, key, data, opts = {}) { return index .insert(cache, key, res.integrity, { ...opts, size: res.size }) .then((entry) => { - if (memoize) { + if (memoize) memo.put(cache, entry, data, opts) - } + return res.integrity }) }) @@ -67,17 +67,16 @@ function putStream (cache, key, opts = {}) { return index .insert(cache, key, integrity, { ...opts, size }) .then((entry) => { - if (memoize && memoData) { + if (memoize && memoData) memo.put(cache, entry, memoData, opts) - } - if (integrity) { + + if (integrity) pipeline.emit('integrity', integrity) - } - if (size) { + + if (size) pipeline.emit('size', size) - } }) - } + }, })) return pipeline diff --git a/node_modules/cacache/rm.js b/node_modules/cacache/rm.js index 7dd4e8c8b07f1..f2ef6b190f457 100644 --- a/node_modules/cacache/rm.js +++ b/node_modules/cacache/rm.js @@ -11,9 +11,9 @@ const rmContent = require('./lib/content/rm') module.exports = entry module.exports.entry = entry -function entry (cache, key) { +function entry (cache, key, opts) { memo.clearMemoized() - return index.delete(cache, key) + return index.delete(cache, key, opts) } module.exports.content = content diff --git a/node_modules/is-core-module/.github/FUNDING.yml b/node_modules/is-core-module/.github/FUNDING.yml deleted file mode 100644 index 422ce9b01a7f3..0000000000000 --- a/node_modules/is-core-module/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: [ljharb] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: npm/is-core-module -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/is-core-module/.github/workflows/node-4+.yml b/node_modules/is-core-module/.github/workflows/node-4+.yml deleted file mode 100644 index ba174e1d6c28c..0000000000000 --- a/node_modules/is-core-module/.github/workflows/node-4+.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: 'Tests: node.js' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - latest: ${{ steps.set-matrix.outputs.requireds }} - minors: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: '>=4' - - latest: - needs: [matrix] - name: 'latest minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.latest) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - minors: - needs: [matrix, latest] - name: 'non-latest minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.minors) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - - node: - name: 'node 4+' - needs: [latest, minors] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/node_modules/is-core-module/.github/workflows/node-iojs.yml b/node_modules/is-core-module/.github/workflows/node-iojs.yml deleted file mode 100644 index f707c3cfc308e..0000000000000 --- a/node_modules/is-core-module/.github/workflows/node-iojs.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'Tests: node.js (io.js)' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - latest: ${{ steps.set-matrix.outputs.requireds }} - minors: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: 'iojs' - - latest: - needs: [matrix] - name: 'latest minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.latest) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - skip-ls-check: true - - minors: - needs: [matrix, latest] - name: 'non-latest minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.minors) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - skip-ls-check: true - - node: - name: 'io.js' - needs: [latest, minors] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/node_modules/is-core-module/.github/workflows/node-pretest.yml b/node_modules/is-core-module/.github/workflows/node-pretest.yml deleted file mode 100644 index 3921e0ae6cd6b..0000000000000 --- a/node_modules/is-core-module/.github/workflows/node-pretest.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: 'Tests: pretest/posttest' - -on: [pull_request, push] - -jobs: - pretest: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run pretest' - with: - node-version: 'lts/*' - command: 'pretest' - - posttest: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run posttest' - with: - node-version: 'lts/*' - command: 'posttest' diff --git a/node_modules/is-core-module/.github/workflows/node-zero.yml b/node_modules/is-core-module/.github/workflows/node-zero.yml deleted file mode 100644 index d044c6031d5b3..0000000000000 --- a/node_modules/is-core-module/.github/workflows/node-zero.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'Tests: node.js (0.x)' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - stable: ${{ steps.set-matrix.outputs.requireds }} - unstable: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: '0.x' - - stable: - needs: [matrix] - name: 'stable minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.stable) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} - skip-ls-check: true - - unstable: - needs: [matrix, stable] - name: 'unstable minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.unstable) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} - skip-ls-check: true - - node: - name: 'node 0.x' - needs: [stable, unstable] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/node_modules/is-core-module/.github/workflows/rebase.yml b/node_modules/is-core-module/.github/workflows/rebase.yml deleted file mode 100644 index 0c2ad39b5f7b8..0000000000000 --- a/node_modules/is-core-module/.github/workflows/rebase.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Automatic Rebase - -on: [pull_request_target] - -jobs: - _: - name: "Automatic Rebase" - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - uses: ljharb/rebase@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/is-core-module/.github/workflows/require-allow-edits.yml b/node_modules/is-core-module/.github/workflows/require-allow-edits.yml deleted file mode 100644 index aac42d3e29c7a..0000000000000 --- a/node_modules/is-core-module/.github/workflows/require-allow-edits.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Require “Allow Edits” - -on: [pull_request_target] - -jobs: - _: - name: "Require “Allow Edits”" - - runs-on: ubuntu-latest - - steps: - - uses: ljharb/require-allow-edits@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/is-core-module/.nycrc b/node_modules/is-core-module/.nycrc index 1826526e091b8..bdd626ce91477 100644 --- a/node_modules/is-core-module/.nycrc +++ b/node_modules/is-core-module/.nycrc @@ -2,10 +2,6 @@ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, "exclude": [ "coverage", "test" diff --git a/node_modules/is-core-module/CHANGELOG.md b/node_modules/is-core-module/CHANGELOG.md index 4cdb33d005960..f2148ddde438a 100644 --- a/node_modules/is-core-module/CHANGELOG.md +++ b/node_modules/is-core-module/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09 + +### Commits + +- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8) +- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f) +- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c) +- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57) + +## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24 + +### Commits + +- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a) +- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9) +- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed) +- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8) +- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7) +- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c) + ## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26 ### Commits diff --git a/node_modules/is-core-module/README.md b/node_modules/is-core-module/README.md index 479d6d24c0f04..062d9068eb57e 100644 --- a/node_modules/is-core-module/README.md +++ b/node_modules/is-core-module/README.md @@ -1,6 +1,7 @@ # is-core-module [![Version Badge][2]][1] -[![Build Status][3]][4] +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] [![dependency status][5]][6] [![dev dependency status][7]][8] [![License][license-image]][license-url] @@ -24,8 +25,6 @@ Clone the repo, `npm install`, and run `npm test` [1]: https://npmjs.org/package/is-core-module [2]: https://versionbadg.es/inspect-js/is-core-module.svg -[3]: https://travis-ci.com/inspect-js/is-core-module.svg -[4]: https://travis-ci.com/inspect-js/is-core-module [5]: https://david-dm.org/inspect-js/is-core-module.svg [6]: https://david-dm.org/inspect-js/is-core-module [7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg @@ -35,3 +34,7 @@ Clone the repo, `npm install`, and run `npm test` [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg [downloads-url]: https://npm-stat.com/charts.html?package=is-core-module +[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module +[actions-url]: https://github.com/inspect-js/is-core-module/actions diff --git a/node_modules/is-core-module/core.json b/node_modules/is-core-module/core.json index 0238b61a4c71e..44a92a1a414b9 100644 --- a/node_modules/is-core-module/core.json +++ b/node_modules/is-core-module/core.json @@ -1,83 +1,146 @@ { "assert": true, + "node:assert": ">= 16", "assert/strict": ">= 15", + "node:assert/strict": ">= 16", "async_hooks": ">= 8", + "node:async_hooks": ">= 16", "buffer_ieee754": "< 0.9.7", "buffer": true, + "node:buffer": ">= 16", "child_process": true, + "node:child_process": ">= 16", "cluster": true, + "node:cluster": ">= 16", "console": true, + "node:console": ">= 16", "constants": true, + "node:constants": ">= 16", "crypto": true, + "node:crypto": ">= 16", "_debug_agent": ">= 1 && < 8", "_debugger": "< 8", "dgram": true, - "diagnostics_channel": ">= 15.1", + "node:dgram": ">= 16", + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": ">= 16", "dns": true, + "node:dns": ">= 16", "dns/promises": ">= 15", + "node:dns/promises": ">= 16", "domain": ">= 0.7.12", + "node:domain": ">= 16", "events": true, + "node:events": ">= 16", "freelist": "< 6", "fs": true, + "node:fs": ">= 16", "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": ">= 16", "_http_agent": ">= 0.11.1", + "node:_http_agent": ">= 16", "_http_client": ">= 0.11.1", + "node:_http_client": ">= 16", "_http_common": ">= 0.11.1", + "node:_http_common": ">= 16", "_http_incoming": ">= 0.11.1", + "node:_http_incoming": ">= 16", "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": ">= 16", "_http_server": ">= 0.11.1", + "node:_http_server": ">= 16", "http": true, + "node:http": ">= 16", "http2": ">= 8.8", + "node:http2": ">= 16", "https": true, - "inspector": ">= 8.0.0", + "node:https": ">= 16", + "inspector": ">= 8", + "node:inspector": ">= 16", "_linklist": "< 8", "module": true, + "node:module": ">= 16", "net": true, - "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", + "node:net": ">= 16", + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", "os": true, + "node:os": ">= 16", "path": true, + "node:path": ">= 16", "path/posix": ">= 15.3", + "node:path/posix": ">= 16", "path/win32": ">= 15.3", + "node:path/win32": ">= 16", "perf_hooks": ">= 8.5", + "node:perf_hooks": ">= 16", "process": ">= 1", + "node:process": ">= 16", "punycode": true, + "node:punycode": ">= 16", "querystring": true, + "node:querystring": ">= 16", "readline": true, + "node:readline": ">= 16", "repl": true, + "node:repl": ">= 16", "smalloc": ">= 0.11.5 && < 3", "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": ">= 16", "_stream_transform": ">= 0.9.4", + "node:_stream_transform": ">= 16", "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": ">= 16", "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": ">= 16", "_stream_readable": ">= 0.9.4", + "node:_stream_readable": ">= 16", "_stream_writable": ">= 0.9.4", + "node:_stream_writable": ">= 16", "stream": true, + "node:stream": ">= 16", "stream/promises": ">= 15", + "node:stream/promises": ">= 16", "string_decoder": true, + "node:string_decoder": ">= 16", "sys": [">= 0.6 && < 0.7", ">= 0.8"], + "node:sys": ">= 16", "timers": true, + "node:timers": ">= 16", "timers/promises": ">= 15", + "node:timers/promises": ">= 16", "_tls_common": ">= 0.11.13", + "node:_tls_common": ">= 16", "_tls_legacy": ">= 0.11.3 && < 10", "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": ">= 16", "tls": true, + "node:tls": ">= 16", "trace_events": ">= 10", + "node:trace_events": ">= 16", "tty": true, + "node:tty": ">= 16", "url": true, + "node:url": ">= 16", "util": true, + "node:util": ">= 16", "util/types": ">= 15.3", + "node:util/types": ">= 16", "v8/tools/arguments": ">= 10 && < 12", - "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], "v8": ">= 1", + "node:v8": ">= 16", "vm": true, + "node:vm": ">= 16", "wasi": ">= 13.4 && < 13.5", "worker_threads": ">= 11.7", - "zlib": true + "node:worker_threads": ">= 16", + "zlib": true, + "node:zlib": ">= 16" } diff --git a/node_modules/is-core-module/package.json b/node_modules/is-core-module/package.json index 21341cc431a50..0442e92cd2065 100644 --- a/node_modules/is-core-module/package.json +++ b/node_modules/is-core-module/package.json @@ -1,6 +1,6 @@ { "name": "is-core-module", - "version": "2.2.0", + "version": "2.4.0", "description": "Is this specifier a node.js core module?", "main": "index.js", "exports": { @@ -13,7 +13,8 @@ "./package.json": "./package.json" }, "scripts": { - "prepublish": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", "lint": "eslint .", "pretest": "npm run lint", "tests-only": "tape 'test/**/*.js'", @@ -47,13 +48,14 @@ "has": "^1.0.3" }, "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", "auto-changelog": "^2.2.1", - "eslint": "^7.14.0", + "eslint": "^7.26.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" + "semver": "^6.3.0", + "tape": "^5.2.2" }, "auto-changelog": { "output": "CHANGELOG.md", diff --git a/node_modules/is-core-module/test/index.js b/node_modules/is-core-module/test/index.js index 99659bcf113f7..281c7e9a4b134 100644 --- a/node_modules/is-core-module/test/index.js +++ b/node_modules/is-core-module/test/index.js @@ -2,9 +2,12 @@ var test = require('tape'); var keys = require('object-keys'); +var semver = require('semver'); var isCore = require('../'); var data = require('../core.json'); +var supportsNodePrefix = semver.satisfies(process.versions.node, '>= 16'); + test('core modules', function (t) { t.test('isCore()', function (st) { st.ok(isCore('fs')); @@ -48,6 +51,17 @@ test('core modules', function (t) { function () { require(mod); }, // eslint-disable-line no-loop-func 'requiring ' + mod + ' does not throw' ); + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } } } st.end(); @@ -73,6 +87,17 @@ test('core modules', function (t) { function () { require(mod); }, // eslint-disable-line no-loop-func 'requiring ' + mod + ' does not throw' ); + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } } } } diff --git a/node_modules/npm-audit-report/CHANGELOG.md b/node_modules/npm-audit-report/CHANGELOG.md deleted file mode 100644 index 58819a43b4d11..0000000000000 --- a/node_modules/npm-audit-report/CHANGELOG.md +++ /dev/null @@ -1,81 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - - -## [1.3.3](https://github.com/npm/npm-audit-report/compare/v1.3.2...v1.3.3) (2020-03-26) - - - - -## [1.3.2](https://github.com/npm/npm-audit-report/compare/v1.3.1...v1.3.2) (2018-12-18) - - -### Bug Fixes - -* **parseable:** add support for critical vulns and more resolves on update/install action ([#28](https://github.com/npm/npm-audit-report/issues/28)) ([5e27893](https://github.com/npm/npm-audit-report/commit/5e27893)) -* **security:** audit fix ([ff9faf3](https://github.com/npm/npm-audit-report/commit/ff9faf3)) -* **urls:** Replace hardcoded URL to advisory with a URL from audit response ([#34](https://github.com/npm/npm-audit-report/issues/34)) ([e2fe95b](https://github.com/npm/npm-audit-report/commit/e2fe95b)) - - - - -## [1.3.1](https://github.com/npm/npm-audit-report/compare/v1.3.0...v1.3.1) (2018-07-10) - - - - -# [1.3.0](https://github.com/npm/npm-audit-report/compare/v1.2.1...v1.3.0) (2018-07-09) - - -### Bug Fixes - -* **deps:** remove object.values dependency ([2c5374a](https://github.com/npm/npm-audit-report/commit/2c5374a)) -* **detail:** Fix info-level severity ([#18](https://github.com/npm/npm-audit-report/issues/18)) ([807db5a](https://github.com/npm/npm-audit-report/commit/807db5a)) -* **tests:** a test should not cause side-effects in other tests ([#23](https://github.com/npm/npm-audit-report/issues/23)) ([a94449f](https://github.com/npm/npm-audit-report/commit/a94449f)) - - -### Features - -* **output:** add `parseable` tabular output format support ([#21](https://github.com/npm/npm-audit-report/issues/21)) ([1c9aaf4](https://github.com/npm/npm-audit-report/commit/1c9aaf4)) - - - - -## [1.2.1](https://github.com/npm/npm-audit-report/compare/v1.2.0...v1.2.1) (2018-05-17) - - -### Bug Fixes - -* **detail:** count id+path instead of just id ([99880fd](https://github.com/npm/npm-audit-report/commit/99880fd)) - - - - -# [1.2.0](https://github.com/npm/npm-audit-report/compare/v1.1.0...v1.2.0) (2018-05-16) - - -### Bug Fixes - -* **full-report:** Fix install flag for devDependencies ([#14](https://github.com/npm/npm-audit-report/issues/14)) ([30e5f30](https://github.com/npm/npm-audit-report/commit/30e5f30)) - - -### Features - -* **detail:** consistified full report with install report ([#15](https://github.com/npm/npm-audit-report/issues/15)) ([6df6810](https://github.com/npm/npm-audit-report/commit/6df6810)) -* **install:** include `npm audit` recommendation too ([32fb153](https://github.com/npm/npm-audit-report/commit/32fb153)) - - - - -# [1.1.0](https://github.com/npm/npm-audit-report/compare/v1.0.9...v1.1.0) (2018-05-10) - - -### Bug Fixes - -* **install:** not enough data for this conditional ([6ddc30c](https://github.com/npm/npm-audit-report/commit/6ddc30c)) - - -### Features - -* **report:** compress and reformat human-readable install report ([74d5203](https://github.com/npm/npm-audit-report/commit/74d5203)) diff --git a/node_modules/npm-audit-report/lib/index.js b/node_modules/npm-audit-report/lib/index.js index 464004c17518a..9ee86be7915d8 100644 --- a/node_modules/npm-audit-report/lib/index.js +++ b/node_modules/npm-audit-report/lib/index.js @@ -15,9 +15,11 @@ module.exports = Object.assign((data, options = {}) => { color = true, unicode = true, indent = 2, - auditLevel = 'low' } = options + // CLI defaults this to `null` so the defaulting method above doesn't work + const auditLevel = options.auditLevel || 'low' + if (!data) throw Object.assign( new TypeError('ENOAUDITDATA'), diff --git a/node_modules/npm-audit-report/package.json b/node_modules/npm-audit-report/package.json index 66b4a6aa74b2c..c819b9608412a 100644 --- a/node_modules/npm-audit-report/package.json +++ b/node_modules/npm-audit-report/package.json @@ -1,6 +1,6 @@ { "name": "npm-audit-report", - "version": "2.1.4", + "version": "2.1.5", "description": "Given a response from the npm security api, render it into a variety of security reports", "main": "lib/index.js", "scripts": { @@ -26,8 +26,8 @@ "chalk": "^4.0.0" }, "devDependencies": { - "tap": "^14.10.7", - "require-inject": "^1.4.4" + "require-inject": "^1.4.4", + "tap": "^14.10.7" }, "directories": { "lib": "lib", diff --git a/package-lock.json b/package-lock.json index 5c511c49f581a..3e3f6a7db04c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "npm", - "version": "7.14.0", + "version": "7.15.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "npm", - "version": "7.14.0", + "version": "7.15.0", "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", @@ -87,7 +87,7 @@ "ansistyles": "~0.1.3", "archy": "~1.0.0", "byte-size": "^7.0.1", - "cacache": "^15.1.0", + "cacache": "^15.2.0", "chalk": "^4.1.0", "chownr": "^2.0.0", "cli-columns": "^3.1.2", @@ -120,7 +120,7 @@ "ms": "^2.1.2", "node-gyp": "^7.1.2", "nopt": "^5.0.0", - "npm-audit-report": "^2.1.4", + "npm-audit-report": "^2.1.5", "npm-package-arg": "^8.1.2", "npm-pick-manifest": "^6.1.1", "npm-profile": "^5.0.3", @@ -1482,9 +1482,9 @@ } }, "node_modules/cacache": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.1.0.tgz", - "integrity": "sha512-mfx0C+mCfWjD1PnwQ9yaOrwG1ou9FkKnx0SvzUHWdFt7r7GaRtzT+9M8HAvLu62zIHtnpQ/1m93nWNDCckJGXQ==", + "version": "15.2.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.2.0.tgz", + "integrity": "sha512-uKoJSHmnrqXgthDFx/IU6ED/5xd+NNGe+Bb+kLZy7Ku4P+BaiWEUflAKPZ7eAzsYGcsAGASJZsybXp+quEcHTw==", "inBundle": true, "dependencies": { "@npmcli/move-file": "^1.0.1", @@ -1930,15 +1930,6 @@ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "inBundle": true }, - "node_modules/contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -2498,9 +2489,9 @@ } }, "node_modules/eslint": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.26.0.tgz", - "integrity": "sha512-4R1ieRf52/izcZE7AlLy56uIHHDLT74Yzz2Iv2l6kDaYvEu9x+wMB5dZArVL8SYGXSYV2YAg70FcW5Y5nGGNIg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.27.0.tgz", + "integrity": "sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA==", "dev": true, "dependencies": { "@babel/code-frame": "7.12.11", @@ -2511,12 +2502,14 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", "glob-parent": "^5.0.0", @@ -2528,7 +2521,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.21", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -2537,7 +2530,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -2577,12 +2570,12 @@ "dev": true }, "node_modules/eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz", + "integrity": "sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A==", "dev": true, "dependencies": { - "debug": "^2.6.9", + "debug": "^3.2.7", "pkg-dir": "^2.0.0" }, "engines": { @@ -2590,20 +2583,14 @@ } }, "node_modules/eslint-module-utils/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "node_modules/eslint-module-utils/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/eslint-plugin-es": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", @@ -2624,23 +2611,25 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "version": "2.23.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.3.tgz", + "integrity": "sha512-wDxdYbSB55F7T5CC7ucDjY641VvKmlRwT0Vxh7PkY1mI4rclVRFWYfsrjDgZvwYYDZ5ee0ZtfFKXowWjqvEoRQ==", "dev": true, "dependencies": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", + "array-includes": "^3.1.3", + "array.prototype.flat": "^1.2.4", "debug": "^2.6.9", - "doctrine": "1.5.0", + "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", + "eslint-module-utils": "^2.6.1", + "find-up": "^2.0.0", "has": "^1.0.3", + "is-core-module": "^2.4.0", "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", + "object.values": "^1.1.3", + "pkg-up": "^2.0.0", + "read-pkg-up": "^3.0.0", + "resolve": "^1.20.0", "tsconfig-paths": "^3.9.0" }, "engines": { @@ -2660,13 +2649,12 @@ } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "dependencies": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" }, "engines": { "node": ">=0.10.0" @@ -2816,6 +2804,18 @@ "node": ">=8" } }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint/node_modules/globals": { "version": "13.8.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.8.0.tgz", @@ -4004,9 +4004,9 @@ } }, "node_modules/is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", "inBundle": true, "dependencies": { "has": "^1.0.3" @@ -4399,13 +4399,13 @@ "inBundle": true }, "node_modules/jsdom": { - "version": "16.5.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.5.3.tgz", - "integrity": "sha512-Qj1H+PEvUsOtdPJ056ewXM4UJPCi4hhLA8wpiz9F2YvsRBhuFsXxtrIFAgGBDynQA9isAMGE91PfUYbdMPXuTA==", + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", + "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", "dev": true, "dependencies": { "abab": "^2.0.5", - "acorn": "^8.1.0", + "acorn": "^8.2.4", "acorn-globals": "^6.0.0", "cssom": "^0.4.4", "cssstyle": "^2.3.0", @@ -4413,12 +4413,13 @@ "decimal.js": "^10.2.1", "domexception": "^2.0.1", "escodegen": "^2.0.0", + "form-data": "^3.0.0", "html-encoding-sniffer": "^2.0.1", - "is-potential-custom-element-name": "^1.0.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", "nwsapi": "^2.2.0", "parse5": "6.0.1", - "request": "^2.88.2", - "request-promise-native": "^1.0.9", "saxes": "^5.0.1", "symbol-tree": "^3.2.4", "tough-cookie": "^4.0.0", @@ -4428,7 +4429,7 @@ "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", "whatwg-url": "^8.5.0", - "ws": "^7.4.4", + "ws": "^7.4.5", "xml-name-validator": "^3.0.0" }, "engines": { @@ -4444,9 +4445,9 @@ } }, "node_modules/jsdom/node_modules/acorn": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.1.tgz", - "integrity": "sha512-xYiIVjNuqtKXMxlRMDc6mZUhXehod4a3gbZ1qRlM7icK4EbxUFNLhWoPblCvFtB2Y9CIqHP3CF/rdxLItaQv8g==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz", + "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -4455,6 +4456,20 @@ "node": ">=0.4.0" } }, + "node_modules/jsdom/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -4467,6 +4482,12 @@ "node": ">=4" } }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "node_modules/json-parse-errback": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/json-parse-errback/-/json-parse-errback-2.0.1.tgz", @@ -4826,14 +4847,14 @@ } }, "node_modules/load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "dependencies": { "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", + "parse-json": "^4.0.0", + "pify": "^3.0.0", "strip-bom": "^3.0.0" }, "engines": { @@ -4877,6 +4898,12 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -5372,9 +5399,9 @@ } }, "node_modules/npm-audit-report": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-2.1.4.tgz", - "integrity": "sha512-Tz7rnfskSdZ0msTzt2mENC/B+H2QI8u0jN0ck7o3zDsQYIQrek/l3MjEc+CARer+64LsVTU6ZIqNuh0X55QPhw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-2.1.5.tgz", + "integrity": "sha512-YB8qOoEmBhUH1UJgh1xFAv7Jg1d+xoNhsDYiFQlEFThEBui0W1vIz2ZK6FVg4WZjwEdl7uBQlm1jy3MUfyHeEw==", "inBundle": true, "dependencies": { "chalk": "^4.0.0" @@ -5941,15 +5968,16 @@ } }, "node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "dependencies": { - "error-ex": "^1.2.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/parse5": { @@ -5992,12 +6020,12 @@ "inBundle": true }, "node_modules/path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "dependencies": { - "pify": "^2.0.0" + "pify": "^3.0.0" }, "engines": { "node": ">=4" @@ -6022,12 +6050,12 @@ } }, "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/pkg-dir": { @@ -6042,6 +6070,18 @@ "node": ">=4" } }, + "node_modules/pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "dependencies": { + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/prebuild-install": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.1.tgz", @@ -6392,27 +6432,27 @@ } }, "node_modules/read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "dependencies": { - "load-json-file": "^2.0.0", + "load-json-file": "^4.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "path-type": "^3.0.0" }, "engines": { "node": ">=4" } }, "node_modules/read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "dependencies": { "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "read-pkg": "^3.0.0" }, "engines": { "node": ">=4" @@ -6626,52 +6666,6 @@ "node": ">= 6" } }, - "node_modules/request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "dependencies": { - "lodash": "^4.17.19" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", - "dev": true, - "dependencies": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "engines": { - "node": ">=0.12.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request-promise-native/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/request/node_modules/tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -7139,15 +7133,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -11406,9 +11391,9 @@ "integrity": "sha512-crQdqyCwhokxwV1UyDzLZanhkugAgft7vt0qbbdt60C6Zf3CAiGmtUCylbtYwrU6loOUw3euGrNtW1J651ot1A==" }, "cacache": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.1.0.tgz", - "integrity": "sha512-mfx0C+mCfWjD1PnwQ9yaOrwG1ou9FkKnx0SvzUHWdFt7r7GaRtzT+9M8HAvLu62zIHtnpQ/1m93nWNDCckJGXQ==", + "version": "15.2.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.2.0.tgz", + "integrity": "sha512-uKoJSHmnrqXgthDFx/IU6ED/5xd+NNGe+Bb+kLZy7Ku4P+BaiWEUflAKPZ7eAzsYGcsAGASJZsybXp+quEcHTw==", "requires": { "@npmcli/move-file": "^1.0.1", "chownr": "^2.0.0", @@ -11722,12 +11707,6 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, "convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -12155,9 +12134,9 @@ } }, "eslint": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.26.0.tgz", - "integrity": "sha512-4R1ieRf52/izcZE7AlLy56uIHHDLT74Yzz2Iv2l6kDaYvEu9x+wMB5dZArVL8SYGXSYV2YAg70FcW5Y5nGGNIg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.27.0.tgz", + "integrity": "sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", @@ -12168,12 +12147,14 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", "glob-parent": "^5.0.0", @@ -12185,7 +12166,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.21", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -12194,7 +12175,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -12214,6 +12195,12 @@ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, "globals": { "version": "13.8.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.8.0.tgz", @@ -12268,29 +12255,23 @@ } }, "eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz", + "integrity": "sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A==", "dev": true, "requires": { - "debug": "^2.6.9", + "debug": "^3.2.7", "pkg-dir": "^2.0.0" }, "dependencies": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -12305,23 +12286,25 @@ } }, "eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "version": "2.23.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.3.tgz", + "integrity": "sha512-wDxdYbSB55F7T5CC7ucDjY641VvKmlRwT0Vxh7PkY1mI4rclVRFWYfsrjDgZvwYYDZ5ee0ZtfFKXowWjqvEoRQ==", "dev": true, "requires": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", + "array-includes": "^3.1.3", + "array.prototype.flat": "^1.2.4", "debug": "^2.6.9", - "doctrine": "1.5.0", + "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", + "eslint-module-utils": "^2.6.1", + "find-up": "^2.0.0", "has": "^1.0.3", + "is-core-module": "^2.4.0", "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", + "object.values": "^1.1.3", + "pkg-up": "^2.0.0", + "read-pkg-up": "^3.0.0", + "resolve": "^1.20.0", "tsconfig-paths": "^3.9.0" }, "dependencies": { @@ -12335,13 +12318,12 @@ } }, "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" } }, "ms": { @@ -13242,9 +13224,9 @@ } }, "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", "requires": { "has": "^1.0.3" } @@ -13523,13 +13505,13 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "jsdom": { - "version": "16.5.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.5.3.tgz", - "integrity": "sha512-Qj1H+PEvUsOtdPJ056ewXM4UJPCi4hhLA8wpiz9F2YvsRBhuFsXxtrIFAgGBDynQA9isAMGE91PfUYbdMPXuTA==", + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", + "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", "dev": true, "requires": { "abab": "^2.0.5", - "acorn": "^8.1.0", + "acorn": "^8.2.4", "acorn-globals": "^6.0.0", "cssom": "^0.4.4", "cssstyle": "^2.3.0", @@ -13537,12 +13519,13 @@ "decimal.js": "^10.2.1", "domexception": "^2.0.1", "escodegen": "^2.0.0", + "form-data": "^3.0.0", "html-encoding-sniffer": "^2.0.1", - "is-potential-custom-element-name": "^1.0.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", "nwsapi": "^2.2.0", "parse5": "6.0.1", - "request": "^2.88.2", - "request-promise-native": "^1.0.9", "saxes": "^5.0.1", "symbol-tree": "^3.2.4", "tough-cookie": "^4.0.0", @@ -13552,15 +13535,26 @@ "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", "whatwg-url": "^8.5.0", - "ws": "^7.4.4", + "ws": "^7.4.5", "xml-name-validator": "^3.0.0" }, "dependencies": { "acorn": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.1.tgz", - "integrity": "sha512-xYiIVjNuqtKXMxlRMDc6mZUhXehod4a3gbZ1qRlM7icK4EbxUFNLhWoPblCvFtB2Y9CIqHP3CF/rdxLItaQv8g==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz", + "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==", "dev": true + }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } } } }, @@ -13570,6 +13564,12 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "json-parse-errback": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/json-parse-errback/-/json-parse-errback-2.0.1.tgz", @@ -13846,14 +13846,14 @@ } }, "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", + "parse-json": "^4.0.0", + "pify": "^3.0.0", "strip-bom": "^3.0.0" } }, @@ -13891,6 +13891,12 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -14251,9 +14257,9 @@ "dev": true }, "npm-audit-report": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-2.1.4.tgz", - "integrity": "sha512-Tz7rnfskSdZ0msTzt2mENC/B+H2QI8u0jN0ck7o3zDsQYIQrek/l3MjEc+CARer+64LsVTU6ZIqNuh0X55QPhw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-2.1.5.tgz", + "integrity": "sha512-YB8qOoEmBhUH1UJgh1xFAv7Jg1d+xoNhsDYiFQlEFThEBui0W1vIz2ZK6FVg4WZjwEdl7uBQlm1jy3MUfyHeEw==", "requires": { "chalk": "^4.0.0" } @@ -14676,12 +14682,13 @@ } }, "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, "parse5": { @@ -14713,12 +14720,12 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" }, "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^2.0.0" + "pify": "^3.0.0" } }, "performance-now": { @@ -14733,9 +14740,9 @@ "dev": true }, "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, "pkg-dir": { @@ -14747,6 +14754,15 @@ "find-up": "^2.1.0" } }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, "prebuild-install": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.1.tgz", @@ -15014,14 +15030,14 @@ } }, "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "^2.0.0", + "load-json-file": "^4.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "path-type": "^3.0.0" }, "dependencies": { "hosted-git-info": { @@ -15051,13 +15067,13 @@ } }, "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "read-pkg": "^3.0.0" } }, "readable-stream": { @@ -15216,38 +15232,6 @@ } } }, - "request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "dev": true, - "requires": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "dependencies": { - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -15574,12 +15558,6 @@ "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", "dev": true }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true - }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", diff --git a/package.json b/package.json index d7f46589a4d2b..60637d6055154 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "7.14.0", + "version": "7.15.0", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -51,7 +51,7 @@ "ansistyles": "~0.1.3", "archy": "~1.0.0", "byte-size": "^7.0.1", - "cacache": "^15.1.0", + "cacache": "^15.2.0", "chalk": "^4.1.0", "chownr": "^2.0.0", "cli-columns": "^3.1.2", @@ -84,7 +84,7 @@ "ms": "^2.1.2", "node-gyp": "^7.1.2", "nopt": "^5.0.0", - "npm-audit-report": "^2.1.4", + "npm-audit-report": "^2.1.5", "npm-package-arg": "^8.1.2", "npm-pick-manifest": "^6.1.1", "npm-profile": "^5.0.3", diff --git a/tap-snapshots/test/lib/link.js.test.cjs b/tap-snapshots/test/lib/link.js.test.cjs index d6dd376593b4d..0e20bcd994e3a 100644 --- a/tap-snapshots/test/lib/link.js.test.cjs +++ b/tap-snapshots/test/lib/link.js.test.cjs @@ -14,6 +14,16 @@ exports[`test/lib/link.js TAP link global linked pkg to local nm when using args ` +exports[`test/lib/link.js TAP link global linked pkg to local workspace using args > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/@myscope/bar -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/global-prefix/lib/node_modules/@myscope/bar +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/scoped-linked +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/a -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/global-prefix/lib/node_modules/a +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/link-me-too -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/link-me-too +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/test-pkg-link -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/test-pkg-link +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/x -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/packages/x + +` + exports[`test/lib/link.js TAP link pkg already in global space > should create a local symlink to global pkg 1`] = ` {CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space/scoped-linked @@ -28,3 +38,8 @@ exports[`test/lib/link.js TAP link to globalDir when in current working dir of p {CWD}/test/lib/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/global-prefix/lib/node_modules/test-pkg-link -> {CWD}/test/lib/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/test-pkg-link ` + +exports[`test/lib/link.js TAP link ws to globalDir when workspace specified and no args > should create a global link to current pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-ws-to-globalDir-when-workspace-specified-and-no-args/global-prefix/lib/node_modules/a -> {CWD}/test/lib/tap-testdir-link-link-ws-to-globalDir-when-workspace-specified-and-no-args/test-pkg-link/packages/a + +` diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index f2d40d4161494..d40be42868184 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -521,6 +521,8 @@ Options: [--strict-peer-deps] [--package-lock] [--omit [--omit ...]] [--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] +[-w|--workspace [-w|--workspace ...]] +[-ws|--workspaces] alias: ln diff --git a/tap-snapshots/test/lib/ls.js.test.cjs b/tap-snapshots/test/lib/ls.js.test.cjs index f443d9caba895..2ed0b4b001376 100644 --- a/tap-snapshots/test/lib/ls.js.test.cjs +++ b/tap-snapshots/test/lib/ls.js.test.cjs @@ -70,7 +70,7 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---dev exports[`test/lib/ls.js TAP ls --link > should output tree containing linked deps 1`] = ` test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---link -\`-- linked-dep@1.0.0 -> {CWD}/tap-testdir-ls-ls---link/linked-dep +\`-- linked-dep@1.0.0 -> ./linked-dep ` @@ -480,24 +480,24 @@ exports[`test/lib/ls.js TAP ls json read problems > should print empty result 1` exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should filter by parent folder workspace config 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -+-- e@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/e -\`-- f@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/f ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f ` exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should filter single workspace 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -+-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a -| \`-- d@1.0.0 deduped -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d -\`-- d@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d ++-- a@1.0.0 -> ./a +| \`-- d@1.0.0 deduped -> ./d +\`-- d@1.0.0 -> ./d ` exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should filter using workspace config 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -\`-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a +\`-- a@1.0.0 -> ./a +-- c@1.0.0 - \`-- d@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d + \`-- d@1.0.0 -> ./d \`-- foo@1.1.1 \`-- bar@1.0.0 @@ -505,34 +505,34 @@ workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspac exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should list --all workspaces properly 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -+-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a ++-- a@1.0.0 -> ./a | +-- c@1.0.0 -| \`-- d@1.0.0 deduped -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d -+-- b@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/b -+-- d@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d +| \`-- d@1.0.0 deduped -> ./d ++-- b@1.0.0 -> ./b ++-- d@1.0.0 -> ./d | \`-- foo@1.1.1 | \`-- bar@1.0.0 -+-- e@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/e -\`-- f@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/f ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f ` exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should list workspaces properly with default configs 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -+-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a ++-- a@1.0.0 -> ./a | +-- c@1.0.0 -| \`-- d@1.0.0 deduped -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d -+-- b@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/b -+-- d@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d +| \`-- d@1.0.0 deduped -> ./d ++-- b@1.0.0 -> ./b ++-- d@1.0.0 -> ./d | \`-- foo@1.1.1 -+-- e@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/e -\`-- f@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/group/f ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f  ` exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should print all tree and filter by dep within only the ws subtree 1`] = ` workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces -\`-- d@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/d +\`-- d@1.0.0 -> ./d \`-- foo@1.1.1 \`-- bar@1.0.0 @@ -567,8 +567,8 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-no-args exports[`test/lib/ls.js TAP ls print deduped symlinks > should output tree containing linked deps 1`] = ` print-deduped-symlinks@1.0.0 {CWD}/tap-testdir-ls-ls-print-deduped-symlinks +-- a@1.0.0 -| \`-- b@1.0.0 deduped -> {CWD}/tap-testdir-ls-ls-print-deduped-symlinks/b -\`-- b@1.0.0 -> {CWD}/tap-testdir-ls-ls-print-deduped-symlinks/b +| \`-- b@1.0.0 deduped -> ./b +\`-- b@1.0.0 -> ./b ` diff --git a/tap-snapshots/test/lib/publish.js.test.cjs b/tap-snapshots/test/lib/publish.js.test.cjs index 05f0e6580ab5a..7a7502e02e338 100644 --- a/tap-snapshots/test/lib/publish.js.test.cjs +++ b/tap-snapshots/test/lib/publish.js.test.cjs @@ -5,6 +5,40 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' +exports[`test/lib/publish.js TAP private workspaces colorless > should output all publishes 1`] = ` +Array [ + "+ @npmcli/b@1.0.0", +] +` + +exports[`test/lib/publish.js TAP private workspaces colorless > should publish all non-private workspaces 1`] = ` +Array [ + Object { + "_id": "@npmcli/b@1.0.0", + "name": "@npmcli/b", + "readme": "ERROR: No README data found!", + "version": "1.0.0", + }, +] +` + +exports[`test/lib/publish.js TAP private workspaces with color > should output all publishes 1`] = ` +Array [ + "+ @npmcli/b@1.0.0", +] +` + +exports[`test/lib/publish.js TAP private workspaces with color > should publish all non-private workspaces 1`] = ` +Array [ + Object { + "_id": "@npmcli/b@1.0.0", + "name": "@npmcli/b", + "readme": "ERROR: No README data found!", + "version": "1.0.0", + }, +] +` + exports[`test/lib/publish.js TAP shows usage with wrong set of arguments > should print usage 1`] = ` Error: Usage: npm publish diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index a81a8f44b30b9..7fdcf0c5d2dba 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -624,6 +624,8 @@ All commands: [--strict-peer-deps] [--package-lock] [--omit [--omit ...]] [--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] + [-w|--workspace [-w|--workspace ...]] + [-ws|--workspaces] alias: ln diff --git a/test/lib/link.js b/test/lib/link.js index d3e66185280ae..3cad0ff90362d 100644 --- a/test/lib/link.js +++ b/test/lib/link.js @@ -84,6 +84,60 @@ t.test('link to globalDir when in current working dir of pkg and no args', (t) = }) }) +t.test('link ws to globalDir when workspace specified and no args', (t) => { + t.plan(2) + + const testdir = t.testdir({ + 'global-prefix': { + lib: { + node_modules: { + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + }), + }, + }, + }, + }, + 'test-pkg-link': { + 'package.json': JSON.stringify({ + name: 'test-pkg-link', + version: '1.0.0', + workspaces: ['packages/*'], + }), + packages: { + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + }), + }, + }, + }, + }) + npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules') + npm.prefix = resolve(testdir, 'test-pkg-link') + npm.localPrefix = resolve(testdir, 'test-pkg-link') + + reifyOutput = async () => { + reifyOutput = undefined + + const links = await printLinks({ + path: resolve(npm.globalDir, '..'), + global: true, + }) + + t.matchSnapshot(links, 'should create a global link to current pkg') + } + + // link.workspaces = ['a'] + // link.workspacePaths = [resolve(testdir, 'test-pkg-link/packages/a')] + link.execWorkspaces([], ['a'], (err) => { + t.error(err, 'should not error out') + }) +}) + t.test('link global linked pkg to local nm when using args', (t) => { t.plan(2) @@ -192,6 +246,124 @@ t.test('link global linked pkg to local nm when using args', (t) => { }) }) +t.test('link global linked pkg to local workspace using args', (t) => { + t.plan(2) + + const testdir = t.testdir({ + 'global-prefix': { + lib: { + node_modules: { + '@myscope': { + foo: { + 'package.json': JSON.stringify({ + name: '@myscope/foo', + version: '1.0.0', + }), + }, + bar: { + 'package.json': JSON.stringify({ + name: '@myscope/bar', + version: '1.0.0', + }), + }, + linked: t.fixture('symlink', '../../../../scoped-linked'), + }, + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + }), + }, + b: { + 'package.json': JSON.stringify({ + name: 'b', + version: '1.0.0', + }), + }, + 'test-pkg-link': t.fixture('symlink', '../../../test-pkg-link'), + }, + }, + }, + 'test-pkg-link': { + 'package.json': JSON.stringify({ + name: 'test-pkg-link', + version: '1.0.0', + }), + }, + 'link-me-too': { + 'package.json': JSON.stringify({ + name: 'link-me-too', + version: '1.0.0', + }), + }, + 'scoped-linked': { + 'package.json': JSON.stringify({ + name: '@myscope/linked', + version: '1.0.0', + }), + }, + 'my-project': { + 'package.json': JSON.stringify({ + name: 'my-project', + version: '1.0.0', + workspaces: ['packages/*'], + }), + packages: { + x: { + 'package.json': JSON.stringify({ + name: 'x', + version: '1.0.0', + dependencies: { + foo: '^1.0.0', + }, + }), + }, + }, + node_modules: { + foo: { + 'package.json': JSON.stringify({ + name: 'foo', + version: '1.0.0', + }), + }, + }, + }, + }) + npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules') + npm.prefix = resolve(testdir, 'my-project') + npm.localPrefix = resolve(testdir, 'my-project') + + const _cwd = process.cwd() + process.chdir(npm.prefix) + + reifyOutput = async () => { + reifyOutput = undefined + process.chdir(_cwd) + + const links = await printLinks({ + path: npm.prefix, + }) + + t.matchSnapshot(links, 'should create a local symlink to global pkg') + } + + // installs examples for: + // - test-pkg-link: pkg linked to globalDir from local fs + // - @myscope/linked: scoped pkg linked to globalDir from local fs + // - @myscope/bar: prev installed scoped package available in globalDir + // - a: prev installed package available in globalDir + // - file:./link-me-too: pkg that needs to be reified in globalDir first + link.execWorkspaces([ + 'test-pkg-link', + '@myscope/linked', + '@myscope/bar', + 'a', + 'file:../link-me-too', + ], ['x'], (err) => { + t.error(err, 'should not error out') + }) +}) + t.test('link pkg already in global space', (t) => { t.plan(3) diff --git a/test/lib/ls.js b/test/lib/ls.js index 2cde319463a9e..ecdede809df20 100644 --- a/test/lib/ls.js +++ b/test/lib/ls.js @@ -90,7 +90,12 @@ const diffDepTypesNmFixture = { } let result = '' -const LS = require('../../lib/ls.js') +const LS = t.mock('../../lib/ls.js', { + path: { + ...require('path'), + sep: '/', + }, +}) const config = { all: true, color: false, diff --git a/test/lib/publish.js b/test/lib/publish.js index 80f3f7ccc639e..e34f00b477ee1 100644 --- a/test/lib/publish.js +++ b/test/lib/publish.js @@ -617,3 +617,148 @@ t.test('workspaces', (t) => { }) t.end() }) + +t.test('private workspaces', (t) => { + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'workspaces-project', + version: '1.0.0', + workspaces: ['packages/*'], + }), + packages: { + a: { + 'package.json': JSON.stringify({ + name: '@npmcli/a', + version: '1.0.0', + private: true, + }), + }, + b: { + 'package.json': JSON.stringify({ + name: '@npmcli/b', + version: '1.0.0', + }), + }, + }, + }) + + const publishes = [] + const outputs = [] + t.beforeEach(() => { + npm.config.set('json', false) + outputs.length = 0 + publishes.length = 0 + }) + const mocks = { + '../../lib/utils/tar.js': { + getContents: (manifest) => ({ + id: manifest._id, + }), + logTar: () => {}, + }, + libnpmpublish: { + publish: (manifest, tarballData, opts) => { + if (manifest.private) { + throw Object.assign( + new Error('private pkg'), + { code: 'EPRIVATE' } + ) + } + publishes.push(manifest) + }, + }, + } + const npm = mockNpm({ + output: (o) => { + outputs.push(o) + }, + }) + npm.localPrefix = testDir + npm.config.getCredentialsByURI = (uri) => { + return { token: 'some.registry.token' } + } + + t.test('with color', t => { + const Publish = t.mock('../../lib/publish.js', { + ...mocks, + npmlog: { + notice () {}, + verbose () {}, + warn (title, msg) { + t.equal(title, 'publish', 'should use publish warn title') + t.match( + msg, + 'Skipping workspace \u001b[32m@npmcli/a\u001b[39m, marked as \u001b[1mprivate\u001b[22m', + 'should display skip private workspace warn msg' + ) + }, + }, + }) + const publish = new Publish(npm) + + npm.color = true + publish.execWorkspaces([], [], (err) => { + t.notOk(err) + t.matchSnapshot(publishes, 'should publish all non-private workspaces') + t.matchSnapshot(outputs, 'should output all publishes') + npm.color = false + t.end() + }) + }) + + t.test('colorless', t => { + const Publish = t.mock('../../lib/publish.js', { + ...mocks, + npmlog: { + notice () {}, + verbose () {}, + warn (title, msg) { + t.equal(title, 'publish', 'should use publish warn title') + t.equal( + msg, + 'Skipping workspace @npmcli/a, marked as private', + 'should display skip private workspace warn msg' + ) + }, + }, + }) + const publish = new Publish(npm) + + publish.execWorkspaces([], [], (err) => { + t.notOk(err) + t.matchSnapshot(publishes, 'should publish all non-private workspaces') + t.matchSnapshot(outputs, 'should output all publishes') + t.end() + }) + }) + + t.test('unexpected error', t => { + const Publish = t.mock('../../lib/publish.js', { + ...mocks, + libnpmpublish: { + publish: (manifest, tarballData, opts) => { + if (manifest.private) + throw new Error('ERR') + + publishes.push(manifest) + }, + }, + npmlog: { + notice () {}, + verbose () {}, + }, + }) + const publish = new Publish(npm) + + publish.execWorkspaces([], [], (err) => { + t.match( + err, + /ERR/, + 'should throw unexpected error' + ) + t.end() + }) + }) + + t.end() +}) diff --git a/test/lib/utils/reify-output.js b/test/lib/utils/reify-output.js index 2142566b90dea..3ffbdf86a2989 100644 --- a/test/lib/utils/reify-output.js +++ b/test/lib/utils/reify-output.js @@ -187,31 +187,154 @@ t.test('print appropriate message for many packages', (t) => { }) }) -t.test('no output when silent', t => { - npm.output = out => { - t.fail('should not get output when silent', { actual: out }) - } - t.teardown(() => log.level = 'warn') - log.level = 'silent' - reifyOutput(npm, { - actualTree: { inventory: { size: 999 }, children: [] }, - auditReport: { - toJSON: () => { - throw new Error('this should not get called') - }, - vulnerabilities: {}, - metadata: { - vulnerabilities: { - total: 99, - }, +t.test('showing and not showing audit report', async t => { + const auditReport = { + toJSON: () => auditReport, + auditReportVersion: 2, + vulnerabilities: { + minimist: { + name: 'minimist', + severity: 'low', + via: [ + { + id: 1179, + url: 'https://npmjs.com/advisories/1179', + title: 'Prototype Pollution', + severity: 'low', + vulnerable_versions: '<0.2.1 || >=1.0.0 <1.2.3', + }, + ], + effects: [], + range: '<0.2.1 || >=1.0.0 <1.2.3', + nodes: [ + 'node_modules/minimist', + ], + fixAvailable: true, }, }, - diff: { - children: [ - { action: 'ADD', ideal: { location: 'loc' } }, - ], + metadata: { + vulnerabilities: { + info: 0, + low: 1, + moderate: 0, + high: 0, + critical: 0, + total: 1, + }, + dependencies: { + prod: 1, + dev: 0, + optional: 0, + peer: 0, + peerOptional: 0, + total: 1, + }, }, + } + + t.test('no output when silent', t => { + npm.output = out => { + t.fail('should not get output when silent', { actual: out }) + } + t.teardown(() => log.level = 'warn') + log.level = 'silent' + reifyOutput(npm, { + actualTree: { inventory: { size: 999 }, children: [] }, + auditReport, + diff: { + children: [ + { action: 'ADD', ideal: { location: 'loc' } }, + ], + }, + }) + t.end() }) + + t.test('output when not silent', t => { + const OUT = [] + npm.output = out => { + OUT.push(out) + } + reifyOutput(npm, { + actualTree: { inventory: new Map(), children: [] }, + auditReport, + diff: { + children: [ + { action: 'ADD', ideal: { location: 'loc' } }, + ], + }, + }) + t.match(OUT.join('\n'), /Run `npm audit` for details\.$/, 'got audit report') + t.end() + }) + + for (const json of [true, false]) { + t.test(`json=${json}`, t => { + t.teardown(() => { + delete npm.flatOptions.json + }) + npm.flatOptions.json = json + t.test('set exit code when cmd is audit', t => { + npm.output = () => {} + const { exitCode } = process + const { command } = npm + npm.flatOptions.auditLevel = 'low' + t.teardown(() => { + delete npm.flatOptions.auditLevel + npm.command = command + // only set exitCode back if we're passing tests + if (t.passing()) + process.exitCode = exitCode + }) + + process.exitCode = 0 + npm.command = 'audit' + reifyOutput(npm, { + actualTree: { inventory: new Map(), children: [] }, + auditReport, + diff: { + children: [ + { action: 'ADD', ideal: { location: 'loc' } }, + ], + }, + }) + + t.equal(process.exitCode, 1, 'set exit code') + t.end() + }) + + t.test('do not set exit code when cmd is install', t => { + npm.output = () => {} + const { exitCode } = process + const { command } = npm + npm.flatOptions.auditLevel = 'low' + t.teardown(() => { + delete npm.flatOptions.auditLevel + npm.command = command + // only set exitCode back if we're passing tests + if (t.passing()) + process.exitCode = exitCode + }) + + process.exitCode = 0 + npm.command = 'install' + reifyOutput(npm, { + actualTree: { inventory: new Map(), children: [] }, + auditReport, + diff: { + children: [ + { action: 'ADD', ideal: { location: 'loc' } }, + ], + }, + }) + + t.equal(process.exitCode, 0, 'did not set exit code') + t.end() + }) + t.end() + }) + } + t.end() })