diff --git a/deps/npm/docs/content/commands/npm-audit.md b/deps/npm/docs/content/commands/npm-audit.md index 323d38f64c14f9..24b700ff5abd85 100644 --- a/deps/npm/docs/content/commands/npm-audit.md +++ b/deps/npm/docs/content/commands/npm-audit.md @@ -246,6 +246,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set `--yes` during `npm init`. * Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! @@ -306,6 +307,36 @@ variable will be set to `'production'` for all lifecycle scripts. +#### `foreground-scripts` + +* Default: false +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + + #### `workspace` * Default: diff --git a/deps/npm/docs/content/commands/npm-ci.md b/deps/npm/docs/content/commands/npm-ci.md index 4490fea9a0bb74..97d1aa5523dd72 100644 --- a/deps/npm/docs/content/commands/npm-ci.md +++ b/deps/npm/docs/content/commands/npm-ci.md @@ -94,6 +94,21 @@ submitted. +#### `foreground-scripts` + +* Default: false +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + + #### `ignore-scripts` * Default: false diff --git a/deps/npm/docs/content/commands/npm-init.md b/deps/npm/docs/content/commands/npm-init.md index d9c03aef41504b..71109cd360511d 100644 --- a/deps/npm/docs/content/commands/npm-init.md +++ b/deps/npm/docs/content/commands/npm-init.md @@ -199,6 +199,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set `--yes` during `npm init`. * Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! diff --git a/deps/npm/docs/content/commands/npm-install-ci-test.md b/deps/npm/docs/content/commands/npm-install-ci-test.md index 5ad67604541d1e..0d9470acf58b3d 100644 --- a/deps/npm/docs/content/commands/npm-install-ci-test.md +++ b/deps/npm/docs/content/commands/npm-install-ci-test.md @@ -43,6 +43,21 @@ submitted. +#### `foreground-scripts` + +* Default: false +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + + #### `ignore-scripts` * Default: false diff --git a/deps/npm/docs/content/commands/npm-install-test.md b/deps/npm/docs/content/commands/npm-install-test.md index ed39c6705a4848..5ac31cbf08e25c 100644 --- a/deps/npm/docs/content/commands/npm-install-test.md +++ b/deps/npm/docs/content/commands/npm-install-test.md @@ -112,6 +112,27 @@ will be preferred. +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + + #### `strict-peer-deps` * Default: false @@ -151,23 +172,17 @@ This configuration does not affect `npm ci`. -#### `omit` - -* Default: 'dev' if the `NODE_ENV` environment variable is set to - 'production', otherwise empty. -* Type: "dev", "optional", or "peer" (can be set multiple times) - -Dependency types to omit from the installation tree on disk. +#### `foreground-scripts` -Note that these dependencies _are_ still resolved and added to the -`package-lock.json` or `npm-shrinkwrap.json` file. They are just not -physically installed on disk. +* Default: false +* Type: Boolean -If a package type appears in both the `--include` and `--omit` lists, then -it will be included. +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. -If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment -variable will be set to `'production'` for all lifecycle scripts. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. diff --git a/deps/npm/docs/content/commands/npm-install.md b/deps/npm/docs/content/commands/npm-install.md index 6f12e5f5389973..2ffd3e3e9fff14 100644 --- a/deps/npm/docs/content/commands/npm-install.md +++ b/deps/npm/docs/content/commands/npm-install.md @@ -22,7 +22,7 @@ npm install npm install npm install / -aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add +aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add ``` @@ -502,6 +502,27 @@ will be preferred. +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + + #### `strict-peer-deps` * Default: false @@ -541,23 +562,17 @@ This configuration does not affect `npm ci`. -#### `omit` - -* Default: 'dev' if the `NODE_ENV` environment variable is set to - 'production', otherwise empty. -* Type: "dev", "optional", or "peer" (can be set multiple times) - -Dependency types to omit from the installation tree on disk. +#### `foreground-scripts` -Note that these dependencies _are_ still resolved and added to the -`package-lock.json` or `npm-shrinkwrap.json` file. They are just not -physically installed on disk. +* Default: false +* Type: Boolean -If a package type appears in both the `--include` and `--omit` lists, then -it will be included. +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. -If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment -variable will be set to `'production'` for all lifecycle scripts. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. diff --git a/deps/npm/docs/content/commands/npm-pkg.md b/deps/npm/docs/content/commands/npm-pkg.md index 8f6cbecf958fd9..576e1335efbba9 100644 --- a/deps/npm/docs/content/commands/npm-pkg.md +++ b/deps/npm/docs/content/commands/npm-pkg.md @@ -14,6 +14,8 @@ description: Manages your package.json npm pkg set = [= ...] npm pkg get [ [ ...]] npm pkg delete [ ...] +npm pkg set [[].= ...] +npm pkg set [[].= ...] ``` @@ -197,6 +199,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set `--yes` during `npm init`. * Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! diff --git a/deps/npm/docs/content/commands/npm-prune.md b/deps/npm/docs/content/commands/npm-prune.md index 49420e5b9d99cb..a10a353801b7cd 100644 --- a/deps/npm/docs/content/commands/npm-prune.md +++ b/deps/npm/docs/content/commands/npm-prune.md @@ -99,6 +99,36 @@ Not supported by all npm commands. +#### `foreground-scripts` + +* Default: false +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + + #### `workspace` * Default: diff --git a/deps/npm/docs/content/commands/npm-rebuild.md b/deps/npm/docs/content/commands/npm-rebuild.md index ecb4a7ce34c62a..d63e00b79d3867 100644 --- a/deps/npm/docs/content/commands/npm-rebuild.md +++ b/deps/npm/docs/content/commands/npm-rebuild.md @@ -70,6 +70,21 @@ systems. +#### `foreground-scripts` + +* Default: false +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + + #### `ignore-scripts` * Default: false diff --git a/deps/npm/docs/content/commands/npm-unpublish.md b/deps/npm/docs/content/commands/npm-unpublish.md index 13589a03ee69fa..a4c481ea5af7f7 100644 --- a/deps/npm/docs/content/commands/npm-unpublish.md +++ b/deps/npm/docs/content/commands/npm-unpublish.md @@ -6,21 +6,22 @@ description: Remove a package from the registry ### Synopsis -To learn more about how the npm registry treats unpublish, see our unpublish policies - -#### Unpublishing a single version of a package + + + ```bash -npm unpublish [<@scope>/]@ +npm unpublish [<@scope>/][@] ``` -#### Unpublishing an entire package + + + + -```bash -npm unpublish [<@scope>/] --force -``` +To learn more about how the npm registry treats unpublish, see our unpublish policies ### Warning @@ -87,6 +88,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set `--yes` during `npm init`. * Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! diff --git a/deps/npm/docs/content/commands/npm-update.md b/deps/npm/docs/content/commands/npm-update.md index e1b48a8ed43208..aff46b1e5b5576 100644 --- a/deps/npm/docs/content/commands/npm-update.md +++ b/deps/npm/docs/content/commands/npm-update.md @@ -169,6 +169,22 @@ be _downgraded_. +#### `save` + +* Default: `true` unless when using `npm update` or `npm dedupe` where it + defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + + #### `global` * Default: false @@ -214,6 +230,27 @@ will be preferred. +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + + #### `strict-peer-deps` * Default: false @@ -253,39 +290,17 @@ This configuration does not affect `npm ci`. -#### `save` +#### `foreground-scripts` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: false * Type: Boolean -Save installed packages to a `package.json` file as dependencies. +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. -When used with the `npm rm` command, removes the dependency from -`package.json`. - -Will also prevent writing to `package-lock.json` if set to `false`. - - - - -#### `omit` - -* Default: 'dev' if the `NODE_ENV` environment variable is set to - 'production', otherwise empty. -* Type: "dev", "optional", or "peer" (can be set multiple times) - -Dependency types to omit from the installation tree on disk. - -Note that these dependencies _are_ still resolved and added to the -`package-lock.json` or `npm-shrinkwrap.json` file. They are just not -physically installed on disk. - -If a package type appears in both the `--include` and `--omit` lists, then -it will be included. - -If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment -variable will be set to `'production'` for all lifecycle scripts. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. diff --git a/deps/npm/docs/content/commands/npm-version.md b/deps/npm/docs/content/commands/npm-version.md index b53dd64aeae850..86e2ce90e9bea7 100644 --- a/deps/npm/docs/content/commands/npm-version.md +++ b/deps/npm/docs/content/commands/npm-version.md @@ -52,7 +52,8 @@ Run git commit hooks when using the `npm version` command. * Default: true * Type: Boolean -Tag the commit when using the `npm version` command. +Tag the commit when using the `npm version` command. Setting this to false +results in no commit being made at all. diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index 530df0971c8ebe..0c2047ad9abe08 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -323,7 +323,7 @@ This should be a module relative to the root of your package folder. For most modules, it makes the most sense to have a main script and often not much else. -If `main` is not set it defaults to `index.js` in the packages root folder. +If `main` is not set it defaults to `index.js` in the package's root folder. ### browser @@ -690,6 +690,10 @@ This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing packages to the public registry. +*note*: Packages linked by local path will not have their own +dependencies installed when `npm install` is ran in this case. You must +run `npm install` from inside the local path itself. + ### devDependencies If someone is planning on downloading and using your module in their diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index 9fbb614564df88..df259715f08f2e 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -616,6 +616,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set `--yes` during `npm init`. * Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! @@ -677,7 +678,8 @@ but is not in the `PATH`, then set this to the full path to the git binary. * Default: true * Type: Boolean -Tag the commit when using the `npm version` command. +Tag the commit when using the `npm version` command. Setting this to false +results in no commit being made at all. diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html index 11006e2f09089d..33c2a803c2a876 100644 --- a/deps/npm/docs/output/commands/npm-audit.html +++ b/deps/npm/docs/output/commands/npm-audit.html @@ -142,7 +142,7 @@

npm-audit

Table of contents

- +

Synopsis

@@ -319,6 +319,7 @@

