From d0b53c0557cece8cb97076a4c078094e16a9e743 Mon Sep 17 00:00:00 2001 From: "npm-cli+bot@github.com" Date: Wed, 11 May 2022 17:17:18 +0000 Subject: [PATCH] deps: upgrade npm to 8.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/43061 Reviewed-By: Ruy Adorno Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Mohammed Keyvanzadeh --- deps/npm/README.md | 1 + deps/npm/docs/content/commands/npm-bugs.md | 64 ++- deps/npm/docs/content/commands/npm-repo.md | 10 + deps/npm/docs/content/commands/npm-star.md | 14 + deps/npm/docs/content/using-npm/config.md | 14 + deps/npm/docs/output/commands/npm-bugs.html | 55 ++- deps/npm/docs/output/commands/npm-ls.html | 2 +- deps/npm/docs/output/commands/npm-repo.html | 10 +- deps/npm/docs/output/commands/npm-star.html | 13 +- deps/npm/docs/output/commands/npm.html | 2 +- deps/npm/docs/output/using-npm/config.html | 14 +- deps/npm/lib/commands/bugs.js | 31 +- deps/npm/lib/commands/completion.js | 18 +- deps/npm/lib/commands/docs.js | 45 +- deps/npm/lib/commands/repo.js | 45 +- deps/npm/lib/commands/search.js | 47 +- deps/npm/lib/commands/star.js | 27 +- deps/npm/lib/commands/unstar.js | 10 - deps/npm/lib/commands/view.js | 3 - deps/npm/lib/package-url-cmd.js | 61 +++ deps/npm/lib/search/package-filter.js | 43 -- deps/npm/lib/utils/config/definitions.js | 14 +- deps/npm/lib/utils/config/index.js | 1 + deps/npm/lib/utils/file-exists.js | 10 - deps/npm/lib/utils/format-bytes.js | 1 + .../format-search-stream.js} | 66 +-- .../utils/hosted-git-info-from-manifest.js | 14 - deps/npm/lib/utils/read-package-name.js | 9 - deps/npm/man/man1/npm-bugs.1 | 72 ++- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm-repo.1 | 10 + deps/npm/man/man1/npm-star.1 | 14 + deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man7/config.7 | 15 + .../arborist/lib/arborist/build-ideal-tree.js | 2 + .../arborist/lib/arborist/load-actual.js | 2 + .../arborist/lib/arborist/load-virtual.js | 1 + .../@npmcli/arborist/lib/arborist/rebuild.js | 117 +++-- .../@npmcli/arborist/lib/arborist/reify.js | 3 +- .../node_modules/@npmcli/arborist/lib/node.js | 12 + .../@npmcli/arborist/lib/override-resolves.js | 11 + .../@npmcli/arborist/lib/shrinkwrap.js | 31 +- .../@npmcli/arborist/package.json | 6 +- deps/npm/node_modules/builtins/index.js | 3 +- deps/npm/node_modules/builtins/package.json | 6 +- .../https-proxy-agent/dist/agent.js | 7 +- .../https-proxy-agent/dist/agent.js.map | 2 +- .../https-proxy-agent/package.json | 2 +- deps/npm/node_modules/ip/lib/ip.js | 201 ++++---- deps/npm/node_modules/ip/package.json | 16 +- deps/npm/node_modules/ip/test/api-test.js | 407 ---------------- .../npm/node_modules/is-core-module/core.json | 1 + .../node_modules/is-core-module/package.json | 20 +- .../node_modules/is-core-module/test/index.js | 65 +-- deps/npm/node_modules/just-diff/index.js | 11 +- deps/npm/node_modules/just-diff/package.json | 2 +- .../node_modules/libnpmaccess/package.json | 4 +- deps/npm/node_modules/libnpmdiff/package.json | 4 +- deps/npm/node_modules/libnpmexec/package.json | 4 +- deps/npm/node_modules/libnpmfund/package.json | 4 +- deps/npm/node_modules/libnpmhook/package.json | 4 +- deps/npm/node_modules/libnpmorg/package.json | 4 +- deps/npm/node_modules/libnpmpack/package.json | 4 +- .../node_modules/libnpmpublish/package.json | 4 +- .../node_modules/libnpmsearch/package.json | 4 +- deps/npm/node_modules/libnpmteam/package.json | 4 +- .../node_modules/libnpmversion/package.json | 4 +- deps/npm/node_modules/lru-cache/index.js | 52 +- deps/npm/node_modules/lru-cache/package.json | 3 +- .../make-fetch-happen/lib/index.js | 7 +- .../make-fetch-happen/package.json | 6 +- .../node_modules/npm-packlist/lib/index.js | 4 +- .../node_modules/npm-packlist/package.json | 6 +- .../socks-proxy-agent/dist/agent.d.ts | 22 - .../socks-proxy-agent/dist/agent.js | 181 ------- .../socks-proxy-agent/dist/agent.js.map | 1 - .../socks-proxy-agent/dist/index.d.ts | 46 +- .../socks-proxy-agent/dist/index.js | 199 +++++++- .../socks-proxy-agent/dist/index.js.map | 2 +- .../socks-proxy-agent/package.json | 187 +++++-- deps/npm/package.json | 17 +- .../test/lib/commands/config.js.test.cjs | 2 + .../test/lib/commands/search.js.test.cjs | 130 ++++- .../test/lib/commands/view.js.test.cjs | 386 +++++++-------- .../test/lib/load-all-commands.js.test.cjs | 8 +- .../lib/utils/config/definitions.js.test.cjs | 13 + .../lib/utils/config/describe-all.js.test.cjs | 13 + .../test/lib/utils/config/index.js.test.cjs | 3 + .../test/lib/utils/npm-usage.js.test.cjs | 8 +- deps/npm/test/coverage-map.js | 26 - .../fixtures/libnpmsearch-stream-result.js | 27 +- deps/npm/test/fixtures/mock-registry.js | 27 +- deps/npm/test/lib/commands/deprecate.js | 6 +- deps/npm/test/lib/commands/docs.js | 13 +- deps/npm/test/lib/commands/owner.js | 44 +- deps/npm/test/lib/commands/search.js | 302 +++++------- deps/npm/test/lib/commands/star.js | 154 ++---- deps/npm/test/lib/commands/unstar.js | 73 ++- deps/npm/test/lib/commands/view.js | 457 +++++++----------- deps/npm/test/lib/utils/config/definitions.js | 11 +- deps/npm/test/lib/utils/file-exists.js | 30 -- .../utils/hosted-git-info-from-manifest.js | 21 - 102 files changed, 2072 insertions(+), 2146 deletions(-) create mode 100644 deps/npm/lib/package-url-cmd.js delete mode 100644 deps/npm/lib/search/package-filter.js delete mode 100644 deps/npm/lib/utils/file-exists.js rename deps/npm/lib/{search/format-package-stream.js => utils/format-search-stream.js} (70%) delete mode 100644 deps/npm/lib/utils/hosted-git-info-from-manifest.js delete mode 100644 deps/npm/lib/utils/read-package-name.js create mode 100644 deps/npm/node_modules/@npmcli/arborist/lib/override-resolves.js delete mode 100644 deps/npm/node_modules/ip/test/api-test.js delete mode 100644 deps/npm/node_modules/socks-proxy-agent/dist/agent.d.ts delete mode 100644 deps/npm/node_modules/socks-proxy-agent/dist/agent.js delete mode 100644 deps/npm/node_modules/socks-proxy-agent/dist/agent.js.map delete mode 100644 deps/npm/test/coverage-map.js delete mode 100644 deps/npm/test/lib/utils/file-exists.js delete mode 100644 deps/npm/test/lib/utils/hosted-git-info-from-manifest.js diff --git a/deps/npm/README.md b/deps/npm/README.md index fdc80bc796a268..642e1a51ebc05f 100644 --- a/deps/npm/README.md +++ b/deps/npm/README.md @@ -37,6 +37,7 @@ If you're looking to manage multiple versions of **`node`** &/or **`npm`**, cons * [**`nodenv`**](https://github.com/nodenv/nodenv) * [**`asdf-nodejs`**](https://github.com/asdf-vm/asdf-nodejs) * [**`nvm-windows`**](https://github.com/coreybutler/nvm-windows) +* [**`fnm`**](https://github.com/Schniz/fnm) ### Usage diff --git a/deps/npm/docs/content/commands/npm-bugs.md b/deps/npm/docs/content/commands/npm-bugs.md index aeddeb848e81b8..6b45f1f18ac660 100644 --- a/deps/npm/docs/content/commands/npm-bugs.md +++ b/deps/npm/docs/content/commands/npm-bugs.md @@ -11,7 +11,7 @@ description: Report bugs for a package in a web browser ```bash -npm bugs [] +npm bugs [ [ ...]] alias: issues ``` @@ -58,6 +58,68 @@ The base URL of the npm registry. +#### `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 in selecting all + workspaces within that folder) + +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: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + + + + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + + + + ### See Also diff --git a/deps/npm/docs/content/commands/npm-repo.md b/deps/npm/docs/content/commands/npm-repo.md index 404c724ff02906..fc540a9382b235 100644 --- a/deps/npm/docs/content/commands/npm-repo.md +++ b/deps/npm/docs/content/commands/npm-repo.md @@ -46,6 +46,16 @@ Set to `true` to use default system URL opener. +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + + #### `workspace` * Default: diff --git a/deps/npm/docs/content/commands/npm-star.md b/deps/npm/docs/content/commands/npm-star.md index bbec7ac5f9263f..00ef17a816b4ae 100644 --- a/deps/npm/docs/content/commands/npm-star.md +++ b/deps/npm/docs/content/commands/npm-star.md @@ -69,6 +69,20 @@ false, it uses ascii characters instead of unicode glyphs. +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + + ### See Also diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index 4dc2829825d60d..a33e791bb836ba 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -68,6 +68,7 @@ The following shorthands are parsed on the command-line: * `--desc`: `--description` * `-f`: `--force` * `-g`: `--global` +* `--iwr`: `--include-workspace-root` * `-L`: `--location` * `-d`: `--loglevel info` * `-s`: `--loglevel silent` @@ -1177,6 +1178,19 @@ variable will be set to `'production'` for all lifecycle scripts. +#### `omit-lockfile-registry-resolved` + +* Default: false +* Type: Boolean + +This option causes npm to create lock files without a `resolved` key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time. + + + + #### `otp` * Default: null diff --git a/deps/npm/docs/output/commands/npm-bugs.html b/deps/npm/docs/output/commands/npm-bugs.html index 3b5bed07593a65..28fdc0c643885a 100644 --- a/deps/npm/docs/output/commands/npm-bugs.html +++ b/deps/npm/docs/output/commands/npm-bugs.html @@ -142,14 +142,14 @@

npm-bugs

Table of contents

- +

Synopsis

-
npm bugs [<pkgname>]
+
npm bugs [<pkgname> [<pkgname> ...]]
 
 alias: issues
 
@@ -184,6 +184,57 @@

registry

The base URL of the npm registry.

+

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 in selecting all +workspaces within that folder)
  • +
+

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: null
  • +
  • Type: null or Boolean
  • +
+

Set to true to run the command in the context of all configured +workspaces.

+

Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

+
    +
  • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
  • +
+

This value is not exported to the environment for child processes.

+ + +

include-workspace-root

+
    +
  • Default: false
  • +
  • Type: Boolean
  • +
+

Include the workspace root when workspaces are enabled for a command.

+

When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

+

This value is not exported to the environment for child processes.

+ +