force

  • Allow conflicting peerDependencies to be installed in the root project.
  • Implicitly set --yes during npm init.
  • Allow clobbering existing values in npm pkg
  • +
  • Allow unpublishing of entire packages (not just a single version).
  • If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

    @@ -366,6 +367,30 @@

    omit

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

    +

    foreground-scripts

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

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    + + +

    ignore-scripts

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

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    + +

    workspace

    • Default:
    • diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html index fdde58b1adba3d..bbacda33a5174e 100644 --- a/deps/npm/docs/output/commands/npm-ci.html +++ b/deps/npm/docs/output/commands/npm-ci.html @@ -142,7 +142,7 @@

      npm-ci

      Table of contents

      - +

      Synopsis

      @@ -214,6 +214,18 @@

      audit

      submitted.

      +

      foreground-scripts

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

      Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

      +

      Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

      + +

      ignore-scripts

      • Default: false
      • diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html index 00874a95c080a4..c8dece27945345 100644 --- a/deps/npm/docs/output/commands/npm-init.html +++ b/deps/npm/docs/output/commands/npm-init.html @@ -294,6 +294,7 @@

        force

      • Allow conflicting peerDependencies to be installed in the root project.
      • Implicitly set --yes during npm init.
      • Allow clobbering existing values in npm pkg
      • +
      • Allow unpublishing of entire packages (not just a single version).

      If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

      diff --git a/deps/npm/docs/output/commands/npm-install-ci-test.html b/deps/npm/docs/output/commands/npm-install-ci-test.html index f8b2bcfeeed7e9..b414f090278283 100644 --- a/deps/npm/docs/output/commands/npm-install-ci-test.html +++ b/deps/npm/docs/output/commands/npm-install-ci-test.html @@ -142,7 +142,7 @@

      npm-install-ci-test

      Table of contents

      - +

      Synopsis

      @@ -173,6 +173,18 @@

      audit

      submitted.

      +

      foreground-scripts

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

      Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

      +

      Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

      + +

      ignore-scripts

      • Default: false
      • diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html index 9db250961fe56c..116cc24a81238d 100644 --- a/deps/npm/docs/output/commands/npm-install-test.html +++ b/deps/npm/docs/output/commands/npm-install-test.html @@ -142,7 +142,7 @@

        npm-install-test

        Table of contents

        - +

        Synopsis

        @@ -233,6 +233,22 @@

        legacy-bundling

        will be preferred.

        +

        omit

        +
          +
        • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
        • +
        • Type: "dev", "optional", or "peer" (can be set multiple times)
        • +
        +

        Dependency types to omit from the installation tree on disk.

        +

        Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

        +

        If a package type appears in both the --include and --omit lists, then +it will be included.

        +

        If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

        + +

        strict-peer-deps

        • Default: false
        • @@ -264,20 +280,16 @@

          package-lock

          This configuration does not affect npm ci.

          -

          omit

          +

          foreground-scripts

            -
          • Default: 'dev' if the NODE_ENV environment variable is set to -'production', otherwise empty.
          • -
          • Type: "dev", "optional", or "peer" (can be set multiple times)
          • +
          • Default: false
          • +
          • Type: Boolean
          -

          Dependency types to omit from the installation tree on disk.

          -

          Note that these dependencies are still resolved and added to the -package-lock.json or npm-shrinkwrap.json file. They are just not -physically installed on disk.

          -

          If a package type appears in both the --include and --omit lists, then -it will be included.

          -

          If the resulting omit list includes 'dev', then the NODE_ENV environment -variable will be set to 'production' for all lifecycle scripts.

          +

          Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

          +

          Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

          ignore-scripts

          diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html index 678e4cce344963..755dee22402fdd 100644 --- a/deps/npm/docs/output/commands/npm-install.html +++ b/deps/npm/docs/output/commands/npm-install.html @@ -142,7 +142,7 @@

          npm-install

          Table of contents

          - +

          Synopsis

          @@ -160,7 +160,7 @@

          Table of contents

          npm install <git:// url> npm install <github username>/<github project> -aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add +aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add @@ -559,6 +559,22 @@

          legacy-bundling

          will be preferred.

          +

          omit

          +
            +
          • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
          • +
          • Type: "dev", "optional", or "peer" (can be set multiple times)
          • +
          +

          Dependency types to omit from the installation tree on disk.

          +

          Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

          +

          If a package type appears in both the --include and --omit lists, then +it will be included.

          +

          If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

          + +

          strict-peer-deps

          • Default: false
          • @@ -590,20 +606,16 @@

            package-lock

            This configuration does not affect npm ci.

            -

            omit

            +

            foreground-scripts

              -
            • Default: 'dev' if the NODE_ENV environment variable is set to -'production', otherwise empty.
            • -
            • Type: "dev", "optional", or "peer" (can be set multiple times)
            • +
            • Default: false
            • +
            • Type: Boolean
            -

            Dependency types to omit from the installation tree on disk.

            -

            Note that these dependencies are still resolved and added to the -package-lock.json or npm-shrinkwrap.json file. They are just not -physically installed on disk.

            -

            If a package type appears in both the --include and --omit lists, then -it will be included.

            -

            If the resulting omit list includes 'dev', then the NODE_ENV environment -variable will be set to 'production' for all lifecycle scripts.

            +

            Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

            +

            Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

            ignore-scripts

            diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 3269bcc579a886..19bf6080bf1a86 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.5.3 /path/to/npm
            +
            npm@8.5.5 /path/to/npm
             └─┬ init-package-json@0.0.4
               └── promzard@0.1.5
             
            diff --git a/deps/npm/docs/output/commands/npm-pkg.html b/deps/npm/docs/output/commands/npm-pkg.html index 4c34d4556eacef..221afc4e594b2b 100644 --- a/deps/npm/docs/output/commands/npm-pkg.html +++ b/deps/npm/docs/output/commands/npm-pkg.html @@ -152,6 +152,8 @@

            Table of contents

            npm pkg set <key>=<value> [<key>=<value> ...]
             npm pkg get [<key> [<key> ...]]
             npm pkg delete <key> [<key> ...]
            +npm pkg set [<array>[<index>].<key>=<value> ...]
            +npm pkg set [<array>[].<key>=<value> ...]
             
            @@ -284,6 +286,7 @@

            force

          • Allow conflicting peerDependencies to be installed in the root project.
          • Implicitly set --yes during npm init.
          • Allow clobbering existing values in npm pkg
          • +
          • Allow unpublishing of entire packages (not just a single version).

          If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

          diff --git a/deps/npm/docs/output/commands/npm-prune.html b/deps/npm/docs/output/commands/npm-prune.html index 942b4f94f8bdfa..08df537cf8c443 100644 --- a/deps/npm/docs/output/commands/npm-prune.html +++ b/deps/npm/docs/output/commands/npm-prune.html @@ -142,7 +142,7 @@

          npm-prune

          Table of contents

          - +

          Synopsis

          @@ -216,6 +216,30 @@

          json

          Not supported by all npm commands.

          +

          foreground-scripts

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

          Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

          +

          Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

          + + +

          ignore-scripts

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

          If true, npm does not run scripts specified in package.json files.

          +

          Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

          + +

          workspace

          • Default:
          • diff --git a/deps/npm/docs/output/commands/npm-rebuild.html b/deps/npm/docs/output/commands/npm-rebuild.html index 9e55f371c63bee..139d1591ed3efc 100644 --- a/deps/npm/docs/output/commands/npm-rebuild.html +++ b/deps/npm/docs/output/commands/npm-rebuild.html @@ -142,7 +142,7 @@

            npm-rebuild

            Table of contents

            - +

            Synopsis

            @@ -197,6 +197,18 @@ systems.

            +

            foreground-scripts

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

            Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

            +

            Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

            + +

            ignore-scripts

            • Default: false
            • diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index 857a08d7216324..21fafc89ebaacf 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -142,17 +142,19 @@

              npm-unpublish

              Table of contents

              - +

              Synopsis

              -

              To learn more about how the npm registry treats unpublish, see our unpublish policies

              -

              Unpublishing a single version of a package

              -
              npm unpublish [<@scope>/]<pkg>@<version>
              -
              -

              Unpublishing an entire package

              -
              npm unpublish [<@scope>/]<pkg> --force
              +
              +
              +
              +
              npm unpublish [<@scope>/]<pkg>[@<version>]
               
              + + + +

              To learn more about how the npm registry treats unpublish, see our unpublish policies

              Warning

              Consider using the deprecate command instead, if your intent is to encourage users to upgrade, or if you no longer @@ -207,6 +209,7 @@

              force

            • Allow conflicting peerDependencies to be installed in the root project.
            • Implicitly set --yes during npm init.
            • Allow clobbering existing values in npm pkg
            • +
            • Allow unpublishing of entire packages (not just a single version).

            If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

            diff --git a/deps/npm/docs/output/commands/npm-update.html b/deps/npm/docs/output/commands/npm-update.html index 7a8df45f12c8fe..62e81a62dd2c20 100644 --- a/deps/npm/docs/output/commands/npm-update.html +++ b/deps/npm/docs/output/commands/npm-update.html @@ -142,7 +142,7 @@

            npm-update

            Table of contents

            - +

            Synopsis

            @@ -260,6 +260,18 @@

            Configuration

            +

            save

            +
              +
            • Default: true unless when using npm update or npm dedupe where it +defaults to false
            • +
            • Type: Boolean
            • +
            +

            Save installed packages to a package.json file as dependencies.

            +

            When used with the npm rm command, removes the dependency from +package.json.

            +

            Will also prevent writing to package-lock.json if set to false.

            + +

            global

            • Default: false
            • @@ -300,6 +312,22 @@

              legacy-bundling

              will be preferred.

              +

              omit

              +
                +
              • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
              • +
              • Type: "dev", "optional", or "peer" (can be set multiple times)
              • +
              +

              Dependency types to omit from the installation tree on disk.

              +

              Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

              +

              If a package type appears in both the --include and --omit lists, then +it will be included.

              +

              If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

              + +

              strict-peer-deps

              • Default: false
              • @@ -331,32 +359,16 @@

                package-lock

                This configuration does not affect npm ci.

                -

                save

                +

                foreground-scripts

                  -
                • Default: true unless when using npm update or npm dedupe where it -defaults to false
                • +
                • Default: false
                • Type: Boolean
                -

                Save installed packages to a package.json file as dependencies.

                -

                When used with the npm rm command, removes the dependency from -package.json.

                -

                Will also prevent writing to package-lock.json if set to false.

                - - -

                omit

                -
                  -
                • Default: 'dev' if the NODE_ENV environment variable is set to -'production', otherwise empty.
                • -
                • Type: "dev", "optional", or "peer" (can be set multiple times)
                • -
                -

                Dependency types to omit from the installation tree on disk.

                -

                Note that these dependencies are still resolved and added to the -package-lock.json or npm-shrinkwrap.json file. They are just not -physically installed on disk.

                -

                If a package type appears in both the --include and --omit lists, then -it will be included.

                -

                If the resulting omit list includes 'dev', then the NODE_ENV environment -variable will be set to 'production' for all lifecycle scripts.

                +

                Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

                +

                Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

                ignore-scripts

                diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html index 34eeb4dc7d1862..a4e8ff6dbdc0b4 100644 --- a/deps/npm/docs/output/commands/npm-version.html +++ b/deps/npm/docs/output/commands/npm-version.html @@ -182,7 +182,8 @@

                git-tag-version

              • Default: true
              • Type: Boolean
              -

              Tag the commit when using the npm version command.

              +

              Tag the commit when using the npm version command. Setting this to false +results in no commit being made at all.

              json

              diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 89bdc4f6d0b238..8690cdc621a88f 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.5.3

              +

              8.5.5

              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/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html index 9aed0d3070d90e..b318eee5795193 100644 --- a/deps/npm/docs/output/configuring-npm/package-json.html +++ b/deps/npm/docs/output/configuring-npm/package-json.html @@ -391,7 +391,7 @@

              main

              This should be a module relative to the root of your package folder.

              For most modules, it makes the most sense to have a main script and often not much else.

              -

              If main is not set it defaults to index.js in the packages root folder.

              +

              If main is not set it defaults to index.js in the package's root folder.

              browser

              If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might @@ -663,6 +663,9 @@

              Local Paths

              This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing packages to the public registry.

              +

              note: Packages linked by local path will not have their own +dependencies installed when npm install is ran in this case. You must +run npm install from inside the local path itself.

              devDependencies

              If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index ef5a0f92634dc0..66f848bf6fdcde 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -639,6 +639,7 @@

              force

            • Allow conflicting peerDependencies to be installed in the root project.
            • Implicitly set --yes during npm init.
            • Allow clobbering existing values in npm pkg
            • +
            • Allow unpublishing of entire packages (not just a single version).

            If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

            @@ -688,7 +689,8 @@

            git-tag-version

          • Default: true
          • Type: Boolean
          -

          Tag the commit when using the npm version command.

          +

          Tag the commit when using the npm version command. Setting this to false +results in no commit being made at all.

          global

          diff --git a/deps/npm/lib/commands/audit.js b/deps/npm/lib/commands/audit.js index fad43fe902df9f..08d011d8318751 100644 --- a/deps/npm/lib/commands/audit.js +++ b/deps/npm/lib/commands/audit.js @@ -14,6 +14,8 @@ class Audit extends ArboristWorkspaceCmd { 'json', 'package-lock-only', 'omit', + 'foreground-scripts', + 'ignore-scripts', ...super.params, ] diff --git a/deps/npm/lib/commands/ci.js b/deps/npm/lib/commands/ci.js index e054bee51679c7..eb1e02bcdc7241 100644 --- a/deps/npm/lib/commands/ci.js +++ b/deps/npm/lib/commands/ci.js @@ -24,6 +24,7 @@ class CI extends ArboristWorkspaceCmd { static name = 'ci' static params = [ 'audit', + 'foreground-scripts', 'ignore-scripts', 'script-shell', ] diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js index 9af4c4cd6ffbfc..630150c0886fed 100644 --- a/deps/npm/lib/commands/doctor.js +++ b/deps/npm/lib/commands/doctor.js @@ -10,7 +10,6 @@ const semver = require('semver') const { promisify } = require('util') const log = require('../utils/log-shim.js') const ansiTrim = require('../utils/ansi-trim.js') -const isWindows = require('../utils/is-windows.js') const ping = require('../utils/ping.js') const { registry: { default: defaultRegistry }, @@ -55,32 +54,36 @@ class Doctor extends BaseCommand { ['node -v', 'getLatestNodejsVersion', []], ['npm config get registry', 'checkNpmRegistry', []], ['which git', 'getGitPath', []], - ...(isWindows + ...(process.platform === 'win32' ? [] : [ - ['Perms check on cached files', 'checkFilesPermission', [this.npm.cache, true, R_OK]], [ + 'Perms check on cached files', + 'checkFilesPermission', + [this.npm.cache, true, R_OK], + ], [ 'Perms check on local node_modules', 'checkFilesPermission', - [this.npm.localDir, true], - ], - [ + [this.npm.localDir, true, R_OK | W_OK, true], + ], [ 'Perms check on global node_modules', 'checkFilesPermission', - [this.npm.globalDir, false], - ], - [ + [this.npm.globalDir, false, R_OK], + ], [ 'Perms check on local bin folder', 'checkFilesPermission', - [this.npm.localBin, false, R_OK | W_OK | X_OK], - ], - [ + [this.npm.localBin, false, R_OK | W_OK | X_OK, true], + ], [ 'Perms check on global bin folder', 'checkFilesPermission', [this.npm.globalBin, false, X_OK], ], ]), - ['Verify cache contents', 'verifyCachedFiles', [this.npm.flatOptions.cache]], + [ + 'Verify cache contents', + 'verifyCachedFiles', + [this.npm.flatOptions.cache], + ], // TODO: // - ensure arborist.loadActual() runs without errors and no invalid edges // - ensure package-lock.json matches loadActual() @@ -129,6 +132,7 @@ class Doctor extends BaseCommand { if (!this.npm.silent) { this.npm.output(table(outTable, tableOpts)) if (!allOk) { + // TODO is this really needed? console.error('') } } @@ -141,7 +145,7 @@ class Doctor extends BaseCommand { const tracker = log.newItem('checkPing', 1) tracker.info('checkPing', 'Pinging registry') try { - await ping(this.npm.flatOptions) + await ping({ ...this.npm.flatOptions, retry: false }) return '' } catch (er) { if (/^E\d{3}$/.test(er.code || '')) { @@ -201,11 +205,7 @@ class Doctor extends BaseCommand { } } - async checkFilesPermission (root, shouldOwn, mask = null) { - if (mask === null) { - mask = shouldOwn ? R_OK | W_OK : R_OK - } - + async checkFilesPermission (root, shouldOwn, mask, missingOk) { let ok = true const tracker = log.newItem(root, 1) @@ -217,8 +217,11 @@ class Doctor extends BaseCommand { for (const f of files) { tracker.silly('checkFilesPermission', f.substr(root.length + 1)) const st = await lstat(f).catch(er => { - ok = false - tracker.warn('checkFilesPermission', 'error getting info for ' + f) + // if it can't be missing, or if it can and the error wasn't that it was missing + if (!missingOk || er.code !== 'ENOENT') { + ok = false + tracker.warn('checkFilesPermission', 'error getting info for ' + f) + } }) tracker.completeWork(1) diff --git a/deps/npm/lib/commands/install.js b/deps/npm/lib/commands/install.js index 61526abb7879b1..ebba02a1bd47d0 100644 --- a/deps/npm/lib/commands/install.js +++ b/deps/npm/lib/commands/install.js @@ -14,15 +14,18 @@ const ArboristWorkspaceCmd = require('../arborist-cmd.js') class Install extends ArboristWorkspaceCmd { static description = 'Install a package' static name = 'install' + + // These are in the order they will show up in when running "-h" static params = [ 'save', 'save-exact', 'global', 'global-style', 'legacy-bundling', + 'omit', 'strict-peer-deps', 'package-lock', - 'omit', + 'foreground-scripts', 'ignore-scripts', 'audit', 'bin-links', diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js index 93e0a45ad1e274..e74efac1baf6a2 100644 --- a/deps/npm/lib/commands/owner.js +++ b/deps/npm/lib/commands/owner.js @@ -59,60 +59,39 @@ class Owner extends BaseCommand { } async exec ([action, ...args]) { - const opts = { - ...this.npm.flatOptions, - } switch (action) { case 'ls': case 'list': - return this.ls(args[0], opts) + return this.ls(args[0]) case 'add': - return this.add(args[0], args[1], opts) + return this.changeOwners(args[0], args[1], 'add') case 'rm': case 'remove': - return this.rm(args[0], args[1], opts) + return this.changeOwners(args[0], args[1], 'rm') default: throw this.usageError() } } - async ls (pkg, opts) { - if (!pkg) { - if (this.npm.config.get('global')) { - throw this.usageError() - } - - const pkgName = await readLocalPkgName(this.npm.prefix) - if (!pkgName) { - throw this.usageError() - } - - pkg = pkgName - } - + async ls (pkg) { + pkg = await this.getPkg(pkg) const spec = npa(pkg) try { - const packumentOpts = { ...opts, fullMetadata: true } + const packumentOpts = { ...this.npm.flatOptions, fullMetadata: true, preferOnline: true } const { maintainers } = await pacote.packument(spec, packumentOpts) if (!maintainers || !maintainers.length) { this.npm.output('no admin found') } else { - this.npm.output(maintainers.map(o => `${o.name} <${o.email}>`).join('\n')) + this.npm.output(maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) } - - return maintainers } catch (err) { log.error('owner ls', "Couldn't get owner data", pkg) throw err } } - async add (user, pkg, opts) { - if (!user) { - throw this.usageError() - } - + async getPkg (pkg) { if (!pkg) { if (this.npm.config.get('global')) { throw this.usageError() @@ -122,44 +101,25 @@ class Owner extends BaseCommand { throw this.usageError() } - pkg = pkgName + return pkgName } - log.verbose('owner add', '%s to %s', user, pkg) - - const spec = npa(pkg) - return this.putOwners(spec, user, opts, - (newOwner, owners) => this.validateAddOwner(newOwner, owners)) + return pkg } - async rm (user, pkg, opts) { + async changeOwners (user, pkg, addOrRm) { if (!user) { throw this.usageError() } - if (!pkg) { - if (this.npm.config.get('global')) { - throw this.usageError() - } - const pkgName = await readLocalPkgName(this.npm.prefix) - if (!pkgName) { - throw this.usageError() - } - - pkg = pkgName - } - log.verbose('owner rm', '%s from %s', user, pkg) + pkg = await this.getPkg(pkg) + log.verbose(`owner ${addOrRm}`, '%s to %s', user, pkg) const spec = npa(pkg) - return this.putOwners(spec, user, opts, - (rmOwner, owners) => this.validateRmOwner(rmOwner, owners)) - } - - async putOwners (spec, user, opts, validation) { const uri = `/-/user/org.couchdb.user:${encodeURIComponent(user)}` - let u = '' + let u try { - u = await npmFetch.json(uri, opts) + u = await npmFetch.json(uri, this.npm.flatOptions) } catch (err) { log.error('owner mutate', `Error getting user data for ${user}`) throw err @@ -177,36 +137,64 @@ class Owner extends BaseCommand { // normalize user data u = { name: u.name, email: u.email } - const data = await pacote.packument(spec, { ...opts, fullMetadata: true }) + const data = await pacote.packument(spec, { + ...this.npm.flatOptions, + fullMetadata: true, + preferOnline: true, + }) - // save the number of maintainers before validation for comparison - const before = data.maintainers ? data.maintainers.length : 0 + const owners = data.maintainers || [] + let maintainers + if (addOrRm === 'add') { + const existing = owners.find(o => o.name === u.name) + if (existing) { + log.info( + 'owner add', + `Already a package owner: ${existing.name} <${existing.email}>` + ) + return + } + maintainers = [ + ...owners, + u, + ] + } else { + maintainers = owners.filter(o => o.name !== u.name) - const m = validation(u, data.maintainers) - if (!m) { - return - } // invalid owners + if (maintainers.length === owners.length) { + log.info('owner rm', 'Not a package owner: ' + u.name) + return false + } - const body = { - _id: data._id, - _rev: data._rev, - maintainers: m, + if (!maintainers.length) { + throw Object.assign( + new Error( + 'Cannot remove all owners of a package. Add someone else first.' + ), + { code: 'EOWNERRM' } + ) + } } + const dataPath = `/${spec.escapedName}/-rev/${encodeURIComponent(data._rev)}` - const res = await otplease(opts, opts => { + const res = await otplease(this.npm.flatOptions, opts => { return npmFetch.json(dataPath, { ...opts, method: 'PUT', - body, + body: { + _id: data._id, + _rev: data._rev, + maintainers, + }, spec, }) }) if (!res.error) { - if (m.length < before) { - this.npm.output(`- ${user} (${spec.name})`) - } else { + if (addOrRm === 'add') { this.npm.output(`+ ${user} (${spec.name})`) + } else { + this.npm.output(`- ${user} (${spec.name})`) } } else { throw Object.assign( @@ -216,47 +204,6 @@ class Owner extends BaseCommand { } return res } - - validateAddOwner (newOwner, owners) { - owners = owners || [] - for (const o of owners) { - if (o.name === newOwner.name) { - log.info( - 'owner add', - 'Already a package owner: ' + o.name + ' <' + o.email + '>' - ) - return false - } - } - return [ - ...owners, - newOwner, - ] - } - - validateRmOwner (rmOwner, owners) { - let found = false - const m = owners.filter(function (o) { - var match = (o.name === rmOwner.name) - found = found || match - return !match - }) - - if (!found) { - log.info('owner rm', 'Not a package owner: ' + rmOwner.name) - return false - } - - if (!m.length) { - throw Object.assign( - new Error( - 'Cannot remove all owners of a package. Add someone else first.' - ), - { code: 'EOWNERRM' } - ) - } - - return m - } } + module.exports = Owner diff --git a/deps/npm/lib/commands/prune.js b/deps/npm/lib/commands/prune.js index 16c8b6d4329ac1..ee2c30553f1c5a 100644 --- a/deps/npm/lib/commands/prune.js +++ b/deps/npm/lib/commands/prune.js @@ -6,7 +6,15 @@ const ArboristWorkspaceCmd = require('../arborist-cmd.js') class Prune extends ArboristWorkspaceCmd { static description = 'Remove extraneous packages' static name = 'prune' - static params = ['omit', 'dry-run', 'json', ...super.params] + static params = [ + 'omit', + 'dry-run', + 'json', + 'foreground-scripts', + 'ignore-scripts', + ...super.params, + ] + static usage = ['[[<@scope>/]...]'] async exec () { diff --git a/deps/npm/lib/commands/rebuild.js b/deps/npm/lib/commands/rebuild.js index 471d60b740df11..0e8a1510bde2b3 100644 --- a/deps/npm/lib/commands/rebuild.js +++ b/deps/npm/lib/commands/rebuild.js @@ -11,6 +11,7 @@ class Rebuild extends ArboristWorkspaceCmd { static params = [ 'global', 'bin-links', + 'foreground-scripts', 'ignore-scripts', ...super.params, ] diff --git a/deps/npm/lib/commands/update.js b/deps/npm/lib/commands/update.js index 025ebbaf815f03..c2c3502eedd3d7 100644 --- a/deps/npm/lib/commands/update.js +++ b/deps/npm/lib/commands/update.js @@ -10,14 +10,16 @@ const ArboristWorkspaceCmd = require('../arborist-cmd.js') class Update extends ArboristWorkspaceCmd { static description = 'Update packages' static name = 'update' + static params = [ + 'save', 'global', 'global-style', 'legacy-bundling', + 'omit', 'strict-peer-deps', 'package-lock', - 'save', - 'omit', + 'foreground-scripts', 'ignore-scripts', 'audit', 'bin-links', diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js index 0c3f232602f876..85087057d65e9b 100644 --- a/deps/npm/lib/commands/view.js +++ b/deps/npm/lib/commands/view.js @@ -103,6 +103,7 @@ class View extends BaseCommand { // put the version back if it existed pkg = `${manifest.name}${pkg.slice(1)}` } + let wholePackument = false if (!args.length) { args = [''] @@ -196,7 +197,7 @@ class View extends BaseCommand { // get the data about this package let version = this.npm.config.get('tag') // rawSpec is the git url if this is from git - if (spec.type !== 'git' && spec.rawSpec) { + if (spec.type !== 'git' && spec.type !== 'directory' && spec.rawSpec) { version = spec.rawSpec } @@ -205,10 +206,9 @@ class View extends BaseCommand { if (pckmnt['dist-tags'] && pckmnt['dist-tags'][version]) { version = pckmnt['dist-tags'][version] } - if (pckmnt.time && pckmnt.time.unpublished) { const u = pckmnt.time.unpublished - const er = new Error('Unpublished by ' + u.name + ' on ' + u.time) + const er = new Error(`Unpublished on ${u.time}`) er.statusCode = 404 er.code = 'E404' er.pkgid = pckmnt._id diff --git a/deps/npm/lib/utils/cmd-list.js b/deps/npm/lib/utils/cmd-list.js index 26da5390065886..b3089a62c60d26 100644 --- a/deps/npm/lib/utils/cmd-list.js +++ b/deps/npm/lib/utils/cmd-list.js @@ -37,6 +37,7 @@ const affordances = { isnt: 'install', isnta: 'install', isntal: 'install', + isntall: 'install', 'install-clean': 'ci', 'isntall-clean': 'ci', hlep: 'help', diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index c5c129eb3d495e..ddccb147586f4f 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -740,6 +740,7 @@ define('force', { * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set \`--yes\` during \`npm init\`. * Allow clobbering existing values in \`npm pkg\` + * Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! @@ -798,7 +799,8 @@ define('git-tag-version', { default: true, type: Boolean, description: ` - Tag the commit when using the \`npm version\` command. + Tag the commit when using the \`npm version\` command. Setting this to + false results in no commit being made at all. `, flatten, }) diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js index 4d584346d0f3bd..5fa361efcd3da5 100644 --- a/deps/npm/lib/utils/error-message.js +++ b/deps/npm/lib/utils/error-message.js @@ -199,12 +199,7 @@ module.exports = (er, npm) => { const valResult = nameValidator(pkg) - if (valResult.validForNewPackages) { - detail.push([ - '404', - 'You should bug the author to publish it (or use the name yourself!)', - ]) - } else { + if (!valResult.validForNewPackages) { detail.push(['404', 'This package name is not valid, because', '']) const errorsArray = [...(valResult.errors || []), ...(valResult.warnings || [])] diff --git a/deps/npm/lib/utils/otplease.js b/deps/npm/lib/utils/otplease.js index 0e32493f9eb3e8..566c24ef2e293b 100644 --- a/deps/npm/lib/utils/otplease.js +++ b/deps/npm/lib/utils/otplease.js @@ -1,20 +1,17 @@ -const prompt = 'This operation requires a one-time password.\nEnter OTP:' const readUserInfo = require('./read-user-info.js') -const isOtpError = err => - err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body)) - module.exports = otplease -function otplease (opts, fn) { - opts = { prompt, ...opts } - return Promise.resolve().then(() => fn(opts)).catch(err => { - if (!isOtpError(err)) { +async function otplease (opts, fn) { + try { + await fn(opts) + } catch (err) { + if (err.code !== 'EOTP' && (err.code !== 'E401' || !/one-time pass/.test(err.body))) { throw err } else if (!process.stdin.isTTY || !process.stdout.isTTY) { throw err } else { - return readUserInfo.otp(opts.prompt) - .then(otp => fn({ ...opts, otp })) + const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') + return fn({ ...opts, otp }) } - }) + } } diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index 40bce70782b277..0300ff2b54a75f 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -260,6 +260,8 @@ Allow conflicting peerDependencies to be installed in the root project\. Implicitly set \fB\-\-yes\fP during \fBnpm init\fP\|\. .IP \(bu 2 Allow clobbering existing values in \fBnpm pkg\fP +.IP \(bu 2 +Allow unpublishing of entire packages (not just a single version)\. .RE .P @@ -321,6 +323,36 @@ 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 \fBforeground\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. +.P +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. +.SS \fBignore\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +If true, npm does not run scripts specified in package\.json files\. +.P +Note that commands explicitly intended to run a particular script, such as +\fBnpm start\fP, \fBnpm stop\fP, \fBnpm restart\fP, \fBnpm test\fP, and \fBnpm run\-script\fP +will still run their intended script if \fBignore\-scripts\fP is set, but they +will \fInot\fR run any pre\- or post\-scripts\. .SS \fBworkspace\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 93a2b9c587259b..b45c68b611a4af 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -94,6 +94,21 @@ When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes\. See the documentation for npm help \fBaudit\fP for details on what is submitted\. +.SS \fBforeground\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. +.P +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 2b2f933ea8f4f1..54e8ab0a028020 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -225,6 +225,8 @@ Allow conflicting peerDependencies to be installed in the root project\. Implicitly set \fB\-\-yes\fP during \fBnpm init\fP\|\. .IP \(bu 2 Allow clobbering existing values in \fBnpm pkg\fP +.IP \(bu 2 +Allow unpublishing of entire packages (not just a single version)\. .RE .P diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index e264ef43525276..f65e712ea5ec84 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -27,6 +27,21 @@ When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes\. See the documentation for npm help \fBaudit\fP for details on what is submitted\. +.SS \fBforeground\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. +.P +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 9ea163d7ad1032..0bd50342fa63bf 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -101,6 +101,27 @@ Causes npm to install the package such that versions of npm prior to 1\.4, such as the one included with node 0\.8, can install the package\. This eliminates all automatic deduping\. If used with \fBglobal\-style\fP this option will be preferred\. +.SS \fBomit\fP +.RS 0 +.IP \(bu 2 +Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to +\|'production', otherwise empty\. +.IP \(bu 2 +Type: "dev", "optional", or "peer" (can be set multiple times) + +.RE +.P +Dependency types to omit from the installation tree on disk\. +.P +Note that these dependencies \fIare\fR still resolved and added to the +\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not +physically installed on disk\. +.P +If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then +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 \fBstrict\-peer\-deps\fP .RS 0 .IP \(bu 2 @@ -140,27 +161,21 @@ modules will also be disabled\. To remove extraneous modules with package\-locks disabled use \fBnpm prune\fP\|\. .P This configuration does not affect \fBnpm ci\fP\|\. -.SS \fBomit\fP +.SS \fBforeground\-scripts\fP .RS 0 .IP \(bu 2 -Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to -\|'production', otherwise empty\. +Default: false .IP \(bu 2 -Type: "dev", "optional", or "peer" (can be set multiple times) +Type: Boolean .RE .P -Dependency types to omit from the installation tree on disk\. -.P -Note that these dependencies \fIare\fR still resolved and added to the -\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not -physically installed on disk\. +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. .P -If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then -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\. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 829cdd96384be4..cb36d9f8543969 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -16,7 +16,7 @@ npm install npm install npm install / -aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add +aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add .fi .RE .SS Description @@ -512,6 +512,27 @@ Causes npm to install the package such that versions of npm prior to 1\.4, such as the one included with node 0\.8, can install the package\. This eliminates all automatic deduping\. If used with \fBglobal\-style\fP this option will be preferred\. +.SS \fBomit\fP +.RS 0 +.IP \(bu 2 +Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to +\|'production', otherwise empty\. +.IP \(bu 2 +Type: "dev", "optional", or "peer" (can be set multiple times) + +.RE +.P +Dependency types to omit from the installation tree on disk\. +.P +Note that these dependencies \fIare\fR still resolved and added to the +\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not +physically installed on disk\. +.P +If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then +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 \fBstrict\-peer\-deps\fP .RS 0 .IP \(bu 2 @@ -551,27 +572,21 @@ modules will also be disabled\. To remove extraneous modules with package\-locks disabled use \fBnpm prune\fP\|\. .P This configuration does not affect \fBnpm ci\fP\|\. -.SS \fBomit\fP +.SS \fBforeground\-scripts\fP .RS 0 .IP \(bu 2 -Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to -\|'production', otherwise empty\. +Default: false .IP \(bu 2 -Type: "dev", "optional", or "peer" (can be set multiple times) +Type: Boolean .RE .P -Dependency types to omit from the installation tree on disk\. -.P -Note that these dependencies \fIare\fR still resolved and added to the -\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not -physically installed on disk\. +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. .P -If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then -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\. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 50ea904cebb739..29d10078180d6e 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\.5\.3 /path/to/npm +npm@8\.5\.5 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-pkg.1 b/deps/npm/man/man1/npm-pkg.1 index c46ce352be894d..2bc2f48303c205 100644 --- a/deps/npm/man/man1/npm-pkg.1 +++ b/deps/npm/man/man1/npm-pkg.1 @@ -8,6 +8,8 @@ npm pkg set = [= \.\.\.] npm pkg get [ [ \.\.\.]] npm pkg delete [ \.\.\.] +npm pkg set [[]\.= \.\.\.] +npm pkg set [[]\.= \.\.\.] .fi .RE .SS Description @@ -209,6 +211,8 @@ Allow conflicting peerDependencies to be installed in the root project\. Implicitly set \fB\-\-yes\fP during \fBnpm init\fP\|\. .IP \(bu 2 Allow clobbering existing values in \fBnpm pkg\fP +.IP \(bu 2 +Allow unpublishing of entire packages (not just a single version)\. .RE .P diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index a54093a639b02e..f0f1583f8d8ac5 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -86,6 +86,36 @@ saving them to your \fBpackage\.json\fP\|\. .RE .P Not supported by all npm commands\. +.SS \fBforeground\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. +.P +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. +.SS \fBignore\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +If true, npm does not run scripts specified in package\.json files\. +.P +Note that commands explicitly intended to run a particular script, such as +\fBnpm start\fP, \fBnpm stop\fP, \fBnpm restart\fP, \fBnpm test\fP, and \fBnpm run\-script\fP +will still run their intended script if \fBignore\-scripts\fP is set, but they +will \fInot\fR run any pre\- or post\-scripts\. .SS \fBworkspace\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index a5515a65c78717..b02aeeb7ddbf96 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -59,6 +59,21 @@ executables\. Set to false to have it not do this\. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems\. +.SS \fBforeground\-scripts\fP +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. +.P +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 35ed5696698b82..f7a6f6342e7123 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -3,23 +3,15 @@ \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis .P -To learn more about how the npm registry treats unpublish, see our unpublish policies -.SS Unpublishing a single version of a package -.P .RS 2 .nf -npm unpublish [<@scope>/]@ +npm unpublish [<@scope>/][@] .fi .RE -.SS Unpublishing an entire package .P -.RS 2 -.nf -npm unpublish [<@scope>/] \-\-force -.fi -.RE +To learn more about how the npm registry treats unpublish, see our unpublish policies .SS Warning .P Consider using the npm help \fBdeprecate\fP command instead, @@ -93,6 +85,8 @@ Allow conflicting peerDependencies to be installed in the root project\. Implicitly set \fB\-\-yes\fP during \fBnpm init\fP\|\. .IP \(bu 2 Allow clobbering existing values in \fBnpm pkg\fP +.IP \(bu 2 +Allow unpublishing of entire packages (not just a single version)\. .RE .P diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 6daeaff2c10c74..39ab75c9be426a 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -159,6 +159,22 @@ need to run \fBnpm install \-g [\.\.\.]\fP NOTE: If a package has been upgraded to a version newer than \fBlatest\fP, it will be \fIdowngraded\fR\|\. .SS Configuration +.SS \fBsave\fP +.RS 0 +.IP \(bu 2 +Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it +defaults to \fBfalse\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Save installed packages to a \fBpackage\.json\fP file as dependencies\. +.P +When used with the \fBnpm rm\fP command, removes the dependency from +\fBpackage\.json\fP\|\. +.P +Will also prevent writing to \fBpackage\-lock\.json\fP if set to \fBfalse\fP\|\. .SS \fBglobal\fP .RS 0 .IP \(bu 2 @@ -209,6 +225,27 @@ Causes npm to install the package such that versions of npm prior to 1\.4, such as the one included with node 0\.8, can install the package\. This eliminates all automatic deduping\. If used with \fBglobal\-style\fP this option will be preferred\. +.SS \fBomit\fP +.RS 0 +.IP \(bu 2 +Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to +\|'production', otherwise empty\. +.IP \(bu 2 +Type: "dev", "optional", or "peer" (can be set multiple times) + +.RE +.P +Dependency types to omit from the installation tree on disk\. +.P +Note that these dependencies \fIare\fR still resolved and added to the +\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not +physically installed on disk\. +.P +If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then +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 \fBstrict\-peer\-deps\fP .RS 0 .IP \(bu 2 @@ -248,43 +285,21 @@ modules will also be disabled\. To remove extraneous modules with package\-locks disabled use \fBnpm prune\fP\|\. .P This configuration does not affect \fBnpm ci\fP\|\. -.SS \fBsave\fP +.SS \fBforeground\-scripts\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: false .IP \(bu 2 Type: Boolean .RE .P -Save installed packages to a \fBpackage\.json\fP file as dependencies\. +Run all build scripts (ie, \fBpreinstall\fP, \fBinstall\fP, and \fBpostinstall\fP) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process\. .P -When used with the \fBnpm rm\fP command, removes the dependency from -\fBpackage\.json\fP\|\. -.P -Will also prevent writing to \fBpackage\-lock\.json\fP if set to \fBfalse\fP\|\. -.SS \fBomit\fP -.RS 0 -.IP \(bu 2 -Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to -\|'production', otherwise empty\. -.IP \(bu 2 -Type: "dev", "optional", or "peer" (can be set multiple times) - -.RE -.P -Dependency types to omit from the installation tree on disk\. -.P -Note that these dependencies \fIare\fR still resolved and added to the -\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not -physically installed on disk\. -.P -If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then -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\. +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 09387764e826c4..9b6b81c8a95508 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -41,7 +41,8 @@ Type: Boolean .RE .P -Tag the commit when using the \fBnpm version\fP command\. +Tag the commit when using the \fBnpm version\fP command\. Setting this to false +results in no commit being made at all\. .SS \fBjson\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 0b65e8ff019627..3b5d8e9e336e51 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\.5\.3 +8\.5\.5 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index fb7dd46c6f5379..99116b6a78517a 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -370,7 +370,7 @@ This should be a module relative to the root of your package folder\. For most modules, it makes the most sense to have a main script and often not much else\. .P -If \fBmain\fP is not set it defaults to \fBindex\.js\fP in the packages root folder\. +If \fBmain\fP is not set it defaults to \fBindex\.js\fP in the package's root folder\. .SS browser .P If your module is meant to be used client\-side the browser field should be @@ -772,6 +772,10 @@ in which case they will be normalized to a relative path and added to your This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing packages to the public registry\. +.P +\fInote\fR: Packages linked by local path will not have their own +dependencies installed when \fBnpm install\fP is ran in this case\. You must +run \fBnpm install\fP from inside the local path itself\. .SS devDependencies .P If someone is planning on downloading and using your module in their diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index c98ed3c93ce2b1..23150ebadfbd90 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -668,6 +668,8 @@ Allow conflicting peerDependencies to be installed in the root project\. Implicitly set \fB\-\-yes\fP during \fBnpm init\fP\|\. .IP \(bu 2 Allow clobbering existing values in \fBnpm pkg\fP +.IP \(bu 2 +Allow unpublishing of entire packages (not just a single version)\. .RE .P @@ -731,7 +733,8 @@ Type: Boolean .RE .P -Tag the commit when using the \fBnpm version\fP command\. +Tag the commit when using the \fBnpm version\fP command\. Setting this to false +results in no commit being made at all\. .SS \fBglobal\fP .RS 0 .IP \(bu 2 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 c06ed80265e027..b04fc88f65ccba 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 @@ -435,7 +435,7 @@ module.exports = cls => class ActualLoader extends cls { if (d.dummy) { // it's a placeholder, so likely would not have loaded this dep, // unless another dep in the tree also needs it. - const depPath = `${p}/node_modules/${name}` + const depPath = normalize(`${p}/node_modules/${name}`) const cached = this[_cache].get(depPath) if (!cached || cached.dummy) { depPromises.push(this[_loadFSNode]({ 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 09b4419f5b5dcc..8b47904004a967 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -136,15 +136,19 @@ module.exports = cls => class Builder extends cls { process.emit('time', `build:${type}`) await this[_buildQueues](nodes) - if (!this[_ignoreScripts]) { - await this[_runScripts]('preinstall') - } - if (this[_binLinks] && type !== 'links') { - await this[_linkAllBins]() - } - - // links should also run prepare scripts and only link bins after that - if (type === 'links') { + // 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 { await this[_runScripts]('prepare') if (this[_binLinks]) { @@ -152,11 +156,6 @@ module.exports = cls => class Builder extends cls { } } - 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 4bc1c7ee4e72ec..acb889cebca3dd 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -1225,14 +1225,23 @@ module.exports = cls => class Reifier extends cls { newSpec = h.shortcut(opt) } } else if (isLocalDep) { - // save the relative path in package.json - // Normally saveSpec is updated with the proper relative - // path already, but it's possible to specify a full absolute - // path initially, in which case we can end up with the wrong - // thing, so just get the ultimate fetchSpec and relativize it. - const p = req.fetchSpec.replace(/^file:/, '') - const rel = relpath(addTree.realpath, p) - newSpec = `file:${rel}` + // when finding workspace nodes, make sure that + // we save them using their version instead of + // using their relative path + if (edge.type === 'workspace') { + const { version } = edge.to.target + const prefixRange = version ? this[_savePrefix] + version : '*' + newSpec = prefixRange + } else { + // save the relative path in package.json + // Normally saveSpec is updated with the proper relative + // path already, but it's possible to specify a full absolute + // path initially, in which case we can end up with the wrong + // thing, so just get the ultimate fetchSpec and relativize it. + const p = req.fetchSpec.replace(/^file:/, '') + const rel = relpath(addTree.realpath, p) + newSpec = `file:${rel}` + } } else { newSpec = req.saveSpec } diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index c9dee34b72c4fb..258234b977ea81 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,19 +1,19 @@ { "name": "@npmcli/arborist", - "version": "5.0.0", + "version": "5.0.3", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/map-workspaces": "^2.0.0", - "@npmcli/metavuln-calculator": "^3.0.0", + "@npmcli/metavuln-calculator": "^3.0.1", "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.3", "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^3.0.0", "bin-links": "^3.0.0", - "cacache": "^15.0.3", + "cacache": "^16.0.0", "common-ancestor-path": "^1.0.1", "json-parse-even-better-errors": "^2.3.1", "json-stringify-nice": "^1.1.4", @@ -25,7 +25,7 @@ "npm-pick-manifest": "^7.0.0", "npm-registry-fetch": "^13.0.0", "npmlog": "^6.0.1", - "pacote": "^13.0.2", + "pacote": "^13.0.5", "parse-conflict-json": "^2.0.1", "proc-log": "^2.0.0", "promise-all-reject-late": "^1.0.0", diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js deleted file mode 100644 index 7eef327e92527f..00000000000000 --- a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const x=a(i);if(!x)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new x(i),this.prev=new x(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={},s=function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10);module.exports=s})(); \ No newline at end of file diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs deleted file mode 100644 index 3a4d674c07a412..00000000000000 --- a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs +++ /dev/null @@ -1 +0,0 @@ -var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const L=a(i);if(!L)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new L(i),this.prev=new L(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={};!function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10); \ No newline at end of file diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js deleted file mode 100644 index e9b2f37013e72e..00000000000000 --- a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js +++ /dev/null @@ -1,587 +0,0 @@ -const perf = typeof performance === 'object' && performance && - typeof performance.now === 'function' ? performance : Date - -const warned = new Set() -const deprecatedOption = (opt, instead) => { - const code = `LRU_CACHE_OPTION_${opt}` - if (shouldWarn(code)) { - warn(code, `${opt} option`, `options.${instead}`, LRUCache) - } -} -const deprecatedMethod = (method, instead) => { - const code = `LRU_CACHE_METHOD_${method}` - if (shouldWarn(code)) { - const { prototype } = LRUCache - const { get } = Object.getOwnPropertyDescriptor(prototype, method) - warn(code, `${method} method`, `cache.${instead}()`, get) - } -} -const deprecatedProperty = (field, instead) => { - const code = `LRU_CACHE_PROPERTY_${field}` - if (shouldWarn(code)) { - const { prototype } = LRUCache - const { get } = Object.getOwnPropertyDescriptor(prototype, field) - warn(code, `${field} property`, `cache.${instead}`, get) - } -} -const shouldWarn = (code) => !(process.noDeprecation || warned.has(code)) -const warn = (code, what, instead, fn) => { - warned.add(code) - process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn) -} - -const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n) - -/* istanbul ignore next - This is a little bit ridiculous, tbh. - * The maximum array length is 2^32-1 or thereabouts on most JS impls. - * And well before that point, you're caching the entire world, I mean, - * that's ~32GB of just integers for the next/prev links, plus whatever - * else to hold that many keys and values. Just filling the memory with - * zeroes at init time is brutal when you get that big. - * But why not be complete? - * Maybe in the future, these limits will have expanded. */ -const getUintArray = max => !isPosInt(max) ? null -: max <= Math.pow(2, 8) ? Uint8Array -: max <= Math.pow(2, 16) ? Uint16Array -: max <= Math.pow(2, 32) ? Uint32Array -: max <= Number.MAX_SAFE_INTEGER ? ZeroArray -: null - -class ZeroArray extends Array { - constructor (size) { - super(size) - this.fill(0) - } -} - -class Stack { - constructor (max) { - const UintArray = getUintArray(max) - this.heap = new UintArray(max) - this.length = 0 - } - push (n) { - this.heap[this.length++] = n - } - pop () { - return this.heap[--this.length] - } -} - -class LRUCache { - constructor (options = {}) { - const { - max, - ttl, - ttlResolution = 1, - ttlAutopurge, - updateAgeOnGet, - allowStale, - dispose, - disposeAfter, - noDisposeOnSet, - noUpdateTTL, - maxSize, - sizeCalculation, - } = options - - // deprecated options, don't trigger a warning for getting them if - // the thing being passed in is another LRUCache we're copying. - const { - length, - maxAge, - stale, - } = options instanceof LRUCache ? {} : options - - if (!isPosInt(max)) { - throw new TypeError('max option must be an integer') - } - - const UintArray = getUintArray(max) - if (!UintArray) { - throw new Error('invalid max value: ' + max) - } - - this.max = max - this.maxSize = maxSize || 0 - this.sizeCalculation = sizeCalculation || length - if (this.sizeCalculation) { - if (!this.maxSize) { - throw new TypeError('cannot set sizeCalculation without setting maxSize') - } - if (typeof this.sizeCalculation !== 'function') { - throw new TypeError('sizeCalculating set to non-function') - } - } - this.keyMap = new Map() - this.keyList = new Array(max).fill(null) - this.valList = new Array(max).fill(null) - this.next = new UintArray(max) - this.prev = new UintArray(max) - this.head = 0 - this.tail = 0 - this.free = new Stack(max) - this.initialFill = 1 - this.size = 0 - - if (typeof dispose === 'function') { - this.dispose = dispose - } - if (typeof disposeAfter === 'function') { - this.disposeAfter = disposeAfter - this.disposed = [] - } else { - this.disposeAfter = null - this.disposed = null - } - this.noDisposeOnSet = !!noDisposeOnSet - this.noUpdateTTL = !!noUpdateTTL - - if (this.maxSize) { - if (!isPosInt(this.maxSize)) { - throw new TypeError('maxSize must be a positive integer if specified') - } - this.initializeSizeTracking() - } - - this.allowStale = !!allowStale || !!stale - this.updateAgeOnGet = !!updateAgeOnGet - this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 - ? ttlResolution : 1 - this.ttlAutopurge = !!ttlAutopurge - this.ttl = ttl || maxAge || 0 - if (this.ttl) { - if (!isPosInt(this.ttl)) { - throw new TypeError('ttl must be a positive integer if specified') - } - this.initializeTTLTracking() - } - - if (stale) { - deprecatedOption('stale', 'allowStale') - } - if (maxAge) { - deprecatedOption('maxAge', 'ttl') - } - if (length) { - deprecatedOption('length', 'sizeCalculation') - } - } - - initializeTTLTracking () { - this.ttls = new ZeroArray(this.max) - this.starts = new ZeroArray(this.max) - this.setItemTTL = (index, ttl) => { - this.starts[index] = ttl !== 0 ? perf.now() : 0 - this.ttls[index] = ttl - if (ttl !== 0 && this.ttlAutopurge) { - const t = setTimeout(() => { - if (this.isStale(index)) { - this.delete(this.keyList[index]) - } - }, ttl + 1) - /* istanbul ignore else - unref() not supported on all platforms */ - if (t.unref) { - t.unref() - } - } - } - this.updateItemAge = (index) => { - this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0 - } - // debounce calls to perf.now() to 1s so we're not hitting - // that costly call repeatedly. - let cachedNow = 0 - const getNow = () => { - const n = perf.now() - if (this.ttlResolution > 0) { - cachedNow = n - const t = setTimeout(() => cachedNow = 0, this.ttlResolution) - /* istanbul ignore else - not available on all platforms */ - if (t.unref) { - t.unref() - } - } - return n - } - this.isStale = (index) => { - return this.ttls[index] !== 0 && this.starts[index] !== 0 && - ((cachedNow || getNow()) - this.starts[index] > this.ttls[index]) - } - } - updateItemAge (index) {} - setItemTTL (index, ttl) {} - isStale (index) { return false } - - initializeSizeTracking () { - this.calculatedSize = 0 - this.sizes = new ZeroArray(this.max) - this.removeItemSize = index => this.calculatedSize -= this.sizes[index] - this.addItemSize = (index, v, k, size, sizeCalculation) => { - const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0) - this.sizes[index] = isPosInt(s) ? s : 0 - const maxSize = this.maxSize - this.sizes[index] - while (this.calculatedSize > maxSize) { - this.evict() - } - 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, sizeCalculation) {} - - *indexes () { - if (this.size) { - for (let i = this.tail; true; i = this.prev[i]) { - if (!this.isStale(i)) { - yield i - } - if (i === this.head) { - break - } - } - } - } - *rindexes () { - if (this.size) { - for (let i = this.head; true; i = this.next[i]) { - if (!this.isStale(i)) { - yield i - } - if (i === this.tail) { - break - } - } - } - } - - *entries () { - for (const i of this.indexes()) { - yield [this.keyList[i], this.valList[i]] - } - } - - *keys () { - for (const i of this.indexes()) { - yield this.keyList[i] - } - } - - *values () { - for (const i of this.indexes()) { - yield this.valList[i] - } - } - - [Symbol.iterator] () { - return this.entries() - } - - find (fn, getOptions = {}) { - for (const i of this.indexes()) { - if (fn(this.valList[i], this.keyList[i], this)) { - return this.get(this.keyList[i], getOptions) - } - } - } - - forEach (fn, thisp = this) { - for (const i of this.indexes()) { - fn.call(thisp, this.valList[i], this.keyList[i], this) - } - } - - rforEach (fn, thisp = this) { - for (const i of this.rindexes()) { - fn.call(thisp, this.valList[i], this.keyList[i], this) - } - } - - get prune () { - deprecatedMethod('prune', 'purgeStale') - return this.purgeStale - } - - purgeStale () { - let deleted = false - if (this.size) { - for (let i = this.head; true; i = this.next[i]) { - const b = i === this.tail - if (this.isStale(i)) { - this.delete(this.keyList[i]) - deleted = true - } - if (b) { - break - } - } - } - return deleted - } - - dump () { - const arr = [] - for (const i of this.indexes()) { - const key = this.keyList[i] - const value = this.valList[i] - const entry = { value } - if (this.ttls) { - entry.ttl = this.ttls[i] - } - if (this.sizes) { - entry.size = this.sizes[i] - } - arr.unshift([key, entry]) - } - return arr - } - - load (arr) { - this.clear() - for (const [key, entry] of arr) { - this.set(key, entry.value, entry) - } - } - - dispose (v, k, reason) {} - - set (k, v, { - ttl = this.ttl, - noDisposeOnSet = this.noDisposeOnSet, - size = 0, - sizeCalculation = this.sizeCalculation, - noUpdateTTL = this.noUpdateTTL, - } = {}) { - let index = this.size === 0 ? undefined : this.keyMap.get(k) - if (index === undefined) { - // addition - index = this.newIndex() - this.keyList[index] = k - this.valList[index] = v - this.keyMap.set(k, index) - this.next[this.tail] = index - this.prev[index] = this.tail - this.tail = index - this.size ++ - this.addItemSize(index, v, k, size, sizeCalculation) - noUpdateTTL = false - } else { - // update - const oldVal = this.valList[index] - if (v !== oldVal) { - if (!noDisposeOnSet) { - this.dispose(oldVal, k, 'set') - if (this.disposeAfter) { - this.disposed.push([oldVal, k, 'set']) - } - } - this.removeItemSize(index) - this.valList[index] = v - this.addItemSize(index, v, k, size, sizeCalculation) - } - this.moveToTail(index) - } - if (ttl !== 0 && this.ttl === 0 && !this.ttls) { - this.initializeTTLTracking() - } - if (!noUpdateTTL) { - this.setItemTTL(index, ttl) - } - if (this.disposeAfter) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - return this - } - - newIndex () { - if (this.size === 0) { - return this.tail - } - if (this.size === this.max) { - return this.evict() - } - if (this.free.length !== 0) { - return this.free.pop() - } - // initial fill, just keep writing down the list - return this.initialFill++ - } - - pop () { - if (this.size) { - const val = this.valList[this.head] - this.evict() - return val - } - } - - evict () { - const head = this.head - const k = this.keyList[head] - const v = this.valList[head] - this.dispose(v, k, 'evict') - if (this.disposeAfter) { - this.disposed.push([v, k, 'evict']) - } - this.removeItemSize(head) - this.head = this.next[head] - this.keyMap.delete(k) - this.size -- - return head - } - - has (k) { - return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k)) - } - - // like get(), but without any LRU updating or TTL expiration - peek (k, { allowStale = this.allowStale } = {}) { - const index = this.keyMap.get(k) - if (index !== undefined && (allowStale || !this.isStale(index))) { - return this.valList[index] - } - } - - get (k, { - allowStale = this.allowStale, - updateAgeOnGet = this.updateAgeOnGet, - } = {}) { - const index = this.keyMap.get(k) - if (index !== undefined) { - if (this.isStale(index)) { - const value = allowStale ? this.valList[index] : undefined - this.delete(k) - return value - } else { - this.moveToTail(index) - if (updateAgeOnGet) { - this.updateItemAge(index) - } - return this.valList[index] - } - } - } - - connect (p, n) { - this.prev[n] = p - this.next[p] = n - } - - moveToTail (index) { - // if tail already, nothing to do - // if head, move head to next[index] - // else - // move next[prev[index]] to next[index] (head has no prev) - // move prev[next[index]] to prev[index] - // prev[index] = tail - // next[tail] = index - // tail = index - if (index !== this.tail) { - if (index === this.head) { - this.head = this.next[index] - } else { - this.connect(this.prev[index], this.next[index]) - } - this.connect(this.tail, index) - this.tail = index - } - } - - get del () { - deprecatedMethod('del', 'delete') - return this.delete - } - delete (k) { - let deleted = false - if (this.size !== 0) { - const index = this.keyMap.get(k) - if (index !== undefined) { - deleted = true - if (this.size === 1) { - this.clear() - } else { - this.removeItemSize(index) - this.dispose(this.valList[index], k, 'delete') - if (this.disposeAfter) { - this.disposed.push([this.valList[index], k, 'delete']) - } - this.keyMap.delete(k) - this.keyList[index] = null - this.valList[index] = null - if (index === this.tail) { - this.tail = this.prev[index] - } else if (index === this.head) { - this.head = this.next[index] - } else { - this.next[this.prev[index]] = this.next[index] - this.prev[this.next[index]] = this.prev[index] - } - this.size -- - this.free.push(index) - } - } - } - if (this.disposed) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - return deleted - } - - clear () { - if (this.dispose !== LRUCache.prototype.dispose) { - for (const index of this.rindexes()) { - this.dispose(this.valList[index], this.keyList[index], 'delete') - } - } - if (this.disposeAfter) { - for (const index of this.rindexes()) { - this.disposed.push([this.valList[index], this.keyList[index], 'delete']) - } - } - this.keyMap.clear() - this.valList.fill(null) - this.keyList.fill(null) - if (this.ttls) { - this.ttls.fill(0) - this.starts.fill(0) - } - if (this.sizes) { - this.sizes.fill(0) - } - this.head = 0 - this.tail = 0 - this.initialFill = 1 - this.free.length = 0 - this.calculatedSize = 0 - this.size = 0 - if (this.disposed) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - } - get reset () { - deprecatedMethod('reset', 'clear') - return this.clear - } - - get length () { - deprecatedProperty('length', 'size') - return this.size - } -} - -module.exports = LRUCache diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json deleted file mode 100644 index ae92116975dc96..00000000000000 --- a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "lru-cache", - "description": "A cache object that deletes the least-recently-used items.", - "version": "7.4.0", - "author": "Isaac Z. Schlueter ", - "keywords": [ - "mru", - "lru", - "cache" - ], - "scripts": { - "prepare": "webpack-cli -o bundle ./index.js --node-env production", - "build": "npm run prepare", - "presize": "npm run prepare", - "test": "tap", - "snap": "tap", - "size": "size-limit", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "main": "index.js", - "browser": "./bundle/main.js", - "exports": { - ".": "./index.js", - "./browser": "./bundle/main.js" - }, - "repository": "git://github.com/isaacs/node-lru-cache.git", - "devDependencies": { - "@size-limit/preset-small-lib": "^7.0.8", - "benchmark": "^2.1.4", - "size-limit": "^7.0.8", - "tap": "^15.1.6", - "webpack-cli": "^4.9.2" - }, - "license": "ISC", - "files": [ - "index.js", - "bundle" - ], - "engines": { - "node": ">=12" - }, - "tap": { - "coverage-map": "map.js" - }, - "size-limit": [ - { - "path": "./bundle/main.js" - } - ] -} diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js index a2401b565b3353..3ac545e9c15c4e 100644 --- a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js +++ b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js @@ -117,28 +117,52 @@ async function mapWorkspaces (opts = {}) { const name = getPackageName(pkg, packagePathname) + let seenPackagePathnames = seen.get(name) + if (!seenPackagePathnames) { + seenPackagePathnames = new Set() + seen.set(name, seenPackagePathnames) + } if (item.negate) { - results.delete(packagePathname, name) + seenPackagePathnames.delete(packagePathname) } else { - if (seen.has(name) && seen.get(name) !== packagePathname) { - throw getError({ - Type: Error, - message: [ - 'must not have multiple workspaces with the same name', - `package '${name}' has conflicts in the following paths:`, - ' ' + seen.get(name), - ' ' + packagePathname, - ].join('\n'), - code: 'EDUPLICATEWORKSPACE', - }) - } - - seen.set(name, packagePathname) - results.set(packagePathname, name) + seenPackagePathnames.add(packagePathname) } } } - return reverseResultMap(results) + + const errorMessageArray = ['must not have multiple workspaces with the same name'] + for (const [packageName, seenPackagePathnames] of seen) { + if (seenPackagePathnames.size === 0) { + continue + } + if (seenPackagePathnames.size > 1) { + addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames) + } else { + results.set(packageName, seenPackagePathnames.values().next().value) + } + } + + if (errorMessageArray.length > 1) { + throw getError({ + Type: Error, + message: errorMessageArray.join('\n'), + code: 'EDUPLICATEWORKSPACE', + }) + } + + return results +} + +function addDuplicateErrorMessages (messageArray, packageName, packagePathnames) { + messageArray.push( + `package '${packageName}' has conflicts in the following paths:` + ) + + for (const packagePathname of packagePathnames) { + messageArray.push( + ' ' + packagePathname + ) + } } mapWorkspaces.virtual = function (opts = {}) { diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/package.json b/deps/npm/node_modules/@npmcli/map-workspaces/package.json index aa46ad0f42f2de..8ae823cf3e9b7b 100644 --- a/deps/npm/node_modules/@npmcli/map-workspaces/package.json +++ b/deps/npm/node_modules/@npmcli/map-workspaces/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/map-workspaces", - "version": "2.0.1", + "version": "2.0.2", "main": "lib/index.js", "files": [ "bin", @@ -37,23 +37,18 @@ "tap": { "check-coverage": true }, - "standard": { - "ignore": [ - "/tap-snapshots/" - ] - }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", - "eslint": "^8.9.0", + "@npmcli/template-oss": "^2.9.2", + "eslint": "^8.10.0", "tap": "^15.1.6" }, "dependencies": { "@npmcli/name-from-folder": "^1.0.1", "glob": "^7.2.0", - "minimatch": "^5.0.0", + "minimatch": "^5.0.1", "read-package-json-fast": "^2.0.3" }, "templateOSS": { - "version": "2.7.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index 385a34b85af274..6c05ee529cc829 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/metavuln-calculator", - "version": "3.0.0", + "version": "3.0.1", "main": "lib/index.js", "files": [ "bin", @@ -29,20 +29,20 @@ "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", + "@npmcli/template-oss": "^2.9.2", "require-inject": "^1.4.4", "tap": "^15.1.6" }, "dependencies": { - "cacache": "^15.3.0", + "cacache": "^16.0.0", "json-parse-even-better-errors": "^2.3.1", - "pacote": "^13.0.1", + "pacote": "^13.0.3", "semver": "^7.3.5" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" }, "templateOSS": { - "version": "2.7.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/cli-columns/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/ansi-regex/index.d.ts similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/ansi-regex/index.d.ts rename to deps/npm/node_modules/ansi-regex/index.d.ts diff --git a/deps/npm/node_modules/cli-columns/node_modules/ansi-regex/index.js b/deps/npm/node_modules/ansi-regex/index.js similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/ansi-regex/index.js rename to deps/npm/node_modules/ansi-regex/index.js diff --git a/deps/npm/node_modules/cli-columns/node_modules/ansi-regex/license b/deps/npm/node_modules/ansi-regex/license similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/ansi-regex/license rename to deps/npm/node_modules/ansi-regex/license diff --git a/deps/npm/node_modules/cli-columns/node_modules/ansi-regex/package.json b/deps/npm/node_modules/ansi-regex/package.json similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/ansi-regex/package.json rename to deps/npm/node_modules/ansi-regex/package.json diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/ansi-regex/readme.md similarity index 100% rename from deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md rename to deps/npm/node_modules/ansi-regex/readme.md diff --git a/deps/npm/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/cacache/lib/content/read.js index 034e8eee05b101..8bffb2af83caba 100644 --- a/deps/npm/node_modules/cacache/lib/content/read.js +++ b/deps/npm/node_modules/cacache/lib/content/read.js @@ -20,15 +20,18 @@ function read (cache, integrity, opts = {}) { // get size return lstat(cpath).then(stat => ({ stat, cpath, sri })) }).then(({ stat, cpath, sri }) => { - if (typeof size === 'number' && stat.size !== size) + if (typeof size === 'number' && stat.size !== size) { throw sizeError(size, stat.size) + } - if (stat.size > MAX_SINGLE_READ_SIZE) + if (stat.size > MAX_SINGLE_READ_SIZE) { return readPipeline(cpath, stat.size, sri, new Pipeline()).concat() + } return readFile(cpath, null).then((data) => { - if (!ssri.checkData(data, sri)) + if (!ssri.checkData(data, sri)) { throw integrityError(sri, cpath) + } return data }) @@ -55,11 +58,13 @@ function readSync (cache, integrity, opts = {}) { const { size } = opts return withContentSriSync(cache, integrity, (cpath, sri) => { const data = fs.readFileSync(cpath) - if (typeof size === 'number' && size !== data.length) + if (typeof size === 'number' && size !== data.length) { throw sizeError(size, data.length) + } - if (ssri.checkData(data, sri)) + if (ssri.checkData(data, sri)) { return data + } throw integrityError(sri, cpath) }) @@ -75,8 +80,9 @@ function readStream (cache, integrity, opts = {}) { // just lstat to ensure it exists return lstat(cpath).then((stat) => ({ stat, cpath, sri })) }).then(({ stat, cpath, sri }) => { - if (typeof size === 'number' && size !== stat.size) + if (typeof size === 'number' && size !== stat.size) { return stream.emit('error', sizeError(size, stat.size)) + } readPipeline(cpath, stat.size, sri, stream) }, er => stream.emit('error', er)) @@ -106,21 +112,24 @@ function copySync (cache, integrity, dest) { module.exports.hasContent = hasContent function hasContent (cache, integrity) { - if (!integrity) + if (!integrity) { return Promise.resolve(false) + } return withContentSri(cache, integrity, (cpath, sri) => { return lstat(cpath).then((stat) => ({ size: stat.size, sri, stat })) }).catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return false + } if (err.code === 'EPERM') { /* istanbul ignore else */ - if (process.platform !== 'win32') + if (process.platform !== 'win32') { throw err - else + } else { return false + } } }) } @@ -128,23 +137,26 @@ function hasContent (cache, integrity) { module.exports.hasContent.sync = hasContentSync function hasContentSync (cache, integrity) { - if (!integrity) + if (!integrity) { return false + } return withContentSriSync(cache, integrity, (cpath, sri) => { try { const stat = fs.lstatSync(cpath) return { size: stat.size, sri, stat } } catch (err) { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return false + } if (err.code === 'EPERM') { /* istanbul ignore else */ - if (process.platform !== 'win32') + if (process.platform !== 'win32') { throw err - else + } else { return false + } } } }) @@ -180,13 +192,15 @@ function withContentSri (cache, integrity, fn) { .then((results) => { // Return the first non error if it is found const result = results.find((r) => !(r instanceof Error)) - if (result) + if (result) { return result + } // Throw the No matching content found error const enoentError = results.find((r) => r.code === 'ENOENT') - if (enoentError) + if (enoentError) { throw enoentError + } // Throw generic error throw results.find((r) => r instanceof Error) @@ -228,6 +242,7 @@ function withContentSriSync (cache, integrity, fn) { } function sizeError (expected, found) { + /* eslint-disable-next-line max-len */ const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) err.expected = expected err.found = found diff --git a/deps/npm/node_modules/cacache/lib/content/rm.js b/deps/npm/node_modules/cacache/lib/content/rm.js index 6a3d1a3d023406..50612364e9b48a 100644 --- a/deps/npm/node_modules/cacache/lib/content/rm.js +++ b/deps/npm/node_modules/cacache/lib/content/rm.js @@ -11,9 +11,10 @@ module.exports = rm function rm (cache, integrity) { return hasContent(cache, integrity).then((content) => { // ~pretty~ sure we can't end up with a content lacking sri, but be safe - if (content && content.sri) + if (content && content.sri) { return rimraf(contentPath(cache, content.sri)).then(() => true) - else + } else { return false + } }) } diff --git a/deps/npm/node_modules/cacache/lib/content/write.js b/deps/npm/node_modules/cacache/lib/content/write.js index dde1bd1dd5daef..a71e81ad5e150c 100644 --- a/deps/npm/node_modules/cacache/lib/content/write.js +++ b/deps/npm/node_modules/cacache/lib/content/write.js @@ -22,15 +22,18 @@ module.exports = write function write (cache, data, opts = {}) { const { algorithms, size, integrity } = opts - if (algorithms && algorithms.length > 1) + if (algorithms && algorithms.length > 1) { throw new Error('opts.algorithms only supports a single algorithm for now') + } - if (typeof size === 'number' && data.length !== size) + if (typeof size === 'number' && data.length !== size) { return Promise.reject(sizeError(size, data.length)) + } const sri = ssri.fromData(data, algorithms ? { algorithms } : {}) - if (integrity && !ssri.checkData(data, integrity, opts)) + if (integrity && !ssri.checkData(data, integrity, opts)) { return Promise.reject(checksumError(integrity, sri)) + } return disposer(makeTmp(cache, opts), makeTmpDisposer, (tmp) => { @@ -149,8 +152,9 @@ function makeTmp (cache, opts) { } function makeTmpDisposer (tmp) { - if (tmp.moved) + if (tmp.moved) { return Promise.resolve() + } return rimraf(tmp.target) } @@ -171,6 +175,7 @@ function moveToDestination (tmp, cache, sri, opts) { } function sizeError (expected, found) { + /* eslint-disable-next-line max-len */ const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) err.expected = expected err.found = found diff --git a/deps/npm/node_modules/cacache/lib/entry-index.js b/deps/npm/node_modules/cacache/lib/entry-index.js index 71aac5ed75b146..426778b8509634 100644 --- a/deps/npm/node_modules/cacache/lib/entry-index.js +++ b/deps/npm/node_modules/cacache/lib/entry-index.js @@ -49,8 +49,9 @@ async function compact (cache, key, matchFn, opts = {}) { // if the integrity is null and no validateEntry is provided, we break // as we consider the null integrity to be a deletion of everything // that came before it. - if (entry.integrity === null && !opts.validateEntry) + if (entry.integrity === null && !opts.validateEntry) { break + } // if this entry is valid, and it is either the first entry or // the newEntries array doesn't already include an entry that @@ -58,8 +59,9 @@ async function compact (cache, key, matchFn, opts = {}) { // it to the beginning of our list if ((!opts.validateEntry || opts.validateEntry(entry) === true) && (newEntries.length === 0 || - !newEntries.find((oldEntry) => matchFn(oldEntry, entry)))) + !newEntries.find((oldEntry) => matchFn(oldEntry, entry)))) { newEntries.unshift(entry) + } } const newIndex = '\n' + newEntries.map((entry) => { @@ -78,8 +80,9 @@ async function compact (cache, key, matchFn, opts = {}) { } const teardown = async (tmp) => { - if (!tmp.moved) + if (!tmp.moved) { return rimraf(tmp.target) + } } const write = async (tmp) => { @@ -92,8 +95,9 @@ async function compact (cache, key, matchFn, opts = {}) { try { await fixOwner.chownr(cache, bucket) } catch (err) { - if (err.code !== 'ENOENT') + if (err.code !== 'ENOENT') { throw err + } } } @@ -136,8 +140,9 @@ function insert (cache, key, integrity, opts = {}) { }) .then(() => fixOwner.chownr(cache, bucket)) .catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return undefined + } throw err // There's a class of race conditions that happen when things get deleted @@ -169,8 +174,9 @@ function insertSync (cache, key, integrity, opts = {}) { try { fixOwner.chownr.sync(cache, bucket) } catch (err) { - if (err.code !== 'ENOENT') + if (err.code !== 'ENOENT') { throw err + } } return formatEntry(cache, entry) } @@ -182,17 +188,19 @@ function find (cache, key) { return bucketEntries(bucket) .then((entries) => { return entries.reduce((latest, next) => { - if (next && next.key === key) + if (next && next.key === key) { return formatEntry(cache, next) - else + } else { return latest + } }, null) }) .catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null - else + } else { throw err + } }) } @@ -202,24 +210,27 @@ function findSync (cache, key) { const bucket = bucketPath(cache, key) try { return bucketEntriesSync(bucket).reduce((latest, next) => { - if (next && next.key === key) + if (next && next.key === key) { return formatEntry(cache, next) - else + } else { return latest + } }, null) } catch (err) { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null - else + } else { throw err + } } } module.exports.delete = del function del (cache, key, opts = {}) { - if (!opts.removeFully) + if (!opts.removeFully) { return insert(cache, key, null, opts) + } const bucket = bucketPath(cache, key) return rimraf(bucket) @@ -228,8 +239,9 @@ function del (cache, key, opts = {}) { module.exports.delete.sync = delSync function delSync (cache, key, opts = {}) { - if (!opts.removeFully) + if (!opts.removeFully) { return insertSync(cache, key, null, opts) + } const bucket = bucketPath(cache, key) return rimraf.sync(bucket) @@ -263,12 +275,14 @@ function lsStream (cache) { // reduced is a map of key => entry for (const entry of reduced.values()) { const formatted = formatEntry(cache, entry) - if (formatted) + if (formatted) { stream.write(formatted) + } } }).catch(err => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return undefined + } throw err }) }) @@ -312,8 +326,9 @@ function bucketEntriesSync (bucket, filter) { function _bucketEntries (data, filter) { const entries = [] data.split('\n').forEach((entry) => { - if (!entry) + if (!entry) { return + } const pieces = entry.split('\t') if (!pieces[1] || hashEntry(pieces[1]) !== pieces[0]) { @@ -328,8 +343,9 @@ function _bucketEntries (data, filter) { // Entry is corrupted! return } - if (obj) + if (obj) { entries.push(obj) + } }) return entries } @@ -371,8 +387,9 @@ function hash (str, digest) { function formatEntry (cache, entry, keepAll) { // Treat null digests as deletions. They'll shadow any previous entries. - if (!entry.integrity && !keepAll) + if (!entry.integrity && !keepAll) { return null + } return { key: entry.key, @@ -386,8 +403,9 @@ function formatEntry (cache, entry, keepAll) { function readdirOrEmpty (dir) { return readdir(dir).catch((err) => { - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { return [] + } throw err }) diff --git a/deps/npm/node_modules/cacache/get.js b/deps/npm/node_modules/cacache/lib/get.js similarity index 91% rename from deps/npm/node_modules/cacache/get.js rename to deps/npm/node_modules/cacache/lib/get.js index 4e905e7cf861c1..d9d4bf4c6416fb 100644 --- a/deps/npm/node_modules/cacache/get.js +++ b/deps/npm/node_modules/cacache/lib/get.js @@ -6,9 +6,9 @@ const Pipeline = require('minipass-pipeline') const fs = require('fs') const util = require('util') -const index = require('./lib/entry-index') -const memo = require('./lib/memoization') -const read = require('./lib/content/read') +const index = require('./entry-index') +const memo = require('./memoization') +const read = require('./content/read') const writeFile = util.promisify(fs.writeFile) @@ -25,12 +25,14 @@ function getData (cache, key, opts = {}) { } return index.find(cache, key, opts).then((entry) => { - if (!entry) + if (!entry) { throw new index.NotFoundError(cache, key) + } return read(cache, entry.integrity, { integrity, size }).then((data) => { - if (memoize) + if (memoize) { memo.put(cache, entry, data, opts) + } return { data, @@ -46,12 +48,14 @@ module.exports = getData function getDataByDigest (cache, key, opts = {}) { const { integrity, memoize, size } = opts const memoized = memo.get.byDigest(cache, key, opts) - if (memoized && memoize !== false) + if (memoized && memoize !== false) { return Promise.resolve(memoized) + } return read(cache, key, { integrity, size }).then((res) => { - if (memoize) + if (memoize) { memo.put.byDigest(cache, key, res, opts) + } return res }) } @@ -70,8 +74,9 @@ function getDataSync (cache, key, opts = {}) { } } const entry = index.find.sync(cache, key, opts) - if (!entry) + if (!entry) { throw new index.NotFoundError(cache, key) + } const data = read.sync(cache, entry.integrity, { integrity: integrity, size: size, @@ -82,8 +87,9 @@ function getDataSync (cache, key, opts = {}) { size: entry.size, integrity: entry.integrity, } - if (memoize) + if (memoize) { memo.put(cache, entry, res.data, opts) + } return res } @@ -94,15 +100,17 @@ function getDataByDigestSync (cache, digest, opts = {}) { const { integrity, memoize, size } = opts const memoized = memo.get.byDigest(cache, digest, opts) - if (memoized && memoize !== false) + if (memoized && memoize !== false) { return memoized + } const res = read.sync(cache, digest, { integrity: integrity, size: size, }) - if (memoize) + if (memoize) { memo.put.byDigest(cache, digest, res, opts) + } return res } @@ -122,15 +130,17 @@ const getMemoizedStream = (memoized) => { function getStream (cache, key, opts = {}) { const { memoize, size } = opts const memoized = memo.get(cache, key, opts) - if (memoized && memoize !== false) + if (memoized && memoize !== false) { return getMemoizedStream(memoized) + } const stream = new Pipeline() index .find(cache, key) .then((entry) => { - if (!entry) + if (!entry) { throw new index.NotFoundError(cache, key) + } stream.emit('metadata', entry.metadata) stream.emit('integrity', entry.integrity) @@ -170,8 +180,9 @@ function getStreamDigest (cache, integrity, opts = {}) { return stream } else { const stream = read.readStream(cache, integrity, opts) - if (!memoize) + if (!memoize) { return stream + } const memoStream = new Collect.PassThrough() memoStream.on('collect', data => memo.put.byDigest( @@ -189,18 +200,20 @@ module.exports.stream.byDigest = getStreamDigest function info (cache, key, opts = {}) { const { memoize } = opts const memoized = memo.get(cache, key, opts) - if (memoized && memoize !== false) + if (memoized && memoize !== false) { return Promise.resolve(memoized.entry) - else + } else { return index.find(cache, key) + } } module.exports.info = info function copy (cache, key, dest, opts = {}) { if (read.copy) { return index.find(cache, key, opts).then((entry) => { - if (!entry) + if (!entry) { throw new index.NotFoundError(cache, key) + } return read.copy(cache, entry.integrity, dest, opts) .then(() => { return { @@ -225,8 +238,9 @@ function copy (cache, key, dest, opts = {}) { module.exports.copy = copy function copyByDigest (cache, key, dest, opts = {}) { - if (read.copy) + if (read.copy) { return read.copy(cache, key, dest, opts).then(() => key) + } return getDataByDigest(cache, key, opts).then((res) => { return writeFile(dest, res).then(() => key) diff --git a/deps/npm/node_modules/cacache/index.js b/deps/npm/node_modules/cacache/lib/index.js similarity index 83% rename from deps/npm/node_modules/cacache/index.js rename to deps/npm/node_modules/cacache/lib/index.js index c8c52b0417dea4..1c56be68dd8fd2 100644 --- a/deps/npm/node_modules/cacache/index.js +++ b/deps/npm/node_modules/cacache/lib/index.js @@ -1,20 +1,19 @@ 'use strict' -const ls = require('./ls.js') const get = require('./get.js') const put = require('./put.js') const rm = require('./rm.js') const verify = require('./verify.js') -const { clearMemoized } = require('./lib/memoization.js') -const tmp = require('./lib/util/tmp.js') -const index = require('./lib/entry-index.js') +const { clearMemoized } = require('./memoization.js') +const tmp = require('./util/tmp.js') +const index = require('./entry-index.js') module.exports.index = {} module.exports.index.compact = index.compact module.exports.index.insert = index.insert -module.exports.ls = ls -module.exports.ls.stream = ls.stream +module.exports.ls = index.ls +module.exports.ls.stream = index.lsStream module.exports.get = get module.exports.get.byDigest = get.byDigest diff --git a/deps/npm/node_modules/cacache/lib/memoization.js b/deps/npm/node_modules/cacache/lib/memoization.js index d5465f39fc581e..0ff604a479c9c1 100644 --- a/deps/npm/node_modules/cacache/lib/memoization.js +++ b/deps/npm/node_modules/cacache/lib/memoization.js @@ -2,13 +2,11 @@ const LRU = require('lru-cache') -const MAX_SIZE = 50 * 1024 * 1024 // 50MB -const MAX_AGE = 3 * 60 * 1000 - const MEMOIZED = new LRU({ - max: MAX_SIZE, - maxAge: MAX_AGE, - length: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length, + max: 500, + maxSize: 50 * 1024 * 1024, // 50MB + ttl: 3 * 60 * 1000, // 3 minutes + sizeCalculation: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length, }) module.exports.clearMemoized = clearMemoized @@ -18,7 +16,7 @@ function clearMemoized () { MEMOIZED.forEach((v, k) => { old[k] = v }) - MEMOIZED.reset() + MEMOIZED.clear() return old } @@ -62,12 +60,13 @@ class ObjProxy { } function pickMem (opts) { - if (!opts || !opts.memoize) + if (!opts || !opts.memoize) { return MEMOIZED - else if (opts.memoize.get && opts.memoize.set) + } else if (opts.memoize.get && opts.memoize.set) { return opts.memoize - else if (typeof opts.memoize === 'object') + } else if (typeof opts.memoize === 'object') { return new ObjProxy(opts.memoize) - else + } else { return MEMOIZED + } } diff --git a/deps/npm/node_modules/cacache/put.js b/deps/npm/node_modules/cacache/lib/put.js similarity index 86% rename from deps/npm/node_modules/cacache/put.js rename to deps/npm/node_modules/cacache/lib/put.js index 84e9562bc33abb..d6904fa3012726 100644 --- a/deps/npm/node_modules/cacache/put.js +++ b/deps/npm/node_modules/cacache/lib/put.js @@ -1,8 +1,8 @@ 'use strict' -const index = require('./lib/entry-index') -const memo = require('./lib/memoization') -const write = require('./lib/content/write') +const index = require('./entry-index') +const memo = require('./memoization') +const write = require('./content/write') const Flush = require('minipass-flush') const { PassThrough } = require('minipass-collect') const Pipeline = require('minipass-pipeline') @@ -21,8 +21,9 @@ function putData (cache, key, data, opts = {}) { return index .insert(cache, key, res.integrity, { ...opts, size: res.size }) .then((entry) => { - if (memoize) + if (memoize) { memo.put(cache, entry, data, opts) + } return res.integrity }) @@ -67,14 +68,17 @@ function putStream (cache, key, opts = {}) { return index .insert(cache, key, integrity, { ...opts, size }) .then((entry) => { - if (memoize && memoData) + if (memoize && memoData) { memo.put(cache, entry, memoData, opts) + } - if (integrity) + if (integrity) { pipeline.emit('integrity', integrity) + } - if (size) + if (size) { pipeline.emit('size', size) + } }) }, })) diff --git a/deps/npm/node_modules/cacache/rm.js b/deps/npm/node_modules/cacache/lib/rm.js similarity index 80% rename from deps/npm/node_modules/cacache/rm.js rename to deps/npm/node_modules/cacache/lib/rm.js index f2ef6b190f4577..5f00071770b8d2 100644 --- a/deps/npm/node_modules/cacache/rm.js +++ b/deps/npm/node_modules/cacache/lib/rm.js @@ -2,11 +2,11 @@ const util = require('util') -const index = require('./lib/entry-index') -const memo = require('./lib/memoization') +const index = require('./entry-index') +const memo = require('./memoization') const path = require('path') const rimraf = util.promisify(require('rimraf')) -const rmContent = require('./lib/content/rm') +const rmContent = require('./content/rm') module.exports = entry module.exports.entry = entry diff --git a/deps/npm/node_modules/cacache/lib/util/disposer.js b/deps/npm/node_modules/cacache/lib/util/disposer.js index aa8aed54da551d..52d7d3edda7d52 100644 --- a/deps/npm/node_modules/cacache/lib/util/disposer.js +++ b/deps/npm/node_modules/cacache/lib/util/disposer.js @@ -8,8 +8,9 @@ function disposer (creatorFn, disposerFn, fn) { .then( // disposer resolved, do something with original fn's promise () => { - if (shouldThrow) + if (shouldThrow) { throw result + } return result }, diff --git a/deps/npm/node_modules/cacache/lib/util/fix-owner.js b/deps/npm/node_modules/cacache/lib/util/fix-owner.js index 90ffece524f54b..bc14def4e405cb 100644 --- a/deps/npm/node_modules/cacache/lib/util/fix-owner.js +++ b/deps/npm/node_modules/cacache/lib/util/fix-owner.js @@ -49,8 +49,9 @@ function fixOwner (cache, filepath) { const { uid, gid } = owner // No need to override if it's already what we used. - if (self.uid === uid && self.gid === gid) + if (self.uid === uid && self.gid === gid) { return + } return inflight('fixOwner: fixing ownership on ' + filepath, () => chownr( @@ -58,8 +59,9 @@ function fixOwner (cache, filepath) { typeof uid === 'number' ? uid : self.uid, typeof gid === 'number' ? gid : self.gid ).catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null + } throw err }) @@ -93,8 +95,9 @@ function fixOwnerSync (cache, filepath) { ) } catch (err) { // only catch ENOENT, any other error is a problem. - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null + } throw err } @@ -110,12 +113,14 @@ function mkdirfix (cache, p, cb) { return Promise.resolve(inferOwner(cache)).then(() => { return mkdirp(p) .then((made) => { - if (made) + if (made) { return fixOwner(cache, made).then(() => made) + } }) .catch((err) => { - if (err.code === 'EEXIST') + if (err.code === 'EEXIST') { return fixOwner(cache, p).then(() => null) + } throw err }) @@ -136,7 +141,8 @@ function mkdirfixSync (cache, p) { if (err.code === 'EEXIST') { fixOwnerSync(cache, p) return null - } else + } else { throw err + } } } diff --git a/deps/npm/node_modules/cacache/lib/util/move-file.js b/deps/npm/node_modules/cacache/lib/util/move-file.js index c3f9e35eb99c77..3739cea3df2816 100644 --- a/deps/npm/node_modules/cacache/lib/util/move-file.js +++ b/deps/npm/node_modules/cacache/lib/util/move-file.js @@ -38,10 +38,12 @@ function moveFile (src, dest) { } else if (err.code === 'EEXIST' || err.code === 'EBUSY') { // file already exists, so whatever return resolve() - } else + } else { return reject(err) - } else + } + } else { return resolve() + } }) }) .then(() => { diff --git a/deps/npm/node_modules/cacache/lib/verify.js b/deps/npm/node_modules/cacache/lib/verify.js index e9d679eceaf51f..300cd9f9de1c42 100644 --- a/deps/npm/node_modules/cacache/lib/verify.js +++ b/deps/npm/node_modules/cacache/lib/verify.js @@ -54,8 +54,9 @@ function verify (cache, opts) { stats[k] = s[k] }) const end = new Date() - if (!stats.runTime) + if (!stats.runTime) { stats.runTime = {} + } stats.runTime[label] = end - start return Promise.resolve(stats) @@ -108,8 +109,9 @@ function garbageCollect (cache, opts) { const indexStream = index.lsStream(cache) const liveContent = new Set() indexStream.on('data', (entry) => { - if (opts.filter && !opts.filter(entry)) + if (opts.filter && !opts.filter(entry)) { return + } liveContent.add(entry.integrity.toString()) }) @@ -176,8 +178,9 @@ function verifyContent (filepath, sri) { return ssri .checkStream(new fsm.ReadStream(filepath), sri) .catch((err) => { - if (err.code !== 'EINTEGRITY') + if (err.code !== 'EINTEGRITY') { throw err + } return rimraf(filepath).then(() => { contentInfo.valid = false @@ -186,8 +189,9 @@ function verifyContent (filepath, sri) { .then(() => contentInfo) }) .catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return { size: 0, valid: false } + } throw err }) @@ -209,9 +213,9 @@ function rebuildIndex (cache, opts) { const entry = entries[k] const excluded = opts.filter && !opts.filter(entry) excluded && stats.rejectedEntries++ - if (buckets[hashed] && !excluded) + if (buckets[hashed] && !excluded) { buckets[hashed].push(entry) - else if (buckets[hashed] && excluded) { + } else if (buckets[hashed] && excluded) { // skip } else if (excluded) { buckets[hashed] = [] diff --git a/deps/npm/node_modules/cacache/ls.js b/deps/npm/node_modules/cacache/ls.js deleted file mode 100644 index 6006c99e348521..00000000000000 --- a/deps/npm/node_modules/cacache/ls.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict' - -const index = require('./lib/entry-index') - -module.exports = index.ls -module.exports.stream = index.lsStream diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index 6cb4140159af8c..c240fa446df48e 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,14 +1,14 @@ { "name": "cacache", - "version": "15.3.0", + "version": "16.0.2", "cache-version": { "content": "2", "index": "5" }, "description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.", - "main": "index.js", + "main": "lib/index.js", "files": [ - "*.js", + "bin", "lib" ], "scripts": { @@ -20,10 +20,13 @@ "snap": "tap", "coverage": "tap", "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", - "lint": "npm run npmclilint -- \"*.*js\" \"lib/**/*.*js\" \"test/**/*.*js\"", + "lint": "eslint '**/*.js'", "npmclilint": "npmcli-lint", "lintfix": "npm run lint -- --fix", - "postsnap": "npm run lintfix --" + "postsnap": "npm run lintfix --", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "posttest": "npm run lint" }, "repository": "https://github.com/npm/cacache", "keywords": [ @@ -44,28 +47,28 @@ "license": "ISC", "dependencies": { "@npmcli/fs": "^1.0.0", - "@npmcli/move-file": "^1.0.1", + "@npmcli/move-file": "^1.1.2", "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "glob": "^7.1.4", + "fs-minipass": "^2.1.0", + "glob": "^7.2.0", "infer-owner": "^1.0.4", - "lru-cache": "^6.0.0", - "minipass": "^3.1.1", + "lru-cache": "^7.5.1", + "minipass": "^3.1.6", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "mkdirp": "^1.0.3", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", "p-map": "^4.0.0", "promise-inflight": "^1.0.1", "rimraf": "^3.0.2", "ssri": "^8.0.1", - "tar": "^6.0.2", + "tar": "^6.1.11", "unique-filename": "^1.1.1" }, "devDependencies": { - "@npmcli/lint": "^1.0.1", + "@npmcli/template-oss": "^2.9.2", "benchmark": "^2.1.4", - "chalk": "^4.0.0", + "chalk": "^4.1.2", "require-inject": "^1.4.4", "tacks": "^1.3.0", "tap": "^15.0.9" @@ -75,6 +78,11 @@ "test-regex": "test/[^/]*.js" }, "engines": { - "node": ">= 10" - } + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "windowsCI": false, + "version": "2.9.2" + }, + "author": "GitHub Inc." } diff --git a/deps/npm/node_modules/cacache/verify.js b/deps/npm/node_modules/cacache/verify.js deleted file mode 100644 index db7763d7afd074..00000000000000 --- a/deps/npm/node_modules/cacache/verify.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' - -module.exports = require('./lib/verify') diff --git a/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af2b6f3b5..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.js b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.js deleted file mode 100644 index 616ff837d3ff01..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/deps/npm/node_modules/columnify/node_modules/ansi-regex/license b/deps/npm/node_modules/columnify/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/columnify/node_modules/ansi-regex/package.json b/deps/npm/node_modules/columnify/node_modules/ansi-regex/package.json deleted file mode 100644 index 017f53116a9e28..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "ansi-regex", - "version": "5.0.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": "chalk/ansi-regex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc29269eb..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593dfcd1fd5c..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/license b/deps/npm/node_modules/columnify/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json deleted file mode 100644 index 1a41108d42831c..00000000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "strip-ansi", - "version": "6.0.1", - "description": "Strip ANSI escape codes from a string", - "license": "MIT", - "repository": "chalk/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/gauge/lib/demo.js b/deps/npm/node_modules/gauge/lib/demo.js deleted file mode 100644 index 88c03cd9a4040c..00000000000000 --- a/deps/npm/node_modules/gauge/lib/demo.js +++ /dev/null @@ -1,45 +0,0 @@ -var Gauge = require('./') -var gaugeDefault = require('./themes.js') -var onExit = require('signal-exit') - -var activeGauge - -onExit(function () { - activeGauge.disable() -}) - -var themes = gaugeDefault.getThemeNames() - -nextBar() -function nextBar () { - var themeName = themes.shift() - - console.log('Demoing output for ' + themeName) - - var gt = new Gauge(process.stderr, { - updateInterval: 50, - theme: themeName, - cleanupOnExit: false, - }) - activeGauge = gt - - var progress = 0 - - var cnt = 0 - var pulse = setInterval(function () { - gt.pulse('this is a thing that happened ' + (++cnt)) - }, 110) - var prog = setInterval(function () { - progress += 0.04 - gt.show(themeName + ':' + Math.round(progress * 1000), progress) - if (progress >= 1) { - clearInterval(prog) - clearInterval(pulse) - gt.disable() - if (themes.length) { - nextBar() - } - } - }, 100) - gt.show() -} diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af2b6f3b5..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js deleted file mode 100644 index 616ff837d3ff01..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/license b/deps/npm/node_modules/gauge/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json b/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json deleted file mode 100644 index 017f53116a9e28..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "ansi-regex", - "version": "5.0.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": "chalk/ansi-regex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc29269eb..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593dfcd1fd5c..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/license b/deps/npm/node_modules/gauge/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json b/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json deleted file mode 100644 index 1a41108d42831c..00000000000000 --- a/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "strip-ansi", - "version": "6.0.1", - "description": "Strip ANSI escape codes from a string", - "license": "MIT", - "repository": "chalk/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/gauge/package.json b/deps/npm/node_modules/gauge/package.json index 4a6ebf285b3eda..431d906a9e481c 100644 --- a/deps/npm/node_modules/gauge/package.json +++ b/deps/npm/node_modules/gauge/package.json @@ -1,6 +1,6 @@ { "name": "gauge", - "version": "4.0.2", + "version": "4.0.3", "description": "A terminal based horizontal gauge", "main": "lib", "scripts": { @@ -31,7 +31,6 @@ }, "homepage": "https://github.com/npm/gauge", "dependencies": { - "ansi-regex": "^5.0.1", "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.3", "console-control-strings": "^1.1.0", @@ -42,7 +41,7 @@ "wide-align": "^1.1.5" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", + "@npmcli/template-oss": "^2.9.2", "readable-stream": "^3.6.0", "tap": "^15.1.6" }, @@ -60,6 +59,6 @@ "lines": 90 }, "templateOSS": { - "version": "2.7.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/hosted-git-info/git-host-info.js b/deps/npm/node_modules/hosted-git-info/lib/git-host-info.js similarity index 98% rename from deps/npm/node_modules/hosted-git-info/git-host-info.js rename to deps/npm/node_modules/hosted-git-info/lib/git-host-info.js index ba55248e7d62d3..9a9720fa3c3394 100644 --- a/deps/npm/node_modules/hosted-git-info/git-host-info.js +++ b/deps/npm/node_modules/hosted-git-info/lib/git-host-info.js @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ 'use strict' const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : '' const maybeEncode = (arg) => arg ? encodeURIComponent(arg) : '' @@ -13,7 +14,7 @@ const defaults = { shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin('#', committish)}`, pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin('#', committish)}`, bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`, - hashformat: formatHashFragment + hashformat: formatHashFragment, } const gitHosts = {} @@ -45,7 +46,7 @@ gitHosts.github = Object.assign({}, defaults, { } return { user, project, committish } - } + }, }) gitHosts.bitbucket = Object.assign({}, defaults, { @@ -68,7 +69,7 @@ gitHosts.bitbucket = Object.assign({}, defaults, { } return { user, project, committish: url.hash.slice(1) } - } + }, }) gitHosts.gitlab = Object.assign({}, defaults, { @@ -95,7 +96,7 @@ gitHosts.gitlab = Object.assign({}, defaults, { } return { user, project, committish: url.hash.slice(1) } - } + }, }) gitHosts.gist = Object.assign({}, defaults, { @@ -136,7 +137,7 @@ gitHosts.gist = Object.assign({}, defaults, { }, hashformat: function (fragment) { return fragment && 'file-' + formatHashFragment(fragment) - } + }, }) gitHosts.sourcehut = Object.assign({}, defaults, { @@ -166,7 +167,7 @@ gitHosts.sourcehut = Object.assign({}, defaults, { } return { user, project, committish: url.hash.slice(1) } - } + }, }) const names = Object.keys(gitHosts) diff --git a/deps/npm/node_modules/hosted-git-info/git-host.js b/deps/npm/node_modules/hosted-git-info/lib/git-host.js similarity index 100% rename from deps/npm/node_modules/hosted-git-info/git-host.js rename to deps/npm/node_modules/hosted-git-info/lib/git-host.js diff --git a/deps/npm/node_modules/hosted-git-info/index.js b/deps/npm/node_modules/hosted-git-info/lib/index.js similarity index 93% rename from deps/npm/node_modules/hosted-git-info/index.js rename to deps/npm/node_modules/hosted-git-info/lib/index.js index f35c570c46b595..8bce6b3c28d516 100644 --- a/deps/npm/node_modules/hosted-git-info/index.js +++ b/deps/npm/node_modules/hosted-git-info/lib/index.js @@ -9,7 +9,7 @@ const protocolToRepresentationMap = { 'git+ssh:': 'sshurl', 'git+https:': 'https', 'ssh:': 'sshurl', - 'git:': 'git' + 'git:': 'git', } function protocolToRepresentation (protocol) { @@ -21,10 +21,11 @@ const authProtocols = { 'https:': true, 'git+https:': true, 'http:': true, - 'git+http:': true + 'git+http:': true, } -const knownProtocols = Object.keys(gitHosts.byShortcut).concat(['http:', 'https:', 'git:', 'git+ssh:', 'git+https:', 'ssh:']) +const knownProtocols = Object.keys(gitHosts.byShortcut) + .concat(['http:', 'https:', 'git:', 'git+ssh:', 'git+https:', 'ssh:']) module.exports.fromUrl = function (giturl, opts) { if (typeof giturl !== 'string') { @@ -52,7 +53,10 @@ function fromUrl (giturl, opts) { } const gitHostShortcut = gitHosts.byShortcut[parsed.protocol] - const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith('www.') ? parsed.hostname.slice(4) : parsed.hostname] + const gitHostDomain = + gitHosts.byDomain[parsed.hostname.startsWith('www.') ? + parsed.hostname.slice(4) : + parsed.hostname] const gitHostName = gitHostShortcut || gitHostDomain if (!gitHostName) { return @@ -172,11 +176,14 @@ const isGitHubShorthand = (arg) => { const colonOnlyAfterHash = firstColon === -1 || (firstHash > -1 && firstColon > firstHash) const secondSlashOnlyAfterHash = secondSlash === -1 || (firstHash > -1 && secondSlash > firstHash) const hasSlash = firstSlash > 0 - // if a # is found, what we really want to know is that the character immediately before # is not a / + // if a # is found, what we really want to know is that the character + // immediately before # is not a / const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== '/' : !arg.endsWith('/') const doesNotStartWithDot = !arg.startsWith('.') - return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash + return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && + doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && + secondSlashOnlyAfterHash } // attempt to correct an scp style url so that it will parse with `new URL()` diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json index b145e62240805d..0153b0852cbf43 100644 --- a/deps/npm/node_modules/hosted-git-info/package.json +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -1,8 +1,8 @@ { "name": "hosted-git-info", - "version": "4.1.0", + "version": "5.0.0", "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", - "main": "index.js", + "main": "./lib/index.js", "repository": { "type": "git", "url": "git+https://github.com/npm/hosted-git-info.git" @@ -13,39 +13,44 @@ "bitbucket", "gitlab" ], - "author": "Rebecca Turner (http://re-becca.org)", + "author": "GitHub Inc.", "license": "ISC", "bugs": { "url": "https://github.com/npm/hosted-git-info/issues" }, "homepage": "https://github.com/npm/hosted-git-info", "scripts": { - "posttest": "standard", + "posttest": "npm run lint", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "preversion": "npm test", "snap": "tap", "test": "tap", - "test:coverage": "tap --coverage-report=html" + "test:coverage": "tap --coverage-report=html", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "lintfix": "npm run lint -- --fix" }, "dependencies": { - "lru-cache": "^6.0.0" + "lru-cache": "^7.5.1" }, "devDependencies": { - "standard": "^16.0.3", - "standard-version": "^9.1.0", + "@npmcli/template-oss": "^2.9.2", "tap": "^15.1.6" }, "files": [ - "index.js", - "git-host.js", - "git-host-info.js" + "bin", + "lib" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "tap": { "color": 1, "coverage": true + }, + "templateOSS": { + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index 7649c503de815b..9219863cb67203 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "3.0.0", + "version": "3.0.1", "main": "lib/init-package-json.js", "scripts": { "test": "tap", @@ -25,14 +25,14 @@ "npm-package-arg": "^9.0.0", "promzard": "^0.3.0", "read": "^1.0.7", - "read-package-json": "^4.1.1", + "read-package-json": "^5.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^3.0.0" }, "devDependencies": { - "@npmcli/config": "^4.0.0", - "@npmcli/template-oss": "^2.7.1", + "@npmcli/config": "^4.0.1", + "@npmcli/template-oss": "^2.9.2", "tap": "^15.1.6" }, "engines": { @@ -58,6 +58,6 @@ "lib" ], "templateOSS": { - "version": "2.7.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 7f0b335b388dc0..72fcfaf586a05d 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "6.0.0", + "version": "6.0.2", "description": "programmatic library for `npm access` commands", "author": "GitHub Inc.", "license": "ISC", @@ -33,7 +33,7 @@ "dependencies": { "aproba": "^2.0.0", "minipass": "^3.1.1", - "npm-package-arg": "^9.0.0", + "npm-package-arg": "^9.0.1", "npm-registry-fetch": "^13.0.0" }, "engines": { diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index 883748ee63f858..11d0f5887bb815 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,6 +1,6 @@ { "name": "libnpmdiff", - "version": "4.0.0", + "version": "4.0.2", "description": "The registry diff", "repository": { "type": "git", @@ -58,8 +58,8 @@ "binary-extensions": "^2.2.0", "diff": "^5.0.0", "minimatch": "^3.0.4", - "npm-package-arg": "^9.0.0", - "pacote": "^13.0.2", + "npm-package-arg": "^9.0.1", + "pacote": "^13.0.5", "tar": "^6.1.0" }, "templateOSS": { diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index 26cede0da7b578..9af42b29942e67 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,6 +1,6 @@ { "name": "libnpmexec", - "version": "4.0.0", + "version": "4.0.2", "files": [ "bin", "lib" @@ -60,9 +60,9 @@ "@npmcli/run-script": "^3.0.0", "chalk": "^4.1.0", "mkdirp-infer-owner": "^2.0.0", - "npm-package-arg": "^9.0.0", + "npm-package-arg": "^9.0.1", "npmlog": "^6.0.1", - "pacote": "^13.0.2", + "pacote": "^13.0.5", "proc-log": "^2.0.0", "read": "^1.0.7", "read-package-json-fast": "^2.0.2", diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 8af2c2b11570f1..2abf897eefeb86 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,6 +1,6 @@ { "name": "libnpmfund", - "version": "3.0.0", + "version": "3.0.1", "main": "lib/index.js", "files": [ "bin", diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index ad10da8865052a..c95230114cb7f4 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,6 +1,6 @@ { "name": "libnpmhook", - "version": "8.0.0", + "version": "8.0.2", "description": "programmatic API for managing npm registry hooks", "main": "lib/index.js", "files": [ diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 707b5318696934..582a60e2ded1da 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "4.0.0", + "version": "4.0.2", "description": "Programmatic api for `npm org` commands", "author": "GitHub Inc.", "main": "lib/index.js", diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 586bd3153b14d7..f98f0269b0f223 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpack", - "version": "4.0.0", + "version": "4.0.2", "description": "Programmatic API for the bits behind npm pack", "author": "GitHub Inc.", "main": "lib/index.js", @@ -41,8 +41,8 @@ "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { "@npmcli/run-script": "^3.0.0", - "npm-package-arg": "^9.0.0", - "pacote": "^13.0.2" + "npm-package-arg": "^9.0.1", + "pacote": "^13.0.5" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index c155df4cf2cc2d..2ad8baf3d4a540 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "6.0.0", + "version": "6.0.2", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", @@ -44,8 +44,8 @@ "bugs": "https://github.com/npm/cli/issues", "homepage": "https://npmjs.com/package/libnpmpublish", "dependencies": { - "normalize-package-data": "^3.0.2", - "npm-package-arg": "^9.0.0", + "normalize-package-data": "^4.0.0", + "npm-package-arg": "^9.0.1", "npm-registry-fetch": "^13.0.0", "semver": "^7.1.3", "ssri": "^8.0.1" diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index 0c14b707d20705..25e730395aeb76 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "5.0.0", + "version": "5.0.2", "description": "Programmatic API for searching in npm and compatible registries.", "author": "GitHub Inc.", "main": "lib/index.js", diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 2861f74cbfe53a..485ab59735bcf8 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -1,7 +1,7 @@ { "name": "libnpmteam", "description": "npm Team management APIs", - "version": "4.0.0", + "version": "4.0.2", "author": "GitHub Inc.", "license": "ISC", "main": "lib/index.js", diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 16302f6737aa6a..ddb56c1cf32cf3 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "3.0.0", + "version": "3.0.1", "main": "lib/index.js", "files": [ "bin", diff --git a/deps/npm/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/lru-cache/LICENSE index 19129e315fe593..9b58a3e03d1df1 100644 --- a/deps/npm/node_modules/lru-cache/LICENSE +++ b/deps/npm/node_modules/lru-cache/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/deps/npm/node_modules/lru-cache/index.js b/deps/npm/node_modules/lru-cache/index.js index 573b6b85b9779d..e37f51616452e3 100644 --- a/deps/npm/node_modules/lru-cache/index.js +++ b/deps/npm/node_modules/lru-cache/index.js @@ -1,334 +1,615 @@ -'use strict' - -// A linked list to keep track of recently-used-ness -const Yallist = require('yallist') - -const MAX = Symbol('max') -const LENGTH = Symbol('length') -const LENGTH_CALCULATOR = Symbol('lengthCalculator') -const ALLOW_STALE = Symbol('allowStale') -const MAX_AGE = Symbol('maxAge') -const DISPOSE = Symbol('dispose') -const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') -const LRU_LIST = Symbol('lruList') -const CACHE = Symbol('cache') -const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') - -const naiveLength = () => 1 - -// lruList is a yallist where the head is the youngest -// item, and the tail is the oldest. the list contains the Hit -// objects as the entries. -// Each Hit object has a reference to its Yallist.Node. This -// never changes. -// -// cache is a Map (or PseudoMap) that matches the keys to -// the Yallist.Node object. -class LRUCache { - constructor (options) { - if (typeof options === 'number') - options = { max: options } - - if (!options) - options = {} - - if (options.max && (typeof options.max !== 'number' || options.max < 0)) - throw new TypeError('max must be a non-negative number') - // Kind of weird to have a default max of Infinity, but oh well. - const max = this[MAX] = options.max || Infinity - - const lc = options.length || naiveLength - this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc - this[ALLOW_STALE] = options.stale || false - if (options.maxAge && typeof options.maxAge !== 'number') - throw new TypeError('maxAge must be a number') - this[MAX_AGE] = options.maxAge || 0 - this[DISPOSE] = options.dispose - this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false - this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false - this.reset() +const perf = typeof performance === 'object' && performance && + typeof performance.now === 'function' ? performance : Date + +const warned = new Set() +const deprecatedOption = (opt, instead) => { + const code = `LRU_CACHE_OPTION_${opt}` + if (shouldWarn(code)) { + warn(code, `${opt} option`, `options.${instead}`, LRUCache) } - - // resize the cache when the max changes. - set max (mL) { - if (typeof mL !== 'number' || mL < 0) - throw new TypeError('max must be a non-negative number') - - this[MAX] = mL || Infinity - trim(this) +} +const deprecatedMethod = (method, instead) => { + const code = `LRU_CACHE_METHOD_${method}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, method) + warn(code, `${method} method`, `cache.${instead}()`, get) } - get max () { - return this[MAX] +} +const deprecatedProperty = (field, instead) => { + const code = `LRU_CACHE_PROPERTY_${field}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, field) + warn(code, `${field} property`, `cache.${instead}`, get) } +} +const shouldWarn = (code) => typeof process === 'object' && + process && + !(process.noDeprecation || warned.has(code)) +const warn = (code, what, instead, fn) => { + warned.add(code) + process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn) +} - set allowStale (allowStale) { - this[ALLOW_STALE] = !!allowStale - } - get allowStale () { - return this[ALLOW_STALE] +const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n) + +/* istanbul ignore next - This is a little bit ridiculous, tbh. + * The maximum array length is 2^32-1 or thereabouts on most JS impls. + * And well before that point, you're caching the entire world, I mean, + * that's ~32GB of just integers for the next/prev links, plus whatever + * else to hold that many keys and values. Just filling the memory with + * zeroes at init time is brutal when you get that big. + * But why not be complete? + * Maybe in the future, these limits will have expanded. */ +const getUintArray = max => !isPosInt(max) ? null +: max <= Math.pow(2, 8) ? Uint8Array +: max <= Math.pow(2, 16) ? Uint16Array +: max <= Math.pow(2, 32) ? Uint32Array +: max <= Number.MAX_SAFE_INTEGER ? ZeroArray +: null + +class ZeroArray extends Array { + constructor (size) { + super(size) + this.fill(0) } +} - set maxAge (mA) { - if (typeof mA !== 'number') - throw new TypeError('maxAge must be a non-negative number') - - this[MAX_AGE] = mA - trim(this) +class Stack { + constructor (max) { + const UintArray = getUintArray(max) + this.heap = new UintArray(max) + this.length = 0 } - get maxAge () { - return this[MAX_AGE] + push (n) { + this.heap[this.length++] = n } + pop () { + return this.heap[--this.length] + } +} - // resize the cache when the lengthCalculator changes. - set lengthCalculator (lC) { - if (typeof lC !== 'function') - lC = naiveLength +class LRUCache { + constructor (options = {}) { + const { + max, + ttl, + ttlResolution = 1, + ttlAutopurge, + updateAgeOnGet, + allowStale, + dispose, + disposeAfter, + noDisposeOnSet, + noUpdateTTL, + maxSize, + sizeCalculation, + } = options + + // deprecated options, don't trigger a warning for getting them if + // the thing being passed in is another LRUCache we're copying. + const { + length, + maxAge, + stale, + } = options instanceof LRUCache ? {} : options + + if (!isPosInt(max)) { + throw new TypeError('max option must be an integer') + } - if (lC !== this[LENGTH_CALCULATOR]) { - this[LENGTH_CALCULATOR] = lC - this[LENGTH] = 0 - this[LRU_LIST].forEach(hit => { - hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) - this[LENGTH] += hit.length - }) + const UintArray = getUintArray(max) + if (!UintArray) { + throw new Error('invalid max value: ' + max) } - trim(this) - } - get lengthCalculator () { return this[LENGTH_CALCULATOR] } - get length () { return this[LENGTH] } - get itemCount () { return this[LRU_LIST].length } + this.max = max + this.maxSize = maxSize || 0 + this.sizeCalculation = sizeCalculation || length + if (this.sizeCalculation) { + if (!this.maxSize) { + throw new TypeError('cannot set sizeCalculation without setting maxSize') + } + if (typeof this.sizeCalculation !== 'function') { + throw new TypeError('sizeCalculating set to non-function') + } + } + this.keyMap = new Map() + this.keyList = new Array(max).fill(null) + this.valList = new Array(max).fill(null) + this.next = new UintArray(max) + this.prev = new UintArray(max) + this.head = 0 + this.tail = 0 + this.free = new Stack(max) + this.initialFill = 1 + this.size = 0 + + if (typeof dispose === 'function') { + this.dispose = dispose + } + if (typeof disposeAfter === 'function') { + this.disposeAfter = disposeAfter + this.disposed = [] + } else { + this.disposeAfter = null + this.disposed = null + } + this.noDisposeOnSet = !!noDisposeOnSet + this.noUpdateTTL = !!noUpdateTTL - rforEach (fn, thisp) { - thisp = thisp || this - for (let walker = this[LRU_LIST].tail; walker !== null;) { - const prev = walker.prev - forEachStep(this, fn, walker, thisp) - walker = prev + if (this.maxSize) { + if (!isPosInt(this.maxSize)) { + throw new TypeError('maxSize must be a positive integer if specified') + } + this.initializeSizeTracking() } - } - forEach (fn, thisp) { - thisp = thisp || this - for (let walker = this[LRU_LIST].head; walker !== null;) { - const next = walker.next - forEachStep(this, fn, walker, thisp) - walker = next + this.allowStale = !!allowStale || !!stale + this.updateAgeOnGet = !!updateAgeOnGet + this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 + ? ttlResolution : 1 + this.ttlAutopurge = !!ttlAutopurge + this.ttl = ttl || maxAge || 0 + if (this.ttl) { + if (!isPosInt(this.ttl)) { + throw new TypeError('ttl must be a positive integer if specified') + } + this.initializeTTLTracking() } - } - keys () { - return this[LRU_LIST].toArray().map(k => k.key) + if (stale) { + deprecatedOption('stale', 'allowStale') + } + if (maxAge) { + deprecatedOption('maxAge', 'ttl') + } + if (length) { + deprecatedOption('length', 'sizeCalculation') + } } - values () { - return this[LRU_LIST].toArray().map(k => k.value) + initializeTTLTracking () { + this.ttls = new ZeroArray(this.max) + this.starts = new ZeroArray(this.max) + this.setItemTTL = (index, ttl) => { + this.starts[index] = ttl !== 0 ? perf.now() : 0 + this.ttls[index] = ttl + if (ttl !== 0 && this.ttlAutopurge) { + const t = setTimeout(() => { + if (this.isStale(index)) { + this.delete(this.keyList[index]) + } + }, ttl + 1) + /* istanbul ignore else - unref() not supported on all platforms */ + if (t.unref) { + t.unref() + } + } + } + this.updateItemAge = (index) => { + this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0 + } + // debounce calls to perf.now() to 1s so we're not hitting + // that costly call repeatedly. + let cachedNow = 0 + const getNow = () => { + const n = perf.now() + if (this.ttlResolution > 0) { + cachedNow = n + const t = setTimeout(() => cachedNow = 0, this.ttlResolution) + /* istanbul ignore else - not available on all platforms */ + if (t.unref) { + t.unref() + } + } + return n + } + this.isStale = (index) => { + return this.ttls[index] !== 0 && this.starts[index] !== 0 && + ((cachedNow || getNow()) - this.starts[index] > this.ttls[index]) + } } - - reset () { - if (this[DISPOSE] && - this[LRU_LIST] && - this[LRU_LIST].length) { - this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) + updateItemAge (index) {} + setItemTTL (index, ttl) {} + isStale (index) { return false } + + initializeSizeTracking () { + this.calculatedSize = 0 + this.sizes = new ZeroArray(this.max) + this.removeItemSize = index => this.calculatedSize -= this.sizes[index] + this.addItemSize = (index, v, k, size, sizeCalculation) => { + const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0) + this.sizes[index] = isPosInt(s) ? s : 0 + const maxSize = this.maxSize - this.sizes[index] + while (this.calculatedSize > maxSize) { + this.evict() + } + 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) } - - this[CACHE] = new Map() // hash of items by key - this[LRU_LIST] = new Yallist() // list of items in order of use recency - this[LENGTH] = 0 // length of items in the list } - - dump () { - return this[LRU_LIST].map(hit => - isStale(this, hit) ? false : { - k: hit.key, - v: hit.value, - e: hit.now + (hit.maxAge || 0) - }).toArray().filter(h => h) + removeItemSize (index) {} + addItemSize (index, v, k, size, sizeCalculation) {} + + *indexes ({ allowStale = this.allowStale } = {}) { + if (this.size) { + for (let i = this.tail, j; true; ) { + if (!this.isValidIndex(i)) { + break + } + j = i === this.head + if (allowStale || !this.isStale(i)) { + yield i + } + if (i === this.head) { + break + } else { + i = this.prev[i] + } + } + } } - dumpLru () { - return this[LRU_LIST] + *rindexes ({ allowStale = this.allowStale } = {}) { + if (this.size) { + for (let i = this.head, j; true; ) { + if (!this.isValidIndex(i)) { + break + } + if (allowStale || !this.isStale(i)) { + yield i + } + // either the tail now, or WAS the tail, and deleted + if (i === this.tail) { + break + } else { + i = this.next[i] + } + } + } } - set (key, value, maxAge) { - maxAge = maxAge || this[MAX_AGE] + isValidIndex (index) { + return this.keyMap.get(this.keyList[index]) === index + } - if (maxAge && typeof maxAge !== 'number') - throw new TypeError('maxAge must be a number') + *entries () { + for (const i of this.indexes()) { + yield [this.keyList[i], this.valList[i]] + } + } + *rentries () { + for (const i of this.rindexes()) { + yield [this.keyList[i], this.valList[i]] + } + } - const now = maxAge ? Date.now() : 0 - const len = this[LENGTH_CALCULATOR](value, key) + *keys () { + for (const i of this.indexes()) { + yield this.keyList[i] + } + } + *rkeys () { + for (const i of this.rindexes()) { + yield this.keyList[i] + } + } - if (this[CACHE].has(key)) { - if (len > this[MAX]) { - del(this, this[CACHE].get(key)) - return false - } + *values () { + for (const i of this.indexes()) { + yield this.valList[i] + } + } + *rvalues () { + for (const i of this.rindexes()) { + yield this.valList[i] + } + } - const node = this[CACHE].get(key) - const item = node.value + [Symbol.iterator] () { + return this.entries() + } - // dispose of the old one before overwriting - // split out into 2 ifs for better coverage tracking - if (this[DISPOSE]) { - if (!this[NO_DISPOSE_ON_SET]) - this[DISPOSE](key, item.value) + find (fn, getOptions = {}) { + for (const i of this.indexes()) { + if (fn(this.valList[i], this.keyList[i], this)) { + return this.get(this.keyList[i], getOptions) } + } + } - item.now = now - item.maxAge = maxAge - item.value = value - this[LENGTH] += len - item.length - item.length = len - this.get(key) - trim(this) - return true + forEach (fn, thisp = this) { + for (const i of this.indexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) } + } - const hit = new Entry(key, value, len, now, maxAge) + rforEach (fn, thisp = this) { + for (const i of this.rindexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) + } + } - // oversized objects fall out of cache automatically. - if (hit.length > this[MAX]) { - if (this[DISPOSE]) - this[DISPOSE](key, value) + get prune () { + deprecatedMethod('prune', 'purgeStale') + return this.purgeStale + } - return false + purgeStale () { + let deleted = false + for (const i of this.rindexes({ allowStale: true })) { + if (this.isStale(i)) { + this.delete(this.keyList[i]) + deleted = true + } } + return deleted + } - this[LENGTH] += hit.length - this[LRU_LIST].unshift(hit) - this[CACHE].set(key, this[LRU_LIST].head) - trim(this) - return true + dump () { + const arr = [] + for (const i of this.indexes()) { + const key = this.keyList[i] + const value = this.valList[i] + const entry = { value } + if (this.ttls) { + entry.ttl = this.ttls[i] + } + if (this.sizes) { + entry.size = this.sizes[i] + } + arr.unshift([key, entry]) + } + return arr } - has (key) { - if (!this[CACHE].has(key)) return false - const hit = this[CACHE].get(key).value - return !isStale(this, hit) + load (arr) { + this.clear() + for (const [key, entry] of arr) { + this.set(key, entry.value, entry) + } } - get (key) { - return get(this, key, true) + dispose (v, k, reason) {} + + set (k, v, { + ttl = this.ttl, + noDisposeOnSet = this.noDisposeOnSet, + size = 0, + sizeCalculation = this.sizeCalculation, + noUpdateTTL = this.noUpdateTTL, + } = {}) { + let index = this.size === 0 ? undefined : this.keyMap.get(k) + if (index === undefined) { + // addition + index = this.newIndex() + this.keyList[index] = k + this.valList[index] = v + this.keyMap.set(k, index) + this.next[this.tail] = index + this.prev[index] = this.tail + this.tail = index + this.size ++ + this.addItemSize(index, v, k, size, sizeCalculation) + noUpdateTTL = false + } else { + // update + const oldVal = this.valList[index] + if (v !== oldVal) { + if (!noDisposeOnSet) { + this.dispose(oldVal, k, 'set') + if (this.disposeAfter) { + this.disposed.push([oldVal, k, 'set']) + } + } + this.removeItemSize(index) + this.valList[index] = v + this.addItemSize(index, v, k, size, sizeCalculation) + } + this.moveToTail(index) + } + if (ttl !== 0 && this.ttl === 0 && !this.ttls) { + this.initializeTTLTracking() + } + if (!noUpdateTTL) { + this.setItemTTL(index, ttl) + } + if (this.disposeAfter) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + return this } - peek (key) { - return get(this, key, false) + newIndex () { + if (this.size === 0) { + return this.tail + } + if (this.size === this.max) { + return this.evict() + } + if (this.free.length !== 0) { + return this.free.pop() + } + // initial fill, just keep writing down the list + return this.initialFill++ } pop () { - const node = this[LRU_LIST].tail - if (!node) - return null + if (this.size) { + const val = this.valList[this.head] + this.evict() + return val + } + } + + evict () { + const head = this.head + const k = this.keyList[head] + const v = this.valList[head] + this.dispose(v, k, 'evict') + if (this.disposeAfter) { + this.disposed.push([v, k, 'evict']) + } + this.removeItemSize(head) + this.head = this.next[head] + this.keyMap.delete(k) + this.size -- + return head + } - del(this, node) - return node.value + has (k) { + return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k)) } - del (key) { - del(this, this[CACHE].get(key)) + // like get(), but without any LRU updating or TTL expiration + peek (k, { allowStale = this.allowStale } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined && (allowStale || !this.isStale(index))) { + return this.valList[index] + } } - load (arr) { - // reset the cache - this.reset() - - const now = Date.now() - // A previous serialized cache has the most recent items first - for (let l = arr.length - 1; l >= 0; l--) { - const hit = arr[l] - const expiresAt = hit.e || 0 - if (expiresAt === 0) - // the item was created without expiration in a non aged cache - this.set(hit.k, hit.v) - else { - const maxAge = expiresAt - now - // dont add already expired items - if (maxAge > 0) { - this.set(hit.k, hit.v, maxAge) + get (k, { + allowStale = this.allowStale, + updateAgeOnGet = this.updateAgeOnGet, + } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined) { + if (this.isStale(index)) { + const value = allowStale ? this.valList[index] : undefined + this.delete(k) + return value + } else { + this.moveToTail(index) + if (updateAgeOnGet) { + this.updateItemAge(index) } + return this.valList[index] } } } - prune () { - this[CACHE].forEach((value, key) => get(this, key, false)) + connect (p, n) { + this.prev[n] = p + this.next[p] = n } -} -const get = (self, key, doUse) => { - const node = self[CACHE].get(key) - if (node) { - const hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) - return undefined - } else { - if (doUse) { - if (self[UPDATE_AGE_ON_GET]) - node.value.now = Date.now() - self[LRU_LIST].unshiftNode(node) + moveToTail (index) { + // if tail already, nothing to do + // if head, move head to next[index] + // else + // move next[prev[index]] to next[index] (head has no prev) + // move prev[next[index]] to prev[index] + // prev[index] = tail + // next[tail] = index + // tail = index + if (index !== this.tail) { + if (index === this.head) { + this.head = this.next[index] + } else { + this.connect(this.prev[index], this.next[index]) } + this.connect(this.tail, index) + this.tail = index } - return hit.value } -} - -const isStale = (self, hit) => { - if (!hit || (!hit.maxAge && !self[MAX_AGE])) - return false - const diff = Date.now() - hit.now - return hit.maxAge ? diff > hit.maxAge - : self[MAX_AGE] && (diff > self[MAX_AGE]) -} - -const trim = self => { - if (self[LENGTH] > self[MAX]) { - for (let walker = self[LRU_LIST].tail; - self[LENGTH] > self[MAX] && walker !== null;) { - // We know that we're about to delete this one, and also - // what the next least recently used key will be, so just - // go ahead and set it now. - const prev = walker.prev - del(self, walker) - walker = prev + get del () { + deprecatedMethod('del', 'delete') + return this.delete + } + delete (k) { + let deleted = false + if (this.size !== 0) { + const index = this.keyMap.get(k) + if (index !== undefined) { + deleted = true + if (this.size === 1) { + this.clear() + } else { + this.removeItemSize(index) + this.dispose(this.valList[index], k, 'delete') + if (this.disposeAfter) { + this.disposed.push([this.valList[index], k, 'delete']) + } + this.keyMap.delete(k) + this.keyList[index] = null + this.valList[index] = null + if (index === this.tail) { + this.tail = this.prev[index] + } else if (index === this.head) { + this.head = this.next[index] + } else { + this.next[this.prev[index]] = this.next[index] + this.prev[this.next[index]] = this.prev[index] + } + this.size -- + this.free.push(index) + } + } + } + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } } + return deleted } -} -const del = (self, node) => { - if (node) { - const hit = node.value - if (self[DISPOSE]) - self[DISPOSE](hit.key, hit.value) - - self[LENGTH] -= hit.length - self[CACHE].delete(hit.key) - self[LRU_LIST].removeNode(node) + clear () { + if (this.dispose !== LRUCache.prototype.dispose) { + for (const index of this.rindexes({ allowStale: true })) { + this.dispose(this.valList[index], this.keyList[index], 'delete') + } + } + if (this.disposeAfter) { + for (const index of this.rindexes({ allowStale: true })) { + this.disposed.push([this.valList[index], this.keyList[index], 'delete']) + } + } + this.keyMap.clear() + this.valList.fill(null) + this.keyList.fill(null) + if (this.ttls) { + this.ttls.fill(0) + this.starts.fill(0) + } + if (this.sizes) { + this.sizes.fill(0) + } + this.head = 0 + this.tail = 0 + this.initialFill = 1 + this.free.length = 0 + this.calculatedSize = 0 + this.size = 0 + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } } -} - -class Entry { - constructor (key, value, length, now, maxAge) { - this.key = key - this.value = value - this.length = length - this.now = now - this.maxAge = maxAge || 0 + get reset () { + deprecatedMethod('reset', 'clear') + return this.clear } -} -const forEachStep = (self, fn, node, thisp) => { - let hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) - hit = undefined + get length () { + deprecatedProperty('length', 'size') + return this.size } - if (hit) - fn.call(thisp, hit.value, hit.key, self) } module.exports = LRUCache diff --git a/deps/npm/node_modules/lru-cache/package.json b/deps/npm/node_modules/lru-cache/package.json index 43b7502c3e7c79..a62f74c2b648ac 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": "6.0.0", + "version": "7.5.1", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -9,8 +9,10 @@ "cache" ], "scripts": { + "build": "", "test": "tap", "snap": "tap", + "size": "size-limit", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags" @@ -18,17 +20,24 @@ "main": "index.js", "repository": "git://github.com/isaacs/node-lru-cache.git", "devDependencies": { + "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", - "tap": "^14.10.7" + "size-limit": "^7.0.8", + "tap": "^15.1.6" }, "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, "files": [ "index.js" ], "engines": { - "node": ">=10" - } + "node": ">=12" + }, + "tap": { + "coverage-map": "map.js" + }, + "size-limit": [ + { + "path": "./index.js" + } + ] } diff --git a/deps/npm/node_modules/make-fetch-happen/lib/agent.js b/deps/npm/node_modules/make-fetch-happen/lib/agent.js index cc1d388691961f..d28a31bfbda0cb 100644 --- a/deps/npm/node_modules/make-fetch-happen/lib/agent.js +++ b/deps/npm/node_modules/make-fetch-happen/lib/agent.js @@ -198,6 +198,7 @@ function getProxy (proxyUrl, opts, isHttps) { throw Object.assign( new Error(`unsupported proxy protocol: '${proxyUrl.protocol}'`), { + code: 'EUNSUPPORTEDPROXY', url: proxyUrl.href, } ) diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE deleted file mode 100644 index 9b58a3e03d1df1..00000000000000 --- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js deleted file mode 100644 index 7eef327e92527f..00000000000000 --- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const x=a(i);if(!x)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new x(i),this.prev=new x(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={},s=function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10);module.exports=s})(); \ No newline at end of file diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.mjs b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.mjs deleted file mode 100644 index 3a4d674c07a412..00000000000000 --- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.mjs +++ /dev/null @@ -1 +0,0 @@ -var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const L=a(i);if(!L)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new L(i),this.prev=new L(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={};!function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10); \ No newline at end of file diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js deleted file mode 100644 index e9b2f37013e72e..00000000000000 --- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js +++ /dev/null @@ -1,587 +0,0 @@ -const perf = typeof performance === 'object' && performance && - typeof performance.now === 'function' ? performance : Date - -const warned = new Set() -const deprecatedOption = (opt, instead) => { - const code = `LRU_CACHE_OPTION_${opt}` - if (shouldWarn(code)) { - warn(code, `${opt} option`, `options.${instead}`, LRUCache) - } -} -const deprecatedMethod = (method, instead) => { - const code = `LRU_CACHE_METHOD_${method}` - if (shouldWarn(code)) { - const { prototype } = LRUCache - const { get } = Object.getOwnPropertyDescriptor(prototype, method) - warn(code, `${method} method`, `cache.${instead}()`, get) - } -} -const deprecatedProperty = (field, instead) => { - const code = `LRU_CACHE_PROPERTY_${field}` - if (shouldWarn(code)) { - const { prototype } = LRUCache - const { get } = Object.getOwnPropertyDescriptor(prototype, field) - warn(code, `${field} property`, `cache.${instead}`, get) - } -} -const shouldWarn = (code) => !(process.noDeprecation || warned.has(code)) -const warn = (code, what, instead, fn) => { - warned.add(code) - process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn) -} - -const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n) - -/* istanbul ignore next - This is a little bit ridiculous, tbh. - * The maximum array length is 2^32-1 or thereabouts on most JS impls. - * And well before that point, you're caching the entire world, I mean, - * that's ~32GB of just integers for the next/prev links, plus whatever - * else to hold that many keys and values. Just filling the memory with - * zeroes at init time is brutal when you get that big. - * But why not be complete? - * Maybe in the future, these limits will have expanded. */ -const getUintArray = max => !isPosInt(max) ? null -: max <= Math.pow(2, 8) ? Uint8Array -: max <= Math.pow(2, 16) ? Uint16Array -: max <= Math.pow(2, 32) ? Uint32Array -: max <= Number.MAX_SAFE_INTEGER ? ZeroArray -: null - -class ZeroArray extends Array { - constructor (size) { - super(size) - this.fill(0) - } -} - -class Stack { - constructor (max) { - const UintArray = getUintArray(max) - this.heap = new UintArray(max) - this.length = 0 - } - push (n) { - this.heap[this.length++] = n - } - pop () { - return this.heap[--this.length] - } -} - -class LRUCache { - constructor (options = {}) { - const { - max, - ttl, - ttlResolution = 1, - ttlAutopurge, - updateAgeOnGet, - allowStale, - dispose, - disposeAfter, - noDisposeOnSet, - noUpdateTTL, - maxSize, - sizeCalculation, - } = options - - // deprecated options, don't trigger a warning for getting them if - // the thing being passed in is another LRUCache we're copying. - const { - length, - maxAge, - stale, - } = options instanceof LRUCache ? {} : options - - if (!isPosInt(max)) { - throw new TypeError('max option must be an integer') - } - - const UintArray = getUintArray(max) - if (!UintArray) { - throw new Error('invalid max value: ' + max) - } - - this.max = max - this.maxSize = maxSize || 0 - this.sizeCalculation = sizeCalculation || length - if (this.sizeCalculation) { - if (!this.maxSize) { - throw new TypeError('cannot set sizeCalculation without setting maxSize') - } - if (typeof this.sizeCalculation !== 'function') { - throw new TypeError('sizeCalculating set to non-function') - } - } - this.keyMap = new Map() - this.keyList = new Array(max).fill(null) - this.valList = new Array(max).fill(null) - this.next = new UintArray(max) - this.prev = new UintArray(max) - this.head = 0 - this.tail = 0 - this.free = new Stack(max) - this.initialFill = 1 - this.size = 0 - - if (typeof dispose === 'function') { - this.dispose = dispose - } - if (typeof disposeAfter === 'function') { - this.disposeAfter = disposeAfter - this.disposed = [] - } else { - this.disposeAfter = null - this.disposed = null - } - this.noDisposeOnSet = !!noDisposeOnSet - this.noUpdateTTL = !!noUpdateTTL - - if (this.maxSize) { - if (!isPosInt(this.maxSize)) { - throw new TypeError('maxSize must be a positive integer if specified') - } - this.initializeSizeTracking() - } - - this.allowStale = !!allowStale || !!stale - this.updateAgeOnGet = !!updateAgeOnGet - this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 - ? ttlResolution : 1 - this.ttlAutopurge = !!ttlAutopurge - this.ttl = ttl || maxAge || 0 - if (this.ttl) { - if (!isPosInt(this.ttl)) { - throw new TypeError('ttl must be a positive integer if specified') - } - this.initializeTTLTracking() - } - - if (stale) { - deprecatedOption('stale', 'allowStale') - } - if (maxAge) { - deprecatedOption('maxAge', 'ttl') - } - if (length) { - deprecatedOption('length', 'sizeCalculation') - } - } - - initializeTTLTracking () { - this.ttls = new ZeroArray(this.max) - this.starts = new ZeroArray(this.max) - this.setItemTTL = (index, ttl) => { - this.starts[index] = ttl !== 0 ? perf.now() : 0 - this.ttls[index] = ttl - if (ttl !== 0 && this.ttlAutopurge) { - const t = setTimeout(() => { - if (this.isStale(index)) { - this.delete(this.keyList[index]) - } - }, ttl + 1) - /* istanbul ignore else - unref() not supported on all platforms */ - if (t.unref) { - t.unref() - } - } - } - this.updateItemAge = (index) => { - this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0 - } - // debounce calls to perf.now() to 1s so we're not hitting - // that costly call repeatedly. - let cachedNow = 0 - const getNow = () => { - const n = perf.now() - if (this.ttlResolution > 0) { - cachedNow = n - const t = setTimeout(() => cachedNow = 0, this.ttlResolution) - /* istanbul ignore else - not available on all platforms */ - if (t.unref) { - t.unref() - } - } - return n - } - this.isStale = (index) => { - return this.ttls[index] !== 0 && this.starts[index] !== 0 && - ((cachedNow || getNow()) - this.starts[index] > this.ttls[index]) - } - } - updateItemAge (index) {} - setItemTTL (index, ttl) {} - isStale (index) { return false } - - initializeSizeTracking () { - this.calculatedSize = 0 - this.sizes = new ZeroArray(this.max) - this.removeItemSize = index => this.calculatedSize -= this.sizes[index] - this.addItemSize = (index, v, k, size, sizeCalculation) => { - const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0) - this.sizes[index] = isPosInt(s) ? s : 0 - const maxSize = this.maxSize - this.sizes[index] - while (this.calculatedSize > maxSize) { - this.evict() - } - 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, sizeCalculation) {} - - *indexes () { - if (this.size) { - for (let i = this.tail; true; i = this.prev[i]) { - if (!this.isStale(i)) { - yield i - } - if (i === this.head) { - break - } - } - } - } - *rindexes () { - if (this.size) { - for (let i = this.head; true; i = this.next[i]) { - if (!this.isStale(i)) { - yield i - } - if (i === this.tail) { - break - } - } - } - } - - *entries () { - for (const i of this.indexes()) { - yield [this.keyList[i], this.valList[i]] - } - } - - *keys () { - for (const i of this.indexes()) { - yield this.keyList[i] - } - } - - *values () { - for (const i of this.indexes()) { - yield this.valList[i] - } - } - - [Symbol.iterator] () { - return this.entries() - } - - find (fn, getOptions = {}) { - for (const i of this.indexes()) { - if (fn(this.valList[i], this.keyList[i], this)) { - return this.get(this.keyList[i], getOptions) - } - } - } - - forEach (fn, thisp = this) { - for (const i of this.indexes()) { - fn.call(thisp, this.valList[i], this.keyList[i], this) - } - } - - rforEach (fn, thisp = this) { - for (const i of this.rindexes()) { - fn.call(thisp, this.valList[i], this.keyList[i], this) - } - } - - get prune () { - deprecatedMethod('prune', 'purgeStale') - return this.purgeStale - } - - purgeStale () { - let deleted = false - if (this.size) { - for (let i = this.head; true; i = this.next[i]) { - const b = i === this.tail - if (this.isStale(i)) { - this.delete(this.keyList[i]) - deleted = true - } - if (b) { - break - } - } - } - return deleted - } - - dump () { - const arr = [] - for (const i of this.indexes()) { - const key = this.keyList[i] - const value = this.valList[i] - const entry = { value } - if (this.ttls) { - entry.ttl = this.ttls[i] - } - if (this.sizes) { - entry.size = this.sizes[i] - } - arr.unshift([key, entry]) - } - return arr - } - - load (arr) { - this.clear() - for (const [key, entry] of arr) { - this.set(key, entry.value, entry) - } - } - - dispose (v, k, reason) {} - - set (k, v, { - ttl = this.ttl, - noDisposeOnSet = this.noDisposeOnSet, - size = 0, - sizeCalculation = this.sizeCalculation, - noUpdateTTL = this.noUpdateTTL, - } = {}) { - let index = this.size === 0 ? undefined : this.keyMap.get(k) - if (index === undefined) { - // addition - index = this.newIndex() - this.keyList[index] = k - this.valList[index] = v - this.keyMap.set(k, index) - this.next[this.tail] = index - this.prev[index] = this.tail - this.tail = index - this.size ++ - this.addItemSize(index, v, k, size, sizeCalculation) - noUpdateTTL = false - } else { - // update - const oldVal = this.valList[index] - if (v !== oldVal) { - if (!noDisposeOnSet) { - this.dispose(oldVal, k, 'set') - if (this.disposeAfter) { - this.disposed.push([oldVal, k, 'set']) - } - } - this.removeItemSize(index) - this.valList[index] = v - this.addItemSize(index, v, k, size, sizeCalculation) - } - this.moveToTail(index) - } - if (ttl !== 0 && this.ttl === 0 && !this.ttls) { - this.initializeTTLTracking() - } - if (!noUpdateTTL) { - this.setItemTTL(index, ttl) - } - if (this.disposeAfter) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - return this - } - - newIndex () { - if (this.size === 0) { - return this.tail - } - if (this.size === this.max) { - return this.evict() - } - if (this.free.length !== 0) { - return this.free.pop() - } - // initial fill, just keep writing down the list - return this.initialFill++ - } - - pop () { - if (this.size) { - const val = this.valList[this.head] - this.evict() - return val - } - } - - evict () { - const head = this.head - const k = this.keyList[head] - const v = this.valList[head] - this.dispose(v, k, 'evict') - if (this.disposeAfter) { - this.disposed.push([v, k, 'evict']) - } - this.removeItemSize(head) - this.head = this.next[head] - this.keyMap.delete(k) - this.size -- - return head - } - - has (k) { - return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k)) - } - - // like get(), but without any LRU updating or TTL expiration - peek (k, { allowStale = this.allowStale } = {}) { - const index = this.keyMap.get(k) - if (index !== undefined && (allowStale || !this.isStale(index))) { - return this.valList[index] - } - } - - get (k, { - allowStale = this.allowStale, - updateAgeOnGet = this.updateAgeOnGet, - } = {}) { - const index = this.keyMap.get(k) - if (index !== undefined) { - if (this.isStale(index)) { - const value = allowStale ? this.valList[index] : undefined - this.delete(k) - return value - } else { - this.moveToTail(index) - if (updateAgeOnGet) { - this.updateItemAge(index) - } - return this.valList[index] - } - } - } - - connect (p, n) { - this.prev[n] = p - this.next[p] = n - } - - moveToTail (index) { - // if tail already, nothing to do - // if head, move head to next[index] - // else - // move next[prev[index]] to next[index] (head has no prev) - // move prev[next[index]] to prev[index] - // prev[index] = tail - // next[tail] = index - // tail = index - if (index !== this.tail) { - if (index === this.head) { - this.head = this.next[index] - } else { - this.connect(this.prev[index], this.next[index]) - } - this.connect(this.tail, index) - this.tail = index - } - } - - get del () { - deprecatedMethod('del', 'delete') - return this.delete - } - delete (k) { - let deleted = false - if (this.size !== 0) { - const index = this.keyMap.get(k) - if (index !== undefined) { - deleted = true - if (this.size === 1) { - this.clear() - } else { - this.removeItemSize(index) - this.dispose(this.valList[index], k, 'delete') - if (this.disposeAfter) { - this.disposed.push([this.valList[index], k, 'delete']) - } - this.keyMap.delete(k) - this.keyList[index] = null - this.valList[index] = null - if (index === this.tail) { - this.tail = this.prev[index] - } else if (index === this.head) { - this.head = this.next[index] - } else { - this.next[this.prev[index]] = this.next[index] - this.prev[this.next[index]] = this.prev[index] - } - this.size -- - this.free.push(index) - } - } - } - if (this.disposed) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - return deleted - } - - clear () { - if (this.dispose !== LRUCache.prototype.dispose) { - for (const index of this.rindexes()) { - this.dispose(this.valList[index], this.keyList[index], 'delete') - } - } - if (this.disposeAfter) { - for (const index of this.rindexes()) { - this.disposed.push([this.valList[index], this.keyList[index], 'delete']) - } - } - this.keyMap.clear() - this.valList.fill(null) - this.keyList.fill(null) - if (this.ttls) { - this.ttls.fill(0) - this.starts.fill(0) - } - if (this.sizes) { - this.sizes.fill(0) - } - this.head = 0 - this.tail = 0 - this.initialFill = 1 - this.free.length = 0 - this.calculatedSize = 0 - this.size = 0 - if (this.disposed) { - while (this.disposed.length) { - this.disposeAfter(...this.disposed.shift()) - } - } - } - get reset () { - deprecatedMethod('reset', 'clear') - return this.clear - } - - get length () { - deprecatedProperty('length', 'size') - return this.size - } -} - -module.exports = LRUCache diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json deleted file mode 100644 index ae92116975dc96..00000000000000 --- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "lru-cache", - "description": "A cache object that deletes the least-recently-used items.", - "version": "7.4.0", - "author": "Isaac Z. Schlueter ", - "keywords": [ - "mru", - "lru", - "cache" - ], - "scripts": { - "prepare": "webpack-cli -o bundle ./index.js --node-env production", - "build": "npm run prepare", - "presize": "npm run prepare", - "test": "tap", - "snap": "tap", - "size": "size-limit", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "main": "index.js", - "browser": "./bundle/main.js", - "exports": { - ".": "./index.js", - "./browser": "./bundle/main.js" - }, - "repository": "git://github.com/isaacs/node-lru-cache.git", - "devDependencies": { - "@size-limit/preset-small-lib": "^7.0.8", - "benchmark": "^2.1.4", - "size-limit": "^7.0.8", - "tap": "^15.1.6", - "webpack-cli": "^4.9.2" - }, - "license": "ISC", - "files": [ - "index.js", - "bundle" - ], - "engines": { - "node": ">=12" - }, - "tap": { - "coverage-map": "map.js" - }, - "size-limit": [ - { - "path": "./bundle/main.js" - } - ] -} diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json index b871b18e09766c..e52131b8a8e01d 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.0.4", + "version": "10.0.6", "description": "Opinionated, caching, retrying fetch client", "main": "lib/index.js", "files": [ @@ -34,15 +34,15 @@ "license": "ISC", "dependencies": { "agentkeepalive": "^4.2.1", - "cacache": "^15.3.0", + "cacache": "^16.0.0", "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", - "lru-cache": "^7.4.0", + "lru-cache": "^7.5.1", "minipass": "^3.1.6", "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.1", + "minipass-fetch": "^2.0.3", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", @@ -51,8 +51,8 @@ "ssri": "^8.0.1" }, "devDependencies": { - "@npmcli/template-oss": "^2.8.1", - "eslint": "^8.10.0", + "@npmcli/template-oss": "^2.9.2", + "eslint": "^8.11.0", "mkdirp": "^1.0.4", "nock": "^13.2.4", "rimraf": "^3.0.2", @@ -69,6 +69,6 @@ "check-coverage": true }, "templateOSS": { - "version": "2.8.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/minipass-fetch/lib/index.js b/deps/npm/node_modules/minipass-fetch/lib/index.js index 473630e1a5857a..22257a417aff84 100644 --- a/deps/npm/node_modules/minipass-fetch/lib/index.js +++ b/deps/npm/node_modules/minipass-fetch/lib/index.js @@ -204,6 +204,14 @@ const fetch = async (url, opts) => { timeout: request.timeout, } + // if the redirect is to a new hostname, strip the authorization and cookie headers + const parsedOriginal = new URL(request.url) + const parsedRedirect = new URL(locationURL) + if (parsedOriginal.hostname !== parsedRedirect.hostname) { + requestOpts.headers.delete('authorization') + requestOpts.headers.delete('cookie') + } + // HTTP-redirect fetch step 11 if (res.statusCode === 303 || ( (res.statusCode === 301 || res.statusCode === 302) && diff --git a/deps/npm/node_modules/minipass-fetch/package.json b/deps/npm/node_modules/minipass-fetch/package.json index 47e32dad6df8b3..68e1ce134cd26c 100644 --- a/deps/npm/node_modules/minipass-fetch/package.json +++ b/deps/npm/node_modules/minipass-fetch/package.json @@ -1,6 +1,6 @@ { "name": "minipass-fetch", - "version": "2.0.2", + "version": "2.0.3", "description": "An implementation of window.fetch in Node.js using Minipass streams", "license": "MIT", "main": "lib/index.js", @@ -22,11 +22,12 @@ "check-coverage": true }, "devDependencies": { - "@npmcli/template-oss": "^2.8.1", + "@npmcli/template-oss": "^2.9.2", "@ungap/url-search-params": "^0.2.2", "abort-controller": "^3.0.0", "abortcontroller-polyfill": "~1.7.3", "form-data": "^4.0.0", + "nock": "^13.2.4", "parted": "^0.1.1", "string-to-arraybuffer": "^1.0.2", "tap": "^15.1.6" @@ -58,6 +59,6 @@ }, "author": "GitHub Inc.", "templateOSS": { - "version": "2.8.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/normalize-package-data/AUTHORS b/deps/npm/node_modules/normalize-package-data/AUTHORS deleted file mode 100644 index 66282ba1d11971..00000000000000 --- a/deps/npm/node_modules/normalize-package-data/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -# Names sorted by how much code was originally theirs. -Isaac Z. Schlueter -Meryn Stol -Robert Kowalski diff --git a/deps/npm/node_modules/normalize-package-data/lib/fixer.js b/deps/npm/node_modules/normalize-package-data/lib/fixer.js index 97c26b26b461dc..0846f2c045a6e5 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/fixer.js +++ b/deps/npm/node_modules/normalize-package-data/lib/fixer.js @@ -8,6 +8,8 @@ var extractDescription = require('./extract_description') var url = require('url') var typos = require('./typos.json') +var isEmail = str => str.includes('@') && (str.indexOf('@') < str.lastIndexOf('.')) + module.exports = { // default warning function warn: function () {}, @@ -127,7 +129,7 @@ module.exports = { if (!data.dependencies) { data.dependencies = {} } - if (Object.prototype.hasOwnProperty.call(data.dependencies, bd)) { + if (!Object.prototype.hasOwnProperty.call(data.dependencies, bd)) { this.warn('nonDependencyBundleDependency', bd) data.dependencies[bd] = '*' } @@ -213,7 +215,7 @@ module.exports = { fixNameField: function (data, options) { if (typeof options === 'boolean') { - options = {strict: options} + options = { strict: options } } else if (typeof options === 'undefined') { options = {} } @@ -261,16 +263,15 @@ module.exports = { if (!data.bugs && data.repository && data.repository.url) { var hosted = hostedGitInfo.fromUrl(data.repository.url) if (hosted && hosted.bugs()) { - data.bugs = {url: hosted.bugs()} + data.bugs = { url: hosted.bugs() } } } else if (data.bugs) { - var emailRe = /^.+@.*\..+$/ if (typeof data.bugs === 'string') { - if (emailRe.test(data.bugs)) { - data.bugs = {email: data.bugs} + if (isEmail(data.bugs)) { + data.bugs = { email: data.bugs } /* eslint-disable-next-line node/no-deprecated-api */ } else if (url.parse(data.bugs).protocol) { - data.bugs = {url: data.bugs} + data.bugs = { url: data.bugs } } else { this.warn('nonEmailUrlBugsString') } @@ -287,7 +288,7 @@ module.exports = { } } if (oldBugs.email) { - if (typeof (oldBugs.email) === 'string' && emailRe.test(oldBugs.email)) { + if (typeof (oldBugs.email) === 'string' && isEmail(oldBugs.email)) { data.bugs.email = oldBugs.email } else { this.warn('nonEmailBugsEmailField') @@ -399,8 +400,8 @@ function parsePerson (person) { return person } var name = person.match(/^([^(<]+)/) - var url = person.match(/\(([^)]+)\)/) - var email = person.match(/<([^>]+)>/) + var url = person.match(/\(([^()]+)\)/) + var email = person.match(/<([^<>]+)>/) var obj = {} if (name && name[0].trim()) { obj.name = name[0].trim() diff --git a/deps/npm/node_modules/normalize-package-data/package.json b/deps/npm/node_modules/normalize-package-data/package.json index 17f167ea13f516..a6f1244eb5a256 100644 --- a/deps/npm/node_modules/normalize-package-data/package.json +++ b/deps/npm/node_modules/normalize-package-data/package.json @@ -1,7 +1,7 @@ { "name": "normalize-package-data", - "version": "3.0.3", - "author": "Meryn Stol ", + "version": "4.0.0", + "author": "GitHub Inc.", "description": "Normalizes data that can be found in package.json files.", "license": "BSD-2-Clause", "repository": { @@ -13,29 +13,40 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "preversion": "npm test", - "test": "tap test/*.js --branches 85 --functions 90 --lines 85 --statements 85", + "test": "tap", "npmclilint": "npmcli-lint", - "lint": "npm run npmclilint -- \"lib/**/*.*js\" \"test/**/*.*js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint --", - "postsnap": "npm run lintfix --" + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "snap": "tap" }, "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" + "hosted-git-info": "^5.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" }, "devDependencies": { - "@npmcli/lint": "^1.0.2", + "@npmcli/template-oss": "^2.9.2", "tap": "^15.0.9" }, "files": [ - "lib/*.js", - "lib/*.json", - "AUTHORS" + "bin", + "lib" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.9.2" + }, + "tap": { + "branches": 86, + "functions": 92, + "lines": 86, + "statements": 86 } } diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index b0821312a7f0d6..25356af3739824 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,6 +1,6 @@ { "name": "npm-package-arg", - "version": "9.0.0", + "version": "9.0.1", "description": "Parse the things that can be arguments to `npm install`", "main": "./lib/npa.js", "directories": { @@ -11,12 +11,12 @@ "lib" ], "dependencies": { - "hosted-git-info": "^4.1.0", + "hosted-git-info": "^5.0.0", "semver": "^7.3.5", "validate-npm-package-name": "^3.0.0" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", + "@npmcli/template-oss": "^2.9.2", "tap": "^15.1.6" }, "scripts": { @@ -50,6 +50,6 @@ "branches": 97 }, "templateOSS": { - "version": "2.7.1" + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/npm-packlist/bin/index.js b/deps/npm/node_modules/npm-packlist/bin/index.js index 40811db7d32e72..a42f5b74ce80e8 100755 --- a/deps/npm/node_modules/npm-packlist/bin/index.js +++ b/deps/npm/node_modules/npm-packlist/bin/index.js @@ -6,18 +6,19 @@ process.argv.slice(2).forEach(arg => { if (arg === '-h' || arg === '--help') { console.log('usage: npm-packlist [-s --sort] [directory, directory, ...]') process.exit(0) - } else if (arg === '-s' || arg === '--sort') + } else if (arg === '-s' || arg === '--sort') { doSort = true - else + } else { dirs.push(arg) + } }) const sort = list => doSort ? list.sort((a, b) => a.localeCompare(b, 'en')) : list const packlist = require('../') -if (!dirs.length) +if (!dirs.length) { console.log(sort(packlist.sync({ path: process.cwd() })).join('\n')) -else { +} else { dirs.forEach(path => { console.log(`> ${path}`) console.log(sort(packlist.sync({ path })).join('\n')) diff --git a/deps/npm/node_modules/npm-packlist/index.js b/deps/npm/node_modules/npm-packlist/lib/index.js similarity index 99% rename from deps/npm/node_modules/npm-packlist/index.js rename to deps/npm/node_modules/npm-packlist/lib/index.js index 76018557cb9c8e..1b67e4e71e04d3 100644 --- a/deps/npm/node_modules/npm-packlist/index.js +++ b/deps/npm/node_modules/npm-packlist/lib/index.js @@ -58,6 +58,7 @@ const defaultRules = [ '*.orig', '/package-lock.json', '/yarn.lock', + '/pnpm-lock.yaml', '/archived-packages/**', ] @@ -248,7 +249,7 @@ const npmWalker = Class => class Walker extends Class { } } const processResults = results => { - for (const {negate, fileList} of results) { + for (const { negate, fileList } of results) { if (negate) { fileList.forEach(f => { f = f.replace(/\/+$/, '') @@ -276,7 +277,7 @@ const npmWalker = Class => class Walker extends Class { // maintain the index so that we process them in-order only once all // are completed, otherwise the parallelism messes things up, since a // glob like **/*.js will always be slower than a subsequent !foo.js - patterns.forEach(({pattern, negate}, i) => + patterns.forEach(({ pattern, negate }, i) => this.globFiles(pattern, (er, res) => then(pattern, negate, er, res, i))) } diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index 2fe493a203601c..ab270f60713b6a 100644 --- a/deps/npm/node_modules/npm-packlist/package.json +++ b/deps/npm/node_modules/npm-packlist/package.json @@ -1,40 +1,42 @@ { "name": "npm-packlist", - "version": "3.0.0", + "version": "4.0.0", "description": "Get a list of the files to add from a folder into an npm package", "directories": { "test": "test" }, - "main": "index.js", + "main": "lib", "dependencies": { - "glob": "^7.1.6", + "glob": "^7.2.0", "ignore-walk": "^4.0.1", - "npm-bundled": "^1.1.1", + "npm-bundled": "^1.1.2", "npm-normalize-package-bin": "^1.0.1" }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "author": "GitHub Inc.", "license": "ISC", "files": [ - "bin/index.js", - "index.js" + "bin", + "lib" ], "devDependencies": { - "@npmcli/lint": "^1.0.2", + "@npmcli/template-oss": "^2.9.2", "mutate-fs": "^2.1.1", - "tap": "^15.0.6" + "tap": "^15.1.6" }, "scripts": { "test": "tap", - "posttest": "npm run lint --", + "posttest": "npm run lint", "snap": "tap", "postsnap": "npm run lintfix --", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "npm run npmclilint -- \"*.*js\" \"test/**/*.*js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", - "npmclilint": "npmcli-lint" + "npmclilint": "npmcli-lint", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force" }, "repository": { "type": "git", @@ -54,6 +56,9 @@ "npm-packlist": "bin/index.js" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index fc6ab52fa9bc08..f49c23147a80ca 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "13.0.3", + "version": "13.0.5", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -25,7 +25,7 @@ "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", + "@npmcli/template-oss": "^2.9.2", "mutate-fs": "^2.1.1", "npm-registry-mock": "^1.3.1", "tap": "^15.1.6" @@ -43,20 +43,20 @@ "@npmcli/git": "^3.0.0", "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/promise-spawn": "^1.2.0", - "@npmcli/run-script": "^3.0.0", - "cacache": "^15.3.0", + "@npmcli/run-script": "^3.0.1", + "cacache": "^16.0.0", "chownr": "^2.0.0", "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", "minipass": "^3.1.6", "mkdirp": "^1.0.4", "npm-package-arg": "^9.0.0", - "npm-packlist": "^3.0.0", + "npm-packlist": "^4.0.0", "npm-pick-manifest": "^7.0.0", - "npm-registry-fetch": "^13.0.0", + "npm-registry-fetch": "^13.0.1", "proc-log": "^2.0.0", "promise-retry": "^2.0.1", - "read-package-json": "^4.1.1", + "read-package-json": "^5.0.0", "read-package-json-fast": "^2.0.3", "rimraf": "^3.0.2", "ssri": "^8.0.1", @@ -67,7 +67,7 @@ }, "repository": "git@github.com:npm/pacote", "templateOSS": { - "version": "2.7.1", + "version": "2.9.2", "windowsCI": false } } diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/lib/read-json.js similarity index 97% rename from deps/npm/node_modules/read-package-json/read-json.js rename to deps/npm/node_modules/read-package-json/lib/read-json.js index 468a33e3977742..d0ee9af1ae7505 100644 --- a/deps/npm/node_modules/read-package-json/read-json.js +++ b/deps/npm/node_modules/read-package-json/lib/read-json.js @@ -350,7 +350,9 @@ function mans (file, data, cb) { if (er) { return cb(er) } - data.man = mans.map(man => path.relative(dirname, path.join(cwd, man))) + data.man = mans.map(man => + path.relative(dirname, path.join(cwd, man)).split(path.sep).join('/') + ) return cb(null, data) }) } @@ -522,6 +524,10 @@ function final (file, data, log, strict, cb) { function fillTypes (file, data, cb) { var index = data.main ? data.main : 'index.js' + if (typeof index !== 'string') { + return cb(new TypeError('The "main" attribute must be of type string.')) + } + // TODO exports is much more complicated than this in verbose format // We need to support for instance @@ -552,7 +558,7 @@ function fillTypes (file, data, cb) { var dtsPath = path.join(path.dirname(file), dts) var hasDTSFields = 'types' in data || 'typings' in data if (!hasDTSFields && fs.existsSync(dtsPath)) { - data.types = dts + data.types = dts.split(path.sep).join('/') } cb(null, data) diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json index fb263fd711ee7f..038047c9709418 100644 --- a/deps/npm/node_modules/read-package-json/package.json +++ b/deps/npm/node_modules/read-package-json/package.json @@ -1,46 +1,55 @@ { "name": "read-package-json", - "version": "4.1.1", - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "version": "5.0.0", + "author": "GitHub Inc.", "description": "The thing npm uses to read package.json files with semantics and defaults and validation", "repository": { "type": "git", "url": "https://github.com/npm/read-package-json.git" }, - "main": "read-json.js", + "main": "lib/read-json.js", "scripts": { "prerelease": "npm t", "postrelease": "npm publish && git push --follow-tags", "release": "standard-version -s", - "test": "tap --nyc-arg=--all --coverage test/*.js", + "test": "tap", "npmclilint": "npmcli-lint", - "lint": "npm run npmclilint -- --ignore-pattern test/fixtures \"*.*js\" \"test/**/*.*js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint --", - "postsnap": "npm run lintfix --" + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap" }, "dependencies": { - "glob": "^7.1.1", - "json-parse-even-better-errors": "^2.3.0", - "normalize-package-data": "^3.0.0", - "npm-normalize-package-bin": "^1.0.0" + "glob": "^7.2.0", + "json-parse-even-better-errors": "^2.3.1", + "normalize-package-data": "^4.0.0", + "npm-normalize-package-bin": "^1.0.1" }, "devDependencies": { - "@npmcli/lint": "^1.0.2", - "standard-version": "^9.3.1", + "@npmcli/template-oss": "^2.9.2", "tap": "^15.0.9" }, "license": "ISC", "files": [ - "read-json.js" + "bin", + "lib" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "tap": { "branches": 68, "functions": 83, "lines": 76, "statements": 77 + }, + "templateOSS": { + "version": "2.9.2" } } diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE similarity index 92% rename from deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE rename to deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE index 9b58a3e03d1df1..19129e315fe593 100644 --- a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE +++ b/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors +Copyright (c) Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/deps/npm/node_modules/semver/node_modules/lru-cache/index.js b/deps/npm/node_modules/semver/node_modules/lru-cache/index.js new file mode 100644 index 00000000000000..573b6b85b9779d --- /dev/null +++ b/deps/npm/node_modules/semver/node_modules/lru-cache/index.js @@ -0,0 +1,334 @@ +'use strict' + +// A linked list to keep track of recently-used-ness +const Yallist = require('yallist') + +const MAX = Symbol('max') +const LENGTH = Symbol('length') +const LENGTH_CALCULATOR = Symbol('lengthCalculator') +const ALLOW_STALE = Symbol('allowStale') +const MAX_AGE = Symbol('maxAge') +const DISPOSE = Symbol('dispose') +const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') +const LRU_LIST = Symbol('lruList') +const CACHE = Symbol('cache') +const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') + +const naiveLength = () => 1 + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +class LRUCache { + constructor (options) { + if (typeof options === 'number') + options = { max: options } + + if (!options) + options = {} + + if (options.max && (typeof options.max !== 'number' || options.max < 0)) + throw new TypeError('max must be a non-negative number') + // Kind of weird to have a default max of Infinity, but oh well. + const max = this[MAX] = options.max || Infinity + + const lc = options.length || naiveLength + this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc + this[ALLOW_STALE] = options.stale || false + if (options.maxAge && typeof options.maxAge !== 'number') + throw new TypeError('maxAge must be a number') + this[MAX_AGE] = options.maxAge || 0 + this[DISPOSE] = options.dispose + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false + this.reset() + } + + // resize the cache when the max changes. + set max (mL) { + if (typeof mL !== 'number' || mL < 0) + throw new TypeError('max must be a non-negative number') + + this[MAX] = mL || Infinity + trim(this) + } + get max () { + return this[MAX] + } + + set allowStale (allowStale) { + this[ALLOW_STALE] = !!allowStale + } + get allowStale () { + return this[ALLOW_STALE] + } + + set maxAge (mA) { + if (typeof mA !== 'number') + throw new TypeError('maxAge must be a non-negative number') + + this[MAX_AGE] = mA + trim(this) + } + get maxAge () { + return this[MAX_AGE] + } + + // resize the cache when the lengthCalculator changes. + set lengthCalculator (lC) { + if (typeof lC !== 'function') + lC = naiveLength + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC + this[LENGTH] = 0 + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) + this[LENGTH] += hit.length + }) + } + trim(this) + } + get lengthCalculator () { return this[LENGTH_CALCULATOR] } + + get length () { return this[LENGTH] } + get itemCount () { return this[LRU_LIST].length } + + rforEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev + forEachStep(this, fn, walker, thisp) + walker = prev + } + } + + forEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next + forEachStep(this, fn, walker, thisp) + walker = next + } + } + + keys () { + return this[LRU_LIST].toArray().map(k => k.key) + } + + values () { + return this[LRU_LIST].toArray().map(k => k.value) + } + + reset () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) + } + + this[CACHE] = new Map() // hash of items by key + this[LRU_LIST] = new Yallist() // list of items in order of use recency + this[LENGTH] = 0 // length of items in the list + } + + dump () { + return this[LRU_LIST].map(hit => + isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h) + } + + dumpLru () { + return this[LRU_LIST] + } + + set (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE] + + if (maxAge && typeof maxAge !== 'number') + throw new TypeError('maxAge must be a number') + + const now = maxAge ? Date.now() : 0 + const len = this[LENGTH_CALCULATOR](value, key) + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)) + return false + } + + const node = this[CACHE].get(key) + const item = node.value + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value) + } + + item.now = now + item.maxAge = maxAge + item.value = value + this[LENGTH] += len - item.length + item.length = len + this.get(key) + trim(this) + return true + } + + const hit = new Entry(key, value, len, now, maxAge) + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value) + + return false + } + + this[LENGTH] += hit.length + this[LRU_LIST].unshift(hit) + this[CACHE].set(key, this[LRU_LIST].head) + trim(this) + return true + } + + has (key) { + if (!this[CACHE].has(key)) return false + const hit = this[CACHE].get(key).value + return !isStale(this, hit) + } + + get (key) { + return get(this, key, true) + } + + peek (key) { + return get(this, key, false) + } + + pop () { + const node = this[LRU_LIST].tail + if (!node) + return null + + del(this, node) + return node.value + } + + del (key) { + del(this, this[CACHE].get(key)) + } + + load (arr) { + // reset the cache + this.reset() + + const now = Date.now() + // A previous serialized cache has the most recent items first + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l] + const expiresAt = hit.e || 0 + if (expiresAt === 0) + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + else { + const maxAge = expiresAt - now + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge) + } + } + } + } + + prune () { + this[CACHE].forEach((value, key) => get(this, key, false)) + } +} + +const get = (self, key, doUse) => { + const node = self[CACHE].get(key) + if (node) { + const hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + return undefined + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) + node.value.now = Date.now() + self[LRU_LIST].unshiftNode(node) + } + } + return hit.value + } +} + +const isStale = (self, hit) => { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) + return false + + const diff = Date.now() - hit.now + return hit.maxAge ? diff > hit.maxAge + : self[MAX_AGE] && (diff > self[MAX_AGE]) +} + +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev + del(self, walker) + walker = prev + } + } +} + +const del = (self, node) => { + if (node) { + const hit = node.value + if (self[DISPOSE]) + self[DISPOSE](hit.key, hit.value) + + self[LENGTH] -= hit.length + self[CACHE].delete(hit.key) + self[LRU_LIST].removeNode(node) + } +} + +class Entry { + constructor (key, value, length, now, maxAge) { + this.key = key + this.value = value + this.length = length + this.now = now + this.maxAge = maxAge || 0 + } +} + +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + hit = undefined + } + if (hit) + fn.call(thisp, hit.value, hit.key, self) +} + +module.exports = LRUCache diff --git a/deps/npm/node_modules/semver/node_modules/lru-cache/package.json b/deps/npm/node_modules/semver/node_modules/lru-cache/package.json new file mode 100644 index 00000000000000..43b7502c3e7c79 --- /dev/null +++ b/deps/npm/node_modules/semver/node_modules/lru-cache/package.json @@ -0,0 +1,34 @@ +{ + "name": "lru-cache", + "description": "A cache object that deletes the least-recently-used items.", + "version": "6.0.0", + "author": "Isaac Z. Schlueter ", + "keywords": [ + "mru", + "lru", + "cache" + ], + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "main": "index.js", + "repository": "git://github.com/isaacs/node-lru-cache.git", + "devDependencies": { + "benchmark": "^2.1.4", + "tap": "^14.10.7" + }, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "files": [ + "index.js" + ], + "engines": { + "node": ">=10" + } +} diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts deleted file mode 100644 index 2dbf6af2b6f3b5..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare namespace ansiRegex { - interface Options { - /** - Match only the first ANSI escape. - - @default false - */ - onlyFirst: boolean; - } -} - -/** -Regular expression for matching ANSI escape codes. - -@example -``` -import ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` -*/ -declare function ansiRegex(options?: ansiRegex.Options): RegExp; - -export = ansiRegex; diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js deleted file mode 100644 index 616ff837d3ff01..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = ({onlyFirst = false} = {}) => { - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/license b/deps/npm/node_modules/string-width/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json b/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json deleted file mode 100644 index 017f53116a9e28..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "ansi-regex", - "version": "5.0.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": "chalk/ansi-regex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd", - "view-supported": "node fixtures/view-codes.js" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.9.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc29269eb..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. - -@example -``` -import stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` -*/ -declare function stripAnsi(string: string): string; - -export = stripAnsi; diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js deleted file mode 100644 index 9a593dfcd1fd5c..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/license b/deps/npm/node_modules/string-width/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json b/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json deleted file mode 100644 index 1a41108d42831c..00000000000000 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "strip-ansi", - "version": "6.0.1", - "description": "Strip ANSI escape codes from a string", - "license": "MIT", - "repository": "chalk/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.10.0", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/cli-columns/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/strip-ansi/index.d.ts similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/strip-ansi/index.d.ts rename to deps/npm/node_modules/strip-ansi/index.d.ts diff --git a/deps/npm/node_modules/cli-columns/node_modules/strip-ansi/index.js b/deps/npm/node_modules/strip-ansi/index.js similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/strip-ansi/index.js rename to deps/npm/node_modules/strip-ansi/index.js diff --git a/deps/npm/node_modules/cli-columns/node_modules/strip-ansi/license b/deps/npm/node_modules/strip-ansi/license similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/strip-ansi/license rename to deps/npm/node_modules/strip-ansi/license diff --git a/deps/npm/node_modules/cli-columns/node_modules/strip-ansi/package.json b/deps/npm/node_modules/strip-ansi/package.json similarity index 100% rename from deps/npm/node_modules/cli-columns/node_modules/strip-ansi/package.json rename to deps/npm/node_modules/strip-ansi/package.json diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/strip-ansi/readme.md similarity index 99% rename from deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md rename to deps/npm/node_modules/strip-ansi/readme.md index 7c4b56d46ddc72..e0ef1a809b6a50 100644 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md +++ b/deps/npm/node_modules/strip-ansi/readme.md @@ -43,4 +43,3 @@ The maintainers of strip-ansi and thousands of other packages are working with T - [Sindre Sorhus](https://github.com/sindresorhus) - [Josh Junon](https://github.com/qix-) - diff --git a/deps/npm/package.json b/deps/npm/package.json index 1d535ac05cd56c..d51ffcd4dc4fba 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "8.5.3", + "version": "8.5.5", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -55,17 +55,17 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^5.0.0", + "@npmcli/arborist": "^5.0.3", "@npmcli/ci-detect": "^2.0.0", "@npmcli/config": "^4.0.1", - "@npmcli/map-workspaces": "^2.0.0", + "@npmcli/map-workspaces": "^2.0.2", "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^3.0.1", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", - "cacache": "^15.3.0", + "cacache": "^16.0.2", "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^4.0.0", @@ -74,23 +74,23 @@ "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", "graceful-fs": "^4.2.9", - "hosted-git-info": "^4.1.0", + "hosted-git-info": "^5.0.0", "ini": "^2.0.0", - "init-package-json": "^3.0.0", + "init-package-json": "^3.0.1", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", - "libnpmaccess": "^6.0.0", - "libnpmdiff": "^4.0.0", - "libnpmexec": "^4.0.0", - "libnpmfund": "^3.0.0", - "libnpmhook": "^8.0.0", - "libnpmorg": "^4.0.0", - "libnpmpack": "^4.0.0", - "libnpmpublish": "^6.0.0", - "libnpmsearch": "^5.0.0", - "libnpmteam": "^4.0.0", - "libnpmversion": "^3.0.0", - "make-fetch-happen": "^10.0.4", + "libnpmaccess": "^6.0.2", + "libnpmdiff": "^4.0.2", + "libnpmexec": "^4.0.2", + "libnpmfund": "^3.0.1", + "libnpmhook": "^8.0.2", + "libnpmorg": "^4.0.2", + "libnpmpack": "^4.0.2", + "libnpmpublish": "^6.0.2", + "libnpmsearch": "^5.0.2", + "libnpmteam": "^4.0.2", + "libnpmversion": "^3.0.1", + "make-fetch-happen": "^10.0.6", "minipass": "^3.1.6", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -100,19 +100,19 @@ "nopt": "^5.0.0", "npm-audit-report": "^2.1.5", "npm-install-checks": "^4.0.0", - "npm-package-arg": "^9.0.0", + "npm-package-arg": "^9.0.1", "npm-pick-manifest": "^7.0.0", "npm-profile": "^6.0.2", "npm-registry-fetch": "^13.0.1", "npm-user-validate": "^1.0.1", "npmlog": "^6.0.1", "opener": "^1.5.2", - "pacote": "^13.0.3", + "pacote": "^13.0.5", "parse-conflict-json": "^2.0.1", "proc-log": "^2.0.0", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", - "read-package-json": "^4.1.1", + "read-package-json": "^5.0.0", "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", @@ -204,6 +204,7 @@ "@npmcli/template-oss": "^2.9.2", "eslint": "^8.3.0", "licensee": "^8.2.0", + "nock": "^13.2.4", "spawk": "^1.7.1", "tap": "^15.1.6" }, diff --git a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs index 13a3f66ef7d157..4fa3a2179e6ee5 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs @@ -143,6 +143,7 @@ Array [ isnt isnta isntal + isntall install-clean isntall-clean hlep diff --git a/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs new file mode 100644 index 00000000000000..a28654e5d9b29d --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs @@ -0,0 +1,1449 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/commands/doctor.js TAP all clear > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP all clear > output 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP all clear in color > everything is ok in color 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP all clear in color > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP bad proxy > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP bad proxy > output 1`] = ` +Check Value Recommendation/Notes +npm ping not ok unsupported proxy protocol: 'ssh:' +npm -v not ok Error: unsupported proxy protocol: 'ssh:' +node -v not ok Error: unsupported proxy protocol: 'ssh:' +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP cacache badContent > corrupted cache content 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 2 tarballs +` + +exports[`test/lib/commands/doctor.js TAP cacache badContent > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 1, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 2 + } + ), + ], + ], + "warn": Array [ + Array [ + "verifyCachedFiles", + "Corrupted content removed: 1", + ], + Array [ + "verifyCachedFiles", + "Cache issues have been fixed", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP cacache missingContent > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 1, + "verifiedContent": 2 + } + ), + ], + ], + "warn": Array [ + Array [ + "verifyCachedFiles", + "Missing content: 1", + ], + Array [ + "verifyCachedFiles", + "Cache issues have been fixed", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP cacache missingContent > missing content 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 2 tarballs +` + +exports[`test/lib/commands/doctor.js TAP cacache reclaimedCount > content garbage collected 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 2 tarballs +` + +exports[`test/lib/commands/doctor.js TAP cacache reclaimedCount > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 1, + "missingContent": 0, + "verifiedContent": 2 + } + ), + ], + ], + "warn": Array [ + Array [ + "verifyCachedFiles", + "Content garbage-collected: 1 (undefined bytes)", + ], + Array [ + "verifyCachedFiles", + "Cache issues have been fixed", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP error reading directory > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [ + Array [ + "checkFilesPermission", + "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/cache", + ], + Array [ + "checkFilesPermission", + "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules", + ], + Array [ + "checkFilesPermission", + "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/lib/node_modules", + ], + Array [ + "checkFilesPermission", + "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules/.bin", + ], + Array [ + "checkFilesPermission", + "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/bin", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP error reading directory > readdir error 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/cache (should be owned by current user) +Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules (should be owned by current user) +Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/lib/node_modules +Perms check on local bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules/.bin +Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/bin +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP incorrect owner > incorrect owner 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache (should be owned by current user) +Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules (should be owned by current user) +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP incorrect owner > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [ + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/tmp", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs/{DATE}-debug-0.log", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be/ccdeeea0a01ebb0e365e566161f7c68ddcbbe04206d8542742d98875f03f", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03/5c781820370e585dc2323edbbc80669bf714da5b47d56510c7d0bd7521ee", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/.bin", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testLink", + ], + Array [ + "checkFilesPermission", + "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir/testFile", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP incorrect permissions > incorrect owner 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/cache (should be owned by current user) +Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules (should be owned by current user) +Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/lib/node_modules +Perms check on local bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules/.bin +Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/bin +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP incorrect permissions > logs 1`] = ` +Object { + "error": Array [ + Array [ + "checkFilesPermission", + "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/cache (expect: readable)", + ], + Array [ + "checkFilesPermission", + "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules (expect: readable, writable)", + ], + Array [ + "checkFilesPermission", + "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/lib/node_modules (expect: readable)", + ], + Array [ + "checkFilesPermission", + "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules/.bin (expect: readable, writable, executable)", + ], + Array [ + "checkFilesPermission", + "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/bin (expect: executable)", + ], + ], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP missing git > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [ + Array [ + Error: test error, + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP missing git > missing git 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git not ok Install git and ensure it's in your PATH. +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP missing global directories > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [ + Array [ + "checkFilesPermission", + "error getting info for {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/lib/node_modules", + ], + Array [ + "checkFilesPermission", + "error getting info for {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/bin", + ], + ], +} +` + +exports[`test/lib/commands/doctor.js TAP missing global directories > missing global directories 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/lib/node_modules +Perms check on local bin folder ok +Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/bin +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP missing local node_modules > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP missing local node_modules > missing local node_modules 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP node out of date - current > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP node out of date - current > node is out of date 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v not ok Use node v2.0.1 (current: v2.0.0) +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP node out of date - lts > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP node out of date - lts > node is out of date 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v not ok Use node v1.0.0 (current: v0.0.1) +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP non-default registry > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP non-default registry > non default registry 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry not ok Try \`npm config set registry=https://registry.npmjs.org/\` +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP npm out of date > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP npm out of date > npm is out of date 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v not ok Use npm v2.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP ping 404 > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP ping 404 > ping 404 1`] = ` +Check Value Recommendation/Notes +npm ping not ok 404 404 Not Found - GET https://registry.npmjs.org/-/ping?write=true +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP ping 404 in color > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP ping 404 in color > ping 404 in color 1`] = ` +Check Value Recommendation/Notes +npm ping not ok 404 404 Not Found - GET https://registry.npmjs.org/-/ping?write=true +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP ping exception with code > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP ping exception with code > ping failure 1`] = ` +Check Value Recommendation/Notes +npm ping not ok request to https://registry.npmjs.org/-/ping?write=true failed, reason: Test Error +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP ping exception without code > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP ping exception without code > ping failure 1`] = ` +Check Value Recommendation/Notes +npm ping not ok request to https://registry.npmjs.org/-/ping?write=true failed, reason: Test Error +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok +Verify cache contents ok verified 0 tarballs +` + +exports[`test/lib/commands/doctor.js TAP silent > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP silent > output 1`] = ` + +` + +exports[`test/lib/commands/doctor.js TAP windows skips permissions checks > logs 1`] = ` +Object { + "error": Array [], + "info": Array [ + Array [ + "Running checkup", + ], + Array [ + "checkPing", + "Pinging registry", + ], + Array [ + "getLatestNpmVersion", + "Getting npm package information", + ], + Array [ + "getLatestNodejsVersion", + "Getting Node.js release information", + ], + Array [ + "getGitPath", + "Finding git in your PATH", + ], + Array [ + "verifyCachedFiles", + "Verifying the npm cache", + ], + Array [ + "verifyCachedFiles", + String( + Verification complete. Stats: { + "badContentCount": 0, + "reclaimedCount": 0, + "missingContent": 0, + "verifiedContent": 0 + } + ), + ], + ], + "warn": Array [], +} +` + +exports[`test/lib/commands/doctor.js TAP windows skips permissions checks > no permissions checks 1`] = ` +Check Value Recommendation/Notes +npm ping ok +npm -v ok current: v1.0.0, latest: v1.0.0 +node -v ok current: v1.0.0, recommended: v1.0.0 +npm config get registry ok using default registry (https://registry.npmjs.org/) +which git ok /path/to/git +Verify cache contents ok verified 0 tarballs +` diff --git a/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs index ddc80a9350f0a6..dee5f8af83b0f2 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs @@ -16,7 +16,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient > must }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 1, "requires": true }, @@ -39,7 +39,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient upgrad "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": {} @@ -61,7 +61,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing > mus }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": {} @@ -85,7 +85,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing downg "lockfile-version": 1 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 1, "requires": true }, @@ -108,7 +108,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing upgra "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": {} @@ -124,7 +124,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient > must match s "localPrefix": {}, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": {} @@ -142,7 +142,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient upgrade > must "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": {} @@ -162,12 +162,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient > }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -188,12 +188,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient up "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -212,12 +212,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing > }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -238,7 +238,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing d "lockfile-version": 1 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 1, "requires": true }, @@ -259,12 +259,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing u "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -283,12 +283,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient > mu }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -309,12 +309,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient upgr "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -333,12 +333,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing > m }, "config": {}, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, @@ -359,7 +359,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing dow "lockfile-version": 1 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 1, "requires": true }, @@ -380,12 +380,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing upg "lockfile-version": 3 }, "shrinkwrap": { - "name": "root", + "name": "prefix", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "root" + "name": "prefix" } } }, 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 72d09b44e2620f..229a9d323dbaee 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 @@ -68,6 +68,23 @@ yellow@1.0.1 'claudia' yellow@1.0.2 'claudia' ` +exports[`test/lib/commands/view.js TAP should log info of package in current working dir 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 + +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`] = ` 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 d84cdfb305e902..1ad8aee29f087e 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 @@ -55,6 +55,7 @@ Options: [--audit-level ] [--dry-run] [-f|--force] [--json] [--package-lock-only] [--omit [--omit ...]] +[--foreground-scripts] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -121,7 +122,8 @@ Usage: npm ci Options: -[--no-audit] [--ignore-scripts] [--script-shell ] +[--no-audit] [--foreground-scripts] [--ignore-scripts] +[--script-shell ] aliases: clean-install, ic, install-clean, isntall-clean @@ -449,13 +451,13 @@ npm install / Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--no-package-lock] -[--omit [--omit ...]] [--ignore-scripts] -[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] +[--omit [--omit ...]] +[--strict-peer-deps] [--no-package-lock] [--foreground-scripts] +[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] -aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add +aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add Run "npm help install" for more info ` @@ -469,7 +471,8 @@ Usage: npm install-ci-test Options: -[--no-audit] [--ignore-scripts] [--script-shell ] +[--no-audit] [--foreground-scripts] [--ignore-scripts] +[--script-shell ] alias: cit @@ -496,9 +499,9 @@ npm install-test / Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--no-package-lock] -[--omit [--omit ...]] [--ignore-scripts] -[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] +[--omit [--omit ...]] +[--strict-peer-deps] [--no-package-lock] [--foreground-scripts] +[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -742,7 +745,8 @@ npm prune [[<@scope>/]...] Options: [--omit [--omit ...]] [--dry-run] -[--json] [-w|--workspace [-w|--workspace ...]] +[--json] [--foreground-scripts] [--ignore-scripts] +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] Run "npm help prune" for more info @@ -773,7 +777,7 @@ Usage: npm rebuild [[<@scope>/][@] ...] Options: -[-g|--global] [--no-bin-links] [--ignore-scripts] +[-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -1063,11 +1067,11 @@ Usage: npm update [...] Options: -[-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] -[--no-package-lock] [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[--omit [--omit ...]] [--ignore-scripts] -[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] +[-g|--global] [--global-style] [--legacy-bundling] +[--omit [--omit ...]] +[--strict-peer-deps] [--no-package-lock] [--foreground-scripts] +[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] diff --git a/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs index 971580792048b4..f842e689f16310 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs @@ -27,6 +27,7 @@ Object { "isnt": "install", "isnta": "install", "isntal": "install", + "isntall": "install", "isntall-clean": "ci", "issues": "bugs", "la": "ll", @@ -71,6 +72,7 @@ Object { "isnt": "install", "isnta": "install", "isntal": "install", + "isntall": "install", "isntall-clean": "ci", "issues": "bugs", "it": "install-test", 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 d75d32d9b74eaf..373f094a59af93 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 @@ -659,6 +659,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set \`--yes\` during \`npm init\`. * Allow clobbering existing values in \`npm pkg\` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! @@ -715,7 +716,8 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for git-t * Default: true * Type: Boolean -Tag the commit when using the \`npm version\` command. +Tag the commit when using the \`npm version\` command. Setting this to false +results in no commit being made at all. ` exports[`test/lib/utils/config/definitions.js TAP > config description for global 1`] = ` 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 27b8278fd388e7..3a7d90db01be69 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 @@ -490,6 +490,7 @@ mistakes, unnecessary performance degradation, and malicious input. * Allow conflicting peerDependencies to be installed in the root project. * Implicitly set \`--yes\` during \`npm init\`. * Allow clobbering existing values in \`npm pkg\` +* Allow unpublishing of entire packages (not just a single version). If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! @@ -551,7 +552,8 @@ but is not in the \`PATH\`, then set this to the full path to the git binary. * Default: true * Type: Boolean -Tag the commit when using the \`npm version\` command. +Tag the commit when using the \`npm version\` command. Setting this to false +results in no commit being made at all. diff --git a/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs index 069212cec32367..8c6a17ad2f96fc 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs @@ -155,10 +155,6 @@ Object { "", "'yolo' is not in this registry.", ], - Array [ - "404", - "You should bug the author to publish it (or use the name yourself!)", - ], Array [ "404", String( 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 d2001f4da8c7ed..2db10df46e2f78 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 @@ -210,6 +210,7 @@ All commands: [--audit-level ] [--dry-run] [-f|--force] [--json] [--package-lock-only] [--omit [--omit ...]] + [--foreground-scripts] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -268,7 +269,8 @@ All commands: npm ci Options: - [--no-audit] [--ignore-scripts] [--script-shell ] + [--no-audit] [--foreground-scripts] [--ignore-scripts] + [--script-shell ] aliases: clean-install, ic, install-clean, isntall-clean @@ -558,13 +560,13 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--no-package-lock] - [--omit [--omit ...]] [--ignore-scripts] - [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] + [--omit [--omit ...]] + [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] + [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] - aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add + aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add Run "npm help install" for more info @@ -576,7 +578,8 @@ All commands: npm install-ci-test Options: - [--no-audit] [--ignore-scripts] [--script-shell ] + [--no-audit] [--foreground-scripts] [--ignore-scripts] + [--script-shell ] alias: cit @@ -601,9 +604,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--no-package-lock] - [--omit [--omit ...]] [--ignore-scripts] - [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] + [--omit [--omit ...]] + [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] + [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -819,7 +822,8 @@ All commands: Options: [--omit [--omit ...]] [--dry-run] - [--json] [-w|--workspace [-w|--workspace ...]] + [--json] [--foreground-scripts] [--ignore-scripts] + [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] Run "npm help prune" for more info @@ -846,7 +850,7 @@ All commands: npm rebuild [[<@scope>/][@] ...] Options: - [-g|--global] [--no-bin-links] [--ignore-scripts] + [-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] @@ -1098,11 +1102,11 @@ All commands: npm update [...] Options: - [-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] - [--no-package-lock] [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] - [--omit [--omit ...]] [--ignore-scripts] - [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] + [-g|--global] [--global-style] [--legacy-bundling] + [--omit [--omit ...]] + [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] + [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] diff --git a/deps/npm/test/fixtures/clean-snapshot.js b/deps/npm/test/fixtures/clean-snapshot.js index 037155eea186d6..b0ea28cee4d814 100644 --- a/deps/npm/test/fixtures/clean-snapshot.js +++ b/deps/npm/test/fixtures/clean-snapshot.js @@ -10,7 +10,7 @@ const cleanCwd = (path) => normalizePath(path) .replace(new RegExp(normalizePath(process.cwd()), 'g'), '{CWD}') const cleanDate = (str) => - str.replace(/\d{4}-\d{2}-\d{2}T\d{2}[_:]\d{2}[_:]\d{2}[_:]\d{3}Z/g, '{DATE}') + str.replace(/\d{4}-\d{2}-\d{2}T\d{2}[_:]\d{2}[_:]\d{2}[_:.]\d{3}Z/g, '{DATE}') module.exports = { normalizePath, diff --git a/deps/npm/test/fixtures/mock-logs.js b/deps/npm/test/fixtures/mock-logs.js index 80037c6ffa88d9..706c9a3050ac4e 100644 --- a/deps/npm/test/fixtures/mock-logs.js +++ b/deps/npm/test/fixtures/mock-logs.js @@ -60,7 +60,27 @@ const mockLogs = (otherMocks = {}) => { return acc }, {}), // except collect timing logs - { timing: (...args) => logs.push(['timing', ...args]) }, + { + timing: (...args) => logs.push(['timing', ...args]), + newItem: () => { + return { + info: (...p) => { + logs.push(['info', ...p]) + }, + warn: (...p) => { + logs.push(['warn', ...p]) + }, + error: (...p) => { + logs.push(['error', ...p]) + }, + silly: (...p) => { + logs.push(['silly', ...p]) + }, + completeWork: () => {}, + finish: () => {}, + } + }, + }, otherMocks.npmlog )), } diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js index 4846d9a4858419..ea608d66444460 100644 --- a/deps/npm/test/fixtures/mock-npm.js +++ b/deps/npm/test/fixtures/mock-npm.js @@ -49,7 +49,9 @@ const result = (fn, ...args) => typeof fn === 'function' ? fn(...args) : fn const LoadMockNpm = async (t, { init = true, load = init, - testdir = {}, + prefixDir = {}, + cacheDir = {}, + globalPrefixDir = {}, config = {}, mocks = {}, globals = null, @@ -77,9 +79,10 @@ const LoadMockNpm = async (t, { // Set log level as early as possible since setLoglevel(t, config.loglevel) - const dir = t.testdir({ root: testdir, cache: {} }) - const prefix = path.join(dir, 'root') + const dir = t.testdir({ prefix: prefixDir, cache: cacheDir, global: globalPrefixDir }) + const prefix = path.join(dir, 'prefix') const cache = path.join(dir, 'cache') + const globalPrefix = path.join(dir, 'global') // Set cache to testdir via env var so it is available when load is run // XXX: remove this for a solution where cache argv is passed in @@ -104,6 +107,7 @@ const LoadMockNpm = async (t, { setLoglevel(t, config.loglevel, false) npm.prefix = prefix npm.cache = cache + npm.globalPrefix = globalPrefix } return { @@ -111,6 +115,7 @@ const LoadMockNpm = async (t, { Npm, npm, prefix, + testdir: dir, cache, debugFile: async () => { const readFiles = npm.logFiles.map(f => fs.readFile(f)) diff --git a/deps/npm/test/fixtures/tnock.js b/deps/npm/test/fixtures/tnock.js new file mode 100644 index 00000000000000..c5acec510543d0 --- /dev/null +++ b/deps/npm/test/fixtures/tnock.js @@ -0,0 +1,15 @@ +'use strict' + +const nock = require('nock') + +// TODO (other tests actually make network calls today, which is bad) +// nock.disableNetConnect() + +module.exports = tnock +function tnock (t, host) { + const server = nock(host) + t.teardown(function () { + server.done() + }) + return server +} diff --git a/deps/npm/test/lib/commands/access.js b/deps/npm/test/lib/commands/access.js index 298897e4f5ffc6..81e29146b61021 100644 --- a/deps/npm/test/lib/commands/access.js +++ b/deps/npm/test/lib/commands/access.js @@ -61,7 +61,7 @@ t.test('edit', async t => { t.test('access public on unscoped package', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'npm-access-public-pkg', }), @@ -91,7 +91,7 @@ t.test('access public on scoped package', async t => { }, }, }, - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name }), }, }) @@ -109,7 +109,7 @@ t.test('access public on missing package.json', async t => { t.test('access public on invalid package.json', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': '{\n', node_modules: {}, }, @@ -123,7 +123,7 @@ t.test('access public on invalid package.json', async t => { t.test('access restricted on unscoped package', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'npm-access-restricted-pkg', }), @@ -153,7 +153,7 @@ t.test('access restricted on scoped package', async t => { }, }, }, - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name }), }, }) @@ -171,7 +171,7 @@ t.test('access restricted on missing package.json', async t => { t.test('access restricted on invalid package.json', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': '{\n', node_modules: {}, }, @@ -240,7 +240,7 @@ t.test('access grant current cwd', async t => { }, }, }, - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'yargs', }), @@ -406,7 +406,7 @@ t.test('access ls-collaborators on current', async t => { }, }, }, - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'yargs', }), diff --git a/deps/npm/test/lib/commands/completion.js b/deps/npm/test/lib/commands/completion.js index dd571baf793a7f..045054b74ec7b2 100644 --- a/deps/npm/test/lib/commands/completion.js +++ b/deps/npm/test/lib/commands/completion.js @@ -42,7 +42,7 @@ const loadMockCompletionComp = async (t, word, line) => t.test('completion', async t => { t.test('completion completion', async t => { const { outputs, completion, prefix } = await loadMockCompletion(t, { - testdir: { + prefixDir: { '.bashrc': 'aaa', '.zshrc': 'aaa', }, diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js index dee2110ff3c89c..5badab99a1d56e 100644 --- a/deps/npm/test/lib/commands/doctor.js +++ b/deps/npm/test/lib/commands/doctor.js @@ -1,1022 +1,524 @@ const t = require('tap') - -const { join } = require('path') const fs = require('fs') -const ansiTrim = require('../../../lib/utils/ansi-trim.js') -const isWindows = require('../../../lib/utils/is-windows.js') -const { fake: mockNpm } = require('../../fixtures/mock-npm') -// getuid and getgid do not exist in windows, so we shim them -// to return 0, as that is the value that lstat will assign the -// gid and uid properties for fs.Stats objects -if (isWindows) { - process.getuid = () => 0 - process.getgid = () => 0 -} +const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const tnock = require('../../fixtures/tnock.js') +const mockGlobals = require('../../fixtures/mock-globals') +const { cleanCwd, cleanDate } = require('../../fixtures/clean-snapshot.js') -const output = [] +const cleanCacheSha = (str) => + str.replace(/content-v2\/sha512\/[^"]+/g, 'content-v2/sha512/{sha}') -let pingError -const ping = async () => { - if (pingError) { - throw pingError - } -} +t.cleanSnapshot = p => cleanCacheSha(cleanDate(cleanCwd(p))) -let whichError = null -const which = async () => { - if (whichError) { - throw whichError +const npmManifest = (version) => { + return { + name: 'npm', + versions: { + [version]: { + name: 'npm', + version: version, + }, + }, + time: { + [version]: new Date(), + }, + 'dist-tags': { latest: version }, } - return '/path/to/git' } const nodeVersions = [ - { version: 'v14.0.0', lts: false }, - { version: 'v13.0.0', lts: false }, - // it's necessary to allow tests in node 10.x to not mark 12.x as lts - { version: 'v12.0.0', lts: false }, - { version: 'v10.13.0', lts: 'Dubnium' }, + { version: 'v2.0.1', lts: false }, + { version: 'v2.0.0', lts: false }, + { version: 'v1.0.0', lts: 'NpmTestium' }, ] -const fetch = async () => { - return { - json: async () => { - return nodeVersions +const dirs = { + prefixDir: { + node_modules: { + testLink: t.fixture('symlink', './testDir'), + testDir: { + testFile: 'test contents', + }, + '.bin': {}, }, - } -} - -const logs = { - info: [], -} - -const clearLogs = () => { - output.length = 0 - for (const key in logs) { - if (Array.isArray(logs[key])) { - logs[key].length = 0 - } else { - delete logs[key] - } - } -} - -const npm = mockNpm({ - flatOptions: { - registry: 'https://registry.npmjs.org/', - }, - config: { - loglevel: 'info', }, - version: '7.1.0', - output: data => { - output.push(data) + globalPrefixDir: { + bin: {}, + lib: { + node_modules: { + }, + }, }, +} + +let consoleError = false +t.afterEach(() => { + consoleError = false }) -let latestNpm = npm.version -const pacote = { - manifest: async () => { - return { version: latestNpm } +const globals = { + console: { + error: () => { + consoleError = true + }, + }, + process: { + platform: 'test-not-windows', + version: 'v1.0.0', }, } -let verifyResponse = { verifiedCount: 1, verifiedContent: 1 } -const cacache = { - verify: async () => { - return verifyResponse - }, +// getuid and getgid do not exist in windows, so we shim them +// to return 0, as that is the value that lstat will assign the +// gid and uid properties for fs.Stats objects +if (process.platform === 'win32') { + mockGlobals(t, { + process: { + getuid: () => 0, + getgid: () => 0, + }, + }) } const mocks = { - '../../../lib/utils/is-windows.js': false, - '../../../lib/utils/ping.js': ping, - cacache, - pacote, - 'make-fetch-happen': fetch, - which, - 'proc-log': { - info: msg => { - logs.info.push(msg) + '../../package.json': { version: '1.0.0' }, + which: async () => '/path/to/git', + cacache: { + verify: () => { + return { badContentCount: 0, reclaimedCount: 0, missingContent: 0, verifiedContent: 0 } }, }, - npmlog: { - newItem: name => { - logs[name] = {} - return { - info: (_, msg) => { - if (!logs[name].info) { - logs[name].info = [] - } - logs[name].info.push(msg) - }, - warn: (_, msg) => { - if (!logs[name].warn) { - logs[name].warn = [] - } - logs[name].warn.push(msg) - }, - error: (_, msg) => { - if (!logs[name].error) { - logs[name].error = [] - } - logs[name].error.push(msg) - }, - silly: (_, msg) => { - if (!logs[name].silly) { - logs[name].silly = [] - } - logs[name].silly.push(msg) - }, - completeWork: () => {}, - finish: () => { - logs[name].finished = true - }, - } +} + +t.test('all clear', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'output') + t.notOk(consoleError, 'console.error not called') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('all clear in color', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + npm.config.set('color', 'always') + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'everything is ok in color') + t.notOk(consoleError, 'console.error not called') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('silent', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + config: { + loglevel: 'silent', + }, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'output') + t.notOk(consoleError, 'console.error not called') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('ping 404', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(404, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'ping 404') + t.ok(consoleError, 'console.error called') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('ping 404 in color', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(404, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + npm.config.set('color', 'always') + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'ping 404 in color') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('ping exception with code', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').replyWithError({ message: 'Test Error', code: 'TEST' }) + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'ping failure') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('ping exception without code', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').replyWithError({ message: 'Test Error', code: false }) + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'ping failure') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('npm out of date', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest('2.0.0')) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'npm is out of date') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('node out of date - lts', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals: { + ...globals, + process: { + platform: 'test-not-windows', + version: 'v0.0.1', + }, }, - level: 'error', - levels: { - info: 1, - error: 0, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'node is out of date') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('node out of date - current', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals: { + ...globals, + process: { + ...globals.process, + version: 'v2.0.0', + }, }, - }, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'node is out of date') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) -} +t.test('non-default registry', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + config: { registry: 'http://some-other-url.npmjs.org' }, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'non default registry') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) -const Doctor = t.mock('../../../lib/commands/doctor.js', { - ...mocks, +t.test('missing git', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + which: async () => { + throw new Error('test error') + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'missing git') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') }) -const doctor = new Doctor(npm) - -const origVersion = process.version -t.test('node versions', t => { - t.plan(nodeVersions.length) - - nodeVersions.forEach(({ version }) => { - t.test(`${version}:`, vt => { - Object.defineProperty(process, 'version', { value: version }) - vt.teardown(() => { - Object.defineProperty(process, 'version', { value: origVersion }) - }) - - vt.test(`${version}: npm doctor checks ok`, async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - clearLogs() - }) - - await doctor.exec([]) - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor supports silent', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - npm.config.set('loglevel', 'silent') - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - npm.config.set('loglevel', 'info') - clearLogs() - }) - - await doctor.exec([]) - - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.strictSame(output, [], 'did not print output') - }) - - vt.test('npm doctor supports color', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - npm.color = true - pingError = { message: 'generic error' } - const _consoleError = console.error - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - delete npm.color - pingError = null - console.error = _consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping.*not ok/, 'ping output is ok') - st.match(output, /npm -v.*ok/, 'npm -v output is ok') - st.match(output, /node -v.*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry.*ok.*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git.*ok/, 'which git output is ok') - st.match(output, /cached files.*ok/, 'cached files are ok') - st.match(output, /local node_modules.*ok/, 'local node_modules are ok') - st.match(output, /global node_modules.*ok/, 'global node_modules are ok') - st.match(output, /local bin folder.*ok/, 'local bin is ok') - st.match(output, /global bin folder.*ok/, 'global bin is ok') - st.match(output, /cache contents.*ok/, 'cache contents is ok') - st.not(output[0], ansiTrim(output[0]), 'output should contain color codes') - }) - - vt.test('npm doctor skips some tests in windows', async st => { - const WinDoctor = t.mock('../../../lib/commands/doctor.js', { - ...mocks, - '../../../lib/utils/is-windows.js': true, - }) - const winDoctor = new WinDoctor(npm) - - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - clearLogs() - }) - - await winDoctor.exec([]) - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: undefined, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor ping error E{3}', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - pingError = { code: 'E111', message: 'this error is 111' } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - pingError = null - console.error = consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match( - output, - /npm ping\s*not ok\s*111 this error is 111/, - 'ping output contains trimmed error' - ) - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor generic ping error', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - pingError = { message: 'generic error' } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - pingError = null - console.error = consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*not ok\s*generic error/, 'ping output contains trimmed error') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor outdated npm version', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - latestNpm = '7.1.1' - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - latestNpm = npm.version - console.error = consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date npm') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*not ok/, 'npm -v output is not ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor file permission checks', async st => { - const dir = st.testdir({ - cache: { - one: 'one', - link: st.fixture('symlink', './baddir'), - unreadable: 'unreadable', - baddir: {}, - }, - local: { - two: 'two', - notmine: 'notmine', - }, - global: { - three: 'three', - broken: 'broken', - }, - localBin: { - four: 'four', - five: 'five', - }, - globalBin: { - six: 'six', - seven: 'seven', - }, - }) - - const _fsLstat = fs.lstat - fs.lstat = (p, cb) => { - let err = null - let stat = null - - try { - stat = fs.lstatSync(p) - } catch (err) { - return cb(err) - } - - switch (p) { - case join(dir, 'local', 'notmine'): - stat.uid += 1 - stat.gid += 1 - break - case join(dir, 'global', 'broken'): - err = new Error('broken') - break - } - - return cb(err, stat) - } - - const _fsReaddir = fs.readdir - fs.readdir = (p, cb) => { - let err = null - let result = null - - try { - result = fs.readdirSync(p) - } catch (err) { - return cb(err) - } - - if (p === join(dir, 'cache', 'baddir')) { - err = new Error('broken') - } - - return cb(err, result) - } - - const _fsAccess = fs.access - fs.access = (p, mask, cb) => { - const err = new Error('failed') - switch (p) { - case join(dir, 'cache', 'unreadable'): - case join(dir, 'localBin', 'four'): - case join(dir, 'globalBin', 'six'): - return cb(err) - default: - return cb(null) - } - } - - const Doctor = t.mock('../../../lib/commands/doctor.js', { - ...mocks, - fs, - }) - const doctor = new Doctor(npm) - // it's necessary to allow tests in node 10.x to not mark 12.x as lted - - npm.cache = npm.flatOptions.cache = join(dir, 'cache') - npm.localDir = join(dir, 'local') - npm.globalDir = join(dir, 'global') - npm.localBin = join(dir, 'localBin') - npm.globalBin = join(dir, 'globalBin') - const _consoleError = console.error - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - console.error = _consoleError - fs.lstat = _fsLstat - fs.readdir = _fsReaddir - fs.access = _fsAccess - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'identified problems') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [join(dir, 'cache')]: { finished: true }, - [join(dir, 'local')]: { finished: true }, - [join(dir, 'global')]: { finished: true }, - [join(dir, 'localBin')]: { finished: true }, - [join(dir, 'globalBin')]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*not ok/, 'cached files are not ok') - st.match(output, /local node_modules\s*not ok/, 'local node_modules are not ok') - st.match(output, /global node_modules\s*not ok/, 'global node_modules are not ok') - st.match(output, /local bin folder\s*not ok/, 'local bin is not ok') - st.match(output, /global bin folder\s*not ok/, 'global bin is not ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor missing git', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - whichError = new Error('boom') - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - whichError = null - console.error = consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the missing git') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*not ok/, 'which git output is not ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.test('npm doctor cache verification showed bad content', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - badContentCount: 1, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - // cache verification problems get fixed and so do not throw an error - await doctor.exec([]) - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is not ok') - }) - - vt.test('npm doctor cache verification showed reclaimed content', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - reclaimedCount: 1, - reclaimedSize: 100, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - // cache verification problems get fixed and so do not throw an error - await doctor.exec([]) - - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is not ok') - }) - - vt.test('npm doctor cache verification showed missing content', async st => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - missingContent: 1, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - // cache verification problems get fixed and so do not throw an error - await doctor.exec([]) - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is not ok') - }) - - vt.test('npm doctor not using default registry', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _currentRegistry = npm.flatOptions.registry - npm.flatOptions.registry = 'https://google.com' - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - npm.flatOptions.registry = _currentRegistry - console.error = consoleError - clearLogs() - }) - - await st.rejects( - doctor.exec([]), - /Some problems found/, - 'detected the non-default registry' - ) - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*ok/, 'node -v output is ok') - st.match( - output, - /npm config get registry\s*not ok/, - 'npm config get registry output is not ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') - }) - - vt.end() - }) + +t.test('windows skips permissions checks', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals: { + ...globals, + process: { + ...globals.process, + platform: 'win32', + }, + }, + prefixDir: {}, + globalPrefixDir: {}, }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'no permissions checks') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') }) -t.test('outdated node version', vt => { - vt.plan(1) - const version = 'v10.0.0' +t.test('missing global directories', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + prefixDir: dirs.prefixDir, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'missing global directories') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) - Object.defineProperty(process, 'version', { value: version }) - vt.teardown(() => { - Object.defineProperty(process, 'version', { value: origVersion }) +t.test('missing local node_modules', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + globalPrefixDir: dirs.globalPrefixDir, }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'missing local node_modules') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) - vt.test('npm doctor outdated nodejs version', async st => { - const dir = st.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - nodeVersions.push({ version: process.version.replace(/\d+(-.*)?$/, '999'), lts: false }) - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - st.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - nodeVersions.pop() - console.error = consoleError - clearLogs() - }) - - await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date nodejs') - st.match( - logs, - { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, +t.test('incorrect owner', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + fs: { + ...fs, + lstat: (p, cb) => { + const stat = fs.lstatSync(p) + stat.uid += 1 + stat.gid += 1 + return cb(null, stat) + }, }, - 'trackers all finished' - ) - st.match(output, /npm ping\s*ok/, 'ping output is ok') - st.match(output, /npm -v\s*ok/, 'npm -v output is ok') - st.match(output, /node -v\s*not ok/, 'node -v output is not ok') - st.match( - output, - /npm config get registry\s*ok\s*using default/, - 'npm config get registry output is ok' - ) - st.match(output, /which git\s*ok/, 'which git output is ok') - st.match(output, /cached files\s*ok/, 'cached files are ok') - st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - st.match(output, /local bin folder\s*ok/, 'local bin is ok') - st.match(output, /global bin folder\s*ok/, 'global bin is ok') - st.match(output, /cache contents\s*ok/, 'cache contents is ok') + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'incorrect owner') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('incorrect permissions', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + fs: { + ...fs, + access: () => { + throw new Error('Test Error') + }, + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'incorrect owner') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('error reading directory', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + fs: { + ...fs, + readdir: () => { + throw new Error('Test Error') + }, + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'readdir error') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('cacache badContent', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + cacache: { + verify: async () => { + return { badContentCount: 1, reclaimedCount: 0, missingContent: 0, verifiedContent: 2 } + }, + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'corrupted cache content') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('cacache reclaimedCount', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + cacache: { + verify: async () => { + return { badContentCount: 0, reclaimedCount: 1, missingContent: 0, verifiedContent: 2 } + }, + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'content garbage collected') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('cacache missingContent', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks: { + ...mocks, + cacache: { + verify: async () => { + return { badContentCount: 0, reclaimedCount: 0, missingContent: 1, verifiedContent: 2 } + }, + }, + }, + globals, + ...dirs, + }) + tnock(t, npm.config.get('registry')) + .get('/-/ping?write=true').reply(200, '{}') + .get('/npm').reply(200, npmManifest(npm.version)) + tnock(t, 'https://nodejs.org') + .get('/dist/index.json').reply(200, nodeVersions) + await npm.exec('doctor', []) + t.matchSnapshot(joinedOutput(), 'missing content') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') +}) + +t.test('bad proxy', async t => { + const { joinedOutput, logs, npm } = await loadMockNpm(t, { + mocks, + globals, + config: { + proxy: 'ssh://npmjs.org', + }, + ...dirs, }) + await t.rejects(npm.exec('doctor', [])) + t.matchSnapshot(joinedOutput(), 'output') + t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs') }) diff --git a/deps/npm/test/lib/commands/pack.js b/deps/npm/test/lib/commands/pack.js index 51453dae9b017d..f287d93dc75365 100644 --- a/deps/npm/test/lib/commands/pack.js +++ b/deps/npm/test/lib/commands/pack.js @@ -10,7 +10,7 @@ t.afterEach(t => { t.test('should pack current directory with no arguments', async t => { const { npm, outputs, logs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'test-package', version: '1.0.0', @@ -27,7 +27,7 @@ t.test('should pack current directory with no arguments', async t => { t.test('follows pack-destination config', async t => { const { npm, outputs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'test-package', version: '1.0.0', @@ -45,7 +45,7 @@ t.test('follows pack-destination config', async t => { t.test('should pack given directory for scoped package', async t => { const { npm, outputs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: '@npm/test-package', version: '1.0.0', @@ -61,7 +61,7 @@ t.test('should pack given directory for scoped package', async t => { t.test('should log output as valid json', async t => { const { npm, outputs, logs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'test-package', version: '1.0.0', @@ -79,7 +79,7 @@ t.test('should log output as valid json', async t => { t.test('dry run', async t => { const { npm, outputs, logs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'test-package', version: '1.0.0', @@ -97,7 +97,7 @@ t.test('dry run', async t => { t.test('invalid packument', async t => { const { npm, outputs } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': '{}', }, }) @@ -111,7 +111,7 @@ t.test('invalid packument', async t => { t.test('workspaces', async t => { const loadWorkspaces = (t) => loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify( { name: 'workspaces-test', diff --git a/deps/npm/test/lib/commands/repo.js b/deps/npm/test/lib/commands/repo.js index 93eb6d0311e1cf..e06a2894417bc2 100644 --- a/deps/npm/test/lib/commands/repo.js +++ b/deps/npm/test/lib/commands/repo.js @@ -188,10 +188,10 @@ const openUrl = async (npm, url, errMsg) => { } t.afterEach(() => opened = {}) -const loadMockNpm = async (t, prefix) => { +const loadMockNpm = async (t, prefixDir) => { const res = await _loadMockNpm(t, { mocks: { '../../lib/utils/open-url.js': openUrl }, - testdir: prefix, + prefixDir, }) return res } diff --git a/deps/npm/test/lib/commands/restart.js b/deps/npm/test/lib/commands/restart.js index 7730f1a3011f69..83773eae9543b3 100644 --- a/deps/npm/test/lib/commands/restart.js +++ b/deps/npm/test/lib/commands/restart.js @@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js') t.test('should run restart script from package.json', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'x', version: '1.2.3', diff --git a/deps/npm/test/lib/commands/shrinkwrap.js b/deps/npm/test/lib/commands/shrinkwrap.js index 2b9e46c70c98e0..e3fc1f9356705e 100644 --- a/deps/npm/test/lib/commands/shrinkwrap.js +++ b/deps/npm/test/lib/commands/shrinkwrap.js @@ -19,14 +19,14 @@ t.formatSnapshot = obj => 2 ) -// Run shrinkwrap against a specified testdir with config items +// Run shrinkwrap against a specified prefixDir with config items // and make some assertions that should always be true. Sets // the results on t.context for use in child tests -const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => { +const shrinkwrap = async (t, prefixDir = {}, config = {}, mocks = {}) => { const { npm, logs } = await loadMockNpm(t, { mocks, config, - testdir, + prefixDir, }) await npm.exec('shrinkwrap', []) @@ -38,7 +38,7 @@ const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => { t.same(logs.warn, [], 'no warnings') t.teardown(() => delete t.context) t.context = { - localPrefix: testdir, + localPrefix: prefixDir, config, shrinkwrap: JSON.parse(fs.readFileSync(newFile)), logs: logs.notice.map(([, m]) => m), diff --git a/deps/npm/test/lib/commands/start.js b/deps/npm/test/lib/commands/start.js index 4f7dc366dbc196..c9312c8e2adc7d 100644 --- a/deps/npm/test/lib/commands/start.js +++ b/deps/npm/test/lib/commands/start.js @@ -15,7 +15,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js') t.test('should run start script from package.json', async t => { t.plan(2) const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'x', version: '1.2.3', diff --git a/deps/npm/test/lib/commands/stop.js b/deps/npm/test/lib/commands/stop.js index 53d057b711306e..f5db4a047d3f7b 100644 --- a/deps/npm/test/lib/commands/stop.js +++ b/deps/npm/test/lib/commands/stop.js @@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js') t.test('should run stop script from package.json', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'x', version: '1.2.3', diff --git a/deps/npm/test/lib/commands/test.js b/deps/npm/test/lib/commands/test.js index a3dbd3ff4cffb7..665df7148a0e5c 100644 --- a/deps/npm/test/lib/commands/test.js +++ b/deps/npm/test/lib/commands/test.js @@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js') t.test('should run test script from package.json', async t => { const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { 'package.json': JSON.stringify({ name: 'x', version: '1.2.3', diff --git a/deps/npm/test/lib/commands/view.js b/deps/npm/test/lib/commands/view.js index 035490a79fbf7d..82be1201ee1699 100644 --- a/deps/npm/test/lib/commands/view.js +++ b/deps/npm/test/lib/commands/view.js @@ -32,12 +32,15 @@ const packument = (nv, opts) => { const mocks = { red: { + _id: 'red@1.0.1', name: 'red', 'dist-tags': { '1.0.1': {}, }, time: { - unpublished: new Date(), + unpublished: { + time: '2012-12-20T00:00:00.000Z', + }, }, }, blue: { @@ -262,6 +265,9 @@ const packument = (nv, opts) => { if (nv.type === 'git') { return mocks[nv.hosted.project] } + if (nv.raw === './blue') { + return mocks.blue + } return mocks[nv.name] } @@ -387,6 +393,11 @@ t.test('should log info of package in current working dir', async t => { await view.exec(['.']) t.matchSnapshot(logs) }) + + t.test('directory', async t => { + await view.exec(['./blue']) + t.matchSnapshot(logs) + }) }) t.test('should log info by field name', async t => { @@ -533,7 +544,7 @@ t.test('throws when unpublished', async t => { const view = new View(npm) await t.rejects( view.exec(['red']), - { code: 'E404' } + { code: 'E404', pkgid: 'red@1.0.1', message: 'Unpublished on 2012-12-20T00:00:00.000Z' } ) }) diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index b2eedde72bc9d0..3ae2af35c287d5 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -77,7 +77,7 @@ t.test('npm.load', async t => { t.test('basic loading', async t => { const { npm, logs, prefix: dir, cache } = await loadMockNpm(t, { - testdir: { node_modules: {} }, + prefixDir: { node_modules: {} }, }) t.equal(npm.loaded, true) @@ -165,7 +165,7 @@ t.test('npm.load', async t => { ], }) const { npm, logs, outputs, prefix } = await loadMockNpm(t, { - testdir: { + prefixDir: { bin: t.fixture('symlink', dirname(process.execPath)), }, globals: ({ prefix }) => ({ @@ -237,7 +237,7 @@ t.test('npm.load', async t => { }) const { npm } = await loadMockNpm(t, { load: false, - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ @@ -270,7 +270,7 @@ t.test('npm.load', async t => { ], }) const { npm, outputs } = await loadMockNpm(t, { - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ @@ -329,7 +329,7 @@ t.test('npm.load', async t => { ], }) const { npm } = await loadMockNpm(t, { - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ @@ -531,7 +531,7 @@ t.test('explicit workspace rejection', async t => { ], }) const mock = await loadMockNpm(t, { - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ @@ -556,7 +556,7 @@ t.test('explicit workspace rejection', async t => { t.test('implicit workspace rejection', async t => { const mock = await loadMockNpm(t, { - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ @@ -590,7 +590,7 @@ t.test('implicit workspace rejection', async t => { t.test('implicit workspace accept', async t => { const mock = await loadMockNpm(t, { - testdir: { + prefixDir: { packages: { a: { 'package.json': JSON.stringify({ diff --git a/deps/npm/test/lib/utils/error-message.js b/deps/npm/test/lib/utils/error-message.js index ddc88c1d990b09..3fec501ef9ff76 100644 --- a/deps/npm/test/lib/utils/error-message.js +++ b/deps/npm/test/lib/utils/error-message.js @@ -16,10 +16,10 @@ mockGlobals(t, { }, }) -const loadMockNpm = async (t, { load, command, testdir, config } = {}) => { +const loadMockNpm = async (t, { load, command, prefixDir, config } = {}) => { const { npm, ...rest } = await _loadMockNpm(t, { load, - testdir, + prefixDir, config, mocks: { '../../package.json': { @@ -210,7 +210,7 @@ t.test('json parse', t => { mockGlobals(t, { 'process.argv': ['arg', 'v'] }) t.test('merge conflict in package.json', async t => { - const testdir = { + const prefixDir = { 'package.json': ` { "array": [ @@ -250,7 +250,7 @@ t.test('json parse', t => { } `, } - const npm = await loadMockNpm(t, { testdir }) + const npm = await loadMockNpm(t, { prefixDir }) t.matchSnapshot(errorMessage(Object.assign(new Error('conflicted'), { code: 'EJSONPARSE', path: path.resolve(npm.prefix, 'package.json'), @@ -259,10 +259,10 @@ t.test('json parse', t => { }) t.test('just regular bad json in package.json', async t => { - const testdir = { + const prefixDir = { 'package.json': 'not even slightly json', } - const npm = await loadMockNpm(t, { testdir }) + const npm = await loadMockNpm(t, { prefixDir }) t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), { code: 'EJSONPARSE', path: path.resolve(npm.prefix, 'package.json'), @@ -271,10 +271,10 @@ t.test('json parse', t => { }) t.test('json somewhere else', async t => { - const testdir = { + const prefixDir = { 'blerg.json': 'not even slightly json', } - const npm = await loadMockNpm(t, { testdir }) + const npm = await loadMockNpm(t, { prefixDir }) t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), { code: 'EJSONPARSE', path: path.resolve(npm.prefix, 'blerg.json'),