See Also

    diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 4b44cbfbc3d570..579b54a3880811 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -166,7 +166,7 @@

    Description

    the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

    -
    npm@8.9.0 /path/to/npm
    +
    npm@8.10.0 /path/to/npm
     └─┬ init-package-json@0.0.4
       └── promzard@0.1.5
     
    diff --git a/deps/npm/docs/output/commands/npm-repo.html b/deps/npm/docs/output/commands/npm-repo.html index bd2ea8644bab05..24197ef0ea193c 100644 --- a/deps/npm/docs/output/commands/npm-repo.html +++ b/deps/npm/docs/output/commands/npm-repo.html @@ -142,7 +142,7 @@

    npm-repo

    Table of contents

    - +

    Synopsis

    @@ -174,6 +174,14 @@

    browser

    Set to true to use default system URL opener.

    +

    registry

    + +

    The base URL of the npm registry.

    + +

    workspace

    • Default:
    • diff --git a/deps/npm/docs/output/commands/npm-star.html b/deps/npm/docs/output/commands/npm-star.html index 42143bed974a3c..bc1f7ae76992dd 100644 --- a/deps/npm/docs/output/commands/npm-star.html +++ b/deps/npm/docs/output/commands/npm-star.html @@ -142,7 +142,7 @@

      npm-star

      Table of contents

      - +

      Synopsis

      @@ -188,6 +188,17 @@

      unicode

      false, it uses ascii characters instead of unicode glyphs.

      +

      otp

      +
        +
      • Default: null
      • +
      • Type: null or String
      • +
      +

      This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

      +

      If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

      + +

      See Also

        diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 947e5a7ee179ad..4a816cc1a9f398 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -149,7 +149,7 @@

        Table of contents

        Version

        -

        8.9.0

        +

        8.10.0

        Description

        npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index e1edc365007055..d00c7654e1be16 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -142,7 +142,7 @@

        config

        Table of contents

        -
        +

        Description

        @@ -196,6 +196,7 @@

        Shorthands and Other CLI Niceties

        --desc: --description
      • -f: --force
      • -g: --global
      • +
      • --iwr: --include-workspace-root
      • -L: --location
      • -d: --loglevel info
      • -s: --loglevel silent
      • @@ -1089,6 +1090,17 @@

        omit

        variable will be set to 'production' for all lifecycle scripts.

        +

        omit-lockfile-registry-resolved

        +
          +
        • Default: false
        • +
        • Type: Boolean
        • +
        +

        This option causes npm to create lock files without a resolved key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time.

        + +

        otp

        • Default: null
        • diff --git a/deps/npm/lib/commands/bugs.js b/deps/npm/lib/commands/bugs.js index f6218f033f3d3d..17cbd96649b871 100644 --- a/deps/npm/lib/commands/bugs.js +++ b/deps/npm/lib/commands/bugs.js @@ -1,33 +1,10 @@ -const pacote = require('pacote') -const log = require('../utils/log-shim') -const openUrl = require('../utils/open-url.js') -const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js') -const BaseCommand = require('../base-command.js') +const PackageUrlCmd = require('../package-url-cmd.js') -class Bugs extends BaseCommand { +class Bugs extends PackageUrlCmd { static description = 'Report bugs for a package in a web browser' static name = 'bugs' - static usage = ['[]'] - static params = ['browser', 'registry'] - static ignoreImplicitWorkspace = true - async exec (args) { - if (!args || !args.length) { - args = ['.'] - } - - await Promise.all(args.map(pkg => this.getBugs(pkg))) - } - - async getBugs (pkg) { - const opts = { ...this.npm.flatOptions, fullMetadata: true } - const mani = await pacote.manifest(pkg, opts) - const url = this.getBugsUrl(mani) - log.silly('bugs', 'url', url) - await openUrl(this.npm, url, `${mani.name} bug list available at the following URL`) - } - - getBugsUrl (mani) { + getUrl (spec, mani) { if (mani.bugs) { if (typeof mani.bugs === 'string') { return mani.bugs @@ -43,7 +20,7 @@ class Bugs extends BaseCommand { } // try to get it from the repo, if possible - const info = hostedFromMani(mani) + const info = this.hostedFromMani(mani) if (info) { return info.bugs() } diff --git a/deps/npm/lib/commands/completion.js b/deps/npm/lib/commands/completion.js index 5b7e0d355c63c8..c24fb050dcb34d 100644 --- a/deps/npm/lib/commands/completion.js +++ b/deps/npm/lib/commands/completion.js @@ -29,18 +29,26 @@ // as an array. // +const fs = require('@npmcli/fs') +const nopt = require('nopt') + const { definitions, shorthands } = require('../utils/config/index.js') const { aliases, cmdList, plumbing } = require('../utils/cmd-list.js') const aliasNames = Object.keys(aliases) const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c)) -const nopt = require('nopt') const configNames = Object.keys(definitions) const shorthandNames = Object.keys(shorthands) const allConfs = configNames.concat(shorthandNames) const { isWindowsShell } = require('../utils/is-windows.js') -const fileExists = require('../utils/file-exists.js') +const fileExists = async (file) => { + try { + const stat = await fs.stat(file) + return stat.isFile() + } catch { + return false + } +} -const { promisify } = require('util') const BaseCommand = require('../base-command.js') class Completion extends BaseCommand { @@ -189,12 +197,10 @@ class Completion extends BaseCommand { } const dumpScript = async () => { - const fs = require('fs') - const readFile = promisify(fs.readFile) const { resolve } = require('path') const p = resolve(__dirname, '..', 'utils', 'completion.sh') - const d = (await readFile(p, 'utf8')).replace(/^#!.*?\n/, '') + const d = (await fs.readFile(p, 'utf8')).replace(/^#!.*?\n/, '') await new Promise((res, rej) => { let done = false process.stdout.on('error', er => { diff --git a/deps/npm/lib/commands/docs.js b/deps/npm/lib/commands/docs.js index 631615acc56b3d..5d20215b56a07f 100644 --- a/deps/npm/lib/commands/docs.js +++ b/deps/npm/lib/commands/docs.js @@ -1,54 +1,19 @@ -const pacote = require('pacote') -const openUrl = require('../utils/open-url.js') -const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js') -const log = require('../utils/log-shim') -const BaseCommand = require('../base-command.js') -class Docs extends BaseCommand { +const PackageUrlCmd = require('../package-url-cmd.js') +class Docs extends PackageUrlCmd { static description = 'Open documentation for a package in a web browser' static name = 'docs' - static params = [ - 'browser', - 'registry', - 'workspace', - 'workspaces', - 'include-workspace-root', - ] - static usage = ['[ [ ...]]'] - static ignoreImplicitWorkspace = false - - async exec (args) { - if (!args || !args.length) { - args = ['.'] - } - - await Promise.all(args.map(pkg => this.getDocs(pkg))) - } - - async execWorkspaces (args, filters) { - await this.setWorkspaces(filters) - return this.exec(this.workspacePaths) - } - - async getDocs (pkg) { - const opts = { ...this.npm.flatOptions, fullMetadata: true } - const mani = await pacote.manifest(pkg, opts) - const url = this.getDocsUrl(mani) - log.silly('docs', 'url', url) - await openUrl(this.npm, url, `${mani.name} docs available at the following URL`) - } - - getDocsUrl (mani) { + getUrl (spec, mani) { if (mani.homepage) { return mani.homepage } - const info = hostedFromMani(mani) + const info = this.hostedFromMani(mani) if (info) { return info.docs() } - return 'https://www.npmjs.com/package/' + mani.name + return `https://www.npmjs.com/package/${mani.name}` } } module.exports = Docs diff --git a/deps/npm/lib/commands/repo.js b/deps/npm/lib/commands/repo.js index b8dccc209ff87a..b89b74c0bf1baa 100644 --- a/deps/npm/lib/commands/repo.js +++ b/deps/npm/lib/commands/repo.js @@ -1,40 +1,11 @@ -const pacote = require('pacote') const { URL } = require('url') -const log = require('../utils/log-shim') -const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js') -const openUrl = require('../utils/open-url.js') -const BaseCommand = require('../base-command.js') -class Repo extends BaseCommand { +const PackageUrlCmd = require('../package-url-cmd.js') +class Repo extends PackageUrlCmd { static description = 'Open package repository page in the browser' static name = 'repo' - static params = ['browser', 'workspace', 'workspaces', 'include-workspace-root'] - static usage = ['[ [ ...]]'] - static ignoreImplicitWorkspace = false - - async exec (args) { - if (!args || !args.length) { - args = ['.'] - } - - await Promise.all(args.map(pkg => this.get(pkg))) - } - - async execWorkspaces (args, filters) { - await this.setWorkspaces(filters) - return this.exec(this.workspacePaths) - } - - async get (pkg) { - // XXX It is very odd that `where` is how pacote knows to look anywhere - // other than the cwd. - const opts = { - ...this.npm.flatOptions, - where: this.npm.localPrefix, - fullMetadata: true, - } - const mani = await pacote.manifest(pkg, opts) + getUrl (spec, mani) { const r = mani.repository const rurl = !r ? null : typeof r === 'string' ? r @@ -43,22 +14,20 @@ class Repo extends BaseCommand { if (!rurl) { throw Object.assign(new Error('no repository'), { - pkgid: pkg, + pkgid: spec, }) } - const info = hostedFromMani(mani) + const info = this.hostedFromMani(mani) const url = info ? info.browse(mani.repository.directory) : unknownHostedUrl(rurl) if (!url) { throw Object.assign(new Error('no repository: could not get url'), { - pkgid: pkg, + pkgid: spec, }) } - - log.silly('docs', 'url', url) - await openUrl(this.npm, url, `${mani.name} repo available at the following URL`) + return url } } module.exports = Repo diff --git a/deps/npm/lib/commands/search.js b/deps/npm/lib/commands/search.js index a06ba4031443b4..8751e9e7d22fd0 100644 --- a/deps/npm/lib/commands/search.js +++ b/deps/npm/lib/commands/search.js @@ -3,26 +3,33 @@ const Pipeline = require('minipass-pipeline') const libSearch = require('libnpmsearch') const log = require('../utils/log-shim.js') -const formatPackageStream = require('../search/format-package-stream.js') -const packageFilter = require('../search/package-filter.js') +const formatSearchStream = require('../utils/format-search-stream.js') + +function filter (data, include, exclude) { + const words = [data.name] + .concat(data.maintainers.map(m => `=${m.username}`)) + .concat(data.keywords || []) + .map(f => f && f.trim && f.trim()) + .filter(f => f) + .join(' ') + .toLowerCase() + + if (exclude.find(e => match(words, e))) { + return false + } -function prepareIncludes (args) { - return args - .map(s => s.toLowerCase()) - .filter(s => s) + return true } -function prepareExcludes (searchexclude) { - var exclude - if (typeof searchexclude === 'string') { - exclude = searchexclude.split(/\s+/) - } else { - exclude = [] +function match (words, pattern) { + if (pattern.startsWith('/')) { + if (pattern.endsWith('/')) { + pattern = pattern.slice(0, -1) + } + pattern = new RegExp(pattern.slice(1)) + return words.match(pattern) } - - return exclude - .map(s => s.toLowerCase()) - .filter(s => s) + return words.indexOf(pattern) !== -1 } const BaseCommand = require('../base-command.js') @@ -50,8 +57,8 @@ class Search extends BaseCommand { const opts = { ...this.npm.flatOptions, ...this.npm.flatOptions.search, - include: prepareIncludes(args), - exclude: prepareExcludes(this.npm.flatOptions.search.exclude), + include: args.map(s => s.toLowerCase()).filter(s => s), + exclude: this.npm.flatOptions.search.exclude.split(/\s+/), } if (opts.include.length === 0) { @@ -63,7 +70,7 @@ class Search extends BaseCommand { class FilterStream extends Minipass { write (pkg) { - if (packageFilter(pkg, opts.include, opts.exclude)) { + if (filter(pkg, opts.include, opts.exclude)) { super.write(pkg) } } @@ -73,7 +80,7 @@ class Search extends BaseCommand { // Grab a configured output stream that will spit out packages in the // desired format. - const outputStream = formatPackageStream({ + const outputStream = formatSearchStream({ args, // --searchinclude options are not highlighted ...opts, }) diff --git a/deps/npm/lib/commands/star.js b/deps/npm/lib/commands/star.js index fb3882bcd1c56b..7b76be3c1632d5 100644 --- a/deps/npm/lib/commands/star.js +++ b/deps/npm/lib/commands/star.js @@ -11,6 +11,7 @@ class Star extends BaseCommand { static params = [ 'registry', 'unicode', + 'otp', ] static ignoreImplicitWorkspace = false @@ -23,26 +24,20 @@ class Star extends BaseCommand { // if we're unstarring, then show an empty star image // otherwise, show the full star image const unicode = this.npm.config.get('unicode') - const unstar = this.npm.config.get('star.unstar') const full = unicode ? '\u2605 ' : '(*)' const empty = unicode ? '\u2606 ' : '( )' - const show = unstar ? empty : full + const show = this.name === 'star' ? full : empty const pkgs = args.map(npa) - for (const pkg of pkgs) { - const [username, fullData] = await Promise.all([ - getIdentity(this.npm, { ...this.npm.flatOptions }), - fetch.json(pkg.escapedName, { - ...this.npm.flatOptions, - spec: pkg, - query: { write: true }, - preferOnline: true, - }), - ]) + const username = await getIdentity(this.npm, this.npm.flatOptions) - if (!username) { - throw new Error('You need to be logged in!') - } + for (const pkg of pkgs) { + const fullData = await fetch.json(pkg.escapedName, { + ...this.npm.flatOptions, + spec: pkg, + query: { write: true }, + preferOnline: true, + }) const body = { _id: fullData._id, @@ -50,7 +45,7 @@ class Star extends BaseCommand { users: fullData.users || {}, } - if (!unstar) { + if (this.name === 'star') { log.info('star', 'starring', body._id) body.users[username] = true log.verbose('star', 'starring', body) diff --git a/deps/npm/lib/commands/unstar.js b/deps/npm/lib/commands/unstar.js index 9a64c843178f35..cbcb73636c6384 100644 --- a/deps/npm/lib/commands/unstar.js +++ b/deps/npm/lib/commands/unstar.js @@ -3,15 +3,5 @@ const Star = require('./star.js') class Unstar extends Star { static description = 'Remove an item from your favorite packages' static name = 'unstar' - static params = [ - 'registry', - 'unicode', - 'otp', - ] - - async exec (args) { - this.npm.config.set('star.unstar', true) - return super.exec(args) - } } module.exports = Unstar diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js index 403d09d813dc7e..d78ee77dc0a3db 100644 --- a/deps/npm/lib/commands/view.js +++ b/deps/npm/lib/commands/view.js @@ -57,9 +57,6 @@ class View extends BaseCommand { function getFields (d, f, pref) { f = f || [] - if (!d) { - return f - } pref = pref || [] Object.keys(d).forEach((k) => { if (k.charAt(0) === '_' || k.indexOf('.') !== -1) { diff --git a/deps/npm/lib/package-url-cmd.js b/deps/npm/lib/package-url-cmd.js new file mode 100644 index 00000000000000..b897272149d027 --- /dev/null +++ b/deps/npm/lib/package-url-cmd.js @@ -0,0 +1,61 @@ +// Base command for opening urls from a package manifest (bugs, docs, repo) + +const pacote = require('pacote') +const hostedGitInfo = require('hosted-git-info') + +const openUrl = require('./utils/open-url.js') +const log = require('./utils/log-shim') + +const BaseCommand = require('./base-command.js') +class PackageUrlCommand extends BaseCommand { + static ignoreImplicitWorkspace = false + static params = [ + 'browser', + 'registry', + 'workspace', + 'workspaces', + 'include-workspace-root', + ] + + static usage = ['[ [ ...]]'] + + async exec (args) { + if (!args || !args.length) { + args = ['.'] + } + + for (const arg of args) { + // XXX It is very odd that `where` is how pacote knows to look anywhere + // other than the cwd. + const opts = { + ...this.npm.flatOptions, + where: this.npm.localPrefix, + fullMetadata: true, + } + const mani = await pacote.manifest(arg, opts) + const url = this.getUrl(arg, mani) + log.silly(this.name, 'url', url) + await openUrl(this.npm, url, `${mani.name} ${this.name} available at the following URL`) + } + } + + async execWorkspaces (args, filters) { + await this.setWorkspaces(filters) + return this.exec(this.workspacePaths) + } + + // given a manifest, try to get the hosted git info from it based on + // repository (if a string) or repository.url (if an object) returns null + // if it's not a valid repo, or not a known hosted repo + hostedFromMani (mani) { + const r = mani.repository + const rurl = !r ? null + : typeof r === 'string' ? r + : typeof r === 'object' && typeof r.url === 'string' ? r.url + : null + + // hgi returns undefined sometimes, but let's always return null here + return (rurl && hostedGitInfo.fromUrl(rurl.replace(/^git\+/, ''))) || null + } +} +module.exports = PackageUrlCommand diff --git a/deps/npm/lib/search/package-filter.js b/deps/npm/lib/search/package-filter.js deleted file mode 100644 index bb0ae679bdccd9..00000000000000 --- a/deps/npm/lib/search/package-filter.js +++ /dev/null @@ -1,43 +0,0 @@ -module.exports = filter -function filter (data, include, exclude, opts) { - return typeof data === 'object' && - filterWords(data, include, exclude, opts) -} - -function getWords (data, opts) { - return [data.name] - .concat((opts && opts.description) ? data.description : []) - .concat((data.maintainers || []).map(m => `=${m.name}`)) - .concat(data.versions && data.versions.length && data.url && ('<' + data.url + '>')) - .concat(data.keywords || []) - .map(f => f && f.trim && f.trim()) - .filter(f => f) - .join(' ') - .toLowerCase() -} - -function filterWords (data, include, exclude, opts) { - var words = getWords(data, opts) - for (var i = 0, l = include.length; i < l; i++) { - if (!match(words, include[i])) { - return false - } - } - - for (i = 0, l = exclude.length; i < l; i++) { - if (match(words, exclude[i])) { - return false - } - } - - return true -} - -function match (words, pattern) { - if (pattern.charAt(0) === '/') { - pattern = pattern.replace(/\/$/, '') - pattern = new RegExp(pattern.slice(1)) - return words.match(pattern) - } - return words.indexOf(pattern) !== -1 -} diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index 6f1b1a7244a504..c4be3a6584cc16 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -1385,6 +1385,18 @@ define('omit', { }, }) +define('omit-lockfile-registry-resolved', { + default: false, + type: Boolean, + description: ` + This option causes npm to create lock files without a \`resolved\` key for + registry dependencies. Subsequent installs will need to resolve tarball + endpoints with the configured registry, likely resulting in a longer install + time. + `, + flatten, +}) + define('only', { default: null, type: [null, 'prod', 'production'], @@ -1856,7 +1868,7 @@ define('searchexclude', { `, flatten (key, obj, flatOptions) { flatOptions.search = flatOptions.search || { limit: 20 } - flatOptions.search.exclude = obj[key] + flatOptions.search.exclude = obj[key].toLowerCase() }, }) diff --git a/deps/npm/lib/utils/config/index.js b/deps/npm/lib/utils/config/index.js index d8706d50c612d9..b0ad24d7ee12f8 100644 --- a/deps/npm/lib/utils/config/index.js +++ b/deps/npm/lib/utils/config/index.js @@ -25,6 +25,7 @@ const shorthands = { porcelain: ['--parseable'], readonly: ['--read-only'], reg: ['--registry'], + iwr: ['--include-workspace-root'], } for (const [key, { short }] of Object.entries(definitions)) { diff --git a/deps/npm/lib/utils/file-exists.js b/deps/npm/lib/utils/file-exists.js deleted file mode 100644 index 605472536aab01..00000000000000 --- a/deps/npm/lib/utils/file-exists.js +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs') -const util = require('util') - -const stat = util.promisify(fs.stat) - -const fileExists = (file) => stat(file) - .then((stat) => stat.isFile()) - .catch(() => false) - -module.exports = fileExists diff --git a/deps/npm/lib/utils/format-bytes.js b/deps/npm/lib/utils/format-bytes.js index d7cf6d144e3394..d293001df5524e 100644 --- a/deps/npm/lib/utils/format-bytes.js +++ b/deps/npm/lib/utils/format-bytes.js @@ -23,6 +23,7 @@ const formatBytes = (bytes, space = true) => { return `${(bytes / 1000000).toFixed(1)}${spacer}MB` } + // GB return `${(bytes / 1000000000).toFixed(1)}${spacer}GB` } diff --git a/deps/npm/lib/search/format-package-stream.js b/deps/npm/lib/utils/format-search-stream.js similarity index 70% rename from deps/npm/lib/search/format-package-stream.js rename to deps/npm/lib/utils/format-search-stream.js index acead79e1a7706..2a2dadd5c34342 100644 --- a/deps/npm/lib/search/format-package-stream.js +++ b/deps/npm/lib/utils/format-search-stream.js @@ -1,6 +1,3 @@ -// XXX these output classes should not live in here forever. it'd be good to -// split them out, perhaps to libnpmsearch - const Minipass = require('minipass') const columnify = require('columnify') @@ -18,32 +15,26 @@ const columnify = require('columnify') // The returned stream will format this package data // into a byte stream of formatted, displayable output. -module.exports = (opts = {}) => - opts.json ? new JSONOutputStream() : new TextOutputStream(opts) +module.exports = (opts) => { + return opts.json ? new JSONOutputStream() : new TextOutputStream(opts) +} class JSONOutputStream extends Minipass { - constructor () { - super() - this._didFirst = false - } + #didFirst = false write (obj) { - if (!this._didFirst) { + if (!this.#didFirst) { super.write('[\n') - this._didFirst = true + this.#didFirst = true } else { super.write('\n,\n') } - try { - return super.write(JSON.stringify(obj)) - } catch (er) { - return this.emit('error', er) - } + return super.write(JSON.stringify(obj)) } end () { - super.write(this._didFirst ? ']\n' : '\n[]\n') + super.write(this.#didFirst ? ']\n' : '\n[]\n') super.end() } } @@ -61,14 +52,11 @@ class TextOutputStream extends Minipass { } function prettify (data, num, opts) { - opts = opts || {} var truncate = !opts.long var pkg = normalizePackage(data, opts) - var columns = opts.description - ? ['name', 'description', 'author', 'date', 'version', 'keywords'] - : ['name', 'author', 'date', 'version', 'keywords'] + var columns = ['name', 'description', 'author', 'date', 'version', 'keywords'] if (opts.parseable) { return columns.map(function (col) { @@ -76,7 +64,10 @@ function prettify (data, num, opts) { }).join('\t') } - var output = columnify( + // stdout in tap is never a tty + /* istanbul ignore next */ + const maxWidth = process.stdout.isTTY ? process.stdout.getWindowSize()[0] : Infinity + let output = columnify( [pkg], { include: columns, @@ -92,8 +83,8 @@ function prettify (data, num, opts) { keywords: { maxWidth: Infinity }, }, } - ) - output = trimToMaxWidth(output) + ).split('\n').map(line => line.slice(0, maxWidth)).join('\n') + if (opts.color) { output = highlightSearchTerms(output, opts.args) } @@ -140,26 +131,6 @@ function colorize (line) { return line.split('\u0000').join(uncolor) } -function getMaxWidth () { - var cols - try { - var tty = require('tty') - var stdout = process.stdout - cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0] - cols = (cols === 0) ? Infinity : cols - } catch (ex) { - cols = Infinity - } - return cols -} - -function trimToMaxWidth (str) { - var maxWidth = getMaxWidth() - return str.split('\n').map(function (line) { - return line.slice(0, maxWidth) - }).join('\n') -} - function highlightSearchTerms (str, terms) { terms.forEach(function (arg, i) { str = addColorMarker(str, arg, i) @@ -169,13 +140,10 @@ function highlightSearchTerms (str, terms) { } function normalizePackage (data, opts) { - opts = opts || {} return { name: data.name, - description: opts.description ? data.description : '', - author: (data.maintainers || []).map(function (m) { - return '=' + m.username - }).join(' '), + description: data.description, + author: data.maintainers.map((m) => `=${m.username}`).join(' '), keywords: Array.isArray(data.keywords) ? data.keywords.join(' ') : typeof data.keywords === 'string' diff --git a/deps/npm/lib/utils/hosted-git-info-from-manifest.js b/deps/npm/lib/utils/hosted-git-info-from-manifest.js deleted file mode 100644 index 9592b0b3a937b8..00000000000000 --- a/deps/npm/lib/utils/hosted-git-info-from-manifest.js +++ /dev/null @@ -1,14 +0,0 @@ -// given a manifest, try to get the hosted git info from it based on -// repository (if a string) or repository.url (if an object) -// returns null if it's not a valid repo, or not a known hosted repo -const hostedGitInfo = require('hosted-git-info') -module.exports = mani => { - const r = mani.repository - const rurl = !r ? null - : typeof r === 'string' ? r - : typeof r === 'object' && typeof r.url === 'string' ? r.url - : null - - // hgi returns undefined sometimes, but let's always return null here - return (rurl && hostedGitInfo.fromUrl(rurl.replace(/^git\+/, ''))) || null -} diff --git a/deps/npm/lib/utils/read-package-name.js b/deps/npm/lib/utils/read-package-name.js deleted file mode 100644 index 7ed15987767bb4..00000000000000 --- a/deps/npm/lib/utils/read-package-name.js +++ /dev/null @@ -1,9 +0,0 @@ -const { resolve } = require('path') -const readJson = require('read-package-json-fast') -async function readLocalPackageName (prefix) { - const filepath = resolve(prefix, 'package.json') - const json = await readJson(filepath) - return json.name -} - -module.exports = readLocalPackageName diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index f56c459c6d73e1..1c1ec8a08e28c1 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -5,7 +5,7 @@ .P .RS 2 .nf -npm bugs [] +npm bugs [ [ \.\.\.]] alias: issues .fi @@ -42,6 +42,76 @@ Type: URL .RE .P The base URL of the npm registry\. +.SS \fBworkspace\fP +.RS 0 +.IP \(bu 2 +Default: +.IP \(bu 2 +Type: String (can be set multiple times) + +.RE +.P +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\. +.P +Valid values for the \fBworkspace\fP config are either: +.RS 0 +.IP \(bu 2 +Workspace names +.IP \(bu 2 +Path to a workspace directory +.IP \(bu 2 +Path to a parent workspace directory (will result in selecting all +workspaces within that folder) + +.RE +.P +When set for the \fBnpm init\fP 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\. +.P +This value is not exported to the environment for child processes\. +.SS \fBworkspaces\fP +.RS 0 +.IP \(bu 2 +Default: null +.IP \(bu 2 +Type: null or Boolean + +.RE +.P +Set to true to run the command in the context of \fBall\fR configured +workspaces\. +.P +Explicitly setting this to false will cause commands like \fBinstall\fP to +ignore workspaces altogether\. When not set explicitly: +.RS 0 +.IP \(bu 2 +Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.) +will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do +other things (test, exec, publish, etc\.) will operate on the root project, +\fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\. + +.RE +.P +This value is not exported to the environment for child processes\. +.SS \fBinclude\-workspace\-root\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Include the workspace root when workspaces are enabled for a command\. +.P +When false, specifying individual workspaces via the \fBworkspace\fP config, or +all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on +the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index df207311c04553..42f9baf9652feb 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@8\.9\.0 /path/to/npm +npm@8\.10\.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 7fd6c738c9f7a0..7b9993a2fd7b60 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -30,6 +30,16 @@ Set to \fBfalse\fP to suppress browser behavior and instead print urls to terminal\. .P Set to \fBtrue\fP to use default system URL opener\. +.SS \fBregistry\fP +.RS 0 +.IP \(bu 2 +Default: "https://registry\.npmjs\.org/" +.IP \(bu 2 +Type: URL + +.RE +.P +The base URL of the npm registry\. .SS \fBworkspace\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 6075139da7cbb2..57f9c5d361f8ec 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -50,6 +50,20 @@ Type: Boolean .P When set to true, npm uses unicode characters in the tree output\. When false, it uses ascii characters instead of unicode glyphs\. +.SS \fBotp\fP +.RS 0 +.IP \(bu 2 +Default: null +.IP \(bu 2 +Type: null or String + +.RE +.P +This is a one\-time password from a two\-factor authenticator\. It's needed +when publishing or changing package permissions with \fBnpm access\fP\|\. +.P +If not set, and a registry response fails with a challenge for a one\-time +password, npm will prompt on the command line for one\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index cbfc8e8ec6a572..c5404972523068 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -4,7 +4,7 @@ .SS Synopsis .SS Version .P -8\.9\.0 +8\.10\.0 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index eee1ac6c5f2fe1..f727a19f25d358 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -70,6 +70,8 @@ The following shorthands are parsed on the command\-line: .IP \(bu 2 \fB\-g\fP: \fB\-\-global\fP .IP \(bu 2 +\fB\-\-iwr\fP: \fB\-\-include\-workspace\-root\fP +.IP \(bu 2 \fB\-L\fP: \fB\-\-location\fP .IP \(bu 2 \fB\-d\fP: \fB\-\-loglevel info\fP @@ -1238,6 +1240,19 @@ it will be included\. .P If the resulting omit list includes \fB\|'dev'\fP, then the \fBNODE_ENV\fP environment variable will be set to \fB\|'production'\fP for all lifecycle scripts\. +.SS \fBomit\-lockfile\-registry\-resolved\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +This option causes npm to create lock files without a \fBresolved\fP key for +registry dependencies\. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time\. .SS \fBotp\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index 55eb8292335d00..e6c9fe68fab97d 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -329,6 +329,7 @@ Try using the package name instead, e.g: ? Shrinkwrap.reset({ path: this.path, lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, }).then(meta => Object.assign(root, { meta })) : this.loadVirtual({ root })) @@ -388,6 +389,7 @@ Try using the package name instead, e.g: const meta = new Shrinkwrap({ path: this.path, lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, }) meta.reset() root.meta = meta diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js index 70b898141cc54c..43351b69034af8 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js @@ -147,6 +147,7 @@ module.exports = cls => class ActualLoader extends cls { const meta = await Shrinkwrap.load({ path: this[_actualTree].path, hiddenLockfile: true, + resolveOptions: this.options, }) if (meta.loadedFromDisk) { this[_actualTree].meta = meta @@ -155,6 +156,7 @@ module.exports = cls => class ActualLoader extends cls { const meta = await Shrinkwrap.load({ path: this[_actualTree].path, lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, }) this[_actualTree].meta = meta return this[_loadActualActually]({ root, ignoreMissing }) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js index 097e5fb84298ed..fb3f334747fc8a 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js @@ -57,6 +57,7 @@ module.exports = cls => class VirtualLoader extends cls { const s = await Shrinkwrap.load({ path: this.path, lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, }) if (!s.loadedFromDisk && !options.root) { const er = new Error('loadVirtual requires existing shrinkwrap file') diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js index 8b47904004a967..e9b79031ef427b 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -21,6 +21,8 @@ const sortNodes = (a, b) => const _workspaces = Symbol.for('workspaces') const _build = Symbol('build') +const _loadDefaultNodes = Symbol('loadDefaultNodes') +const _retrieveNodesByType = Symbol('retrieveNodesByType') const _resetQueues = Symbol('resetQueues') const _rebuildBundle = Symbol('rebuildBundle') const _ignoreScripts = Symbol('ignoreScripts') @@ -39,6 +41,7 @@ const _includeWorkspaceRoot = Symbol.for('includeWorkspaceRoot') const _workspacesEnabled = Symbol.for('workspacesEnabled') const _force = Symbol.for('force') +const _global = Symbol.for('global') // defined by reify mixin const _handleOptionalFailure = Symbol.for('handleOptionalFailure') @@ -75,36 +78,60 @@ module.exports = cls => class Builder extends cls { // running JUST a rebuild, we treat optional failures as real fails this[_doHandleOptionalFailure] = handleOptionalFailure - // if we don't have a set of nodes, then just rebuild - // the actual tree on disk. if (!nodes) { - const tree = await this.loadActual() - let filterSet - if (!this[_workspacesEnabled]) { - filterSet = this.excludeWorkspacesDependencySet(tree) - nodes = tree.inventory.filter(node => - filterSet.has(node) || node.isProjectRoot - ) - } else if (this[_workspaces] && this[_workspaces].length) { - filterSet = this.workspaceDependencySet( - tree, - this[_workspaces], - this[_includeWorkspaceRoot] - ) - nodes = tree.inventory.filter(node => filterSet.has(node)) - } else { - nodes = tree.inventory.values() - } + nodes = await this[_loadDefaultNodes]() } // separates links nodes so that it can run // prepare scripts and link bins in the expected order process.emit('time', 'build') + + const { + depNodes, + linkNodes, + } = this[_retrieveNodesByType](nodes) + + // build regular deps + await this[_build](depNodes, {}) + + // build link deps + if (linkNodes.size) { + this[_resetQueues]() + await this[_build](linkNodes, { type: 'links' }) + } + + process.emit('timeEnd', 'build') + } + + // if we don't have a set of nodes, then just rebuild + // the actual tree on disk. + async [_loadDefaultNodes] () { + let nodes + const tree = await this.loadActual() + let filterSet + if (!this[_workspacesEnabled]) { + filterSet = this.excludeWorkspacesDependencySet(tree) + nodes = tree.inventory.filter(node => + filterSet.has(node) || node.isProjectRoot + ) + } else if (this[_workspaces] && this[_workspaces].length) { + filterSet = this.workspaceDependencySet( + tree, + this[_workspaces], + this[_includeWorkspaceRoot] + ) + nodes = tree.inventory.filter(node => filterSet.has(node)) + } else { + nodes = tree.inventory.values() + } + return nodes + } + + [_retrieveNodesByType] (nodes) { const depNodes = new Set() const linkNodes = new Set() + for (const node of nodes) { - // we skip the target nodes to that workspace in order to make sure - // we only run lifecycle scripts / place bin links once per workspace if (node.isLink) { linkNodes.add(node) } else { @@ -112,14 +139,22 @@ module.exports = cls => class Builder extends cls { } } - await this[_build](depNodes, {}) - - if (linkNodes.size) { - this[_resetQueues]() - await this[_build](linkNodes, { type: 'links' }) + // deduplicates link nodes and their targets, avoids + // calling lifecycle scripts twice when running `npm rebuild` + // ref: https://github.com/npm/cli/issues/2905 + // + // we avoid doing so if global=true since `bin-links` relies + // on having the target nodes available in global mode. + if (!this[_global]) { + for (const node of linkNodes) { + depNodes.delete(node.target) + } } - process.emit('timeEnd', 'build') + return { + depNodes, + linkNodes, + } } [_resetQueues] () { @@ -136,24 +171,22 @@ module.exports = cls => class Builder extends cls { process.emit('time', `build:${type}`) await this[_buildQueues](nodes) + + if (!this[_ignoreScripts]) { + await this[_runScripts]('preinstall') + } + // links should run prepare scripts and only link bins after that - if (type !== 'links') { - if (!this[_ignoreScripts]) { - await this[_runScripts]('preinstall') - } - if (this[_binLinks]) { - await this[_linkAllBins]() - } - if (!this[_ignoreScripts]) { - await this[_runScripts]('install') - await this[_runScripts]('postinstall') - } - } else { + if (type === 'links') { await this[_runScripts]('prepare') + } + if (this[_binLinks]) { + await this[_linkAllBins]() + } - if (this[_binLinks]) { - await this[_linkAllBins]() - } + if (!this[_ignoreScripts]) { + await this[_runScripts]('install') + await this[_runScripts]('postinstall') } process.emit('timeEnd', `build:${type}`) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js index 7fd0ca7f607403..4932c17d03667b 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -1105,7 +1105,8 @@ module.exports = cls => class Reifier extends cls { // skip links that only live within node_modules as they are most // likely managed by packages we installed, we only want to rebuild // unchanged links we directly manage - if (node.isLink && node.target.fsTop === tree) { + const linkedFromRoot = node.parent === tree || node.target.fsTop === tree + if (node.isLink && linkedFromRoot) { nodes.push(node) } } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js index 60301798b918d4..d731e5f617908a 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js @@ -524,6 +524,18 @@ class Node { return this === this.root || this === this.root.target } + get isRegistryDependency () { + if (this.edgesIn.size === 0) { + return false + } + for (const edge of this.edgesIn) { + if (!npa(edge.spec).registry) { + return false + } + } + return true + } + * ancestry () { for (let anc = this; anc; anc = anc.resolveParent) { yield anc diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/override-resolves.js b/deps/npm/node_modules/@npmcli/arborist/lib/override-resolves.js new file mode 100644 index 00000000000000..794b2c335dc628 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/arborist/lib/override-resolves.js @@ -0,0 +1,11 @@ +function overrideResolves (resolved, opts = {}) { + const { omitLockfileRegistryResolved = false } = opts + + if (omitLockfileRegistryResolved) { + return undefined + } + + return resolved +} + +module.exports = { overrideResolves } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index ab6c91935c78ec..3305bac4914be5 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -95,6 +95,7 @@ const specFromResolved = resolved => { const relpath = require('./relpath.js') const consistentResolve = require('./consistent-resolve.js') +const { overrideResolves } = require('./override-resolves.js') const maybeReadFile = file => { return readFile(file, 'utf8').then(d => d, er => { @@ -265,7 +266,7 @@ class Shrinkwrap { return s } - static metaFromNode (node, path) { + static metaFromNode (node, path, options = {}) { if (node.isLink) { return { resolved: relpath(path, node.realpath), @@ -299,7 +300,12 @@ class Shrinkwrap { }) const resolved = consistentResolve(node.resolved, node.path, path, true) - if (resolved) { + // hide resolved from registry dependencies. + if (!resolved) { + // no-op + } else if (node.isRegistryDependency) { + meta.resolved = overrideResolves(resolved, options) + } else { meta.resolved = resolved } @@ -330,6 +336,7 @@ class Shrinkwrap { shrinkwrapOnly = false, hiddenLockfile = false, lockfileVersion, + resolveOptions = {}, } = options this.lockfileVersion = hiddenLockfile ? 3 @@ -347,6 +354,7 @@ class Shrinkwrap { this.yarnLock = null this.hiddenLockfile = hiddenLockfile this.loadingError = null + this.resolveOptions = resolveOptions // only load npm-shrinkwrap.json in dep trees, not package-lock this.shrinkwrapOnly = shrinkwrapOnly } @@ -830,7 +838,7 @@ class Shrinkwrap { resolved, integrity, hasShrinkwrap, - } = Shrinkwrap.metaFromNode(node, this.path) + } = Shrinkwrap.metaFromNode(node, this.path, this.resolveOptions) node.resolved = node.resolved || resolved || null node.integrity = node.integrity || integrity || null node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false @@ -886,7 +894,10 @@ class Shrinkwrap { [_updateWaitingNode] (loc) { const node = this[_awaitingUpdate].get(loc) this[_awaitingUpdate].delete(loc) - this.data.packages[loc] = Shrinkwrap.metaFromNode(node, this.path) + this.data.packages[loc] = Shrinkwrap.metaFromNode( + node, + this.path, + this.resolveOptions) } commit () { @@ -894,7 +905,10 @@ class Shrinkwrap { if (this.yarnLock) { this.yarnLock.fromTree(this.tree) } - const root = Shrinkwrap.metaFromNode(this.tree.target, this.path) + const root = Shrinkwrap.metaFromNode( + this.tree.target, + this.path, + this.resolveOptions) this.data.packages = {} if (Object.keys(root).length) { this.data.packages[''] = root @@ -905,7 +919,10 @@ class Shrinkwrap { continue } const loc = relpath(this.path, node.path) - this.data.packages[loc] = Shrinkwrap.metaFromNode(node, this.path) + this.data.packages[loc] = Shrinkwrap.metaFromNode( + node, + this.path, + this.resolveOptions) } } else if (this[_awaitingUpdate].size > 0) { for (const loc of this[_awaitingUpdate].keys()) { @@ -1013,7 +1030,7 @@ class Shrinkwrap { spec.type !== 'git' && spec.type !== 'file' && spec.type !== 'remote') { - lock.resolved = node.resolved + lock.resolved = overrideResolves(node.resolved, this.resolveOptions) } if (node.integrity) { diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index bf3031fd066d5f..e6d2d9613c206f 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "5.1.1", + "version": "5.2.0", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", @@ -40,7 +40,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "benchmark": "^2.1.4", "chalk": "^4.1.0", "minify-registry-metadata": "^2.1.0", @@ -101,6 +101,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/builtins/index.js b/deps/npm/node_modules/builtins/index.js index 3c781da7354192..b715278437cbcf 100644 --- a/deps/npm/node_modules/builtins/index.js +++ b/deps/npm/node_modules/builtins/index.js @@ -46,7 +46,8 @@ const versionLockedModules = { http2: '>=8.4.0', perf_hooks: '>=8.5.0', trace_events: '>=10.0.0', - worker_threads: '>=12.0.0' + worker_threads: '>=12.0.0', + 'node:test': '>=18.0.0' } const experimentalModules = { diff --git a/deps/npm/node_modules/builtins/package.json b/deps/npm/node_modules/builtins/package.json index 9c6c108d3ff5e7..1c43660c7483fe 100644 --- a/deps/npm/node_modules/builtins/package.json +++ b/deps/npm/node_modules/builtins/package.json @@ -1,19 +1,19 @@ { "name": "builtins", - "version": "5.0.0", + "version": "5.0.1", "description": "List of node.js builtin modules", "repository": "juliangruber/builtins", "license": "MIT", "main": "index.js", "files": [], "scripts": { - "test": "prettier-standard && standard && node test.js" + "test": "prettier-standard && standard && node-core-test" }, "dependencies": { "semver": "^7.0.0" }, "devDependencies": { - "node-core-test": "^1.1.1", + "node-core-test": "^1.4.0", "prettier-standard": "^15.0.1", "standard": "^14.3.4" } diff --git a/deps/npm/node_modules/https-proxy-agent/dist/agent.js b/deps/npm/node_modules/https-proxy-agent/dist/agent.js index d6665259f91f17..75d11364ed3001 100644 --- a/deps/npm/node_modules/https-proxy-agent/dist/agent.js +++ b/deps/npm/node_modules/https-proxy-agent/dist/agent.js @@ -118,13 +118,10 @@ class HttpsProxyAgent extends agent_base_1.Agent { if (statusCode === 200) { req.once('socket', resume); if (opts.secureEndpoint) { - const servername = opts.servername || opts.host; - if (!servername) { - throw new Error('Could not determine "servername"'); - } // The proxy is connecting to a TLS server, so upgrade // this socket connection to a TLS connection. debug('Upgrading socket connection to TLS'); + const servername = opts.servername || opts.host; return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, servername })); } @@ -141,7 +138,7 @@ class HttpsProxyAgent extends agent_base_1.Agent { // // See: https://hackerone.com/reports/541502 socket.destroy(); - const fakeSocket = new net_1.default.Socket(); + const fakeSocket = new net_1.default.Socket({ writable: false }); fakeSocket.readable = true; // Need to wait for the "socket" event to re-play the "data" events. req.once('socket', (s) => { diff --git a/deps/npm/node_modules/https-proxy-agent/dist/agent.js.map b/deps/npm/node_modules/https-proxy-agent/dist/agent.js.map index d1307cdd8afae6..0af6c17a3e78a3 100644 --- a/deps/npm/node_modules/https-proxy-agent/dist/agent.js.map +++ b/deps/npm/node_modules/https-proxy-agent/dist/agent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CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/deps/npm/node_modules/https-proxy-agent/package.json b/deps/npm/node_modules/https-proxy-agent/package.json index 7872bdf902abf8..fb2aba1b946951 100644 --- a/deps/npm/node_modules/https-proxy-agent/package.json +++ b/deps/npm/node_modules/https-proxy-agent/package.json @@ -1,6 +1,6 @@ { "name": "https-proxy-agent", - "version": "5.0.0", + "version": "5.0.1", "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", "main": "dist/index", "types": "dist/index", diff --git a/deps/npm/node_modules/ip/lib/ip.js b/deps/npm/node_modules/ip/lib/ip.js index c1799a8c50f427..5b5ccc246a4ab6 100644 --- a/deps/npm/node_modules/ip/lib/ip.js +++ b/deps/npm/node_modules/ip/lib/ip.js @@ -1,17 +1,15 @@ -'use strict'; - var ip = exports; -var Buffer = require('buffer').Buffer; +var { Buffer } = require('buffer'); var os = require('os'); -ip.toBuffer = function(ip, buff, offset) { +ip.toBuffer = function (ip, buff, offset) { offset = ~~offset; var result; if (this.isV4Format(ip)) { result = buff || new Buffer(offset + 4); - ip.split(/\./g).map(function(byte) { + ip.split(/\./g).map((byte) => { result[offset++] = parseInt(byte, 10) & 0xff; }); } else if (this.isV6Format(ip)) { @@ -38,7 +36,7 @@ ip.toBuffer = function(ip, buff, offset) { while (sections.length < 8) sections.push('0'); } else if (sections.length < 8) { for (i = 0; i < sections.length && sections[i] !== ''; i++); - var argv = [ i, 1 ]; + var argv = [i, 1]; for (i = 9 - sections.length; i > 0; i--) { argv.push('0'); } @@ -54,26 +52,27 @@ ip.toBuffer = function(ip, buff, offset) { } if (!result) { - throw Error('Invalid ip address: ' + ip); + throw Error(`Invalid ip address: ${ip}`); } return result; }; -ip.toString = function(buff, offset, length) { +ip.toString = function (buff, offset, length) { offset = ~~offset; length = length || (buff.length - offset); var result = []; + var i; if (length === 4) { // IPv4 - for (var i = 0; i < length; i++) { + for (i = 0; i < length; i++) { result.push(buff[offset + i]); } result = result.join('.'); } else if (length === 16) { // IPv6 - for (var i = 0; i < length; i += 2) { + for (i = 0; i < length; i += 2) { result.push(buff.readUInt16BE(offset + i).toString(16)); } result = result.join(':'); @@ -85,21 +84,27 @@ ip.toString = function(buff, offset, length) { }; var ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/; -var ipv6Regex = - /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i; +var ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i; -ip.isV4Format = function(ip) { +ip.isV4Format = function (ip) { return ipv4Regex.test(ip); }; -ip.isV6Format = function(ip) { +ip.isV6Format = function (ip) { return ipv6Regex.test(ip); }; + function _normalizeFamily(family) { + if (family === 4) { + return 'ipv4'; + } + if (family === 6) { + return 'ipv6'; + } return family ? family.toLowerCase() : 'ipv4'; } -ip.fromPrefixLen = function(prefixlen, family) { +ip.fromPrefixLen = function (prefixlen, family) { if (prefixlen > 32) { family = 'ipv6'; } else { @@ -125,14 +130,14 @@ ip.fromPrefixLen = function(prefixlen, family) { return ip.toString(buff); }; -ip.mask = function(addr, mask) { +ip.mask = function (addr, mask) { addr = ip.toBuffer(addr); mask = ip.toBuffer(mask); var result = new Buffer(Math.max(addr.length, mask.length)); - var i = 0; // Same protocol - do bitwise and + var i; if (addr.length === mask.length) { for (i = 0; i < addr.length; i++) { result[i] = addr[i] & mask[i]; @@ -141,11 +146,11 @@ ip.mask = function(addr, mask) { // IPv6 address and IPv4 mask // (Mask low bits) for (i = 0; i < mask.length; i++) { - result[i] = addr[addr.length - 4 + i] & mask[i]; + result[i] = addr[addr.length - 4 + i] & mask[i]; } } else { // IPv6 mask and IPv4 addr - for (var i = 0; i < result.length - 6; i++) { + for (i = 0; i < result.length - 6; i++) { result[i] = 0; } @@ -155,27 +160,29 @@ ip.mask = function(addr, mask) { for (i = 0; i < addr.length; i++) { result[i + 12] = addr[i] & mask[i + 12]; } - i = i + 12; + i += 12; } - for (; i < result.length; i++) + for (; i < result.length; i++) { result[i] = 0; + } return ip.toString(result); }; -ip.cidr = function(cidrString) { +ip.cidr = function (cidrString) { var cidrParts = cidrString.split('/'); var addr = cidrParts[0]; - if (cidrParts.length !== 2) - throw new Error('invalid CIDR subnet: ' + addr); + if (cidrParts.length !== 2) { + throw new Error(`invalid CIDR subnet: ${addr}`); + } var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); return ip.mask(addr, mask); }; -ip.subnet = function(addr, mask) { +ip.subnet = function (addr, mask) { var networkAddress = ip.toLong(ip.mask(addr, mask)); // Calculate the mask's length. @@ -198,37 +205,38 @@ ip.subnet = function(addr, mask) { return { networkAddress: ip.fromLong(networkAddress), - firstAddress: numberOfAddresses <= 2 ? - ip.fromLong(networkAddress) : - ip.fromLong(networkAddress + 1), - lastAddress: numberOfAddresses <= 2 ? - ip.fromLong(networkAddress + numberOfAddresses - 1) : - ip.fromLong(networkAddress + numberOfAddresses - 2), + firstAddress: numberOfAddresses <= 2 + ? ip.fromLong(networkAddress) + : ip.fromLong(networkAddress + 1), + lastAddress: numberOfAddresses <= 2 + ? ip.fromLong(networkAddress + numberOfAddresses - 1) + : ip.fromLong(networkAddress + numberOfAddresses - 2), broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1), subnetMask: mask, subnetMaskLength: maskLength, - numHosts: numberOfAddresses <= 2 ? - numberOfAddresses : numberOfAddresses - 2, + numHosts: numberOfAddresses <= 2 + ? numberOfAddresses : numberOfAddresses - 2, length: numberOfAddresses, - contains: function(other) { + contains(other) { return networkAddress === ip.toLong(ip.mask(other, mask)); - } + }, }; }; -ip.cidrSubnet = function(cidrString) { +ip.cidrSubnet = function (cidrString) { var cidrParts = cidrString.split('/'); var addr = cidrParts[0]; - if (cidrParts.length !== 2) - throw new Error('invalid CIDR subnet: ' + addr); + if (cidrParts.length !== 2) { + throw new Error(`invalid CIDR subnet: ${addr}`); + } var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); return ip.subnet(addr, mask); }; -ip.not = function(addr) { +ip.not = function (addr) { var buff = ip.toBuffer(addr); for (var i = 0; i < buff.length; i++) { buff[i] = 0xff ^ buff[i]; @@ -236,42 +244,45 @@ ip.not = function(addr) { return ip.toString(buff); }; -ip.or = function(a, b) { +ip.or = function (a, b) { + var i; + a = ip.toBuffer(a); b = ip.toBuffer(b); // same protocol if (a.length === b.length) { - for (var i = 0; i < a.length; ++i) { + for (i = 0; i < a.length; ++i) { a[i] |= b[i]; } return ip.toString(a); // mixed protocols - } else { - var buff = a; - var other = b; - if (b.length > a.length) { - buff = b; - other = a; - } - - var offset = buff.length - other.length; - for (var i = offset; i < buff.length; ++i) { - buff[i] |= other[i - offset]; - } + } + var buff = a; + var other = b; + if (b.length > a.length) { + buff = b; + other = a; + } - return ip.toString(buff); + var offset = buff.length - other.length; + for (i = offset; i < buff.length; ++i) { + buff[i] |= other[i - offset]; } + + return ip.toString(buff); }; -ip.isEqual = function(a, b) { +ip.isEqual = function (a, b) { + var i; + a = ip.toBuffer(a); b = ip.toBuffer(b); // Same protocol if (a.length === b.length) { - for (var i = 0; i < a.length; i++) { + for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) return false; } return true; @@ -285,47 +296,47 @@ ip.isEqual = function(a, b) { } // a - IPv4, b - IPv6 - for (var i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { if (b[i] !== 0) return false; } var word = b.readUInt16BE(10); if (word !== 0 && word !== 0xffff) return false; - for (var i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { if (a[i] !== b[i + 12]) return false; } return true; }; -ip.isPrivate = function(addr) { +ip.isPrivate = function (addr) { return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i - .test(addr) || - /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || - /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i - .test(addr) || - /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || - /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || - /^f[cd][0-9a-f]{2}:/i.test(addr) || - /^fe80:/i.test(addr) || - /^::1$/.test(addr) || - /^::$/.test(addr); + .test(addr) + || /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i + .test(addr) + || /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^f[cd][0-9a-f]{2}:/i.test(addr) + || /^fe80:/i.test(addr) + || /^::1$/.test(addr) + || /^::$/.test(addr); }; -ip.isPublic = function(addr) { +ip.isPublic = function (addr) { return !ip.isPrivate(addr); }; -ip.isLoopback = function(addr) { +ip.isLoopback = function (addr) { return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/ - .test(addr) || - /^fe80::1$/.test(addr) || - /^::1$/.test(addr) || - /^::$/.test(addr); + .test(addr) + || /^fe80::1$/.test(addr) + || /^::1$/.test(addr) + || /^::$/.test(addr); }; -ip.loopback = function(family) { +ip.loopback = function (family) { // // Default to `ipv4` // @@ -353,9 +364,8 @@ ip.loopback = function(family) { // * 'private': the first private ip address of family. // * undefined: First address with `ipv4` or loopback address `127.0.0.1`. // -ip.address = function(name, family) { +ip.address = function (name, family) { var interfaces = os.networkInterfaces(); - var all; // // Default to `ipv4` @@ -367,30 +377,31 @@ ip.address = function(name, family) { // return the address. // if (name && name !== 'private' && name !== 'public') { - var res = interfaces[name].filter(function(details) { - var itemFamily = details.family.toLowerCase(); + var res = interfaces[name].filter((details) => { + var itemFamily = _normalizeFamily(details.family); return itemFamily === family; }); - if (res.length === 0) + if (res.length === 0) { return undefined; + } return res[0].address; } - var all = Object.keys(interfaces).map(function (nic) { + var all = Object.keys(interfaces).map((nic) => { // // Note: name will only be `public` or `private` // when this is called. // - var addresses = interfaces[nic].filter(function (details) { - details.family = details.family.toLowerCase(); + var addresses = interfaces[nic].filter((details) => { + details.family = _normalizeFamily(details.family); if (details.family !== family || ip.isLoopback(details.address)) { return false; - } else if (!name) { + } if (!name) { return true; } - return name === 'public' ? ip.isPrivate(details.address) : - ip.isPublic(details.address); + return name === 'public' ? ip.isPrivate(details.address) + : ip.isPublic(details.address); }); return addresses.length ? addresses[0].address : undefined; @@ -399,18 +410,18 @@ ip.address = function(name, family) { return !all.length ? ip.loopback(family) : all[0]; }; -ip.toLong = function(ip) { +ip.toLong = function (ip) { var ipl = 0; - ip.split('.').forEach(function(octet) { + ip.split('.').forEach((octet) => { ipl <<= 8; ipl += parseInt(octet); }); - return(ipl >>> 0); + return (ipl >>> 0); }; -ip.fromLong = function(ipl) { - return ((ipl >>> 24) + '.' + - (ipl >> 16 & 255) + '.' + - (ipl >> 8 & 255) + '.' + - (ipl & 255) ); +ip.fromLong = function (ipl) { + return (`${ipl >>> 24}.${ + ipl >> 16 & 255}.${ + ipl >> 8 & 255}.${ + ipl & 255}`); }; diff --git a/deps/npm/node_modules/ip/package.json b/deps/npm/node_modules/ip/package.json index c783fdd43767d4..70e1a4f02aeb7f 100644 --- a/deps/npm/node_modules/ip/package.json +++ b/deps/npm/node_modules/ip/package.json @@ -1,21 +1,25 @@ { "name": "ip", - "version": "1.1.5", + "version": "1.1.8", "author": "Fedor Indutny ", "homepage": "https://github.com/indutny/node-ip", "repository": { "type": "git", "url": "http://github.com/indutny/node-ip.git" }, + "files": [ + "lib", + "README.md" + ], "main": "lib/ip", "devDependencies": { - "jscs": "^2.1.1", - "jshint": "^2.8.0", - "mocha": "~1.3.2" + "eslint": "^8.15.0", + "mocha": "^10.0.0" }, "scripts": { - "test": "jscs lib/*.js test/*.js && jshint lib/*.js && mocha --reporter spec test/*-test.js", - "fix": "jscs lib/*.js test/*.js --fix" + "lint": "eslint lib/*.js test/*.js", + "test": "npm run lint && mocha --reporter spec test/*-test.js", + "fix": "npm run lint -- --fix" }, "license": "MIT" } diff --git a/deps/npm/node_modules/ip/test/api-test.js b/deps/npm/node_modules/ip/test/api-test.js deleted file mode 100644 index 2e390f986d0bfd..00000000000000 --- a/deps/npm/node_modules/ip/test/api-test.js +++ /dev/null @@ -1,407 +0,0 @@ -'use strict'; - -var ip = require('..'); -var assert = require('assert'); -var net = require('net'); -var os = require('os'); - -describe('IP library for node.js', function() { - describe('toBuffer()/toString() methods', function() { - it('should convert to buffer IPv4 address', function() { - var buf = ip.toBuffer('127.0.0.1'); - assert.equal(buf.toString('hex'), '7f000001'); - assert.equal(ip.toString(buf), '127.0.0.1'); - }); - - it('should convert to buffer IPv4 address in-place', function() { - var buf = new Buffer(128); - var offset = 64; - ip.toBuffer('127.0.0.1', buf, offset); - assert.equal(buf.toString('hex', offset, offset + 4), '7f000001'); - assert.equal(ip.toString(buf, offset, 4), '127.0.0.1'); - }); - - it('should convert to buffer IPv6 address', function() { - var buf = ip.toBuffer('::1'); - assert(/(00){15,15}01/.test(buf.toString('hex'))); - assert.equal(ip.toString(buf), '::1'); - assert.equal(ip.toString(ip.toBuffer('1::')), '1::'); - assert.equal(ip.toString(ip.toBuffer('abcd::dcba')), 'abcd::dcba'); - }); - - it('should convert to buffer IPv6 address in-place', function() { - var buf = new Buffer(128); - var offset = 64; - ip.toBuffer('::1', buf, offset); - assert(/(00){15,15}01/.test(buf.toString('hex', offset, offset + 16))); - assert.equal(ip.toString(buf, offset, 16), '::1'); - assert.equal(ip.toString(ip.toBuffer('1::', buf, offset), - offset, 16), '1::'); - assert.equal(ip.toString(ip.toBuffer('abcd::dcba', buf, offset), - offset, 16), 'abcd::dcba'); - }); - - it('should convert to buffer IPv6 mapped IPv4 address', function() { - var buf = ip.toBuffer('::ffff:127.0.0.1'); - assert.equal(buf.toString('hex'), '00000000000000000000ffff7f000001'); - assert.equal(ip.toString(buf), '::ffff:7f00:1'); - - buf = ip.toBuffer('ffff::127.0.0.1'); - assert.equal(buf.toString('hex'), 'ffff000000000000000000007f000001'); - assert.equal(ip.toString(buf), 'ffff::7f00:1'); - - buf = ip.toBuffer('0:0:0:0:0:ffff:127.0.0.1'); - assert.equal(buf.toString('hex'), '00000000000000000000ffff7f000001'); - assert.equal(ip.toString(buf), '::ffff:7f00:1'); - }); - }); - - describe('fromPrefixLen() method', function() { - it('should create IPv4 mask', function() { - assert.equal(ip.fromPrefixLen(24), '255.255.255.0'); - }); - it('should create IPv6 mask', function() { - assert.equal(ip.fromPrefixLen(64), 'ffff:ffff:ffff:ffff::'); - }); - it('should create IPv6 mask explicitly', function() { - assert.equal(ip.fromPrefixLen(24, 'IPV6'), 'ffff:ff00::'); - }); - }); - - describe('not() method', function() { - it('should reverse bits in address', function() { - assert.equal(ip.not('255.255.255.0'), '0.0.0.255'); - }); - }); - - describe('or() method', function() { - it('should or bits in ipv4 addresses', function() { - assert.equal(ip.or('0.0.0.255', '192.168.1.10'), '192.168.1.255'); - }); - it('should or bits in ipv6 addresses', function() { - assert.equal(ip.or('::ff', '::abcd:dcba:abcd:dcba'), - '::abcd:dcba:abcd:dcff'); - }); - it('should or bits in mixed addresses', function() { - assert.equal(ip.or('0.0.0.255', '::abcd:dcba:abcd:dcba'), - '::abcd:dcba:abcd:dcff'); - }); - }); - - describe('mask() method', function() { - it('should mask bits in address', function() { - assert.equal(ip.mask('192.168.1.134', '255.255.255.0'), '192.168.1.0'); - assert.equal(ip.mask('192.168.1.134', '::ffff:ff00'), '::ffff:c0a8:100'); - }); - - it('should not leak data', function() { - for (var i = 0; i < 10; i++) - assert.equal(ip.mask('::1', '0.0.0.0'), '::'); - }); - }); - - describe('subnet() method', function() { - // Test cases calculated with http://www.subnet-calculator.com/ - var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.192'); - - it('should compute ipv4 network address', function() { - assert.equal(ipv4Subnet.networkAddress, '192.168.1.128'); - }); - - it('should compute ipv4 network\'s first address', function() { - assert.equal(ipv4Subnet.firstAddress, '192.168.1.129'); - }); - - it('should compute ipv4 network\'s last address', function() { - assert.equal(ipv4Subnet.lastAddress, '192.168.1.190'); - }); - - it('should compute ipv4 broadcast address', function() { - assert.equal(ipv4Subnet.broadcastAddress, '192.168.1.191'); - }); - - it('should compute ipv4 subnet number of addresses', function() { - assert.equal(ipv4Subnet.length, 64); - }); - - it('should compute ipv4 subnet number of addressable hosts', function() { - assert.equal(ipv4Subnet.numHosts, 62); - }); - - it('should compute ipv4 subnet mask', function() { - assert.equal(ipv4Subnet.subnetMask, '255.255.255.192'); - }); - - it('should compute ipv4 subnet mask\'s length', function() { - assert.equal(ipv4Subnet.subnetMaskLength, 26); - }); - - it('should know whether a subnet contains an address', function() { - assert.equal(ipv4Subnet.contains('192.168.1.180'), true); - }); - - it('should know whether a subnet does not contain an address', function() { - assert.equal(ipv4Subnet.contains('192.168.1.195'), false); - }); - }); - - describe('subnet() method with mask length 32', function() { - // Test cases calculated with http://www.subnet-calculator.com/ - var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.255'); - it('should compute ipv4 network\'s first address', function() { - assert.equal(ipv4Subnet.firstAddress, '192.168.1.134'); - }); - - it('should compute ipv4 network\'s last address', function() { - assert.equal(ipv4Subnet.lastAddress, '192.168.1.134'); - }); - - it('should compute ipv4 subnet number of addressable hosts', function() { - assert.equal(ipv4Subnet.numHosts, 1); - }); - }); - - describe('subnet() method with mask length 31', function() { - // Test cases calculated with http://www.subnet-calculator.com/ - var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.254'); - it('should compute ipv4 network\'s first address', function() { - assert.equal(ipv4Subnet.firstAddress, '192.168.1.134'); - }); - - it('should compute ipv4 network\'s last address', function() { - assert.equal(ipv4Subnet.lastAddress, '192.168.1.135'); - }); - - it('should compute ipv4 subnet number of addressable hosts', function() { - assert.equal(ipv4Subnet.numHosts, 2); - }); - }); - - describe('cidrSubnet() method', function() { - // Test cases calculated with http://www.subnet-calculator.com/ - var ipv4Subnet = ip.cidrSubnet('192.168.1.134/26'); - - it('should compute an ipv4 network address', function() { - assert.equal(ipv4Subnet.networkAddress, '192.168.1.128'); - }); - - it('should compute an ipv4 network\'s first address', function() { - assert.equal(ipv4Subnet.firstAddress, '192.168.1.129'); - }); - - it('should compute an ipv4 network\'s last address', function() { - assert.equal(ipv4Subnet.lastAddress, '192.168.1.190'); - }); - - it('should compute an ipv4 broadcast address', function() { - assert.equal(ipv4Subnet.broadcastAddress, '192.168.1.191'); - }); - - it('should compute an ipv4 subnet number of addresses', function() { - assert.equal(ipv4Subnet.length, 64); - }); - - it('should compute an ipv4 subnet number of addressable hosts', function() { - assert.equal(ipv4Subnet.numHosts, 62); - }); - - it('should compute an ipv4 subnet mask', function() { - assert.equal(ipv4Subnet.subnetMask, '255.255.255.192'); - }); - - it('should compute an ipv4 subnet mask\'s length', function() { - assert.equal(ipv4Subnet.subnetMaskLength, 26); - }); - - it('should know whether a subnet contains an address', function() { - assert.equal(ipv4Subnet.contains('192.168.1.180'), true); - }); - - it('should know whether a subnet contains an address', function() { - assert.equal(ipv4Subnet.contains('192.168.1.195'), false); - }); - - }); - - describe('cidr() method', function() { - it('should mask address in CIDR notation', function() { - assert.equal(ip.cidr('192.168.1.134/26'), '192.168.1.128'); - assert.equal(ip.cidr('2607:f0d0:1002:51::4/56'), '2607:f0d0:1002::'); - }); - }); - - describe('isEqual() method', function() { - it('should check if addresses are equal', function() { - assert(ip.isEqual('127.0.0.1', '::7f00:1')); - assert(!ip.isEqual('127.0.0.1', '::7f00:2')); - assert(ip.isEqual('127.0.0.1', '::ffff:7f00:1')); - assert(!ip.isEqual('127.0.0.1', '::ffaf:7f00:1')); - assert(ip.isEqual('::ffff:127.0.0.1', '::ffff:127.0.0.1')); - assert(ip.isEqual('::ffff:127.0.0.1', '127.0.0.1')); - }); - }); - - - describe('isPrivate() method', function() { - it('should check if an address is localhost', function() { - assert.equal(ip.isPrivate('127.0.0.1'), true); - }); - - it('should check if an address is from a 192.168.x.x network', function() { - assert.equal(ip.isPrivate('192.168.0.123'), true); - assert.equal(ip.isPrivate('192.168.122.123'), true); - assert.equal(ip.isPrivate('192.162.1.2'), false); - }); - - it('should check if an address is from a 172.16.x.x network', function() { - assert.equal(ip.isPrivate('172.16.0.5'), true); - assert.equal(ip.isPrivate('172.16.123.254'), true); - assert.equal(ip.isPrivate('171.16.0.5'), false); - assert.equal(ip.isPrivate('172.25.232.15'), true); - assert.equal(ip.isPrivate('172.15.0.5'), false); - assert.equal(ip.isPrivate('172.32.0.5'), false); - }); - - it('should check if an address is from a 169.254.x.x network', function() { - assert.equal(ip.isPrivate('169.254.2.3'), true); - assert.equal(ip.isPrivate('169.254.221.9'), true); - assert.equal(ip.isPrivate('168.254.2.3'), false); - }); - - it('should check if an address is from a 10.x.x.x network', function() { - assert.equal(ip.isPrivate('10.0.2.3'), true); - assert.equal(ip.isPrivate('10.1.23.45'), true); - assert.equal(ip.isPrivate('12.1.2.3'), false); - }); - - it('should check if an address is from a private IPv6 network', function() { - assert.equal(ip.isPrivate('fd12:3456:789a:1::1'), true); - assert.equal(ip.isPrivate('fe80::f2de:f1ff:fe3f:307e'), true); - assert.equal(ip.isPrivate('::ffff:10.100.1.42'), true); - assert.equal(ip.isPrivate('::FFFF:172.16.200.1'), true); - assert.equal(ip.isPrivate('::ffff:192.168.0.1'), true); - }); - - it('should check if an address is from the internet', function() { - assert.equal(ip.isPrivate('165.225.132.33'), false); // joyent.com - }); - - it('should check if an address is a loopback IPv6 address', function() { - assert.equal(ip.isPrivate('::'), true); - assert.equal(ip.isPrivate('::1'), true); - assert.equal(ip.isPrivate('fe80::1'), true); - }); - }); - - describe('loopback() method', function() { - describe('undefined', function() { - it('should respond with 127.0.0.1', function() { - assert.equal(ip.loopback(), '127.0.0.1') - }); - }); - - describe('ipv4', function() { - it('should respond with 127.0.0.1', function() { - assert.equal(ip.loopback('ipv4'), '127.0.0.1') - }); - }); - - describe('ipv6', function() { - it('should respond with fe80::1', function() { - assert.equal(ip.loopback('ipv6'), 'fe80::1') - }); - }); - }); - - describe('isLoopback() method', function() { - describe('127.0.0.1', function() { - it('should respond with true', function() { - assert.ok(ip.isLoopback('127.0.0.1')) - }); - }); - - describe('127.8.8.8', function () { - it('should respond with true', function () { - assert.ok(ip.isLoopback('127.8.8.8')) - }); - }); - - describe('8.8.8.8', function () { - it('should respond with false', function () { - assert.equal(ip.isLoopback('8.8.8.8'), false); - }); - }); - - describe('fe80::1', function() { - it('should respond with true', function() { - assert.ok(ip.isLoopback('fe80::1')) - }); - }); - - describe('::1', function() { - it('should respond with true', function() { - assert.ok(ip.isLoopback('::1')) - }); - }); - - describe('::', function() { - it('should respond with true', function() { - assert.ok(ip.isLoopback('::')) - }); - }); - }); - - describe('address() method', function() { - describe('undefined', function() { - it('should respond with a private ip', function() { - assert.ok(ip.isPrivate(ip.address())); - }); - }); - - describe('private', function() { - [ undefined, 'ipv4', 'ipv6' ].forEach(function(family) { - describe(family, function() { - it('should respond with a private ip', function() { - assert.ok(ip.isPrivate(ip.address('private', family))); - }); - }); - }); - }); - - var interfaces = os.networkInterfaces(); - - Object.keys(interfaces).forEach(function(nic) { - describe(nic, function() { - [ undefined, 'ipv4' ].forEach(function(family) { - describe(family, function() { - it('should respond with an ipv4 address', function() { - var addr = ip.address(nic, family); - assert.ok(!addr || net.isIPv4(addr)); - }); - }); - }); - - describe('ipv6', function() { - it('should respond with an ipv6 address', function() { - var addr = ip.address(nic, 'ipv6'); - assert.ok(!addr || net.isIPv6(addr)); - }); - }) - }); - }); - }); - - describe('toLong() method', function() { - it('should respond with a int', function() { - assert.equal(ip.toLong('127.0.0.1'), 2130706433); - assert.equal(ip.toLong('255.255.255.255'), 4294967295); - }); - }); - - describe('fromLong() method', function() { - it('should repond with ipv4 address', function() { - assert.equal(ip.fromLong(2130706433), '127.0.0.1'); - assert.equal(ip.fromLong(4294967295), '255.255.255.255'); - }); - }) -}); diff --git a/deps/npm/node_modules/is-core-module/core.json b/deps/npm/node_modules/is-core-module/core.json index d275294854868e..058584b78998a0 100644 --- a/deps/npm/node_modules/is-core-module/core.json +++ b/deps/npm/node_modules/is-core-module/core.json @@ -112,6 +112,7 @@ "node:string_decoder": [">= 14.18 && < 15", ">= 16"], "sys": [">= 0.4 && < 0.7", ">= 0.8"], "node:sys": [">= 14.18 && < 15", ">= 16"], + "node:test": ">= 18", "timers": true, "node:timers": [">= 14.18 && < 15", ">= 16"], "timers/promises": ">= 15", diff --git a/deps/npm/node_modules/is-core-module/package.json b/deps/npm/node_modules/is-core-module/package.json index 0caddef2e1676f..80ce9f5bb1797c 100644 --- a/deps/npm/node_modules/is-core-module/package.json +++ b/deps/npm/node_modules/is-core-module/package.json @@ -1,16 +1,11 @@ { "name": "is-core-module", - "version": "2.8.1", + "version": "2.9.0", "description": "Is this specifier a node.js core module?", "main": "index.js", "sideEffects": false, "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], + ".": "./index.js", "./package.json": "./package.json" }, "scripts": { @@ -49,14 +44,15 @@ "has": "^1.0.3" }, "devDependencies": { - "@ljharb/eslint-config": "^20.1.0", - "aud": "^1.1.5", - "auto-changelog": "^2.3.0", - "eslint": "^8.6.0", + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "mock-property": "^1.0.0", "nyc": "^10.3.2", "safe-publish-latest": "^2.0.0", "semver": "^6.3.0", - "tape": "^5.4.0" + "tape": "^5.5.3" }, "auto-changelog": { "output": "CHANGELOG.md", diff --git a/deps/npm/node_modules/is-core-module/test/index.js b/deps/npm/node_modules/is-core-module/test/index.js index b688cd22f645f3..4385b20ea14891 100644 --- a/deps/npm/node_modules/is-core-module/test/index.js +++ b/deps/npm/node_modules/is-core-module/test/index.js @@ -3,6 +3,8 @@ var test = require('tape'); var keys = require('object-keys'); var semver = require('semver'); +var mockProperty = require('mock-property'); + var isCore = require('../'); var data = require('../core.json'); @@ -51,16 +53,18 @@ 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' - ); + if (mod.slice(0, 5) !== 'node:') { + 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' + ); + } } } } @@ -79,6 +83,10 @@ test('core modules', function (t) { 'v8/tools/tickprocessor', 'v8/tools/profile' ]; + // see https://github.com/nodejs/node/issues/42785 + if (semver.satisfies(process.version, '>= 18')) { + libs = libs.concat('node:test'); + } for (var i = 0; i < libs.length; ++i) { var mod = libs[i]; if (excludeList.indexOf(mod) === -1) { @@ -87,16 +95,18 @@ 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' - ); + if (mod.slice(0, 5) !== 'node:') { + 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' + ); + } } } } @@ -105,18 +115,11 @@ test('core modules', function (t) { }); t.test('Object.prototype pollution', function (st) { - /* eslint no-extend-native: 1 */ var nonKey = 'not a core module'; - st.teardown(function () { - delete Object.prototype.fs; - delete Object.prototype.path; - delete Object.prototype.http; - delete Object.prototype[nonKey]; - }); - Object.prototype.fs = false; - Object.prototype.path = '>= 999999999'; - Object.prototype.http = data.http; - Object.prototype[nonKey] = true; + st.teardown(mockProperty(Object.prototype, 'fs', { value: false })); + st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' })); + st.teardown(mockProperty(Object.prototype, 'http', { value: data.http })); + st.teardown(mockProperty(Object.prototype, nonKey, { value: true })); st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies'); st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies'); diff --git a/deps/npm/node_modules/just-diff/index.js b/deps/npm/node_modules/just-diff/index.js index b49bed14662e03..11ad3710b98f4a 100644 --- a/deps/npm/node_modules/just-diff/index.js +++ b/deps/npm/node_modules/just-diff/index.js @@ -129,12 +129,13 @@ function diff(obj1, obj2, pathConverter) { } } - return diffs.remove - .reverse() - .concat(diffs.replace) - .concat(diffs.add); + return diffs; } - return getDiff(obj1, obj2, [], {remove: [], replace: [], add: []}); + const finalDiffs = getDiff(obj1, obj2, [], {remove: [], replace: [], add: []}); + return finalDiffs.remove + .reverse() + .concat(finalDiffs.replace) + .concat(finalDiffs.add); } function pushReplace(path, basePath, key, diffs, pathConverter, obj2) { diff --git a/deps/npm/node_modules/just-diff/package.json b/deps/npm/node_modules/just-diff/package.json index bab8a29ae93a4d..5a4bb5f129c831 100644 --- a/deps/npm/node_modules/just-diff/package.json +++ b/deps/npm/node_modules/just-diff/package.json @@ -1,6 +1,6 @@ { "name": "just-diff", - "version": "5.0.1", + "version": "5.0.2", "description": "Return an object representing the diffs between two objects. Supports jsonPatch protocol", "main": "index.js", "module": "index.mjs", diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 2494ef0d9dd97d..55ad695b29d1cc 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "nock": "^13.2.4", "tap": "^16.0.1" }, @@ -46,6 +46,6 @@ ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index 20d7637724fceb..3630980ccb30b2 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "tap": "^16.0.1" }, "dependencies": { @@ -61,6 +61,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index f41df25140fb20..9fe45c7ef6d049 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -50,7 +50,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "bin-links": "^3.0.0", "tap": "^16.0.1" }, @@ -70,6 +70,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 9efee46511b540..7dd3e1b6484740 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -45,7 +45,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "tap": "^16.0.1" }, "dependencies": { @@ -56,6 +56,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index 7219e36fcc3225..2f76b52f8e1be7 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "nock": "^13.2.4", "tap": "^16.0.1" }, @@ -49,6 +49,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 56adfb6574c864..280fa5339ca53e 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -31,7 +31,7 @@ ], "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "minipass": "^3.1.1", "nock": "^13.2.4", "tap": "^16.0.1" @@ -52,6 +52,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 4d7f9226cfbabb..3fcf630cce58fb 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -26,7 +26,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "nock": "^13.0.7", "tap": "^16.0.1" }, @@ -47,6 +47,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index fec6490d4771c2..9d1f9de5c5e208 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "libnpmpack": "^4.0.0", "lodash.clonedeep": "^4.5.0", "nock": "^13.2.4", @@ -53,6 +53,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index 9c33fcaaa61cf3..dc28a374b21ecd 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -29,7 +29,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "nock": "^13.2.4", "tap": "^16.0.1" }, @@ -48,6 +48,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 80fb95a028958c..569678b5d864a6 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -19,7 +19,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "nock": "^13.2.4", "tap": "^16.0.1" }, @@ -42,6 +42,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index d374f3e392b5d7..86f97378128375 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "require-inject": "^1.4.4", "tap": "^16.0.1" }, @@ -47,6 +47,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.2" + "version": "3.5.0" } } diff --git a/deps/npm/node_modules/lru-cache/index.js b/deps/npm/node_modules/lru-cache/index.js index b63be6e988835e..fb1a076fa3ae8e 100644 --- a/deps/npm/node_modules/lru-cache/index.js +++ b/deps/npm/node_modules/lru-cache/index.js @@ -1,15 +1,46 @@ const perf = typeof performance === 'object' && performance && typeof performance.now === 'function' ? performance : Date -const hasAbortController = typeof AbortController !== 'undefined' +const hasAbortController = typeof AbortController === 'function' // minimal backwards-compatibility polyfill +// this doesn't have nearly all the checks and whatnot that +// actual AbortController/Signal has, but it's enough for +// our purposes, and if used properly, behaves the same. const AC = hasAbortController ? AbortController : Object.assign( class AbortController { constructor () { this.signal = new AC.AbortSignal } - abort () { this.signal.aborted = true } + abort () { + this.signal.dispatchEvent('abort') + } }, - { AbortSignal: class AbortSignal { constructor () { this.aborted = false }}} + { + AbortSignal: class AbortSignal { + constructor () { + this.aborted = false + this._listeners = [] + } + dispatchEvent (type) { + if (type === 'abort') { + this.aborted = true + const e = { type, target: this } + this.onabort(e) + this._listeners.forEach(f => f(e), this) + } + } + onabort () {} + addEventListener (ev, fn) { + if (ev === 'abort') { + this._listeners.push(fn) + } + } + removeEventListener (ev, fn) { + if (ev === 'abort') { + this._listeners = this._listeners.filter(f => f !== fn) + } + } + } + } ) const warned = new Set() @@ -306,15 +337,6 @@ class LRUCache { } this.calculatedSize += this.sizes[index] } - this.delete = k => { - if (this.size !== 0) { - const index = this.keyMap.get(k) - if (index !== undefined) { - this.calculatedSize -= this.sizes[index] - } - } - return LRUCache.prototype.delete.call(this, k) - } } removeItemSize (index) {} addItemSize (index, v, k, size) {} @@ -730,6 +752,7 @@ class LRUCache { deprecatedMethod('del', 'delete') return this.delete } + delete (k) { let deleted = false if (this.size !== 0) { @@ -809,6 +832,7 @@ class LRUCache { } } } + get reset () { deprecatedMethod('reset', 'clear') return this.clear @@ -818,6 +842,10 @@ class LRUCache { deprecatedProperty('length', 'size') return this.size } + + static get AbortController () { + return AC + } } module.exports = LRUCache diff --git a/deps/npm/node_modules/lru-cache/package.json b/deps/npm/node_modules/lru-cache/package.json index 32fb9da24e56e9..5364b09d2002c1 100644 --- a/deps/npm/node_modules/lru-cache/package.json +++ b/deps/npm/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "7.8.1", + "version": "7.9.0", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -23,7 +23,6 @@ "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", "clock-mock": "^1.0.4", - "heapdump": "^0.3.15", "size-limit": "^7.0.8", "tap": "^15.1.6" }, diff --git a/deps/npm/node_modules/make-fetch-happen/lib/index.js b/deps/npm/node_modules/make-fetch-happen/lib/index.js index 6028bc0725129a..2f12e8e1b61131 100644 --- a/deps/npm/node_modules/make-fetch-happen/lib/index.js +++ b/deps/npm/node_modules/make-fetch-happen/lib/index.js @@ -10,7 +10,7 @@ const makeFetchHappen = (url, opts) => { return fetch(request, options) } -makeFetchHappen.defaults = (defaultUrl, defaultOptions = {}) => { +makeFetchHappen.defaults = (defaultUrl, defaultOptions = {}, wrappedFetch = makeFetchHappen) => { if (typeof defaultUrl === 'object') { defaultOptions = defaultUrl defaultUrl = null @@ -26,10 +26,11 @@ makeFetchHappen.defaults = (defaultUrl, defaultOptions = {}) => { ...options.headers, }, } - return makeFetchHappen(finalUrl, finalOptions) + return wrappedFetch(finalUrl, finalOptions) } - defaultedFetch.defaults = makeFetchHappen.defaults + defaultedFetch.defaults = (defaultUrl1, defaultOptions1 = {}) => + makeFetchHappen.defaults(defaultUrl1, defaultOptions1, defaultedFetch) return defaultedFetch } diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json index 720ba01f1b213f..e1e8e975187b59 100644 --- a/deps/npm/node_modules/make-fetch-happen/package.json +++ b/deps/npm/node_modules/make-fetch-happen/package.json @@ -1,6 +1,6 @@ { "name": "make-fetch-happen", - "version": "10.1.2", + "version": "10.1.3", "description": "Opinionated, caching, retrying fetch client", "main": "lib/index.js", "files": [ @@ -55,7 +55,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.4.3", "mkdirp": "^1.0.4", "nock": "^13.2.4", "rimraf": "^3.0.2", @@ -73,6 +73,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.4.3" } } diff --git a/deps/npm/node_modules/npm-packlist/lib/index.js b/deps/npm/node_modules/npm-packlist/lib/index.js index 7e4093dfb39298..c7b0db5f608475 100644 --- a/deps/npm/node_modules/npm-packlist/lib/index.js +++ b/deps/npm/node_modules/npm-packlist/lib/index.js @@ -242,8 +242,8 @@ class Walker extends IgnoreWalker { if (excl) { pattern = pattern.slice(excl[0].length) } - // strip off any / from the start of the pattern. /foo => foo - pattern = pattern.replace(/^\/+/, '') + // strip off any / or ./ from the start of the pattern. /foo => foo, ./foo => foo + pattern = pattern.replace(/^\.?\/+/, '') // an odd number of ! means a negated pattern. !!foo ==> foo const negate = excl && excl[0].length % 2 === 1 set.push({ pattern, negate }) diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index ab5e46359d09b6..e79d1d4b82d865 100644 --- a/deps/npm/node_modules/npm-packlist/package.json +++ b/deps/npm/node_modules/npm-packlist/package.json @@ -1,6 +1,6 @@ { "name": "npm-packlist", - "version": "5.0.2", + "version": "5.0.3", "description": "Get a list of the files to add from a folder into an npm package", "directories": { "test": "test" @@ -20,7 +20,7 @@ ], "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.1", + "@npmcli/template-oss": "3.4.2", "mutate-fs": "^2.1.1", "tap": "^16.0.1" }, @@ -56,6 +56,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.1" + "version": "3.4.2" } } diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/agent.d.ts b/deps/npm/node_modules/socks-proxy-agent/dist/agent.d.ts deleted file mode 100644 index 96f44af75984cb..00000000000000 --- a/deps/npm/node_modules/socks-proxy-agent/dist/agent.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// -import net from 'net'; -import { Agent, ClientRequest, RequestOptions } from 'agent-base'; -import { SocksProxyAgentOptions } from '.'; -/** - * The `SocksProxyAgent`. - * - * @api public - */ -export default class SocksProxyAgent extends Agent { - private lookup; - private proxy; - private tlsConnectionOptions; - constructor(_opts: string | SocksProxyAgentOptions); - /** - * Initiates a SOCKS connection to the specified SOCKS proxy server, - * which in turn connects to the specified remote host and port. - * - * @api protected - */ - callback(req: ClientRequest, opts: RequestOptions): Promise; -} diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/agent.js b/deps/npm/node_modules/socks-proxy-agent/dist/agent.js deleted file mode 100644 index 1e4c529f7746f4..00000000000000 --- a/deps/npm/node_modules/socks-proxy-agent/dist/agent.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const dns_1 = __importDefault(require("dns")); -const tls_1 = __importDefault(require("tls")); -const url_1 = __importDefault(require("url")); -const debug_1 = __importDefault(require("debug")); -const agent_base_1 = require("agent-base"); -const socks_1 = require("socks"); -const debug = debug_1.default('socks-proxy-agent'); -function dnsLookup(host) { - return new Promise((resolve, reject) => { - dns_1.default.lookup(host, (err, res) => { - if (err) { - reject(err); - } - else { - resolve(res); - } - }); - }); -} -function parseSocksProxy(opts) { - let port = 0; - let lookup = false; - let type = 5; - // Prefer `hostname` over `host`, because of `url.parse()` - const host = opts.hostname || opts.host; - if (!host) { - throw new TypeError('No "host"'); - } - if (typeof opts.port === 'number') { - port = opts.port; - } - else if (typeof opts.port === 'string') { - port = parseInt(opts.port, 10); - } - // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 - // "The SOCKS service is conventionally located on TCP port 1080" - if (!port) { - port = 1080; - } - // figure out if we want socks v4 or v5, based on the "protocol" used. - // Defaults to 5. - if (opts.protocol) { - switch (opts.protocol.replace(':', '')) { - case 'socks4': - lookup = true; - // pass through - case 'socks4a': - type = 4; - break; - case 'socks5': - lookup = true; - // pass through - case 'socks': // no version specified, default to 5h - case 'socks5h': - type = 5; - break; - default: - throw new TypeError(`A "socks" protocol must be specified! Got: ${opts.protocol}`); - } - } - if (typeof opts.type !== 'undefined') { - if (opts.type === 4 || opts.type === 5) { - type = opts.type; - } - else { - throw new TypeError(`"type" must be 4 or 5, got: ${opts.type}`); - } - } - const proxy = { - host, - port, - type - }; - let userId = opts.userId || opts.username; - let password = opts.password; - if (opts.auth) { - const auth = opts.auth.split(':'); - userId = auth[0]; - password = auth[1]; - } - if (userId) { - Object.defineProperty(proxy, 'userId', { - value: userId, - enumerable: false - }); - } - if (password) { - Object.defineProperty(proxy, 'password', { - value: password, - enumerable: false - }); - } - return { lookup, proxy }; -} -/** - * The `SocksProxyAgent`. - * - * @api public - */ -class SocksProxyAgent extends agent_base_1.Agent { - constructor(_opts) { - let opts; - if (typeof _opts === 'string') { - opts = url_1.default.parse(_opts); - } - else { - opts = _opts; - } - if (!opts) { - throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!'); - } - super(opts); - const parsedProxy = parseSocksProxy(opts); - this.lookup = parsedProxy.lookup; - this.proxy = parsedProxy.proxy; - this.tlsConnectionOptions = opts.tls || {}; - } - /** - * Initiates a SOCKS connection to the specified SOCKS proxy server, - * which in turn connects to the specified remote host and port. - * - * @api protected - */ - callback(req, opts) { - return __awaiter(this, void 0, void 0, function* () { - const { lookup, proxy } = this; - let { host, port, timeout } = opts; - if (!host) { - throw new Error('No `host` defined!'); - } - if (lookup) { - // Client-side DNS resolution for "4" and "5" socks proxy versions. - host = yield dnsLookup(host); - } - const socksOpts = { - proxy, - destination: { host, port }, - command: 'connect', - timeout - }; - debug('Creating socks proxy connection: %o', socksOpts); - const { socket } = yield socks_1.SocksClient.createConnection(socksOpts); - debug('Successfully created socks proxy connection'); - if (opts.secureEndpoint) { - // The proxy is connecting to a TLS server, so upgrade - // this socket connection to a TLS connection. - debug('Upgrading socket connection to TLS'); - const servername = opts.servername || opts.host; - return tls_1.default.connect(Object.assign(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, - servername }), this.tlsConnectionOptions)); - } - return socket; - }); - } -} -exports.default = SocksProxyAgent; -function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; -} -//# sourceMappingURL=agent.js.map \ No newline at end of file diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/agent.js.map b/deps/npm/node_modules/socks-proxy-agent/dist/agent.js.map deleted file mode 100644 index 4efc16887a93b9..00000000000000 --- a/deps/npm/node_modules/socks-proxy-agent/dist/agent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,8CAAsB;AACtB,8CAAsB;AACtB,kDAAgC;AAChC,2CAAkE;AAClE,iCAAoE;AAGpE,MAAM,KAAK,GAAG,eAAW,CAAC,mBAAmB,CAAC,CAAC;AAE/C,SAAS,SAAS,CAAC,IAAY;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,aAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC7B,IAAI,GAAG,EAAE;gBACR,MAAM,CAAC,GAAG,CAAC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9C,KAAK,CAAC,oCAAoC,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC;gBAChD,OAAO,aAAG,CAAC,OAAO,+CACd,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,KACjD,MAAM;oBACN,UAAU,KACP,IAAI,CAAC,oBAAoB,EAC3B,CAAC;aACH;YAED,OAAO,MAAM,CAAC;QACf,CAAC;KAAA;CACD;AAxED,kCAwEC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/index.d.ts b/deps/npm/node_modules/socks-proxy-agent/dist/index.d.ts index d031b95ddf593f..4de33b1252a18c 100644 --- a/deps/npm/node_modules/socks-proxy-agent/dist/index.d.ts +++ b/deps/npm/node_modules/socks-proxy-agent/dist/index.d.ts @@ -1,21 +1,33 @@ /// -import { Url } from 'url'; import { SocksProxy } from 'socks'; -import tls from 'tls'; +import { Agent, ClientRequest, RequestOptions } from 'agent-base'; import { AgentOptions } from 'agent-base'; -import _SocksProxyAgent from './agent'; -declare function createSocksProxyAgent(opts: string | createSocksProxyAgent.SocksProxyAgentOptions): _SocksProxyAgent; -declare namespace createSocksProxyAgent { - interface BaseSocksProxyAgentOptions { - host?: string | null; - port?: string | number | null; - username?: string | null; - tls?: tls.ConnectionOptions | null; - } - export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial> { - } - export type SocksProxyAgent = _SocksProxyAgent; - export const SocksProxyAgent: typeof _SocksProxyAgent; - export {}; +import { Url } from 'url'; +import net from 'net'; +import tls from 'tls'; +interface BaseSocksProxyAgentOptions { + host?: string | null; + port?: string | number | null; + username?: string | null; + tls?: tls.ConnectionOptions | null; +} +interface SocksProxyAgentOptionsExtra { + timeout?: number; +} +export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial> { +} +export declare class SocksProxyAgent extends Agent { + private readonly shouldLookup; + private readonly proxy; + private readonly tlsConnectionOptions; + timeout: number | null; + constructor(input: string | SocksProxyAgentOptions, options?: SocksProxyAgentOptionsExtra); + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + * + * @api protected + */ + callback(req: ClientRequest, opts: RequestOptions): Promise; } -export = createSocksProxyAgent; +export {}; diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/index.js b/deps/npm/node_modules/socks-proxy-agent/dist/index.js index dd1e49a77e436c..55b598b7f5ca73 100644 --- a/deps/npm/node_modules/socks-proxy-agent/dist/index.js +++ b/deps/npm/node_modules/socks-proxy-agent/dist/index.js @@ -1,14 +1,197 @@ "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -const agent_1 = __importDefault(require("./agent")); -function createSocksProxyAgent(opts) { - return new agent_1.default(opts); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocksProxyAgent = void 0; +const socks_1 = require("socks"); +const agent_base_1 = require("agent-base"); +const debug_1 = __importDefault(require("debug")); +const dns_1 = __importDefault(require("dns")); +const tls_1 = __importDefault(require("tls")); +const debug = (0, debug_1.default)('socks-proxy-agent'); +function parseSocksProxy(opts) { + var _a; + let port = 0; + let lookup = false; + let type = 5; + const host = opts.hostname; + if (host == null) { + throw new TypeError('No "host"'); + } + if (typeof opts.port === 'number') { + port = opts.port; + } + else if (typeof opts.port === 'string') { + port = parseInt(opts.port, 10); + } + // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 + // "The SOCKS service is conventionally located on TCP port 1080" + if (port == null) { + port = 1080; + } + // figure out if we want socks v4 or v5, based on the "protocol" used. + // Defaults to 5. + if (opts.protocol != null) { + switch (opts.protocol.replace(':', '')) { + case 'socks4': + lookup = true; + // pass through + case 'socks4a': + type = 4; + break; + case 'socks5': + lookup = true; + // pass through + case 'socks': // no version specified, default to 5h + case 'socks5h': + type = 5; + break; + default: + throw new TypeError(`A "socks" protocol must be specified! Got: ${String(opts.protocol)}`); + } + } + if (typeof opts.type !== 'undefined') { + if (opts.type === 4 || opts.type === 5) { + type = opts.type; + } + else { + throw new TypeError(`"type" must be 4 or 5, got: ${String(opts.type)}`); + } + } + const proxy = { + host, + port, + type + }; + let userId = (_a = opts.userId) !== null && _a !== void 0 ? _a : opts.username; + let password = opts.password; + if (opts.auth != null) { + const auth = opts.auth.split(':'); + userId = auth[0]; + password = auth[1]; + } + if (userId != null) { + Object.defineProperty(proxy, 'userId', { + value: userId, + enumerable: false + }); + } + if (password != null) { + Object.defineProperty(proxy, 'password', { + value: password, + enumerable: false + }); + } + return { lookup, proxy }; +} +const normalizeProxyOptions = (input) => { + let proxyOptions; + if (typeof input === 'string') { + proxyOptions = new URL(input); + } + else { + proxyOptions = input; + } + if (proxyOptions == null) { + throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!'); + } + return proxyOptions; +}; +class SocksProxyAgent extends agent_base_1.Agent { + constructor(input, options) { + var _a; + const proxyOptions = normalizeProxyOptions(input); + super(proxyOptions); + const parsedProxy = parseSocksProxy(proxyOptions); + this.shouldLookup = parsedProxy.lookup; + this.proxy = parsedProxy.proxy; + this.tlsConnectionOptions = proxyOptions.tls != null ? proxyOptions.tls : {}; + this.timeout = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : null; + } + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + * + * @api protected + */ + callback(req, opts) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const { shouldLookup, proxy, timeout } = this; + let { host, port, lookup: lookupCallback } = opts; + if (host == null) { + throw new Error('No `host` defined!'); + } + if (shouldLookup) { + // Client-side DNS resolution for "4" and "5" socks proxy versions. + host = yield new Promise((resolve, reject) => { + // Use the request's custom lookup, if one was configured: + const lookupFn = lookupCallback !== null && lookupCallback !== void 0 ? lookupCallback : dns_1.default.lookup; + lookupFn(host, {}, (err, res) => { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + }); + } + const socksOpts = { + proxy, + destination: { host, port }, + command: 'connect', + timeout: timeout !== null && timeout !== void 0 ? timeout : undefined + }; + const cleanup = (tlsSocket) => { + req.destroy(); + socket.destroy(); + if (tlsSocket) + tlsSocket.destroy(); + }; + debug('Creating socks proxy connection: %o', socksOpts); + const { socket } = yield socks_1.SocksClient.createConnection(socksOpts); + debug('Successfully created socks proxy connection'); + if (timeout !== null) { + socket.setTimeout(timeout); + socket.on('timeout', () => cleanup()); + } + if (opts.secureEndpoint) { + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + const servername = (_a = opts.servername) !== null && _a !== void 0 ? _a : opts.host; + const tlsSocket = tls_1.default.connect(Object.assign(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername }), this.tlsConnectionOptions)); + tlsSocket.once('error', (error) => { + debug('socket TLS error', error.message); + cleanup(tlsSocket); + }); + return tlsSocket; + } + return socket; + }); + } +} +exports.SocksProxyAgent = SocksProxyAgent; +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; } -(function (createSocksProxyAgent) { - createSocksProxyAgent.SocksProxyAgent = agent_1.default; - createSocksProxyAgent.prototype = agent_1.default.prototype; -})(createSocksProxyAgent || (createSocksProxyAgent = {})); -module.exports = createSocksProxyAgent; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/index.js.map b/deps/npm/node_modules/socks-proxy-agent/dist/index.js.map index 23f3d1ce592b6c..e183e8e7a13ce0 100644 --- a/deps/npm/node_modules/socks-proxy-agent/dist/index.js.map +++ b/deps/npm/node_modules/socks-proxy-agent/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAIA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAcjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAjBS,qBAAqB,KAArB,qBAAqB,QAiB9B;AAED,iBAAS,qBAAqB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAmE;AACnE,2CAAiE;AAEjE,kDAA+B;AAE/B,8CAAqB;AAErB,8CAAqB;AAarB,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,mBAAmB,CAAC,CAAA;AAE9C,SAAS,eAAe,CAAE,IAA4B;;IACpD,IAAI,IAAI,GAAG,CAAC,CAAA;IACZ,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,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jD,MAAM;oBACN,UAAU,KACP,IAAI,CAAC,oBAAoB,EAC5B,CAAA;gBAEF,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBAChC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;oBACxC,OAAO,CAAC,SAAS,CAAC,CAAA;gBACpB,CAAC,CAAC,CAAA;gBAEF,OAAO,SAAS,CAAA;aACjB;YAED,OAAO,MAAM,CAAA;;KACd;CACF;AA7FD,0CA6FC;AAED,SAAS,IAAI,CACX,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAAgD,CAAA;IAC5D,IAAI,GAAqB,CAAA;IACzB,KAAK,GAAG,IAAI,GAAG,EAAE;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACvB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;SACpB;KACF;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"} \ No newline at end of file diff --git a/deps/npm/node_modules/socks-proxy-agent/package.json b/deps/npm/node_modules/socks-proxy-agent/package.json index 460043188eb255..268b8a5b187441 100644 --- a/deps/npm/node_modules/socks-proxy-agent/package.json +++ b/deps/npm/node_modules/socks-proxy-agent/package.json @@ -1,64 +1,177 @@ { "name": "socks-proxy-agent", - "version": "6.1.1", "description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS", - "main": "dist/index", - "typings": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "prebuild": "rimraf dist", - "build": "tsc", - "test": "mocha --reporter spec", - "test-lint": "eslint src --ext .js,.ts", - "prepublishOnly": "npm run build" + "homepage": "https://github.com/TooTallNate/node-socks-proxy-agent#readme", + "version": "6.2.0", + "main": "dist/index.js", + "author": { + "email": "nathan@tootallnate.net", + "name": "Nathan Rajlich", + "url": "http://n8.io/" }, + "contributors": [ + { + "name": "Kiko Beats", + "email": "josefrancisco.verdu@gmail.com" + }, + { + "name": "Josh Glazebrook", + "email": "josh@joshglazebrook.com" + }, + { + "name": "talmobi", + "email": "talmobi@users.noreply.github.com" + }, + { + "name": "Indospace.io", + "email": "justin@indospace.io" + }, + { + "name": "Kilian von Pflugk", + "email": "github@jumoog.io" + }, + { + "name": "Kyle", + "email": "admin@hk1229.cn" + }, + { + "name": "Matheus Fernandes", + "email": "matheus.frndes@gmail.com" + }, + { + "name": "Shantanu Sharma", + "email": "shantanu34@outlook.com" + }, + { + "name": "Tim Perry", + "email": "pimterry@gmail.com" + }, + { + "name": "Vadim Baryshev", + "email": "vadimbaryshev@gmail.com" + }, + { + "name": "jigu", + "email": "luo1257857309@gmail.com" + }, + { + "name": "Alba Mendez", + "email": "me@jmendeth.com" + }, + { + "name": "Дмитрий Гуденков", + "email": "Dimangud@rambler.ru" + }, + { + "name": "Andrei Bitca", + "email": "63638922+andrei-bitca-dc@users.noreply.github.com" + }, + { + "name": "Andrew Casey", + "email": "amcasey@users.noreply.github.com" + }, + { + "name": "Brandon Ros", + "email": "brandonros1@gmail.com" + }, + { + "name": "Dang Duy Thanh", + "email": "thanhdd.it@gmail.com" + }, + { + "name": "Dimitar Nestorov", + "email": "8790386+dimitarnestorov@users.noreply.github.com" + } + ], "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-socks-proxy-agent.git" }, + "bugs": { + "url": "https://github.com/TooTallNate/node-socks-proxy-agent/issues" + }, "keywords": [ + "agent", + "http", + "https", + "proxy", "socks", "socks4", "socks4a", "socks5", - "socks5h", - "proxy", - "http", - "https", - "agent" + "socks5h" ], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/node-socks-proxy-agent/issues" - }, "dependencies": { "agent-base": "^6.0.2", - "debug": "^4.3.1", - "socks": "^2.6.1" + "debug": "^4.3.3", + "socks": "^2.6.2" }, "devDependencies": { + "@commitlint/cli": "latest", + "@commitlint/config-conventional": "latest", "@types/debug": "latest", "@types/node": "latest", - "@typescript-eslint/eslint-plugin": "latest", - "@typescript-eslint/parser": "latest", - "eslint": "latest", - "eslint-config-airbnb": "latest", - "eslint-config-prettier": "latest", - "eslint-import-resolver-typescript": "latest", - "eslint-plugin-import": "latest", - "eslint-plugin-jsx-a11y": "latest", - "eslint-plugin-react": "latest", + "cacheable-lookup": "^6.0.4", + "conventional-github-releaser": "latest", + "dns2": "^2.0.1", + "finepack": "latest", + "git-authors-cli": "latest", "mocha": "latest", - "proxy": "latest", + "nano-staged": "latest", + "npm-check-updates": "latest", + "prettier-standard": "latest", "raw-body": "latest", "rimraf": "latest", - "socksv5": "TooTallNate/socksv5#fix/dstSock-close-event", + "simple-git-hooks": "latest", + "socksv5": "github:TooTallNate/socksv5#fix/dstSock-close-event", + "standard": "latest", + "standard-markdown": "latest", + "standard-version": "latest", + "ts-standard": "latest", "typescript": "latest" }, "engines": { "node": ">= 10" - } -} + }, + "files": [ + "dist" + ], + "license": "MIT", + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "nano-staged": { + "*.js": [ + "prettier-standard" + ], + "*.md": [ + "standard-markdown" + ], + "package.json": [ + "finepack" + ] + }, + "simple-git-hooks": { + "commit-msg": "npx commitlint --edit", + "pre-commit": "npx nano-staged" + }, + "typings": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "clean": "rimraf node_modules", + "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true", + "lint": "ts-standard", + "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)", + "prebuild": "rimraf dist", + "prerelease": "npm run update:check && npm run contributors", + "release": "standard-version -a", + "release:github": "conventional-github-releaser -p angular", + "release:tags": "git push --follow-tags origin HEAD:master", + "test": "mocha --reporter spec", + "update": "ncu -u", + "update:check": "ncu -- --error-level 2" + }, + "readme": "socks-proxy-agent\n================\n### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS\n[![Build Status](https://github.com/TooTallNate/node-socks-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-socks-proxy-agent/actions?workflow=Node+CI)\n\nThis module provides an `http.Agent` implementation that connects to a\nspecified SOCKS proxy server, and can be used with the built-in `http`\nand `https` modules.\n\nIt can also be used in conjunction with the `ws` module to establish a WebSocket\nconnection over a SOCKS proxy. See the \"Examples\" section below.\n\nInstallation\n------------\n\nInstall with `npm`:\n\n``` bash\nnpm install socks-proxy-agent\n```\n\n\nExamples\n--------\n\n#### TypeScript example\n\n```ts\nimport https from 'https';\nimport { SocksProxyAgent } from 'socks-proxy-agent';\n\nconst info = {\n\thostname: 'br41.nordvpn.com',\n\tuserId: 'your-name@gmail.com',\n\tpassword: 'abcdef12345124'\n};\nconst agent = new SocksProxyAgent(info);\n\nhttps.get('https://ipinfo.io', { agent }, (res) => {\n\tconsole.log(res.headers);\n\tres.pipe(process.stdout);\n});\n```\n\n#### `http` module example\n\n```js\nvar url = require('url');\nvar http = require('http');\nvar { SocksProxyAgent } = require('socks-proxy-agent');\n\n// SOCKS proxy to connect to\nvar proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';\nconsole.log('using proxy server %j', proxy);\n\n// HTTP endpoint for the proxy to connect to\nvar endpoint = process.argv[2] || 'http://nodejs.org/api/';\nconsole.log('attempting to GET %j', endpoint);\nvar opts = url.parse(endpoint);\n\n// create an instance of the `SocksProxyAgent` class with the proxy server information\nvar agent = new SocksProxyAgent(proxy);\nopts.agent = agent;\n\nhttp.get(opts, function (res) {\n\tconsole.log('\"response\" event!', res.headers);\n\tres.pipe(process.stdout);\n});\n```\n\n#### `https` module example\n\n```js\nvar url = require('url');\nvar https = require('https');\nvar { SocksProxyAgent } = require('socks-proxy-agent');\n\n// SOCKS proxy to connect to\nvar proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';\nconsole.log('using proxy server %j', proxy);\n\n// HTTP endpoint for the proxy to connect to\nvar endpoint = process.argv[2] || 'https://encrypted.google.com/';\nconsole.log('attempting to GET %j', endpoint);\nvar opts = url.parse(endpoint);\n\n// create an instance of the `SocksProxyAgent` class with the proxy server information\nvar agent = new SocksProxyAgent(proxy);\nopts.agent = agent;\n\nhttps.get(opts, function (res) {\n\tconsole.log('\"response\" event!', res.headers);\n\tres.pipe(process.stdout);\n});\n```\n\n#### `ws` WebSocket connection example\n\n``` js\nvar WebSocket = require('ws');\nvar { SocksProxyAgent } = require('socks-proxy-agent');\n\n// SOCKS proxy to connect to\nvar proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';\nconsole.log('using proxy server %j', proxy);\n\n// WebSocket endpoint for the proxy to connect to\nvar endpoint = process.argv[2] || 'ws://echo.websocket.org';\nconsole.log('attempting to connect to WebSocket %j', endpoint);\n\n// create an instance of the `SocksProxyAgent` class with the proxy server information\nvar agent = new SocksProxyAgent(proxy);\n\n// initiate the WebSocket connection\nvar socket = new WebSocket(endpoint, { agent: agent });\n\nsocket.on('open', function () {\n\tconsole.log('\"open\" event!');\n\tsocket.send('hello world');\n});\n\nsocket.on('message', function (data, flags) {\n\tconsole.log('\"message\" event! %j %j', data, flags);\n\tsocket.close();\n});\n```\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" +} \ No newline at end of file diff --git a/deps/npm/package.json b/deps/npm/package.json index d3e55ad623a432..e654f94102d9da 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "8.9.0", + "version": "8.10.0", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -90,7 +90,7 @@ "libnpmsearch": "^5.0.2", "libnpmteam": "^4.0.2", "libnpmversion": "^3.0.1", - "make-fetch-happen": "^10.1.2", + "make-fetch-happen": "^10.1.3", "minipass": "^3.1.6", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -200,7 +200,7 @@ ], "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.2", + "@npmcli/template-oss": "3.5.0", "licensee": "^8.2.0", "nock": "^13.2.4", "spawk": "^1.7.1", @@ -230,13 +230,18 @@ ], "color": 1, "files": "test/{lib,bin,index.js}", - "coverage-map": "test/coverage-map.js", - "timeout": 600 + "timeout": 600, + "nyc-arg": [ + "--exclude", + "workspaces/**", + "--exclude", + "tap-snapshots/**" + ] }, "templateOSS": { "rootRepo": false, "rootModule": false, - "version": "3.4.2" + "version": "3.5.0" }, "license": "Artistic-2.0", "engines": { diff --git a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs index 896991c32d99c3..095fd9b7886c21 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -103,6 +103,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "npm-version": "{NPM-VERSION}", "offline": false, "omit": [], + "omit-lockfile-registry-resolved": false, "only": null, "optional": null, "otp": null, @@ -257,6 +258,7 @@ noproxy = [""] npm-version = "{NPM-VERSION}" offline = false omit = [] +omit-lockfile-registry-resolved = false only = null optional = null otp = null diff --git a/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs index 9e27c4be47e1c1..bfa4b42182e1ea 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs @@ -9,12 +9,130 @@ exports[`test/lib/commands/search.js TAP empty search results > should have expe No matches found for "foo" ` -exports[`test/lib/commands/search.js TAP search --searchexclude --searchopts > should have filtered expected search results 1`] = ` -NAME | AUTHOR | DATE | VERSION | KEYWORDS -foo | =foo | prehistoric | 1.0.0 | +exports[`test/lib/commands/search.js TAP search //--color > should have expected search results with color 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +libnpmversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | ` -exports[`test/lib/commands/search.js TAP search > should have expected search results 1`] = ` -NAME | AUTHOR | DATE | VERSION | KEYWORDS -libnpm | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager liblibnpmaccess | =nlf… | 2020-11-03 | 4.0.1 | @evocateur/libnpmaccess | =evocateur | 2019-07-16 | 3.1.2 | @evocateur/libnpmpublish | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teamslibnpmsearch | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpmlibnpmteam | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm apilibnpmpublish | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund@npmcli/map-workspaces | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaceslibnpmversion | =nlf… | 2020-11-04 | 1.0.7 | @types/libnpmsearch | =types | 2019-09-26 | 2.0.1 | +exports[`test/lib/commands/search.js TAP search --color > should have expected search results with color 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 |  +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 |  +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 |  +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 |  +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +libnpmversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 |  +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 |  +` + +exports[`test/lib/commands/search.js TAP search --parseable > should have expected search results as parseable 1`] = ` +libnpm Collection of programmatic APIs for the npm CLI =nlf =ruyadorno =darcyclarke =isaacs 2019-07-16 3.0.1 npm api package manager lib +libnpmaccess programmatic library for \`npm access\` commands =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 4.0.1 libnpmaccess +@evocateur/libnpmaccess programmatic library for \`npm access\` commands =evocateur 2019-07-16 3.1.2 +@evocateur/libnpmpublish Programmatic API for the bits behind npm publish and unpublish =evocateur 2019-07-16 1.2.2 +libnpmorg Programmatic api for \`npm org\` commands =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 2.0.1 libnpm npm package manager api orgs teams +libnpmsearch Programmatic API for searching in npm and compatible registries. =nlf =ruyadorno =darcyclarke =isaacs 2020-12-08 3.1.0 npm search api libnpm +libnpmteam npm Team management APIs =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 2.0.2 +libnpmhook programmatic API for managing npm registry hooks =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 6.0.1 npm hooks registry npm api +libnpmpublish Programmatic API for the bits behind npm publish and unpublish =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 4.0.0 +libnpmfund Programmatic API for npm fund =nlf =ruyadorno =darcyclarke =isaacs 2020-12-08 1.0.2 npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces Retrieves a name:pathname Map for a given workspaces config =nlf =ruyadorno =darcyclarke =isaacs 2020-09-30 1.0.1 npm npmcli libnpm cli workspaces map-workspaces +libnpmversion library to do the things that 'npm version' does =nlf =ruyadorno =darcyclarke =isaacs 2020-11-04 1.0.7 +@types/libnpmsearch TypeScript definitions for libnpmsearch =types 2019-09-26 2.0.1 +` + +exports[`test/lib/commands/search.js TAP search > should have filtered expected search results 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +foo | | =foo | prehistoric | 1.0.0 | +libnpmversion | | =foo | prehistoric | 1.0.0 | +` + +exports[`test/lib/commands/search.js TAP search text > should have expected search results 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +libnpmversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +exports[`test/lib/commands/search.js TAP search exclude forward slash > results should not have libnpmversion 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +exports[`test/lib/commands/search.js TAP search exclude regex > results should not have libnpmversion 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +exports[`test/lib/commands/search.js TAP search exclude string > results should not have libnpmversion 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams +libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +exports[`test/lib/commands/search.js TAP search exclude username with upper case letters > results should not have nlf 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | ` diff --git a/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs index 5868e7b04babe3..d5b7a3b4a79068 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs @@ -5,96 +5,102 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/commands/view.js TAP should log info by field name array field - 1 element > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP deprecated package with license, bugs, repository and other fields > must match snapshot 1`] = ` -claudia -` +green@1.0.0 | ACME | deps: 2 | versions: 2 +green is a very important color -exports[`test/lib/commands/view.js TAP should log info by field name array field - 2 elements > must match snapshot 1`] = ` +DEPRECATED!! - true -maintainers[0].name = 'claudia' -maintainers[1].name = 'isaacs' -` +keywords:,colors, green, crayola -exports[`test/lib/commands/view.js TAP should log info by field name maintainers with email > must match snapshot 1`] = ` +bin:,green -{ - "maintainers": [ - { - "name": "claudia", - "email": "c@yellow.com", - "twitter": "cyellow" - }, - { - "name": "isaacs", - "email": "i@yellow.com", - "twitter": "iyellow" - } - ], - "name": "yellow" -} -` +dist +.tarball:,http://hm.green.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 GB + +dependencies: +red: 1.0.0 +yellow: 1.0.0 -exports[`test/lib/commands/view.js TAP should log info by field name maintainers with url > must match snapshot 1`] = ` +maintainers: +-,claudia <c@yellow.com> +-,isaacs <i@yellow.com> -[ - "claudia (http://c.pink.com)", - "isaacs (http://i.pink.com)" -] +dist-tags: +latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log info by field name nested field with brackets > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP deprecated package with unicode > must match snapshot 1`] = ` -"123" -` +green@1.0.0 | ACME | deps: 2 | versions: 2 +green is a very important color -exports[`test/lib/commands/view.js TAP should log info by field name readme > must match snapshot 1`] = ` +DEPRECATED ⚠️ - true -a very useful readme -` +keywords:,colors, green, crayola -exports[`test/lib/commands/view.js TAP should log info by field name several fields > must match snapshot 1`] = ` +bin:,green -{ - "name": "yellow", - "version": "1.0.0" -} -` +dist +.tarball:,http://hm.green.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 GB + +dependencies: +red: 1.0.0 +yellow: 1.0.0 -exports[`test/lib/commands/view.js TAP should log info by field name several fields with several versions > must match snapshot 1`] = ` +maintainers: +-,claudia <c@yellow.com> +-,isaacs <i@yellow.com> -yellow@1.0.0 'claudia' -yellow@1.0.1 'claudia' -yellow@1.0.2 'claudia' +dist-tags: +latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir directory > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP package from git > must match snapshot 1`] = ` + +green@1.0.0 | ACME | deps: 2 | versions: 2 +green is a very important color + +DEPRECATED!! - true +keywords:,colors, green, crayola -blue@1.0.0 | Proprietary | deps: none | versions: 2 +bin:,green dist -.tarball:http://hm.blue.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.green.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 GB + +dependencies: +red: 1.0.0 +yellow: 1.0.0 + +maintainers: +-,claudia <c@yellow.com> +-,isaacs <i@yellow.com> dist-tags: latest: 1.0.0 - -published {TIME} ago ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir non-specific version > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package in cwd directory > must match snapshot 1`] = ` blue@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.blue.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.blue.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 @@ -102,16 +108,15 @@ dist-tags: published {TIME} ago ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir specific version > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package in cwd non-specific version > must match snapshot 1`] = ` blue@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.blue.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.blue.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 @@ -119,38 +124,23 @@ dist-tags: published {TIME} ago ` -exports[`test/lib/commands/view.js TAP should log package info package from git > must match snapshot 1`] = ` - - -green@1.0.0 | ACME | deps: 2 | versions: 2 -green is a very important color - -DEPRECATED!! - true - -keywords:colors, green, crayola +exports[`test/lib/commands/view.js TAP package in cwd specific version > must match snapshot 1`] = ` -bin:green +blue@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.green.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B - -dependencies: -red: 1.0.0 -yellow: 1.0.0 - -maintainers: --claudia <c@yellow.com> --isaacs <i@yellow.com> +.tarball:,http://hm.blue.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 -` -exports[`test/lib/commands/view.js TAP should log package info package with --json and semver range > must match snapshot 1`] = ` +published {TIME} ago +` +exports[`test/lib/commands/view.js TAP package with --json and semver range > must match snapshot 1`] = ` [ { "_npmUser": "claudia ", @@ -168,7 +158,7 @@ exports[`test/lib/commands/view.js TAP should log package info package with --js "tarball": "http://hm.cyan.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000 } }, { @@ -185,77 +175,44 @@ exports[`test/lib/commands/view.js TAP should log package info package with --js ] ` -exports[`test/lib/commands/view.js TAP should log package info package with homepage > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with homepage > must match snapshot 1`] = ` orange@1.0.0 | Proprietary | deps: none | versions: 2 http://hm.orange.com dist -.tarball:http://hm.orange.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B - -dist-tags: -latest: 1.0.0 -` - -exports[`test/lib/commands/view.js TAP should log package info package with license, bugs, repository and other fields > must match snapshot 1`] = ` - - -green@1.0.0 | ACME | deps: 2 | versions: 2 -green is a very important color - -DEPRECATED!! - true - -keywords:colors, green, crayola - -bin:green - -dist -.tarball:http://hm.green.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B - -dependencies: -red: 1.0.0 -yellow: 1.0.0 - -maintainers: --claudia <c@yellow.com> --isaacs <i@yellow.com> +.tarball:,http://hm.orange.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log package info package with maintainers info as object > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with maintainers info as object > must match snapshot 1`] = ` pink@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.pink.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.pink.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log package info package with more than 25 deps > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with more than 25 deps > must match snapshot 1`] = ` black@1.0.0 | Proprietary | deps: 25 | versions: 2 dist -.tarball:http://hm.black.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.black.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dependencies: 0: 1.0.0 @@ -288,16 +245,15 @@ dist-tags: latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log package info package with no modified time > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with no modified time > must match snapshot 1`] = ` cyan@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.cyan.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.cyan.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 MB dist-tags: latest: 1.0.0 @@ -305,16 +261,15 @@ dist-tags: published by claudia <claudia@cyan.com> ` -exports[`test/lib/commands/view.js TAP should log package info package with no repo or homepage > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with no repo or homepage > must match snapshot 1`] = ` blue@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.blue.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.blue.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 @@ -322,16 +277,15 @@ dist-tags: published {TIME} ago ` -exports[`test/lib/commands/view.js TAP should log package info package with semver range > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package with semver range > must match snapshot 1`] = ` blue@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.blue.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.blue.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 @@ -341,10 +295,10 @@ published {TIME} ago blue@1.0.1 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.blue.com/1.0.1.tgz -.shasum:124 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.blue.com/1.0.1.tgz +.shasum:,124 +.integrity:,--- +.unpackedSize:,1.0 kB dist-tags: latest: 1.0.0 @@ -352,8 +306,47 @@ dist-tags: published over a year from now ` -exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP specific field names array field - 1 element > must match snapshot 1`] = ` +claudia +` + +exports[`test/lib/commands/view.js TAP specific field names array field - 2 elements > must match snapshot 1`] = ` +maintainers[0].name = 'claudia' +maintainers[1].name = 'isaacs' +` + +exports[`test/lib/commands/view.js TAP specific field names maintainers with email > must match snapshot 1`] = ` +maintainers = [ + { name: 'claudia', email: 'c@yellow.com', twitter: 'cyellow' }, + { name: 'isaacs', email: 'i@yellow.com', twitter: 'iyellow' } +] +name = 'yellow' +` + +exports[`test/lib/commands/view.js TAP specific field names maintainers with url > must match snapshot 1`] = ` +[ 'claudia (http://c.pink.com)', 'isaacs (http://i.pink.com)' ] +` + +exports[`test/lib/commands/view.js TAP specific field names nested field with brackets > must match snapshot 1`] = ` +123 +` + +exports[`test/lib/commands/view.js TAP specific field names readme > must match snapshot 1`] = ` +a very useful readme +` + +exports[`test/lib/commands/view.js TAP specific field names several fields > must match snapshot 1`] = ` +name = 'yellow' +version = '1.0.0' +` + +exports[`test/lib/commands/view.js TAP specific field names several fields with several versions > must match snapshot 1`] = ` +yellow@1.0.0 'claudia' +yellow@1.0.1 'claudia' +yellow@1.0.2 'claudia' +` +exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must match snapshot 1`] = ` { "green": { "_id": "green", @@ -406,7 +399,7 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must m "tarball": "http://hm.green.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000000 } }, "orange": { @@ -434,29 +427,28 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must m exports[`test/lib/commands/view.js TAP workspaces all workspaces > must match snapshot 1`] = ` - green@1.0.0 | ACME | deps: 2 | versions: 2 green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:,colors, green, crayola -bin:green +bin:,green dist -.tarball:http://hm.green.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.green.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 GB dependencies: red: 1.0.0 yellow: 1.0.0 maintainers: --claudia <c@yellow.com> --isaacs <i@yellow.com> +-,claudia <c@yellow.com> +-,isaacs <i@yellow.com> dist-tags: latest: 1.0.0 @@ -465,10 +457,10 @@ dist-tags: http://hm.orange.com dist -.tarball:http://hm.orange.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.orange.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 @@ -479,13 +471,11 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces nonexistent fie ` exports[`test/lib/commands/view.js TAP workspaces all workspaces nonexistent field > must match snapshot 1`] = ` - green: orange: ` exports[`test/lib/commands/view.js TAP workspaces all workspaces single field --json > must match snapshot 1`] = ` - { "green": "green", "orange": "orange" @@ -493,7 +483,6 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces single field -- ` exports[`test/lib/commands/view.js TAP workspaces all workspaces single field > must match snapshot 1`] = ` - green: green orange: @@ -502,55 +491,56 @@ orange exports[`test/lib/commands/view.js TAP workspaces one specific workspace > must match snapshot 1`] = ` - green@1.0.0 | ACME | deps: 2 | versions: 2 green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:,colors, green, crayola -bin:green +bin:,green dist -.tarball:http://hm.green.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.green.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1.0 GB dependencies: red: 1.0.0 yellow: 1.0.0 maintainers: --claudia <c@yellow.com> --isaacs <i@yellow.com> +-,claudia <c@yellow.com> +-,isaacs <i@yellow.com> dist-tags: latest: 1.0.0 ` exports[`test/lib/commands/view.js TAP workspaces remote package name > must match snapshot 1`] = ` -Ignoring workspaces for specified package(s) -` - -exports[`test/lib/commands/view.js TAP workspaces remote package name > must match snapshot 2`] = ` - pink@1.0.0 | Proprietary | deps: none | versions: 2 dist -.tarball:http://hm.pink.com/1.0.0.tgz -.shasum:123 -.integrity:--- -.unpackedSize:1 B +.tarball:,http://hm.pink.com/1.0.0.tgz +.shasum:,123 +.integrity:,--- +.unpackedSize:,1 B dist-tags: latest: 1.0.0 ` -exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP workspaces remote package name > should have warning of ignoring workspaces 1`] = ` +Array [ + Array [ + "Ignoring workspaces for specified package(s)", + ], +] +` +exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must match snapshot 1`] = ` { "green": { "_id": "green", @@ -603,7 +593,7 @@ exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must "tarball": "http://hm.green.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000000 } } } diff --git a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs index eccb06580d9f9e..20915cdd871317 100644 --- a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -81,10 +81,12 @@ exports[`test/lib/load-all-commands.js TAP load each command bugs > must match s Report bugs for a package in a web browser Usage: -npm bugs [] +npm bugs [ [ ...]] Options: [--no-browser|--browser ] [--registry ] +[-w|--workspace [-w|--workspace ...]] +[-ws|--workspaces] [--include-workspace-root] alias: issues @@ -727,7 +729,7 @@ Usage: npm repo [ [ ...]] Options: -[--no-browser|--browser ] +[--no-browser|--browser ] [--registry ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -828,7 +830,7 @@ Usage: npm star [...] Options: -[--registry ] [--unicode] +[--registry ] [--unicode] [--otp ] Run "npm help star" for more info ` diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index 42db6ce030b537..c31a6b7dc7e671 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -97,6 +97,7 @@ Array [ "npm-version", "offline", "omit", + "omit-lockfile-registry-resolved", "only", "optional", "otp", @@ -1239,6 +1240,18 @@ If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\` environment variable will be set to \`'production'\` for all lifecycle scripts. ` +exports[`test/lib/utils/config/definitions.js TAP > config description for omit-lockfile-registry-resolved 1`] = ` +#### \`omit-lockfile-registry-resolved\` + +* Default: false +* Type: Boolean + +This option causes npm to create lock files without a \`resolved\` key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time. +` + exports[`test/lib/utils/config/definitions.js TAP > config description for only 1`] = ` #### \`only\` diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index d0ce3a26f764ff..0ec2ca17a4ef1f 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -1051,6 +1051,19 @@ variable will be set to \`'production'\` for all lifecycle scripts. +#### \`omit-lockfile-registry-resolved\` + +* Default: false +* Type: Boolean + +This option causes npm to create lock files without a \`resolved\` key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time. + + + + #### \`otp\` * Default: null diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs index f1cba9264ee2ff..78055d5bc720b3 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs @@ -61,6 +61,9 @@ Object { "help": Array [ "--usage", ], + "iwr": Array [ + "--include-workspace-root", + ], "l": Array [ "--long", ], diff --git a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index bbb3563405da19..8d7dbfedc35682 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -223,10 +223,12 @@ All commands: bugs Report bugs for a package in a web browser Usage: - npm bugs [] + npm bugs [ [ ...]] Options: [--no-browser|--browser ] [--registry ] + [-w|--workspace [-w|--workspace ...]] + [-ws|--workspaces] [--include-workspace-root] alias: issues @@ -777,7 +779,7 @@ All commands: npm repo [ [ ...]] Options: - [--no-browser|--browser ] + [--no-browser|--browser ] [--registry ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -862,7 +864,7 @@ All commands: npm star [...] Options: - [--registry ] [--unicode] + [--registry ] [--unicode] [--otp ] Run "npm help star" for more info diff --git a/deps/npm/test/coverage-map.js b/deps/npm/test/coverage-map.js deleted file mode 100644 index 9a289b6489e3e4..00000000000000 --- a/deps/npm/test/coverage-map.js +++ /dev/null @@ -1,26 +0,0 @@ -const coverageMap = (filename) => { - const { basename } = require('path') - const testbase = basename(filename) - if (filename === 'test/index.js') { - return ['index.js'] - } - if (testbase === 'load-all-commands.js') { - const { cmdList } = require('../lib/utils/cmd-list.js') - return cmdList.map(cmd => `lib/${cmd}.js`) - .concat('lib/base-command.js') - } - if (/^test\/lib\/commands/.test(filename) || filename === 'test/lib/npm.js') { - return [ - filename.replace(/^test\//, ''), - 'lib/npm.js', - 'lib/base-command.js', - 'lib/exec/get-workspace-location-msg.js', - ] - } - if (/^test\/(lib|bin)\//.test(filename)) { - return filename.replace(/^test\//, '') - } - return [] -} - -module.exports = coverageMap diff --git a/deps/npm/test/fixtures/libnpmsearch-stream-result.js b/deps/npm/test/fixtures/libnpmsearch-stream-result.js index 4d3aca396fbca4..b2ec20f59efebc 100644 --- a/deps/npm/test/fixtures/libnpmsearch-stream-result.js +++ b/deps/npm/test/fixtures/libnpmsearch-stream-result.js @@ -5,7 +5,7 @@ module.exports = [ version: '3.0.1', description: 'Collection of programmatic APIs for the npm CLI', keywords: ['npm', 'api', 'package manager', 'lib'], - date: new Date('2019-07-16T17:50:00.572Z'), + date: '2019-07-16T17:50:00.572Z', links: { npm: 'https://www.npmjs.com/package/libnpm', homepage: 'https://github.com/npm/libnpm#readme', @@ -26,7 +26,8 @@ module.exports = [ scope: 'unscoped', version: '4.0.1', description: 'programmatic library for `npm access` commands', - date: new Date('2020-11-03T19:19:00.526Z'), + keywords: 'libnpmaccess', + date: '2020-11-03T19:19:00.526Z', links: { npm: 'https://www.npmjs.com/package/libnpmaccess', homepage: 'https://npmjs.com/package/libnpmaccess', @@ -47,7 +48,7 @@ module.exports = [ scope: 'evocateur', version: '3.1.2', description: 'programmatic library for `npm access` commands', - date: new Date('2019-07-16T19:43:33.959Z'), + date: '2019-07-16T19:43:33.959Z', links: { npm: 'https://www.npmjs.com/package/%40evocateur%2Flibnpmaccess', homepage: 'https://npmjs.com/package/@evocateur/libnpmaccess', @@ -63,7 +64,7 @@ module.exports = [ scope: 'evocateur', version: '1.2.2', description: 'Programmatic API for the bits behind npm publish and unpublish', - date: new Date('2019-07-16T19:40:40.850Z'), + date: '2019-07-16T19:40:40.850Z', links: { npm: 'https://www.npmjs.com/package/%40evocateur%2Flibnpmpublish', homepage: 'https://npmjs.com/package/@evocateur/libnpmpublish', @@ -80,7 +81,7 @@ module.exports = [ version: '2.0.1', description: 'Programmatic api for `npm org` commands', keywords: ['libnpm', 'npm', 'package manager', 'api', 'orgs', 'teams'], - date: new Date('2020-11-03T19:21:57.757Z'), + date: '2020-11-03T19:21:57.757Z', links: { npm: 'https://www.npmjs.com/package/libnpmorg', homepage: 'https://npmjs.com/package/libnpmorg', @@ -102,7 +103,7 @@ module.exports = [ version: '3.1.0', description: 'Programmatic API for searching in npm and compatible registries.', keywords: ['npm', 'search', 'api', 'libnpm'], - date: new Date('2020-12-08T23:54:18.374Z'), + date: '2020-12-08T23:54:18.374Z', links: { npm: 'https://www.npmjs.com/package/libnpmsearch', homepage: 'https://npmjs.com/package/libnpmsearch', @@ -123,7 +124,7 @@ module.exports = [ scope: 'unscoped', version: '2.0.2', description: 'npm Team management APIs', - date: new Date('2020-11-03T19:24:42.380Z'), + date: '2020-11-03T19:24:42.380Z', links: { npm: 'https://www.npmjs.com/package/libnpmteam', homepage: 'https://npmjs.com/package/libnpmteam', @@ -145,7 +146,7 @@ module.exports = [ version: '6.0.1', description: 'programmatic API for managing npm registry hooks', keywords: ['npm', 'hooks', 'registry', 'npm api'], - date: new Date('2020-11-03T19:20:45.818Z'), + date: '2020-11-03T19:20:45.818Z', links: { npm: 'https://www.npmjs.com/package/libnpmhook', homepage: 'https://github.com/npm/libnpmhook#readme', @@ -166,7 +167,7 @@ module.exports = [ scope: 'unscoped', version: '4.0.0', description: 'Programmatic API for the bits behind npm publish and unpublish', - date: new Date('2020-11-03T19:13:43.780Z'), + date: '2020-11-03T19:13:43.780Z', links: { npm: 'https://www.npmjs.com/package/libnpmpublish', homepage: 'https://npmjs.com/package/libnpmpublish', @@ -193,7 +194,7 @@ module.exports = [ 'git', 'fund', 'gitfund', ], - date: new Date('2020-12-08T23:22:00.213Z'), + date: '2020-12-08T23:22:00.213Z', links: { npm: 'https://www.npmjs.com/package/libnpmfund', homepage: 'https://github.com/npm/libnpmfund#readme', @@ -222,7 +223,7 @@ module.exports = [ 'workspaces', 'map-workspaces', ], - date: new Date('2020-09-30T15:16:29.017Z'), + date: '2020-09-30T15:16:29.017Z', links: { npm: 'https://www.npmjs.com/package/%40npmcli%2Fmap-workspaces', homepage: 'https://github.com/npm/map-workspaces#readme', @@ -243,7 +244,7 @@ module.exports = [ scope: 'unscoped', version: '1.0.7', description: "library to do the things that 'npm version' does", - date: new Date('2020-11-04T00:21:41.069Z'), + date: '2020-11-04T00:21:41.069Z', links: { npm: 'https://www.npmjs.com/package/libnpmversion', homepage: 'https://github.com/npm/libnpmversion#readme', @@ -269,7 +270,7 @@ module.exports = [ scope: 'types', version: '2.0.1', description: 'TypeScript definitions for libnpmsearch', - date: new Date('2019-09-26T22:24:28.713Z'), + date: '2019-09-26T22:24:28.713Z', links: { npm: 'https://www.npmjs.com/package/%40types%2Flibnpmsearch' }, publisher: { username: 'types', email: 'ts-npm-types@microsoft.com' }, maintainers: [{ username: 'types', email: 'ts-npm-types@microsoft.com' }], diff --git a/deps/npm/test/fixtures/mock-registry.js b/deps/npm/test/fixtures/mock-registry.js index 5890fa7ee93661..a62890b72e2f62 100644 --- a/deps/npm/test/fixtures/mock-registry.js +++ b/deps/npm/test/fixtures/mock-registry.js @@ -46,6 +46,19 @@ class MockRegistry { this.#nock = nock } + search ({ responseCode = 200, results = [], error }) { + // the flags, score, and searchScore parts of the response are never used + // by npm, only package is used + const response = results.map(p => ({ package: p })) + this.nock = this.nock.get('/-/v1/search').query(true) + if (error) { + this.nock = this.nock.replyWithError(error) + } else { + this.nock = this.nock.reply(responseCode, { objects: response }) + } + return this.nock + } + whoami ({ username, body, responseCode = 200, times = 1 }) { if (username) { this.nock = this.nock.get('/-/whoami').times(times).reply(responseCode, { username }) @@ -170,6 +183,15 @@ class MockRegistry { } } + star (manifest, users) { + const spec = npa(manifest.name) + this.nock = this.nock.put(`/${spec.escapedName}`, { + _id: manifest._id, + _rev: manifest._rev, + users, + }).reply(200, { ...manifest, users }) + } + async package ({ manifest, times = 1, query, tarballs }) { let nock = this.nock const spec = npa(manifest.name) @@ -193,7 +215,7 @@ class MockRegistry { // either pass in packuments if you need to set specific attributes besides version, // or an array of versions // the last packument in the packuments or versions array will be tagged latest - manifest ({ name = 'test-package', packuments, versions } = {}) { + manifest ({ name = 'test-package', users, packuments, versions } = {}) { packuments = this.packuments(packuments, name) const latest = packuments.slice(-1)[0] const manifest = { @@ -207,6 +229,9 @@ class MockRegistry { 'dist-tags': { latest: latest.version }, ...latest, } + if (users) { + manifest.users = users + } if (versions) { packuments = versions.map(version => ({ version })) } diff --git a/deps/npm/test/lib/commands/deprecate.js b/deps/npm/test/lib/commands/deprecate.js index 03177cb7be0b9d..8a925fc2a6a73a 100644 --- a/deps/npm/test/lib/commands/deprecate.js +++ b/deps/npm/test/lib/commands/deprecate.js @@ -85,7 +85,7 @@ t.test('undeprecate', async t => { name: 'foo', versions, }) - registry.package({ manifest, query: { write: true } }) + await registry.package({ manifest, query: { write: true } }) registry.nock.put('/foo', body => { for (const version of versions) { if (body.versions[version].deprecated !== '') { @@ -110,7 +110,7 @@ t.test('deprecates given range', async t => { name: 'foo', versions, }) - registry.package({ manifest, query: { write: true } }) + await registry.package({ manifest, query: { write: true } }) const message = 'test deprecation message' registry.nock.put('/foo', body => { if (body.versions['1.0.1'].deprecated) { @@ -136,7 +136,7 @@ t.test('deprecates all versions when no range is specified', async t => { name: 'foo', versions, }) - registry.package({ manifest, query: { write: true } }) + await registry.package({ manifest, query: { write: true } }) const message = 'test deprecation message' registry.nock.put('/foo', body => { for (const version of versions) { diff --git a/deps/npm/test/lib/commands/docs.js b/deps/npm/test/lib/commands/docs.js index a3b31bd70656d1..b2a65786bf4d8e 100644 --- a/deps/npm/test/lib/commands/docs.js +++ b/deps/npm/test/lib/commands/docs.js @@ -35,6 +35,13 @@ const pkgDirs = t.testdir({ repository: { url: 'https://github.com/foo/repoobj' }, }), }, + repourlobj: { + 'package.json': JSON.stringify({ + name: 'repourlobj', + version: '1.2.3', + repository: { url: { works: false } }, + }), + }, workspaces: { 'package.json': JSON.stringify({ name: 'workspaces-test', @@ -81,14 +88,13 @@ const docs = new Docs(npm) t.afterEach(() => opened = {}) t.test('open docs urls', t => { - // XXX It is very odd that `where` is how pacote knows to look anywhere other - // than the cwd. I would think npm.localPrefix would factor in somehow - flatOptions.where = pkgDirs + npm.localPrefix = pkgDirs const expect = { nodocs: 'https://www.npmjs.com/package/nodocs', docsurl: 'https://bugzilla.localhost/docsurl', repourl: 'https://github.com/foo/repourl#readme', repoobj: 'https://github.com/foo/repoobj#readme', + repourlobj: 'https://www.npmjs.com/package/repourlobj', '.': 'https://example.com', } const keys = Object.keys(expect) @@ -110,7 +116,6 @@ t.test('open default package if none specified', async t => { }) t.test('workspaces', (t) => { - flatOptions.where = undefined npm.localPrefix = join(pkgDirs, 'workspaces') t.test('all workspaces', async t => { await docs.execWorkspaces([], []) diff --git a/deps/npm/test/lib/commands/owner.js b/deps/npm/test/lib/commands/owner.js index 800d5b96a58763..f8ab7feef5be78 100644 --- a/deps/npm/test/lib/commands/owner.js +++ b/deps/npm/test/lib/commands/owner.js @@ -46,7 +46,7 @@ function registryPackage (t, registry, name) { name, packuments: [{ maintainers, version: '1.0.0' }], }) - mockRegistry.package({ manifest }) + return mockRegistry.package({ manifest }) } t.test('owner no args', async t => { @@ -73,7 +73,7 @@ t.test('owner ls no args', async t => { name: packageName, packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) await npm.exec('owner', ['ls']) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) @@ -137,7 +137,7 @@ t.test('owner ls ', async t => { name: packageName, packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) await npm.exec('owner', ['ls', packageName]) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) @@ -153,7 +153,7 @@ t.test('owner ls no maintainers', async t => { name: packageName, versions: ['1.0.0'], }) - registry.package({ manifest }) + await registry.package({ manifest }) await npm.exec('owner', ['ls', packageName]) t.equal(joinedOutput(), 'no admin found') @@ -173,7 +173,7 @@ t.test('owner add ', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { t.match(body, { _id: manifest._id, @@ -206,7 +206,7 @@ t.test('owner add cwd package', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { t.match(body, { _id: manifest._id, @@ -236,7 +236,7 @@ t.test('owner add already an owner', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) await npm.exec('owner', ['add', username, packageName]) t.equal(joinedOutput(), '') t.match( @@ -273,7 +273,7 @@ t.test('owner add fails to PUT updates', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`).reply(404, {}) await t.rejects( npm.exec('owner', ['add', username, packageName]), @@ -295,7 +295,7 @@ t.test('owner add no previous maintainers property from server', as packuments: [{ maintainers: undefined, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { t.match(body, { _id: manifest._id, @@ -351,7 +351,7 @@ t.test('owner rm ', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { t.match(body, { _id: manifest._id, @@ -378,7 +378,7 @@ t.test('owner rm not a current owner', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) await npm.exec('owner', ['rm', username, packageName]) t.match(logs.info, [['owner rm', `Not a package owner: ${username}`]]) }) @@ -400,7 +400,7 @@ t.test('owner rm cwd package', async t => { packuments: [{ maintainers, version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { t.match(body, { _id: manifest._id, @@ -430,7 +430,7 @@ t.test('owner rm only user', async t => { packuments: [{ maintainers: maintainers.slice(0, 1), version: '1.0.0' }], }) registry.couchuser({ username }) - registry.package({ manifest }) + await registry.package({ manifest }) await t.rejects( npm.exec('owner', ['rm', username]), { @@ -486,7 +486,7 @@ t.test('workspaces', async t => { 'process.cwd': () => path.join(prefix, 'workspace-a'), }), }) - registryPackage(t, npm.config.get('registry'), 'workspace-a') + await registryPackage(t, npm.config.get('registry'), 'workspace-a') await npm.exec('owner', ['ls']) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) }) @@ -499,7 +499,7 @@ t.test('workspaces', async t => { }), }) npm.config.set('workspace', ['workspace-a']) - registryPackage(t, npm.config.get('registry'), 'workspace-a') + await registryPackage(t, npm.config.get('registry'), 'workspace-a') await npm.exec('owner', ['ls']) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) }) @@ -511,7 +511,7 @@ t.test('workspaces', async t => { 'process.cwd': () => path.join(prefix, 'workspace-a'), }), }) - registryPackage(t, npm.config.get('registry'), packageName) + await registryPackage(t, npm.config.get('registry'), packageName) await npm.exec('owner', ['ls', packageName]) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) }) @@ -524,7 +524,7 @@ t.test('workspaces', async t => { }), }) npm.config.set('workspace', ['workspace-a']) - registryPackage(t, npm.config.get('registry'), packageName) + await registryPackage(t, npm.config.get('registry'), packageName) await npm.exec('owner', ['ls', packageName]) t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) }) @@ -543,7 +543,7 @@ t.test('workspaces', async t => { name: 'workspace-a', packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.couchuser({ username }) registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { t.match(body, { @@ -572,7 +572,7 @@ t.test('workspaces', async t => { name: 'workspace-a', packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.couchuser({ username }) registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { t.match(body, { @@ -603,7 +603,7 @@ t.test('workspaces', async t => { name: 'workspace-a', packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) registry.couchuser({ username }) registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { t.match(body, { @@ -649,7 +649,7 @@ t.test('completion', async t => { name: packageName, packuments: [{ maintainers, version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) t.strictSame(res, maintainers.map(m => m.name), 'should return list of current owners') }) @@ -683,7 +683,7 @@ t.test('completion', async t => { name: packageName, packuments: [{ maintainers: [], version: '1.0.0' }], }) - registry.package({ manifest }) + await registry.package({ manifest }) const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) t.strictSame(res, [], 'should return no owners if not found') diff --git a/deps/npm/test/lib/commands/search.js b/deps/npm/test/lib/commands/search.js index d2462b1aed4ccf..f18fcc475a99cb 100644 --- a/deps/npm/test/lib/commands/search.js +++ b/deps/npm/test/lib/commands/search.js @@ -1,169 +1,92 @@ const t = require('tap') -const Minipass = require('minipass') -const { fake: mockNpm } = require('../../fixtures/mock-npm') +const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') +const MockRegistry = require('../../fixtures/mock-registry.js') const libnpmsearchResultFixture = require('../../fixtures/libnpmsearch-stream-result.js') -let result = '' -const flatOptions = { - search: { - exclude: null, - limit: 20, - opts: '', - }, -} -const config = { - json: false, - parseable: false, -} -const npm = mockNpm({ - config, - flatOptions: { ...flatOptions }, - output: (...msg) => { - result += msg.join('\n') - }, -}) -const npmlog = { - silly () {}, - clearProgress () {}, -} -const libnpmsearch = { - stream () {}, -} -const mocks = { - npmlog, - libnpmsearch, -} - -t.afterEach(() => { - result = '' - config.json = false - config.parseable = false - npm.flatOptions = { ...flatOptions } -}) - -const Search = t.mock('../../../lib/commands/search.js', mocks) -const search = new Search(npm) - t.test('no args', async t => { + const { npm } = await loadMockNpm(t) await t.rejects( - search.exec([]), + npm.exec('search', []), /search must be called with arguments/, 'should throw usage instructions' ) }) -t.test('search ', async t => { - const src = new Minipass() - src.objectMode = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, +t.test('search text', async t => { + const { npm, joinedOutput } = await loadMockNpm(t) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - for (const i of libnpmsearchResultFixture) { - src.write(i) - } - - src.end() - - await search.exec(['libnpm']) - t.matchSnapshot(result, 'should have expected search results') + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'should have expected search results') }) t.test('search --json', async t => { - const src = new Minipass() - src.objectMode = true - - npm.flatOptions.json = true - config.json = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, + const { npm, joinedOutput } = await loadMockNpm(t, { config: { json: true } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - for (const i of libnpmsearchResultFixture) { - src.write(i) - } + registry.search({ results: libnpmsearchResultFixture }) - src.end() - await search.exec(['libnpm']) - - const parsedResult = JSON.parse(result) - parsedResult.forEach((entry) => { - entry.date = new Date(entry.date) - }) + await npm.exec('search', ['libnpm']) t.same( - parsedResult, + JSON.parse(joinedOutput()), libnpmsearchResultFixture, 'should have expected search results as json' ) +}) - config.json = false +t.test('search --parseable', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { parseable: true } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'should have expected search results as parseable') }) -t.test('search --json', async t => { - const src = new Minipass() - src.objectMode = true - - npm.flatOptions.json = true - config.json = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, +t.test('search --color', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { color: 'always' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - src.end() - await search.exec(['foo']) + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'should have expected search results with color') +}) - t.equal(result, '\n[]\n', 'should have expected empty square brackets') +t.test('search //--color', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { color: 'always' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) - config.json = false + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['/libnpm/']) + t.matchSnapshot(joinedOutput(), 'should have expected search results with color') }) -t.test('search --searchexclude --searchopts', async t => { - npm.flatOptions.search = { - ...flatOptions.search, - exclude: '', - } - - const src = new Minipass() - src.objectMode = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, +t.test('search ', async t => { + const { npm, joinedOutput } = await loadMockNpm(t) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - src.write({ + registry.search({ results: [{ name: 'foo', scope: 'unscoped', version: '1.0.0', @@ -175,8 +98,7 @@ t.test('search --searchexclude --searchopts', async t => { maintainers: [ { username: 'foo', email: 'foo@npmjs.com' }, ], - }) - src.write({ + }, { name: 'libnpmversion', scope: 'unscoped', version: '1.0.0', @@ -188,58 +110,100 @@ t.test('search --searchexclude --searchopts', async t => { maintainers: [ { username: 'foo', email: 'foo@npmjs.com' }, ], - }) + }] }) - src.end() - await search.exec(['foo']) + await npm.exec('search', ['foo']) - t.matchSnapshot(result, 'should have filtered expected search results') + t.matchSnapshot(joinedOutput(), 'should have filtered expected search results') }) t.test('empty search results', async t => { - const src = new Minipass() - src.objectMode = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, + const { npm, joinedOutput } = await loadMockNpm(t) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - src.end() - await search.exec(['foo']) + registry.search({ results: [] }) + await npm.exec('search', ['foo']) - t.matchSnapshot(result, 'should have expected search results') + t.matchSnapshot(joinedOutput(), 'should have expected search results') }) -t.test('search api response error', async t => { - const src = new Minipass() - src.objectMode = true - const libnpmsearch = { - stream () { - return src - }, - } - - const Search = t.mock('../../../lib/commands/search.js', { - ...mocks, - libnpmsearch, +t.test('empty search results --json', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { json: true } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - const search = new Search(npm) - setImmediate(() => { - src.emit('error', new Error('ERR')) - src.end() + registry.search({ results: [] }) + + await npm.exec('search', ['foo']) + t.equal(joinedOutput(), '\n[]\n', 'should have expected empty square brackets') +}) + +t.test('search api response error', async t => { + const { npm } = await loadMockNpm(t) + + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) + registry.search({ error: 'ERR' }) + await t.rejects( - search.exec(['foo']), + npm.exec('search', ['foo']), /ERR/, 'should throw response error' ) }) + +t.test('search exclude string', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { searchexclude: 'libnpmversion' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'results should not have libnpmversion') +}) + +t.test('search exclude username with upper case letters', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { searchexclude: 'NLF' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'results should not have nlf') +}) + +t.test('search exclude regex', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { searchexclude: '/version/' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'results should not have libnpmversion') +}) + +t.test('search exclude forward slash', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { config: { searchexclude: '/version' } }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + registry.search({ results: libnpmsearchResultFixture }) + await npm.exec('search', ['libnpm']) + t.matchSnapshot(joinedOutput(), 'results should not have libnpmversion') +}) diff --git a/deps/npm/test/lib/commands/star.js b/deps/npm/test/lib/commands/star.js index 5b79c077696283..ce9d258be1855f 100644 --- a/deps/npm/test/lib/commands/star.js +++ b/deps/npm/test/lib/commands/star.js @@ -1,133 +1,61 @@ const t = require('tap') -const { fake: mockNpm } = require('../../fixtures/mock-npm') +const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') +const MockRegistry = require('../../fixtures/mock-registry.js') -let result = '' - -const noop = () => null -const config = { - unicode: false, - 'star.unstar': false, -} -const npm = mockNpm({ - config, - output: (...msg) => { - result += msg.join('\n') - }, -}) -const npmFetch = { json: noop } -const log = { error: noop, info: noop, verbose: noop } -const mocks = { - 'proc-log': log, - 'npm-registry-fetch': npmFetch, - '../../../lib/utils/get-identity.js': async () => 'foo', -} - -const Star = t.mock('../../../lib/commands/star.js', mocks) -const star = new Star(npm) - -t.afterEach(() => { - config.unicode = false - config['star.unstar'] = false - log.info = noop - result = '' -}) +const pkgName = '@npmcli/test-package' +const authToken = 'test-auth-token' +const username = 'test-user' +const auth = { '//registry.npmjs.org/:_authToken': authToken } t.test('no args', async t => { + const { npm } = await loadMockNpm(t) await t.rejects( - star.exec([]), + npm.exec('star', []), { code: 'EUSAGE' }, 'should throw usage error' ) }) -t.test('star a package', async t => { - t.plan(4) - const pkgName = '@npmcli/arborist' - npmFetch.json = async (uri, opts) => { - return { - _id: pkgName, - _rev: 'hash', - users: ( - opts.method === 'PUT' - ? { foo: true } - : {} - ), - } - } - log.info = (title, msg, id) => { - t.equal(title, 'star', 'should use expected title') - t.equal(msg, 'starring', 'should use expected msg') - t.equal(id, pkgName, 'should use expected id') - } - await star.exec([pkgName]) - t.equal( - result, - '(*) @npmcli/arborist', - 'should output starred package msg' - ) -}) +t.test('first person to star a package unicode:false', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { unicode: false, ...auth }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: authToken, + }) + const manifest = registry.manifest({ name: pkgName }) + await registry.package({ manifest, query: { write: true } }) + registry.whoami({ username }) + registry.star(manifest, { [username]: true }) -t.test('unstar a package', async t => { - t.plan(4) - const pkgName = '@npmcli/arborist' - config['star.unstar'] = true - npmFetch.json = async (uri, opts) => { - return { - _id: pkgName, - _rev: 'hash', - ...(opts.method === 'PUT' - ? {} - : { foo: true } - ), - } - } - log.info = (title, msg, id) => { - t.equal(title, 'unstar', 'should use expected title') - t.equal(msg, 'unstarring', 'should use expected msg') - t.equal(id, pkgName, 'should use expected id') - } - await star.exec([pkgName]) + await npm.exec('star', [pkgName]) t.equal( - result, - '( ) @npmcli/arborist', - 'should output unstarred package msg' + joinedOutput(), + '(*) @npmcli/test-package', + 'should output starred package msg' ) }) -t.test('unicode', async t => { - t.test('star a package', async t => { - config.unicode = true - npmFetch.json = async (uri, opts) => ({}) - await star.exec(['pkg']) - t.equal( - result, - '\u2605 pkg', - 'should output unicode starred package msg' - ) +t.test('second person to star a package unicode:true', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { unicode: true, ...auth }, }) - - t.test('unstar a package', async t => { - config.unicode = true - config['star.unstar'] = true - npmFetch.json = async (uri, opts) => ({}) - await star.exec(['pkg']) - t.equal( - result, - '\u2606 pkg', - 'should output unstarred package msg' - ) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: authToken, }) -}) + const manifest = registry.manifest({ name: pkgName, users: { otheruser: true } }) + await registry.package({ manifest, query: { write: true } }) + registry.whoami({ username }) + registry.star(manifest, { otheruser: true, [username]: true }) -t.test('logged out user', async t => { - const Star = t.mock('../../../lib/commands/star.js', { - ...mocks, - '../../../lib/utils/get-identity.js': async () => undefined, - }) - const star = new Star(npm) - await t.rejects( - star.exec(['@npmcli/arborist']), - /You need to be logged in/, - 'should throw login required error' + await npm.exec('star', [pkgName]) + t.equal( + joinedOutput(), + '★ @npmcli/test-package', + 'should output starred package msg' ) }) diff --git a/deps/npm/test/lib/commands/unstar.js b/deps/npm/test/lib/commands/unstar.js index fb3c269b7bbdd1..85c33d27935639 100644 --- a/deps/npm/test/lib/commands/unstar.js +++ b/deps/npm/test/lib/commands/unstar.js @@ -1,29 +1,62 @@ const t = require('tap') +const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') +const MockRegistry = require('../../fixtures/mock-registry.js') -t.test('unstar', async t => { - t.plan(3) +const pkgName = '@npmcli/test-package' +const authToken = 'test-auth-token' +const username = 'test-user' +const auth = { '//registry.npmjs.org/:_authToken': authToken } - class Star { - constructor (npm) { - this.npm = npm - } +t.test('no args', async t => { + const { npm } = await loadMockNpm(t) + await t.rejects( + npm.exec('unstar', []), + { code: 'EUSAGE' }, + 'should throw usage error' + ) +}) + +t.test('unstar a package unicode:false', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { unicode: false, ...auth }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: authToken, + }) + const manifest = registry.manifest({ name: pkgName, users: { [username]: true } }) + await registry.package({ manifest, query: { write: true } }) + registry.whoami({ username }) + registry.star(manifest, {}) + + await npm.exec('unstar', [pkgName]) + t.equal( + joinedOutput(), + '( ) @npmcli/test-package', + 'should output unstarred package msg' + ) +}) - async exec (args) { - t.same(args, ['pkg'], 'should forward packages') - } - } - const Unstar = t.mock('../../../lib/commands/unstar.js', { - '../../../lib/commands/star.js': Star, +t.test('unstar a package unicode:true', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { unicode: true, ...auth }, }) - const unstar = new Unstar({ - config: { - set: (key, value) => { - t.equal(key, 'star.unstar', 'should set unstar config value') - t.equal(value, true, 'should set a truthy value') - }, - }, + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: authToken, }) + const manifest = registry.manifest({ name: pkgName, users: { [username]: true } }) + await registry.package({ manifest, query: { write: true } }) + registry.whoami({ username }) + registry.star(manifest, {}) - await unstar.exec(['pkg']) + await npm.exec('unstar', [pkgName]) + t.equal( + joinedOutput(), + '☆ @npmcli/test-package', + 'should output unstarred package msg' + ) }) diff --git a/deps/npm/test/lib/commands/view.js b/deps/npm/test/lib/commands/view.js index 82be1201ee1699..da823db5d75072 100644 --- a/deps/npm/test/lib/commands/view.js +++ b/deps/npm/test/lib/commands/view.js @@ -1,4 +1,5 @@ const t = require('tap') +const { load: _loadMockNpm } = require('../../fixtures/mock-npm.js') t.cleanSnapshot = str => str .replace(/(published ).*?( ago)/g, '$1{TIME}$2') @@ -6,18 +7,6 @@ t.cleanSnapshot = str => str // run the same as tap does when running directly with node process.stdout.columns = undefined -const { fake: mockNpm } = require('../../fixtures/mock-npm') - -let logs -const cleanLogs = () => { - logs = '' - const fn = (...args) => { - logs += '\n' - args.map(el => logs += el) - } - console.log = fn -} - // 3 days. its never yesterday and never a week ago const yesterday = new Date(Date.now() - 1000 * 60 * 60 * 24 * 3) @@ -71,7 +60,7 @@ const packument = (nv, opts) => { tarball: 'http://hm.blue.com/1.0.1.tgz', integrity: '---', fileCount: 1, - unpackedSize: 1, + unpackedSize: 1000, }, }, }, @@ -94,7 +83,7 @@ const packument = (nv, opts) => { tarball: 'http://hm.cyan.com/1.0.0.tgz', integrity: '---', fileCount: 1, - unpackedSize: 1, + unpackedSize: 1000000, }, }, '1.0.1': {}, @@ -180,7 +169,7 @@ const packument = (nv, opts) => { tarball: 'http://hm.green.com/1.0.0.tgz', integrity: '---', fileCount: 1, - unpackedSize: 1, + unpackedSize: 1000000000, }, }, '1.0.1': {}, @@ -271,289 +260,212 @@ const packument = (nv, opts) => { return mocks[nv.name] } -t.beforeEach(cleanLogs) - -t.test('should log package info', async t => { - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const npm = mockNpm({ - config: { unicode: false }, - }) - const view = new View(npm) - - const ViewJson = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, +const loadMockNpm = async function (t, opts = {}) { + const consoleLogs = [] + const mockNpm = await _loadMockNpm(t, { + mocks: { + pacote: { + packument, + }, }, - }) - const jsonNpm = mockNpm({ - config: { - json: true, - tag: 'latest', + globals: { + 'console.log': (...args) => { + consoleLogs.push(args) + }, }, + ...opts, }) - const viewJson = new ViewJson(jsonNpm) + return { ...mockNpm, consoleLogs } +} - const ViewUnicode = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const unicodeNpm = mockNpm({ - config: { unicode: true }, - }) - const viewUnicode = new ViewUnicode(unicodeNpm) +t.test('package from git', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['https://github.com/npm/green']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package from git', async t => { - await view.exec(['https://github.com/npm/green']) - t.matchSnapshot(logs) - }) +t.test('deprecated package with license, bugs, repository and other fields', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['green@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with license, bugs, repository and other fields', async t => { - await view.exec(['green@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('deprecated package with unicode', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: true } }) + await npm.exec('view', ['green@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with more than 25 deps', async t => { - await view.exec(['black@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with more than 25 deps', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['black@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with maintainers info as object', async t => { - await view.exec(['pink@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with maintainers info as object', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['pink@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with homepage', async t => { - await view.exec(['orange@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with homepage', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['orange@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with no versions', async t => { - await view.exec(['brown']) - t.equal(logs, '', 'no info to display') - }) +t.test('package with no versions', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['brown']) + t.equal(consoleLogs.join('\n'), '', 'no info to display') +}) - t.test('package with no repo or homepage', async t => { - await view.exec(['blue@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with no repo or homepage', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['blue@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with semver range', async t => { - await view.exec(['blue@^1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with semver range', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['blue@^1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with no modified time', async t => { - await viewUnicode.exec(['cyan@1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with no modified time', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { unicode: false } }) + await npm.exec('view', ['cyan@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with --json and semver range', async t => { - await viewJson.exec(['cyan@^1.0.0']) - t.matchSnapshot(logs) - }) +t.test('package with --json and semver range', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { json: true } }) + await npm.exec('view', ['cyan@^1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) +}) - t.test('package with --json and no versions', async t => { - await viewJson.exec(['brown']) - t.equal(logs, '', 'no info to display') - }) +t.test('package with --json and no versions', async t => { + const { npm, consoleLogs } = await loadMockNpm(t, { config: { json: true } }) + await npm.exec('view', ['brown']) + t.equal(consoleLogs.join('\n'), '', 'no info to display') }) -t.test('should log info of package in current working dir', async t => { - const testDir = t.testdir({ +t.test('package in cwd', async t => { + const prefixDir = { 'package.json': JSON.stringify({ name: 'blue', version: '1.0.0', }, null, 2), - }) - - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const npm = mockNpm({ - prefix: testDir, - config: { - tag: '1.0.0', - }, - }) - const view = new View(npm) + } t.test('specific version', async t => { - await view.exec(['.@1.0.0']) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { prefixDir }) + await npm.exec('view', ['.@1.0.0']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('non-specific version', async t => { - await view.exec(['.']) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { prefixDir }) + await npm.exec('view', ['.']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('directory', async t => { - await view.exec(['./blue']) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { prefixDir }) + await npm.exec('view', ['./blue']) + t.matchSnapshot(consoleLogs.join('\n')) }) }) -t.test('should log info by field name', async t => { - const ViewJson = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const jsonNpm = mockNpm({ - config: { - tag: 'latest', - json: true, - }, - }) - - const viewJson = new ViewJson(jsonNpm) - - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, +t.test('specific field names', async t => { + const { npm, consoleLogs } = await loadMockNpm(t) + t.afterEach(() => { + consoleLogs.length = 0 }) - const npm = mockNpm() - const view = new View(npm) - t.test('readme', async t => { - await view.exec(['yellow@1.0.0', 'readme']) - t.matchSnapshot(logs) + await npm.exec('view', ['yellow@1.0.0', 'readme']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('several fields', async t => { - await viewJson.exec(['yellow@1.0.0', 'name', 'version', 'foo[bar]']) - t.matchSnapshot(logs) + await npm.exec('view', ['yellow@1.0.0', 'name', 'version', 'foo[bar]']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('several fields with several versions', async t => { - await view.exec(['yellow@1.x.x', 'author']) - t.matchSnapshot(logs) + await npm.exec('view', ['yellow@1.x.x', 'author']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('nested field with brackets', async t => { - await viewJson.exec(['orange@1.0.0', 'dist[shasum]']) - t.matchSnapshot(logs) + await npm.exec('view', ['orange@1.0.0', 'dist[shasum]']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('maintainers with email', async t => { - await viewJson.exec(['yellow@1.0.0', 'maintainers', 'name']) - t.matchSnapshot(logs) + await npm.exec('view', ['yellow@1.0.0', 'maintainers', 'name']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('maintainers with url', async t => { - await viewJson.exec(['pink@1.0.0', 'maintainers']) - t.matchSnapshot(logs) + await npm.exec('view', ['pink@1.0.0', 'maintainers']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('unknown nested field ', async t => { - await view.exec(['yellow@1.0.0', 'dist.foobar']) - t.equal(logs, '', 'no info to display') + await npm.exec('view', ['yellow@1.0.0', 'dist.foobar']) + t.equal(consoleLogs.join('\n'), '', 'no info to display') }) t.test('array field - 1 element', async t => { - await view.exec(['purple@1.0.0', 'maintainers.name']) - t.matchSnapshot(logs) + await npm.exec('view', ['purple@1.0.0', 'maintainers.name']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('array field - 2 elements', async t => { - await view.exec(['yellow@1.x.x', 'maintainers.name']) - t.matchSnapshot(logs) + await npm.exec('view', ['yellow@1.x.x', 'maintainers.name']) + t.matchSnapshot(consoleLogs.join('\n')) }) }) t.test('throw error if global mode', async t => { - const View = t.mock('../../../lib/commands/view.js') - const npm = mockNpm({ - config: { - global: true, - tag: 'latest', - }, - }) - const view = new View(npm) + const { npm } = await loadMockNpm(t, { config: { global: true } }) await t.rejects( - view.exec([]), + npm.exec('view', []), /Cannot use view command in global mode./ ) }) t.test('throw ENOENT error if package.json missing', async t => { - const testDir = t.testdir({}) - - const View = t.mock('../../../lib/commands/view.js') - const npm = mockNpm({ - prefix: testDir, - }) - const view = new View(npm) + const { npm } = await loadMockNpm(t) await t.rejects( - view.exec([]), + npm.exec('view', []), { code: 'ENOENT' } ) }) -t.test('throw EJSONPARSE error if package.json not json', async t => { - const testDir = t.testdir({ - 'package.json': 'not json, nope, not even a little bit!', - }) - - const View = t.mock('../../../lib/commands/view.js') - const npm = mockNpm({ - prefix: testDir, - }) - const view = new View(npm) - await t.rejects( - view.exec([]), - { code: 'EJSONPARSE' } - ) -}) - t.test('throw error if package.json has no name', async t => { - const testDir = t.testdir({ - 'package.json': '{}', - }) - - const View = t.mock('../../../lib/commands/view.js') - const npm = mockNpm({ - prefix: testDir, + const { npm } = await loadMockNpm(t, { + prefixDir: { + 'package.json': '{}', + }, }) - const view = new View(npm) await t.rejects( - view.exec([]), + npm.exec('view', []), /Invalid package.json, no "name" field/ ) }) t.test('throws when unpublished', async t => { - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const npm = mockNpm({ - config: { - tag: '1.0.1', - }, - }) - const view = new View(npm) + const { npm } = await loadMockNpm(t) await t.rejects( - view.exec(['red']), + npm.exec('view', ['red']), { code: 'E404', pkgid: 'red@1.0.1', message: 'Unpublished on 2012-12-20T00:00:00.000Z' } ) }) t.test('workspaces', async t => { - t.beforeEach(() => { - warnMsg = undefined - config.json = false - }) - const testDir = t.testdir({ + const prefixDir = { 'package.json': JSON.stringify({ name: 'workspaces-test-package', version: '1.2.3', @@ -571,106 +483,103 @@ t.test('workspaces', async t => { version: '1.2.3', }), }, - }) - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - 'proc-log': { - warn: (msg) => { - warnMsg = msg - }, - silly: () => {}, - }, - }) - const config = { - unicode: false, - tag: 'latest', } - let warnMsg - const npm = mockNpm({ - config, - localPrefix: testDir, - }) - const view = new View(npm) t.test('all workspaces', async t => { - await view.execWorkspaces([], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true }, + }) + await npm.exec('view', []) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('one specific workspace', async t => { - await view.execWorkspaces([], ['green']) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspace: ['green'] }, + }) + await npm.exec('view', []) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('all workspaces --json', async t => { - config.json = true - await view.execWorkspaces([], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true, json: true }, + }) + await npm.exec('view', []) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('all workspaces single field', async t => { - await view.execWorkspaces(['.', 'name'], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true }, + }) + await npm.exec('view', ['.', 'name']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('all workspaces nonexistent field', async t => { - await view.execWorkspaces(['.', 'foo'], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true }, + }) + await npm.exec('view', ['.', 'foo']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('all workspaces nonexistent field --json', async t => { - config.json = true - await view.execWorkspaces(['.', 'foo'], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true, json: true }, + }) + await npm.exec('view', ['.', 'foo']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('all workspaces single field --json', async t => { - config.json = true - await view.execWorkspaces(['.', 'name'], []) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true, json: true }, + }) + await npm.exec('view', ['.', 'name']) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('single workspace --json', async t => { - config.json = true - await view.execWorkspaces([], ['green']) - t.matchSnapshot(logs) + const { npm, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspace: ['green'], json: true }, + }) + await npm.exec('view', []) + t.matchSnapshot(consoleLogs.join('\n')) }) t.test('remote package name', async t => { - await view.execWorkspaces(['pink'], []) - t.matchSnapshot(warnMsg) - t.matchSnapshot(logs) + const { npm, logs, consoleLogs } = await loadMockNpm(t, { + prefixDir, + config: { unicode: false, workspaces: true }, + }) + await npm.exec('view', ['pink']) + t.matchSnapshot(consoleLogs.join('\n')) + t.matchSnapshot(logs.warn, 'should have warning of ignoring workspaces') }) }) t.test('completion', async t => { - const View = t.mock('../../../lib/commands/view.js', { - pacote: { - packument, - }, - }) - const npm = mockNpm({ - config: { - tag: '1.0.1', - }, - }) - const view = new View(npm) + const { npm } = await loadMockNpm(t) + const view = await npm.cmd('view') const res = await view.completion({ conf: { argv: { remain: ['npm', 'view', 'green@1.0.0'] } }, }) t.ok(res, 'returns back fields') }) -t.test('no registry completion', async t => { - const View = t.mock('../../../lib/commands/view.js') - const npm = mockNpm({ - config: { - tag: '1.0.1', - }, - }) - const view = new View(npm) +t.test('no package completion', async t => { + const { npm } = await loadMockNpm(t) + const view = await npm.cmd('view') const res = await view.completion({ conf: { argv: { remain: ['npm', 'view'] } } }) t.notOk(res, 'there is no package completion') t.end() diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js index 088d0cdb6e1288..200ee9e5536d18 100644 --- a/deps/npm/test/lib/utils/config/definitions.js +++ b/deps/npm/test/lib/utils/config/definitions.js @@ -457,6 +457,13 @@ t.test('retry options', t => { }) t.test('search options', t => { + const vals = { + description: 'test description', + exclude: 'test search exclude', + limit: 99, + staleneess: 99, + + } const obj = {} // : flat.search[