From fd91eaab349a2d421dd852e1fbb1995b3f3e6476 Mon Sep 17 00:00:00 2001 From: npm CLI robot Date: Thu, 16 May 2024 05:38:49 -0700 Subject: [PATCH] deps: upgrade npm to 10.8.0 PR-URL: https://github.com/nodejs/node/pull/53014 Reviewed-By: Luke Karrys Reviewed-By: Luigi Pinca Reviewed-By: Marco Ippolito Reviewed-By: Trivikram Kamat --- deps/npm/docs/content/commands/npm-ls.md | 2 +- deps/npm/docs/content/commands/npm.md | 2 +- .../content/configuring-npm/package-json.md | 22 +- deps/npm/docs/content/using-npm/config.md | 2 +- deps/npm/docs/content/using-npm/removal.md | 6 +- deps/npm/docs/lib/index.js | 2 +- deps/npm/docs/output/commands/npm-access.html | 10 +- .../npm/docs/output/commands/npm-adduser.html | 10 +- deps/npm/docs/output/commands/npm-audit.html | 10 +- deps/npm/docs/output/commands/npm-bugs.html | 10 +- deps/npm/docs/output/commands/npm-cache.html | 10 +- deps/npm/docs/output/commands/npm-ci.html | 10 +- .../docs/output/commands/npm-completion.html | 10 +- deps/npm/docs/output/commands/npm-config.html | 10 +- deps/npm/docs/output/commands/npm-dedupe.html | 10 +- .../docs/output/commands/npm-deprecate.html | 10 +- deps/npm/docs/output/commands/npm-diff.html | 10 +- .../docs/output/commands/npm-dist-tag.html | 10 +- deps/npm/docs/output/commands/npm-docs.html | 10 +- deps/npm/docs/output/commands/npm-doctor.html | 10 +- deps/npm/docs/output/commands/npm-edit.html | 10 +- deps/npm/docs/output/commands/npm-exec.html | 10 +- .../npm/docs/output/commands/npm-explain.html | 10 +- .../npm/docs/output/commands/npm-explore.html | 10 +- .../docs/output/commands/npm-find-dupes.html | 10 +- deps/npm/docs/output/commands/npm-fund.html | 10 +- .../docs/output/commands/npm-help-search.html | 10 +- deps/npm/docs/output/commands/npm-help.html | 10 +- deps/npm/docs/output/commands/npm-hook.html | 10 +- deps/npm/docs/output/commands/npm-init.html | 10 +- .../output/commands/npm-install-ci-test.html | 10 +- .../output/commands/npm-install-test.html | 10 +- .../npm/docs/output/commands/npm-install.html | 10 +- deps/npm/docs/output/commands/npm-link.html | 10 +- deps/npm/docs/output/commands/npm-login.html | 10 +- deps/npm/docs/output/commands/npm-logout.html | 10 +- deps/npm/docs/output/commands/npm-ls.html | 12 +- deps/npm/docs/output/commands/npm-org.html | 10 +- .../docs/output/commands/npm-outdated.html | 10 +- deps/npm/docs/output/commands/npm-owner.html | 10 +- deps/npm/docs/output/commands/npm-pack.html | 10 +- deps/npm/docs/output/commands/npm-ping.html | 10 +- deps/npm/docs/output/commands/npm-pkg.html | 10 +- deps/npm/docs/output/commands/npm-prefix.html | 10 +- .../npm/docs/output/commands/npm-profile.html | 10 +- deps/npm/docs/output/commands/npm-prune.html | 10 +- .../npm/docs/output/commands/npm-publish.html | 10 +- deps/npm/docs/output/commands/npm-query.html | 10 +- .../npm/docs/output/commands/npm-rebuild.html | 10 +- deps/npm/docs/output/commands/npm-repo.html | 10 +- .../npm/docs/output/commands/npm-restart.html | 10 +- deps/npm/docs/output/commands/npm-root.html | 10 +- .../docs/output/commands/npm-run-script.html | 10 +- deps/npm/docs/output/commands/npm-sbom.html | 10 +- deps/npm/docs/output/commands/npm-search.html | 10 +- .../docs/output/commands/npm-shrinkwrap.html | 10 +- deps/npm/docs/output/commands/npm-star.html | 10 +- deps/npm/docs/output/commands/npm-stars.html | 10 +- deps/npm/docs/output/commands/npm-start.html | 10 +- deps/npm/docs/output/commands/npm-stop.html | 10 +- deps/npm/docs/output/commands/npm-team.html | 10 +- deps/npm/docs/output/commands/npm-test.html | 10 +- deps/npm/docs/output/commands/npm-token.html | 10 +- .../docs/output/commands/npm-uninstall.html | 10 +- .../docs/output/commands/npm-unpublish.html | 10 +- deps/npm/docs/output/commands/npm-unstar.html | 10 +- deps/npm/docs/output/commands/npm-update.html | 10 +- .../npm/docs/output/commands/npm-version.html | 10 +- deps/npm/docs/output/commands/npm-view.html | 10 +- deps/npm/docs/output/commands/npm-whoami.html | 10 +- deps/npm/docs/output/commands/npm.html | 12 +- deps/npm/docs/output/commands/npx.html | 10 +- .../docs/output/configuring-npm/folders.html | 10 +- .../docs/output/configuring-npm/install.html | 10 +- .../output/configuring-npm/npm-global.html | 330 +++++ .../docs/output/configuring-npm/npm-json.html | 1080 +++++++++++++++++ .../configuring-npm/npm-shrinkwrap-json.html | 10 +- .../docs/output/configuring-npm/npmrc.html | 10 +- .../output/configuring-npm/package-json.html | 31 +- .../configuring-npm/package-lock-json.html | 10 +- deps/npm/docs/output/using-npm/config.html | 12 +- .../using-npm/dependency-selectors.html | 10 +- .../npm/docs/output/using-npm/developers.html | 10 +- deps/npm/docs/output/using-npm/logging.html | 10 +- deps/npm/docs/output/using-npm/orgs.html | 10 +- .../docs/output/using-npm/package-spec.html | 10 +- deps/npm/docs/output/using-npm/registry.html | 10 +- deps/npm/docs/output/using-npm/removal.html | 14 +- deps/npm/docs/output/using-npm/scope.html | 10 +- deps/npm/docs/output/using-npm/scripts.html | 10 +- .../npm/docs/output/using-npm/workspaces.html | 10 +- deps/npm/lib/base-cmd.js | 29 +- deps/npm/lib/cli/entry.js | 22 +- deps/npm/lib/cli/exit-handler.js | 263 ++-- deps/npm/lib/commands/access.js | 2 +- deps/npm/lib/commands/audit.js | 2 +- deps/npm/lib/commands/cache.js | 2 +- deps/npm/lib/commands/config.js | 81 +- deps/npm/lib/commands/deprecate.js | 5 +- deps/npm/lib/commands/dist-tag.js | 2 +- deps/npm/lib/commands/fund.js | 3 +- deps/npm/lib/commands/help.js | 10 +- deps/npm/lib/commands/hook.js | 2 +- deps/npm/lib/commands/ls.js | 2 +- deps/npm/lib/commands/org.js | 2 +- deps/npm/lib/commands/owner.js | 2 +- deps/npm/lib/commands/pack.js | 18 +- deps/npm/lib/commands/pkg.js | 74 +- deps/npm/lib/commands/profile.js | 24 +- deps/npm/lib/commands/publish.js | 95 +- deps/npm/lib/commands/run-script.js | 206 ++-- deps/npm/lib/commands/team.js | 2 +- deps/npm/lib/commands/token.js | 12 +- deps/npm/lib/commands/unpublish.js | 2 +- deps/npm/lib/commands/view.js | 449 ++++--- deps/npm/lib/npm.js | 226 ++-- deps/npm/lib/package-url-cmd.js | 2 +- deps/npm/lib/utils/auth.js | 63 +- deps/npm/lib/utils/did-you-mean.js | 49 +- deps/npm/lib/utils/display.js | 91 +- deps/npm/lib/utils/error-message.js | 459 +++---- deps/npm/lib/utils/log-file.js | 6 +- deps/npm/lib/utils/open-url-prompt.js | 66 - deps/npm/lib/utils/open-url.js | 108 +- deps/npm/lib/utils/otplease.js | 46 - deps/npm/lib/utils/output-error.js | 29 + deps/npm/lib/utils/queryable.js | 14 +- deps/npm/lib/utils/read-user-info.js | 12 +- deps/npm/lib/utils/tar.js | 9 +- deps/npm/lib/utils/web-auth.js | 20 - deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-audit.1 | 2 +- deps/npm/man/man1/npm-bugs.1 | 2 +- deps/npm/man/man1/npm-cache.1 | 2 +- deps/npm/man/man1/npm-ci.1 | 2 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 2 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-diff.1 | 2 +- deps/npm/man/man1/npm-dist-tag.1 | 2 +- deps/npm/man/man1/npm-docs.1 | 2 +- deps/npm/man/man1/npm-doctor.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-exec.1 | 2 +- deps/npm/man/man1/npm-explain.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-find-dupes.1 | 2 +- deps/npm/man/man1/npm-fund.1 | 2 +- deps/npm/man/man1/npm-help-search.1 | 2 +- deps/npm/man/man1/npm-help.1 | 2 +- deps/npm/man/man1/npm-hook.1 | 2 +- deps/npm/man/man1/npm-init.1 | 2 +- deps/npm/man/man1/npm-install-ci-test.1 | 2 +- deps/npm/man/man1/npm-install-test.1 | 2 +- deps/npm/man/man1/npm-install.1 | 2 +- deps/npm/man/man1/npm-link.1 | 2 +- deps/npm/man/man1/npm-login.1 | 2 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 4 +- deps/npm/man/man1/npm-org.1 | 2 +- deps/npm/man/man1/npm-outdated.1 | 2 +- deps/npm/man/man1/npm-owner.1 | 2 +- deps/npm/man/man1/npm-pack.1 | 2 +- deps/npm/man/man1/npm-ping.1 | 2 +- deps/npm/man/man1/npm-pkg.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 2 +- deps/npm/man/man1/npm-profile.1 | 2 +- deps/npm/man/man1/npm-prune.1 | 2 +- deps/npm/man/man1/npm-publish.1 | 2 +- deps/npm/man/man1/npm-query.1 | 2 +- deps/npm/man/man1/npm-rebuild.1 | 2 +- deps/npm/man/man1/npm-repo.1 | 2 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 2 +- deps/npm/man/man1/npm-sbom.1 | 2 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-shrinkwrap.1 | 2 +- deps/npm/man/man1/npm-star.1 | 2 +- deps/npm/man/man1/npm-stars.1 | 2 +- deps/npm/man/man1/npm-start.1 | 2 +- deps/npm/man/man1/npm-stop.1 | 2 +- deps/npm/man/man1/npm-team.1 | 2 +- deps/npm/man/man1/npm-test.1 | 2 +- deps/npm/man/man1/npm-token.1 | 2 +- deps/npm/man/man1/npm-uninstall.1 | 2 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-unstar.1 | 2 +- deps/npm/man/man1/npm-update.1 | 2 +- deps/npm/man/man1/npm-version.1 | 2 +- deps/npm/man/man1/npm-view.1 | 2 +- deps/npm/man/man1/npm-whoami.1 | 2 +- deps/npm/man/man1/npm.1 | 4 +- deps/npm/man/man1/npx.1 | 2 +- deps/npm/man/man5/folders.5 | 2 +- deps/npm/man/man5/install.5 | 2 +- deps/npm/man/man5/npm-global.5 | 2 +- deps/npm/man/man5/npm-json.5 | 14 +- deps/npm/man/man5/npm-shrinkwrap-json.5 | 2 +- deps/npm/man/man5/npmrc.5 | 2 +- deps/npm/man/man5/package-json.5 | 14 +- deps/npm/man/man5/package-lock-json.5 | 2 +- deps/npm/man/man7/config.7 | 4 +- deps/npm/man/man7/dependency-selectors.7 | 2 +- deps/npm/man/man7/developers.7 | 2 +- deps/npm/man/man7/logging.7 | 2 +- deps/npm/man/man7/orgs.7 | 2 +- deps/npm/man/man7/package-spec.7 | 2 +- deps/npm/man/man7/registry.7 | 2 +- deps/npm/man/man7/removal.7 | 10 +- deps/npm/man/man7/scope.7 | 2 +- deps/npm/man/man7/scripts.7 | 2 +- deps/npm/man/man7/workspaces.7 | 2 +- .../arborist/lib/arborist/build-ideal-tree.js | 60 +- .../@npmcli/arborist/lib/arborist/index.js | 4 +- .../node_modules/@npmcli/arborist/lib/node.js | 2 + .../@npmcli/arborist/lib/packument-cache.js | 77 ++ .../@npmcli/arborist/lib/shrinkwrap.js | 3 +- .../@npmcli/arborist/package.json | 29 +- .../config/lib/definitions/definitions.js | 7 +- .../node_modules/@npmcli/config/lib/index.js | 6 +- .../node_modules/@npmcli/config/package.json | 8 +- deps/npm/node_modules/@npmcli/fs/package.json | 10 +- .../node_modules/@npmcli/git/lib/errors.js | 6 +- .../npm/node_modules/@npmcli/git/package.json | 8 +- .../@npmcli/metavuln-calculator/lib/index.js | 2 +- .../@npmcli/metavuln-calculator/package.json | 8 +- .../@npmcli/promise-spawn/lib/index.js | 77 +- .../@npmcli/promise-spawn/package.json | 8 +- .../dist/__generated__/sigstore_trustroot.js | 5 +- .../@sigstore/protobuf-specs/package.json | 2 +- .../@sigstore/sign/dist/external/error.js | 44 +- .../@sigstore/sign/dist/external/fetch.js | 99 ++ .../@sigstore/sign/dist/external/fulcio.js | 30 +- .../@sigstore/sign/dist/external/rekor.js | 77 +- .../@sigstore/sign/dist/external/tsa.js | 27 +- .../node_modules/@sigstore/sign/package.json | 11 +- .../node_modules/@sigstore/tuf/package.json | 6 +- .../node_modules/@tufjs/models/package.json | 4 +- .../node_modules/bin-links/lib/shim-bin.js | 2 +- deps/npm/node_modules/bin-links/package.json | 10 +- deps/npm/node_modules/builtins/License | 20 - deps/npm/node_modules/builtins/index.js | 80 -- deps/npm/node_modules/builtins/package.json | 19 - .../node_modules/cacache/lib/content/read.js | 2 +- .../node_modules/cacache/lib/content/write.js | 2 +- .../node_modules/cacache/lib/entry-index.js | 2 +- deps/npm/node_modules/cacache/lib/verify.js | 6 +- deps/npm/node_modules/cacache/package.json | 8 +- deps/npm/node_modules/cmd-shim/lib/index.js | 2 +- deps/npm/node_modules/cmd-shim/package.json | 10 +- .../node_modules/glob/dist/commonjs/glob.js | 4 +- .../glob/dist/commonjs/glob.js.map | 2 +- deps/npm/node_modules/glob/dist/esm/glob.js | 2 +- .../node_modules/glob/dist/esm/glob.js.map | 2 +- deps/npm/node_modules/glob/package.json | 6 +- .../node_modules/hosted-git-info/lib/hosts.js | 2 +- .../node_modules/hosted-git-info/package.json | 18 +- .../npm/node_modules/ignore-walk/lib/index.js | 4 +- .../npm/node_modules/ignore-walk/package.json | 10 +- .../lib/init-package-json.js | 3 + .../init-package-json/package.json | 11 +- .../lib/index.js | 4 +- .../package.json | 8 +- .../node_modules/libnpmaccess/package.json | 8 +- deps/npm/node_modules/libnpmdiff/package.json | 10 +- deps/npm/node_modules/libnpmexec/package.json | 12 +- deps/npm/node_modules/libnpmfund/package.json | 8 +- deps/npm/node_modules/libnpmhook/package.json | 8 +- deps/npm/node_modules/libnpmorg/package.json | 10 +- deps/npm/node_modules/libnpmpack/package.json | 10 +- .../node_modules/libnpmpublish/package.json | 12 +- .../node_modules/libnpmsearch/package.json | 8 +- deps/npm/node_modules/libnpmteam/package.json | 8 +- .../node_modules/libnpmversion/package.json | 10 +- .../node_modules/minipass-fetch/lib/body.js | 2 +- .../node_modules/minipass-fetch/lib/index.js | 2 +- .../node_modules/minipass-fetch/package.json | 10 +- .../minipass/dist/commonjs/index.js | 18 +- .../node_modules/minipass/dist/esm/index.js | 6 +- deps/npm/node_modules/minipass/package.json | 4 +- deps/npm/node_modules/nopt/lib/debug.js | 1 + deps/npm/node_modules/nopt/package.json | 10 +- .../normalize-package-data/lib/fixer.js | 4 +- .../normalize-package-data/lib/normalize.js | 2 +- .../normalize-package-data/package.json | 18 +- .../npm/node_modules/npm-bundled/lib/index.js | 2 +- .../npm/node_modules/npm-bundled/package.json | 13 +- .../npm-pick-manifest/lib/index.js | 4 +- .../npm-pick-manifest/package.json | 18 +- .../npm/node_modules/npm-profile/lib/index.js | 328 +++-- .../npm/node_modules/npm-profile/package.json | 6 +- .../npm-registry-fetch/lib/errors.js | 26 +- .../npm-registry-fetch/package.json | 2 +- .../npm-user-validate/package.json | 11 +- .../pacote/{lib/bin.js => bin/index.js} | 0 deps/npm/node_modules/pacote/lib/dir.js | 23 +- deps/npm/node_modules/pacote/lib/fetcher.js | 93 +- deps/npm/node_modules/pacote/lib/file.js | 21 +- deps/npm/node_modules/pacote/lib/git.js | 108 +- deps/npm/node_modules/pacote/lib/index.js | 10 +- deps/npm/node_modules/pacote/lib/registry.js | 45 +- deps/npm/node_modules/pacote/lib/remote.js | 16 +- .../node_modules/pacote/lib/util/cache-dir.js | 8 +- .../node_modules/pacote/lib/util/protected.js | 5 + deps/npm/node_modules/pacote/package.json | 10 +- .../path-scurry/dist/commonjs/index.js | 124 +- .../path-scurry/dist/esm/index.js | 114 +- .../npm/node_modules/path-scurry/package.json | 16 +- deps/npm/node_modules/promzard/lib/index.js | 1 + deps/npm/node_modules/promzard/package.json | 8 +- deps/npm/node_modules/semver/README.md | 75 +- deps/npm/node_modules/semver/bin/semver.js | 19 +- deps/npm/node_modules/semver/classes/range.js | 7 +- .../npm/node_modules/semver/classes/semver.js | 2 +- .../node_modules/semver/internal/lrucache.js | 40 + .../semver/node_modules/lru-cache/LICENSE | 15 - .../semver/node_modules/lru-cache/index.js | 334 ----- .../node_modules/lru-cache/package.json | 34 - deps/npm/node_modules/semver/package.json | 15 +- deps/npm/node_modules/ssri/lib/index.js | 2 +- deps/npm/node_modules/ssri/package.json | 10 +- deps/npm/node_modules/tuf-js/package.json | 8 +- .../validate-npm-package-name/lib/index.js | 10 +- .../validate-npm-package-name/package.json | 19 +- deps/npm/package.json | 72 +- .../test/lib/cli/exit-handler.js.test.cjs | 40 +- .../test/lib/commands/config.js.test.cjs | 12 +- .../test/lib/commands/doctor.js.test.cjs | 62 +- .../test/lib/commands/run-script.js.test.cjs | 274 +++++ .../test/lib/commands/shrinkwrap.js.test.cjs | 22 +- .../test/lib/commands/view.js.test.cjs | 19 + .../tap-snapshots/test/lib/docs.js.test.cjs | 2 +- .../test/lib/utils/error-message.js.test.cjs | 54 +- .../lib/utils/open-url-prompt.js.test.cjs | 22 - .../test/lib/utils/open-url.js.test.cjs | 32 +- deps/npm/test/fixtures/mock-npm.js | 17 - deps/npm/test/lib/cli/entry.js | 33 +- deps/npm/test/lib/cli/exit-handler.js | 327 +++-- deps/npm/test/lib/commands/adduser.js | 4 +- deps/npm/test/lib/commands/audit.js | 1 + deps/npm/test/lib/commands/bugs.js | 2 +- deps/npm/test/lib/commands/config.js | 35 +- deps/npm/test/lib/commands/deprecate.js | 3 +- deps/npm/test/lib/commands/docs.js | 2 +- deps/npm/test/lib/commands/doctor.js | 2 +- deps/npm/test/lib/commands/pack.js | 5 +- deps/npm/test/lib/commands/pkg.js | 137 ++- deps/npm/test/lib/commands/publish.js | 20 +- deps/npm/test/lib/commands/repo.js | 8 +- deps/npm/test/lib/commands/run-script.js | 256 +--- deps/npm/test/lib/commands/view.js | 39 + deps/npm/test/lib/npm.js | 8 + .../test/lib/utils/{otplease.js => auth.js} | 31 +- deps/npm/test/lib/utils/did-you-mean.js | 43 +- deps/npm/test/lib/utils/error-message.js | 17 +- deps/npm/test/lib/utils/open-url-prompt.js | 156 --- deps/npm/test/lib/utils/open-url.js | 352 ++++-- deps/npm/test/lib/utils/web-auth.js | 33 - 361 files changed, 5870 insertions(+), 3940 deletions(-) create mode 100644 deps/npm/docs/output/configuring-npm/npm-global.html create mode 100644 deps/npm/docs/output/configuring-npm/npm-json.html delete mode 100644 deps/npm/lib/utils/open-url-prompt.js delete mode 100644 deps/npm/lib/utils/otplease.js create mode 100644 deps/npm/lib/utils/output-error.js delete mode 100644 deps/npm/lib/utils/web-auth.js create mode 100644 deps/npm/node_modules/@npmcli/arborist/lib/packument-cache.js create mode 100644 deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js delete mode 100644 deps/npm/node_modules/builtins/License delete mode 100644 deps/npm/node_modules/builtins/index.js delete mode 100644 deps/npm/node_modules/builtins/package.json rename deps/npm/node_modules/pacote/{lib/bin.js => bin/index.js} (100%) create mode 100644 deps/npm/node_modules/pacote/lib/util/protected.js create mode 100644 deps/npm/node_modules/semver/internal/lrucache.js delete mode 100644 deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE delete mode 100644 deps/npm/node_modules/semver/node_modules/lru-cache/index.js delete mode 100644 deps/npm/node_modules/semver/node_modules/lru-cache/package.json create mode 100644 deps/npm/tap-snapshots/test/lib/commands/run-script.js.test.cjs delete mode 100644 deps/npm/tap-snapshots/test/lib/utils/open-url-prompt.js.test.cjs rename deps/npm/test/lib/utils/{otplease.js => auth.js} (87%) delete mode 100644 deps/npm/test/lib/utils/open-url-prompt.js delete mode 100644 deps/npm/test/lib/utils/web-auth.js diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md index 89a4bd3604ce40..580e559ebd737c 100644 --- a/deps/npm/docs/content/commands/npm-ls.md +++ b/deps/npm/docs/content/commands/npm-ls.md @@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For example, running `npm ls promzard` in npm's source tree will show: ```bash -npm@10.7.0 /path/to/npm +npm@10.8.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 ``` diff --git a/deps/npm/docs/content/commands/npm.md b/deps/npm/docs/content/commands/npm.md index eb9a779cfdee9d..ac3041cfcfdf48 100644 --- a/deps/npm/docs/content/commands/npm.md +++ b/deps/npm/docs/content/commands/npm.md @@ -14,7 +14,7 @@ Note: This command is unaware of workspaces. ### Version -10.7.0 +10.8.0 ### Description diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index 43037477491e35..099be58239b247 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -368,7 +368,7 @@ For example, myapp could have this: ```json { "bin": { - "myapp": "./cli.js" + "myapp": "bin/cli.js" } } ``` @@ -385,7 +385,7 @@ package, then you can just supply it as a string. For example: { "name": "my-program", "version": "1.2.5", - "bin": "./path/to/program" + "bin": "path/to/program" } ``` @@ -396,7 +396,7 @@ would be the same as this: "name": "my-program", "version": "1.2.5", "bin": { - "my-program": "./path/to/program" + "my-program": "path/to/program" } } ``` @@ -497,7 +497,7 @@ walking the folder. ### repository Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on GitHub, then the `npm docs` +want to contribute. If the git repo is on GitHub, then the `npm repo` command will be able to find you. Do it like this: @@ -818,11 +818,12 @@ to express this. If you depend on features introduced in 1.5.2, use ### peerDependenciesMeta -When a user installs your package, npm will emit warnings if packages -specified in `peerDependencies` are not already installed. The -`peerDependenciesMeta` field serves to provide npm more information on how +The `peerDependenciesMeta` field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer -dependencies to be marked as optional. +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed. For example: @@ -842,11 +843,6 @@ For example: } ``` -Marking a peer dependency as optional ensures npm will not emit a warning -if the `soy-milk` package is not installed on the host. This allows you to -integrate and interact with a variety of host packages without requiring -all of them to be installed. - ### bundleDependencies This defines an array of package names that will be bundled when publishing diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index 7158ee304ba46c..622b84b44210a5 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -1217,7 +1217,7 @@ a semver. Like the `rc` in `1.2.0-rc.8`. * Type: Boolean When set to `true`, npm will display a progress bar during time intensive -operations, if `process.stderr` is a TTY. +operations, if `process.stderr` and `process.stdout` are a TTY. Set to `false` to suppress the progress bar. diff --git a/deps/npm/docs/content/using-npm/removal.md b/deps/npm/docs/content/using-npm/removal.md index 25dbb80baa7a95..3b94a7d18f9d7c 100644 --- a/deps/npm/docs/content/using-npm/removal.md +++ b/deps/npm/docs/content/using-npm/removal.md @@ -12,11 +12,7 @@ So sad to see you go. sudo npm uninstall npm -g ``` -Or, if that fails, get the npm source code, and do: - -```bash -sudo make uninstall -``` +Or, if that fails, please proceed to more severe uninstalling methods. ### More Severe Uninstalling diff --git a/deps/npm/docs/lib/index.js b/deps/npm/docs/lib/index.js index 5f8501ead27b83..b88d20cca35585 100644 --- a/deps/npm/docs/lib/index.js +++ b/deps/npm/docs/lib/index.js @@ -157,7 +157,7 @@ const replaceHelpLinks = (src) => { const transformMan = (src, { data, unified, remarkParse, remarkMan }) => unified() .use(remarkParse) - .use(remarkMan) + .use(remarkMan, { version: `NPM@${version}` }) .processSync(`# ${data.title}(${data.section}) - ${data.description}\n\n${src}`) .toString() diff --git a/deps/npm/docs/output/commands/npm-access.html b/deps/npm/docs/output/commands/npm-access.html index 3263227f8afd5f..61bb6a3c762a35 100644 --- a/deps/npm/docs/output/commands/npm-access.html +++ b/deps/npm/docs/output/commands/npm-access.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-access

+

+ npm-access + @10.8.0 +

Set access level on published packages
diff --git a/deps/npm/docs/output/commands/npm-adduser.html b/deps/npm/docs/output/commands/npm-adduser.html index e515eaa5adabda..0a338175ead62d 100644 --- a/deps/npm/docs/output/commands/npm-adduser.html +++ b/deps/npm/docs/output/commands/npm-adduser.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-adduser

+

+ npm-adduser + @10.8.0 +

Add a registry user account
diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html index 5e8e9d66bb2e59..1e556d50a03f9b 100644 --- a/deps/npm/docs/output/commands/npm-audit.html +++ b/deps/npm/docs/output/commands/npm-audit.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-audit

+

+ npm-audit + @10.8.0 +

Run a security audit
diff --git a/deps/npm/docs/output/commands/npm-bugs.html b/deps/npm/docs/output/commands/npm-bugs.html index b3f7987e53a092..ac46a5e8de225c 100644 --- a/deps/npm/docs/output/commands/npm-bugs.html +++ b/deps/npm/docs/output/commands/npm-bugs.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-bugs

+

+ npm-bugs + @10.8.0 +

Report bugs for a package in a web browser
diff --git a/deps/npm/docs/output/commands/npm-cache.html b/deps/npm/docs/output/commands/npm-cache.html index b5ddd5a5ad5c43..45c980155e7b14 100644 --- a/deps/npm/docs/output/commands/npm-cache.html +++ b/deps/npm/docs/output/commands/npm-cache.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-cache

+

+ npm-cache + @10.8.0 +

Manipulates packages cache
diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html index 4dffceba0d4d5c..961718439b4a47 100644 --- a/deps/npm/docs/output/commands/npm-ci.html +++ b/deps/npm/docs/output/commands/npm-ci.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-ci

+

+ npm-ci + @10.8.0 +

Clean install a project
diff --git a/deps/npm/docs/output/commands/npm-completion.html b/deps/npm/docs/output/commands/npm-completion.html index d43bbf99fcdea5..b1896ad10f4e20 100644 --- a/deps/npm/docs/output/commands/npm-completion.html +++ b/deps/npm/docs/output/commands/npm-completion.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-completion

+

+ npm-completion + @10.8.0 +

Tab Completion for npm
diff --git a/deps/npm/docs/output/commands/npm-config.html b/deps/npm/docs/output/commands/npm-config.html index 70a60390e0f90d..c399d3142eb004 100644 --- a/deps/npm/docs/output/commands/npm-config.html +++ b/deps/npm/docs/output/commands/npm-config.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-config

+

+ npm-config + @10.8.0 +

Manage the npm configuration files
diff --git a/deps/npm/docs/output/commands/npm-dedupe.html b/deps/npm/docs/output/commands/npm-dedupe.html index 625fe39bbd36c7..9864ec2ecc5cb0 100644 --- a/deps/npm/docs/output/commands/npm-dedupe.html +++ b/deps/npm/docs/output/commands/npm-dedupe.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-dedupe

+

+ npm-dedupe + @10.8.0 +

Reduce duplication in the package tree
diff --git a/deps/npm/docs/output/commands/npm-deprecate.html b/deps/npm/docs/output/commands/npm-deprecate.html index f332437e1035c3..9dedd3be56f2ad 100644 --- a/deps/npm/docs/output/commands/npm-deprecate.html +++ b/deps/npm/docs/output/commands/npm-deprecate.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-deprecate

+

+ npm-deprecate + @10.8.0 +

Deprecate a version of a package
diff --git a/deps/npm/docs/output/commands/npm-diff.html b/deps/npm/docs/output/commands/npm-diff.html index 13569c85f1837f..5d3f5ef0f089b6 100644 --- a/deps/npm/docs/output/commands/npm-diff.html +++ b/deps/npm/docs/output/commands/npm-diff.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-diff

+

+ npm-diff + @10.8.0 +

The registry diff command
diff --git a/deps/npm/docs/output/commands/npm-dist-tag.html b/deps/npm/docs/output/commands/npm-dist-tag.html index 1e75f62f1fcb49..ba748cd0b16ec6 100644 --- a/deps/npm/docs/output/commands/npm-dist-tag.html +++ b/deps/npm/docs/output/commands/npm-dist-tag.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-dist-tag

+

+ npm-dist-tag + @10.8.0 +

Modify package distribution tags
diff --git a/deps/npm/docs/output/commands/npm-docs.html b/deps/npm/docs/output/commands/npm-docs.html index 53885437ec9a19..9624310743ed1d 100644 --- a/deps/npm/docs/output/commands/npm-docs.html +++ b/deps/npm/docs/output/commands/npm-docs.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-docs

+

+ npm-docs + @10.8.0 +

Open documentation for a package in a web browser
diff --git a/deps/npm/docs/output/commands/npm-doctor.html b/deps/npm/docs/output/commands/npm-doctor.html index fc4f7643fad896..e861423a6daba7 100644 --- a/deps/npm/docs/output/commands/npm-doctor.html +++ b/deps/npm/docs/output/commands/npm-doctor.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-doctor

+

+ npm-doctor + @10.8.0 +

Check the health of your npm environment
diff --git a/deps/npm/docs/output/commands/npm-edit.html b/deps/npm/docs/output/commands/npm-edit.html index 52c8e573836abc..238f2fb7ad5e3f 100644 --- a/deps/npm/docs/output/commands/npm-edit.html +++ b/deps/npm/docs/output/commands/npm-edit.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-edit

+

+ npm-edit + @10.8.0 +

Edit an installed package
diff --git a/deps/npm/docs/output/commands/npm-exec.html b/deps/npm/docs/output/commands/npm-exec.html index 51f6c2b75e4566..b2f4fa56527767 100644 --- a/deps/npm/docs/output/commands/npm-exec.html +++ b/deps/npm/docs/output/commands/npm-exec.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-exec

+

+ npm-exec + @10.8.0 +

Run a command from a local or remote npm package
diff --git a/deps/npm/docs/output/commands/npm-explain.html b/deps/npm/docs/output/commands/npm-explain.html index 74305d399bc6d4..915559613d1e96 100644 --- a/deps/npm/docs/output/commands/npm-explain.html +++ b/deps/npm/docs/output/commands/npm-explain.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-explain

+

+ npm-explain + @10.8.0 +

Explain installed packages
diff --git a/deps/npm/docs/output/commands/npm-explore.html b/deps/npm/docs/output/commands/npm-explore.html index 2e52c73f3f7c26..851b42790c160c 100644 --- a/deps/npm/docs/output/commands/npm-explore.html +++ b/deps/npm/docs/output/commands/npm-explore.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-explore

+

+ npm-explore + @10.8.0 +

Browse an installed package
diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html index 86546d345d46cc..18ec5d449d4f50 100644 --- a/deps/npm/docs/output/commands/npm-find-dupes.html +++ b/deps/npm/docs/output/commands/npm-find-dupes.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-find-dupes

+

+ npm-find-dupes + @10.8.0 +

Find duplication in the package tree
diff --git a/deps/npm/docs/output/commands/npm-fund.html b/deps/npm/docs/output/commands/npm-fund.html index 7193d179f23a33..7381f39f2f95b5 100644 --- a/deps/npm/docs/output/commands/npm-fund.html +++ b/deps/npm/docs/output/commands/npm-fund.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-fund

+

+ npm-fund + @10.8.0 +

Retrieve funding information
diff --git a/deps/npm/docs/output/commands/npm-help-search.html b/deps/npm/docs/output/commands/npm-help-search.html index c8ae1b63192108..0003fbc903e32b 100644 --- a/deps/npm/docs/output/commands/npm-help-search.html +++ b/deps/npm/docs/output/commands/npm-help-search.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-help-search

+

+ npm-help-search + @10.8.0 +

Search npm help documentation
diff --git a/deps/npm/docs/output/commands/npm-help.html b/deps/npm/docs/output/commands/npm-help.html index 3cf78e35bf1f62..3fff79470f8339 100644 --- a/deps/npm/docs/output/commands/npm-help.html +++ b/deps/npm/docs/output/commands/npm-help.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-help

+

+ npm-help + @10.8.0 +

Get help on npm
diff --git a/deps/npm/docs/output/commands/npm-hook.html b/deps/npm/docs/output/commands/npm-hook.html index 46077516384cc5..73a7fec7ad9993 100644 --- a/deps/npm/docs/output/commands/npm-hook.html +++ b/deps/npm/docs/output/commands/npm-hook.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-hook

+

+ npm-hook + @10.8.0 +

Manage registry hooks
diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html index 9094984dd20efa..a7eeececb33df9 100644 --- a/deps/npm/docs/output/commands/npm-init.html +++ b/deps/npm/docs/output/commands/npm-init.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-init

+

+ npm-init + @10.8.0 +

Create a package.json file
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 407dbf9a2dd6bd..1cd97c41a79e3a 100644 --- a/deps/npm/docs/output/commands/npm-install-ci-test.html +++ b/deps/npm/docs/output/commands/npm-install-ci-test.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-install-ci-test

+

+ npm-install-ci-test + @10.8.0 +

Install a project with a clean slate and run tests
diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html index bdbe82f5d3442a..78fb874a8208a1 100644 --- a/deps/npm/docs/output/commands/npm-install-test.html +++ b/deps/npm/docs/output/commands/npm-install-test.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-install-test

+

+ npm-install-test + @10.8.0 +

Install package(s) and run tests
diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html index 774da9fc37b106..e8c03b3d91dd85 100644 --- a/deps/npm/docs/output/commands/npm-install.html +++ b/deps/npm/docs/output/commands/npm-install.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-install

+

+ npm-install + @10.8.0 +

Install a package
diff --git a/deps/npm/docs/output/commands/npm-link.html b/deps/npm/docs/output/commands/npm-link.html index 93ec04390fc5b2..1f20e99c5ff76e 100644 --- a/deps/npm/docs/output/commands/npm-link.html +++ b/deps/npm/docs/output/commands/npm-link.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-link

+

+ npm-link + @10.8.0 +

Symlink a package folder
diff --git a/deps/npm/docs/output/commands/npm-login.html b/deps/npm/docs/output/commands/npm-login.html index 5ffff8aa627168..821d2158709a58 100644 --- a/deps/npm/docs/output/commands/npm-login.html +++ b/deps/npm/docs/output/commands/npm-login.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-login

+

+ npm-login + @10.8.0 +

Login to a registry user account
diff --git a/deps/npm/docs/output/commands/npm-logout.html b/deps/npm/docs/output/commands/npm-logout.html index 5767772b68c4f0..0ae8a1059ac71d 100644 --- a/deps/npm/docs/output/commands/npm-logout.html +++ b/deps/npm/docs/output/commands/npm-logout.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-logout

+

+ npm-logout + @10.8.0 +

Log out of the registry
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index be2287797a8f30..f46d1f062f283d 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-ls

+

+ npm-ls + @10.8.0 +

List installed packages
@@ -160,7 +168,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@10.7.0 /path/to/npm
+
npm@10.8.0 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm-org.html b/deps/npm/docs/output/commands/npm-org.html index 601abc6369724e..fa3cf17fe91ce5 100644 --- a/deps/npm/docs/output/commands/npm-org.html +++ b/deps/npm/docs/output/commands/npm-org.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-org

+

+ npm-org + @10.8.0 +

Manage orgs
diff --git a/deps/npm/docs/output/commands/npm-outdated.html b/deps/npm/docs/output/commands/npm-outdated.html index 96689fb906c263..c7f265fc45e6e5 100644 --- a/deps/npm/docs/output/commands/npm-outdated.html +++ b/deps/npm/docs/output/commands/npm-outdated.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-outdated

+

+ npm-outdated + @10.8.0 +

Check for outdated packages
diff --git a/deps/npm/docs/output/commands/npm-owner.html b/deps/npm/docs/output/commands/npm-owner.html index dab34abe97c14a..4b69069eb1cb8d 100644 --- a/deps/npm/docs/output/commands/npm-owner.html +++ b/deps/npm/docs/output/commands/npm-owner.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-owner

+

+ npm-owner + @10.8.0 +

Manage package owners
diff --git a/deps/npm/docs/output/commands/npm-pack.html b/deps/npm/docs/output/commands/npm-pack.html index f8f5d784224d73..eed8ab39c212e3 100644 --- a/deps/npm/docs/output/commands/npm-pack.html +++ b/deps/npm/docs/output/commands/npm-pack.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-pack

+

+ npm-pack + @10.8.0 +

Create a tarball from a package
diff --git a/deps/npm/docs/output/commands/npm-ping.html b/deps/npm/docs/output/commands/npm-ping.html index 708238b04497f8..26fe123493be79 100644 --- a/deps/npm/docs/output/commands/npm-ping.html +++ b/deps/npm/docs/output/commands/npm-ping.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-ping

+

+ npm-ping + @10.8.0 +

Ping npm registry
diff --git a/deps/npm/docs/output/commands/npm-pkg.html b/deps/npm/docs/output/commands/npm-pkg.html index d60ca0b0f4aac7..aa85100d6e7925 100644 --- a/deps/npm/docs/output/commands/npm-pkg.html +++ b/deps/npm/docs/output/commands/npm-pkg.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-pkg

+

+ npm-pkg + @10.8.0 +

Manages your package.json
diff --git a/deps/npm/docs/output/commands/npm-prefix.html b/deps/npm/docs/output/commands/npm-prefix.html index 41789e3e315088..954ec28a8ea7fc 100644 --- a/deps/npm/docs/output/commands/npm-prefix.html +++ b/deps/npm/docs/output/commands/npm-prefix.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-prefix

+

+ npm-prefix + @10.8.0 +

Display prefix
diff --git a/deps/npm/docs/output/commands/npm-profile.html b/deps/npm/docs/output/commands/npm-profile.html index e0c913a6b46b22..8d7472d64f5495 100644 --- a/deps/npm/docs/output/commands/npm-profile.html +++ b/deps/npm/docs/output/commands/npm-profile.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-profile

+

+ npm-profile + @10.8.0 +

Change settings on your registry profile
diff --git a/deps/npm/docs/output/commands/npm-prune.html b/deps/npm/docs/output/commands/npm-prune.html index 94d016027e8363..2ac404508a4472 100644 --- a/deps/npm/docs/output/commands/npm-prune.html +++ b/deps/npm/docs/output/commands/npm-prune.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-prune

+

+ npm-prune + @10.8.0 +

Remove extraneous packages
diff --git a/deps/npm/docs/output/commands/npm-publish.html b/deps/npm/docs/output/commands/npm-publish.html index b5b18b4ddca610..8ca49253fbb0eb 100644 --- a/deps/npm/docs/output/commands/npm-publish.html +++ b/deps/npm/docs/output/commands/npm-publish.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-publish

+

+ npm-publish + @10.8.0 +

Publish a package
diff --git a/deps/npm/docs/output/commands/npm-query.html b/deps/npm/docs/output/commands/npm-query.html index 228de6787fd408..1b9c9dccc7b3db 100644 --- a/deps/npm/docs/output/commands/npm-query.html +++ b/deps/npm/docs/output/commands/npm-query.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-query

+

+ npm-query + @10.8.0 +

Dependency selector query
diff --git a/deps/npm/docs/output/commands/npm-rebuild.html b/deps/npm/docs/output/commands/npm-rebuild.html index ee3ba1e8163502..da577ba779c3d7 100644 --- a/deps/npm/docs/output/commands/npm-rebuild.html +++ b/deps/npm/docs/output/commands/npm-rebuild.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-rebuild

+

+ npm-rebuild + @10.8.0 +

Rebuild a package
diff --git a/deps/npm/docs/output/commands/npm-repo.html b/deps/npm/docs/output/commands/npm-repo.html index 4278ffae934975..3664db2261e6d9 100644 --- a/deps/npm/docs/output/commands/npm-repo.html +++ b/deps/npm/docs/output/commands/npm-repo.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-repo

+

+ npm-repo + @10.8.0 +

Open package repository page in the browser
diff --git a/deps/npm/docs/output/commands/npm-restart.html b/deps/npm/docs/output/commands/npm-restart.html index 368252f58ea5b3..28b77442350989 100644 --- a/deps/npm/docs/output/commands/npm-restart.html +++ b/deps/npm/docs/output/commands/npm-restart.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-restart

+

+ npm-restart + @10.8.0 +

Restart a package
diff --git a/deps/npm/docs/output/commands/npm-root.html b/deps/npm/docs/output/commands/npm-root.html index d300a0caaf8fb6..e75f2cf4365022 100644 --- a/deps/npm/docs/output/commands/npm-root.html +++ b/deps/npm/docs/output/commands/npm-root.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-root

+

+ npm-root + @10.8.0 +

Display npm root
diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html index 9f0c03940e83d3..5fecae8454429a 100644 --- a/deps/npm/docs/output/commands/npm-run-script.html +++ b/deps/npm/docs/output/commands/npm-run-script.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-run-script

+

+ npm-run-script + @10.8.0 +

Run arbitrary package scripts
diff --git a/deps/npm/docs/output/commands/npm-sbom.html b/deps/npm/docs/output/commands/npm-sbom.html index 01302780a2ab77..c4e3f3063bf78b 100644 --- a/deps/npm/docs/output/commands/npm-sbom.html +++ b/deps/npm/docs/output/commands/npm-sbom.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-sbom

+

+ npm-sbom + @10.8.0 +

Generate a Software Bill of Materials (SBOM)
diff --git a/deps/npm/docs/output/commands/npm-search.html b/deps/npm/docs/output/commands/npm-search.html index 3d7821531f730a..67a609015eeca8 100644 --- a/deps/npm/docs/output/commands/npm-search.html +++ b/deps/npm/docs/output/commands/npm-search.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-search

+

+ npm-search + @10.8.0 +

Search for packages
diff --git a/deps/npm/docs/output/commands/npm-shrinkwrap.html b/deps/npm/docs/output/commands/npm-shrinkwrap.html index fd219fe06a4ce8..0ca603a788b007 100644 --- a/deps/npm/docs/output/commands/npm-shrinkwrap.html +++ b/deps/npm/docs/output/commands/npm-shrinkwrap.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-shrinkwrap

+

+ npm-shrinkwrap + @10.8.0 +

Lock down dependency versions for publication
diff --git a/deps/npm/docs/output/commands/npm-star.html b/deps/npm/docs/output/commands/npm-star.html index 58f8c0946bfb5e..ab7371e2b91cdf 100644 --- a/deps/npm/docs/output/commands/npm-star.html +++ b/deps/npm/docs/output/commands/npm-star.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-star

+

+ npm-star + @10.8.0 +

Mark your favorite packages
diff --git a/deps/npm/docs/output/commands/npm-stars.html b/deps/npm/docs/output/commands/npm-stars.html index 18ffb8529d31a8..2ed1193c1e6f1d 100644 --- a/deps/npm/docs/output/commands/npm-stars.html +++ b/deps/npm/docs/output/commands/npm-stars.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-stars

+

+ npm-stars + @10.8.0 +

View packages marked as favorites
diff --git a/deps/npm/docs/output/commands/npm-start.html b/deps/npm/docs/output/commands/npm-start.html index 79647edf37980d..ade6e79ff9eff0 100644 --- a/deps/npm/docs/output/commands/npm-start.html +++ b/deps/npm/docs/output/commands/npm-start.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-start

+

+ npm-start + @10.8.0 +

Start a package
diff --git a/deps/npm/docs/output/commands/npm-stop.html b/deps/npm/docs/output/commands/npm-stop.html index a744a635d665cc..57deebf6ac7e39 100644 --- a/deps/npm/docs/output/commands/npm-stop.html +++ b/deps/npm/docs/output/commands/npm-stop.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-stop

+

+ npm-stop + @10.8.0 +

Stop a package
diff --git a/deps/npm/docs/output/commands/npm-team.html b/deps/npm/docs/output/commands/npm-team.html index 6752bb38102d7a..00b739517f6cdb 100644 --- a/deps/npm/docs/output/commands/npm-team.html +++ b/deps/npm/docs/output/commands/npm-team.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-team

+

+ npm-team + @10.8.0 +

Manage organization teams and team memberships
diff --git a/deps/npm/docs/output/commands/npm-test.html b/deps/npm/docs/output/commands/npm-test.html index 6e1732ade6b13a..d9c73d48618535 100644 --- a/deps/npm/docs/output/commands/npm-test.html +++ b/deps/npm/docs/output/commands/npm-test.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-test

+

+ npm-test + @10.8.0 +

Test a package
diff --git a/deps/npm/docs/output/commands/npm-token.html b/deps/npm/docs/output/commands/npm-token.html index 33b66d08e69def..ac6dde4adb31af 100644 --- a/deps/npm/docs/output/commands/npm-token.html +++ b/deps/npm/docs/output/commands/npm-token.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-token

+

+ npm-token + @10.8.0 +

Manage your authentication tokens
diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html index 4a4e6c274a09e7..32fc83fc1f1233 100644 --- a/deps/npm/docs/output/commands/npm-uninstall.html +++ b/deps/npm/docs/output/commands/npm-uninstall.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-uninstall

+

+ npm-uninstall + @10.8.0 +

Remove a package
diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index cf952c56f4cfdf..f9e914d67ff963 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-unpublish

+

+ npm-unpublish + @10.8.0 +

Remove a package from the registry
diff --git a/deps/npm/docs/output/commands/npm-unstar.html b/deps/npm/docs/output/commands/npm-unstar.html index 602e555e760e14..7845f3b401f8cc 100644 --- a/deps/npm/docs/output/commands/npm-unstar.html +++ b/deps/npm/docs/output/commands/npm-unstar.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-unstar

+

+ npm-unstar + @10.8.0 +

Remove an item from your favorite packages
diff --git a/deps/npm/docs/output/commands/npm-update.html b/deps/npm/docs/output/commands/npm-update.html index 462bca7b771628..12231c0e838931 100644 --- a/deps/npm/docs/output/commands/npm-update.html +++ b/deps/npm/docs/output/commands/npm-update.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-update

+

+ npm-update + @10.8.0 +

Update packages
diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html index 4977af5173cf55..b1092d2af20333 100644 --- a/deps/npm/docs/output/commands/npm-version.html +++ b/deps/npm/docs/output/commands/npm-version.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-version

+

+ npm-version + @10.8.0 +

Bump a package version
diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html index af43193dd0869b..de9d9bd0280fef 100644 --- a/deps/npm/docs/output/commands/npm-view.html +++ b/deps/npm/docs/output/commands/npm-view.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-view

+

+ npm-view + @10.8.0 +

View registry info
diff --git a/deps/npm/docs/output/commands/npm-whoami.html b/deps/npm/docs/output/commands/npm-whoami.html index 9e5050b06ee9e4..8cb3231e1e9030 100644 --- a/deps/npm/docs/output/commands/npm-whoami.html +++ b/deps/npm/docs/output/commands/npm-whoami.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-whoami

+

+ npm-whoami + @10.8.0 +

Display npm username
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 1a279cf259db33..9094333b74138e 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm

+

+ npm + @10.8.0 +

javascript package manager
@@ -150,7 +158,7 @@

Table of contents

Note: This command is unaware of workspaces.

Version

-

10.7.0

+

10.8.0

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/commands/npx.html b/deps/npm/docs/output/commands/npx.html index d2bebc34c0c484..b3da26ebd097e0 100644 --- a/deps/npm/docs/output/commands/npx.html +++ b/deps/npm/docs/output/commands/npx.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@

-

npx

+

+ npx + @10.8.0 +

Run a command from a local or remote npm package
diff --git a/deps/npm/docs/output/configuring-npm/folders.html b/deps/npm/docs/output/configuring-npm/folders.html index cb97ac6ad25326..52891fddf891d4 100644 --- a/deps/npm/docs/output/configuring-npm/folders.html +++ b/deps/npm/docs/output/configuring-npm/folders.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

folders

+

+ folders + @10.8.0 +

Folder Structures Used by npm
diff --git a/deps/npm/docs/output/configuring-npm/install.html b/deps/npm/docs/output/configuring-npm/install.html index 996082d018ea30..e9f278ee30f88f 100644 --- a/deps/npm/docs/output/configuring-npm/install.html +++ b/deps/npm/docs/output/configuring-npm/install.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

install

+

+ install + @10.8.0 +

Download and install node and npm
diff --git a/deps/npm/docs/output/configuring-npm/npm-global.html b/deps/npm/docs/output/configuring-npm/npm-global.html new file mode 100644 index 00000000000000..52891fddf891d4 --- /dev/null +++ b/deps/npm/docs/output/configuring-npm/npm-global.html @@ -0,0 +1,330 @@ + + +folders + + + + + +
+
+

+ folders + @10.8.0 +

+Folder Structures Used by npm +
+ +
+

Table of contents

+ +
+ +

Description

+

npm puts various things on your computer. That's its job.

+

This document will tell you what it puts where.

+

tl;dr

+
    +
  • Local install (default): puts stuff in ./node_modules of the current +package root.
  • +
  • Global install (with -g): puts stuff in /usr/local or wherever node +is installed.
  • +
  • Install it locally if you're going to require() it.
  • +
  • Install it globally if you're going to run it on the command line.
  • +
  • If you need both, then install it in both places, or use npm link.
  • +
+

prefix Configuration

+

The prefix config defaults to the location where +node is installed. On most systems, this is /usr/local. On Windows, it's +%AppData%\npm. On Unix systems, it's one level up, since node is typically +installed at {prefix}/bin/node rather than {prefix}/node.exe.

+

When the global flag is set, npm installs things into this prefix. +When it is not set, it uses the root of the current package, or the +current working directory if not in a package already.

+

Node Modules

+

Packages are dropped into the node_modules folder under the prefix. +When installing locally, this means that you can +require("packagename") to load its main module, or +require("packagename/lib/path/to/sub/module") to load other modules.

+

Global installs on Unix systems go to {prefix}/lib/node_modules. +Global installs on Windows go to {prefix}/node_modules (that is, no +lib folder.)

+

Scoped packages are installed the same way, except they are grouped together +in a sub-folder of the relevant node_modules folder with the name of that +scope prefix by the @ symbol, e.g. npm install @myorg/package would place +the package in {prefix}/node_modules/@myorg/package. See +scope for more details.

+

If you wish to require() a package, then install it locally.

+

Executables

+

When in global mode, executables are linked into {prefix}/bin on Unix, +or directly into {prefix} on Windows. Ensure that path is in your +terminal's PATH environment to run them.

+

When in local mode, executables are linked into +./node_modules/.bin so that they can be made available to scripts run +through npm. (For example, so that a test runner will be in the path +when you run npm test.)

+

Man Pages

+

When in global mode, man pages are linked into {prefix}/share/man.

+

When in local mode, man pages are not installed.

+

Man pages are not installed on Windows systems.

+

Cache

+

See npm cache. Cache files are stored in ~/.npm on Posix, or +%LocalAppData%/npm-cache on Windows.

+

This is controlled by the cache config param.

+

Temp Files

+

Temporary files are stored by default in the folder specified by the +tmp config, which defaults to the TMPDIR, TMP, or +TEMP environment variables, or /tmp on Unix and c:\windows\temp on Windows.

+

Temp files are given a unique folder under this root for each run of the +program, and are deleted upon successful exit.

+

More Information

+

When installing locally, npm first tries to find an appropriate +prefix folder. This is so that npm install foo@1.2.3 will install +to the sensible root of your package, even if you happen to have cded +into some other folder.

+

Starting at the $PWD, npm will walk up the folder tree checking for a +folder that contains either a package.json file, or a node_modules +folder. If such a thing is found, then that is treated as the effective +"current directory" for the purpose of running npm commands. (This +behavior is inspired by and similar to git's .git-folder seeking +logic when running git commands in a working dir.)

+

If no package root is found, then the current folder is used.

+

When you run npm install foo@1.2.3, then the package is loaded into +the cache, and then unpacked into ./node_modules/foo. Then, any of +foo's dependencies are similarly unpacked into +./node_modules/foo/node_modules/....

+

Any bin files are symlinked to ./node_modules/.bin/, so that they may +be found by npm scripts when necessary.

+

Global Installation

+

If the global config is set to true, then npm will +install packages "globally".

+

For global installation, packages are installed roughly the same way, +but using the folders described above.

+

Cycles, Conflicts, and Folder Parsimony

+

Cycles are handled using the property of node's module system that it +walks up the directories looking for node_modules folders. So, at every +stage, if a package is already installed in an ancestor node_modules +folder, then it is not installed at the current location.

+

Consider the case above, where foo -> bar -> baz. Imagine if, in +addition to that, baz depended on bar, so you'd have: +foo -> bar -> baz -> bar -> baz .... However, since the folder +structure is: foo/node_modules/bar/node_modules/baz, there's no need to +put another copy of bar into .../baz/node_modules, since when baz calls +require("bar"), it will get the copy that is installed in +foo/node_modules/bar.

+

This shortcut is only used if the exact same +version would be installed in multiple nested node_modules folders. It +is still possible to have a/node_modules/b/node_modules/a if the two +"a" packages are different versions. However, without repeating the +exact same package multiple times, an infinite regress will always be +prevented.

+

Another optimization can be made by installing dependencies at the +highest level possible, below the localized "target" folder (hoisting). +Since version 3, npm hoists dependencies by default.

+

Example

+

Consider this dependency graph:

+
foo
++-- blerg@1.2.5
++-- bar@1.2.3
+|   +-- blerg@1.x (latest=1.3.7)
+|   +-- baz@2.x
+|   |   `-- quux@3.x
+|   |       `-- bar@1.2.3 (cycle)
+|   `-- asdf@*
+`-- baz@1.2.3
+    `-- quux@3.x
+        `-- bar
+
+

In this case, we might expect a folder structure like this +(with all dependencies hoisted to the highest level possible):

+
foo
++-- node_modules
+    +-- blerg (1.2.5) <---[A]
+    +-- bar (1.2.3) <---[B]
+    |   +-- node_modules
+    |       +-- baz (2.0.2) <---[C]
+    +-- asdf (2.3.4)
+    +-- baz (1.2.3) <---[D]
+    +-- quux (3.2.0) <---[E]
+
+

Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are +installed in foo's node_modules folder.

+

Even though the latest copy of blerg is 1.3.7, foo has a specific +dependency on version 1.2.5. So, that gets installed at [A]. Since the +parent installation of blerg satisfies bar's dependency on blerg@1.x, +it does not install another copy under [B].

+

Bar [B] also has dependencies on baz and asdf. Because it depends on baz@2.x, it cannot +re-use the baz@1.2.3 installed in the parent node_modules folder [D], +and must install its own copy [C]. In order to minimize duplication, npm hoists +dependencies to the top level by default, so asdf is installed under [A].

+

Underneath bar, the baz -> quux -> bar dependency creates a cycle. +However, because bar is already in quux's ancestry [B], it does not +unpack another copy of bar into that folder. Likewise, quux's [E] +folder tree is empty, because its dependency on bar is satisfied +by the parent folder copy installed at [B].

+

For a graphical breakdown of what is installed where, use npm ls.

+

Publishing

+

Upon publishing, npm will look in the node_modules folder. If any of +the items there are not in the bundleDependencies array, then they will +not be included in the package tarball.

+

This allows a package maintainer to install all of their dependencies +(and dev dependencies) locally, but only re-publish those items that +cannot be found elsewhere. See package.json for more information.

+

See also

+
+ + +
+ + + + \ No newline at end of file diff --git a/deps/npm/docs/output/configuring-npm/npm-json.html b/deps/npm/docs/output/configuring-npm/npm-json.html new file mode 100644 index 00000000000000..ebf67c36fb2bd2 --- /dev/null +++ b/deps/npm/docs/output/configuring-npm/npm-json.html @@ -0,0 +1,1080 @@ + + +package.json + + + + + +
+
+

+ package.json + @10.8.0 +

+Specifics of npm's package.json handling +
+ +
+

Table of contents

+ +
+ +

Description

+

This document is all you need to know about what's required in your +package.json file. It must be actual JSON, not just a JavaScript object +literal.

+

A lot of the behavior described in this document is affected by the config +settings described in config.

+

name

+

If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

+

The name is what your thing is called.

+

Some rules:

+
    +
  • The name must be less than or equal to 214 characters. This includes the +scope for scoped packages.
  • +
  • The names of scoped packages can begin with a dot or an underscore. This +is not permitted without a scope.
  • +
  • New packages must not have uppercase letters in the name.
  • +
  • The name ends up being part of a URL, an argument on the command line, +and a folder name. Therefore, the name can't contain any non-URL-safe +characters.
  • +
+

Some tips:

+
    +
  • Don't use the same name as a core Node module.
  • +
  • Don't put "js" or "node" in the name. It's assumed that it's js, since +you're writing a package.json file, and you can specify the engine using +the "engines" field. (See below.)
  • +
  • The name will probably be passed as an argument to require(), so it +should be something short, but also reasonably descriptive.
  • +
  • You may want to check the npm registry to see if there's something by +that name already, before you get too attached to it. +https://www.npmjs.com/
  • +
+

A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See +scope for more detail.

+

version

+

If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

+

Version must be parseable by +node-semver, which is bundled with +npm as a dependency. (npm install semver to use it yourself.)

+

description

+

Put a description in it. It's a string. This helps people discover your +package, as it's listed in npm search.

+

keywords

+

Put keywords in it. It's an array of strings. This helps people discover +your package as it's listed in npm search.

+

homepage

+

The URL to the project homepage.

+

Example:

+
"homepage": "https://github.com/owner/project#readme"
+
+

bugs

+

The URL to your project's issue tracker and / or the email address to which +issues should be reported. These are helpful for people who encounter +issues with your package.

+

It should look like this:

+
{
+  "bugs": {
+    "url": "https://github.com/owner/project/issues",
+    "email": "project@hostname.com"
+  }
+}
+
+

You can specify either one or both values. If you want to provide only a +URL, you can specify the value for "bugs" as a simple string instead of an +object.

+

If a URL is provided, it will be used by the npm bugs command.

+

license

+

You should specify a license for your package so that people know how they +are permitted to use it, and any restrictions you're placing on it.

+

If you're using a common license such as BSD-2-Clause or MIT, add a current +SPDX license identifier for the license you're using, like this:

+
{
+  "license" : "BSD-3-Clause"
+}
+
+

You can check the full list of SPDX license +IDs. Ideally you should pick one that is +OSI approved.

+

If your package is licensed under multiple common licenses, use an SPDX +license expression syntax version 2.0 +string, like this:

+
{
+  "license" : "(ISC OR GPL-3.0)"
+}
+
+

If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use a string value like this one:

+
{
+  "license" : "SEE LICENSE IN <filename>"
+}
+
+

Then include a file named <filename> at the top level of the package.

+

Some old packages used license objects or a "licenses" property containing +an array of license objects:

+
// Not valid metadata
+{
+  "license" : {
+    "type" : "ISC",
+    "url" : "https://opensource.org/licenses/ISC"
+  }
+}
+
+// Not valid metadata
+{
+  "licenses" : [
+    {
+      "type": "MIT",
+      "url": "https://www.opensource.org/licenses/mit-license.php"
+    },
+    {
+      "type": "Apache-2.0",
+      "url": "https://opensource.org/licenses/apache2.0.php"
+    }
+  ]
+}
+
+

Those styles are now deprecated. Instead, use SPDX expressions, like this:

+
{
+  "license": "ISC"
+}
+
+
{
+  "license": "(MIT OR Apache-2.0)"
+}
+
+

Finally, if you do not wish to grant others the right to use a private or +unpublished package under any terms:

+
{
+  "license": "UNLICENSED"
+}
+
+

Consider also setting "private": true to prevent accidental publication.

+

people fields: author, contributors

+

The "author" is one person. "contributors" is an array of people. A +"person" is an object with a "name" field and optionally "url" and "email", +like this:

+
{
+  "name" : "Barney Rubble",
+  "email" : "b@rubble.com",
+  "url" : "http://barnyrubble.tumblr.com/"
+}
+
+

Or you can shorten that all into a single string, and npm will parse it for +you:

+
{
+  "author": "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
+}
+
+

Both email and url are optional either way.

+

npm also sets a top-level "maintainers" field with your npm user info.

+

funding

+

You can specify an object containing a URL that provides up-to-date +information about ways to help fund development of your package, or a +string URL, or an array of these:

+
{
+  "funding": {
+    "type" : "individual",
+    "url" : "http://example.com/donate"
+  },
+
+  "funding": {
+    "type" : "patreon",
+    "url" : "https://www.patreon.com/my-account"
+  },
+
+  "funding": "http://example.com/donate",
+
+  "funding": [
+    {
+      "type" : "individual",
+      "url" : "http://example.com/donate"
+    },
+    "http://example.com/donateAlso",
+    {
+      "type" : "patreon",
+      "url" : "https://www.patreon.com/my-account"
+    }
+  ]
+}
+
+

Users can use the npm fund subcommand to list the funding URLs of all +dependencies of their project, direct and indirect. A shortcut to visit +each funding url is also available when providing the project name such as: +npm fund <projectname> (when there are multiple URLs, the first one will +be visited)

+

files

+

The optional files field is an array of file patterns that describes the +entries to be included when your package is installed as a dependency. File +patterns follow a similar syntax to .gitignore, but reversed: including a +file, directory, or glob pattern (*, **/*, and such) will make it so +that file is included in the tarball when it's packed. Omitting the field +will make it default to ["*"], which means it will include all files.

+

Some special files and directories are also included or excluded regardless +of whether they exist in the files array (see below).

+

You can also provide a .npmignore file in the root of your package or in +subdirectories, which will keep files from being included. At the root of +your package it will not override the "files" field, but in subdirectories +it will. The .npmignore file works just like a .gitignore. If there is +a .gitignore file, and .npmignore is missing, .gitignore's contents +will be used instead.

+

Certain files are always included, regardless of settings:

+
    +
  • package.json
  • +
  • README
  • +
  • LICENSE / LICENCE
  • +
  • The file in the "main" field
  • +
  • The file(s) in the "bin" field
  • +
+

README & LICENSE can have any case and extension.

+

Some files are always ignored by default:

+
    +
  • *.orig
  • +
  • .*.swp
  • +
  • .DS_Store
  • +
  • ._*
  • +
  • .git
  • +
  • .hg
  • +
  • .lock-wscript
  • +
  • .npmrc
  • +
  • .svn
  • +
  • .wafpickle-N
  • +
  • CVS
  • +
  • config.gypi
  • +
  • node_modules
  • +
  • npm-debug.log
  • +
  • package-lock.json (use +npm-shrinkwrap.json +if you wish it to be published)
  • +
  • pnpm-lock.yaml
  • +
  • yarn.lock
  • +
+

Most of these ignored files can be included specifically if included in +the files globs. Exceptions to this are:

+
    +
  • .git
  • +
  • .npmrc
  • +
  • node_modules
  • +
  • package-lock.json
  • +
  • pnpm-lock.yaml
  • +
  • yarn.lock
  • +
+

These can not be included.

+

main

+

The main field is a module ID that is the primary entry point to your +program. That is, if your package is named foo, and a user installs it, +and then does require("foo"), then your main module's exports object will +be returned.

+

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 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 +rely on primitives that aren't available in Node.js modules. (e.g. +window)

+

bin

+

A lot of packages have one or more executable files that they'd like to +install into the PATH. npm makes this pretty easy (in fact, it uses this +feature to install the "npm" executable.)

+

To use this, supply a bin field in your package.json which is a map of +command name to local file name. When this package is installed globally, +that file will be either linked inside the global bins directory or +a cmd (Windows Command File) will be created which executes the specified +file in the bin field, so it is available to run by name or name.cmd (on +Windows PowerShell). When this package is installed as a dependency in another +package, the file will be linked where it will be available to that package +either directly by npm exec or by name in other scripts when invoking them +via npm run-script.

+

For example, myapp could have this:

+
{
+  "bin": {
+    "myapp": "bin/cli.js"
+  }
+}
+
+

So, when you install myapp, in case of unix-like OS it'll create a symlink +from the cli.js script to /usr/local/bin/myapp and in case of windows it +will create a cmd file usually at C:\Users\{Username}\AppData\Roaming\npm\myapp.cmd +which runs the cli.js script.

+

If you have a single executable, and its name should be the name of the +package, then you can just supply it as a string. For example:

+
{
+  "name": "my-program",
+  "version": "1.2.5",
+  "bin": "path/to/program"
+}
+
+

would be the same as this:

+
{
+  "name": "my-program",
+  "version": "1.2.5",
+  "bin": {
+    "my-program": "path/to/program"
+  }
+}
+
+

Please make sure that your file(s) referenced in bin starts with +#!/usr/bin/env node, otherwise the scripts are started without the node +executable!

+

Note that you can also set the executable files using directories.bin.

+

See folders for more info on +executables.

+

man

+

Specify either a single file or an array of filenames to put in place for +the man program to find.

+

If only a single file is provided, then it's installed such that it is the +result from man <pkgname>, regardless of its actual filename. For +example:

+
{
+  "name": "foo",
+  "version": "1.2.3",
+  "description": "A packaged foo fooer for fooing foos",
+  "main": "foo.js",
+  "man": "./man/doc.1"
+}
+
+

would link the ./man/doc.1 file in such that it is the target for man foo

+

If the filename doesn't start with the package name, then it's prefixed. +So, this:

+
{
+  "name": "foo",
+  "version": "1.2.3",
+  "description": "A packaged foo fooer for fooing foos",
+  "main": "foo.js",
+  "man": [
+    "./man/foo.1",
+    "./man/bar.1"
+  ]
+}
+
+

will create files to do man foo and man foo-bar.

+

Man files must end with a number, and optionally a .gz suffix if they are +compressed. The number dictates which man section the file is installed +into.

+
{
+  "name": "foo",
+  "version": "1.2.3",
+  "description": "A packaged foo fooer for fooing foos",
+  "main": "foo.js",
+  "man": [
+    "./man/foo.1",
+    "./man/foo.2"
+  ]
+}
+
+

will create entries for man foo and man 2 foo

+

directories

+

The CommonJS Packages spec +details a few ways that you can indicate the structure of your package +using a directories object. If you look at npm's +package.json, you'll see that it +has directories for doc, lib, and man.

+

In the future, this information may be used in other creative ways.

+

directories.bin

+

If you specify a bin directory in directories.bin, all the files in +that folder will be added.

+

Because of the way the bin directive works, specifying both a bin path +and setting directories.bin is an error. If you want to specify +individual files, use bin, and for all the files in an existing bin +directory, use directories.bin.

+

directories.man

+

A folder that is full of man pages. Sugar to generate a "man" array by +walking the folder.

+

repository

+

Specify the place where your code lives. This is helpful for people who +want to contribute. If the git repo is on GitHub, then the npm repo +command will be able to find you.

+

Do it like this:

+
{
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/npm/cli.git"
+  }
+}
+
+

The URL should be a publicly available (perhaps read-only) URL that can be +handed directly to a VCS program without any modification. It should not +be a URL to an html project page that you put in your browser. It's for +computers.

+

For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the +same shortcut syntax you use for npm install:

+
{
+  "repository": "npm/npm",
+
+  "repository": "github:user/repo",
+
+  "repository": "gist:11081aaa281",
+
+  "repository": "bitbucket:user/repo",
+
+  "repository": "gitlab:user/repo"
+}
+
+

If the package.json for your package is not in the root directory (for +example if it is part of a monorepo), you can specify the directory in +which it lives:

+
{
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/facebook/react.git",
+    "directory": "packages/react-dom"
+  }
+}
+
+

scripts

+

The "scripts" property is a dictionary containing script commands that are +run at various times in the lifecycle of your package. The key is the +lifecycle event, and the value is the command to run at that point.

+

See scripts to find out more about writing package +scripts.

+

config

+

A "config" object can be used to set configuration parameters used in +package scripts that persist across upgrades. For instance, if a package +had the following:

+
{
+  "name": "foo",
+  "config": {
+    "port": "8080"
+  }
+}
+
+

It could also have a "start" command that referenced the +npm_package_config_port environment variable.

+

dependencies

+

Dependencies are specified in a simple object that maps a package name to a +version range. The version range is a string which has one or more +space-separated descriptors. Dependencies can also be identified with a +tarball or git URL.

+

Please do not put test harnesses or transpilers or other "development" +time tools in your dependencies object. See devDependencies, below.

+

See semver for more details about specifying version ranges.

+
    +
  • version Must match version exactly
  • +
  • >version Must be greater than version
  • +
  • >=version etc
  • +
  • <version
  • +
  • <=version
  • +
  • ~version "Approximately equivalent to version" See +semver
  • +
  • ^version "Compatible with version" See semver
  • +
  • 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
  • +
  • http://... See 'URLs as Dependencies' below
  • +
  • * Matches any version
  • +
  • "" (just an empty string) Same as *
  • +
  • version1 - version2 Same as >=version1 <=version2.
  • +
  • range1 || range2 Passes if either range1 or range2 are satisfied.
  • +
  • git... See 'Git URLs as Dependencies' below
  • +
  • user/repo See 'GitHub URLs' below
  • +
  • tag A specific version tagged and published as tag See npm dist-tag
  • +
  • path/path/path See Local Paths below
  • +
+

For example, these are all valid:

+
{
+  "dependencies": {
+    "foo": "1.0.0 - 2.9999.9999",
+    "bar": ">=1.0.2 <2.1.2",
+    "baz": ">1.0.2 <=2.3.4",
+    "boo": "2.0.1",
+    "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
+    "asd": "http://asdf.com/asdf.tar.gz",
+    "til": "~1.2",
+    "elf": "~1.2.3",
+    "two": "2.x",
+    "thr": "3.3.x",
+    "lat": "latest",
+    "dyl": "file:../dyl"
+  }
+}
+
+

URLs as Dependencies

+

You may specify a tarball URL in place of a version range.

+

This tarball will be downloaded and installed locally to your package at +install time.

+

Git URLs as Dependencies

+

Git URLs are of the form:

+
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
+
+

<protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

+

If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for +a registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then the default branch is used.

+

Examples:

+
git+ssh://git@github.com:npm/cli.git#v1.0.27
+git+ssh://git@github.com:npm/cli#semver:^5.0
+git+https://isaacs@github.com/npm/cli.git
+git://github.com/npm/cli.git#v1.0.27
+
+

When installing from a git repository, the presence of certain fields in the +package.json will cause npm to believe it needs to perform a build. To do so +your repository will be cloned into a temporary directory, all of its deps +installed, relevant scripts run, and the resulting directory packed and +installed.

+

This flow will occur if your git dependency uses workspaces, or if any of the +following scripts are present:

+
    +
  • build
  • +
  • prepare
  • +
  • prepack
  • +
  • preinstall
  • +
  • install
  • +
  • postinstall
  • +
+

If your git repository includes pre-built artifacts, you will likely want to +make sure that none of the above scripts are defined, or your dependency +will be rebuilt for every installation.

+

GitHub URLs

+

As of version 1.1.65, you can refer to GitHub URLs as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

+
{
+  "name": "foo",
+  "version": "0.0.0",
+  "dependencies": {
+    "express": "expressjs/express",
+    "mocha": "mochajs/mocha#4727d357ea",
+    "module": "user/repo#feature\/branch"
+  }
+}
+
+

Local Paths

+

As of version 2.0.0 you can provide a path to a local directory that +contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

+
../foo/bar
+~/foo/bar
+./foo/bar
+/foo/bar
+
+

in which case they will be normalized to a relative path and added to your +package.json. For example:

+
{
+  "name": "baz",
+  "dependencies": {
+    "bar": "file:../foo/bar"
+  }
+}
+
+

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 your package 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 +external test or documentation framework that you use.

+

In this case, it's best to map these additional items in a +devDependencies object.

+

These things will be installed when doing npm link or npm install from +the root of a package, and can be managed like any other npm configuration +param. See config for more on the topic.

+

For build steps that are not platform-specific, such as compiling +CoffeeScript or other languages to JavaScript, use the prepare script to +do this, and make the required package a devDependency.

+

For example:

+
{
+  "name": "ethopia-waza",
+  "description": "a delightfully fruity coffee varietal",
+  "version": "1.2.3",
+  "devDependencies": {
+    "coffee-script": "~1.6.3"
+  },
+  "scripts": {
+    "prepare": "coffee -o lib/ -c src/waza.coffee"
+  },
+  "main": "lib/waza.js"
+}
+
+

The prepare script will be run before publishing, so that users can +consume the functionality without requiring them to compile it themselves. +In dev mode (ie, locally running npm install), it'll run this script as +well, so that you can test it easily.

+

peerDependencies

+

In some cases, you want to express the compatibility of your package with a +host tool or library, while not necessarily doing a require of this host. +This is usually referred to as a plugin. Notably, your module may be +exposing a specific interface, expected and specified by the host +documentation.

+

For example:

+
{
+  "name": "tea-latte",
+  "version": "1.3.5",
+  "peerDependencies": {
+    "tea": "2.x"
+  }
+}
+
+

This ensures your package tea-latte can be installed along with the +second major version of the host package tea only. npm install tea-latte could possibly yield the following dependency graph:

+
├── tea-latte@1.3.5
+└── tea@2.2.0
+
+

In npm versions 3 through 6, peerDependencies were not automatically +installed, and would raise a warning if an invalid version of the peer +dependency was found in the tree. As of npm v7, peerDependencies are +installed by default.

+

Trying to install another plugin with a conflicting requirement may cause +an error if the tree cannot be resolved correctly. For this reason, make +sure your plugin requirement is as broad as possible, and not to lock it +down to specific patch versions.

+

Assuming the host complies with semver, only changes +in the host package's major version will break your plugin. Thus, if you've +worked with every 1.x version of the host package, use "^1.0" or "1.x" +to express this. If you depend on features introduced in 1.5.2, use +"^1.5.2".

+

peerDependenciesMeta

+

The peerDependenciesMeta field serves to provide npm more information on how +your peer dependencies are to be used. Specifically, it allows peer +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed.

+

For example:

+
{
+  "name": "tea-latte",
+  "version": "1.3.5",
+  "peerDependencies": {
+    "tea": "2.x",
+    "soy-milk": "1.2"
+  },
+  "peerDependenciesMeta": {
+    "soy-milk": {
+      "optional": true
+    }
+  }
+}
+
+

bundleDependencies

+

This defines an array of package names that will be bundled when publishing +the package.

+

In cases where you need to preserve npm packages locally or have them +available through a single file download, you can bundle the packages in a +tarball file by specifying the package names in the bundleDependencies +array and executing npm pack.

+

For example:

+

If we define a package.json like this:

+
{
+  "name": "awesome-web-framework",
+  "version": "1.0.0",
+  "bundleDependencies": [
+    "renderized",
+    "super-streams"
+  ]
+}
+
+

we can obtain awesome-web-framework-1.0.0.tgz file by running npm pack. +This file contains the dependencies renderized and super-streams which +can be installed in a new project by executing npm install awesome-web-framework-1.0.0.tgz. Note that the package names do not +include any versions, as that information is specified in dependencies.

+

If this is spelled "bundledDependencies", then that is also honored.

+

Alternatively, "bundleDependencies" can be defined as a boolean value. A +value of true will bundle all dependencies, a value of false will bundle +none.

+

optionalDependencies

+

If a dependency can be used, but you would like npm to proceed if it cannot +be found or fails to install, then you may put it in the +optionalDependencies object. This is a map of package name to version or +URL, just like the dependencies object. The difference is that build +failures do not cause installation to fail. Running npm install --omit=optional will prevent these dependencies from being installed.

+

It is still your program's responsibility to handle the lack of the +dependency. For example, something like this:

+
try {
+  var foo = require('foo')
+  var fooVersion = require('foo/package.json').version
+} catch (er) {
+  foo = null
+}
+if ( notGoodFooVersion(fooVersion) ) {
+  foo = null
+}
+
+// .. then later in your program ..
+
+if (foo) {
+  foo.doFooThings()
+}
+
+

Entries in optionalDependencies will override entries of the same name in +dependencies, so it's usually best to only put in one place.

+

overrides

+

If you need to make specific changes to dependencies of your dependencies, for +example replacing the version of a dependency with a known security issue, +replacing an existing dependency with a fork, or making sure that the same +version of a package is used everywhere, then you may add an override.

+

Overrides provide a way to replace a package in your dependency tree with +another version, or another package entirely. These changes can be scoped as +specific or as vague as desired.

+

Overrides are only considered in the root package.json file for a project. +Overrides in installed dependencies (including +workspaces) are not considered in dependency tree +resolution. Published packages may dictate their resolutions by pinning +dependencies or using an +npm-shrinkwrap.json file.

+

To make sure the package foo is always installed as version 1.0.0 no matter +what version your dependencies rely on:

+
{
+  "overrides": {
+    "foo": "1.0.0"
+  }
+}
+
+

The above is a short hand notation, the full object form can be used to allow +overriding a package itself as well as a child of the package. This will cause +foo to always be 1.0.0 while also making bar at any depth beyond foo +also 1.0.0:

+
{
+  "overrides": {
+    "foo": {
+      ".": "1.0.0",
+      "bar": "1.0.0"
+    }
+  }
+}
+
+

To only override foo to be 1.0.0 when it's a child (or grandchild, or great +grandchild, etc) of the package bar:

+
{
+  "overrides": {
+    "bar": {
+      "foo": "1.0.0"
+    }
+  }
+}
+
+

Keys can be nested to any arbitrary length. To override foo only when it's a +child of bar and only when bar is a child of baz:

+
{
+  "overrides": {
+    "baz": {
+      "bar": {
+        "foo": "1.0.0"
+      }
+    }
+  }
+}
+
+

The key of an override can also include a version, or range of versions. +To override foo to 1.0.0, but only when it's a child of bar@2.0.0:

+
{
+  "overrides": {
+    "bar@2.0.0": {
+      "foo": "1.0.0"
+    }
+  }
+}
+
+

You may not set an override for a package that you directly depend on unless +both the dependency and the override itself share the exact same spec. To make +this limitation easier to deal with, overrides may also be defined as a +reference to a spec for a direct dependency by prefixing the name of the +package you wish the version to match with a $.

+
{
+  "dependencies": {
+    "foo": "^1.0.0"
+  },
+  "overrides": {
+    // BAD, will throw an EOVERRIDE error
+    // "foo": "^2.0.0"
+    // GOOD, specs match so override is allowed
+    // "foo": "^1.0.0"
+    // BEST, the override is defined as a reference to the dependency
+    "foo": "$foo",
+    // the referenced package does not need to match the overridden one
+    "bar": "$foo"
+  }
+}
+
+

engines

+

You can specify the version of node that your stuff works on:

+
{
+  "engines": {
+    "node": ">=0.10.3 <15"
+  }
+}
+
+

And, like with dependencies, if you don't specify the version (or if you +specify "*" as the version), then any version of node will do.

+

You can also use the "engines" field to specify which versions of npm are +capable of properly installing your program. For example:

+
{
+  "engines": {
+    "npm": "~1.0.20"
+  }
+}
+
+

Unless the user has set the +engine-strict config flag, this field is +advisory only and will only produce warnings when your package is installed as a +dependency.

+

os

+

You can specify which operating systems your +module will run on:

+
{
+  "os": [
+    "darwin",
+    "linux"
+  ]
+}
+
+

You can also block instead of allowing operating systems, just prepend the +blocked os with a '!':

+
{
+  "os": [
+    "!win32"
+  ]
+}
+
+

The host operating system is determined by process.platform

+

It is allowed to both block and allow an item, although there isn't any +good reason to do this.

+

cpu

+

If your code only runs on certain cpu architectures, +you can specify which ones.

+
{
+  "cpu": [
+    "x64",
+    "ia32"
+  ]
+}
+
+

Like the os option, you can also block architectures:

+
{
+  "cpu": [
+    "!arm",
+    "!mips"
+  ]
+}
+
+

The host architecture is determined by process.arch

+

private

+

If you set "private": true in your package.json, then npm will refuse to +publish it.

+

This is a way to prevent accidental publication of private repositories. +If you would like to ensure that a given package is only ever published to +a specific registry (for example, an internal registry), then use the +publishConfig dictionary described below to override the registry +config param at publish-time.

+

publishConfig

+

This is a set of config values that will be used at publish-time. It's +especially handy if you want to set the tag, registry or access, so that +you can ensure that a given package is not tagged with "latest", published +to the global public registry or that a scoped module is private by +default.

+

See config to see the list of config options that +can be overridden.

+

workspaces

+

The optional workspaces field is an array of file patterns that describes +locations within the local file system that the install client should look +up to find each workspace that needs to be +symlinked to the top level node_modules folder.

+

It can describe either the direct paths of the folders to be used as +workspaces or it can define globs that will resolve to these same folders.

+

In the following example, all folders located inside the folder +./packages will be treated as workspaces as long as they have valid +package.json files inside them:

+
{
+  "name": "workspace-example",
+  "workspaces": [
+    "./packages/*"
+  ]
+}
+
+

See workspaces for more examples.

+

DEFAULT VALUES

+

npm will default some values based on package contents.

+
    +
  • +

    "scripts": {"start": "node server.js"}

    +

    If there is a server.js file in the root of your package, then npm will +default the start command to node server.js.

    +
  • +
  • +

    "scripts":{"install": "node-gyp rebuild"}

    +

    If there is a binding.gyp file in the root of your package and you have +not defined an install or preinstall script, npm will default the +install command to compile using node-gyp.

    +
  • +
  • +

    "contributors": [...]

    +

    If there is an AUTHORS file in the root of your package, npm will treat +each line as a Name <email> (url) format, where email and url are +optional. Lines which start with a # or are blank, will be ignored.

    +
  • +
+

SEE ALSO

+
+ + +
+ + + + \ No newline at end of file diff --git a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html index f03832d0f9fd60..4882e030da6e1e 100644 --- a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html +++ b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npm-shrinkwrap.json

+

+ npm-shrinkwrap.json + @10.8.0 +

A publishable lockfile
diff --git a/deps/npm/docs/output/configuring-npm/npmrc.html b/deps/npm/docs/output/configuring-npm/npmrc.html index c33c803690c56e..60595e7cd92066 100644 --- a/deps/npm/docs/output/configuring-npm/npmrc.html +++ b/deps/npm/docs/output/configuring-npm/npmrc.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

npmrc

+

+ npmrc + @10.8.0 +

The npm config files
diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html index 3a0e58663c6ac7..ebf67c36fb2bd2 100644 --- a/deps/npm/docs/output/configuring-npm/package-json.html +++ b/deps/npm/docs/output/configuring-npm/package-json.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

package.json

+

+ package.json + @10.8.0 +

Specifics of npm's package.json handling
@@ -427,7 +435,7 @@

bin

For example, myapp could have this:

{
   "bin": {
-    "myapp": "./cli.js"
+    "myapp": "bin/cli.js"
   }
 }
 
@@ -440,7 +448,7 @@

bin

{
   "name": "my-program",
   "version": "1.2.5",
-  "bin": "./path/to/program"
+  "bin": "path/to/program"
 }
 

would be the same as this:

@@ -448,7 +456,7 @@

bin

"name": "my-program", "version": "1.2.5", "bin": { - "my-program": "./path/to/program" + "my-program": "path/to/program" } }
@@ -521,7 +529,7 @@

directories.man

walking the folder.

repository

Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on GitHub, then the npm docs +want to contribute. If the git repo is on GitHub, then the npm repo command will be able to find you.

Do it like this:

{
@@ -766,11 +774,12 @@ 

peerDependencies

to express this. If you depend on features introduced in 1.5.2, use "^1.5.2".

peerDependenciesMeta

-

When a user installs your package, npm will emit warnings if packages -specified in peerDependencies are not already installed. The -peerDependenciesMeta field serves to provide npm more information on how +

The peerDependenciesMeta field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer -dependencies to be marked as optional.

+dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed.

For example:

{
   "name": "tea-latte",
@@ -786,10 +795,6 @@ 

peerDependenciesMeta

} }
-

Marking a peer dependency as optional ensures npm will not emit a warning -if the soy-milk package is not installed on the host. This allows you to -integrate and interact with a variety of host packages without requiring -all of them to be installed.

bundleDependencies

This defines an array of package names that will be bundled when publishing the package.

diff --git a/deps/npm/docs/output/configuring-npm/package-lock-json.html b/deps/npm/docs/output/configuring-npm/package-lock-json.html index ca61021db3a36a..c0951061760ce3 100644 --- a/deps/npm/docs/output/configuring-npm/package-lock-json.html +++ b/deps/npm/docs/output/configuring-npm/package-lock-json.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

package-lock.json

+

+ package-lock.json + @10.8.0 +

A manifestation of the manifest
diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 2a3ead1b706956..8e420e6cc38997 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
-

config

+

+ config + @10.8.0 +

More than you probably want to know about npm configuration
@@ -1023,7 +1031,7 @@

progress

  • Type: Boolean
  • When set to true, npm will display a progress bar during time intensive -operations, if process.stderr is a TTY.

    +operations, if process.stderr and process.stdout are a TTY.

    Set to false to suppress the progress bar.

    provenance

      diff --git a/deps/npm/docs/output/using-npm/dependency-selectors.html b/deps/npm/docs/output/using-npm/dependency-selectors.html index 27bba15c1a2135..c2535dbc0974ae 100644 --- a/deps/npm/docs/output/using-npm/dependency-selectors.html +++ b/deps/npm/docs/output/using-npm/dependency-selectors.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      Dependency Selector Syntax & Querying

      +

      + Dependency Selector Syntax & Querying + @10.8.0 +

      Dependency Selector Syntax & Querying
      diff --git a/deps/npm/docs/output/using-npm/developers.html b/deps/npm/docs/output/using-npm/developers.html index cde04b8fb38969..039b7840e70554 100644 --- a/deps/npm/docs/output/using-npm/developers.html +++ b/deps/npm/docs/output/using-npm/developers.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      developers

      +

      + developers + @10.8.0 +

      Developer Guide
      diff --git a/deps/npm/docs/output/using-npm/logging.html b/deps/npm/docs/output/using-npm/logging.html index 0a874fd8e18939..8440dbdb0c196f 100644 --- a/deps/npm/docs/output/using-npm/logging.html +++ b/deps/npm/docs/output/using-npm/logging.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      Logging

      +

      + Logging + @10.8.0 +

      Why, What & How We Log
      diff --git a/deps/npm/docs/output/using-npm/orgs.html b/deps/npm/docs/output/using-npm/orgs.html index 0c2b69eb598711..fef8c1423d2c62 100644 --- a/deps/npm/docs/output/using-npm/orgs.html +++ b/deps/npm/docs/output/using-npm/orgs.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      orgs

      +

      + orgs + @10.8.0 +

      Working with Teams & Orgs
      diff --git a/deps/npm/docs/output/using-npm/package-spec.html b/deps/npm/docs/output/using-npm/package-spec.html index ee4f6ff55e7d85..52d706cd8480b4 100644 --- a/deps/npm/docs/output/using-npm/package-spec.html +++ b/deps/npm/docs/output/using-npm/package-spec.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      package-spec

      +

      + package-spec + @10.8.0 +

      Package name specifier
      diff --git a/deps/npm/docs/output/using-npm/registry.html b/deps/npm/docs/output/using-npm/registry.html index 8ff40109fe0a64..e5f4a30cb02113 100644 --- a/deps/npm/docs/output/using-npm/registry.html +++ b/deps/npm/docs/output/using-npm/registry.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      registry

      +

      + registry + @10.8.0 +

      The JavaScript Package Registry
      diff --git a/deps/npm/docs/output/using-npm/removal.html b/deps/npm/docs/output/using-npm/removal.html index e54187122e1f71..3ef038bfa9d151 100644 --- a/deps/npm/docs/output/using-npm/removal.html +++ b/deps/npm/docs/output/using-npm/removal.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      removal

      +

      + removal + @10.8.0 +

      Cleaning the Slate
      @@ -149,9 +157,7 @@

      Table of contents

      So sad to see you go.

      sudo npm uninstall npm -g
       
      -

      Or, if that fails, get the npm source code, and do:

      -
      sudo make uninstall
      -
      +

      Or, if that fails, please proceed to more severe uninstalling methods.

      More Severe Uninstalling

      Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed.

      diff --git a/deps/npm/docs/output/using-npm/scope.html b/deps/npm/docs/output/using-npm/scope.html index d91612e40a1e45..0e6e4d939abb55 100644 --- a/deps/npm/docs/output/using-npm/scope.html +++ b/deps/npm/docs/output/using-npm/scope.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      scope

      +

      + scope + @10.8.0 +

      Scoped packages
      diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html index 91d558e1163b5c..f37ac8bcf375e1 100644 --- a/deps/npm/docs/output/using-npm/scripts.html +++ b/deps/npm/docs/output/using-npm/scripts.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      scripts

      +

      + scripts + @10.8.0 +

      How npm handles the "scripts" field
      diff --git a/deps/npm/docs/output/using-npm/workspaces.html b/deps/npm/docs/output/using-npm/workspaces.html index 39a77dfeb583fe..f76929b19e7366 100644 --- a/deps/npm/docs/output/using-npm/workspaces.html +++ b/deps/npm/docs/output/using-npm/workspaces.html @@ -113,6 +113,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -136,7 +141,10 @@
      -

      workspaces

      +

      + workspaces + @10.8.0 +

      Working with workspaces
      diff --git a/deps/npm/lib/base-cmd.js b/deps/npm/lib/base-cmd.js index 9c30ef8a4b44e0..99ae6d7f43c70a 100644 --- a/deps/npm/lib/base-cmd.js +++ b/deps/npm/lib/base-cmd.js @@ -1,4 +1,4 @@ -const { log, output } = require('proc-log') +const { log } = require('proc-log') class BaseCommand { static workspaces = false @@ -111,33 +111,6 @@ class BaseCommand { }) } - async cmdExec (args) { - const { config } = this.npm - - if (config.get('usage')) { - return output.standard(this.usage) - } - - const hasWsConfig = config.get('workspaces') || config.get('workspace').length - // if cwd is a workspace, the default is set to [that workspace] - const implicitWs = config.get('workspace', 'default').length - - // (-ws || -w foo) && (cwd is not a workspace || command is not ignoring implicit workspaces) - if (hasWsConfig && (!implicitWs || !this.constructor.ignoreImplicitWorkspace)) { - if (this.npm.global) { - throw new Error('Workspaces not supported for global packages') - } - if (!this.constructor.workspaces) { - throw Object.assign(new Error('This command does not support workspaces.'), { - code: 'ENOWORKSPACES', - }) - } - return this.execWorkspaces(args) - } - - return this.exec(args) - } - // Compare the number of entries with what was expected checkExpected (entries) { if (!this.npm.config.isDefault('expect-results')) { diff --git a/deps/npm/lib/cli/entry.js b/deps/npm/lib/cli/entry.js index 5d676c3f0a8a10..49b13eb0234cd4 100644 --- a/deps/npm/lib/cli/entry.js +++ b/deps/npm/lib/cli/entry.js @@ -15,7 +15,8 @@ module.exports = async (process, validateEngines) => { require('graceful-fs').gracefulify(require('fs')) const satisfies = require('semver/functions/satisfies') - const exitHandler = require('./exit-handler.js') + const ExitHandler = require('./exit-handler.js') + const exitHandler = new ExitHandler({ process }) const Npm = require('../npm.js') const npm = new Npm() exitHandler.setNpm(npm) @@ -28,8 +29,7 @@ module.exports = async (process, validateEngines) => { // At this point we've required a few files and can be pretty sure we dont contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers. validateEngines.off() - process.on('uncaughtException', exitHandler) - process.on('unhandledRejection', exitHandler) + exitHandler.registerUncaughtHandlers() // It is now safe to log a warning if they are using a version of node that is not going to fail on syntax errors but is still unsupported and untested and might not work reliably. This is safe to use the logger now which we want since this will show up in the error log too. if (!satisfies(validateEngines.node, validateEngines.engines)) { @@ -42,13 +42,13 @@ module.exports = async (process, validateEngines) => { const { exec, command, args } = await npm.load() if (!exec) { - return exitHandler() + return exitHandler.exit() } if (!command) { output.standard(npm.usage) process.exitCode = 1 - return exitHandler() + return exitHandler.exit() } // Options are prefixed by a hyphen-minus (-, \u2d). @@ -72,16 +72,8 @@ module.exports = async (process, validateEngines) => { updateNotifier(npm).then((msg) => (npm.updateNotification = msg)) await execPromise - return exitHandler() + return exitHandler.exit() } catch (err) { - if (err.code === 'EUNKNOWNCOMMAND') { - const didYouMean = require('../utils/did-you-mean.js') - const suggestions = await didYouMean(npm.localPrefix, err.command) - output.standard(`Unknown command: "${err.command}"${suggestions}\n`) - output.standard('To see a list of supported npm commands, run:\n npm help') - process.exitCode = 1 - return exitHandler() - } - return exitHandler(err) + return exitHandler.exit(err) } } diff --git a/deps/npm/lib/cli/exit-handler.js b/deps/npm/lib/cli/exit-handler.js index 5866c46b57c5f0..fff95165a18de6 100644 --- a/deps/npm/lib/cli/exit-handler.js +++ b/deps/npm/lib/cli/exit-handler.js @@ -1,160 +1,173 @@ const { log, output, META } = require('proc-log') -const errorMessage = require('../utils/error-message.js') -const { redactLog: replaceInfo } = require('@npmcli/redact') +const { errorMessage, getExitCodeFromError } = require('../utils/error-message.js') -let npm = null // set by the cli -let exitHandlerCalled = false -let showLogFileError = false +class ExitHandler { + #npm = null + #process = null + #exited = false + #exitErrorMessage = false -process.on('exit', code => { - const hasLoadedNpm = npm?.config.loaded + #noNpmError = false - if (!code) { - log.info('ok') - } else { - log.verbose('code', code) + get #hasNpm () { + return !!this.#npm } - if (!exitHandlerCalled) { - process.exitCode = code || 1 - log.error('', 'Exit handler never called!') - log.error('', 'This is an error with npm itself. Please report this error at:') - log.error('', ' ') - // eslint-disable-next-line no-console - console.error('') - showLogFileError = true + get #loaded () { + return !!this.#npm?.loaded } - // npm must be loaded to know where the log file was written - if (hasLoadedNpm) { - npm.finish({ showLogFileError }) - // This removes any listeners npm setup, mostly for tests to avoid max listener warnings - npm.unload() + get #showExitErrorMessage () { + if (!this.#loaded) { + return false + } + if (!this.#exited) { + return true + } + return this.#exitErrorMessage } - // these are needed for the tests to have a clean slate in each test case - exitHandlerCalled = false - showLogFileError = false -}) + get #notLoadedOrExited () { + return !this.#loaded && !this.#exited + } -const exitHandler = err => { - exitHandlerCalled = true + setNpm (npm) { + this.#npm = npm + } - const hasLoadedNpm = npm?.config.loaded + constructor ({ process }) { + this.#process = process + this.#process.on('exit', this.#handleProcesExitAndReset) + } - if (!npm) { - err = err || new Error('Exit prior to setting npm in exit handler') - // Don't use proc-log here since npm was never set - // eslint-disable-next-line no-console - console.error(err.stack || err.message) - return process.exit(1) + registerUncaughtHandlers () { + this.#process.on('uncaughtException', this.#handleExit) + this.#process.on('unhandledRejection', this.#handleExit) } - if (!hasLoadedNpm) { - err = err || new Error('Exit prior to config file resolving.') - // Don't use proc-log here since npm was never loaded - // eslint-disable-next-line no-console - console.error(err.stack || err.message) + exit (err) { + this.#handleExit(err) } - // only show the notification if it finished. - if (typeof npm.updateNotification === 'string') { - log.notice('', npm.updateNotification, { [META]: true, force: true }) + #handleProcesExitAndReset = (code) => { + this.#handleProcessExit(code) + + // Reset all the state. This is only relevant for tests since + // in reality the process fully exits here. + this.#process.off('exit', this.#handleProcesExitAndReset) + this.#process.off('uncaughtException', this.#handleExit) + this.#process.off('unhandledRejection', this.#handleExit) + if (this.#loaded) { + this.#npm.unload() + } + this.#npm = null + this.#exited = false + this.#exitErrorMessage = false } - let exitCode = process.exitCode || 0 - let noLogMessage = exitCode !== 0 - let jsonError - - if (err) { - exitCode = 1 - // if we got a command that just shells out to something else, then it - // will presumably print its own errors and exit with a proper status - // code if there's a problem. If we got an error with a code=0, then... - // something else went wrong along the way, so maybe an npm problem? - const isShellout = npm.isShellout - const quietShellout = isShellout && typeof err.code === 'number' && err.code - if (quietShellout) { - exitCode = err.code - noLogMessage = true - } else if (typeof err === 'string') { - // XXX: we should stop throwing strings - log.error('', err) - noLogMessage = true - } else if (!(err instanceof Error)) { - log.error('weird error', err) - noLogMessage = true - } else { - const os = require('node:os') - const fs = require('node:fs') - if (!err.code) { - const matchErrorCode = err.message.match(/^(?:Error: )?(E[A-Z]+)/) - err.code = matchErrorCode && matchErrorCode[1] - } + #handleProcessExit (code) { + // Force exit code to a number if it has not been set + const exitCode = typeof code === 'number' ? code : (this.#exited ? 0 : 1) + this.#process.exitCode = exitCode - for (const k of ['type', 'stack', 'statusCode', 'pkgid']) { - const v = err[k] - if (v) { - log.verbose(k, replaceInfo(v)) - } - } + if (this.#notLoadedOrExited) { + // Exit handler was not called and npm was not loaded so we have to log something + this.#logConsoleError(new Error(`Process exited unexpectedly with code: ${exitCode}`)) + return + } - log.verbose('cwd', process.cwd()) - log.verbose('', os.type() + ' ' + os.release()) - log.verbose('node', process.version) - log.verbose('npm ', 'v' + npm.version) + if (this.#logNoNpmError()) { + return + } - for (const k of ['code', 'syscall', 'file', 'path', 'dest', 'errno']) { - const v = err[k] - if (v) { - log.error(k, v) - } - } + const os = require('node:os') + log.verbose('cwd', this.#process.cwd()) + log.verbose('os', `${os.type()} ${os.release()}`) + log.verbose('node', this.#process.version) + log.verbose('npm ', `v${this.#npm.version}`) - const { summary, detail, json, files = [] } = errorMessage(err, npm) - jsonError = json - - for (let [file, content] of files) { - file = `${npm.logPath}${file}` - content = `'Log files:\n${npm.logFiles.join('\n')}\n\n${content.trim()}\n` - try { - fs.writeFileSync(file, content) - detail.push(['', `\n\nFor a full report see:\n${file}`]) - } catch (logFileErr) { - log.warn('', `Could not write error message to ${file} due to ${logFileErr}`) - } - } + // only show the notification if it finished + if (typeof this.#npm.updateNotification === 'string') { + log.notice('', this.#npm.updateNotification, { [META]: true, force: true }) + } - for (const errline of [...summary, ...detail]) { - log.error(...errline) + if (!this.#exited) { + log.error('', 'Exit handler never called!') + log.error('', 'This is an error with npm itself. Please report this error at:') + log.error('', ' ') + if (this.#npm.silent) { + output.error('') } + } - if (typeof err.errno === 'number') { - exitCode = err.errno - } else if (typeof err.code === 'number') { - exitCode = err.code - } + log.verbose('exit', exitCode) + + if (exitCode) { + log.verbose('code', exitCode) + } else { + log.info('ok') + } + + if (this.#showExitErrorMessage) { + log.error('', this.#npm.exitErrorMessage()) } } - if (hasLoadedNpm) { - output.flush({ [META]: true, jsonError }) + #logConsoleError (err) { + // Run our error message formatters on all errors even if we + // have no npm or an unloaded npm. This will clean the error + // and possible return a formatted message about EACCESS or something. + const { summary, detail } = errorMessage(err, this.#npm) + const formatted = [...new Set([...summary, ...detail].flat().filter(Boolean))].join('\n') + // If we didn't get anything from the formatted message then just display the full stack + // eslint-disable-next-line no-console + console.error(formatted === err.message ? err.stack : formatted) } - log.verbose('exit', exitCode || 0) + #logNoNpmError (err) { + if (this.#hasNpm) { + return false + } + // Make sure we only log this error once + if (!this.#noNpmError) { + this.#noNpmError = true + this.#logConsoleError( + new Error(`Exit prior to setting npm in exit handler`, err ? { cause: err } : {}) + ) + } + return true + } + + #handleExit = (err) => { + this.#exited = true + + // No npm at all + if (this.#logNoNpmError(err)) { + return this.#process.exit(this.#process.exitCode || getExitCodeFromError(err) || 1) + } - showLogFileError = (hasLoadedNpm && npm.silent) || noLogMessage - ? false - : !!exitCode + // npm was never loaded but we still might have a config loading error or + // something similar that we can run through the error message formatter + // to give the user a clue as to what happened.s + if (!this.#loaded) { + this.#logConsoleError(new Error('Exit prior to config file resolving', { cause: err })) + return this.#process.exit(this.#process.exitCode || getExitCodeFromError(err) || 1) + } + + this.#exitErrorMessage = err?.suppressError === true ? false : !!err - // explicitly call process.exit now so we don't hang on things like the - // update notifier, also flush stdout/err beforehand because process.exit doesn't - // wait for that to happen. - let flushed = 0 - const flush = [process.stderr, process.stdout] - const exit = () => ++flushed === flush.length && process.exit(exitCode) - flush.forEach((f) => f.write('', exit)) + // Prefer the exit code of the error, then the current process exit code, + // then set it to 1 if we still have an error. Otherwise we call process.exit + // with undefined so that it can determine the final exit code + const exitCode = err?.exitCode ?? this.#process.exitCode ?? (err ? 1 : undefined) + + // explicitly call process.exit now so we don't hang on things like the + // update notifier, also flush stdout/err beforehand because process.exit doesn't + // wait for that to happen. + this.#process.stderr.write('', () => this.#process.stdout.write('', () => { + this.#process.exit(exitCode) + })) + } } -module.exports = exitHandler -module.exports.setNpm = n => (npm = n) +module.exports = ExitHandler diff --git a/deps/npm/lib/commands/access.js b/deps/npm/lib/commands/access.js index d35699e839109c..dad0c405f713b4 100644 --- a/deps/npm/lib/commands/access.js +++ b/deps/npm/lib/commands/access.js @@ -3,7 +3,7 @@ const npa = require('npm-package-arg') const { output } = require('proc-log') const pkgJson = require('@npmcli/package-json') const localeCompare = require('@isaacs/string-locale-compare')('en') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const getIdentity = require('../utils/get-identity.js') const BaseCommand = require('../base-cmd.js') diff --git a/deps/npm/lib/commands/audit.js b/deps/npm/lib/commands/audit.js index aed1be7a82906b..486bef1bb5dc11 100644 --- a/deps/npm/lib/commands/audit.js +++ b/deps/npm/lib/commands/audit.js @@ -90,7 +90,7 @@ class Audit extends ArboristWorkspaceCmd { ) } - log.verbose('loading installed dependencies') + log.verbose('audit', 'loading installed dependencies') const Arborist = require('@npmcli/arborist') const opts = { ...this.npm.flatOptions, diff --git a/deps/npm/lib/commands/cache.js b/deps/npm/lib/commands/cache.js index 108c261ffe57d5..d23c51c3902875 100644 --- a/deps/npm/lib/commands/cache.js +++ b/deps/npm/lib/commands/cache.js @@ -132,7 +132,7 @@ class Cache extends BaseCommand { try { entry = await cacache.get(cachePath, key) } catch (err) { - log.warn(`Not Found: ${key}`) + log.warn('cache', `Not Found: ${key}`) break } output.standard(`Deleted: ${key}`) diff --git a/deps/npm/lib/commands/config.js b/deps/npm/lib/commands/config.js index 7fb8476276937b..e8da195204c00f 100644 --- a/deps/npm/lib/commands/config.js +++ b/deps/npm/lib/commands/config.js @@ -7,17 +7,36 @@ const pkgJson = require('@npmcli/package-json') const { defaults, definitions } = require('@npmcli/config/lib/definitions') const { log, output } = require('proc-log') const BaseCommand = require('../base-cmd.js') +const { redact } = require('@npmcli/redact') // These are the configs that we can nerf-dart. Not all of them currently even -// *have* config definitions so we have to explicitly validate them here +// *have* config definitions so we have to explicitly validate them here. +// This is used to validate during "npm config set" const nerfDarts = [ '_auth', '_authToken', - 'username', '_password', + 'certfile', 'email', + 'keyfile', + 'username', +] +// These are the config values to swap with "protected". It does not catch +// every single sensitive thing a user may put in the npmrc file but it gets +// the common ones. This is distinct from nerfDarts because that is used to +// validate valid configs during "npm config set", and folks may have old +// invalid entries lying around in a config file that we still want to protect +// when running "npm config list" +// This is a more general list of values to consider protected. You can not +// "npm config get" them, and they will not display during "npm config list" +const protected = [ + 'auth', + 'authToken', 'certfile', + 'email', 'keyfile', + 'password', + 'username', ] // take an array of `[key, value, k2=v2, k3, v3, ...]` and turn into @@ -35,18 +54,35 @@ const keyValues = args => { return kv } -const publicVar = k => { +const isProtected = (k) => { // _password if (k.startsWith('_')) { - return false + return true + } + if (protected.includes(k)) { + return true } // //localhost:8080/:_password - if (k.startsWith('//') && k.includes(':_')) { - return false + if (k.startsWith('//')) { + if (k.includes(':_')) { + return true + } + // //registry:_authToken or //registry:authToken + for (const p of protected) { + if (k.endsWith(`:${p}`) || k.endsWith(`:_${p}`)) { + return true + } + } } - return true + return false } +// Private fields are either protected or they can redacted info +const isPrivate = (k, v) => isProtected(k) || redact(v) !== v + +const displayVar = (k, v) => + `${k} = ${isProtected(k, v) ? '(protected)' : JSON.stringify(redact(v))}` + class Config extends BaseCommand { static description = 'Manage the npm configuration files' static name = 'config' @@ -177,12 +213,13 @@ class Config extends BaseCommand { const out = [] for (const key of keys) { - if (!publicVar(key)) { + const val = this.npm.config.get(key) + if (isPrivate(key, val)) { throw new Error(`The ${key} option is protected, and can not be retrieved in this way`) } const pref = keys.length > 1 ? `${key}=` : '' - out.push(pref + this.npm.config.get(key)) + out.push(pref + val) } output.standard(out.join('\n')) } @@ -309,18 +346,17 @@ ${defData} continue } - const keys = Object.keys(data).sort(localeCompare) - if (!keys.length) { + const entries = Object.entries(data).sort(([a], [b]) => localeCompare(a, b)) + if (!entries.length) { continue } msg.push(`; "${where}" config from ${source}`, '') - for (const k of keys) { - const v = publicVar(k) ? JSON.stringify(data[k]) : '(protected)' + for (const [k, v] of entries) { + const display = displayVar(k, v) const src = this.npm.config.find(k) - const overridden = src !== where - msg.push((overridden ? '; ' : '') + - `${k} = ${v} ${overridden ? `; overridden by ${src}` : ''}`) + msg.push(src === where ? display : `; ${display} ; overridden by ${src}`) + msg.push() } msg.push('') } @@ -345,10 +381,10 @@ ${defData} const pkgPath = resolve(this.npm.prefix, 'package.json') msg.push(`; "publishConfig" from ${pkgPath}`) msg.push('; This set of config values will be used at publish-time.', '') - const pkgKeys = Object.keys(content.publishConfig).sort(localeCompare) - for (const k of pkgKeys) { - const v = publicVar(k) ? JSON.stringify(content.publishConfig[k]) : '(protected)' - msg.push(`${k} = ${v}`) + const entries = Object.entries(content.publishConfig) + .sort(([a], [b]) => localeCompare(a, b)) + for (const [k, value] of entries) { + msg.push(displayVar(k, value)) } msg.push('') } @@ -360,11 +396,12 @@ ${defData} async listJson () { const publicConf = {} for (const key in this.npm.config.list[0]) { - if (!publicVar(key)) { + const value = this.npm.config.get(key) + if (isPrivate(key, value)) { continue } - publicConf[key] = this.npm.config.get(key) + publicConf[key] = value } output.standard(JSON.stringify(publicConf, null, 2)) } diff --git a/deps/npm/lib/commands/deprecate.js b/deps/npm/lib/commands/deprecate.js index 58856538fe23f2..977fd9fce11dac 100644 --- a/deps/npm/lib/commands/deprecate.js +++ b/deps/npm/lib/commands/deprecate.js @@ -1,6 +1,7 @@ const fetch = require('npm-registry-fetch') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const npa = require('npm-package-arg') +const { log } = require('proc-log') const semver = require('semver') const getIdentity = require('../utils/get-identity.js') const libaccess = require('libnpmaccess') @@ -66,6 +67,8 @@ class Deprecate extends BaseCommand { body: packument, ignoreBody: true, })) + } else { + log.warn('deprecate', 'No version found for', p.rawSpec) } } } diff --git a/deps/npm/lib/commands/dist-tag.js b/deps/npm/lib/commands/dist-tag.js index e13f9ecf59c7fe..663f0eb44a26ad 100644 --- a/deps/npm/lib/commands/dist-tag.js +++ b/deps/npm/lib/commands/dist-tag.js @@ -2,7 +2,7 @@ const npa = require('npm-package-arg') const regFetch = require('npm-registry-fetch') const semver = require('semver') const { log, output } = require('proc-log') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const pkgJson = require('@npmcli/package-json') const BaseCommand = require('../base-cmd.js') diff --git a/deps/npm/lib/commands/fund.js b/deps/npm/lib/commands/fund.js index 8bcd184e709683..8bb4c304b379ba 100644 --- a/deps/npm/lib/commands/fund.js +++ b/deps/npm/lib/commands/fund.js @@ -5,8 +5,7 @@ const { output } = require('proc-log') const npa = require('npm-package-arg') const { depth } = require('treeverse') const { readTree: getFundingInfo, normalizeFunding, isValidFunding } = require('libnpmfund') - -const openUrl = require('../utils/open-url.js') +const { openUrl } = require('../utils/open-url.js') const ArboristWorkspaceCmd = require('../arborist-cmd.js') const getPrintableName = ({ name, version }) => { diff --git a/deps/npm/lib/commands/help.js b/deps/npm/lib/commands/help.js index fb3fe664e017df..a2307bf1d8a2c9 100644 --- a/deps/npm/lib/commands/help.js +++ b/deps/npm/lib/commands/help.js @@ -1,8 +1,8 @@ const spawn = require('@npmcli/promise-spawn') const path = require('path') -const openUrl = require('../utils/open-url.js') +const { openUrl } = require('../utils/open-url.js') const { glob } = require('glob') -const { output } = require('proc-log') +const { output, input } = require('proc-log') const localeCompare = require('@isaacs/string-locale-compare')('en') const { deref } = require('../utils/cmd-list.js') const BaseCommand = require('../base-cmd.js') @@ -95,13 +95,15 @@ class Help extends BaseCommand { args = ['emacsclient', ['-e', `(woman-find-file '${man}')`]] } - return spawn(...args, { stdio: 'inherit' }).catch(err => { + try { + await input.start(() => spawn(...args, { stdio: 'inherit' })) + } catch (err) { if (err.code) { throw new Error(`help process exited with code: ${err.code}`) } else { throw err } - }) + } } // Returns the path to the html version of the man page diff --git a/deps/npm/lib/commands/hook.js b/deps/npm/lib/commands/hook.js index 3b91ff539081a9..43da92f3f9e6c6 100644 --- a/deps/npm/lib/commands/hook.js +++ b/deps/npm/lib/commands/hook.js @@ -1,5 +1,5 @@ const hookApi = require('libnpmhook') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const relativeDate = require('tiny-relative-date') const { output } = require('proc-log') const BaseCommand = require('../base-cmd.js') diff --git a/deps/npm/lib/commands/ls.js b/deps/npm/lib/commands/ls.js index 51e99f429816a9..7dbe14fea20bc3 100644 --- a/deps/npm/lib/commands/ls.js +++ b/deps/npm/lib/commands/ls.js @@ -554,7 +554,7 @@ const jsonOutput = ({ path, problems, result, rootError, seenItems }) => { } } - return JSON.stringify(result, null, 2) + return result } const parseableOutput = ({ global, long, seenNodes }) => { diff --git a/deps/npm/lib/commands/org.js b/deps/npm/lib/commands/org.js index af67547a643db2..caebadbc545e7e 100644 --- a/deps/npm/lib/commands/org.js +++ b/deps/npm/lib/commands/org.js @@ -1,5 +1,5 @@ const liborg = require('libnpmorg') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const BaseCommand = require('../base-cmd.js') const { output } = require('proc-log') diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js index 188065583198d0..0f12cf9293c30c 100644 --- a/deps/npm/lib/commands/owner.js +++ b/deps/npm/lib/commands/owner.js @@ -2,7 +2,7 @@ const npa = require('npm-package-arg') const npmFetch = require('npm-registry-fetch') const pacote = require('pacote') const { log, output } = require('proc-log') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const pkgJson = require('@npmcli/package-json') const BaseCommand = require('../base-cmd.js') const { redact } = require('@npmcli/redact') diff --git a/deps/npm/lib/commands/pack.js b/deps/npm/lib/commands/pack.js index f64a21dcc0d9de..79e7f49f819ecc 100644 --- a/deps/npm/lib/commands/pack.js +++ b/deps/npm/lib/commands/pack.js @@ -53,18 +53,16 @@ class Pack extends BaseCommand { prefix: this.npm.localPrefix, workspaces: this.workspacePaths, }) - const pkgContents = await getContents(manifest, tarballData) - tarballs.push(pkgContents) + tarballs.push(await getContents(manifest, tarballData)) } - if (json) { - output.standard(JSON.stringify(tarballs, null, 2)) - return - } - - for (const tar of tarballs) { - logTar(tar, { unicode }) - output.standard(tar.filename.replace(/^@/, '').replace(/\//, '-')) + for (const [index, tar] of Object.entries(tarballs)) { + // XXX(BREAKING_CHANGE): publish outputs a json object with package + // names as keys. Pack should do the same here instead of an array + logTar(tar, { unicode, json, key: index }) + if (!json) { + output.standard(tar.filename.replace(/^@/, '').replace(/\//, '-')) + } } } diff --git a/deps/npm/lib/commands/pkg.js b/deps/npm/lib/commands/pkg.js index 62553b15103e3b..a108d79c515172 100644 --- a/deps/npm/lib/commands/pkg.js +++ b/deps/npm/lib/commands/pkg.js @@ -25,13 +25,7 @@ class Pkg extends BaseCommand { static workspaces = true static ignoreImplicitWorkspace = false - async exec (args, { prefix } = {}) { - if (!prefix) { - this.prefix = this.npm.localPrefix - } else { - this.prefix = prefix - } - + async exec (args, { path = this.npm.localPrefix, workspace } = {}) { if (this.npm.global) { throw Object.assign( new Error(`There's no package.json file to manage on global mode`), @@ -42,13 +36,13 @@ class Pkg extends BaseCommand { const [cmd, ..._args] = args switch (cmd) { case 'get': - return this.get(_args) + return this.get(_args, { path, workspace }) case 'set': - return this.set(_args) + return this.set(_args, { path, workspace }).then(p => p.save()) case 'delete': - return this.delete(_args) + return this.delete(_args, { path, workspace }).then(p => p.save()) case 'fix': - return this.fix(_args) + return PackageJson.fix(path).then(p => p.save()) default: throw this.usageError() } @@ -56,43 +50,40 @@ class Pkg extends BaseCommand { async execWorkspaces (args) { await this.setWorkspaces() - const result = {} - for (const [workspaceName, workspacePath] of this.workspaces.entries()) { - this.prefix = workspacePath - result[workspaceName] = await this.exec(args, { prefix: workspacePath }) + for (const [workspace, path] of this.workspaces.entries()) { + await this.exec(args, { path, workspace }) } - // when running in workspaces names, make sure to key by workspace - // name the results of each value retrieved in each ws - output.standard(JSON.stringify(result, null, 2)) } - async get (args) { - const pkgJson = await PackageJson.load(this.prefix) - - const { content } = pkgJson - let result = !args.length && content + async get (args, { path, workspace }) { + this.npm.config.set('json', true) + const pkgJson = await PackageJson.load(path) - if (!result) { - const q = new Queryable(content) - result = q.query(args) + let unwrap = false + let result = pkgJson.content + if (args.length) { + result = new Queryable(result).query(args) // in case there's only a single result from the query // just prints that one element to stdout if (Object.keys(result).length === 1) { + unwrap = true result = result[args] } } - // only outputs if not running with workspaces config - // execWorkspaces will handle the output otherwise - if (!this.workspaces) { - output.standard(JSON.stringify(result, null, 2)) + if (workspace) { + // workspaces are always json + output.buffer({ [workspace]: result }) + } else { + // if the result was unwrapped, stringify as json which will add quotes around strings + // TODO: https://github.com/npm/cli/issues/5508 a raw mode has been requested similar + // to jq -r. If that was added then it would conditionally not call JSON.stringify here + output.buffer(unwrap ? JSON.stringify(result) : result) } - - return result } - async set (args) { + async set (args, { path }) { const setError = () => this.usageError('npm pkg set expects a key=value pair of args.') @@ -102,7 +93,7 @@ class Pkg extends BaseCommand { const force = this.npm.config.get('force') const json = this.npm.config.get('json') - const pkgJson = await PackageJson.load(this.prefix) + const pkgJson = await PackageJson.load(path) const q = new Queryable(pkgJson.content) for (const arg of args) { const [key, ...rest] = arg.split('=') @@ -114,11 +105,10 @@ class Pkg extends BaseCommand { q.set(key, json ? JSON.parse(value) : value, { force }) } - pkgJson.update(q.toJSON()) - await pkgJson.save() + return pkgJson.update(q.toJSON()) } - async delete (args) { + async delete (args, { path }) { const setError = () => this.usageError('npm pkg delete expects key args.') @@ -126,7 +116,7 @@ class Pkg extends BaseCommand { throw setError() } - const pkgJson = await PackageJson.load(this.prefix) + const pkgJson = await PackageJson.load(path) const q = new Queryable(pkgJson.content) for (const key of args) { if (!key) { @@ -136,13 +126,7 @@ class Pkg extends BaseCommand { q.delete(key) } - pkgJson.update(q.toJSON()) - await pkgJson.save() - } - - async fix () { - const pkgJson = await PackageJson.fix(this.prefix) - await pkgJson.save() + return pkgJson.update(q.toJSON()) } } diff --git a/deps/npm/lib/commands/profile.js b/deps/npm/lib/commands/profile.js index 8eae6278549f56..adf534730de243 100644 --- a/deps/npm/lib/commands/profile.js +++ b/deps/npm/lib/commands/profile.js @@ -1,9 +1,9 @@ const { inspect } = require('util') const { URL } = require('url') const { log, output } = require('proc-log') -const npmProfile = require('npm-profile') +const { get, set, createToken } = require('npm-profile') const qrcodeTerminal = require('qrcode-terminal') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const readUserInfo = require('../utils/read-user-info.js') const BaseCommand = require('../base-cmd.js') @@ -101,7 +101,7 @@ class Profile extends BaseCommand { async get (args) { const tfa = 'two-factor auth' - const info = await npmProfile.get({ ...this.npm.flatOptions }) + const info = await get({ ...this.npm.flatOptions }) if (!info.cidr_whitelist) { delete info.cidr_whitelist @@ -199,7 +199,7 @@ class Profile extends BaseCommand { } // FIXME: Work around to not clear everything other than what we're setting - const user = await npmProfile.get(conf) + const user = await get(conf) const newUser = {} for (const key of writableProfileKeys) { @@ -208,7 +208,7 @@ class Profile extends BaseCommand { newUser[prop] = value - const result = await otplease(this.npm, conf, c => npmProfile.set(newUser, c)) + const result = await otplease(this.npm, conf, c => set(newUser, c)) if (this.npm.config.get('json')) { output.standard(JSON.stringify({ [prop]: result[prop] }, null, 2)) @@ -273,7 +273,7 @@ class Profile extends BaseCommand { if (auth.basic) { log.info('profile', 'Updating authentication to bearer token') - const result = await npmProfile.createToken( + const result = await createToken( auth.basic.password, false, [], { ...this.npm.flatOptions } ) @@ -297,12 +297,12 @@ class Profile extends BaseCommand { info.tfa.password = password log.info('profile', 'Determine if tfa is pending') - const userInfo = await npmProfile.get({ ...this.npm.flatOptions }) + const userInfo = await get({ ...this.npm.flatOptions }) const conf = { ...this.npm.flatOptions } if (userInfo && userInfo.tfa && userInfo.tfa.pending) { log.info('profile', 'Resetting two-factor authentication') - await npmProfile.set({ tfa: { password, mode: 'disable' } }, conf) + await set({ tfa: { password, mode: 'disable' } }, conf) } else if (userInfo && userInfo.tfa) { if (!conf.otp) { conf.otp = await readUserInfo.otp( @@ -312,7 +312,7 @@ class Profile extends BaseCommand { } log.info('profile', 'Setting two-factor authentication to ' + mode) - const challenge = await npmProfile.set(info, conf) + const challenge = await set(info, conf) if (challenge.tfa === null) { output.standard('Two factor authentication mode changed to: ' + mode) @@ -341,7 +341,7 @@ class Profile extends BaseCommand { log.info('profile', 'Finalizing two-factor authentication') - const result = await npmProfile.set({ tfa: [interactiveOTP] }, conf) + const result = await set({ tfa: [interactiveOTP] }, conf) output.standard( '2FA successfully enabled. Below are your recovery codes, ' + @@ -359,7 +359,7 @@ class Profile extends BaseCommand { async disable2fa () { const conf = { ...this.npm.flatOptions } - const info = await npmProfile.get(conf) + const info = await get(conf) if (!info.tfa || info.tfa.pending) { output.standard('Two factor authentication not enabled.') @@ -375,7 +375,7 @@ class Profile extends BaseCommand { log.info('profile', 'disabling tfa') - await npmProfile.set({ tfa: { password: password, mode: 'disable' } }, conf) + await set({ tfa: { password: password, mode: 'disable' } }, conf) if (this.npm.config.get('json')) { output.standard(JSON.stringify({ tfa: false }, null, 2)) diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js index 6bb2dcc6614bb2..6f893b929284bf 100644 --- a/deps/npm/lib/commands/publish.js +++ b/deps/npm/lib/commands/publish.js @@ -7,7 +7,7 @@ const pacote = require('pacote') const npa = require('npm-package-arg') const npmFetch = require('npm-registry-fetch') const { redactLog: replaceInfo } = require('@npmcli/redact') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const { getContents, logTar } = require('../utils/tar.js') // for historical reasons, publishConfig in package.json can contain ANY config // keys that npm supports in .npmrc files and elsewhere. We *may* want to @@ -43,6 +43,26 @@ class Publish extends BaseCommand { throw this.usageError() } + await this.#publish(args) + } + + async execWorkspaces () { + await this.setWorkspaces() + + for (const [name, workspace] of this.workspaces.entries()) { + try { + await this.#publish([workspace], { workspace: name }) + } catch (err) { + if (err.code !== 'EPRIVATE') { + throw err + } + // eslint-disable-next-line max-len + log.warn('publish', `Skipping workspace ${this.npm.chalk.cyan(name)}, marked as ${this.npm.chalk.bold('private')}`) + } + } + } + + async #publish (args, { workspace } = {}) { log.verbose('publish', replaceInfo(args)) const unicode = this.npm.config.get('unicode') @@ -61,7 +81,7 @@ class Publish extends BaseCommand { // you can publish name@version, ./foo.tgz, etc. // even though the default is the 'file:.' cwd. const spec = npa(args[0]) - let manifest = await this.getManifest(spec, opts) + let manifest = await this.#getManifest(spec, opts) // only run scripts for directory type publishes if (spec.type === 'directory' && !ignoreScripts) { @@ -84,18 +104,24 @@ class Publish extends BaseCommand { workspaces: this.workspacePaths, }) const pkgContents = await getContents(manifest, tarballData) + const logPkg = () => logTar(pkgContents, { unicode, json, key: workspace }) // The purpose of re-reading the manifest is in case it changed, // so that we send the latest and greatest thing to the registry // note that publishConfig might have changed as well! - manifest = await this.getManifest(spec, opts, true) + manifest = await this.#getManifest(spec, opts, true) - // JSON already has the package contents + // If we are not in JSON mode then we show the user the contents of the tarball + // before it is published so they can see it while their otp is pending if (!json) { - logTar(pkgContents, { unicode }) + logPkg() } const resolved = npa.resolve(manifest.name, manifest.version) + + // make sure tag is valid, this will throw if invalid + npa(`${manifest.name}@${defaultTag}`) + const registry = npmFetch.pickRegistry(resolved, opts) const creds = this.npm.config.getCredentialsByURI(registry) const noCreds = !(creds.token || creds.username || creds.certfile && creds.keyfile) @@ -122,6 +148,12 @@ class Publish extends BaseCommand { await otplease(this.npm, opts, o => libpub(manifest, tarballData, o)) } + // In json mode we dont log until the publish has completed as this will + // add it to the output only if completes successfully + if (json) { + logPkg() + } + if (spec.type === 'directory' && !ignoreScripts) { await runScript({ event: 'publish', @@ -138,62 +170,15 @@ class Publish extends BaseCommand { }) } - if (!this.suppressOutput) { - if (!silent && json) { - output.standard(JSON.stringify(pkgContents, null, 2)) - } else if (!silent) { - output.standard(`+ ${pkgContents.id}`) - } - } - - return pkgContents - } - - async execWorkspaces () { - // Suppresses JSON output in publish() so we can handle it here - this.suppressOutput = true - - const results = {} - const json = this.npm.config.get('json') - const { silent } = this.npm - await this.setWorkspaces() - - for (const [name, workspace] of this.workspaces.entries()) { - let pkgContents - try { - pkgContents = await this.exec([workspace]) - } catch (err) { - if (err.code === 'EPRIVATE') { - log.warn( - 'publish', - `Skipping workspace ${ - this.npm.chalk.cyan(name) - }, marked as ${ - this.npm.chalk.bold('private') - }` - ) - continue - } - throw err - } - // This needs to be in-line w/ the rest of the output that non-JSON - // publish generates - if (!silent && !json) { - output.standard(`+ ${pkgContents.id}`) - } else { - results[name] = pkgContents - } - } - - if (!silent && json) { - output.standard(JSON.stringify(results, null, 2)) + if (!json && !silent) { + output.standard(`+ ${pkgContents.id}`) } } // if it's a directory, read it from the file system // otherwise, get the full metadata from whatever it is // XXX can't pacote read the manifest from a directory? - async getManifest (spec, opts, logWarnings = false) { + async #getManifest (spec, opts, logWarnings = false) { let manifest if (spec.type === 'directory') { const changes = [] diff --git a/deps/npm/lib/commands/run-script.js b/deps/npm/lib/commands/run-script.js index dd00c98fc8b6ec..180dfa1cdeac5c 100644 --- a/deps/npm/lib/commands/run-script.js +++ b/deps/npm/lib/commands/run-script.js @@ -1,6 +1,8 @@ -const { log, output } = require('proc-log') +const { output } = require('proc-log') const pkgJson = require('@npmcli/package-json') const BaseCommand = require('../base-cmd.js') +const { getError } = require('../utils/error-message.js') +const { outputError } = require('../utils/output-error.js') class RunScript extends BaseCommand { static description = 'Run arbitrary package scripts' @@ -34,27 +36,54 @@ class RunScript extends BaseCommand { async exec (args) { if (args.length) { - return this.run(args) + await this.#run(args, { path: this.npm.localPrefix }) } else { - return this.list(args) + await this.#list(this.npm.localPrefix) } } async execWorkspaces (args) { - if (args.length) { - return this.runWorkspaces(args) - } else { - return this.listWorkspaces(args) + await this.setWorkspaces() + + const ws = [...this.workspaces.entries()] + for (const [workspace, path] of ws) { + const last = path === ws.at(-1)[1] + + if (!args.length) { + const newline = await this.#list(path, { workspace }) + if (newline && !last) { + output.standard('') + } + continue + } + + const pkg = await pkgJson.normalize(path).then(p => p.content) + try { + await this.#run(args, { path, pkg, workspace }) + } catch (e) { + const err = getError(e, { npm: this.npm, command: null }) + outputError({ + ...err, + error: [ + ['', `Lifecycle script \`${args[0]}\` failed with error:`], + ...err.error, + ['workspace', pkg._id || pkg.name], + ['location', path], + ], + }) + process.exitCode = err.exitCode + if (!last) { + output.error('') + } + } } } - async run ([event, ...args], { path = this.npm.localPrefix, pkg } = {}) { + async #run ([event, ...args], { path, pkg, workspace }) { const runScript = require('@npmcli/run-script') - if (!pkg) { - const { content } = await pkgJson.normalize(path) - pkg = content - } + pkg ??= await pkgJson.normalize(path).then(p => p.content) + const { scripts = {} } = pkg if (event === 'restart' && !scripts.restart) { @@ -74,11 +103,15 @@ class RunScript extends BaseCommand { return } - const didYouMean = require('../utils/did-you-mean.js') - const suggestions = await didYouMean(path, event) - throw new Error( - `Missing script: "${event}"${suggestions}\n\nTo see a list of scripts, run:\n npm run` - ) + const suggestions = require('../utils/did-you-mean.js')(pkg, event) + const wsArg = workspace && path !== this.npm.localPrefix + ? ` --workspace=${pkg._id || pkg.name}` + : '' + throw new Error([ + `Missing script: "${event}"${suggestions}\n`, + 'To see a list of scripts, run:', + ` npm run${wsArg}`, + ].join('\n')) } // positional args only added to the main event, not pre/post @@ -107,31 +140,29 @@ class RunScript extends BaseCommand { } } - async list (args, path) { - /* eslint-disable-next-line max-len */ - const { content: { scripts, name, _id } } = await pkgJson.normalize(path || this.npm.localPrefix) - const pkgid = _id || name - - if (!scripts) { - return [] - } + async #list (path, { workspace } = {}) { + const { scripts = {}, name, _id } = await pkgJson.normalize(path).then(p => p.content) + const scriptEntries = Object.entries(scripts) - const allScripts = Object.keys(scripts) if (this.npm.silent) { - return allScripts + return } if (this.npm.config.get('json')) { - output.standard(JSON.stringify(scripts, null, 2)) - return allScripts + output.buffer(workspace ? { [workspace]: scripts } : scripts) + return } - if (this.npm.config.get('parseable')) { - for (const [script, cmd] of Object.entries(scripts)) { - output.standard(`${script}:${cmd}`) - } + if (!scriptEntries.length) { + return + } - return allScripts + if (this.npm.config.get('parseable')) { + output.standard(scriptEntries + .map((s) => (workspace ? [workspace, ...s] : s).join(':')) + .join('\n') + .trim()) + return } // TODO this is missing things like prepare, prepublishOnly, and dependencies @@ -145,96 +176,39 @@ class RunScript extends BaseCommand { 'preuninstall', 'uninstall', 'postuninstall', 'preversion', 'version', 'postversion', ] - const indent = '\n ' - const prefix = ' ' - const cmds = [] - const runScripts = [] - for (const script of allScripts) { - const list = cmdList.includes(script) ? cmds : runScripts - list.push(script) - } - const colorize = this.npm.chalk - - if (cmds.length) { - output.standard( - `${colorize.reset(colorize.bold('Lifecycle scripts'))} included in ${colorize.green( - pkgid - )}:` - ) - } - - for (const script of cmds) { - output.standard(prefix + script + indent + colorize.dim(scripts[script])) - } - - if (!cmds.length && runScripts.length) { - output.standard( - `${colorize.bold('Scripts')} available in ${colorize.green(pkgid)} via \`${colorize.blue( - 'npm run-script' - )}\`:` - ) - } else if (runScripts.length) { - output.standard(`\navailable via \`${colorize.blue('npm run-script')}\`:`) - } - - for (const script of runScripts) { - output.standard(prefix + script + indent + colorize.dim(scripts[script])) - } - - output.standard('') - return allScripts - } + const [cmds, runScripts] = scriptEntries.reduce((acc, s) => { + acc[cmdList.includes(s[0]) ? 0 : 1].push(s) + return acc + }, [[], []]) - async runWorkspaces (args) { - const res = [] - await this.setWorkspaces() + const { reset, bold, cyan, dim, blue } = this.npm.chalk + const pkgId = `in ${cyan(_id || name)}` + const title = (t) => reset(bold(t)) - for (const workspacePath of this.workspacePaths) { - const { content: pkg } = await pkgJson.normalize(workspacePath) - const runResult = await this.run(args, { - path: workspacePath, - pkg, - }).catch(err => { - log.error(`Lifecycle script \`${args[0]}\` failed with error:`) - log.error(err) - log.error(` in workspace: ${pkg._id || pkg.name}`) - log.error(` at location: ${workspacePath}`) - process.exitCode = 1 - }) - res.push(runResult) - } - } - - async listWorkspaces (args) { - await this.setWorkspaces() - - if (this.npm.silent) { - return - } - - if (this.npm.config.get('json')) { - const res = {} - for (const workspacePath of this.workspacePaths) { - const { content: { scripts, name } } = await pkgJson.normalize(workspacePath) - res[name] = { ...scripts } + if (cmds.length) { + output.standard(`${title('Lifecycle scripts')} included ${pkgId}:`) + for (const [k, v] of cmds) { + output.standard(` ${k}`) + output.standard(` ${dim(v)}`) } - output.standard(JSON.stringify(res, null, 2)) - return } - if (this.npm.config.get('parseable')) { - for (const workspacePath of this.workspacePaths) { - const { content: { scripts, name } } = await pkgJson.normalize(workspacePath) - for (const [script, cmd] of Object.entries(scripts || {})) { - output.standard(`${name}:${script}:${cmd}`) - } + if (runScripts.length) { + const via = `via \`${blue('npm run-script')}\`:` + if (!cmds.length) { + output.standard(`${title('Scripts')} available ${pkgId} ${via}`) + } else { + output.standard(`available ${via}`) + } + for (const [k, v] of runScripts) { + output.standard(` ${k}`) + output.standard(` ${dim(v)}`) } - return } - for (const workspacePath of this.workspacePaths) { - await this.list(args, workspacePath) - } + // Return true to indicate that something was output for this path + // that should be separated from others + return true } } diff --git a/deps/npm/lib/commands/team.js b/deps/npm/lib/commands/team.js index 22af61863851ab..c36b6ef023a264 100644 --- a/deps/npm/lib/commands/team.js +++ b/deps/npm/lib/commands/team.js @@ -1,7 +1,7 @@ const columns = require('cli-columns') const libteam = require('libnpmteam') const { output } = require('proc-log') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const BaseCommand = require('../base-cmd.js') class Team extends BaseCommand { diff --git a/deps/npm/lib/commands/token.js b/deps/npm/lib/commands/token.js index 24ca21a8e29ce9..ae58891a566c22 100644 --- a/deps/npm/lib/commands/token.js +++ b/deps/npm/lib/commands/token.js @@ -1,6 +1,6 @@ const { log, output } = require('proc-log') -const profile = require('npm-profile') -const otplease = require('../utils/otplease.js') +const { listTokens, createToken, removeToken } = require('npm-profile') +const { otplease } = require('../utils/auth.js') const readUserInfo = require('../utils/read-user-info.js') const BaseCommand = require('../base-cmd.js') @@ -48,7 +48,7 @@ class Token extends BaseCommand { const json = this.npm.config.get('json') const parseable = this.npm.config.get('parseable') log.info('token', 'getting list') - const tokens = await profile.listTokens(this.npm.flatOptions) + const tokens = await listTokens(this.npm.flatOptions) if (json) { output.standard(JSON.stringify(tokens, null, 2)) return @@ -92,7 +92,7 @@ class Token extends BaseCommand { const toRemove = [] const opts = { ...this.npm.flatOptions } log.info('token', `removing ${toRemove.length} tokens`) - const tokens = await profile.listTokens(opts) + const tokens = await listTokens(opts) args.forEach(id => { const matches = tokens.filter(token => token.key.indexOf(id) === 0) if (matches.length === 1) { @@ -113,7 +113,7 @@ class Token extends BaseCommand { }) await Promise.all( toRemove.map(key => { - return otplease(this.npm, opts, c => profile.removeToken(key, c)) + return otplease(this.npm, opts, c => removeToken(key, c)) }) ) if (json) { @@ -137,7 +137,7 @@ class Token extends BaseCommand { const result = await otplease( this.npm, { ...this.npm.flatOptions }, - c => profile.createToken(password, readonly, validCIDR, c) + c => createToken(password, readonly, validCIDR, c) ) delete result.key delete result.updated diff --git a/deps/npm/lib/commands/unpublish.js b/deps/npm/lib/commands/unpublish.js index 47a5db82062442..4944888fe5aca5 100644 --- a/deps/npm/lib/commands/unpublish.js +++ b/deps/npm/lib/commands/unpublish.js @@ -6,7 +6,7 @@ const { output, log } = require('proc-log') const pkgJson = require('@npmcli/package-json') const { flatten } = require('@npmcli/config/lib/definitions') const getIdentity = require('../utils/get-identity.js') -const otplease = require('../utils/otplease.js') +const { otplease } = require('../utils/auth.js') const BaseCommand = require('../base-cmd.js') const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' + diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js index c0d5bf552eee02..8c6b5be3a0643a 100644 --- a/deps/npm/lib/commands/view.js +++ b/deps/npm/lib/commands/view.js @@ -12,7 +12,7 @@ const { packument } = require('pacote') const Queryable = require('../utils/queryable.js') const BaseCommand = require('../base-cmd.js') -const readJson = async file => jsonParse(await readFile(file, 'utf8')) +const readJson = file => readFile(file, 'utf8').then(jsonParse) class View extends BaseCommand { static description = 'View registry info' @@ -46,42 +46,11 @@ class View extends BaseCommand { const dv = pckmnt.versions[pckmnt['dist-tags'][defaultTag]] pckmnt.versions = Object.keys(pckmnt.versions).sort(semver.compareLoose) - return getFields(pckmnt).concat(getFields(dv)) - - function getFields (d, f, pref) { - f = f || [] - pref = pref || [] - Object.keys(d).forEach((k) => { - if (k.charAt(0) === '_' || k.indexOf('.') !== -1) { - return - } - const p = pref.concat(k).join('.') - f.push(p) - if (Array.isArray(d[k])) { - d[k].forEach((val, i) => { - const pi = p + '[' + i + ']' - if (val && typeof val === 'object') { - getFields(val, f, [p]) - } else { - f.push(pi) - } - }) - return - } - if (typeof d[k] === 'object') { - getFields(d[k], f, [p]) - } - }) - return f - } + return getCompletionFields(pckmnt).concat(getCompletionFields(dv)) } async exec (args) { - if (!args.length) { - args = ['.'] - } - let pkg = args.shift() - const local = /^\.@/.test(pkg) || pkg === '.' + let { pkg, local, rest } = parseArgs(args) if (local) { if (this.npm.global) { @@ -96,92 +65,62 @@ class View extends BaseCommand { pkg = `${manifest.name}${pkg.slice(1)}` } - let wholePackument = false - if (!args.length) { - args = [''] - wholePackument = true - } - const [pckmnt, data] = await this.getData(pkg, args) - - if (!this.npm.config.get('json') && wholePackument) { - // pretty view (entire packument) - data.map((v) => this.prettyView(pckmnt, v[Object.keys(v)[0]][''])) - } else { - // JSON formatted output (JSON or specific attributes from packument) - let reducedData = data.reduce(reducer, {}) - if (wholePackument) { - // No attributes - reducedData = cleanBlanks(reducedData) - log.silly('view', reducedData) - } - - const msg = await this.jsonData(reducedData, pckmnt._id) - if (msg !== '') { - output.standard(msg) - } - } + await this.#viewPackage(pkg, rest) } async execWorkspaces (args) { - if (!args.length) { - args = ['.'] - } - - const pkg = args.shift() + const { pkg, local, rest } = parseArgs(args) - const local = /^\.@/.test(pkg) || pkg === '.' if (!local) { log.warn('Ignoring workspaces for specified package(s)') - return this.exec([pkg, ...args]) - } - let wholePackument = false - if (!args.length) { - wholePackument = true - args = [''] // getData relies on this + return this.exec([pkg, ...rest]) } - const results = {} + await this.setWorkspaces() + for (const name of this.workspaceNames) { - const wsPkg = `${name}${pkg.slice(1)}` - const [pckmnt, data] = await this.getData(wsPkg, args) - - let reducedData = data.reduce(reducer, {}) - if (wholePackument) { - // No attributes - reducedData = cleanBlanks(reducedData) - log.silly('view', reducedData) + await this.#viewPackage(`${name}${pkg.slice(1)}`, rest, { workspace: true }) + } + } + + async #viewPackage (name, args, { workspace } = {}) { + const wholePackument = !args.length + const json = this.npm.config.get('json') + + // If we are viewing many packages and outputting individual fields then + // output the name before doing any async activity + if (!json && !wholePackument && workspace) { + output.standard(`${name}:`) + } + + const [pckmnt, data] = await this.#getData(name, args, wholePackument) + + if (!json && wholePackument) { + // pretty view (entire packument) + for (const v of data) { + output.standard(this.#prettyView(pckmnt, Object.values(v)[0][Queryable.ALL])) } + return + } - if (!this.npm.config.get('json')) { - if (wholePackument) { - data.map((v) => this.prettyView(pckmnt, v[Object.keys(v)[0]][''])) - } else { - output.standard(`${name}:`) - const msg = await this.jsonData(reducedData, pckmnt._id) - if (msg !== '') { - output.standard(msg) - } - } + const res = this.#packageOutput(cleanData(data, wholePackument), pckmnt._id) + if (res) { + if (json) { + output.buffer(workspace ? { [name]: res } : res) } else { - const msg = await this.jsonData(reducedData, pckmnt._id) - if (msg !== '') { - results[name] = JSON.parse(msg) - } + output.standard(res) } } - if (Object.keys(results).length > 0) { - output.standard(JSON.stringify(results, null, 2)) - } } - async getData (pkg, args) { - const opts = { + async #getData (pkg, args) { + const spec = npa(pkg) + + const pckmnt = await packument(spec, { ...this.npm.flatOptions, preferOnline: true, fullMetadata: true, - } - - const spec = npa(pkg) + }) // get the data about this package let version = this.npm.config.get('tag') @@ -190,22 +129,19 @@ class View extends BaseCommand { version = spec.rawSpec } - const pckmnt = await packument(spec, opts) - if (pckmnt['dist-tags']?.[version]) { version = pckmnt['dist-tags'][version] } - if (pckmnt.time && pckmnt.time.unpublished) { + if (pckmnt.time?.unpublished) { const u = pckmnt.time.unpublished - const er = new Error(`Unpublished on ${u.time}`) - er.statusCode = 404 - er.code = 'E404' - er.pkgid = pckmnt._id - throw er + throw Object.assign(new Error(`Unpublished on ${u.time}`), { + statusCode: 404, + code: 'E404', + pkgid: pckmnt._id, + }) } - const data = [] const versions = pckmnt.versions || {} pckmnt.versions = Object.keys(versions).filter(v => { if (semver.valid(v)) { @@ -220,105 +156,99 @@ class View extends BaseCommand { delete pckmnt.readme } - Object.keys(versions).forEach((v) => { - if (semver.satisfies(v, version, true)) { - args.forEach(arg => { - // remove readme unless we asked for it - if (args.indexOf('readme') !== -1) { - delete versions[v].readme - } - - data.push(showFields(pckmnt, versions[v], arg)) + const data = Object.entries(versions) + .filter(([v]) => semver.satisfies(v, version, true)) + .flatMap(([, v]) => { + // remove readme unless we asked for it + if (args.indexOf('readme') !== -1) { + delete v.readme + } + return showFields({ + data: pckmnt, + version: v, + fields: args, + json: this.npm.config.get('json'), }) - } - }) + }) // No data has been pushed because no data is matching the specified version - if (data.length === 0 && version !== 'latest') { - const er = new Error(`No match found for version ${version}`) - er.statusCode = 404 - er.code = 'E404' - er.pkgid = `${pckmnt._id}@${version}` - throw er - } - - if ( - !this.npm.config.get('json') && - args.length === 1 && - args[0] === '' - ) { - pckmnt.version = version + if (!data.length && version !== 'latest') { + throw Object.assign(new Error(`No match found for version ${version}`), { + statusCode: 404, + code: 'E404', + pkgid: `${pckmnt._id}@${version}`, + }) } return [pckmnt, data] } - async jsonData (data, name) { + #packageOutput (data, name) { + const json = this.npm.config.get('json') const versions = Object.keys(data) - let msg = '' - let msgJson = [] const includeVersions = versions.length > 1 + let includeFields - const json = this.npm.config.get('json') + const res = versions.flatMap((v) => { + const fields = Object.entries(data[v]) - versions.forEach((v) => { - const fields = Object.keys(data[v]) - includeFields = includeFields || (fields.length > 1) - if (json) { - msgJson.push({}) - } - fields.forEach((f) => { - let d = cleanup(data[v][f]) - if (fields.length === 1 && json) { - msgJson[msgJson.length - 1][f] = d + includeFields ||= (fields.length > 1) + + const msg = json ? {} : [] + + for (let [f, d] of fields) { + d = cleanup(d) + + if (json) { + msg[f] = d + continue } if (includeVersions || includeFields || typeof d !== 'string') { - if (json) { - msgJson[msgJson.length - 1][f] = d - } else { - d = inspect(d, { - showHidden: false, - depth: 5, - colors: this.npm.color, - maxArrayLength: null, - }) - } - } else if (typeof d === 'string' && json) { - d = JSON.stringify(d) + d = inspect(d, { + showHidden: false, + depth: 5, + colors: this.npm.color, + maxArrayLength: null, + }) } - if (!json) { - if (f && includeFields) { - f += ' = ' - } - msg += (includeVersions ? name + '@' + v + ' ' : '') + - (includeFields ? f : '') + d + '\n' + if (f && includeFields) { + f += ' = ' } - }) + + msg.push(`${includeVersions ? `${name}@${v} ` : ''}${includeFields ? f : ''}${d}`) + } + + return msg }) if (json) { - if (msgJson.length && Object.keys(msgJson[0]).length === 1) { - const k = Object.keys(msgJson[0])[0] - msgJson = msgJson.map(m => m[k]) + // TODO(BREAKING_CHANGE): all unwrapping should be removed. Users should know + // based on their arguments if they can expect an array or an object. And this + // unwrapping can break that assumption. Eg `npm view abbrev@^2` should always + // return an array, but currently since there is only one version matching `^2` + // this will return a single object instead. + const first = Object.keys(res[0] || {}) + const jsonRes = first.length === 1 ? res.map(m => m[first[0]]) : res + if (jsonRes.length === 0) { + return } - if (msgJson.length === 1) { - msg = JSON.stringify(msgJson[0], null, 2) + '\n' - } else if (msgJson.length > 1) { - msg = JSON.stringify(msgJson, null, 2) + '\n' + if (jsonRes.length === 1) { + return jsonRes[0] } + return jsonRes } - return msg.trim() + return res.join('\n').trim() } - prettyView (packu, manifest) { + #prettyView (packu, manifest) { // More modern, pretty printing of default view const unicode = this.npm.config.get('unicode') const chalk = this.npm.chalk - const deps = Object.keys(manifest.dependencies || {}).map((dep) => - `${chalk.blue(dep)}: ${manifest.dependencies[dep]}` + const deps = Object.entries(manifest.dependencies || {}).map(([k, dep]) => + `${chalk.blue(k)}: ${dep}` ) const site = manifest.homepage?.url || manifest.homepage const bins = Object.keys(manifest.bin || {}) @@ -327,8 +257,10 @@ class View extends BaseCommand { ? licenseField : (licenseField.type || 'Proprietary') - output.standard('') - output.standard([ + const res = [] + + res.push('') + res.push([ chalk.underline.cyan(`${manifest.name}@${manifest.version}`), license.toLowerCase().trim() === 'proprietary' ? chalk.red(license) @@ -337,56 +269,56 @@ class View extends BaseCommand { `versions: ${chalk.cyan(packu.versions.length + '')}`, ].join(' | ')) - manifest.description && output.standard(manifest.description) + manifest.description && res.push(manifest.description) if (site) { - output.standard(chalk.blue(site)) + res.push(chalk.blue(site)) } - manifest.deprecated && output.standard( + manifest.deprecated && res.push( `\n${chalk.redBright('DEPRECATED')}${unicode ? ' ⚠️ ' : '!!'} - ${manifest.deprecated}` ) if (packu.keywords?.length) { - output.standard(`\nkeywords: ${ + res.push(`\nkeywords: ${ packu.keywords.map(k => chalk.cyan(k)).join(', ') }`) } if (bins.length) { - output.standard(`\nbin: ${chalk.cyan(bins.join(', '))}`) + res.push(`\nbin: ${chalk.cyan(bins.join(', '))}`) } - output.standard('\ndist') - output.standard(`.tarball: ${chalk.blue(manifest.dist.tarball)}`) - output.standard(`.shasum: ${chalk.green(manifest.dist.shasum)}`) + res.push('\ndist') + res.push(`.tarball: ${chalk.blue(manifest.dist.tarball)}`) + res.push(`.shasum: ${chalk.green(manifest.dist.shasum)}`) if (manifest.dist.integrity) { - output.standard(`.integrity: ${chalk.green(manifest.dist.integrity)}`) + res.push(`.integrity: ${chalk.green(manifest.dist.integrity)}`) } if (manifest.dist.unpackedSize) { - output.standard(`.unpackedSize: ${chalk.blue(formatBytes(manifest.dist.unpackedSize, true))}`) + res.push(`.unpackedSize: ${chalk.blue(formatBytes(manifest.dist.unpackedSize, true))}`) } if (deps.length) { const maxDeps = 24 - output.standard('\ndependencies:') - output.standard(columns(deps.slice(0, maxDeps), { padding: 1 })) + res.push('\ndependencies:') + res.push(columns(deps.slice(0, maxDeps), { padding: 1 })) if (deps.length > maxDeps) { - output.standard(chalk.dim(`(...and ${deps.length - maxDeps} more.)`)) + res.push(chalk.dim(`(...and ${deps.length - maxDeps} more.)`)) } } if (packu.maintainers?.length) { - output.standard('\nmaintainers:') + res.push('\nmaintainers:') packu.maintainers.forEach(u => - output.standard(`- ${unparsePerson({ + res.push(`- ${unparsePerson({ name: chalk.blue(u.name), email: chalk.dim(u.email) })}`) ) } - output.standard('\ndist-tags:') - output.standard(columns(Object.keys(packu['dist-tags']).map(t => - `${chalk.blue(t)}: ${packu['dist-tags'][t]}` + res.push('\ndist-tags:') + res.push(columns(Object.entries(packu['dist-tags']).map(([k, t]) => + `${chalk.blue(k)}: ${t}` ))) const publisher = manifest._npmUser && unparsePerson({ @@ -401,52 +333,77 @@ class View extends BaseCommand { if (publisher) { publishInfo += ` by ${publisher}` } - output.standard('') - output.standard(publishInfo) + res.push('') + res.push(publishInfo) } + + return res.join('\n') } } module.exports = View -function cleanBlanks (obj) { - const clean = {} - Object.keys(obj).forEach((version) => { - clean[version] = obj[version][''] - }) - return clean +function parseArgs (args) { + if (!args.length) { + args = ['.'] + } + + const pkg = args.shift() + + return { + pkg, + local: /^\.@/.test(pkg) || pkg === '.', + rest: args, + } } -// takes an array of objects and merges them into one object -function reducer (acc, cur) { - if (cur) { - Object.keys(cur).forEach((v) => { - acc[v] = acc[v] || {} - Object.keys(cur[v]).forEach((t) => { - acc[v][t] = cur[v][t] +function cleanData (obj, wholePackument) { + // JSON formatted output (JSON or specific attributes from packument) + const data = obj.reduce((acc, cur) => { + if (cur) { + Object.entries(cur).forEach(([k, v]) => { + acc[k] ||= {} + Object.keys(v).forEach((t) => { + acc[k][t] = cur[k][t] + }) }) - }) + } + return acc + }, {}) + + if (wholePackument) { + const cleaned = Object.entries(data).reduce((acc, [k, v]) => { + acc[k] = v[Queryable.ALL] + return acc + }, {}) + log.silly('view', cleaned) + return cleaned } - return acc + return data } // return whatever was printed -function showFields (data, version, fields) { - const o = {} - ;[data, version].forEach((s) => { - Object.keys(s).forEach((k) => { - o[k] = s[k] +function showFields ({ data, version, fields, json }) { + const o = [data, version].reduce((acc, s) => { + Object.entries(s).forEach(([k, v]) => { + acc[k] = v }) - }) + return acc + }, {}) const queryable = new Queryable(o) - const s = queryable.query(fields) - const res = { [version.version]: s } - if (s) { - return res + if (!fields.length) { + return { [version.version]: queryable.query(Queryable.ALL) } } + + return fields.map((field) => { + const s = queryable.query(field, { unwrapSingleItemArrays: !json }) + if (s) { + return { [version.version]: s } + } + }) } function cleanup (data) { @@ -459,19 +416,41 @@ function cleanup (data) { } const keys = Object.keys(data) - if (keys.length <= 3 && - data.name && - (keys.length === 1 || - (keys.length === 3 && data.email && data.url) || - (keys.length === 2 && (data.email || data.url)))) { + if (keys.length <= 3 && data.name && ( + (keys.length === 1) || + (keys.length === 3 && data.email && data.url) || + (keys.length === 2 && (data.email || data.url)) + )) { data = unparsePerson(data) } return data } -function unparsePerson (d) { - return d.name + - (d.email ? ' <' + d.email + '>' : '') + - (d.url ? ' (' + d.url + ')' : '') +const unparsePerson = (d) => + `${d.name}${d.email ? ` <${d.email}>` : ''}${d.url ? ` (${d.url})` : ''}` + +function getCompletionFields (d, f = [], pref = []) { + Object.entries(d).forEach(([k, v]) => { + if (k.charAt(0) === '_' || k.indexOf('.') !== -1) { + return + } + const p = pref.concat(k).join('.') + f.push(p) + if (Array.isArray(v)) { + v.forEach((val, i) => { + const pi = p + '[' + i + ']' + if (val && typeof val === 'object') { + getCompletionFields(val, f, [p]) + } else { + f.push(pi) + } + }) + return + } + if (typeof v === 'object') { + getCompletionFields(v, f, [p]) + } + }) + return f } diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index df2297b215da7b..9d00b630857b1e 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -7,10 +7,11 @@ const usage = require('./utils/npm-usage.js') const LogFile = require('./utils/log-file.js') const Timers = require('./utils/timers.js') const Display = require('./utils/display.js') -const { log, time, output } = require('proc-log') +const { log, time, output, META } = require('proc-log') const { redactLog: replaceInfo } = require('@npmcli/redact') const pkg = require('../package.json') const { deref } = require('./utils/cmd-list.js') +const { jsonError, outputError } = require('./utils/output-error.js') class Npm { static get version () { @@ -73,76 +74,14 @@ class Npm { }) } - get version () { - return this.constructor.version - } - - // Call an npm command - async exec (cmd, args = this.argv) { - const Command = Npm.cmd(cmd) - const command = new Command(this) - - // since 'test', 'start', 'stop', etc. commands re-enter this function - // to call the run-script command, we need to only set it one time. - if (!this.#command) { - this.#command = command - process.env.npm_command = this.command - } - - return time.start(`command:${cmd}`, () => command.cmdExec(args)) - } - async load () { - return time.start('npm:load', () => this.#load()) - } - - get loaded () { - return this.config.loaded - } - - // This gets called at the end of the exit handler and - // during any tests to cleanup all of our listeners - // Everything in here should be synchronous - unload () { - this.#timers.off() - this.#display.off() - this.#logFile.off() - } - - finish ({ showLogFileError } = {}) { - this.#timers.finish({ - id: this.#runId, - command: this.#argvClean, - logfiles: this.logFiles, - version: this.version, - }) - - if (showLogFileError) { - if (!this.silent) { - // just a line break if not in silent mode - output.error('') - } - - if (this.logFiles.length) { - return log.error('', `A complete log of this run can be found in: ${this.logFiles}`) - } - - const logsMax = this.config.get('logs-max') - if (logsMax <= 0) { - // user specified no log file - log.error('', `Log files were not written due to the config logs-max=${logsMax}`) - } else { - // could be an error writing to the directory - log.error('', - `Log files were not written due to an error writing to the directory: ${this.#logsDir}` + - '\nYou can rerun the command with `--loglevel=verbose` to see the logs in your terminal' - ) - } + let err + try { + return await time.start('npm:load', () => this.#load()) + } catch (e) { + err = e } - } - - get title () { - return this.#title + return this.#handleError(err) } async #load () { @@ -238,6 +177,7 @@ class Npm { // take a long time to resolve, but that is why process.exit is called explicitly // in the exit-handler. this.unrefPromises.push(this.#logFile.load({ + command, path: this.logPath, logsMax: this.config.get('logs-max'), timing: this.config.get('timing'), @@ -260,8 +200,152 @@ class Npm { return { exec: true, command: commandArg, args: this.argv } } - get isShellout () { - return this.#command?.constructor?.isShellout + async exec (cmd, args = this.argv) { + if (!this.#command) { + let err + try { + await this.#exec(cmd, args) + } catch (e) { + err = e + } + return this.#handleError(err) + } else { + return this.#exec(cmd, args) + } + } + + // Call an npm command + async #exec (cmd, args) { + const Command = this.constructor.cmd(cmd) + const command = new Command(this) + + // since 'test', 'start', 'stop', etc. commands re-enter this function + // to call the run-script command, we need to only set it one time. + if (!this.#command) { + this.#command = command + process.env.npm_command = this.command + } + + if (this.config.get('usage')) { + return output.standard(command.usage) + } + + let execWorkspaces = false + const hasWsConfig = this.config.get('workspaces') || this.config.get('workspace').length + // if cwd is a workspace, the default is set to [that workspace] + const implicitWs = this.config.get('workspace', 'default').length + // (-ws || -w foo) && (cwd is not a workspace || command is not ignoring implicit workspaces) + if (hasWsConfig && (!implicitWs || !Command.ignoreImplicitWorkspace)) { + if (this.global) { + throw new Error('Workspaces not supported for global packages') + } + if (!Command.workspaces) { + throw Object.assign(new Error('This command does not support workspaces.'), { + code: 'ENOWORKSPACES', + }) + } + execWorkspaces = true + } + + return time.start(`command:${cmd}`, () => + execWorkspaces ? command.execWorkspaces(args) : command.exec(args)) + } + + // This gets called at the end of the exit handler and + // during any tests to cleanup all of our listeners + // Everything in here should be synchronous + unload () { + this.#timers.off() + this.#display.off() + this.#logFile.off() + } + + finish () { + // Finish all our timer work, this will write the file if requested, end timers, etc + this.#timers.finish({ + id: this.#runId, + command: this.#argvClean, + logfiles: this.logFiles, + version: this.version, + }) + } + + exitErrorMessage () { + if (this.logFiles.length) { + return `A complete log of this run can be found in: ${this.logFiles}` + } + + const logsMax = this.config.get('logs-max') + if (logsMax <= 0) { + // user specified no log file + return `Log files were not written due to the config logs-max=${logsMax}` + } + + // could be an error writing to the directory + return `Log files were not written due to an error writing to the directory: ${this.#logsDir}` + + '\nYou can rerun the command with `--loglevel=verbose` to see the logs in your terminal' + } + + async #handleError (err) { + if (err) { + // Get the local package if it exists for a more helpful error message + const localPkg = await require('@npmcli/package-json') + .normalize(this.localPrefix) + .then(p => p.content) + .catch(() => null) + Object.assign(err, this.#getError(err, { pkg: localPkg })) + } + + // TODO: make this not need to be public + this.finish() + + output.flush({ + [META]: true, + // json can be set during a command so we send the + // final value of it to the display layer here + json: this.loaded && this.config.get('json'), + jsonError: jsonError(err, this), + }) + + if (err) { + throw err + } + } + + #getError (rawErr, opts) { + const { files = [], ...error } = require('./utils/error-message.js').getError(rawErr, { + npm: this, + command: this.#command, + ...opts, + }) + + const { writeFileSync } = require('node:fs') + for (const [file, content] of files) { + const filePath = `${this.logPath}${file}` + const fileContent = `'Log files:\n${this.logFiles.join('\n')}\n\n${content.trim()}\n` + try { + writeFileSync(filePath, fileContent) + error.detail.push(['', `\n\nFor a full report see:\n${filePath}`]) + } catch (fileErr) { + log.warn('', `Could not write error message to ${file} due to ${fileErr}`) + } + } + + outputError(error) + + return error + } + + get title () { + return this.#title + } + + get loaded () { + return this.config.loaded + } + + get version () { + return this.constructor.version } get command () { diff --git a/deps/npm/lib/package-url-cmd.js b/deps/npm/lib/package-url-cmd.js index bcefd17af4492a..c7ae32174fcb68 100644 --- a/deps/npm/lib/package-url-cmd.js +++ b/deps/npm/lib/package-url-cmd.js @@ -1,5 +1,5 @@ const pacote = require('pacote') -const openUrl = require('./utils/open-url.js') +const { openUrl } = require('./utils/open-url.js') const { log } = require('proc-log') const BaseCommand = require('./base-cmd.js') diff --git a/deps/npm/lib/utils/auth.js b/deps/npm/lib/utils/auth.js index 04ca455ceb5261..deaff6bbebbafb 100644 --- a/deps/npm/lib/utils/auth.js +++ b/deps/npm/lib/utils/auth.js @@ -1,23 +1,43 @@ -const profile = require('npm-profile') +const { webAuthOpener, adduserWeb, loginWeb, loginCouch, adduserCouch } = require('npm-profile') const { log } = require('proc-log') -const openUrlPrompt = require('../utils/open-url-prompt.js') +const { createOpener } = require('../utils/open-url.js') const read = require('../utils/read-user-info.js') -const otplease = require('../utils/otplease.js') + +const otplease = async (npm, opts, fn) => { + try { + return await fn(opts) + } catch (err) { + if (!process.stdin.isTTY || !process.stdout.isTTY) { + throw err + } + + // web otp + if (err.code === 'EOTP' && err.body?.authUrl && err.body?.doneUrl) { + const otp = await webAuthOpener( + createOpener(npm, 'Authenticate your account at'), + err.body.authUrl, + err.body.doneUrl, + opts + ) + return await fn({ ...opts, otp }) + } + + // classic otp + if (err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body))) { + const otp = await read.otp('This operation requires a one-time password.\nEnter OTP:') + return await fn({ ...opts, otp }) + } + + throw err + } +} const adduser = async (npm, { creds, ...opts }) => { const authType = npm.config.get('auth-type') let res if (authType === 'web') { try { - res = await profile.adduserWeb((url, emitter) => { - openUrlPrompt( - npm, - url, - 'Create your account at', - 'Press ENTER to open in the browser...', - emitter - ) - }, opts) + res = await adduserWeb(createOpener(npm, 'Create your account at'), opts) } catch (err) { if (err.code === 'ENYI') { log.verbose('web add user not supported, trying couch') @@ -35,9 +55,7 @@ const adduser = async (npm, { creds, ...opts }) => { // npm registry quirk: If you "add" an existing user with their current // password, it's effectively a login, and if that account has otp you'll // be prompted for it. - res = await otplease(npm, opts, (reqOpts) => - profile.adduserCouch(username, email, password, reqOpts) - ) + res = await otplease(npm, opts, (reqOpts) => adduserCouch(username, email, password, reqOpts)) } // We don't know the username if it was a web login, all we can reliably log is scope and registry @@ -56,15 +74,7 @@ const login = async (npm, { creds, ...opts }) => { let res if (authType === 'web') { try { - res = await profile.loginWeb((url, emitter) => { - openUrlPrompt( - npm, - url, - 'Login at', - 'Press ENTER to open in the browser...', - emitter - ) - }, opts) + res = await loginWeb(createOpener(npm, 'Login at'), opts) } catch (err) { if (err.code === 'ENYI') { log.verbose('web login not supported, trying couch') @@ -78,9 +88,7 @@ const login = async (npm, { creds, ...opts }) => { if (!res) { const username = await read.username('Username:', creds.username) const password = await read.password('Password:', creds.password) - res = await otplease(npm, opts, (reqOpts) => - profile.loginCouch(username, password, reqOpts) - ) + res = await otplease(npm, opts, (reqOpts) => loginCouch(username, password, reqOpts)) } // We don't know the username if it was a web login, all we can reliably log is scope and registry @@ -97,4 +105,5 @@ const login = async (npm, { creds, ...opts }) => { module.exports = { adduser, login, + otplease, } diff --git a/deps/npm/lib/utils/did-you-mean.js b/deps/npm/lib/utils/did-you-mean.js index 54c8ff2e35aa69..7428ed5df85e9c 100644 --- a/deps/npm/lib/utils/did-you-mean.js +++ b/deps/npm/lib/utils/did-you-mean.js @@ -1,39 +1,34 @@ const Npm = require('../npm') const { distance } = require('fastest-levenshtein') -const pkgJson = require('@npmcli/package-json') const { commands } = require('./cmd-list.js') -const didYouMean = async (path, scmd) => { - const close = commands.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd) - let best = [] - for (const str of close) { - const cmd = Npm.cmd(str) - best.push(` npm ${str} # ${cmd.description}`) - } - // We would already be suggesting this in `npm x` so omit them here - const runScripts = ['stop', 'start', 'test', 'restart'] - try { - const { content: { scripts, bin } } = await pkgJson.normalize(path) - best = best.concat( - Object.keys(scripts || {}) - .filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && !runScripts.includes(cmd)) - .map(str => ` npm run ${str} # run the "${str}" package script`), - Object.keys(bin || {}) - .filter(cmd => distance(scmd, cmd) < scmd.length * 0.4) - /* eslint-disable-next-line max-len */ - .map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`) - ) - } catch { - // gracefully ignore not being in a folder w/ a package.json - } +const runScripts = ['stop', 'start', 'test', 'restart'] + +const isClose = (scmd, cmd) => distance(scmd, cmd) < scmd.length * 0.4 + +const didYouMean = (pkg, scmd) => { + const { scripts = {}, bin = {} } = pkg || {} + + const best = [ + ...commands + .filter(cmd => isClose(scmd, cmd) && scmd !== cmd) + .map(str => [str, Npm.cmd(str).description]), + ...Object.keys(scripts) + // We would already be suggesting this in `npm x` so omit them here + .filter(cmd => isClose(scmd, cmd) && !runScripts.includes(cmd)) + .map(str => [`run ${str}`, `run the "${str}" package script`]), + ...Object.keys(bin) + .filter(cmd => isClose(scmd, cmd)) + /* eslint-disable-next-line max-len */ + .map(str => [`exec ${str}`, `run the "${str}" command from either this or a remote npm package`]), + ] if (best.length === 0) { return '' } - return best.length === 1 - ? `\n\nDid you mean this?\n${best[0]}` - : `\n\nDid you mean one of these?\n${best.slice(0, 3).join('\n')}` + return `\n\nDid you mean ${best.length === 1 ? 'this' : 'one of these'}?\n` + + best.slice(0, 3).map(([msg, comment]) => ` npm ${msg} # ${comment}`).join('\n') } module.exports = didYouMean diff --git a/deps/npm/lib/utils/display.js b/deps/npm/lib/utils/display.js index 29a1f7951d5063..ede2588cacfc1f 100644 --- a/deps/npm/lib/utils/display.js +++ b/deps/npm/lib/utils/display.js @@ -65,17 +65,6 @@ const LEVEL_METHODS = { }, } -const tryJsonParse = (value) => { - if (typeof value === 'string') { - try { - return JSON.parse(value) - } catch { - return {} - } - } - return value -} - const setBlocking = (stream) => { // Copied from https://github.com/yargs/set-blocking // https://raw.githubusercontent.com/yargs/set-blocking/master/LICENSE.txt @@ -86,6 +75,68 @@ const setBlocking = (stream) => { return stream } +// These are important +// This is the key that is returned to the user for errors +const ERROR_KEY = 'error' +// This is the key producers use to indicate that there +// is a json error that should be merged into the finished output +const JSON_ERROR_KEY = 'jsonError' + +const getArrayOrObject = (items) => { + // Arrays cant be merged, if the first item is an array return that + if (Array.isArray(items[0])) { + return items[0] + } + // We use objects with 0,1,2,etc keys to merge array + if (items.length && items.every((o, i) => Object.hasOwn(o, i))) { + return Object.assign([], ...items) + } + // Otherwise its an object with all items merged together + return Object.assign({}, ...items) +} + +const mergeJson = ({ [JSON_ERROR_KEY]: metaError }, buffer) => { + const items = [] + // meta also contains the meta object passed to flush + const errors = metaError ? [metaError] : [] + // index 1 is the meta, 2 is the logged argument + for (const [, { [JSON_ERROR_KEY]: error }, obj] of buffer) { + if (obj && typeof obj === 'object') { + items.push(obj) + } + /* istanbul ignore next - this is not used yet but will be */ + if (error) { + errors.push(error) + } + } + + if (!items.length && !errors.length) { + return null + } + + // If all items are keyed with array indexes, then we return the + // array. This skips any error checking since we cant really set + // an error property on an array in a way that can be stringified + // XXX(BREAKING_CHANGE): remove this in favor of always returning an object + const res = getArrayOrObject(items) + + if (!Array.isArray(res) && errors.length) { + // This is not ideal. JSON output has always been keyed at the root with an `error` + // key, so we cant change that without it being a breaking change. At the same time + // some commands output arbitrary keys at the top level of the output, such as package + // names. So the output could already have the same key. The choice here is to overwrite + // it with our error since that is (probably?) more important. + // XXX(BREAKING_CHANGE): all json output should be keyed under well known keys, eg `result` and `error` + /* istanbul ignore next */ + if (res[ERROR_KEY]) { + log.warn('display', `overwriting existing ${ERROR_KEY} on json output`) + } + res[ERROR_KEY] = getArrayOrObject(errors) + } + + return res +} + const withMeta = (handler) => (level, ...args) => { let meta = {} const last = args.at(-1) @@ -239,25 +290,19 @@ class Display { // Arrow function assigned to a private class field so it can be passed // directly as a listener and still reference "this" #outputHandler = withMeta((level, meta, ...args) => { + this.#json = typeof meta.json === 'boolean' ? meta.json : this.#json switch (level) { - case output.KEYS.flush: + case output.KEYS.flush: { this.#outputState.buffering = false - if (meta.jsonError && this.#json) { - const json = {} - for (const item of this.#outputState.buffer) { - // index 2 skips the level and meta - Object.assign(json, tryJsonParse(item[2])) - } - this.#writeOutput( - output.KEYS.standard, - meta, - JSON.stringify({ ...json, error: meta.jsonError }, null, 2) - ) + const json = this.#json ? mergeJson(meta, this.#outputState.buffer) : null + if (json) { + this.#writeOutput(output.KEYS.standard, meta, JSON.stringify(json, null, 2)) } else { this.#outputState.buffer.forEach((item) => this.#writeOutput(...item)) } this.#outputState.buffer.length = 0 break + } case output.KEYS.buffer: this.#outputState.buffer.push([output.KEYS.standard, meta, ...args]) diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js index 969e56636dfe8d..c484c1ab9c2b61 100644 --- a/deps/npm/lib/utils/error-message.js +++ b/deps/npm/lib/utils/error-message.js @@ -3,34 +3,18 @@ const { resolve } = require('node:path') const { redactLog: replaceInfo } = require('@npmcli/redact') const { log } = require('proc-log') -const messageText = msg => msg.map(line => line.slice(1).join(' ')).join('\n') - -const jsonError = (er, npm, { summary, detail }) => { - if (npm?.config.loaded && npm.config.get('json')) { - return { - code: er.code, - summary: messageText(summary), - detail: messageText(detail), - } - } -} - const errorMessage = (er, npm) => { - const short = [] + const summary = [] const detail = [] const files = [] - if (er.message) { - er.message = replaceInfo(er.message) - } - if (er.stack) { - er.stack = replaceInfo(er.stack) - } + er.message &&= replaceInfo(er.message) + er.stack &&= replaceInfo(er.stack) switch (er.code) { case 'ERESOLVE': { const { report } = require('./explain-eresolve.js') - short.push(['ERESOLVE', er.message]) + summary.push(['ERESOLVE', er.message]) detail.push(['', '']) // XXX(display): error messages are logged so we use the logColor since that is based // on stderr. This should be handled solely by the display layer so it could also be @@ -43,83 +27,70 @@ const errorMessage = (er, npm) => { case 'ENOLOCK': { const cmd = npm.command || '' - short.push([cmd, 'This command requires an existing lockfile.']) + summary.push([cmd, 'This command requires an existing lockfile.']) detail.push([cmd, 'Try creating one first with: npm i --package-lock-only']) detail.push([cmd, `Original error: ${er.message}`]) break } case 'ENOAUDIT': - short.push(['audit', er.message]) + summary.push(['audit', er.message]) break case 'ECONNREFUSED': - short.push(['', er]) - detail.push([ + summary.push(['', er]) + detail.push(['', [ '', - [ - '\nIf you are behind a proxy, please make sure that the', - "'proxy' config is set properly. See: 'npm help config'", - ].join('\n'), - ]) + 'If you are behind a proxy, please make sure that the', + "'proxy' config is set properly. See: 'npm help config'", + ].join('\n')]) break case 'EACCES': case 'EPERM': { const isCachePath = - typeof er.path === 'string' && - npm.config.loaded && - er.path.startsWith(npm.config.get('cache')) + typeof er.path === 'string' && npm.loaded && er.path.startsWith(npm.config.get('cache')) const isCacheDest = - typeof er.dest === 'string' && - npm.config.loaded && - er.dest.startsWith(npm.config.get('cache')) + typeof er.dest === 'string' && npm.loaded && er.dest.startsWith(npm.config.get('cache')) if (process.platform !== 'win32' && (isCachePath || isCacheDest)) { // user probably doesn't need this, but still add it to the debug log log.verbose(er.stack) - short.push([ + summary.push(['', [ '', - [ - '', - 'Your cache folder contains root-owned files, due to a bug in', - 'previous versions of npm which has since been addressed.', - '', - 'To permanently fix this problem, please run:', - ` sudo chown -R ${process.getuid()}:${process.getgid()} ${JSON.stringify( - npm.config.get('cache') - )}`, - ].join('\n'), - ]) + 'Your cache folder contains root-owned files, due to a bug in', + 'previous versions of npm which has since been addressed.', + '', + 'To permanently fix this problem, please run:', + ` sudo chown -R ${process.getuid()}:${process.getgid()} "${npm.config.get('cache')}"`, + ].join('\n')]) } else { - short.push(['', er]) - detail.push([ + summary.push(['', er]) + detail.push(['', [ + '', + 'The operation was rejected by your operating system.', + ...process.platform === 'win32' ? [ + "It's possible that the file was already in use (by a text editor or antivirus),", + 'or that you lack permissions to access it.', + ] : [ + 'It is likely you do not have the permissions to access this file as the current user', + ], '', - [ - '\nThe operation was rejected by your operating system.', - process.platform === 'win32' - /* eslint-disable-next-line max-len */ - ? "It's possible that the file was already in use (by a text editor or antivirus),\n" + - 'or that you lack permissions to access it.' - /* eslint-disable-next-line max-len */ - : 'It is likely you do not have the permissions to access this file as the current user', - '\nIf you believe this might be a permissions issue, please double-check the', - 'permissions of the file and its containing directories, or try running', - 'the command again as root/Administrator.', - ].join('\n'), - ]) + 'If you believe this might be a permissions issue, please double-check the', + 'permissions of the file and its containing directories, or try running', + 'the command again as root/Administrator.', + ].join('\n')]) } break } case 'ENOGIT': - short.push(['', er.message]) - detail.push([ + summary.push(['', er.message]) + detail.push(['', [ '', - ['', 'Failed using git.', 'Please check if you have git installed and in your PATH.'].join( - '\n' - ), - ]) + 'Failed using git.', + 'Please check if you have git installed and in your PATH.', + ].join('\n')]) break case 'EJSONPARSE': @@ -128,82 +99,68 @@ const errorMessage = (er, npm) => { const { isDiff } = require('parse-conflict-json') const txt = require('fs').readFileSync(er.path, 'utf8').replace(/\r\n/g, '\n') if (isDiff(txt)) { - detail.push([ + detail.push(['', [ + 'Merge conflict detected in your package.json.', '', - [ - 'Merge conflict detected in your package.json.', - '', - 'Please resolve the package.json conflict and retry.', - ].join('\n'), - ]) + 'Please resolve the package.json conflict and retry.', + ].join('\n')]) break } } - short.push(['JSON.parse', er.message]) - detail.push([ - 'JSON.parse', - [ - 'Failed to parse JSON data.', - 'Note: package.json must be actual JSON, not just JavaScript.', - ].join('\n'), - ]) + summary.push(['JSON.parse', er.message]) + detail.push(['JSON.parse', [ + 'Failed to parse JSON data.', + 'Note: package.json must be actual JSON, not just JavaScript.', + ].join('\n')]) break case 'EOTP': case 'E401': // E401 is for places where we accidentally neglect OTP stuff if (er.code === 'EOTP' || /one-time pass/.test(er.message)) { - short.push(['', 'This operation requires a one-time password from your authenticator.']) - detail.push([ - '', - [ - 'You can provide a one-time password by passing --otp= to the command you ran.', - 'If you already provided a one-time password then it is likely that you either typoed', - 'it, or it timed out. Please try again.', - ].join('\n'), - ]) + summary.push(['', 'This operation requires a one-time password from your authenticator.']) + detail.push(['', [ + 'You can provide a one-time password by passing --otp= to the command you ran.', + 'If you already provided a one-time password then it is likely that you either typoed', + 'it, or it timed out. Please try again.', + ].join('\n')]) } else { // npm ERR! code E401 // npm ERR! Unable to authenticate, need: Basic - const auth = - !er.headers || !er.headers['www-authenticate'] - ? [] - : er.headers['www-authenticate'].map(au => au.split(/[,\s]+/))[0] + const auth = !er.headers || !er.headers['www-authenticate'] + ? [] + : er.headers['www-authenticate'].map(au => au.split(/[,\s]+/))[0] if (auth.includes('Bearer')) { - short.push([ - '', + summary.push(['', 'Unable to authenticate, your authentication token seems to be invalid.', ]) - detail.push([ - '', - ['To correct this please try logging in again with:', ' npm login'].join('\n'), - ]) + detail.push(['', [ + 'To correct this please try logging in again with:', + ' npm login', + ].join('\n')]) } else if (auth.includes('Basic')) { - short.push(['', 'Incorrect or missing password.']) - detail.push([ + summary.push(['', 'Incorrect or missing password.']) + detail.push(['', [ + 'If you were trying to login, change your password, create an', + 'authentication token or enable two-factor authentication then', + 'that means you likely typed your password in incorrectly.', + 'Please try again, or recover your password at:', + ' https://www.npmjs.com/forgot', '', - [ - 'If you were trying to login, change your password, create an', - 'authentication token or enable two-factor authentication then', - 'that means you likely typed your password in incorrectly.', - 'Please try again, or recover your password at:', - ' https://www.npmjs.com/forgot', - '', - 'If you were doing some other operation then your saved credentials are', - 'probably out of date. To correct this please try logging in again with:', - ' npm login', - ].join('\n'), - ]) + 'If you were doing some other operation then your saved credentials are', + 'probably out of date. To correct this please try logging in again with:', + ' npm login', + ].join('\n')]) } else { - short.push(['', er.message || er]) + summary.push(['', er.message || er]) } } break case 'E404': // There's no need to have 404 in the message as well. - short.push(['404', er.message.replace(/^404\s+/, '')]) + summary.push(['404', er.message.replace(/^404\s+/, '')]) if (er.pkgid && er.pkgid !== '-') { const pkg = er.pkgid.replace(/(?!^)@.*$/, '') @@ -220,26 +177,27 @@ const errorMessage = (er, npm) => { errorsArray.forEach((item, idx) => detail.push(['404', ' ' + (idx + 1) + '. ' + item])) } - detail.push(['404', '\nNote that you can also install from a']) + detail.push(['404', '']) + detail.push(['404', 'Note that you can also install from a']) detail.push(['404', 'tarball, folder, http url, or git url.']) } break case 'EPUBLISHCONFLICT': - short.push(['publish fail', 'Cannot publish over existing version.']) + summary.push(['publish fail', 'Cannot publish over existing version.']) detail.push(['publish fail', "Update the 'version' field in package.json and try again."]) detail.push(['publish fail', '']) detail.push(['publish fail', 'To automatically increment version numbers, see:']) - detail.push(['publish fail', ' npm help version']) + detail.push(['publish fail', ' npm help version']) break case 'EISGIT': - short.push(['git', er.message]) - short.push(['git', ' ' + er.path]) - detail.push([ - 'git', - ['Refusing to remove it. Update manually,', 'or move it out of the way first.'].join('\n'), - ]) + summary.push(['git', er.message]) + summary.push(['git', ` ${er.path}`]) + detail.push(['git', [ + 'Refusing to remove it. Update manually,', + 'or move it out of the way first.', + ].join('\n')]) break case 'EBADPLATFORM': { @@ -271,33 +229,25 @@ const errorMessage = (er, npm) => { detailEntry.push(`Actual ${key}:${' '.repeat(padding)}${actual[key]}`) } - short.push([ - 'notsup', - [ - format( - 'Unsupported platform for %s: wanted %j (current: %j)', - er.pkgid, - expected, - actual - ), - ].join('\n'), - ]) - detail.push([ - 'notsup', - detailEntry.join('\n'), - ]) + summary.push(['notsup', format( + 'Unsupported platform for %s: wanted %j (current: %j)', + er.pkgid, + expected, + actual + )]) + detail.push(['notsup', detailEntry.join('\n')]) break } case 'EEXIST': - short.push(['', er.message]) - short.push(['', 'File exists: ' + (er.dest || er.path)]) + summary.push(['', er.message]) + summary.push(['', 'File exists: ' + (er.dest || er.path)]) detail.push(['', 'Remove the existing file and try again, or run npm']) detail.push(['', 'with --force to overwrite files recklessly.']) break case 'ENEEDAUTH': - short.push(['need auth', er.message]) + summary.push(['need auth', er.message]) detail.push(['need auth', 'You need to authorize this machine using `npm adduser`']) break @@ -306,126 +256,185 @@ const errorMessage = (er, npm) => { case 'ETIMEDOUT': case 'ERR_SOCKET_TIMEOUT': case 'EAI_FAIL': - short.push(['network', er.message]) - detail.push([ - 'network', - [ - 'This is a problem related to network connectivity.', - 'In most cases you are behind a proxy or have bad network settings.', - '\nIf you are behind a proxy, please make sure that the', - "'proxy' config is set properly. See: 'npm help config'", - ].join('\n'), - ]) + summary.push(['network', er.message]) + detail.push(['network', [ + 'This is a problem related to network connectivity.', + 'In most cases you are behind a proxy or have bad network settings.', + '', + 'If you are behind a proxy, please make sure that the', + "'proxy' config is set properly. See: 'npm help config'", + ].join('\n')]) break case 'ETARGET': - short.push(['notarget', er.message]) - detail.push([ - 'notarget', - [ - 'In most cases you or one of your dependencies are requesting', - "a package version that doesn't exist.", - ].join('\n'), - ]) + summary.push(['notarget', er.message]) + detail.push(['notarget', [ + 'In most cases you or one of your dependencies are requesting', + "a package version that doesn't exist.", + ].join('\n')]) break case 'E403': - short.push(['403', er.message]) - detail.push([ - '403', - [ - 'In most cases, you or one of your dependencies are requesting', - 'a package version that is forbidden by your security policy, or', - 'on a server you do not have access to.', - ].join('\n'), - ]) + summary.push(['403', er.message]) + detail.push(['403', [ + 'In most cases, you or one of your dependencies are requesting', + 'a package version that is forbidden by your security policy, or', + 'on a server you do not have access to.', + ].join('\n')]) break case 'EBADENGINE': - short.push(['engine', er.message]) - short.push(['engine', 'Not compatible with your version of node/npm: ' + er.pkgid]) - detail.push([ - 'notsup', - [ - 'Not compatible with your version of node/npm: ' + er.pkgid, - 'Required: ' + JSON.stringify(er.required), - 'Actual: ' + - JSON.stringify({ - npm: npm.version, - node: process.version, - }), - ].join('\n'), - ]) + summary.push(['engine', er.message]) + summary.push(['engine', 'Not compatible with your version of node/npm: ' + er.pkgid]) + detail.push(['notsup', [ + 'Not compatible with your version of node/npm: ' + er.pkgid, + 'Required: ' + JSON.stringify(er.required), + 'Actual: ' + + JSON.stringify({ npm: npm.version, node: process.version }), + ].join('\n')]) break case 'ENOSPC': - short.push(['nospc', er.message]) - detail.push([ - 'nospc', - [ - 'There appears to be insufficient space on your system to finish.', - 'Clear up some disk space and try again.', - ].join('\n'), - ]) + summary.push(['nospc', er.message]) + detail.push(['nospc', [ + 'There appears to be insufficient space on your system to finish.', + 'Clear up some disk space and try again.', + ].join('\n')]) break case 'EROFS': - short.push(['rofs', er.message]) - detail.push([ - 'rofs', - [ - 'Often virtualized file systems, or other file systems', - "that don't support symlinks, give this error.", - ].join('\n'), - ]) + summary.push(['rofs', er.message]) + detail.push(['rofs', [ + 'Often virtualized file systems, or other file systems', + "that don't support symlinks, give this error.", + ].join('\n')]) break case 'ENOENT': - short.push(['enoent', er.message]) - detail.push([ - 'enoent', - [ - 'This is related to npm not being able to find a file.', - er.file ? "\nCheck if the file '" + er.file + "' is present." : '', - ].join('\n'), - ]) + summary.push(['enoent', er.message]) + detail.push(['enoent', [ + 'This is related to npm not being able to find a file.', + er.file ? `\nCheck if the file '${er.file}' is present.` : '', + ].join('\n')]) break case 'EMISSINGARG': case 'EUNKNOWNTYPE': case 'EINVALIDTYPE': case 'ETOOMANYARGS': - short.push(['typeerror', er.stack]) - detail.push([ - 'typeerror', - [ - 'This is an error with npm itself. Please report this error at:', - ' https://github.com/npm/cli/issues', - ].join('\n'), - ]) + summary.push(['typeerror', er.stack]) + detail.push(['typeerror', [ + 'This is an error with npm itself. Please report this error at:', + ' https://github.com/npm/cli/issues', + ].join('\n')]) break default: - short.push(['', er.message || er]) + summary.push(['', er.message || er]) + if (er.cause) { + detail.push(['cause', er.cause.message]) + } if (er.signal) { detail.push(['signal', er.signal]) } - if (er.cmd && Array.isArray(er.args)) { detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]]) } - if (er.stdout) { detail.push(['', er.stdout.trim()]) } - if (er.stderr) { detail.push(['', er.stderr.trim()]) } - break } - return { summary: short, detail, files, json: jsonError(er, npm, { summary: short, detail }) } + + return { + summary, + detail, + files, + } } -module.exports = errorMessage +const getExitCodeFromError = (err) => { + if (typeof err?.errno === 'number') { + return err.errno + } else if (typeof err?.code === 'number') { + return err.code + } +} + +const getError = (err, { npm, command, pkg }) => { + // if we got a command that just shells out to something else, then it + // will presumably print its own errors and exit with a proper status + // code if there's a problem. If we got an error with a code=0, then... + // something else went wrong along the way, so maybe an npm problem? + if (command?.constructor?.isShellout && typeof err.code === 'number' && err.code) { + return { + exitCode: err.code, + suppressError: true, + } + } + + // XXX: we should stop throwing strings + if (typeof err === 'string') { + return { + exitCode: 1, + suppressError: true, + summary: [['', err]], + } + } + + // XXX: we should stop throwing other non-errors + if (!(err instanceof Error)) { + return { + exitCode: 1, + suppressError: true, + summary: [['weird error', err]], + } + } + + if (err.code === 'EUNKNOWNCOMMAND') { + const suggestions = require('./did-you-mean.js')(pkg, err.command) + return { + exitCode: 1, + suppressError: true, + standard: [ + `Unknown command: "${err.command}"`, + suggestions, + 'To see a list of supported npm commands, run:', + ' npm help', + ], + } + } + + // Anything after this is not suppressed and get more logged information + + // add a code to the error if it doesnt have one and mutate some properties + // so they have redacted information + err.code ??= err.message.match(/^(?:Error: )?(E[A-Z]+)/)?.[1] + // this mutates the error and redacts stack/message + const { summary, detail, files } = errorMessage(err, npm) + + return { + err, + code: err.code, + exitCode: getExitCodeFromError(err) || 1, + suppressError: false, + summary, + detail, + files, + verbose: ['type', 'stack', 'statusCode', 'pkgid'] + .filter(k => err[k]) + .map(k => [k, replaceInfo(err[k])]), + error: ['code', 'syscall', 'file', 'path', 'dest', 'errno'] + .filter(k => err[k]) + .map(k => [k, err[k]]), + } +} + +module.exports = { + getExitCodeFromError, + errorMessage, + getError, +} diff --git a/deps/npm/lib/utils/log-file.js b/deps/npm/lib/utils/log-file.js index 09e3873f2dce6c..f8dd19d333cf67 100644 --- a/deps/npm/lib/utils/log-file.js +++ b/deps/npm/lib/utils/log-file.js @@ -48,7 +48,11 @@ class LogFiles { this.#endStream() } - load ({ path, logsMax = Infinity, timing } = {}) { + load ({ command, path, logsMax = Infinity, timing } = {}) { + if (['completion'].includes(command)) { + return + } + // dir is user configurable and is required to exist so // this can error if the dir is missing or not configured correctly this.#path = path diff --git a/deps/npm/lib/utils/open-url-prompt.js b/deps/npm/lib/utils/open-url-prompt.js deleted file mode 100644 index 6f4d453a959d59..00000000000000 --- a/deps/npm/lib/utils/open-url-prompt.js +++ /dev/null @@ -1,66 +0,0 @@ -const readline = require('readline') -const { input, output } = require('proc-log') -const open = require('./open-url.js') - -function print (npm, title, url) { - const json = npm.config.get('json') - - const message = json ? JSON.stringify({ title, url }) : `${title}:\n${url}` - - output.standard(message) -} - -// Prompt to open URL in browser if possible -const promptOpen = async (npm, url, title, prompt, emitter) => { - const browser = npm.config.get('browser') - const isInteractive = process.stdin.isTTY === true && process.stdout.isTTY === true - - try { - if (!/^https?:$/.test(new URL(url).protocol)) { - throw new Error() - } - } catch (_) { - throw new Error('Invalid URL: ' + url) - } - - print(npm, title, url) - - if (browser === false || !isInteractive) { - return - } - - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }) - - const tryOpen = await input.read(() => new Promise(resolve => { - rl.on('SIGINT', () => { - rl.close() - resolve('SIGINT') - }) - - rl.question(prompt, () => { - resolve(true) - }) - - if (emitter && emitter.addListener) { - emitter.addListener('abort', () => { - rl.close() - resolve(false) - }) - } - })) - - if (tryOpen === 'SIGINT') { - throw new Error('canceled') - } - - if (!tryOpen) { - return - } - - await open(npm, url, 'Browser unavailable. Please open the URL manually') -} - -module.exports = promptOpen diff --git a/deps/npm/lib/utils/open-url.js b/deps/npm/lib/utils/open-url.js index 46b7abc731fa1d..7d8e1cb5a2d233 100644 --- a/deps/npm/lib/utils/open-url.js +++ b/deps/npm/lib/utils/open-url.js @@ -1,51 +1,95 @@ -const promiseSpawn = require('@npmcli/promise-spawn') -const { output } = require('proc-log') - +const { open } = require('@npmcli/promise-spawn') +const { output, input } = require('proc-log') const { URL } = require('url') +const readline = require('node:readline/promises') +const { once } = require('node:events') + +const assertValidUrl = (url) => { + try { + if (!/^https?:$/.test(new URL(url).protocol)) { + throw new Error() + } + } catch { + throw new Error('Invalid URL: ' + url) + } +} + +const outputMsg = (json, title, url) => { + const msg = json ? JSON.stringify({ title, url }) : `${title}:\n${url}` + output.standard(msg) +} // attempt to open URL in web-browser, print address otherwise: -const open = async (npm, url, errMsg, isFile) => { +const openUrl = async (npm, url, title, isFile) => { url = encodeURI(url) const browser = npm.config.get('browser') - - function printAlternateMsg () { - const json = npm.config.get('json') - const alternateMsg = json - ? JSON.stringify({ - title: errMsg, - url, - }, null, 2) - : `${errMsg}:\n ${url}\n` - - output.standard(alternateMsg) - } + const json = npm.config.get('json') if (browser === false) { - printAlternateMsg() + outputMsg(json, title, url) return } // We pass this in as true from the help command so we know we don't have to // check the protocol if (!isFile) { - try { - if (!/^https?:$/.test(new URL(url).protocol)) { - throw new Error() - } - } catch { - throw new Error('Invalid URL: ' + url) + assertValidUrl(url) + } + + try { + await input.start(() => open(url, { + command: browser === true ? null : browser, + })) + } catch (err) { + if (err.code !== 127) { + throw err } + outputMsg(json, title, url) } +} + +// Prompt to open URL in browser if possible +const openUrlPrompt = async (npm, url, title, prompt, { signal }) => { + const browser = npm.config.get('browser') + const json = npm.config.get('json') - const command = browser === true ? null : browser - await promiseSpawn.open(url, { command }) - .catch((err) => { - if (err.code !== 127) { - throw err - } + assertValidUrl(url) + outputMsg(json, title, url) + + if (browser === false || !process.stdin.isTTY || !process.stdout.isTTY) { + return + } - printAlternateMsg() - }) + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }) + + try { + await input.read(() => Promise.race([ + rl.question(prompt, { signal }), + once(rl, 'error'), + once(rl, 'SIGINT').then(() => { + throw new Error('canceled') + }), + ])) + rl.close() + await openUrl(npm, url, 'Browser unavailable. Please open the URL manually') + } catch (err) { + rl.close() + if (err.name !== 'AbortError') { + throw err + } + } } -module.exports = open +// Rearrange arguments and return a function that takes the two arguments +// returned from the npm-profile methods that take an opener +const createOpener = (npm, title, prompt = 'Press ENTER to open in the browser...') => + (url, opts) => openUrlPrompt(npm, url, title, prompt, opts) + +module.exports = { + openUrl, + openUrlPrompt, + createOpener, +} diff --git a/deps/npm/lib/utils/otplease.js b/deps/npm/lib/utils/otplease.js deleted file mode 100644 index b8dd0b66ed7664..00000000000000 --- a/deps/npm/lib/utils/otplease.js +++ /dev/null @@ -1,46 +0,0 @@ -async function otplease (npm, opts, fn) { - try { - return await fn(opts) - } catch (err) { - if (!process.stdin.isTTY || !process.stdout.isTTY) { - throw err - } - - if (isWebOTP(err)) { - const webAuth = require('./web-auth') - const openUrlPrompt = require('./open-url-prompt') - - const openerPromise = (url, emitter) => - openUrlPrompt( - npm, - url, - 'Authenticate your account at', - 'Press ENTER to open in the browser...', - emitter - ) - const otp = await webAuth(openerPromise, err.body.authUrl, err.body.doneUrl, opts) - return await fn({ ...opts, otp }) - } - - if (isClassicOTP(err)) { - const readUserInfo = require('./read-user-info.js') - const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') - return await fn({ ...opts, otp }) - } - - throw err - } -} - -function isWebOTP (err) { - if (err.code === 'EOTP' && err.body) { - return err.body.authUrl && err.body.doneUrl - } - return false -} - -function isClassicOTP (err) { - return err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body)) -} - -module.exports = otplease diff --git a/deps/npm/lib/utils/output-error.js b/deps/npm/lib/utils/output-error.js new file mode 100644 index 00000000000000..27128e9f03a8c3 --- /dev/null +++ b/deps/npm/lib/utils/output-error.js @@ -0,0 +1,29 @@ +const { log, output } = require('proc-log') + +const outputError = ({ standard = [], verbose = [], error = [], summary = [], detail = [] }) => { + for (const line of standard) { + // Each output line is just a single string + output.standard(line) + } + for (const line of verbose) { + log.verbose(...line) + } + for (const line of [...error, ...summary, ...detail]) { + log.error(...line) + } +} + +const jsonError = (error, npm) => { + if (error && npm?.loaded && npm?.config.get('json')) { + return { + code: error.code, + summary: (error.summary || []).map(l => l.slice(1).join(' ')).join('\n').trim(), + detail: (error.detail || []).map(l => l.slice(1).join(' ')).join('\n').trim(), + } + } +} + +module.exports = { + outputError, + jsonError, +} diff --git a/deps/npm/lib/utils/queryable.js b/deps/npm/lib/utils/queryable.js index 69621d928e8ddc..4fc1e3533eabc3 100644 --- a/deps/npm/lib/utils/queryable.js +++ b/deps/npm/lib/utils/queryable.js @@ -83,7 +83,7 @@ const parseKeys = key => { return res } -const getter = ({ data, key }) => { +const getter = ({ data, key }, { unwrapSingleItemArrays = true } = {}) => { // keys are a list in which each entry represents the name of // a property that should be walked through the object in order to // return the final found value @@ -122,7 +122,7 @@ const getter = ({ data, key }) => { // these are some legacy expectations from // the old API consumed by lib/view.js - if (Array.isArray(_data) && _data.length <= 1) { + if (unwrapSingleItemArrays && Array.isArray(_data) && _data.length <= 1) { _data = _data[0] } @@ -231,6 +231,8 @@ const setter = ({ data, key, value, force }) => { } class Queryable { + static ALL = '' + #data = null constructor (obj) { @@ -243,19 +245,19 @@ class Queryable { this.#data = obj } - query (queries) { + query (queries, opts) { // this ugly interface here is meant to be a compatibility layer // with the legacy API lib/view.js is consuming, if at some point // we refactor that command then we can revisit making this nicer - if (queries === '') { - return { '': this.#data } + if (queries === Queryable.ALL) { + return { [Queryable.ALL]: this.#data } } const q = query => getter({ data: this.#data, key: query, - }) + }, opts) if (Array.isArray(queries)) { let res = {} diff --git a/deps/npm/lib/utils/read-user-info.js b/deps/npm/lib/utils/read-user-info.js index 4e8def4bdf1def..a9a50f8263ff63 100644 --- a/deps/npm/lib/utils/read-user-info.js +++ b/deps/npm/lib/utils/read-user-info.js @@ -2,11 +2,6 @@ const { read: _read } = require('read') const userValidate = require('npm-user-validate') const { log, input } = require('proc-log') -exports.otp = readOTP -exports.password = readPassword -exports.username = readUsername -exports.email = readEmail - const otpPrompt = `This command requires a one-time password (OTP) from your authenticator app. Enter one below. You can also pass one on the command line by appending --otp=123456. For more information, see: @@ -63,3 +58,10 @@ function readEmail (msg = emailPrompt, email, isRetry) { return read({ prompt: msg, default: email || '' }) .then((username) => readEmail(msg, username, true)) } + +module.exports = { + otp: readOTP, + password: readPassword, + username: readUsername, + email: readEmail, +} diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index 9085d9dd350165..31f8bb089ed859 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -1,14 +1,17 @@ const tar = require('tar') const ssri = require('ssri') -const { log } = require('proc-log') +const { log, output } = require('proc-log') const formatBytes = require('./format-bytes.js') const localeCompare = require('@isaacs/string-locale-compare')('en', { sensitivity: 'case', numeric: true, }) -const logTar = (tarball, opts = {}) => { - const { unicode = false } = opts +const logTar = (tarball, { unicode = false, json, key } = {}) => { + if (json) { + output.buffer(key == null ? tarball : { [key]: tarball }) + return + } log.notice('') log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`) log.notice('Tarball Contents') diff --git a/deps/npm/lib/utils/web-auth.js b/deps/npm/lib/utils/web-auth.js deleted file mode 100644 index ce551687098fc8..00000000000000 --- a/deps/npm/lib/utils/web-auth.js +++ /dev/null @@ -1,20 +0,0 @@ -const EventEmitter = require('events') -const { webAuthCheckLogin } = require('npm-profile') - -async function webAuth (opener, initialUrl, doneUrl, opts) { - const doneEmitter = new EventEmitter() - - const openPromise = opener(initialUrl, doneEmitter) - const webAuthCheckPromise = webAuthCheckLogin(doneUrl, { ...opts, cache: false }) - .then(authResult => { - // cancel open prompt if it's present - doneEmitter.emit('abort') - - return authResult.token - }) - - await openPromise - return await webAuthCheckPromise -} - -module.exports = webAuth diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index df63b4a6a5d6c6..18e2bcac233163 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM-ACCESS" "1" "April 2024" "" "" +.TH "NPM-ACCESS" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-access\fR - Set access level on published packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index e867396ccfc4bf..36958bc8347a2e 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM-ADDUSER" "1" "April 2024" "" "" +.TH "NPM-ADDUSER" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-adduser\fR - Add a registry user account .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index 5832cb09ff9980..82cec83f472761 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -1,4 +1,4 @@ -.TH "NPM-AUDIT" "1" "April 2024" "" "" +.TH "NPM-AUDIT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-audit\fR - Run a security audit .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index ea6371ffbe4fc1..01ce318495068c 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM-BUGS" "1" "April 2024" "" "" +.TH "NPM-BUGS" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-bugs\fR - Report bugs for a package in a web browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index c741829317d2e1..7b4c5e90a10316 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM-CACHE" "1" "April 2024" "" "" +.TH "NPM-CACHE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-cache\fR - Manipulates packages cache .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 793f02006ab229..6d6e3c564cb428 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -1,4 +1,4 @@ -.TH "NPM-CI" "1" "April 2024" "" "" +.TH "NPM-CI" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-ci\fR - Clean install a project .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 28bfb2906d1922..a2370a5cab6e9d 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM-COMPLETION" "1" "April 2024" "" "" +.TH "NPM-COMPLETION" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-completion\fR - Tab Completion for npm .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index bd572dea7c4ab8..9083b7bc508e51 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM-CONFIG" "1" "April 2024" "" "" +.TH "NPM-CONFIG" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-config\fR - Manage the npm configuration files .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 529e14b0efb722..f8088d5d29a6a5 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM-DEDUPE" "1" "April 2024" "" "" +.TH "NPM-DEDUPE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-dedupe\fR - Reduce duplication in the package tree .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 2a3891596da0c6..f6b593cd96fbcf 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM-DEPRECATE" "1" "April 2024" "" "" +.TH "NPM-DEPRECATE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-deprecate\fR - Deprecate a version of a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-diff.1 b/deps/npm/man/man1/npm-diff.1 index f8f0b5e7f40aac..b0c66b2543089f 100644 --- a/deps/npm/man/man1/npm-diff.1 +++ b/deps/npm/man/man1/npm-diff.1 @@ -1,4 +1,4 @@ -.TH "NPM-DIFF" "1" "April 2024" "" "" +.TH "NPM-DIFF" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-diff\fR - The registry diff command .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index c0b6e8d70df6dc..3a056f5fc59eec 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM-DIST-TAG" "1" "April 2024" "" "" +.TH "NPM-DIST-TAG" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-dist-tag\fR - Modify package distribution tags .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index be22f95c00df95..f0ca99bc75f96c 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM-DOCS" "1" "April 2024" "" "" +.TH "NPM-DOCS" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-docs\fR - Open documentation for a package in a web browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 16ae2f7e41715b..eecf5cf9981436 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM-DOCTOR" "1" "April 2024" "" "" +.TH "NPM-DOCTOR" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-doctor\fR - Check the health of your npm environment .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 0f91c98e4b6cd9..f6e06c426a338a 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM-EDIT" "1" "April 2024" "" "" +.TH "NPM-EDIT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-edit\fR - Edit an installed package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1 index 0040f141315cd3..86289a3463037d 100644 --- a/deps/npm/man/man1/npm-exec.1 +++ b/deps/npm/man/man1/npm-exec.1 @@ -1,4 +1,4 @@ -.TH "NPM-EXEC" "1" "April 2024" "" "" +.TH "NPM-EXEC" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-exec\fR - Run a command from a local or remote npm package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1 index ea53b43add250b..09033f5739113e 100644 --- a/deps/npm/man/man1/npm-explain.1 +++ b/deps/npm/man/man1/npm-explain.1 @@ -1,4 +1,4 @@ -.TH "NPM-EXPLAIN" "1" "April 2024" "" "" +.TH "NPM-EXPLAIN" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-explain\fR - Explain installed packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 7127aff53ee73f..1dc4fcf89af9a0 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM-EXPLORE" "1" "April 2024" "" "" +.TH "NPM-EXPLORE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-explore\fR - Browse an installed package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-find-dupes.1 b/deps/npm/man/man1/npm-find-dupes.1 index fc625fb8ebd10b..85e087349da4ad 100644 --- a/deps/npm/man/man1/npm-find-dupes.1 +++ b/deps/npm/man/man1/npm-find-dupes.1 @@ -1,4 +1,4 @@ -.TH "NPM-FIND-DUPES" "1" "April 2024" "" "" +.TH "NPM-FIND-DUPES" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-find-dupes\fR - Find duplication in the package tree .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index c8fb9354beb570..ceba71789ee99f 100644 --- a/deps/npm/man/man1/npm-fund.1 +++ b/deps/npm/man/man1/npm-fund.1 @@ -1,4 +1,4 @@ -.TH "NPM-FUND" "1" "April 2024" "" "" +.TH "NPM-FUND" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-fund\fR - Retrieve funding information .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 892777ce4e6b4a..5c446812f40cc9 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM-HELP-SEARCH" "1" "April 2024" "" "" +.TH "NPM-HELP-SEARCH" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-help-search\fR - Search npm help documentation .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index bb08ed91cccb79..ca9d4d25f9d801 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM-HELP" "1" "April 2024" "" "" +.TH "NPM-HELP" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-help\fR - Get help on npm .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 index ece059dfbb5257..57b1946fcfeb98 100644 --- a/deps/npm/man/man1/npm-hook.1 +++ b/deps/npm/man/man1/npm-hook.1 @@ -1,4 +1,4 @@ -.TH "NPM-HOOK" "1" "April 2024" "" "" +.TH "NPM-HOOK" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-hook\fR - Manage registry hooks .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index cc2c543925e464..768552131f939f 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM-INIT" "1" "April 2024" "" "" +.TH "NPM-INIT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-init\fR - Create a package.json file .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index bd7f5b84a13016..29b4e0403e7db8 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -1,4 +1,4 @@ -.TH "NPM-INSTALL-CI-TEST" "1" "April 2024" "" "" +.TH "NPM-INSTALL-CI-TEST" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-install-ci-test\fR - Install a project with a clean slate and run tests .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 331fe854774f58..dbe67b0a7b395e 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM-INSTALL-TEST" "1" "April 2024" "" "" +.TH "NPM-INSTALL-TEST" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-install-test\fR - Install package(s) and run tests .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 6d98e0e40923c0..6acd9c57d3eb0b 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM-INSTALL" "1" "April 2024" "" "" +.TH "NPM-INSTALL" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-install\fR - Install a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 174f9d1bd1baf8..87a4a28956b48e 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM-LINK" "1" "April 2024" "" "" +.TH "NPM-LINK" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-link\fR - Symlink a package folder .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-login.1 b/deps/npm/man/man1/npm-login.1 index 1b7aea8819d6ec..f170fc928a5667 100644 --- a/deps/npm/man/man1/npm-login.1 +++ b/deps/npm/man/man1/npm-login.1 @@ -1,4 +1,4 @@ -.TH "NPM-LOGIN" "1" "April 2024" "" "" +.TH "NPM-LOGIN" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-login\fR - Login to a registry user account .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 113d6c5fab0995..38f30b6f199727 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM-LOGOUT" "1" "April 2024" "" "" +.TH "NPM-LOGOUT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-logout\fR - Log out of the registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 3d4728693455e4..b6d2b7e4de7031 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM-LS" "1" "April 2024" "" "" +.TH "NPM-LS" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-ls\fR - List installed packages .SS "Synopsis" @@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit .P .RS 2 .nf -npm@10.7.0 /path/to/npm +npm@10.8.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 002259ab5578a8..122781dd7e2514 100644 --- a/deps/npm/man/man1/npm-org.1 +++ b/deps/npm/man/man1/npm-org.1 @@ -1,4 +1,4 @@ -.TH "NPM-ORG" "1" "April 2024" "" "" +.TH "NPM-ORG" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-org\fR - Manage orgs .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 528bc0d0e24d54..e8af0ae412eaec 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM-OUTDATED" "1" "April 2024" "" "" +.TH "NPM-OUTDATED" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-outdated\fR - Check for outdated packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 114cd78939c6a8..657f53963c0056 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM-OWNER" "1" "April 2024" "" "" +.TH "NPM-OWNER" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-owner\fR - Manage package owners .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 6c0046bce58252..a193f1f2679e14 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM-PACK" "1" "April 2024" "" "" +.TH "NPM-PACK" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-pack\fR - Create a tarball from a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index c6d509c56a4be4..42f3d8e76a0614 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM-PING" "1" "April 2024" "" "" +.TH "NPM-PING" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-ping\fR - Ping npm registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-pkg.1 b/deps/npm/man/man1/npm-pkg.1 index 170639b8d9af70..9d827a27e73a8d 100644 --- a/deps/npm/man/man1/npm-pkg.1 +++ b/deps/npm/man/man1/npm-pkg.1 @@ -1,4 +1,4 @@ -.TH "NPM-PKG" "1" "April 2024" "" "" +.TH "NPM-PKG" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-pkg\fR - Manages your package.json .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 0af03494691d7f..55788dd4f3c8e5 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM-PREFIX" "1" "April 2024" "" "" +.TH "NPM-PREFIX" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-prefix\fR - Display prefix .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index 423167e2efafc4..99db8193b1ff44 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM-PROFILE" "1" "April 2024" "" "" +.TH "NPM-PROFILE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-profile\fR - Change settings on your registry profile .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index a7162e053616dd..76a1eb1325d222 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM-PRUNE" "1" "April 2024" "" "" +.TH "NPM-PRUNE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-prune\fR - Remove extraneous packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 9ebfbaa761bb12..190bbbf40ea9ab 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM-PUBLISH" "1" "April 2024" "" "" +.TH "NPM-PUBLISH" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-publish\fR - Publish a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-query.1 b/deps/npm/man/man1/npm-query.1 index d2271722e13711..85f8b742f9314a 100644 --- a/deps/npm/man/man1/npm-query.1 +++ b/deps/npm/man/man1/npm-query.1 @@ -1,4 +1,4 @@ -.TH "NPM-QUERY" "1" "April 2024" "" "" +.TH "NPM-QUERY" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-query\fR - Dependency selector query .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 9fe38d79998a7c..6726d8837ed363 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM-REBUILD" "1" "April 2024" "" "" +.TH "NPM-REBUILD" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-rebuild\fR - Rebuild a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 197d333c10a919..92657ee7e73ac8 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM-REPO" "1" "April 2024" "" "" +.TH "NPM-REPO" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-repo\fR - Open package repository page in the browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 59acbf2c09f56c..a0e0625a8fdff6 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM-RESTART" "1" "April 2024" "" "" +.TH "NPM-RESTART" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-restart\fR - Restart a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index e56b2f3d3afb13..e939af0390befe 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM-ROOT" "1" "April 2024" "" "" +.TH "NPM-ROOT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-root\fR - Display npm root .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index d6e98845b4c411..a8e6330d38ac25 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM-RUN-SCRIPT" "1" "April 2024" "" "" +.TH "NPM-RUN-SCRIPT" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-run-script\fR - Run arbitrary package scripts .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-sbom.1 b/deps/npm/man/man1/npm-sbom.1 index b984044896eaed..7611501b79f9c6 100644 --- a/deps/npm/man/man1/npm-sbom.1 +++ b/deps/npm/man/man1/npm-sbom.1 @@ -1,4 +1,4 @@ -.TH "NPM-SBOM" "1" "April 2024" "" "" +.TH "NPM-SBOM" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-sbom\fR - Generate a Software Bill of Materials (SBOM) .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 041bd1113010f5..750da81528c449 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM-SEARCH" "1" "April 2024" "" "" +.TH "NPM-SEARCH" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-search\fR - Search for packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index cb74dfd382f0a1..b3b6ce959bc25e 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM-SHRINKWRAP" "1" "April 2024" "" "" +.TH "NPM-SHRINKWRAP" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-shrinkwrap\fR - Lock down dependency versions for publication .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 951ab5bdeb7eb3..7072b33548f1cc 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM-STAR" "1" "April 2024" "" "" +.TH "NPM-STAR" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-star\fR - Mark your favorite packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 7848df08500154..e1036885e3efd4 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM-STARS" "1" "April 2024" "" "" +.TH "NPM-STARS" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-stars\fR - View packages marked as favorites .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index c46b8dabed2e89..c0ac0bb5244b4d 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM-START" "1" "April 2024" "" "" +.TH "NPM-START" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-start\fR - Start a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 48ef025074040e..5cf1b62acbb1c9 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM-STOP" "1" "April 2024" "" "" +.TH "NPM-STOP" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-stop\fR - Stop a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 4bbed65d580c39..7320fabc1c27c7 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM-TEAM" "1" "April 2024" "" "" +.TH "NPM-TEAM" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-team\fR - Manage organization teams and team memberships .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 233c6db054a77c..4ec030dd732010 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM-TEST" "1" "April 2024" "" "" +.TH "NPM-TEST" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-test\fR - Test a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index 2b35907fb49681..2e461746d5fec8 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM-TOKEN" "1" "April 2024" "" "" +.TH "NPM-TOKEN" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-token\fR - Manage your authentication tokens .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 700037a7e1cbf8..30b74b229db191 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM-UNINSTALL" "1" "April 2024" "" "" +.TH "NPM-UNINSTALL" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-uninstall\fR - Remove a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 01697803cdfaf6..571c97b736de89 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM-UNPUBLISH" "1" "April 2024" "" "" +.TH "NPM-UNPUBLISH" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-unpublish\fR - Remove a package from the registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1 index 98a6980bd021d5..dc444c7f1fc76e 100644 --- a/deps/npm/man/man1/npm-unstar.1 +++ b/deps/npm/man/man1/npm-unstar.1 @@ -1,4 +1,4 @@ -.TH "NPM-UNSTAR" "1" "April 2024" "" "" +.TH "NPM-UNSTAR" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-unstar\fR - Remove an item from your favorite packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index af80d1b0e398b7..f9fe4260f899a5 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM-UPDATE" "1" "April 2024" "" "" +.TH "NPM-UPDATE" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-update\fR - Update packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 3ec27ac0569159..10659c12accfc9 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM-VERSION" "1" "April 2024" "" "" +.TH "NPM-VERSION" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-version\fR - Bump a package version .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 39bf6ae8c9cc2e..78a4a03ab5d27f 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM-VIEW" "1" "April 2024" "" "" +.TH "NPM-VIEW" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-view\fR - View registry info .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 7e38f165585c9a..b66d679b368450 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM-WHOAMI" "1" "April 2024" "" "" +.TH "NPM-WHOAMI" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-whoami\fR - Display npm username .SS "Synopsis" diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 6fb97e843320ea..c485d79e1f79e3 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "April 2024" "" "" +.TH "NPM" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm\fR - javascript package manager .SS "Synopsis" @@ -12,7 +12,7 @@ npm Note: This command is unaware of workspaces. .SS "Version" .P -10.7.0 +10.8.0 .SS "Description" .P npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index 0a4ff19f4bc901..78eabd16b84b4d 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "April 2024" "" "" +.TH "NPX" "1" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpx\fR - Run a command from a local or remote npm package .SS "Synopsis" diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index 12bda4e2881711..af5cccd4a53786 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "April 2024" "" "" +.TH "FOLDERS" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBfolders\fR - Folder Structures Used by npm .SS "Description" diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index 42e18760236ea4..0b8207691d9bca 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "April 2024" "" "" +.TH "INSTALL" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBinstall\fR - Download and install node and npm .SS "Description" diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 12bda4e2881711..af5cccd4a53786 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "April 2024" "" "" +.TH "FOLDERS" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBfolders\fR - Folder Structures Used by npm .SS "Description" diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index f4d903e2b114cf..17a6e0a802b91e 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE.JSON" "5" "April 2024" "" "" +.TH "PACKAGE.JSON" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBpackage.json\fR - Specifics of npm's package.json handling .SS "Description" @@ -344,7 +344,7 @@ For example, myapp could have this: .nf { "bin": { - "myapp": "./cli.js" + "myapp": "bin/cli.js" } } .fi @@ -359,7 +359,7 @@ If you have a single executable, and its name should be the name of the package, { "name": "my-program", "version": "1.2.5", - "bin": "./path/to/program" + "bin": "path/to/program" } .fi .RE @@ -372,7 +372,7 @@ would be the same as this: "name": "my-program", "version": "1.2.5", "bin": { - "my-program": "./path/to/program" + "my-program": "path/to/program" } } .fi @@ -456,7 +456,7 @@ Because of the way the \fBbin\fR directive works, specifying both a \fBbin\fR pa A folder that is full of man pages. Sugar to generate a "man" array by walking the folder. .SS "repository" .P -Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm docs\fR command will be able to find you. +Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm repo\fR command will be able to find you. .P Do it like this: .P @@ -754,7 +754,7 @@ Trying to install another plugin with a conflicting requirement may cause an err Assuming the host complies with \fBsemver\fR \fI\(lahttps://semver.org/\(ra\fR, only changes in the host package's major version will break your plugin. Thus, if you've worked with every 1.x version of the host package, use \fB"^1.0"\fR or \fB"1.x"\fR to express this. If you depend on features introduced in 1.5.2, use \fB"^1.5.2"\fR. .SS "peerDependenciesMeta" .P -When a user installs your package, npm will emit warnings if packages specified in \fBpeerDependencies\fR are not already installed. The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. +The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. Npm will not automatically install optional peer dependencies. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. .P For example: .P @@ -775,8 +775,6 @@ For example: } .fi .RE -.P -Marking a peer dependency as optional ensures npm will not emit a warning if the \fBsoy-milk\fR package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. .SS "bundleDependencies" .P This defines an array of package names that will be bundled when publishing the package. diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5 index 36a4073b92ac02..17691217f03a82 100644 --- a/deps/npm/man/man5/npm-shrinkwrap-json.5 +++ b/deps/npm/man/man5/npm-shrinkwrap-json.5 @@ -1,4 +1,4 @@ -.TH "NPM-SHRINKWRAP.JSON" "5" "April 2024" "" "" +.TH "NPM-SHRINKWRAP.JSON" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR - A publishable lockfile .SS "Description" diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index 16543b3bc98520..aa6db5aaadb395 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "April 2024" "" "" +.TH "NPMRC" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBnpmrc\fR - The npm config files .SS "Description" diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index f4d903e2b114cf..17a6e0a802b91e 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE.JSON" "5" "April 2024" "" "" +.TH "PACKAGE.JSON" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBpackage.json\fR - Specifics of npm's package.json handling .SS "Description" @@ -344,7 +344,7 @@ For example, myapp could have this: .nf { "bin": { - "myapp": "./cli.js" + "myapp": "bin/cli.js" } } .fi @@ -359,7 +359,7 @@ If you have a single executable, and its name should be the name of the package, { "name": "my-program", "version": "1.2.5", - "bin": "./path/to/program" + "bin": "path/to/program" } .fi .RE @@ -372,7 +372,7 @@ would be the same as this: "name": "my-program", "version": "1.2.5", "bin": { - "my-program": "./path/to/program" + "my-program": "path/to/program" } } .fi @@ -456,7 +456,7 @@ Because of the way the \fBbin\fR directive works, specifying both a \fBbin\fR pa A folder that is full of man pages. Sugar to generate a "man" array by walking the folder. .SS "repository" .P -Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm docs\fR command will be able to find you. +Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm repo\fR command will be able to find you. .P Do it like this: .P @@ -754,7 +754,7 @@ Trying to install another plugin with a conflicting requirement may cause an err Assuming the host complies with \fBsemver\fR \fI\(lahttps://semver.org/\(ra\fR, only changes in the host package's major version will break your plugin. Thus, if you've worked with every 1.x version of the host package, use \fB"^1.0"\fR or \fB"1.x"\fR to express this. If you depend on features introduced in 1.5.2, use \fB"^1.5.2"\fR. .SS "peerDependenciesMeta" .P -When a user installs your package, npm will emit warnings if packages specified in \fBpeerDependencies\fR are not already installed. The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. +The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. Npm will not automatically install optional peer dependencies. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. .P For example: .P @@ -775,8 +775,6 @@ For example: } .fi .RE -.P -Marking a peer dependency as optional ensures npm will not emit a warning if the \fBsoy-milk\fR package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. .SS "bundleDependencies" .P This defines an array of package names that will be bundled when publishing the package. diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index c6a92af27f189c..6fe5ed2969216b 100644 --- a/deps/npm/man/man5/package-lock-json.5 +++ b/deps/npm/man/man5/package-lock-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE-LOCK.JSON" "5" "April 2024" "" "" +.TH "PACKAGE-LOCK.JSON" "5" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBpackage-lock.json\fR - A manifestation of the manifest .SS "Description" diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index ffbf3e50537e37..50b1ccc0bf2dc5 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "April 2024" "" "" +.TH "CONFIG" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBconfig\fR - More than you probably want to know about npm configuration .SS "Description" @@ -1219,7 +1219,7 @@ Type: Boolean .RE 0 .P -When set to \fBtrue\fR, npm will display a progress bar during time intensive operations, if \fBprocess.stderr\fR is a TTY. +When set to \fBtrue\fR, npm will display a progress bar during time intensive operations, if \fBprocess.stderr\fR and \fBprocess.stdout\fR are a TTY. .P Set to \fBfalse\fR to suppress the progress bar. .SS "\fBprovenance\fR" diff --git a/deps/npm/man/man7/dependency-selectors.7 b/deps/npm/man/man7/dependency-selectors.7 index 588989321c6ad1..ece9a2083857db 100644 --- a/deps/npm/man/man7/dependency-selectors.7 +++ b/deps/npm/man/man7/dependency-selectors.7 @@ -1,4 +1,4 @@ -.TH "QUERYING" "7" "April 2024" "" "" +.TH "QUERYING" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBQuerying\fR - Dependency Selector Syntax & Querying .SS "Description" diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index a69fcc052a6da0..fe0a04dccec87d 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "April 2024" "" "" +.TH "DEVELOPERS" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBdevelopers\fR - Developer Guide .SS "Description" diff --git a/deps/npm/man/man7/logging.7 b/deps/npm/man/man7/logging.7 index dfbed85ffbb07f..e96341d19bd1e3 100644 --- a/deps/npm/man/man7/logging.7 +++ b/deps/npm/man/man7/logging.7 @@ -1,4 +1,4 @@ -.TH "LOGGING" "7" "April 2024" "" "" +.TH "LOGGING" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBLogging\fR - Why, What & How We Log .SS "Description" diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index 181693d04032d7..5f34f1c193844a 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "April 2024" "" "" +.TH "ORGS" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBorgs\fR - Working with Teams & Orgs .SS "Description" diff --git a/deps/npm/man/man7/package-spec.7 b/deps/npm/man/man7/package-spec.7 index 167a6915218b94..871a75750d0592 100644 --- a/deps/npm/man/man7/package-spec.7 +++ b/deps/npm/man/man7/package-spec.7 @@ -1,4 +1,4 @@ -.TH "PACKAGE-SPEC" "7" "April 2024" "" "" +.TH "PACKAGE-SPEC" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBpackage-spec\fR - Package name specifier .SS "Description" diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index 73f17929c427aa..f92a028367b649 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "April 2024" "" "" +.TH "REGISTRY" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBregistry\fR - The JavaScript Package Registry .SS "Description" diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index 9b091566aaf453..21e159e0dec333 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "April 2024" "" "" +.TH "REMOVAL" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBremoval\fR - Cleaning the Slate .SS "Synopsis" @@ -11,13 +11,7 @@ sudo npm uninstall npm -g .fi .RE .P -Or, if that fails, get the npm source code, and do: -.P -.RS 2 -.nf -sudo make uninstall -.fi -.RE +Or, if that fails, please proceed to more severe uninstalling methods. .SS "More Severe Uninstalling" .P Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed. diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index 437a4df173394e..6082d1453bdeea 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "April 2024" "" "" +.TH "SCOPE" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBscope\fR - Scoped packages .SS "Description" diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index b051216d26213e..7942e6a39106c4 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "April 2024" "" "" +.TH "SCRIPTS" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBscripts\fR - How npm handles the "scripts" field .SS "Description" diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index 78242b33b18c7b..a3bed632375f3f 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "April 2024" "" "" +.TH "WORKSPACES" "7" "May 2024" "NPM@10.8.0" "" .SH "NAME" \fBworkspaces\fR - Working with workspaces .SS "Description" diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index 920403d231d6db..7808a4b0f86f12 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -53,48 +53,26 @@ const _addNodeToTrashList = Symbol.for('addNodeToTrashList') // they'll affect things deeper in, then alphabetical for consistency between // installs class DepsQueue { - // [{ sorted, items }] indexed by depth #deps = [] #sorted = true - #minDepth = 0 - #length = 0 get length () { - return this.#length + return this.#deps.length } push (item) { - if (!this.#deps[item.depth]) { - this.#length++ - this.#deps[item.depth] = { sorted: true, items: [item] } - // no minDepth check needed, this branch is only reached when we are in - // the middle of a shallower depth and creating a new one - return - } - if (!this.#deps[item.depth].items.includes(item)) { - this.#length++ - this.#deps[item.depth].sorted = false - this.#deps[item.depth].items.push(item) - if (item.depth < this.#minDepth) { - this.#minDepth = item.depth - } + if (!this.#deps.includes(item)) { + this.#sorted = false + this.#deps.push(item) } } pop () { - let depth - while (!depth?.items.length) { - depth = this.#deps[this.#minDepth] - if (!depth?.items.length) { - this.#minDepth++ - } + if (!this.#sorted) { + this.#deps.sort((a, b) => (a.depth - b.depth) || localeCompare(a.path, b.path)) + this.#sorted = true } - if (!depth.sorted) { - depth.items.sort((a, b) => localeCompare(a.path, b.path)) - depth.sorted = true - } - this.#length-- - return depth.items.shift() + return this.#deps.shift() } } @@ -1022,6 +1000,10 @@ This is a one-time fix-up, please be patient... // may well be an optional dep that has gone missing. it'll // fail later anyway. for (const e of this.#problemEdges(placed)) { + // XXX This is somehow load bearing. This makes tests that print + // the ideal tree of a tree with tarball dependencies fail. This + // can't be changed or removed till we figure out why + // The test is named "tarball deps with transitive tarball deps" promises.push(() => this.#fetchManifest(npa.resolve(e.name, e.spec, fromPath(placed, e))) .catch(() => null) @@ -1204,6 +1186,7 @@ This is a one-time fix-up, please be patient... const options = { ...this.options, avoid: this.#avoidRange(spec.name), + fullMetadata: true, } // get the intended spec and stored metadata from yarn.lock file, // if available and valid. @@ -1212,19 +1195,10 @@ This is a one-time fix-up, please be patient... if (this.#manifests.has(spec.raw)) { return this.#manifests.get(spec.raw) } else { - const cleanRawSpec = redact(spec.rawSpec) - log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, cleanRawSpec)) - const o = { - ...options, - fullMetadata: true, - } - const p = pacote.manifest(spec, o) - .then(({ license, ...mani }) => { - this.#manifests.set(spec.raw, mani) - return mani - }) - this.#manifests.set(spec.raw, p) - return p + log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, redact(spec.rawSpec))) + const mani = await pacote.manifest(spec, options) + this.#manifests.set(spec.raw, mani) + return mani } } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js index ba180f354708a2..b348d490def653 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -31,10 +31,10 @@ const { homedir } = require('os') const { depth } = require('treeverse') const mapWorkspaces = require('@npmcli/map-workspaces') const { log, time } = require('proc-log') - const { saveTypeMap } = require('../add-rm-pkg-deps.js') const AuditReport = require('../audit-report.js') const relpath = require('../relpath.js') +const PackumentCache = require('../packument-cache.js') const mixins = [ require('../tracker.js'), @@ -82,7 +82,7 @@ class Arborist extends Base { installStrategy: options.global ? 'shallow' : (options.installStrategy ? options.installStrategy : 'hoisted'), lockfileVersion: lockfileVersion(options.lockfileVersion), packageLockOnly: !!options.packageLockOnly, - packumentCache: options.packumentCache || new Map(), + packumentCache: options.packumentCache || new PackumentCache(), path: options.path || '.', rebuildBundle: 'rebuildBundle' in options ? !!options.rebuildBundle : true, replaceRegistryHost: options.replaceRegistryHost, diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js index bdc021b7c12a99..d5c5a478cce0b3 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js @@ -119,6 +119,8 @@ class Node { // package's dependencies in a virtual root. this.sourceReference = sourceReference + // TODO if this came from pacote.manifest we don't have to do this, + // we can be told to skip this step const pkg = sourceReference ? sourceReference.package : normalize(options.pkg || {}) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/packument-cache.js b/deps/npm/node_modules/@npmcli/arborist/lib/packument-cache.js new file mode 100644 index 00000000000000..26e463eb9d334d --- /dev/null +++ b/deps/npm/node_modules/@npmcli/arborist/lib/packument-cache.js @@ -0,0 +1,77 @@ +const { LRUCache } = require('lru-cache') +const { getHeapStatistics } = require('node:v8') +const { log } = require('proc-log') + +// This is an in-memory cache that Pacote uses for packuments. +// Packuments are usually cached on disk. This allows for rapid re-requests +// of the same packument to bypass disk reads. The tradeoff here is memory +// usage for disk reads. +class PackumentCache extends LRUCache { + static #heapLimit = Math.floor(getHeapStatistics().heap_size_limit) + + #sizeKey + #disposed = new Set() + + #log (...args) { + log.silly('packumentCache', ...args) + } + + constructor ({ + // How much of this.#heapLimit to take up + heapFactor = 0.25, + // How much of this.#maxSize we allow any one packument to take up + // Anything over this is not cached + maxEntryFactor = 0.5, + sizeKey = '_contentLength', + } = {}) { + const maxSize = Math.floor(PackumentCache.#heapLimit * heapFactor) + const maxEntrySize = Math.floor(maxSize * maxEntryFactor) + super({ + maxSize, + maxEntrySize, + sizeCalculation: (p) => { + // Don't cache if we dont know the size + // Some versions of pacote set this to `0`, newer versions set it to `null` + if (!p[sizeKey]) { + return maxEntrySize + 1 + } + if (p[sizeKey] < 10_000) { + return p[sizeKey] * 2 + } + if (p[sizeKey] < 1_000_000) { + return Math.floor(p[sizeKey] * 1.5) + } + // It is less beneficial to store a small amount of super large things + // at the cost of all other packuments. + return maxEntrySize + 1 + }, + dispose: (v, k) => { + this.#disposed.add(k) + this.#log(k, 'dispose') + }, + }) + this.#sizeKey = sizeKey + this.#log(`heap:${PackumentCache.#heapLimit} maxSize:${maxSize} maxEntrySize:${maxEntrySize}`) + } + + set (k, v, ...args) { + // we use disposed only for a logging signal if we are setting packuments that + // have already been evicted from the cache previously. logging here could help + // us tune this in the future. + const disposed = this.#disposed.has(k) + /* istanbul ignore next - this doesnt happen consistently so hard to test without resorting to unit tests */ + if (disposed) { + this.#disposed.delete(k) + } + this.#log(k, 'set', `size:${v[this.#sizeKey]} disposed:${disposed}`) + return super.set(k, v, ...args) + } + + has (k, ...args) { + const has = super.has(k, ...args) + this.#log(k, `cache-${has ? 'hit' : 'miss'}`) + return has + } +} + +module.exports = PackumentCache diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index 026abc55ccba18..111c73889c8767 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -1153,7 +1153,8 @@ class Shrinkwrap { && this.originalLockfileVersion !== this.lockfileVersion ) { log.warn( - `Converting lock file (${relative(process.cwd(), this.filename)}) from v${this.originalLockfileVersion} -> v${this.lockfileVersion}` + 'shrinkwrap', + `Converting lock file (${relative(process.cwd(), this.filename)}) from v${this.originalLockfileVersion} -> v${this.lockfileVersion}` ) } diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index 11c0ab4df3b529..b18a67659a76d5 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,32 +1,33 @@ { "name": "@npmcli/arborist", - "version": "7.5.1", + "version": "7.5.2", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/fs": "^3.1.0", + "@npmcli/fs": "^3.1.1", "@npmcli/installed-package-contents": "^2.1.0", "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/metavuln-calculator": "^7.1.0", + "@npmcli/metavuln-calculator": "^7.1.1", "@npmcli/name-from-folder": "^2.0.0", "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.1.0", "@npmcli/query": "^3.1.0", "@npmcli/redact": "^2.0.0", "@npmcli/run-script": "^8.1.0", - "bin-links": "^4.0.1", - "cacache": "^18.0.0", + "bin-links": "^4.0.4", + "cacache": "^18.0.3", "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^7.0.1", - "json-parse-even-better-errors": "^3.0.0", + "hosted-git-info": "^7.0.2", + "json-parse-even-better-errors": "^3.0.2", "json-stringify-nice": "^1.1.4", + "lru-cache": "^10.2.2", "minimatch": "^9.0.4", - "nopt": "^7.0.0", + "nopt": "^7.2.1", "npm-install-checks": "^6.2.0", "npm-package-arg": "^11.0.2", - "npm-pick-manifest": "^9.0.0", - "npm-registry-fetch": "^17.0.0", - "pacote": "^18.0.1", + "npm-pick-manifest": "^9.0.1", + "npm-registry-fetch": "^17.0.1", + "pacote": "^18.0.6", "parse-conflict-json": "^3.0.0", "proc-log": "^4.2.0", "proggy": "^2.0.0", @@ -34,13 +35,13 @@ "promise-call-limit": "^3.0.1", "read-package-json-fast": "^3.0.2", "semver": "^7.3.7", - "ssri": "^10.0.5", + "ssri": "^10.0.6", "treeverse": "^3.0.0", "walk-up-path": "^3.0.1" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "benchmark": "^2.1.4", "minify-registry-metadata": "^3.0.0", "nock": "^13.3.3", @@ -91,7 +92,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js index 57ab1716118386..2978aa4b55dacf 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js +++ b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js @@ -1549,13 +1549,16 @@ const definitions = { type: Boolean, description: ` When set to \`true\`, npm will display a progress bar during time - intensive operations, if \`process.stderr\` is a TTY. + intensive operations, if \`process.stderr\` and \`process.stdout\` are a TTY. Set to \`false\` to suppress the progress bar. `, flatten (key, obj, flatOptions) { flatOptions.progress = !obj.progress ? false - : !!process.stderr.isTTY && process.env.TERM !== 'dumb' + // progress is only written to stderr but we disable it unless stdout is a tty + // also. This prevents the progress from appearing when piping output to another + // command which doesn't break anything, but does look very odd to users. + : !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb' }, }), provenance: new Definition('provenance', { diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index c99292db9afb40..099bf2f5f15a0c 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -585,7 +585,7 @@ class Config { async #loadFile (file, type) { // only catch the error from readFile, not from the loadObject call - log.silly(`config:load:file:${file}`) + log.silly('config', `load:file:${file}`) await readFile(file, 'utf8').then( data => { const parsedConfig = ini.parse(data) @@ -684,7 +684,7 @@ class Config { if (w === this.localPrefix) { // see if there's a .npmrc file in the workspace, if so log a warning if (await fileExists(this.localPrefix, '.npmrc')) { - log.warn(`ignoring workspace config at ${this.localPrefix}/.npmrc`) + log.warn('config', `ignoring workspace config at ${this.localPrefix}/.npmrc`) } // set the workspace in the default layer, which allows it to be overridden easily @@ -692,7 +692,7 @@ class Config { data.workspace = [this.localPrefix] this.localPrefix = p this.localPackage = hasPackageJson - log.info(`found workspace root at ${this.localPrefix}`) + log.info('config', `found workspace root at ${this.localPrefix}`) // we found a root, so we return now return } diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index 8c59bc3ae3dff6..215175c7332262 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "8.3.1", + "version": "8.3.2", "files": [ "bin/", "lib/" @@ -32,14 +32,14 @@ "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/mock-globals": "^1.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.8" }, "dependencies": { "@npmcli/map-workspaces": "^3.0.2", "ci-info": "^4.0.0", "ini": "^4.1.2", - "nopt": "^7.0.0", + "nopt": "^7.2.1", "proc-log": "^4.2.0", "read-package-json-fast": "^3.0.2", "semver": "^7.3.5", @@ -50,7 +50,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/@npmcli/fs/package.json b/deps/npm/node_modules/@npmcli/fs/package.json index 28eb6133884189..5261a11b78000e 100644 --- a/deps/npm/node_modules/@npmcli/fs/package.json +++ b/deps/npm/node_modules/@npmcli/fs/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/fs", - "version": "3.1.0", + "version": "3.1.1", "description": "filesystem utilities for the npm cli", "main": "lib/index.js", "files": [ @@ -11,7 +11,7 @@ "snap": "tap", "test": "tap", "npmclilint": "npmcli-lint", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", "postsnap": "npm run lintfix --", @@ -20,7 +20,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/fs.git" + "url": "git+https://github.com/npm/fs.git" }, "keywords": [ "npm", @@ -30,7 +30,7 @@ "license": "ISC", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.8.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "dependencies": { @@ -41,7 +41,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.8.0" + "version": "4.22.0" }, "tap": { "nyc-arg": [ diff --git a/deps/npm/node_modules/@npmcli/git/lib/errors.js b/deps/npm/node_modules/@npmcli/git/lib/errors.js index 7aeac4762866f3..3ceaa458116690 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/errors.js +++ b/deps/npm/node_modules/@npmcli/git/lib/errors.js @@ -8,7 +8,7 @@ class GitError extends Error { } class GitConnectionError extends GitError { - constructor (message) { + constructor () { super('A git connection error occurred') } @@ -18,13 +18,13 @@ class GitConnectionError extends GitError { } class GitPathspecError extends GitError { - constructor (message) { + constructor () { super('The git reference could not be found') } } class GitUnknownError extends GitError { - constructor (message) { + constructor () { super('An unknown git error occurred') } } diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json index f7117f13a9399c..cc641d2b1ad920 100644 --- a/deps/npm/node_modules/@npmcli/git/package.json +++ b/deps/npm/node_modules/@npmcli/git/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/git", - "version": "5.0.6", + "version": "5.0.7", "main": "lib/index.js", "files": [ "bin/", @@ -9,7 +9,7 @@ "description": "a util for spawning git from npm CLI contexts", "repository": { "type": "git", - "url": "https://github.com/npm/git.git" + "url": "git+https://github.com/npm/git.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -31,7 +31,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "npm-package-arg": "^11.0.0", "slash": "^3.0.0", "tap": "^16.0.1" @@ -51,7 +51,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "publish": true } } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js index 2a4e08395e7edd..971409b5bad44e 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js @@ -107,7 +107,7 @@ class Calculator { const timeEnd = time.start(`metavuln:packument:${name}`) const p = pacote.packument(name, { ...this[_options] }) - .catch((er) => { + .catch(() => { // presumably not something from the registry. // an empty packument will have an effective range of * return { diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index 74c23ad62bd7a5..a7ec02d2ee72b2 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": "7.1.0", + "version": "7.1.1", "main": "lib/index.js", "files": [ "bin/", @@ -9,7 +9,7 @@ "description": "Calculate meta-vulnerabilities from package security advisories", "repository": { "type": "git", - "url": "https://github.com/npm/metavuln-calculator.git" + "url": "git+https://github.com/npm/metavuln-calculator.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -34,7 +34,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.4", + "@npmcli/template-oss": "4.22.0", "require-inject": "^1.4.4", "tap": "^16.0.1" }, @@ -50,7 +50,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.4", + "version": "4.22.0", "publish": "true", "ciVersions": [ "16.14.0", diff --git a/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js b/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js index b31395ebb5bcd4..e147cb8f9c746f 100644 --- a/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js +++ b/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js @@ -12,54 +12,55 @@ const promiseSpawn = (cmd, args, opts = {}, extra = {}) => { return spawnWithShell(cmd, args, opts, extra) } - let proc + let resolve, reject + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve + reject = _reject + }) - const p = new Promise((res, rej) => { - proc = spawn(cmd, args, opts) + // Create error here so we have a more useful stack trace when rejecting + const closeError = new Error('command failed') - const stdout = [] - const stderr = [] + const stdout = [] + const stderr = [] - const reject = er => rej(Object.assign(er, { - cmd, - args, - ...stdioResult(stdout, stderr, opts), - ...extra, - })) + const getResult = (result) => ({ + cmd, + args, + ...result, + ...stdioResult(stdout, stderr, opts), + ...extra, + }) + const rejectWithOpts = (er, erOpts) => { + const resultError = getResult(erOpts) + reject(Object.assign(er, resultError)) + } - proc.on('error', reject) + const proc = spawn(cmd, args, opts) + promise.stdin = proc.stdin + promise.process = proc - if (proc.stdout) { - proc.stdout.on('data', c => stdout.push(c)).on('error', reject) - proc.stdout.on('error', er => reject(er)) - } + proc.on('error', rejectWithOpts) - if (proc.stderr) { - proc.stderr.on('data', c => stderr.push(c)).on('error', reject) - proc.stderr.on('error', er => reject(er)) - } + if (proc.stdout) { + proc.stdout.on('data', c => stdout.push(c)) + proc.stdout.on('error', rejectWithOpts) + } - proc.on('close', (code, signal) => { - const result = { - cmd, - args, - code, - signal, - ...stdioResult(stdout, stderr, opts), - ...extra, - } + if (proc.stderr) { + proc.stderr.on('data', c => stderr.push(c)) + proc.stderr.on('error', rejectWithOpts) + } - if (code || signal) { - rej(Object.assign(new Error('command failed'), result)) - } else { - res(result) - } - }) + proc.on('close', (code, signal) => { + if (code || signal) { + rejectWithOpts(closeError, { code, signal }) + } else { + resolve(getResult({ code, signal })) + } }) - p.stdin = proc.stdin - p.process = proc - return p + return promise } const spawnWithShell = (cmd, args, opts, extra) => { diff --git a/deps/npm/node_modules/@npmcli/promise-spawn/package.json b/deps/npm/node_modules/@npmcli/promise-spawn/package.json index 6e161b7404b858..1b633f84596d20 100644 --- a/deps/npm/node_modules/@npmcli/promise-spawn/package.json +++ b/deps/npm/node_modules/@npmcli/promise-spawn/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/promise-spawn", - "version": "7.0.1", + "version": "7.0.2", "files": [ "bin/", "lib/" @@ -9,7 +9,7 @@ "description": "spawn processes the way the npm cli likes to do", "repository": { "type": "git", - "url": "https://github.com/npm/promise-spawn.git" + "url": "git+https://github.com/npm/promise-spawn.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -32,7 +32,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "spawk": "^1.7.1", "tap": "^16.0.1" }, @@ -41,7 +41,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "publish": true }, "dependencies": { diff --git a/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js b/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js index 9984f7879c73f1..8791aba27044bd 100644 --- a/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js +++ b/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js @@ -4,7 +4,7 @@ exports.ClientTrustConfig = exports.SigningConfig = exports.TrustedRoot = export /* eslint-disable */ const sigstore_common_1 = require("./sigstore_common"); function createBaseTransparencyLogInstance() { - return { baseUrl: "", hashAlgorithm: 0, publicKey: undefined, logId: undefined }; + return { baseUrl: "", hashAlgorithm: 0, publicKey: undefined, logId: undefined, checkpointKeyId: undefined }; } exports.TransparencyLogInstance = { fromJSON(object) { @@ -13,6 +13,7 @@ exports.TransparencyLogInstance = { hashAlgorithm: isSet(object.hashAlgorithm) ? (0, sigstore_common_1.hashAlgorithmFromJSON)(object.hashAlgorithm) : 0, publicKey: isSet(object.publicKey) ? sigstore_common_1.PublicKey.fromJSON(object.publicKey) : undefined, logId: isSet(object.logId) ? sigstore_common_1.LogId.fromJSON(object.logId) : undefined, + checkpointKeyId: isSet(object.checkpointKeyId) ? sigstore_common_1.LogId.fromJSON(object.checkpointKeyId) : undefined, }; }, toJSON(message) { @@ -22,6 +23,8 @@ exports.TransparencyLogInstance = { message.publicKey !== undefined && (obj.publicKey = message.publicKey ? sigstore_common_1.PublicKey.toJSON(message.publicKey) : undefined); message.logId !== undefined && (obj.logId = message.logId ? sigstore_common_1.LogId.toJSON(message.logId) : undefined); + message.checkpointKeyId !== undefined && + (obj.checkpointKeyId = message.checkpointKeyId ? sigstore_common_1.LogId.toJSON(message.checkpointKeyId) : undefined); return obj; }, }; diff --git a/deps/npm/node_modules/@sigstore/protobuf-specs/package.json b/deps/npm/node_modules/@sigstore/protobuf-specs/package.json index 4fefe51c761fd8..92ae4acbd00ec5 100644 --- a/deps/npm/node_modules/@sigstore/protobuf-specs/package.json +++ b/deps/npm/node_modules/@sigstore/protobuf-specs/package.json @@ -1,6 +1,6 @@ { "name": "@sigstore/protobuf-specs", - "version": "0.3.1", + "version": "0.3.2", "description": "code-signing for npm packages", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/deps/npm/node_modules/@sigstore/sign/dist/external/error.js b/deps/npm/node_modules/@sigstore/sign/dist/external/error.js index 0dad92ea69414f..a6a65adebb1767 100644 --- a/deps/npm/node_modules/@sigstore/sign/dist/external/error.js +++ b/deps/npm/node_modules/@sigstore/sign/dist/external/error.js @@ -1,6 +1,21 @@ "use strict"; +/* +Copyright 2023 The Sigstore Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkStatus = exports.HTTPError = void 0; +exports.HTTPError = void 0; class HTTPError extends Error { constructor({ status, message, location, }) { super(`(${status}) ${message}`); @@ -9,30 +24,3 @@ class HTTPError extends Error { } } exports.HTTPError = HTTPError; -const checkStatus = async (response) => { - if (response.ok) { - return response; - } - else { - let message = response.statusText; - const location = response.headers?.get('Location') || undefined; - const contentType = response.headers?.get('Content-Type'); - // If response type is JSON, try to parse the body for a message - if (contentType?.includes('application/json')) { - try { - await response.json().then((body) => { - message = body.message; - }); - } - catch (e) { - // ignore - } - } - throw new HTTPError({ - status: response.status, - message: message, - location: location, - }); - } -}; -exports.checkStatus = checkStatus; diff --git a/deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js b/deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js new file mode 100644 index 00000000000000..b2d81bde7be16f --- /dev/null +++ b/deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js @@ -0,0 +1,99 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fetchWithRetry = void 0; +/* +Copyright 2023 The Sigstore Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +const http2_1 = require("http2"); +const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); +const proc_log_1 = require("proc-log"); +const promise_retry_1 = __importDefault(require("promise-retry")); +const util_1 = require("../util"); +const error_1 = require("./error"); +const { HTTP2_HEADER_LOCATION, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_USER_AGENT, HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_TOO_MANY_REQUESTS, HTTP_STATUS_REQUEST_TIMEOUT, } = http2_1.constants; +async function fetchWithRetry(url, options) { + return (0, promise_retry_1.default)(async (retry, attemptNum) => { + const method = options.method || 'POST'; + const headers = { + [HTTP2_HEADER_USER_AGENT]: util_1.ua.getUserAgent(), + ...options.headers, + }; + const response = await (0, make_fetch_happen_1.default)(url, { + method, + headers, + body: options.body, + timeout: options.timeout, + retry: false, // We're handling retries ourselves + }).catch((reason) => { + proc_log_1.log.http('fetch', `${method} ${url} attempt ${attemptNum} failed with ${reason}`); + return retry(reason); + }); + if (response.ok) { + return response; + } + else { + const error = await errorFromResponse(response); + proc_log_1.log.http('fetch', `${method} ${url} attempt ${attemptNum} failed with ${response.status}`); + if (retryable(response.status)) { + return retry(error); + } + else { + throw error; + } + } + }, retryOpts(options.retry)); +} +exports.fetchWithRetry = fetchWithRetry; +// Translate a Response into an HTTPError instance. This will attempt to parse +// the response body for a message, but will default to the statusText if none +// is found. +const errorFromResponse = async (response) => { + let message = response.statusText; + const location = response.headers?.get(HTTP2_HEADER_LOCATION) || undefined; + const contentType = response.headers?.get(HTTP2_HEADER_CONTENT_TYPE); + // If response type is JSON, try to parse the body for a message + if (contentType?.includes('application/json')) { + try { + const body = await response.json(); + message = body.message || message; + } + catch (e) { + // ignore + } + } + return new error_1.HTTPError({ + status: response.status, + message: message, + location: location, + }); +}; +// Determine if a status code is retryable. This includes 5xx errors, 408, and +// 429. +const retryable = (status) => [HTTP_STATUS_REQUEST_TIMEOUT, HTTP_STATUS_TOO_MANY_REQUESTS].includes(status) || status >= HTTP_STATUS_INTERNAL_SERVER_ERROR; +// Normalize the retry options to the format expected by promise-retry +const retryOpts = (retry) => { + if (typeof retry === 'boolean') { + return { retries: retry ? 1 : 0 }; + } + else if (typeof retry === 'number') { + return { retries: retry }; + } + else { + return { retries: 0, ...retry }; + } +}; diff --git a/deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js b/deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js index f00b62e147cd7f..de6a1ad9f9e797 100644 --- a/deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js +++ b/deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js @@ -1,7 +1,4 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Fulcio = void 0; /* @@ -19,33 +16,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); -const util_1 = require("../util"); -const error_1 = require("./error"); +const fetch_1 = require("./fetch"); /** * Fulcio API client. */ class Fulcio { constructor(options) { - this.fetch = make_fetch_happen_1.default.defaults({ - retry: options.retry, - timeout: options.timeout, + this.options = options; + } + async createSigningCertificate(request) { + const { baseURL, retry, timeout } = this.options; + const url = `${baseURL}/api/v2/signingCert`; + const response = await (0, fetch_1.fetchWithRetry)(url, { headers: { 'Content-Type': 'application/json', - 'User-Agent': util_1.ua.getUserAgent(), }, - }); - this.baseUrl = options.baseURL; - } - async createSigningCertificate(request) { - const url = `${this.baseUrl}/api/v2/signingCert`; - const response = await this.fetch(url, { - method: 'POST', body: JSON.stringify(request), + timeout, + retry, }); - await (0, error_1.checkStatus)(response); - const data = await response.json(); - return data; + return response.json(); } } exports.Fulcio = Fulcio; diff --git a/deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js b/deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js index 6f6cb96cc9c5cb..bb59a126e032fb 100644 --- a/deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js +++ b/deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js @@ -1,7 +1,4 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Rekor = void 0; /* @@ -19,23 +16,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); -const util_1 = require("../util"); -const error_1 = require("./error"); +const fetch_1 = require("./fetch"); /** * Rekor API client. */ class Rekor { constructor(options) { - this.fetch = make_fetch_happen_1.default.defaults({ - retry: options.retry, - timeout: options.timeout, - headers: { - Accept: 'application/json', - 'User-Agent': util_1.ua.getUserAgent(), - }, - }); - this.baseUrl = options.baseURL; + this.options = options; } /** * Create a new entry in the Rekor log. @@ -43,13 +30,17 @@ class Rekor { * @returns {Promise} The created entry */ async createEntry(propsedEntry) { - const url = `${this.baseUrl}/api/v1/log/entries`; - const response = await this.fetch(url, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/log/entries`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, body: JSON.stringify(propsedEntry), + timeout, + retry, }); - await (0, error_1.checkStatus)(response); const data = await response.json(); return entryFromResponse(data); } @@ -59,44 +50,18 @@ class Rekor { * @returns {Promise} The retrieved entry */ async getEntry(uuid) { - const url = `${this.baseUrl}/api/v1/log/entries/${uuid}`; - const response = await this.fetch(url); - await (0, error_1.checkStatus)(response); - const data = await response.json(); - return entryFromResponse(data); - } - /** - * Search the Rekor log index for entries matching the given query. - * @param opts {SearchIndex} Options to search the Rekor log - * @returns {Promise} UUIDs of matching entries - */ - async searchIndex(opts) { - const url = `${this.baseUrl}/api/v1/index/retrieve`; - const response = await this.fetch(url, { - method: 'POST', - body: JSON.stringify(opts), - headers: { 'Content-Type': 'application/json' }, + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/log/entries/${uuid}`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + method: 'GET', + headers: { + Accept: 'application/json', + }, + timeout, + retry, }); - await (0, error_1.checkStatus)(response); const data = await response.json(); - return data; - } - /** - * Search the Rekor logs for matching the given query. - * @param opts {SearchLogQuery} Query to search the Rekor log - * @returns {Promise} List of matching entries - */ - async searchLog(opts) { - const url = `${this.baseUrl}/api/v1/log/entries/retrieve`; - const response = await this.fetch(url, { - method: 'POST', - body: JSON.stringify(opts), - headers: { 'Content-Type': 'application/json' }, - }); - await (0, error_1.checkStatus)(response); - const rawData = await response.json(); - const data = rawData.map((d) => entryFromResponse(d)); - return data; + return entryFromResponse(data); } } exports.Rekor = Rekor; diff --git a/deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js b/deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js index 252c14f2d32d87..a948ba9cca2c72 100644 --- a/deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js +++ b/deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js @@ -1,7 +1,4 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.TimestampAuthority = void 0; /* @@ -19,28 +16,22 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); -const util_1 = require("../util"); -const error_1 = require("./error"); +const fetch_1 = require("./fetch"); class TimestampAuthority { constructor(options) { - this.fetch = make_fetch_happen_1.default.defaults({ - retry: options.retry, - timeout: options.timeout, + this.options = options; + } + async createTimestamp(request) { + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/timestamp`; + const response = await (0, fetch_1.fetchWithRetry)(url, { headers: { 'Content-Type': 'application/json', - 'User-Agent': util_1.ua.getUserAgent(), }, - }); - this.baseUrl = options.baseURL; - } - async createTimestamp(request) { - const url = `${this.baseUrl}/api/v1/timestamp`; - const response = await this.fetch(url, { - method: 'POST', body: JSON.stringify(request), + timeout, + retry, }); - await (0, error_1.checkStatus)(response); return response.buffer(); } } diff --git a/deps/npm/node_modules/@sigstore/sign/package.json b/deps/npm/node_modules/@sigstore/sign/package.json index 09eea0a39e8771..47d8fed2e6ab38 100644 --- a/deps/npm/node_modules/@sigstore/sign/package.json +++ b/deps/npm/node_modules/@sigstore/sign/package.json @@ -1,6 +1,6 @@ { "name": "@sigstore/sign", - "version": "2.3.0", + "version": "2.3.1", "description": "Sigstore signing library", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -27,15 +27,18 @@ }, "devDependencies": { "@sigstore/jest": "^0.0.0", - "@sigstore/mock": "^0.7.0", + "@sigstore/mock": "^0.7.3", "@sigstore/rekor-types": "^2.0.0", - "@types/make-fetch-happen": "^10.0.4" + "@types/make-fetch-happen": "^10.0.4", + "@types/promise-retry": "^1.1.6" }, "dependencies": { "@sigstore/bundle": "^2.3.0", "@sigstore/core": "^1.0.0", "@sigstore/protobuf-specs": "^0.3.1", - "make-fetch-happen": "^13.0.0" + "make-fetch-happen": "^13.0.1", + "proc-log": "^4.2.0", + "promise-retry": "^2.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" diff --git a/deps/npm/node_modules/@sigstore/tuf/package.json b/deps/npm/node_modules/@sigstore/tuf/package.json index fc842df1814700..d56d45cfc80a84 100644 --- a/deps/npm/node_modules/@sigstore/tuf/package.json +++ b/deps/npm/node_modules/@sigstore/tuf/package.json @@ -1,6 +1,6 @@ { "name": "@sigstore/tuf", - "version": "2.3.2", + "version": "2.3.3", "description": "Client for the Sigstore TUF repository", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -28,12 +28,12 @@ }, "devDependencies": { "@sigstore/jest": "^0.0.0", - "@tufjs/repo-mock": "^2.0.0", + "@tufjs/repo-mock": "^2.0.1", "@types/make-fetch-happen": "^10.0.4" }, "dependencies": { "@sigstore/protobuf-specs": "^0.3.0", - "tuf-js": "^2.2.0" + "tuf-js": "^2.2.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" diff --git a/deps/npm/node_modules/@tufjs/models/package.json b/deps/npm/node_modules/@tufjs/models/package.json index 60368242ab556a..be581591a0f3a3 100644 --- a/deps/npm/node_modules/@tufjs/models/package.json +++ b/deps/npm/node_modules/@tufjs/models/package.json @@ -1,6 +1,6 @@ { "name": "@tufjs/models", - "version": "2.0.0", + "version": "2.0.1", "description": "TUF metadata models", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -29,7 +29,7 @@ "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/models#readme", "dependencies": { "@tufjs/canonical-json": "2.0.0", - "minimatch": "^9.0.3" + "minimatch": "^9.0.4" }, "engines": { "node": "^16.14.0 || >=18.0.0" diff --git a/deps/npm/node_modules/bin-links/lib/shim-bin.js b/deps/npm/node_modules/bin-links/lib/shim-bin.js index d5e19c0f9617fe..67e2702702f0a8 100644 --- a/deps/npm/node_modules/bin-links/lib/shim-bin.js +++ b/deps/npm/node_modules/bin-links/lib/shim-bin.js @@ -17,7 +17,7 @@ const fixBin = require('./fix-bin.js') // nondeterminism. const seen = new Set() -const failEEXIST = ({ path, to, from }) => +const failEEXIST = ({ to, from }) => Promise.reject(Object.assign(new Error('EEXIST: file already exists'), { path: to, dest: from, diff --git a/deps/npm/node_modules/bin-links/package.json b/deps/npm/node_modules/bin-links/package.json index d5c11f7971f942..1872756bb4b48c 100644 --- a/deps/npm/node_modules/bin-links/package.json +++ b/deps/npm/node_modules/bin-links/package.json @@ -1,12 +1,12 @@ { "name": "bin-links", - "version": "4.0.3", + "version": "4.0.4", "description": "JavaScript package binary linker", "main": "./lib/index.js", "scripts": { "snap": "tap", "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", @@ -14,7 +14,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/bin-links.git" + "url": "git+https://github.com/npm/bin-links.git" }, "keywords": [ "npm", @@ -30,7 +30,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.19.0", + "@npmcli/template-oss": "4.22.0", "require-inject": "^1.4.4", "tap": "^16.0.1" }, @@ -53,7 +53,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.19.0", + "version": "4.22.0", "publish": true } } diff --git a/deps/npm/node_modules/builtins/License b/deps/npm/node_modules/builtins/License deleted file mode 100644 index b142e5dc081331..00000000000000 --- a/deps/npm/node_modules/builtins/License +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2015 Julian Gruber - -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/builtins/index.js b/deps/npm/node_modules/builtins/index.js deleted file mode 100644 index 01d23876aae325..00000000000000 --- a/deps/npm/node_modules/builtins/index.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict' - -const satisfies = require('semver/functions/satisfies') - -const permanentModules = [ - 'assert', - 'buffer', - 'child_process', - 'cluster', - 'console', - 'constants', - 'crypto', - 'dgram', - 'dns', - 'domain', - 'events', - 'fs', - 'http', - 'https', - 'module', - 'net', - 'os', - 'path', - 'punycode', - 'querystring', - 'readline', - 'repl', - 'stream', - 'string_decoder', - 'sys', - 'timers', - 'tls', - 'tty', - 'url', - 'util', - 'vm', - 'zlib' -] - -const versionLockedModules = { - freelist: '<6.0.0', - v8: '>=1.0.0', - process: '>=1.1.0', - inspector: '>=8.0.0', - async_hooks: '>=8.1.0', - http2: '>=8.4.0', - perf_hooks: '>=8.5.0', - trace_events: '>=10.0.0', - worker_threads: '>=12.0.0', - 'node:test': '>=18.0.0' -} - -const experimentalModules = { - worker_threads: '>=10.5.0', - wasi: '>=12.16.0', - diagnostics_channel: '^14.17.0 || >=15.1.0' -} - -module.exports = ({ version = process.version, experimental = false } = {}) => { - const builtins = [...permanentModules] - - for (const [name, semverRange] of Object.entries(versionLockedModules)) { - if (version === '*' || satisfies(version, semverRange)) { - builtins.push(name) - } - } - - if (experimental) { - for (const [name, semverRange] of Object.entries(experimentalModules)) { - if ( - !builtins.includes(name) && - (version === '*' || satisfies(version, semverRange)) - ) { - builtins.push(name) - } - } - } - - return builtins -} diff --git a/deps/npm/node_modules/builtins/package.json b/deps/npm/node_modules/builtins/package.json deleted file mode 100644 index d37e02e0768180..00000000000000 --- a/deps/npm/node_modules/builtins/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "builtins", - "version": "5.1.0", - "description": "List of node.js builtin modules", - "repository": "juliangruber/builtins", - "license": "MIT", - "main": "index.js", - "files": [], - "scripts": { - "test": "standard --fix && node--test" - }, - "dependencies": { - "semver": "^7.0.0" - }, - "devDependencies": { - "standard": "^17.0.0", - "test": "^3.0.0" - } -} diff --git a/deps/npm/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/cacache/lib/content/read.js index a1fa8a08cc0f93..5f6192c3cec566 100644 --- a/deps/npm/node_modules/cacache/lib/content/read.js +++ b/deps/npm/node_modules/cacache/lib/content/read.js @@ -71,7 +71,7 @@ function readStream (cache, integrity, opts = {}) { module.exports.copy = copy function copy (cache, integrity, dest) { - return withContentSri(cache, integrity, (cpath, sri) => { + return withContentSri(cache, integrity, (cpath) => { return fs.copyFile(cpath, dest) }) } diff --git a/deps/npm/node_modules/cacache/lib/content/write.js b/deps/npm/node_modules/cacache/lib/content/write.js index 09ca4e4e5a4d3f..e7187abca8788a 100644 --- a/deps/npm/node_modules/cacache/lib/content/write.js +++ b/deps/npm/node_modules/cacache/lib/content/write.js @@ -160,7 +160,7 @@ async function makeTmp (cache, opts) { } } -async function moveToDestination (tmp, cache, sri, opts) { +async function moveToDestination (tmp, cache, sri) { const destination = contentPath(cache, sri) const destDir = path.dirname(destination) if (moveOperations.has(destination)) { diff --git a/deps/npm/node_modules/cacache/lib/entry-index.js b/deps/npm/node_modules/cacache/lib/entry-index.js index 722a37af5ce157..5bc21893827701 100644 --- a/deps/npm/node_modules/cacache/lib/entry-index.js +++ b/deps/npm/node_modules/cacache/lib/entry-index.js @@ -240,7 +240,7 @@ async function bucketEntries (bucket, filter) { return _bucketEntries(data, filter) } -function _bucketEntries (data, filter) { +function _bucketEntries (data) { const entries = [] data.split('\n').forEach((entry) => { if (!entry) { diff --git a/deps/npm/node_modules/cacache/lib/verify.js b/deps/npm/node_modules/cacache/lib/verify.js index 62e85c946490fc..d7423da1295b68 100644 --- a/deps/npm/node_modules/cacache/lib/verify.js +++ b/deps/npm/node_modules/cacache/lib/verify.js @@ -68,11 +68,11 @@ async function verify (cache, opts) { return stats } -async function markStartTime (cache, opts) { +async function markStartTime () { return { startTime: new Date() } } -async function markEndTime (cache, opts) { +async function markEndTime () { return { endTime: new Date() } } @@ -213,7 +213,7 @@ async function rebuildIndex (cache, opts) { return stats } -async function rebuildBucket (cache, bucket, stats, opts) { +async function rebuildBucket (cache, bucket, stats) { await truncate(bucket._path) // This needs to be serialized because cacache explicitly // lets very racy bucket conflicts clobber each other. diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index 3f87af3e7dbcee..0741183efc19b6 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "18.0.2", + "version": "18.0.3", "cache-version": { "content": "2", "index": "5" @@ -26,7 +26,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/cacache.git" + "url": "git+https://github.com/npm/cacache.git" }, "keywords": [ "cache", @@ -60,7 +60,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.0" }, "engines": { @@ -69,7 +69,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.21.3", + "version": "4.22.0", "publish": "true" }, "author": "GitHub Inc.", diff --git a/deps/npm/node_modules/cmd-shim/lib/index.js b/deps/npm/node_modules/cmd-shim/lib/index.js index 9cf2243ebf035f..c13890aed3263c 100644 --- a/deps/npm/node_modules/cmd-shim/lib/index.js +++ b/deps/npm/node_modules/cmd-shim/lib/index.js @@ -56,7 +56,7 @@ const writeShim = (from, to) => const prog = shebang[2] const args = shebang[3] || '' return writeShim_(from, to, prog, args, vars) - }, er => writeShim_(from, to)) + }, () => writeShim_(from, to)) const writeShim_ = (from, to, prog, args, variables) => { let shTarget = relative(dirname(to), from) diff --git a/deps/npm/node_modules/cmd-shim/package.json b/deps/npm/node_modules/cmd-shim/package.json index ec274b2768fbb7..094ca2df619d21 100644 --- a/deps/npm/node_modules/cmd-shim/package.json +++ b/deps/npm/node_modules/cmd-shim/package.json @@ -1,11 +1,11 @@ { "name": "cmd-shim", - "version": "6.0.2", + "version": "6.0.3", "description": "Used in npm for command line application support", "scripts": { "test": "tap", "snap": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -13,12 +13,12 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/cmd-shim.git" + "url": "git+https://github.com/npm/cmd-shim.git" }, "license": "ISC", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.19.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "files": [ @@ -41,7 +41,7 @@ "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.19.0", + "version": "4.22.0", "publish": true } } diff --git a/deps/npm/node_modules/glob/dist/commonjs/glob.js b/deps/npm/node_modules/glob/dist/commonjs/glob.js index 5e37335c4426f1..7734487d380526 100644 --- a/deps/npm/node_modules/glob/dist/commonjs/glob.js +++ b/deps/npm/node_modules/glob/dist/commonjs/glob.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Glob = void 0; const minimatch_1 = require("minimatch"); const path_scurry_1 = require("path-scurry"); -const url_1 = require("url"); +const node_url_1 = require("node:url"); const pattern_js_1 = require("./pattern.js"); const walker_js_1 = require("./walker.js"); // if no process global, just call it linux. @@ -77,7 +77,7 @@ class Glob { this.cwd = ''; } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) { - opts.cwd = (0, url_1.fileURLToPath)(opts.cwd); + opts.cwd = (0, node_url_1.fileURLToPath)(opts.cwd); } this.cwd = opts.cwd || ''; this.root = opts.root; diff --git a/deps/npm/node_modules/glob/dist/commonjs/glob.js.map b/deps/npm/node_modules/glob/dist/commonjs/glob.js.map index 98601fe30edf96..f7114efa5f2073 100644 --- a/deps/npm/node_modules/glob/dist/commonjs/glob.js.map +++ b/deps/npm/node_modules/glob/dist/commonjs/glob.js.map @@ -1 +1 @@ -{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"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","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAEvD,6CAOoB;AACpB,uCAAwC;AAExC,6CAAsC;AACtC,2CAAoD;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;IAClC,CAAC,CAAC,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAgTb;;GAEG;AACH,MAAa,IAAI;IACf,QAAQ,CAAU;IAClB,GAAG,CAAQ;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAiC;IACvC,aAAa,CAAS;IACtB,IAAI,CAAU;IACd,SAAS,CAAS;IAClB,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAAK,CAAS;IACd,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,OAAO,CAAU;IACjB,QAAQ,CAAiB;IACzB,QAAQ,CAAS;IACjB,MAAM,CAAY;IAClB,IAAI,CAAS;IACb,MAAM,CAAc;IACpB,oBAAoB,CAAS;IAC7B,aAAa,CAAiB;IAE9B;;OAEG;IACH,IAAI,CAAM;IAEV;;OAEG;IACH,QAAQ,CAAW;IAEnB;;;;;;;;;;;OAWG;IACH,YAAY,OAA0B,EAAE,IAAU;QAChD,qBAAqB;QACrB,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAA;QACvD,oBAAoB;QACpB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,aAAgC,CAAA;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA;QAC3B,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAA;QACrC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;SACd;aAAM,IAAI,IAAI,CAAC,GAAG,YAAY,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YACpE,IAAI,CAAC,GAAG,GAAG,IAAA,wBAAa,EAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACnC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAA;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAE7B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,QAAQ;YACX,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAA;QAC9D,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;SAC9D;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;SACpB;QAED,IAAI,CAAC,oBAAoB;YACvB,CAAC,CAAC,IAAI,CAAC,oBAAoB;gBAC1B,IAAoB,CAAC,kBAAkB,KAAK,KAAK,CAAA;QAEpD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;SAClD;QAED,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAA;aACvD;YACD,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;SAChE;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;QAChD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;YACzB,IACE,IAAI,CAAC,MAAM,KAAK,SAAS;gBACzB,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,EAClC;gBACA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;aACpE;SACF;aAAM;YACL,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ,KAAK,OAAO;gBACvB,CAAC,CAAC,6BAAe;gBACjB,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ;oBAC5B,CAAC,CAAC,8BAAgB;oBAClB,CAAC,CAAC,IAAI,CAAC,QAAQ;wBACf,CAAC,CAAC,6BAAe;wBACjB,CAAC,CAAC,wBAAU,CAAA;YAChB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACjC,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;aACZ,CAAC,CAAA;SACH;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAEhC,8DAA8D;QAC9D,0DAA0D;QAC1D,6DAA6D;QAC7D,kCAAkC;QAClC,MAAM,eAAe,GACnB,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAA;QAEzD,MAAM,GAAG,GAAqB;YAC5B,mCAAmC;YACnC,GAAG,IAAI;YACP,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,eAAe;YACf,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,CAAC;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;SACzB,CAAA;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,qBAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;QACxD,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CACtC,CAAC,GAA0B,EAAE,CAAC,EAAE,EAAE;YAChC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YACrB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAA;YAC3B,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,CACT,CAAA;QACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;YACtB,qBAAqB;YACrB,IAAI,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;YACjD,oBAAoB;YACpB,OAAO,IAAI,oBAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC;IAMD,KAAK,CAAC,IAAI;QACR,kEAAkE;QAClE,iEAAiE;QACjE,uEAAuE;QACvE,sCAAsC;QACtC,OAAO;YACL,GAAG,CAAC,MAAM,IAAI,sBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;gBACvD,GAAG,IAAI,CAAC,IAAI;gBACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ;oBACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;oBACzC,CAAC,CAAC,QAAQ;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC,IAAI,EAAE,CAAC;SACX,CAAA;IACH,CAAC;IAMD,QAAQ;QACN,OAAO;YACL,GAAG,IAAI,sBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;gBAChD,GAAG,IAAI,CAAC,IAAI;gBACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ;oBACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;oBACzC,CAAC,CAAC,QAAQ;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC,QAAQ,EAAE;SACd,CAAA;IACH,CAAC;IAMD,MAAM;QACJ,OAAO,IAAI,sBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACpD,GAAG,IAAI,CAAC,IAAI;YACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ;gBACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;gBACzC,CAAC,CAAC,QAAQ;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,MAAM,EAAE,CAAA;IACb,CAAC;IAMD,UAAU;QACR,OAAO,IAAI,sBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACpD,GAAG,IAAI,CAAC,IAAI;YACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ;gBACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;gBACzC,CAAC,CAAC,QAAQ;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,UAAU,EAAE,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC7C,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF;AAzQD,oBAyQC","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'node:url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/dist/esm/glob.js b/deps/npm/node_modules/glob/dist/esm/glob.js index 2a2b15d3685b88..0b9384e19f88f2 100644 --- a/deps/npm/node_modules/glob/dist/esm/glob.js +++ b/deps/npm/node_modules/glob/dist/esm/glob.js @@ -1,6 +1,6 @@ import { Minimatch } from 'minimatch'; import { PathScurry, PathScurryDarwin, PathScurryPosix, PathScurryWin32, } from 'path-scurry'; -import { fileURLToPath } from 'url'; +import { fileURLToPath } from 'node:url'; import { Pattern } from './pattern.js'; import { GlobStream, GlobWalker } from './walker.js'; // if no process global, just call it linux. diff --git a/deps/npm/node_modules/glob/dist/esm/glob.js.map b/deps/npm/node_modules/glob/dist/esm/glob.js.map index d08e810250ec64..55c095ce096dc2 100644 --- a/deps/npm/node_modules/glob/dist/esm/glob.js.map +++ b/deps/npm/node_modules/glob/dist/esm/glob.js.map @@ -1 +1 @@ -{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"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","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"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","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'node:url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json index 2caac096136c98..6d93c9f9787ddf 100644 --- a/deps/npm/node_modules/glob/package.json +++ b/deps/npm/node_modules/glob/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (https://blog.izs.me/)", "name": "glob", "description": "the most correct and second fastest glob implementation in JavaScript", - "version": "10.3.12", + "version": "10.3.15", "type": "module", "tshy": { "main": true, @@ -70,7 +70,7 @@ "jackspeak": "^2.3.6", "minimatch": "^9.0.1", "minipass": "^7.0.4", - "path-scurry": "^1.10.2" + "path-scurry": "^1.11.0" }, "devDependencies": { "@types/node": "^20.11.30", @@ -93,6 +93,6 @@ "url": "https://github.com/sponsors/isaacs" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" } } diff --git a/deps/npm/node_modules/hosted-git-info/lib/hosts.js b/deps/npm/node_modules/hosted-git-info/lib/hosts.js index 6dac685f42cef3..9a08efd1b2d7e9 100644 --- a/deps/npm/node_modules/hosted-git-info/lib/hosts.js +++ b/deps/npm/node_modules/hosted-git-info/lib/hosts.js @@ -199,7 +199,7 @@ hosts.sourcehut = { `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'HEAD'}.tar.gz`, - bugstemplate: ({ user, project }) => null, + bugstemplate: () => null, extract: (url) => { let [, user, project, aux] = url.pathname.split('/', 4) diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json index c2e31fa52676a0..d7eebd474f6258 100644 --- a/deps/npm/node_modules/hosted-git-info/package.json +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -1,11 +1,11 @@ { "name": "hosted-git-info", - "version": "7.0.1", + "version": "7.0.2", "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", "main": "./lib/index.js", "repository": { "type": "git", - "url": "https://github.com/npm/hosted-git-info.git" + "url": "git+https://github.com/npm/hosted-git-info.git" }, "keywords": [ "git", @@ -24,7 +24,7 @@ "snap": "tap", "test": "tap", "test:coverage": "tap --coverage-report=html", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", "template-oss-apply": "template-oss-apply --force" @@ -34,7 +34,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "files": [ @@ -54,13 +54,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", - "publish": "true", - "ciVersions": [ - "16.14.0", - "16.x", - "18.0.0", - "18.x" - ] + "version": "4.22.0", + "publish": "true" } } diff --git a/deps/npm/node_modules/ignore-walk/lib/index.js b/deps/npm/node_modules/ignore-walk/lib/index.js index ad3aecc7389c69..366d95e2d516cb 100644 --- a/deps/npm/node_modules/ignore-walk/lib/index.js +++ b/deps/npm/node_modules/ignore-walk/lib/index.js @@ -85,7 +85,7 @@ class Walker extends EE { .filter(e => this.isIgnoreFile(e)) let igCount = newIg.length - const then = _ => { + const then = () => { if (--igCount === 0) { this.filterEntries() } @@ -141,7 +141,7 @@ class Walker extends EE { if (entryCount === 0) { this.emit('done', this.result) } else { - const then = _ => { + const then = () => { if (--entryCount === 0) { this.emit('done', this.result) } diff --git a/deps/npm/node_modules/ignore-walk/package.json b/deps/npm/node_modules/ignore-walk/package.json index cebd4795f953af..f44a7a587a10bb 100644 --- a/deps/npm/node_modules/ignore-walk/package.json +++ b/deps/npm/node_modules/ignore-walk/package.json @@ -1,18 +1,18 @@ { "name": "ignore-walk", - "version": "6.0.4", + "version": "6.0.5", "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.", "main": "lib/index.js", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.19.0", + "@npmcli/template-oss": "4.22.0", "mutate-fs": "^2.1.1", "tap": "^16.0.1" }, "scripts": { "test": "tap", "posttest": "npm run lint", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "lintfix": "npm run lint -- --fix", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", @@ -31,7 +31,7 @@ "license": "ISC", "repository": { "type": "git", - "url": "https://github.com/npm/ignore-walk.git" + "url": "git+https://github.com/npm/ignore-walk.git" }, "files": [ "bin/", @@ -56,7 +56,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.19.0", + "version": "4.22.0", "content": "scripts/template-oss", "publish": "true" } diff --git a/deps/npm/node_modules/init-package-json/lib/init-package-json.js b/deps/npm/node_modules/init-package-json/lib/init-package-json.js index 23fd3dc94dbe4b..51cbd21a1ebe6a 100644 --- a/deps/npm/node_modules/init-package-json/lib/init-package-json.js +++ b/deps/npm/node_modules/init-package-json/lib/init-package-json.js @@ -124,14 +124,17 @@ async function init (dir, if (yes) { await pkg.save() if (!config.get('silent')) { + // eslint-disable-next-line no-console console.log(`Wrote to ${msg}`) } return pkg.content } + // eslint-disable-next-line no-console console.log(`About to write to ${msg}`) const ok = await read({ prompt: 'Is this OK? ', default: 'yes' }) if (!ok || !ok.toLowerCase().startsWith('y')) { + // eslint-disable-next-line no-console console.log('Aborted.') return } diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index e867964e101569..969e124378966e 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": "6.0.2", + "version": "6.0.3", "main": "lib/init-package-json.js", "scripts": { "test": "tap", @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/init-package-json.git" + "url": "git+https://github.com/npm/init-package-json.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -30,7 +30,7 @@ "devDependencies": { "@npmcli/config": "^8.2.0", "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "engines": { @@ -41,7 +41,8 @@ "nyc-arg": [ "--exclude", "tap-snapshots/**" - ] + ], + "timeout": 300 }, "keywords": [ "init", @@ -59,7 +60,7 @@ ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "publish": true } } diff --git a/deps/npm/node_modules/json-parse-even-better-errors/lib/index.js b/deps/npm/node_modules/json-parse-even-better-errors/lib/index.js index c21dd645a778bd..3ffdaac96d2dc8 100644 --- a/deps/npm/node_modules/json-parse-even-better-errors/lib/index.js +++ b/deps/npm/node_modules/json-parse-even-better-errors/lib/index.js @@ -52,7 +52,9 @@ const parseError = (e, txt, context = 20) => { let errIdx if (badIndexMatch) { errIdx = +badIndexMatch[1] - } else if (msg.match(/^Unexpected end of JSON.*/i)) { + } else /* istanbul ignore next - doesnt happen in Node 22 */ if ( + msg.match(/^Unexpected end of JSON.*/i) + ) { errIdx = txt.length - 1 } diff --git a/deps/npm/node_modules/json-parse-even-better-errors/package.json b/deps/npm/node_modules/json-parse-even-better-errors/package.json index 5d0a1d97d4d7ea..c7156df325fa2b 100644 --- a/deps/npm/node_modules/json-parse-even-better-errors/package.json +++ b/deps/npm/node_modules/json-parse-even-better-errors/package.json @@ -1,6 +1,6 @@ { "name": "json-parse-even-better-errors", - "version": "3.0.1", + "version": "3.0.2", "description": "JSON.parse with context information on error", "main": "lib/index.js", "files": [ @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/json-parse-even-better-errors.git" + "url": "git+https://github.com/npm/json-parse-even-better-errors.git" }, "keywords": [ "JSON", @@ -28,7 +28,7 @@ "license": "MIT", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.20.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.0" }, "tap": { @@ -43,7 +43,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.20.0", + "version": "4.22.0", "publish": true } } diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 59b5afa7c7b5f6..64a4af0bee1538 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "8.0.5", + "version": "8.0.6", "description": "programmatic library for `npm access` commands", "author": "GitHub Inc.", "license": "ISC", @@ -17,7 +17,7 @@ "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -30,7 +30,7 @@ "homepage": "https://npmjs.com/package/libnpmaccess", "dependencies": { "npm-package-arg": "^11.0.2", - "npm-registry-fetch": "^17.0.0" + "npm-registry-fetch": "^17.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" @@ -41,7 +41,7 @@ ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index d601ff61ca0218..33aae64ccae5ca 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,6 +1,6 @@ { "name": "libnpmdiff", - "version": "6.1.1", + "version": "6.1.2", "description": "The registry diff", "repository": { "type": "git", @@ -42,22 +42,22 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^7.2.1", + "@npmcli/arborist": "^7.5.2", "@npmcli/installed-package-contents": "^2.1.0", "binary-extensions": "^2.3.0", "diff": "^5.1.0", "minimatch": "^9.0.4", "npm-package-arg": "^11.0.2", - "pacote": "^18.0.1", + "pacote": "^18.0.6", "tar": "^6.2.1" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index fcb30087cb5d22..9f2a3f531d6817 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,6 +1,6 @@ { "name": "libnpmexec", - "version": "8.1.0", + "version": "8.1.1", "files": [ "bin/", "lib/" @@ -51,19 +51,19 @@ "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.21.3", - "bin-links": "^4.0.1", + "@npmcli/template-oss": "4.22.0", + "bin-links": "^4.0.4", "chalk": "^5.2.0", "just-extend": "^6.2.0", "just-safe-set": "^4.2.1", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^7.2.1", + "@npmcli/arborist": "^7.5.2", "@npmcli/run-script": "^8.1.0", "ci-info": "^4.0.0", "npm-package-arg": "^11.0.2", - "pacote": "^18.0.1", + "pacote": "^18.0.6", "proc-log": "^4.2.0", "read": "^3.0.1", "read-package-json-fast": "^3.0.2", @@ -72,7 +72,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 70a53646910a57..bd784bea0ced3c 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,6 +1,6 @@ { "name": "libnpmfund", - "version": "5.0.9", + "version": "5.0.10", "main": "lib/index.js", "files": [ "bin/", @@ -41,18 +41,18 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^7.2.1" + "@npmcli/arborist": "^7.5.2" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index 2cfa16df091be3..098762c037dfd9 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,6 +1,6 @@ { "name": "libnpmhook", - "version": "10.0.4", + "version": "10.0.5", "description": "programmatic API for managing npm registry hooks", "main": "lib/index.js", "files": [ @@ -31,11 +31,11 @@ "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^17.0.0" + "npm-registry-fetch": "^17.0.1" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -44,7 +44,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 1a7486bfc681d2..aa3440de583691 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "6.0.5", + "version": "6.0.6", "description": "Programmatic api for `npm org` commands", "author": "GitHub Inc.", "main": "lib/index.js", @@ -28,8 +28,8 @@ ], "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", - "minipass": "^7.0.4", + "@npmcli/template-oss": "4.22.0", + "minipass": "^7.1.1", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -42,14 +42,14 @@ "homepage": "https://npmjs.com/package/libnpmorg", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^17.0.0" + "npm-registry-fetch": "^17.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 9e40f294cc54f6..ef56bb599b2e48 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpack", - "version": "7.0.1", + "version": "7.0.2", "description": "Programmatic API for the bits behind npm pack", "author": "GitHub Inc.", "main": "lib/index.js", @@ -23,7 +23,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "spawk": "^1.7.1", "tap": "^16.3.8" @@ -36,17 +36,17 @@ "bugs": "https://github.com/npm/libnpmpack/issues", "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { - "@npmcli/arborist": "^7.2.1", + "@npmcli/arborist": "^7.5.2", "@npmcli/run-script": "^8.1.0", "npm-package-arg": "^11.0.2", - "pacote": "^18.0.1" + "pacote": "^18.0.6" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index 31faaa7b59f266..8da06962da04ce 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "9.0.7", + "version": "9.0.8", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", @@ -26,7 +26,7 @@ "@npmcli/eslint-config": "^4.0.0", "@npmcli/mock-globals": "^1.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -39,20 +39,20 @@ "homepage": "https://npmjs.com/package/libnpmpublish", "dependencies": { "ci-info": "^4.0.0", - "normalize-package-data": "^6.0.0", + "normalize-package-data": "^6.0.1", "npm-package-arg": "^11.0.2", - "npm-registry-fetch": "^17.0.0", + "npm-registry-fetch": "^17.0.1", "proc-log": "^4.2.0", "semver": "^7.3.7", "sigstore": "^2.2.0", - "ssri": "^10.0.5" + "ssri": "^10.0.6" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index cb21747310eaec..7e02fd9557a242 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "7.0.4", + "version": "7.0.5", "description": "Programmatic API for searching in npm and compatible registries.", "author": "GitHub Inc.", "main": "lib/index.js", @@ -26,7 +26,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -38,14 +38,14 @@ "bugs": "https://github.com/npm/libnpmsearch/issues", "homepage": "https://npmjs.com/package/libnpmsearch", "dependencies": { - "npm-registry-fetch": "^17.0.0" + "npm-registry-fetch": "^17.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 94f264bd93bf7c..4900435c5b27ab 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": "6.0.4", + "version": "6.0.5", "author": "GitHub Inc.", "license": "ISC", "main": "lib/index.js", @@ -16,7 +16,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -32,14 +32,14 @@ "homepage": "https://npmjs.com/package/libnpmteam", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^17.0.0" + "npm-registry-fetch": "^17.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 43b0d2ff825d7b..d2c96ffb55cc00 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "6.0.1", + "version": "6.0.2", "main": "lib/index.js", "files": [ "bin/", @@ -32,14 +32,14 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "require-inject": "^1.4.4", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/git": "^5.0.6", + "@npmcli/git": "^5.0.7", "@npmcli/run-script": "^8.1.0", - "json-parse-even-better-errors": "^3.0.0", + "json-parse-even-better-errors": "^3.0.2", "proc-log": "^4.2.0", "semver": "^7.3.7" }, @@ -48,7 +48,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/minipass-fetch/lib/body.js b/deps/npm/node_modules/minipass-fetch/lib/body.js index 6a517a21385407..62286bd1de0d91 100644 --- a/deps/npm/node_modules/minipass-fetch/lib/body.js +++ b/deps/npm/node_modules/minipass-fetch/lib/body.js @@ -146,7 +146,7 @@ class Body { // do the pipe in the promise, because the pipe() can send too much // data through right away and upset the MP Sized object - return new Promise((resolve, reject) => { + return new Promise((resolve) => { // if the stream is some other kind of stream, then pipe through a MP // so we can collect it more easily. if (stream !== upstream) { diff --git a/deps/npm/node_modules/minipass-fetch/lib/index.js b/deps/npm/node_modules/minipass-fetch/lib/index.js index 77e82555e984f1..da402161670e65 100644 --- a/deps/npm/node_modules/minipass-fetch/lib/index.js +++ b/deps/npm/node_modules/minipass-fetch/lib/index.js @@ -103,7 +103,7 @@ const fetch = async (url, opts) => { let reqTimeout = null if (request.timeout) { - req.once('socket', socket => { + req.once('socket', () => { reqTimeout = setTimeout(() => { reject(new FetchError(`network timeout at: ${ request.url}`, 'request-timeout')) diff --git a/deps/npm/node_modules/minipass-fetch/package.json b/deps/npm/node_modules/minipass-fetch/package.json index 581275ba27d4ff..d491a7fba126d0 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": "3.0.4", + "version": "3.0.5", "description": "An implementation of window.fetch in Node.js using Minipass streams", "license": "MIT", "main": "lib/index.js", @@ -8,7 +8,7 @@ "test:tls-fixtures": "./test/fixtures/tls/setup.sh", "test": "tap", "snap": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", @@ -24,7 +24,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.22.0", "@ungap/url-search-params": "^0.2.2", "abort-controller": "^3.0.0", "abortcontroller-polyfill": "~1.7.3", @@ -45,7 +45,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/minipass-fetch.git" + "url": "git+https://github.com/npm/minipass-fetch.git" }, "keywords": [ "fetch", @@ -63,7 +63,7 @@ "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", + "version": "4.22.0", "publish": "true" } } diff --git a/deps/npm/node_modules/minipass/dist/commonjs/index.js b/deps/npm/node_modules/minipass/dist/commonjs/index.js index b6cdae8eb514b8..068c095b697932 100644 --- a/deps/npm/node_modules/minipass/dist/commonjs/index.js +++ b/deps/npm/node_modules/minipass/dist/commonjs/index.js @@ -10,9 +10,9 @@ const proc = typeof process === 'object' && process stdout: null, stderr: null, }; -const events_1 = require("events"); -const stream_1 = __importDefault(require("stream")); -const string_decoder_1 = require("string_decoder"); +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); /** * Return true if the argument is a Minipass stream, Node stream, or something * else that Minipass can interact with. @@ -20,7 +20,7 @@ const string_decoder_1 = require("string_decoder"); const isStream = (s) => !!s && typeof s === 'object' && (s instanceof Minipass || - s instanceof stream_1.default || + s instanceof node_stream_1.default || (0, exports.isReadable)(s) || (0, exports.isWritable)(s)); exports.isStream = isStream; @@ -29,17 +29,17 @@ exports.isStream = isStream; */ const isReadable = (s) => !!s && typeof s === 'object' && - s instanceof events_1.EventEmitter && + s instanceof node_events_1.EventEmitter && typeof s.pipe === 'function' && // node core Writable streams have a pipe() method, but it throws - s.pipe !== stream_1.default.Writable.prototype.pipe; + s.pipe !== node_stream_1.default.Writable.prototype.pipe; exports.isReadable = isReadable; /** * Return true if the argument is a valid {@link Minipass.Writable} */ const isWritable = (s) => !!s && typeof s === 'object' && - s instanceof events_1.EventEmitter && + s instanceof node_events_1.EventEmitter && typeof s.write === 'function' && typeof s.end === 'function'; exports.isWritable = isWritable; @@ -146,7 +146,7 @@ const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== * `Events` is the set of event handler signatures that this object * will emit, see {@link Minipass.Events} */ -class Minipass extends events_1.EventEmitter { +class Minipass extends node_events_1.EventEmitter { [FLOWING] = false; [PAUSED] = false; [PIPES] = []; @@ -201,7 +201,7 @@ class Minipass extends events_1.EventEmitter { } this[ASYNC] = !!options.async; this[DECODER] = this[ENCODING] - ? new string_decoder_1.StringDecoder(this[ENCODING]) + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) : null; //@ts-ignore - private option for debugging and testing if (options && options.debugExposeBuffer === true) { diff --git a/deps/npm/node_modules/minipass/dist/esm/index.js b/deps/npm/node_modules/minipass/dist/esm/index.js index b65fafbae43a4e..b5fa4513c90838 100644 --- a/deps/npm/node_modules/minipass/dist/esm/index.js +++ b/deps/npm/node_modules/minipass/dist/esm/index.js @@ -4,9 +4,9 @@ const proc = typeof process === 'object' && process stdout: null, stderr: null, }; -import { EventEmitter } from 'events'; -import Stream from 'stream'; -import { StringDecoder } from 'string_decoder'; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node:string_decoder'; /** * Return true if the argument is a Minipass stream, Node stream, or something * else that Minipass can interact with. diff --git a/deps/npm/node_modules/minipass/package.json b/deps/npm/node_modules/minipass/package.json index 4398347289164c..f8b39b52594900 100644 --- a/deps/npm/node_modules/minipass/package.json +++ b/deps/npm/node_modules/minipass/package.json @@ -1,6 +1,6 @@ { "name": "minipass", - "version": "7.0.4", + "version": "7.1.1", "description": "minimal implementation of a PassThrough stream", "main": "./dist/commonjs/index.js", "types": "./dist/commonjs/index.d.ts", @@ -57,7 +57,6 @@ "end-of-stream": "^1.4.0", "node-abort-controller": "^3.1.1", "prettier": "^2.6.2", - "sync-content": "^1.0.2", "tap": "^18.3.0", "through2": "^2.0.3", "tshy": "^1.2.2", @@ -75,6 +74,7 @@ "node": ">=16 || 14 >=14.17" }, "tap": { + "typecheck": true, "include": [ "test/*.ts" ] diff --git a/deps/npm/node_modules/nopt/lib/debug.js b/deps/npm/node_modules/nopt/lib/debug.js index e62198eb92e9a1..544ab382ca85c0 100644 --- a/deps/npm/node_modules/nopt/lib/debug.js +++ b/deps/npm/node_modules/nopt/lib/debug.js @@ -1,4 +1,5 @@ /* istanbul ignore next */ module.exports = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG + // eslint-disable-next-line no-console ? (...a) => console.error(...a) : () => {} diff --git a/deps/npm/node_modules/nopt/package.json b/deps/npm/node_modules/nopt/package.json index 01b7de8fed9341..37b770ad487711 100644 --- a/deps/npm/node_modules/nopt/package.json +++ b/deps/npm/node_modules/nopt/package.json @@ -1,12 +1,12 @@ { "name": "nopt", - "version": "7.2.0", + "version": "7.2.1", "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", "author": "GitHub Inc.", "main": "lib/nopt.js", "scripts": { "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -15,7 +15,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/nopt.git" + "url": "git+https://github.com/npm/nopt.git" }, "bin": { "nopt": "bin/nopt.js" @@ -26,7 +26,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.15.1", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.0" }, "tap": { @@ -45,7 +45,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.15.1", + "version": "4.22.0", "publish": true } } 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 bb78231d83ca9f..9a1ccc906aee35 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/fixer.js +++ b/deps/npm/node_modules/normalize-package-data/lib/fixer.js @@ -139,7 +139,7 @@ module.exports = { } }, - fixDependencies: function (data, strict) { + fixDependencies: function (data) { objectifyDeps(data, this.warn) addOptionalDepsToDeps(data, this.warn) this.fixBundleDependenciesField(data) @@ -415,7 +415,7 @@ function parsePerson (person) { return obj } -function addOptionalDepsToDeps (data, warn) { +function addOptionalDepsToDeps (data) { var o = data.optionalDependencies if (!o) { return diff --git a/deps/npm/node_modules/normalize-package-data/lib/normalize.js b/deps/npm/node_modules/normalize-package-data/lib/normalize.js index bf71d2c1e22359..e806f110315aae 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/normalize.js +++ b/deps/npm/node_modules/normalize-package-data/lib/normalize.js @@ -26,7 +26,7 @@ function normalize (data, warn, strict) { strict = false } if (!warn || data.private) { - warn = function (msg) { /* noop */ } + warn = function () { /* noop */ } } if (data.scripts && diff --git a/deps/npm/node_modules/normalize-package-data/package.json b/deps/npm/node_modules/normalize-package-data/package.json index 48d2371d4a66b5..7fc803fb5dbb57 100644 --- a/deps/npm/node_modules/normalize-package-data/package.json +++ b/deps/npm/node_modules/normalize-package-data/package.json @@ -1,18 +1,18 @@ { "name": "normalize-package-data", - "version": "6.0.0", + "version": "6.0.1", "author": "GitHub Inc.", "description": "Normalizes data that can be found in package.json files.", "license": "BSD-2-Clause", "repository": { "type": "git", - "url": "https://github.com/npm/normalize-package-data.git" + "url": "git+https://github.com/npm/normalize-package-data.git" }, "main": "lib/normalize.js", "scripts": { "test": "tap", "npmclilint": "npmcli-lint", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", "postsnap": "npm run lintfix --", @@ -28,7 +28,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "files": [ @@ -40,14 +40,8 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", - "publish": "true", - "ciVersions": [ - "16.14.0", - "16.x", - "18.0.0", - "18.x" - ] + "version": "4.22.0", + "publish": "true" }, "tap": { "branches": 86, diff --git a/deps/npm/node_modules/npm-bundled/lib/index.js b/deps/npm/node_modules/npm-bundled/lib/index.js index 4f54ca647c087d..f5ee0bb3ea7653 100644 --- a/deps/npm/node_modules/npm-bundled/lib/index.js +++ b/deps/npm/node_modules/npm-bundled/lib/index.js @@ -154,7 +154,7 @@ class BundleWalker extends EE { path: p, parent: this, }) - child.on('done', _ => { + child.on('done', () => { if (--this.children === 0) { this.done() } diff --git a/deps/npm/node_modules/npm-bundled/package.json b/deps/npm/node_modules/npm-bundled/package.json index f41066ab2e6d32..2744ca6af67fc7 100644 --- a/deps/npm/node_modules/npm-bundled/package.json +++ b/deps/npm/node_modules/npm-bundled/package.json @@ -1,25 +1,23 @@ { "name": "npm-bundled", - "version": "3.0.0", + "version": "3.0.1", "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof", "main": "lib/index.js", "repository": { "type": "git", - "url": "https://github.com/npm/npm-bundled.git" + "url": "git+https://github.com/npm/npm-bundled.git" }, "author": "GitHub Inc.", "license": "ISC", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.5.1", - "mkdirp": "^1.0.4", + "@npmcli/template-oss": "4.22.0", "mutate-fs": "^2.1.1", - "rimraf": "^3.0.2", "tap": "^16.3.0" }, "scripts": { "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -38,7 +36,8 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.5.1" + "version": "4.22.0", + "publish": true }, "tap": { "nyc-arg": [ diff --git a/deps/npm/node_modules/npm-pick-manifest/lib/index.js b/deps/npm/node_modules/npm-pick-manifest/lib/index.js index 8dbd2721c89963..42e41b11804615 100644 --- a/deps/npm/node_modules/npm-pick-manifest/lib/index.js +++ b/deps/npm/node_modules/npm-pick-manifest/lib/index.js @@ -134,7 +134,7 @@ const pickManifest = (packument, wanted, opts) => { const allEntries = Object.entries(versions) .concat(Object.entries(staged)) .concat(Object.entries(restricted)) - .filter(([ver, mani]) => isBefore(verTimes, ver, time)) + .filter(([ver]) => isBefore(verTimes, ver, time)) if (!allEntries.length) { throw Object.assign(new Error(`No versions available for ${name}`), { @@ -148,7 +148,7 @@ const pickManifest = (packument, wanted, opts) => { } const sortSemverOpt = { loose: true } - const entries = allEntries.filter(([ver, mani]) => + const entries = allEntries.filter(([ver]) => semver.satisfies(ver, range, { loose: true })) .sort((a, b) => { const [vera, mania] = a diff --git a/deps/npm/node_modules/npm-pick-manifest/package.json b/deps/npm/node_modules/npm-pick-manifest/package.json index e30c2cfe341fc6..1167be1272712d 100644 --- a/deps/npm/node_modules/npm-pick-manifest/package.json +++ b/deps/npm/node_modules/npm-pick-manifest/package.json @@ -1,6 +1,6 @@ { "name": "npm-pick-manifest", - "version": "9.0.0", + "version": "9.0.1", "description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.", "main": "./lib", "files": [ @@ -9,7 +9,7 @@ ], "scripts": { "coverage": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "test": "tap", "posttest": "npm run lint", "postlint": "template-oss-check", @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/npm-pick-manifest.git" + "url": "git+https://github.com/npm/npm-pick-manifest.git" }, "keywords": [ "npm", @@ -36,7 +36,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "tap": { @@ -51,13 +51,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", - "publish": true, - "ciVersions": [ - "16.14.0", - "16.x", - "18.0.0", - "18.x" - ] + "version": "4.22.0", + "publish": true } } diff --git a/deps/npm/node_modules/npm-profile/lib/index.js b/deps/npm/node_modules/npm-profile/lib/index.js index e5b5dd046baf2e..69e4e49b1fcddf 100644 --- a/deps/npm/node_modules/npm-profile/lib/index.js +++ b/deps/npm/node_modules/npm-profile/lib/index.js @@ -1,37 +1,34 @@ -'use strict' - +const { URL } = require('node:url') +const timers = require('node:timers/promises') const fetch = require('npm-registry-fetch') const { HttpErrorBase } = require('npm-registry-fetch/lib/errors') -const EventEmitter = require('events') -const os = require('os') -const { URL } = require('url') const { log } = require('proc-log') // try loginWeb, catch the "not supported" message and fall back to couch -const login = (opener, prompter, opts = {}) => { - const { creds } = opts - return loginWeb(opener, opts).catch(er => { +const login = async (opener, prompter, opts = {}) => { + try { + return await loginWeb(opener, opts) + } catch (er) { if (er instanceof WebLoginNotSupported) { - log.verbose('web login not supported, trying couch') - return prompter(creds) - .then(data => loginCouch(data.username, data.password, opts)) - } else { - throw er + log.verbose('web login', 'not supported, trying couch') + const { username, password } = await prompter(opts.creds) + return loginCouch(username, password, opts) } - }) + throw er + } } -const adduser = (opener, prompter, opts = {}) => { - const { creds } = opts - return adduserWeb(opener, opts).catch(er => { +const adduser = async (opener, prompter, opts = {}) => { + try { + return await adduserWeb(opener, opts) + } catch (er) { if (er instanceof WebLoginNotSupported) { - log.verbose('web adduser not supported, trying couch') - return prompter(creds) - .then(data => adduserCouch(data.username, data.email, data.password, opts)) - } else { - throw er + log.verbose('web adduser', 'not supported, trying couch') + const { username, email, password } = await prompter(opts.creds) + return adduserCouch(username, email, password, opts) } - }) + throw er + } } const adduserWeb = (opener, opts = {}) => { @@ -47,88 +44,104 @@ const loginWeb = (opener, opts = {}) => { const isValidUrl = u => { try { return /^https?:$/.test(new URL(u).protocol) - } catch (er) { + } catch { return false } } -const webAuth = (opener, opts, body) => { - const { hostname } = opts - body.hostname = hostname || os.hostname() - const target = '/-/v1/login' - const doneEmitter = new EventEmitter() - return fetch(target, { - ...opts, - method: 'POST', - body, - }).then(res => { - return Promise.all([res, res.json()]) - }).then(([res, content]) => { - const { doneUrl, loginUrl } = content +const webAuth = async (opener, opts, body) => { + try { + const res = await fetch('/-/v1/login', { + ...opts, + method: 'POST', + body, + }) + + const content = await res.json() log.verbose('web auth', 'got response', content) + + const { doneUrl, loginUrl } = content if (!isValidUrl(doneUrl) || !isValidUrl(loginUrl)) { throw new WebLoginInvalidResponse('POST', res, content) } - return content - }).then(({ doneUrl, loginUrl }) => { - log.verbose('web auth', 'opening url pair') - - const openPromise = opener(loginUrl, doneEmitter) - const webAuthCheckPromise = webAuthCheckLogin(doneUrl, { ...opts, cache: false }) - .then(authResult => { - log.verbose('web auth', 'done-check finished') - - // cancel open prompt if it's present - doneEmitter.emit('abort') - - return authResult - }) - - return Promise.all([openPromise, webAuthCheckPromise]).then( - // pick the auth result and pass it along - ([, authResult]) => authResult - ) - }).catch(er => { - // cancel open prompt if it's present - doneEmitter.emit('abort') + return await webAuthOpener(opener, loginUrl, doneUrl, opts) + } catch (er) { if ((er.statusCode >= 400 && er.statusCode <= 499) || er.statusCode === 500) { throw new WebLoginNotSupported('POST', { status: er.statusCode, - headers: { raw: () => er.headers }, + headers: er.headers, }, er.body) - } else { - throw er } - }) + throw er + } } -const webAuthCheckLogin = (doneUrl, opts) => { - return fetch(doneUrl, opts).then(res => { - return Promise.all([res, res.json()]) - }).then(([res, content]) => { - if (res.status === 200) { - if (!content.token) { - throw new WebLoginInvalidResponse('GET', res, content) - } else { - return content - } - } else if (res.status === 202) { - const retry = +res.headers.get('retry-after') * 1000 - if (retry > 0) { - return sleep(retry).then(() => webAuthCheckLogin(doneUrl, opts)) - } else { - return webAuthCheckLogin(doneUrl, opts) - } - } else { +const webAuthOpener = async (opener, loginUrl, doneUrl, opts) => { + const abortController = new AbortController() + const { signal } = abortController + try { + log.verbose('web auth', 'opening url pair') + const [, authResult] = await Promise.all([ + opener(loginUrl, { signal }).catch((err) => { + if (err.name === 'AbortError') { + abortController.abort() + return + } + throw err + }), + webAuthCheckLogin(doneUrl, { ...opts, cache: false }, { signal }).then((r) => { + log.verbose('web auth', 'done-check finished') + abortController.abort() + return r + }), + ]) + return authResult + } catch (er) { + abortController.abort() + throw er + } +} + +const webAuthCheckLogin = async (doneUrl, opts, { signal } = {}) => { + signal?.throwIfAborted() + + const res = await fetch(doneUrl, opts) + const content = await res.json() + + if (res.status === 200) { + if (!content.token) { throw new WebLoginInvalidResponse('GET', res, content) } + return content + } + + if (res.status === 202) { + const retry = +res.headers.get('retry-after') * 1000 + if (retry > 0) { + await timers.setTimeout(retry, null, { ref: false, signal }) + } + return webAuthCheckLogin(doneUrl, opts, { signal }) + } + + throw new WebLoginInvalidResponse('GET', res, content) +} + +const couchEndpoint = (username) => `/-/user/org.couchdb.user:${encodeURIComponent(username)}` + +const putCouch = async (path, username, body, opts) => { + const result = await fetch.json(`${couchEndpoint(username)}${path}`, { + ...opts, + method: 'PUT', + body, }) + result.username = username + return result } -const adduserCouch = (username, email, password, opts = {}) => { +const adduserCouch = async (username, email, password, opts = {}) => { const body = { - _id: 'org.couchdb.user:' + username, + _id: `org.couchdb.user:${username}`, name: username, password: password, email: email, @@ -136,134 +149,107 @@ const adduserCouch = (username, email, password, opts = {}) => { roles: [], date: new Date().toISOString(), } - const logObj = { + + log.verbose('adduser', 'before first PUT', { ...body, password: 'XXXXX', - } - log.verbose('adduser', 'before first PUT', logObj) - - const target = '/-/user/org.couchdb.user:' + encodeURIComponent(username) - return fetch.json(target, { - ...opts, - method: 'PUT', - body, - }).then(result => { - result.username = username - return result }) + + return putCouch('', username, body, opts) } -const loginCouch = (username, password, opts = {}) => { +const loginCouch = async (username, password, opts = {}) => { const body = { - _id: 'org.couchdb.user:' + username, + _id: `org.couchdb.user:${username}`, name: username, password: password, type: 'user', roles: [], date: new Date().toISOString(), } - const logObj = { + + log.verbose('login', 'before first PUT', { ...body, password: 'XXXXX', - } - log.verbose('login', 'before first PUT', logObj) + }) - const target = '/-/user/org.couchdb.user:' + encodeURIComponent(username) - return fetch.json(target, { - ...opts, - method: 'PUT', - body, - }).catch(err => { + try { + return await putCouch('', username, body, opts) + } catch (err) { if (err.code === 'E400') { err.message = `There is no user with the username "${username}".` throw err } + if (err.code !== 'E409') { throw err } - return fetch.json(target, { - ...opts, - query: { write: true }, - }).then(result => { - Object.keys(result).forEach(k => { - if (!body[k] || k === 'roles') { - body[k] = result[k] - } - }) - const { otp } = opts - return fetch.json(`${target}/-rev/${body._rev}`, { - ...opts, - method: 'PUT', - body, - forceAuth: { - username, - password: Buffer.from(password, 'utf8').toString('base64'), - otp, - }, - }) - }) - }).then(result => { - result.username = username - return result - }) -} + } -const get = (opts = {}) => fetch.json('/-/npm/v1/user', opts) + const result = await fetch.json(couchEndpoint(username), { + ...opts, + query: { write: true }, + }) -const set = (profile, opts = {}) => { - Object.keys(profile).forEach(key => { - // profile keys can't be empty strings, but they CAN be null - if (profile[key] === '') { - profile[key] = null + for (const k of Object.keys(result)) { + if (!body[k] || k === 'roles') { + body[k] = result[k] } - }) - return fetch.json('/-/npm/v1/user', { + } + + return putCouch(`/-rev/${body._rev}`, username, body, { ...opts, - method: 'POST', - body: profile, + forceAuth: { + username, + password: Buffer.from(password, 'utf8').toString('base64'), + otp: opts.otp, + }, }) } -const listTokens = (opts = {}) => { - const untilLastPage = (href, objects) => { - return fetch.json(href, opts).then(result => { - objects = objects ? objects.concat(result.objects) : result.objects - if (result.urls.next) { - return untilLastPage(result.urls.next, objects) - } else { - return objects - } - }) +const get = (opts = {}) => fetch.json('/-/npm/v1/user', opts) + +const set = (profile, opts = {}) => fetch.json('/-/npm/v1/user', { + ...opts, + method: 'POST', + // profile keys can't be empty strings, but they CAN be null + body: Object.fromEntries(Object.entries(profile).map(([k, v]) => [k, v === '' ? null : v])), +}) + +const paginate = async (href, opts, items = []) => { + const result = await fetch.json(href, opts) + items = items.concat(result.objects) + if (result.urls.next) { + return paginate(result.urls.next, opts, items) } - return untilLastPage('/-/npm/v1/tokens') + return items } -const removeToken = (tokenKey, opts = {}) => { - const target = `/-/npm/v1/tokens/token/${tokenKey}` - return fetch(target, { +const listTokens = (opts = {}) => paginate('/-/npm/v1/tokens', opts) + +const removeToken = async (tokenKey, opts = {}) => { + await fetch(`/-/npm/v1/tokens/token/${tokenKey}`, { ...opts, method: 'DELETE', ignoreBody: true, - }).then(() => null) -} - -const createToken = (password, readonly, cidrs, opts = {}) => { - return fetch.json('/-/npm/v1/tokens', { - ...opts, - method: 'POST', - body: { - password: password, - readonly: readonly, - cidr_whitelist: cidrs, - }, }) + return null } +const createToken = (password, readonly, cidrs, opts = {}) => fetch.json('/-/npm/v1/tokens', { + ...opts, + method: 'POST', + body: { + password: password, + readonly: readonly, + cidr_whitelist: cidrs, + }, +}) + class WebLoginInvalidResponse extends HttpErrorBase { constructor (method, res, body) { super(method, res, body) this.message = 'Invalid response from web login endpoint' - Error.captureStackTrace(this, WebLoginInvalidResponse) } } @@ -272,12 +258,9 @@ class WebLoginNotSupported extends HttpErrorBase { super(method, res, body) this.message = 'Web login not supported' this.code = 'ENYI' - Error.captureStackTrace(this, WebLoginNotSupported) } } -const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) - module.exports = { adduserCouch, loginCouch, @@ -291,4 +274,5 @@ module.exports = { removeToken, createToken, webAuthCheckLogin, + webAuthOpener, } diff --git a/deps/npm/node_modules/npm-profile/package.json b/deps/npm/node_modules/npm-profile/package.json index acdf4d6baf2ee3..ff93911716fa7e 100644 --- a/deps/npm/node_modules/npm-profile/package.json +++ b/deps/npm/node_modules/npm-profile/package.json @@ -1,12 +1,12 @@ { "name": "npm-profile", - "version": "9.0.2", + "version": "10.0.0", "description": "Library for updating an npmjs.com profile", "keywords": [], "author": "GitHub Inc.", "license": "ISC", "dependencies": { - "npm-registry-fetch": "^17.0.0", + "npm-registry-fetch": "^17.0.1", "proc-log": "^4.0.0" }, "main": "./lib/index.js", @@ -41,7 +41,7 @@ ] }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/errors.js b/deps/npm/node_modules/npm-registry-fetch/lib/errors.js index cf5ddba6f300cb..5bf6b012a24ef3 100644 --- a/deps/npm/node_modules/npm-registry-fetch/lib/errors.js +++ b/deps/npm/node_modules/npm-registry-fetch/lib/errors.js @@ -1,10 +1,10 @@ 'use strict' -const url = require('url') +const { URL } = require('node:url') function packageName (href) { try { - let basePath = new url.URL(href).pathname.slice(1) + let basePath = new URL(href).pathname.slice(1) if (!basePath.match(/^-/)) { basePath = basePath.split('/') var index = basePath.indexOf('_rewrite') @@ -15,7 +15,7 @@ function packageName (href) { } return decodeURIComponent(basePath[index]) } - } catch (_) { + } catch { // this is ok } } @@ -24,16 +24,16 @@ class HttpErrorBase extends Error { constructor (method, res, body, spec) { super() this.name = this.constructor.name - this.headers = res.headers.raw() + this.headers = typeof res.headers?.raw === 'function' ? res.headers.raw() : res.headers this.statusCode = res.status this.code = `E${res.status}` this.method = method this.uri = res.url this.body = body this.pkgid = spec ? spec.toString() : packageName(res.url) + Error.captureStackTrace(this, this.constructor) } } -module.exports.HttpErrorBase = HttpErrorBase class HttpErrorGeneral extends HttpErrorBase { constructor (method, res, body, spec) { @@ -45,36 +45,36 @@ class HttpErrorGeneral extends HttpErrorBase { }${ (body && body.error) ? ' - ' + body.error : '' }` - Error.captureStackTrace(this, HttpErrorGeneral) } } -module.exports.HttpErrorGeneral = HttpErrorGeneral class HttpErrorAuthOTP extends HttpErrorBase { constructor (method, res, body, spec) { super(method, res, body, spec) this.message = 'OTP required for authentication' this.code = 'EOTP' - Error.captureStackTrace(this, HttpErrorAuthOTP) } } -module.exports.HttpErrorAuthOTP = HttpErrorAuthOTP class HttpErrorAuthIPAddress extends HttpErrorBase { constructor (method, res, body, spec) { super(method, res, body, spec) this.message = 'Login is not allowed from your IP address' this.code = 'EAUTHIP' - Error.captureStackTrace(this, HttpErrorAuthIPAddress) } } -module.exports.HttpErrorAuthIPAddress = HttpErrorAuthIPAddress class HttpErrorAuthUnknown extends HttpErrorBase { constructor (method, res, body, spec) { super(method, res, body, spec) this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate') - Error.captureStackTrace(this, HttpErrorAuthUnknown) } } -module.exports.HttpErrorAuthUnknown = HttpErrorAuthUnknown + +module.exports = { + HttpErrorBase, + HttpErrorGeneral, + HttpErrorAuthOTP, + HttpErrorAuthIPAddress, + HttpErrorAuthUnknown, +} diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index 52820a6a206ecb..567dedb40f70bc 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,6 +1,6 @@ { "name": "npm-registry-fetch", - "version": "17.0.0", + "version": "17.0.1", "description": "Fetch-based http client for use with npm registry APIs", "main": "lib", "files": [ diff --git a/deps/npm/node_modules/npm-user-validate/package.json b/deps/npm/node_modules/npm-user-validate/package.json index 8cf48f80f86a8e..15a1305356ef3b 100644 --- a/deps/npm/node_modules/npm-user-validate/package.json +++ b/deps/npm/node_modules/npm-user-validate/package.json @@ -1,16 +1,16 @@ { "name": "npm-user-validate", - "version": "2.0.0", + "version": "2.0.1", "description": "User validations for npm", "main": "lib/index.js", "devDependencies": { "@npmcli/eslint-config": "^4.0.1", - "@npmcli/template-oss": "4.11.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.2" }, "scripts": { "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/npm-user-validate.git" + "url": "git+https://github.com/npm/npm-user-validate.git" }, "keywords": [ "npm", @@ -37,7 +37,8 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.11.0" + "version": "4.22.0", + "publish": true }, "tap": { "nyc-arg": [ diff --git a/deps/npm/node_modules/pacote/lib/bin.js b/deps/npm/node_modules/pacote/bin/index.js similarity index 100% rename from deps/npm/node_modules/pacote/lib/bin.js rename to deps/npm/node_modules/pacote/bin/index.js diff --git a/deps/npm/node_modules/pacote/lib/dir.js b/deps/npm/node_modules/pacote/lib/dir.js index 135be8e6cba833..f3229b34e463ab 100644 --- a/deps/npm/node_modules/pacote/lib/dir.js +++ b/deps/npm/node_modules/pacote/lib/dir.js @@ -1,16 +1,13 @@ +const { resolve } = require('node:path') +const packlist = require('npm-packlist') +const runScript = require('@npmcli/run-script') +const tar = require('tar') +const { Minipass } = require('minipass') const Fetcher = require('./fetcher.js') const FileFetcher = require('./file.js') -const { Minipass } = require('minipass') +const _ = require('./util/protected.js') const tarCreateOptions = require('./util/tar-create-options.js') -const packlist = require('npm-packlist') -const tar = require('tar') -const _prepareDir = Symbol('_prepareDir') -const { resolve } = require('path') -const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') - -const runScript = require('@npmcli/run-script') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') class DirFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) @@ -30,7 +27,7 @@ class DirFetcher extends Fetcher { return ['directory'] } - [_prepareDir] () { + #prepareDir () { return this.manifest().then(mani => { if (!mani.scripts || !mani.scripts.prepare) { return @@ -55,7 +52,7 @@ class DirFetcher extends Fetcher { }) } - [_tarballFromResolved] () { + [_.tarballFromResolved] () { if (!this.tree && !this.Arborist) { throw new Error('DirFetcher requires either a tree or an Arborist constructor to pack') } @@ -68,7 +65,7 @@ class DirFetcher extends Fetcher { // run the prepare script, get the list of files, and tar it up // pipe to the stream, and proxy errors the chain. - this[_prepareDir]() + this.#prepareDir() .then(async () => { if (!this.tree) { const arb = new this.Arborist({ path: this.resolved }) @@ -87,7 +84,7 @@ class DirFetcher extends Fetcher { return Promise.resolve(this.package) } - return this[_readPackageJson](this.resolved) + return this[_.readPackageJson](this.resolved) .then(mani => this.package = { ...mani, _integrity: this.integrity && String(this.integrity), diff --git a/deps/npm/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/pacote/lib/fetcher.js index c4a707e7ef81ef..cc2c2db70c697d 100644 --- a/deps/npm/node_modules/pacote/lib/fetcher.js +++ b/deps/npm/node_modules/pacote/lib/fetcher.js @@ -3,42 +3,27 @@ // It handles the unpacking and retry logic that is shared among // all of the other Fetcher types. +const { basename, dirname } = require('node:path') +const { rm, mkdir } = require('node:fs/promises') +const PackageJson = require('@npmcli/package-json') +const cacache = require('cacache') +const fsm = require('fs-minipass') +const getContents = require('@npmcli/installed-package-contents') const npa = require('npm-package-arg') +const retry = require('promise-retry') const ssri = require('ssri') -const { basename, dirname } = require('path') const tar = require('tar') +const { Minipass } = require('minipass') const { log } = require('proc-log') -const retry = require('promise-retry') -const fs = require('fs/promises') -const fsm = require('fs-minipass') -const cacache = require('cacache') +const _ = require('./util/protected.js') +const cacheDir = require('./util/cache-dir.js') const isPackageBin = require('./util/is-package-bin.js') const removeTrailingSlashes = require('./util/trailing-slashes.js') -const getContents = require('@npmcli/installed-package-contents') -const PackageJson = require('@npmcli/package-json') -const { Minipass } = require('minipass') -const cacheDir = require('./util/cache-dir.js') // Pacote is only concerned with the package.json contents const packageJsonPrepare = (p) => PackageJson.prepare(p).then(pkg => pkg.content) const packageJsonNormalize = (p) => PackageJson.normalize(p).then(pkg => pkg.content) -// Private methods. -// Child classes should not have to override these. -// Users should never call them. -const _extract = Symbol('_extract') -const _mkdir = Symbol('_mkdir') -const _empty = Symbol('_empty') -const _toFile = Symbol('_toFile') -const _tarxOptions = Symbol('_tarxOptions') -const _entryMode = Symbol('_entryMode') -const _istream = Symbol('_istream') -const _assertType = Symbol('_assertType') -const _tarballFromCache = Symbol('_tarballFromCache') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') -const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') -const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') - class FetcherBase { constructor (spec, opts) { if (!opts || typeof opts !== 'object') { @@ -57,7 +42,7 @@ class FetcherBase { this.from = this.spec.registry ? `${this.spec.name}@${this.spec.rawSpec}` : this.spec.saveSpec - this[_assertType]() + this.#assertType() // clone the opts object so that others aren't upset when we mutate it // by adding/modifying the integrity value. this.opts = { ...opts } @@ -93,11 +78,9 @@ class FetcherBase { this.before = opts.before this.fullMetadata = this.before ? true : !!opts.fullMetadata this.fullReadJson = !!opts.fullReadJson - if (this.fullReadJson) { - this[_readPackageJson] = packageJsonPrepare - } else { - this[_readPackageJson] = packageJsonNormalize - } + this[_.readPackageJson] = this.fullReadJson + ? packageJsonPrepare + : packageJsonNormalize // rrh is a registry hostname or 'never' or 'always' // defaults to registry.npmjs.org @@ -188,7 +171,7 @@ class FetcherBase { // private, should be overridden. // Note that they should *not* calculate or check integrity or cache, // but *just* return the raw tarball data stream. - [_tarballFromResolved] () { + [_.tarballFromResolved] () { throw this.notImplementedError } @@ -204,17 +187,17 @@ class FetcherBase { // private // Note: cacache will raise a EINTEGRITY error if the integrity doesn't match - [_tarballFromCache] () { + #tarballFromCache () { return cacache.get.stream.byDigest(this.cache, this.integrity, this.opts) } - get [_cacheFetches] () { + get [_.cacheFetches] () { return true } - [_istream] (stream) { + #istream (stream) { // if not caching this, just return it - if (!this.opts.cache || !this[_cacheFetches]) { + if (!this.opts.cache || !this[_.cacheFetches]) { // instead of creating a new integrity stream, we only piggyback on the // provided stream's events if (stream.hasIntegrityEmitter) { @@ -267,7 +250,7 @@ class FetcherBase { return false } - [_assertType] () { + #assertType () { if (this.types && !this.types.includes(this.spec.type)) { throw new TypeError(`Wrong spec type (${ this.spec.type @@ -306,7 +289,7 @@ class FetcherBase { !this.preferOnline && this.integrity && this.resolved - ) ? streamHandler(this[_tarballFromCache]()).catch(er => { + ) ? streamHandler(this.#tarballFromCache()).catch(er => { if (this.isDataCorruptionError(er)) { log.warn('tarball', `cached data for ${ this.spec @@ -329,7 +312,7 @@ class FetcherBase { }. Extracting by manifest.`) } return this.resolve().then(() => retry(tryAgain => - streamHandler(this[_istream](this[_tarballFromResolved]())) + streamHandler(this.#istream(this[_.tarballFromResolved]())) .catch(streamErr => { // Most likely data integrity. A cache ENOENT error is unlikely // here, since we're definitely not reading from the cache, but it @@ -352,24 +335,24 @@ class FetcherBase { return cacache.rm.content(this.cache, this.integrity, this.opts) } - [_empty] (path) { + #empty (path) { return getContents({ path, depth: 1 }).then(contents => Promise.all( - contents.map(entry => fs.rm(entry, { recursive: true, force: true })))) + contents.map(entry => rm(entry, { recursive: true, force: true })))) } - async [_mkdir] (dest) { - await this[_empty](dest) - return await fs.mkdir(dest, { recursive: true }) + async #mkdir (dest) { + await this.#empty(dest) + return await mkdir(dest, { recursive: true }) } // extraction is always the same. the only difference is where // the tarball comes from. async extract (dest) { - await this[_mkdir](dest) - return this.tarballStream((tarball) => this[_extract](dest, tarball)) + await this.#mkdir(dest) + return this.tarballStream((tarball) => this.#extract(dest, tarball)) } - [_toFile] (dest) { + #toFile (dest) { return this.tarballStream(str => new Promise((res, rej) => { const writer = new fsm.WriteStream(dest) str.on('error', er => writer.emit('error', er)) @@ -383,15 +366,15 @@ class FetcherBase { })) } - // don't use this[_mkdir] because we don't want to rimraf anything + // don't use this.#mkdir because we don't want to rimraf anything async tarballFile (dest) { const dir = dirname(dest) - await fs.mkdir(dir, { recursive: true }) - return this[_toFile](dest) + await mkdir(dir, { recursive: true }) + return this.#toFile(dest) } - [_extract] (dest, tarball) { - const extractor = tar.x(this[_tarxOptions]({ cwd: dest })) + #extract (dest, tarball) { + const extractor = tar.x(this.#tarxOptions({ cwd: dest })) const p = new Promise((resolve, reject) => { extractor.on('end', () => { resolve({ @@ -416,7 +399,7 @@ class FetcherBase { // always ensure that entries are at least as permissive as our configured // dmode/fmode, but never more permissive than the umask allows. - [_entryMode] (path, mode, type) { + #entryMode (path, mode, type) { const m = /Directory|GNUDumpDir/.test(type) ? this.dmode : /File$/.test(type) ? this.fmode : /* istanbul ignore next - should never happen in a pkg */ 0 @@ -427,7 +410,7 @@ class FetcherBase { return ((mode | m) & ~this.umask) | exe | 0o600 } - [_tarxOptions] ({ cwd }) { + #tarxOptions ({ cwd }) { const sawIgnores = new Set() return { cwd, @@ -437,7 +420,7 @@ class FetcherBase { if (/Link$/.test(entry.type)) { return false } - entry.mode = this[_entryMode](entry.path, entry.mode, entry.type) + entry.mode = this.#entryMode(entry.path, entry.mode, entry.type) // this replicates the npm pack behavior where .gitignore files // are treated like .npmignore files, but only if a .npmignore // file is not present. diff --git a/deps/npm/node_modules/pacote/lib/file.js b/deps/npm/node_modules/pacote/lib/file.js index 95769de1374c97..2021325085e4f0 100644 --- a/deps/npm/node_modules/pacote/lib/file.js +++ b/deps/npm/node_modules/pacote/lib/file.js @@ -1,12 +1,9 @@ -const fsm = require('fs-minipass') +const { resolve } = require('node:path') +const { stat, chmod } = require('node:fs/promises') const cacache = require('cacache') -const { resolve } = require('path') -const { stat, chmod } = require('fs/promises') +const fsm = require('fs-minipass') const Fetcher = require('./fetcher.js') - -const _exeBins = Symbol('_exeBins') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') -const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') +const _ = require('./util/protected.js') class FileFetcher extends Fetcher { constructor (spec, opts) { @@ -27,7 +24,7 @@ class FileFetcher extends Fetcher { // have to unpack the tarball for this. return cacache.tmp.withTmp(this.cache, this.opts, dir => this.extract(dir) - .then(() => this[_readPackageJson](dir)) + .then(() => this[_.readPackageJson](dir)) .then(mani => this.package = { ...mani, _integrity: this.integrity && String(this.integrity), @@ -36,7 +33,7 @@ class FileFetcher extends Fetcher { })) } - [_exeBins] (pkg, dest) { + #exeBins (pkg, dest) { if (!pkg.bin) { return Promise.resolve() } @@ -65,11 +62,11 @@ class FileFetcher extends Fetcher { // but if not, read the unpacked manifest and chmod properly. return super.extract(dest) .then(result => this.package ? result - : this[_readPackageJson](dest).then(pkg => - this[_exeBins](pkg, dest)).then(() => result)) + : this[_.readPackageJson](dest).then(pkg => + this.#exeBins(pkg, dest)).then(() => result)) } - [_tarballFromResolved] () { + [_.tarballFromResolved] () { // create a read stream and return it return new fsm.ReadStream(this.resolved) } diff --git a/deps/npm/node_modules/pacote/lib/git.js b/deps/npm/node_modules/pacote/lib/git.js index 2cac44ae528e6e..077193a86f026f 100644 --- a/deps/npm/node_modules/pacote/lib/git.js +++ b/deps/npm/node_modules/pacote/lib/git.js @@ -1,28 +1,18 @@ -const Fetcher = require('./fetcher.js') -const FileFetcher = require('./file.js') -const RemoteFetcher = require('./remote.js') -const DirFetcher = require('./dir.js') -const hashre = /^[a-f0-9]{40}$/ +const cacache = require('cacache') const git = require('@npmcli/git') -const pickManifest = require('npm-pick-manifest') const npa = require('npm-package-arg') +const pickManifest = require('npm-pick-manifest') const { Minipass } = require('minipass') -const cacache = require('cacache') const { log } = require('proc-log') +const DirFetcher = require('./dir.js') +const Fetcher = require('./fetcher.js') +const FileFetcher = require('./file.js') +const RemoteFetcher = require('./remote.js') +const _ = require('./util/protected.js') +const addGitSha = require('./util/add-git-sha.js') const npm = require('./util/npm.js') -const _resolvedFromRepo = Symbol('_resolvedFromRepo') -const _resolvedFromHosted = Symbol('_resolvedFromHosted') -const _resolvedFromClone = Symbol('_resolvedFromClone') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') -const _addGitSha = Symbol('_addGitSha') -const addGitSha = require('./util/add-git-sha.js') -const _clone = Symbol('_clone') -const _cloneHosted = Symbol('_cloneHosted') -const _cloneRepo = Symbol('_cloneRepo') -const _setResolvedWithSha = Symbol('_setResolvedWithSha') -const _prepareDir = Symbol('_prepareDir') -const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') +const hashre = /^[a-f0-9]{40}$/ // get the repository url. // prefer https if there's auth, since ssh will drop that. @@ -84,8 +74,9 @@ class GitFetcher extends Fetcher { // fetch the git repo and then look at the current hash const h = this.spec.hosted // try to use ssh, fall back to git. - return h ? this[_resolvedFromHosted](h) - : this[_resolvedFromRepo](this.spec.fetchSpec) + return h + ? this.#resolvedFromHosted(h) + : this.#resolvedFromRepo(this.spec.fetchSpec) } // first try https, since that's faster and passphrase-less for @@ -93,23 +84,22 @@ class GitFetcher extends Fetcher { // Fall back to SSH to support private repos // NB: we always store the https url in resolved field if auth // is present, otherwise ssh if the hosted type provides it - [_resolvedFromHosted] (hosted) { - return this[_resolvedFromRepo](hosted.https && hosted.https()) - .catch(er => { - // Throw early since we know pathspec errors will fail again if retried - if (er instanceof git.errors.GitPathspecError) { - throw er - } - const ssh = hosted.sshurl && hosted.sshurl() - // no fallthrough if we can't fall through or have https auth - if (!ssh || hosted.auth) { - throw er - } - return this[_resolvedFromRepo](ssh) - }) + #resolvedFromHosted (hosted) { + return this.#resolvedFromRepo(hosted.https && hosted.https()).catch(er => { + // Throw early since we know pathspec errors will fail again if retried + if (er instanceof git.errors.GitPathspecError) { + throw er + } + const ssh = hosted.sshurl && hosted.sshurl() + // no fallthrough if we can't fall through or have https auth + if (!ssh || hosted.auth) { + throw er + } + return this.#resolvedFromRepo(ssh) + }) } - [_resolvedFromRepo] (gitRemote) { + #resolvedFromRepo (gitRemote) { // XXX make this a custom error class if (!gitRemote) { return Promise.reject(new Error(`No git url for ${this.spec}`)) @@ -130,17 +120,17 @@ class GitFetcher extends Fetcher { // the committish provided isn't in the rev list // things like HEAD~3 or @yesterday can land here. if (!revDoc || !revDoc.sha) { - return this[_resolvedFromClone]() + return this.#resolvedFromClone() } this.resolvedRef = revDoc this.resolvedSha = revDoc.sha - this[_addGitSha](revDoc.sha) + this.#addGitSha(revDoc.sha) return this.resolved }) } - [_setResolvedWithSha] (withSha) { + #setResolvedWithSha (withSha) { // we haven't cloned, so a tgz download is still faster // of course, if it's not a known host, we can't do that. this.resolved = !this.spec.hosted ? withSha @@ -149,18 +139,18 @@ class GitFetcher extends Fetcher { // when we get the git sha, we affix it to our spec to build up // either a git url with a hash, or a tarball download URL - [_addGitSha] (sha) { - this[_setResolvedWithSha](addGitSha(this.spec, sha)) + #addGitSha (sha) { + this.#setResolvedWithSha(addGitSha(this.spec, sha)) } - [_resolvedFromClone] () { + #resolvedFromClone () { // do a full or shallow clone, then look at the HEAD // kind of wasteful, but no other option, really - return this[_clone](() => this.resolved) + return this.#clone(() => this.resolved) } - [_prepareDir] (dir) { - return this[_readPackageJson](dir).then(mani => { + #prepareDir (dir) { + return this[_.readPackageJson](dir).then(mani => { // no need if we aren't going to do any preparation. const scripts = mani.scripts if (!mani.workspaces && (!scripts || !( @@ -200,13 +190,13 @@ class GitFetcher extends Fetcher { }) } - [_tarballFromResolved] () { + [_.tarballFromResolved] () { const stream = new Minipass() stream.resolved = this.resolved stream.from = this.from // check it out and then shell out to the DirFetcher tarball packer - this[_clone](dir => this[_prepareDir](dir) + this.#clone(dir => this.#prepareDir(dir) .then(() => new Promise((res, rej) => { if (!this.Arborist) { throw new Error('GitFetcher requires an Arborist constructor to pack a tarball') @@ -217,7 +207,7 @@ class GitFetcher extends Fetcher { resolved: null, integrity: null, }) - const dirStream = df[_tarballFromResolved]() + const dirStream = df[_.tarballFromResolved]() dirStream.on('error', rej) dirStream.on('end', res) dirStream.pipe(stream) @@ -235,7 +225,7 @@ class GitFetcher extends Fetcher { // TODO: after cloning, create a tarball of the folder, and add to the cache // with cacache.put.stream(), using a key that's deterministic based on the // spec and repo, so that we don't ever clone the same thing multiple times. - [_clone] (handler, tarballOk = true) { + #clone (handler, tarballOk = true) { const o = { tmpPrefix: 'git-clone' } const ref = this.resolvedSha || this.spec.gitCommittish const h = this.spec.hosted @@ -258,7 +248,7 @@ class GitFetcher extends Fetcher { }).extract(tmp).then(() => handler(tmp), er => { // fall back to ssh download if tarball fails if (er.constructor.name.match(/^Http/)) { - return this[_clone](handler, false) + return this.#clone(handler, false) } else { throw er } @@ -266,12 +256,12 @@ class GitFetcher extends Fetcher { } const sha = await ( - h ? this[_cloneHosted](ref, tmp) - : this[_cloneRepo](this.spec.fetchSpec, ref, tmp) + h ? this.#cloneHosted(ref, tmp) + : this.#cloneRepo(this.spec.fetchSpec, ref, tmp) ) this.resolvedSha = sha if (!this.resolved) { - await this[_addGitSha](sha) + await this.#addGitSha(sha) } return handler(tmp) }) @@ -282,9 +272,9 @@ class GitFetcher extends Fetcher { // Fall back to SSH to support private repos // NB: we always store the https url in resolved field if auth // is present, otherwise ssh if the hosted type provides it - [_cloneHosted] (ref, tmp) { + #cloneHosted (ref, tmp) { const hosted = this.spec.hosted - return this[_cloneRepo](hosted.https({ noCommittish: true }), ref, tmp) + return this.#cloneRepo(hosted.https({ noCommittish: true }), ref, tmp) .catch(er => { // Throw early since we know pathspec errors will fail again if retried if (er instanceof git.errors.GitPathspecError) { @@ -295,11 +285,11 @@ class GitFetcher extends Fetcher { if (!ssh || hosted.auth) { throw er } - return this[_cloneRepo](ssh, ref, tmp) + return this.#cloneRepo(ssh, ref, tmp) }) } - [_cloneRepo] (repo, ref, tmp) { + #cloneRepo (repo, ref, tmp) { const { opts, spec } = this return git.clone(repo, ref, tmp, { ...opts, spec }) } @@ -311,8 +301,8 @@ class GitFetcher extends Fetcher { return this.spec.hosted && this.resolved ? FileFetcher.prototype.manifest.apply(this) - : this[_clone](dir => - this[_readPackageJson](dir) + : this.#clone(dir => + this[_.readPackageJson](dir) .then(mani => this.package = { ...mani, _resolved: this.resolved, diff --git a/deps/npm/node_modules/pacote/lib/index.js b/deps/npm/node_modules/pacote/lib/index.js index cbcbd7c92d15f5..f35314d275d5fd 100644 --- a/deps/npm/node_modules/pacote/lib/index.js +++ b/deps/npm/node_modules/pacote/lib/index.js @@ -5,6 +5,10 @@ const FileFetcher = require('./file.js') const DirFetcher = require('./dir.js') const RemoteFetcher = require('./remote.js') +const tarball = (spec, opts) => get(spec, opts).tarball() +tarball.stream = (spec, handler, opts) => get(spec, opts).tarballStream(handler) +tarball.file = (spec, dest, opts) => get(spec, opts).tarballFile(dest) + module.exports = { GitFetcher, RegistryFetcher, @@ -14,10 +18,6 @@ module.exports = { resolve: (spec, opts) => get(spec, opts).resolve(), extract: (spec, dest, opts) => get(spec, opts).extract(dest), manifest: (spec, opts) => get(spec, opts).manifest(), - tarball: (spec, opts) => get(spec, opts).tarball(), packument: (spec, opts) => get(spec, opts).packument(), + tarball, } -module.exports.tarball.stream = (spec, handler, opts) => - get(spec, opts).tarballStream(handler) -module.exports.tarball.file = (spec, dest, opts) => - get(spec, opts).tarballFile(dest) diff --git a/deps/npm/node_modules/pacote/lib/registry.js b/deps/npm/node_modules/pacote/lib/registry.js index b6a8d49b84f321..1ecf4ee1773499 100644 --- a/deps/npm/node_modules/pacote/lib/registry.js +++ b/deps/npm/node_modules/pacote/lib/registry.js @@ -1,14 +1,15 @@ -const Fetcher = require('./fetcher.js') -const RemoteFetcher = require('./remote.js') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') -const pacoteVersion = require('../package.json').version -const removeTrailingSlashes = require('./util/trailing-slashes.js') +const crypto = require('node:crypto') const PackageJson = require('@npmcli/package-json') const pickManifest = require('npm-pick-manifest') const ssri = require('ssri') -const crypto = require('crypto') const npa = require('npm-package-arg') const sigstore = require('sigstore') +const fetch = require('npm-registry-fetch') +const Fetcher = require('./fetcher.js') +const RemoteFetcher = require('./remote.js') +const pacoteVersion = require('../package.json').version +const removeTrailingSlashes = require('./util/trailing-slashes.js') +const _ = require('./util/protected.js') // Corgis are cute. 🐕🐶 const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' @@ -18,10 +19,8 @@ const fullDoc = 'application/json' // cutoff date. const MISSING_TIME_CUTOFF = '2015-01-01T00:00:00.000Z' -const fetch = require('npm-registry-fetch') - -const _headers = Symbol('_headers') class RegistryFetcher extends Fetcher { + #cacheKey constructor (spec, opts) { super(spec, opts) @@ -34,8 +33,8 @@ class RegistryFetcher extends Fetcher { this.packumentCache = this.opts.packumentCache || null this.registry = fetch.pickRegistry(spec, opts) - this.packumentUrl = removeTrailingSlashes(this.registry) + '/' + - this.spec.escapedName + this.packumentUrl = `${removeTrailingSlashes(this.registry)}/${this.spec.escapedName}` + this.#cacheKey = `${this.fullMetadata ? 'full' : 'corgi'}:${this.packumentUrl}` const parsed = new URL(this.registry) const regKey = `//${parsed.host}${parsed.pathname}` @@ -63,7 +62,7 @@ class RegistryFetcher extends Fetcher { return this.resolved } - [_headers] () { + #headers () { return { // npm will override UA, but ensure that we always send *something* 'user-agent': this.opts.userAgent || @@ -80,8 +79,8 @@ class RegistryFetcher extends Fetcher { // note this might be either an in-flight promise for a request, // or the actual packument, but we never want to make more than // one request at a time for the same thing regardless. - if (this.packumentCache && this.packumentCache.has(this.packumentUrl)) { - return this.packumentCache.get(this.packumentUrl) + if (this.packumentCache?.has(this.#cacheKey)) { + return this.packumentCache.get(this.#cacheKey) } // npm-registry-fetch the packument @@ -90,21 +89,21 @@ class RegistryFetcher extends Fetcher { try { const res = await fetch(this.packumentUrl, { ...this.opts, - headers: this[_headers](), + headers: this.#headers(), spec: this.spec, + // never check integrity for packuments themselves integrity: null, }) const packument = await res.json() - packument._contentLength = +res.headers.get('content-length') - if (this.packumentCache) { - this.packumentCache.set(this.packumentUrl, packument) + const contentLength = res.headers.get('content-length') + if (contentLength) { + packument._contentLength = Number(contentLength) } + this.packumentCache?.set(this.#cacheKey, packument) return packument } catch (err) { - if (this.packumentCache) { - this.packumentCache.delete(this.packumentUrl) - } + this.packumentCache?.delete(this.#cacheKey) if (err.code !== 'E404' || this.fullMetadata) { throw err } @@ -350,13 +349,13 @@ class RegistryFetcher extends Fetcher { return this.package } - [_tarballFromResolved] () { + [_.tarballFromResolved] () { // we use a RemoteFetcher to get the actual tarball stream return new RemoteFetcher(this.resolved, { ...this.opts, resolved: this.resolved, pkgid: `registry:${this.spec.name}@${this.resolved}`, - })[_tarballFromResolved]() + })[_.tarballFromResolved]() } get types () { diff --git a/deps/npm/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/pacote/lib/remote.js index fd617459fb0319..bd321e65a1f18a 100644 --- a/deps/npm/node_modules/pacote/lib/remote.js +++ b/deps/npm/node_modules/pacote/lib/remote.js @@ -1,12 +1,10 @@ +const fetch = require('npm-registry-fetch') +const { Minipass } = require('minipass') const Fetcher = require('./fetcher.js') const FileFetcher = require('./file.js') -const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') +const _ = require('./util/protected.js') const pacoteVersion = require('../package.json').version -const fetch = require('npm-registry-fetch') -const { Minipass } = require('minipass') -const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') -const _headers = Symbol('_headers') class RemoteFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) @@ -25,17 +23,17 @@ class RemoteFetcher extends Fetcher { // Don't need to cache tarball fetches in pacote, because make-fetch-happen // will write into cacache anyway. - get [_cacheFetches] () { + get [_.cacheFetches] () { return false } - [_tarballFromResolved] () { + [_.tarballFromResolved] () { const stream = new Minipass() stream.hasIntegrityEmitter = true const fetchOpts = { ...this.opts, - headers: this[_headers](), + headers: this.#headers(), spec: this.spec, integrity: this.integrity, algorithms: [this.pickIntegrityAlgorithm()], @@ -59,7 +57,7 @@ class RemoteFetcher extends Fetcher { return stream } - [_headers] () { + #headers () { return { // npm will override this, but ensure that we always send *something* 'user-agent': this.opts.userAgent || diff --git a/deps/npm/node_modules/pacote/lib/util/cache-dir.js b/deps/npm/node_modules/pacote/lib/util/cache-dir.js index ac83b1793f1999..ba5683a7bb5bf3 100644 --- a/deps/npm/node_modules/pacote/lib/util/cache-dir.js +++ b/deps/npm/node_modules/pacote/lib/util/cache-dir.js @@ -1,10 +1,10 @@ -const os = require('os') -const { resolve } = require('path') +const { resolve } = require('node:path') +const { tmpdir, homedir } = require('node:os') module.exports = (fakePlatform = false) => { - const temp = os.tmpdir() + const temp = tmpdir() const uidOrPid = process.getuid ? process.getuid() : process.pid - const home = os.homedir() || resolve(temp, 'npm-' + uidOrPid) + const home = homedir() || resolve(temp, 'npm-' + uidOrPid) const platform = fakePlatform || process.platform const cacheExtra = platform === 'win32' ? 'npm-cache' : '.npm' const cacheRoot = (platform === 'win32' && process.env.LOCALAPPDATA) || home diff --git a/deps/npm/node_modules/pacote/lib/util/protected.js b/deps/npm/node_modules/pacote/lib/util/protected.js new file mode 100644 index 00000000000000..e05203b481e6aa --- /dev/null +++ b/deps/npm/node_modules/pacote/lib/util/protected.js @@ -0,0 +1,5 @@ +module.exports = { + cacheFetches: Symbol.for('pacote.Fetcher._cacheFetches'), + readPackageJson: Symbol.for('package.Fetcher._readPackageJson'), + tarballFromResolved: Symbol.for('pacote.Fetcher._tarballFromResolved'), +} diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index 4c1751644cd57a..caadaf2db50c81 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,10 +1,10 @@ { "name": "pacote", - "version": "18.0.3", + "version": "18.0.6", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { - "pacote": "lib/bin.js" + "pacote": "bin/index.js" }, "license": "ISC", "main": "lib/index.js", @@ -27,7 +27,7 @@ "devDependencies": { "@npmcli/arborist": "^7.1.0", "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.4", + "@npmcli/template-oss": "4.22.0", "hosted-git-info": "^7.0.0", "mutate-fs": "^2.1.1", "nock": "^13.2.4", @@ -67,11 +67,11 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/pacote.git" + "url": "git+https://github.com/npm/pacote.git" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.4", + "version": "4.22.0", "windowsCI": false, "publish": "true" } diff --git a/deps/npm/node_modules/path-scurry/dist/commonjs/index.js b/deps/npm/node_modules/path-scurry/dist/commonjs/index.js index 6e330d400d2ac9..555de62f04c90e 100644 --- a/deps/npm/node_modules/path-scurry/dist/commonjs/index.js +++ b/deps/npm/node_modules/path-scurry/dist/commonjs/index.js @@ -25,14 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0; const lru_cache_1 = require("lru-cache"); -const path_1 = require("path"); -const url_1 = require("url"); -const actualFS = __importStar(require("fs")); +const node_path_1 = require("node:path"); +const node_url_1 = require("node:url"); const fs_1 = require("fs"); +const actualFS = __importStar(require("node:fs")); const realpathSync = fs_1.realpathSync.native; // TODO: test perf of fs/promises realpath vs realpathCB, // since the promises one uses realpath.native -const promises_1 = require("fs/promises"); +const promises_1 = require("node:fs/promises"); const minipass_1 = require("minipass"); const defaultFS = { lstatSync: fs_1.lstatSync, @@ -48,8 +48,8 @@ const defaultFS = { }, }; // if they just gave us require('fs') then use our default -const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS - ? defaultFS +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? + defaultFS : { ...defaultFS, ...fsOption, @@ -90,20 +90,13 @@ const ENOREADLINK = 0b0001_0000_0000; const ENOREALPATH = 0b0010_0000_0000; const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH; const TYPEMASK = 0b0011_1111_1111; -const entToType = (s) => s.isFile() - ? IFREG - : s.isDirectory() - ? IFDIR - : s.isSymbolicLink() - ? IFLNK - : s.isCharacterDevice() - ? IFCHR - : s.isBlockDevice() - ? IFBLK - : s.isSocket() - ? IFSOCK - : s.isFIFO() - ? IFIFO +const entToType = (s) => s.isFile() ? IFREG + : s.isDirectory() ? IFDIR + : s.isSymbolicLink() ? IFLNK + : s.isCharacterDevice() ? IFCHR + : s.isBlockDevice() ? IFBLK + : s.isSocket() ? IFSOCK + : s.isFIFO() ? IFIFO : UNKNOWN; // normalize unicode path names const normalizeCache = new Map(); @@ -207,6 +200,11 @@ class PathBase { * @internal */ nocase; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD = false; // potential default fs override #fs; // Stats fields @@ -294,14 +292,20 @@ class PathBase { #realpath; /** * This property is for compatibility with the Dirent class as of - * Node v20, where Dirent['path'] refers to the path of the directory - * that was passed to readdir. So, somewhat counterintuitively, this - * property refers to the *parent* path, not the path object itself. - * For root entries, it's the path to the entry itself. + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. */ - get path() { + get parentPath() { return (this.parent || this).fullpath(); } + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path() { + return this.parentPath; + } /** * Do not create new Path objects directly. They should always be accessed * via the PathScurry class or other methods on the Path class. @@ -355,8 +359,8 @@ class PathBase { const rootPath = this.getRootString(path); const dir = path.substring(rootPath.length); const dirParts = dir.split(this.splitSep); - const result = rootPath - ? this.getRoot(rootPath).#resolveParts(dirParts) + const result = rootPath ? + this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts); return result; } @@ -407,9 +411,7 @@ class PathBase { } // find the child const children = this.children(); - const name = this.nocase - ? normalizeNocase(pathPart) - : normalize(pathPart); + const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart); for (const p of children) { if (p.#matchName === name) { return p; @@ -419,9 +421,7 @@ class PathBase { // actually exist. If we know the parent isn't a dir, then // in fact it CAN'T exist. const s = this.parent ? this.sep : ''; - const fullpath = this.#fullpath - ? this.#fullpath + s + pathPart - : undefined; + const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined; const pchild = this.newChild(pathPart, UNKNOWN, { ...opts, parent: this, @@ -440,6 +440,8 @@ class PathBase { * the cwd, then this ends up being equivalent to the fullpath() */ relative() { + if (this.isCWD) + return ''; if (this.#relative !== undefined) { return this.#relative; } @@ -460,6 +462,8 @@ class PathBase { relativePosix() { if (this.sep === '/') return this.relative(); + if (this.isCWD) + return ''; if (this.#relativePosix !== undefined) return this.#relativePosix; const name = this.name; @@ -525,23 +529,15 @@ class PathBase { return this[`is${type}`](); } getType() { - return this.isUnknown() - ? 'Unknown' - : this.isDirectory() - ? 'Directory' - : this.isFile() - ? 'File' - : this.isSymbolicLink() - ? 'SymbolicLink' - : this.isFIFO() - ? 'FIFO' - : this.isCharacterDevice() - ? 'CharacterDevice' - : this.isBlockDevice() - ? 'BlockDevice' - : /* c8 ignore start */ this.isSocket() - ? 'Socket' - : 'Unknown'; + return (this.isUnknown() ? 'Unknown' + : this.isDirectory() ? 'Directory' + : this.isFile() ? 'File' + : this.isSymbolicLink() ? 'SymbolicLink' + : this.isFIFO() ? 'FIFO' + : this.isCharacterDevice() ? 'CharacterDevice' + : this.isBlockDevice() ? 'BlockDevice' + : /* c8 ignore start */ this.isSocket() ? 'Socket' + : 'Unknown'); /* c8 ignore stop */ } /** @@ -675,8 +671,8 @@ class PathBase { * directly. */ isNamed(n) { - return !this.nocase - ? this.#matchName === normalize(n) + return !this.nocase ? + this.#matchName === normalize(n) : this.#matchName === normalizeNocase(n); } /** @@ -732,7 +728,7 @@ class PathBase { /* c8 ignore stop */ try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = (this.parent.realpathSync())?.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return (this.#linkTarget = linkTarget); } @@ -853,9 +849,7 @@ class PathBase { #readdirMaybePromoteChild(e, c) { for (let p = c.provisional; p < c.length; p++) { const pchild = c[p]; - const name = this.nocase - ? normalizeNocase(e.name) - : normalize(e.name); + const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name); if (name !== pchild.#matchName) { continue; } @@ -1154,6 +1148,8 @@ class PathBase { [setAsCwd](oldCwd) { if (oldCwd === this) return; + oldCwd.isCWD = false; + this.isCWD = true; const changed = new Set([]); let rp = []; let p = this; @@ -1208,7 +1204,7 @@ class PathWin32 extends PathBase { * @internal */ getRootString(path) { - return path_1.win32.parse(path).root; + return node_path_1.win32.parse(path).root; } /** * @internal @@ -1330,7 +1326,7 @@ class PathScurryBase { constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) { this.#fs = fsFromOption(fs); if (cwd instanceof URL || cwd.startsWith('file://')) { - cwd = (0, url_1.fileURLToPath)(cwd); + cwd = (0, node_url_1.fileURLToPath)(cwd); } // resolve and split root, and then add to the store. // this is the only time we call path.resolve() @@ -1919,7 +1915,7 @@ class PathScurryWin32 extends PathScurryBase { sep = '\\'; constructor(cwd = process.cwd(), opts = {}) { const { nocase = true } = opts; - super(cwd, path_1.win32, '\\', { ...opts, nocase }); + super(cwd, node_path_1.win32, '\\', { ...opts, nocase }); this.nocase = nocase; for (let p = this.cwd; p; p = p.parent) { p.nocase = this.nocase; @@ -1932,7 +1928,7 @@ class PathScurryWin32 extends PathScurryBase { // if the path starts with a single separator, it's not a UNC, and we'll // just get separator as the root, and driveFromUNC will return \ // In that case, mount \ on the root from the cwd. - return path_1.win32.parse(dir).root.toUpperCase(); + return node_path_1.win32.parse(dir).root.toUpperCase(); } /** * @internal @@ -1962,7 +1958,7 @@ class PathScurryPosix extends PathScurryBase { sep = '/'; constructor(cwd = process.cwd(), opts = {}) { const { nocase = false } = opts; - super(cwd, path_1.posix, '/', { ...opts, nocase }); + super(cwd, node_path_1.posix, '/', { ...opts, nocase }); this.nocase = nocase; } /** @@ -2012,9 +2008,7 @@ exports.Path = process.platform === 'win32' ? PathWin32 : PathPosix; * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on * Darwin (macOS) systems, {@link PathScurryPosix} on all others. */ -exports.PathScurry = process.platform === 'win32' - ? PathScurryWin32 - : process.platform === 'darwin' - ? PathScurryDarwin +exports.PathScurry = process.platform === 'win32' ? PathScurryWin32 + : process.platform === 'darwin' ? PathScurryDarwin : PathScurryPosix; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/deps/npm/node_modules/path-scurry/dist/esm/index.js b/deps/npm/node_modules/path-scurry/dist/esm/index.js index 2ce978e64bb117..3b11b819faece5 100644 --- a/deps/npm/node_modules/path-scurry/dist/esm/index.js +++ b/deps/npm/node_modules/path-scurry/dist/esm/index.js @@ -1,12 +1,12 @@ import { LRUCache } from 'lru-cache'; -import { posix, win32 } from 'path'; -import { fileURLToPath } from 'url'; -import * as actualFS from 'fs'; +import { posix, win32 } from 'node:path'; +import { fileURLToPath } from 'node:url'; import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps, } from 'fs'; +import * as actualFS from 'node:fs'; const realpathSync = rps.native; // TODO: test perf of fs/promises realpath vs realpathCB, // since the promises one uses realpath.native -import { lstat, readdir, readlink, realpath } from 'fs/promises'; +import { lstat, readdir, readlink, realpath } from 'node:fs/promises'; import { Minipass } from 'minipass'; const defaultFS = { lstatSync, @@ -22,8 +22,8 @@ const defaultFS = { }, }; // if they just gave us require('fs') then use our default -const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS - ? defaultFS +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? + defaultFS : { ...defaultFS, ...fsOption, @@ -64,20 +64,13 @@ const ENOREADLINK = 0b0001_0000_0000; const ENOREALPATH = 0b0010_0000_0000; const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH; const TYPEMASK = 0b0011_1111_1111; -const entToType = (s) => s.isFile() - ? IFREG - : s.isDirectory() - ? IFDIR - : s.isSymbolicLink() - ? IFLNK - : s.isCharacterDevice() - ? IFCHR - : s.isBlockDevice() - ? IFBLK - : s.isSocket() - ? IFSOCK - : s.isFIFO() - ? IFIFO +const entToType = (s) => s.isFile() ? IFREG + : s.isDirectory() ? IFDIR + : s.isSymbolicLink() ? IFLNK + : s.isCharacterDevice() ? IFCHR + : s.isBlockDevice() ? IFBLK + : s.isSocket() ? IFSOCK + : s.isFIFO() ? IFIFO : UNKNOWN; // normalize unicode path names const normalizeCache = new Map(); @@ -179,6 +172,11 @@ export class PathBase { * @internal */ nocase; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD = false; // potential default fs override #fs; // Stats fields @@ -266,14 +264,20 @@ export class PathBase { #realpath; /** * This property is for compatibility with the Dirent class as of - * Node v20, where Dirent['path'] refers to the path of the directory - * that was passed to readdir. So, somewhat counterintuitively, this - * property refers to the *parent* path, not the path object itself. - * For root entries, it's the path to the entry itself. + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. */ - get path() { + get parentPath() { return (this.parent || this).fullpath(); } + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path() { + return this.parentPath; + } /** * Do not create new Path objects directly. They should always be accessed * via the PathScurry class or other methods on the Path class. @@ -327,8 +331,8 @@ export class PathBase { const rootPath = this.getRootString(path); const dir = path.substring(rootPath.length); const dirParts = dir.split(this.splitSep); - const result = rootPath - ? this.getRoot(rootPath).#resolveParts(dirParts) + const result = rootPath ? + this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts); return result; } @@ -379,9 +383,7 @@ export class PathBase { } // find the child const children = this.children(); - const name = this.nocase - ? normalizeNocase(pathPart) - : normalize(pathPart); + const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart); for (const p of children) { if (p.#matchName === name) { return p; @@ -391,9 +393,7 @@ export class PathBase { // actually exist. If we know the parent isn't a dir, then // in fact it CAN'T exist. const s = this.parent ? this.sep : ''; - const fullpath = this.#fullpath - ? this.#fullpath + s + pathPart - : undefined; + const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined; const pchild = this.newChild(pathPart, UNKNOWN, { ...opts, parent: this, @@ -412,6 +412,8 @@ export class PathBase { * the cwd, then this ends up being equivalent to the fullpath() */ relative() { + if (this.isCWD) + return ''; if (this.#relative !== undefined) { return this.#relative; } @@ -432,6 +434,8 @@ export class PathBase { relativePosix() { if (this.sep === '/') return this.relative(); + if (this.isCWD) + return ''; if (this.#relativePosix !== undefined) return this.#relativePosix; const name = this.name; @@ -497,23 +501,15 @@ export class PathBase { return this[`is${type}`](); } getType() { - return this.isUnknown() - ? 'Unknown' - : this.isDirectory() - ? 'Directory' - : this.isFile() - ? 'File' - : this.isSymbolicLink() - ? 'SymbolicLink' - : this.isFIFO() - ? 'FIFO' - : this.isCharacterDevice() - ? 'CharacterDevice' - : this.isBlockDevice() - ? 'BlockDevice' - : /* c8 ignore start */ this.isSocket() - ? 'Socket' - : 'Unknown'; + return (this.isUnknown() ? 'Unknown' + : this.isDirectory() ? 'Directory' + : this.isFile() ? 'File' + : this.isSymbolicLink() ? 'SymbolicLink' + : this.isFIFO() ? 'FIFO' + : this.isCharacterDevice() ? 'CharacterDevice' + : this.isBlockDevice() ? 'BlockDevice' + : /* c8 ignore start */ this.isSocket() ? 'Socket' + : 'Unknown'); /* c8 ignore stop */ } /** @@ -647,8 +643,8 @@ export class PathBase { * directly. */ isNamed(n) { - return !this.nocase - ? this.#matchName === normalize(n) + return !this.nocase ? + this.#matchName === normalize(n) : this.#matchName === normalizeNocase(n); } /** @@ -704,7 +700,7 @@ export class PathBase { /* c8 ignore stop */ try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = (this.parent.realpathSync())?.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return (this.#linkTarget = linkTarget); } @@ -825,9 +821,7 @@ export class PathBase { #readdirMaybePromoteChild(e, c) { for (let p = c.provisional; p < c.length; p++) { const pchild = c[p]; - const name = this.nocase - ? normalizeNocase(e.name) - : normalize(e.name); + const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name); if (name !== pchild.#matchName) { continue; } @@ -1126,6 +1120,8 @@ export class PathBase { [setAsCwd](oldCwd) { if (oldCwd === this) return; + oldCwd.isCWD = false; + this.isCWD = true; const changed = new Set([]); let rp = []; let p = this; @@ -1977,9 +1973,7 @@ export const Path = process.platform === 'win32' ? PathWin32 : PathPosix; * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on * Darwin (macOS) systems, {@link PathScurryPosix} on all others. */ -export const PathScurry = process.platform === 'win32' - ? PathScurryWin32 - : process.platform === 'darwin' - ? PathScurryDarwin +export const PathScurry = process.platform === 'win32' ? PathScurryWin32 + : process.platform === 'darwin' ? PathScurryDarwin : PathScurryPosix; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/deps/npm/node_modules/path-scurry/package.json b/deps/npm/node_modules/path-scurry/package.json index 90a4b468f04618..e1766157894c8d 100644 --- a/deps/npm/node_modules/path-scurry/package.json +++ b/deps/npm/node_modules/path-scurry/package.json @@ -1,6 +1,6 @@ { "name": "path-scurry", - "version": "1.10.2", + "version": "1.11.1", "description": "walk paths fast and efficiently", "author": "Isaac Z. Schlueter (https://blog.izs.me)", "main": "./dist/commonjs/index.js", @@ -26,7 +26,6 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "preprepare": "rm -rf dist", "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", @@ -37,6 +36,7 @@ "bench": "bash ./scripts/bench.sh" }, "prettier": { + "experimentalTernaries": true, "semi": false, "printWidth": 75, "tabWidth": 2, @@ -49,20 +49,23 @@ }, "devDependencies": { "@nodelib/fs.walk": "^1.2.8", - "@types/node": "^20.11.30", + "@types/node": "^20.12.11", "c8": "^7.12.0", "eslint-config-prettier": "^8.6.0", "mkdirp": "^3.0.0", - "prettier": "^2.8.3", + "prettier": "^3.2.5", "rimraf": "^5.0.1", "tap": "^18.7.2", "ts-node": "^10.9.2", - "tshy": "^1.12.0", + "tshy": "^1.14.0", "typedoc": "^0.25.12", "typescript": "^5.4.3" }, + "tap": { + "typecheck": true + }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -76,6 +79,7 @@ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "tshy": { + "selfLink": false, "exports": { "./package.json": "./package.json", ".": "./src/index.ts" diff --git a/deps/npm/node_modules/promzard/lib/index.js b/deps/npm/node_modules/promzard/lib/index.js index 52c8a3c828313d..130bb4e3aa9e5b 100644 --- a/deps/npm/node_modules/promzard/lib/index.js +++ b/deps/npm/node_modules/promzard/lib/index.js @@ -133,6 +133,7 @@ class PromZard { o[k] = await this.#prompt(prompt, def, tx) } catch (er) { if (er.notValid) { + // eslint-disable-next-line no-console console.log(er.message) i-- } else { diff --git a/deps/npm/node_modules/promzard/package.json b/deps/npm/node_modules/promzard/package.json index a4253193232b87..71b0ed439a4402 100644 --- a/deps/npm/node_modules/promzard/package.json +++ b/deps/npm/node_modules/promzard/package.json @@ -2,9 +2,9 @@ "author": "GitHub Inc.", "name": "promzard", "description": "prompting wizardly", - "version": "1.0.1", + "version": "1.0.2", "repository": { - "url": "https://github.com/npm/promzard.git", + "url": "git+https://github.com/npm/promzard.git", "type": "git" }, "dependencies": { @@ -12,7 +12,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "tap": "^16.3.0" }, "main": "lib/index.js", @@ -35,7 +35,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "publish": true }, "tap": { diff --git a/deps/npm/node_modules/semver/README.md b/deps/npm/node_modules/semver/README.md index d0daebe2e280af..a896b79233a696 100644 --- a/deps/npm/node_modules/semver/README.md +++ b/deps/npm/node_modules/semver/README.md @@ -25,7 +25,7 @@ semver.valid(semver.coerce('v2')) // '2.0.0' semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' ``` -You can also just load the module for the function that you care about, if +You can also just load the module for the function that you care about if you'd like to minimize your footprint. ```js @@ -78,8 +78,8 @@ const semverOutside = require('semver/ranges/outside') const semverGtr = require('semver/ranges/gtr') const semverLtr = require('semver/ranges/ltr') const semverIntersects = require('semver/ranges/intersects') -const simplifyRange = require('semver/ranges/simplify') -const rangeSubset = require('semver/ranges/subset') +const semverSimplifyRange = require('semver/ranges/simplify') +const semverRangeSubset = require('semver/ranges/subset') ``` As a command-line utility: @@ -144,7 +144,7 @@ A leading `"="` or `"v"` character is stripped off and ignored. ## Ranges -A `version range` is a set of `comparators` which specify versions +A `version range` is a set of `comparators` that specify versions that satisfy the range. A `comparator` is composed of an `operator` and a `version`. The set @@ -155,7 +155,7 @@ of primitive `operators` is: * `>` Greater than * `>=` Greater than or equal to * `=` Equal. If no operator is specified, then equality is assumed, - so this operator is optional, but MAY be included. + so this operator is optional but MAY be included. For example, the comparator `>=1.2.7` would match the versions `1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` @@ -189,26 +189,26 @@ For example, the range `>1.2.3-alpha.3` would be allowed to match the version `1.2.3-alpha.7`, but it would *not* be satisfied by `3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater than" `1.2.3-alpha.3` according to the SemVer sort rules. The version -range only accepts prerelease tags on the `1.2.3` version. The -version `3.4.5` *would* satisfy the range, because it does not have a +range only accepts prerelease tags on the `1.2.3` version. +Version `3.4.5` *would* satisfy the range because it does not have a prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. -The purpose for this behavior is twofold. First, prerelease versions +The purpose of this behavior is twofold. First, prerelease versions frequently are updated very quickly, and contain many breaking changes that are (by the author's design) not yet fit for public consumption. -Therefore, by default, they are excluded from range matching +Therefore, by default, they are excluded from range-matching semantics. Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use *that specific* set of +indicated the intent to use *that specific* set of alpha/beta/rc versions. By including a prerelease tag in the range, the user is indicating that they are aware of the risk. However, it is still not appropriate to assume that they have opted into taking a similar risk on the *next* set of prerelease versions. Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the `includePrerelease` flag on the options +versions as if they were normal versions, for range-matching) +by setting the `includePrerelease` flag on the options object to any [functions](https://github.com/npm/node-semver#functions) that do range matching. @@ -401,12 +401,12 @@ All methods and classes take a final `options` object argument. All options in this object are `false` by default. The options supported are: -- `loose` Be more forgiving about not-quite-valid semver strings. +- `loose`: Be more forgiving about not-quite-valid semver strings. (Any resulting output will always be 100% strict compliant, of course.) For backwards compatibility reasons, if the `options` argument is a boolean value instead of an object, it is interpreted to be the `loose` param. -- `includePrerelease` Set to suppress the [default +- `includePrerelease`: Set to suppress the [default behavior](https://github.com/npm/node-semver#prerelease-tags) of excluding prerelease tagged versions from ranges unless they are explicitly opted into. @@ -415,16 +415,20 @@ Strict-mode Comparators and Ranges will be strict about the SemVer strings that they parse. * `valid(v)`: Return the parsed version, or null if it's not valid. -* `inc(v, release)`: Return the version incremented by the release - type (`major`, `premajor`, `minor`, `preminor`, `patch`, +* `inc(v, release, options, identifier, identifierBase)`: + Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or null if it's not valid * `premajor` in one call will bump the version up to the next major version and down to a prerelease of that major version. `preminor`, and `prepatch` work the same way. - * If called from a non-prerelease version, the `prerelease` will work the - same as `prepatch`. It increments the patch version, then makes a + * If called from a non-prerelease version, `prerelease` will work the + same as `prepatch`. It increments the patch version and then makes a prerelease. If the input version is already a prerelease it simply increments it. + * `identifier` can be used to prefix `premajor`, `preminor`, + `prepatch`, or `prerelease` version increments. `identifierBase` + is the base to be used for the `prerelease` identifier. * `prerelease(v)`: Returns an array of prerelease components, or null if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` * `major(v)`: Return the major version number. @@ -442,7 +446,7 @@ strings that they parse. * `lt(v1, v2)`: `v1 < v2` * `lte(v1, v2)`: `v1 <= v2` * `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, - even if they're not the exact same string. You already know how to + even if they're not the same string. You already know how to compare strings. * `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. * `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call @@ -451,15 +455,22 @@ strings that they parse. invalid comparison string is provided. * `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions +* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions in descending order when passed to `Array.sort()`. * `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions are equal. Sorts in ascending order if passed to `Array.sort()`. - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `diff(v1, v2)`: Returns difference between two versions by the release type +* `compareLoose(v1, v2)`: Short for ``compare(v1, v2, { loose: true })`. +* `diff(v1, v2)`: Returns the difference between two versions by the release type (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or null if the versions are the same. +### Sorting + +* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild` + function. +* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on + the `compareBuild` function in descending order. + ### Comparators * `intersects(comparator)`: Return true if the comparators intersect @@ -473,19 +484,19 @@ strings that they parse. that satisfies the range, or `null` if none of them do. * `minSatisfying(versions, range)`: Return the lowest version in the list that satisfies the range, or `null` if none of them do. -* `minVersion(range)`: Return the lowest version that can possibly match +* `minVersion(range)`: Return the lowest version that can match the given range. -* `gtr(version, range)`: Return `true` if version is greater than all the +* `gtr(version, range)`: Return `true` if the version is greater than all the versions possible in the range. -* `ltr(version, range)`: Return `true` if version is less than all the +* `ltr(version, range)`: Return `true` if the version is less than all the versions possible in the range. * `outside(version, range, hilo)`: Return true if the version is outside the bounds of the range in either the high or low direction. The `hilo` argument must be either the string `'>'` or `'<'`. (This is the function called by `gtr` and `ltr`.) -* `intersects(range)`: Return true if any of the ranges comparators intersect +* `intersects(range)`: Return true if any of the range comparators intersect. * `simplifyRange(versions, range)`: Return a "simplified" range that - matches the same items in `versions` list as the range specified. Note + matches the same items in the `versions` list as the range specified. Note that it does *not* guarantee that it would match the same versions in all cases, only for the set of versions provided. This is useful when generating ranges by joining together multiple versions with `||` @@ -498,7 +509,7 @@ strings that they parse. Note that, since ranges may be non-contiguous, a version might not be greater than a range, less than a range, *or* satisfy a range! For example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` -until `2.0.0`, so the version `1.2.10` would not be greater than the +until `2.0.0`, so version `1.2.10` would not be greater than the range (because `2.0.1` satisfies, which is higher), nor less than the range (since `1.2.8` satisfies, which is lower), and it also does not satisfy the range. @@ -511,13 +522,13 @@ range, use the `satisfies(version, range)` function. * `coerce(version, options)`: Coerces a string to semver if possible This aims to provide a very forgiving translation of a non-semver string to -semver. It looks for the first digit in a string, and consumes all +semver. It looks for the first digit in a string and consumes all remaining characters which satisfy at least a partial semver (e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`). Only text which lacks digits will fail coercion (`version one` -is not valid). The maximum length for any semver component considered for +is not valid). The maximum length for any semver component considered for coercion is 16 characters; longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value @@ -593,7 +604,7 @@ eg), and then pull the module name into the documentation for that specific thing. --> -You may pull in just the part of this semver utility that you need, if you +You may pull in just the part of this semver utility that you need if you are sensitive to packing and tree-shaking concerns. The main `require('semver')` export uses getter functions to lazily load the parts of the API that are used. @@ -636,5 +647,7 @@ The following modules are available: * `require('semver/ranges/min-satisfying')` * `require('semver/ranges/min-version')` * `require('semver/ranges/outside')` +* `require('semver/ranges/simplify')` +* `require('semver/ranges/subset')` * `require('semver/ranges/to-comparators')` * `require('semver/ranges/valid')` diff --git a/deps/npm/node_modules/semver/bin/semver.js b/deps/npm/node_modules/semver/bin/semver.js index 242b7ade7314ff..f62b566f74bc63 100755 --- a/deps/npm/node_modules/semver/bin/semver.js +++ b/deps/npm/node_modules/semver/bin/semver.js @@ -119,7 +119,11 @@ const main = () => { return fail() } } - return success(versions) + versions + .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options)) + .map(v => semver.clean(v, options)) + .map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v) + .forEach(v => console.log(v)) } const failInc = () => { @@ -129,19 +133,6 @@ const failInc = () => { const fail = () => process.exit(1) -const success = () => { - const compare = reverse ? 'rcompare' : 'compare' - versions.sort((a, b) => { - return semver[compare](a, b, options) - }).map((v) => { - return semver.clean(v, options) - }).map((v) => { - return inc ? semver.inc(v, inc, options, identifier, identifierBase) : v - }).forEach((v, i, _) => { - console.log(v) - }) -} - const help = () => console.log( `SemVer ${version} diff --git a/deps/npm/node_modules/semver/classes/range.js b/deps/npm/node_modules/semver/classes/range.js index 7e7c41410cbfdd..117b45a2b8e055 100644 --- a/deps/npm/node_modules/semver/classes/range.js +++ b/deps/npm/node_modules/semver/classes/range.js @@ -198,8 +198,8 @@ class Range { module.exports = Range -const LRU = require('lru-cache') -const cache = new LRU({ max: 1000 }) +const LRU = require('../internal/lrucache') +const cache = new LRU() const parseOptions = require('../internal/parse-options') const Comparator = require('./comparator') @@ -470,9 +470,10 @@ const replaceGTE0 = (comp, options) => { // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do // 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) => { + to, tM, tm, tp, tpr) => { if (isX(fM)) { from = '' } else if (isX(fm)) { diff --git a/deps/npm/node_modules/semver/classes/semver.js b/deps/npm/node_modules/semver/classes/semver.js index 84e84590e38714..13e66ce4415694 100644 --- a/deps/npm/node_modules/semver/classes/semver.js +++ b/deps/npm/node_modules/semver/classes/semver.js @@ -158,7 +158,7 @@ class SemVer { do { const a = this.build[i] const b = other.build[i] - debug('prerelease compare', i, a, b) + debug('build compare', i, a, b) if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { diff --git a/deps/npm/node_modules/semver/internal/lrucache.js b/deps/npm/node_modules/semver/internal/lrucache.js new file mode 100644 index 00000000000000..6d89ec948d0f1f --- /dev/null +++ b/deps/npm/node_modules/semver/internal/lrucache.js @@ -0,0 +1,40 @@ +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } + + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value + } + } + + delete (key) { + return this.map.delete(key) + } + + set (key, value) { + const deleted = this.delete(key) + + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } + + this.map.set(key, value) + } + + return this + } +} + +module.exports = LRUCache diff --git a/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE deleted file mode 100644 index 19129e315fe593..00000000000000 --- a/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -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 -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/semver/node_modules/lru-cache/index.js b/deps/npm/node_modules/semver/node_modules/lru-cache/index.js deleted file mode 100644 index 573b6b85b9779d..00000000000000 --- a/deps/npm/node_modules/semver/node_modules/lru-cache/index.js +++ /dev/null @@ -1,334 +0,0 @@ -'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 deleted file mode 100644 index 43b7502c3e7c79..00000000000000 --- a/deps/npm/node_modules/semver/node_modules/lru-cache/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "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/semver/package.json b/deps/npm/node_modules/semver/package.json index f00c6bddaebd92..cb8def45184df1 100644 --- a/deps/npm/node_modules/semver/package.json +++ b/deps/npm/node_modules/semver/package.json @@ -1,6 +1,6 @@ { "name": "semver", - "version": "7.6.0", + "version": "7.6.2", "description": "The semantic version parser used by npm.", "main": "index.js", "scripts": { @@ -14,13 +14,14 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", + "benchmark": "^2.1.4", "tap": "^16.0.0" }, "license": "ISC", "repository": { "type": "git", - "url": "https://github.com/npm/node-semver.git" + "url": "git+https://github.com/npm/node-semver.git" }, "bin": { "semver": "bin/semver.js" @@ -47,13 +48,10 @@ "engines": { "node": ">=10" }, - "dependencies": { - "lru-cache": "^6.0.0" - }, "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "engines": ">=10", "distPaths": [ "classes/", @@ -71,7 +69,8 @@ "/ranges/", "/index.js", "/preload.js", - "/range.bnf" + "/range.bnf", + "/benchmarks" ], "publish": "true" } diff --git a/deps/npm/node_modules/ssri/lib/index.js b/deps/npm/node_modules/ssri/lib/index.js index d0ff9dfaf24a77..7d749ed480fb98 100644 --- a/deps/npm/node_modules/ssri/lib/index.js +++ b/deps/npm/node_modules/ssri/lib/index.js @@ -535,7 +535,7 @@ function createIntegrity (opts) { hashes.forEach(h => h.update(chunk, enc)) return this }, - digest: function (enc) { + digest: function () { const integrity = algorithms.reduce((acc, algo) => { const digest = hashes.shift().digest('base64') const hash = new Hash( diff --git a/deps/npm/node_modules/ssri/package.json b/deps/npm/node_modules/ssri/package.json index 8750bd744d28bd..28395414e4643c 100644 --- a/deps/npm/node_modules/ssri/package.json +++ b/deps/npm/node_modules/ssri/package.json @@ -1,6 +1,6 @@ { "name": "ssri", - "version": "10.0.5", + "version": "10.0.6", "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", "main": "lib/index.js", "files": [ @@ -13,7 +13,7 @@ "posttest": "npm run lint", "test": "tap", "coverage": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -28,7 +28,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/ssri.git" + "url": "git+https://github.com/npm/ssri.git" }, "keywords": [ "w3c", @@ -51,7 +51,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "engines": { @@ -59,7 +59,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", + "version": "4.22.0", "publish": "true" } } diff --git a/deps/npm/node_modules/tuf-js/package.json b/deps/npm/node_modules/tuf-js/package.json index f6b2943f8195d6..9280719230d9ab 100644 --- a/deps/npm/node_modules/tuf-js/package.json +++ b/deps/npm/node_modules/tuf-js/package.json @@ -1,6 +1,6 @@ { "name": "tuf-js", - "version": "2.2.0", + "version": "2.2.1", "description": "JavaScript implementation of The Update Framework (TUF)", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -28,14 +28,14 @@ }, "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/client#readme", "devDependencies": { - "@tufjs/repo-mock": "2.0.0", + "@tufjs/repo-mock": "2.0.1", "@types/debug": "^4.1.12", "@types/make-fetch-happen": "^10.0.4" }, "dependencies": { - "@tufjs/models": "2.0.0", + "@tufjs/models": "2.0.1", "debug": "^4.3.4", - "make-fetch-happen": "^13.0.0" + "make-fetch-happen": "^13.0.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" diff --git a/deps/npm/node_modules/validate-npm-package-name/lib/index.js b/deps/npm/node_modules/validate-npm-package-name/lib/index.js index e7e612bfbdf4d5..fd800d5a5eae1f 100644 --- a/deps/npm/node_modules/validate-npm-package-name/lib/index.js +++ b/deps/npm/node_modules/validate-npm-package-name/lib/index.js @@ -1,7 +1,7 @@ 'use strict' +const { builtinModules: builtins } = require('module') var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$') -var builtins = require('builtins') var blacklist = [ 'node_modules', 'favicon.ico', @@ -52,11 +52,9 @@ function validate (name) { // Generate warnings for stuff that used to be allowed // core module names like http, events, util, etc - builtins({ version: '*' }).forEach(function (builtin) { - if (name.toLowerCase() === builtin) { - warnings.push(builtin + ' is a core module name') - } - }) + if (builtins.includes(name.toLowerCase())) { + warnings.push(name + ' is a core module name') + } if (name.length > 214) { warnings.push('name can no longer contain more than 214 characters') diff --git a/deps/npm/node_modules/validate-npm-package-name/package.json b/deps/npm/node_modules/validate-npm-package-name/package.json index 5579a5c33a76b8..8a38b66e1d3e43 100644 --- a/deps/npm/node_modules/validate-npm-package-name/package.json +++ b/deps/npm/node_modules/validate-npm-package-name/package.json @@ -1,17 +1,14 @@ { "name": "validate-npm-package-name", - "version": "5.0.0", + "version": "5.0.1", "description": "Give me a string and I'll tell you if it's a valid npm package name", "main": "lib/", "directories": { "test": "test" }, - "dependencies": { - "builtins": "^5.0.0" - }, "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "4.5.1", + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.22.0", "tap": "^16.0.1" }, "scripts": { @@ -19,7 +16,7 @@ "test:code": "tap ${TAP_FLAGS:-'--'} test/*.js", "test:style": "standard", "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -28,7 +25,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/validate-npm-package-name.git" + "url": "git+https://github.com/npm/validate-npm-package-name.git" }, "keywords": [ "npm", @@ -51,12 +48,10 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.5.1" + "version": "4.22.0", + "publish": true }, "tap": { - "statements": 88, - "branches": 92, - "lines": 88, "nyc-arg": [ "--exclude", "tap-snapshots/**" diff --git a/deps/npm/package.json b/deps/npm/package.json index 1aae41fbe75769..40c0643748e748 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "10.7.0", + "version": "10.8.0", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -52,71 +52,71 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^7.2.1", - "@npmcli/config": "^8.0.2", - "@npmcli/fs": "^3.1.0", + "@npmcli/arborist": "^7.5.2", + "@npmcli/config": "^8.3.2", + "@npmcli/fs": "^3.1.1", "@npmcli/map-workspaces": "^3.0.6", "@npmcli/package-json": "^5.1.0", - "@npmcli/promise-spawn": "^7.0.1", + "@npmcli/promise-spawn": "^7.0.2", "@npmcli/redact": "^2.0.0", "@npmcli/run-script": "^8.1.0", - "@sigstore/tuf": "^2.3.2", + "@sigstore/tuf": "^2.3.3", "abbrev": "^2.0.0", "archy": "~1.0.0", - "cacache": "^18.0.2", + "cacache": "^18.0.3", "chalk": "^5.3.0", "ci-info": "^4.0.0", "cli-columns": "^4.0.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", - "glob": "^10.3.12", + "glob": "^10.3.15", "graceful-fs": "^4.2.11", - "hosted-git-info": "^7.0.1", + "hosted-git-info": "^7.0.2", "ini": "^4.1.2", - "init-package-json": "^6.0.2", + "init-package-json": "^6.0.3", "is-cidr": "^5.0.5", - "json-parse-even-better-errors": "^3.0.1", - "libnpmaccess": "^8.0.1", - "libnpmdiff": "^6.0.3", - "libnpmexec": "^8.0.0", - "libnpmfund": "^5.0.1", - "libnpmhook": "^10.0.0", - "libnpmorg": "^6.0.1", - "libnpmpack": "^7.0.0", - "libnpmpublish": "^9.0.2", - "libnpmsearch": "^7.0.0", - "libnpmteam": "^6.0.0", - "libnpmversion": "^6.0.0", + "json-parse-even-better-errors": "^3.0.2", + "libnpmaccess": "^8.0.6", + "libnpmdiff": "^6.1.2", + "libnpmexec": "^8.1.1", + "libnpmfund": "^5.0.10", + "libnpmhook": "^10.0.5", + "libnpmorg": "^6.0.6", + "libnpmpack": "^7.0.2", + "libnpmpublish": "^9.0.8", + "libnpmsearch": "^7.0.5", + "libnpmteam": "^6.0.5", + "libnpmversion": "^6.0.2", "make-fetch-happen": "^13.0.1", "minimatch": "^9.0.4", - "minipass": "^7.0.4", + "minipass": "^7.1.1", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^10.1.0", - "nopt": "^7.2.0", - "normalize-package-data": "^6.0.0", + "nopt": "^7.2.1", + "normalize-package-data": "^6.0.1", "npm-audit-report": "^5.0.0", "npm-install-checks": "^6.3.0", "npm-package-arg": "^11.0.2", - "npm-pick-manifest": "^9.0.0", - "npm-profile": "^9.0.2", - "npm-registry-fetch": "^17.0.0", - "npm-user-validate": "^2.0.0", + "npm-pick-manifest": "^9.0.1", + "npm-profile": "^10.0.0", + "npm-registry-fetch": "^17.0.1", + "npm-user-validate": "^2.0.1", "p-map": "^4.0.0", - "pacote": "^18.0.3", + "pacote": "^18.0.6", "parse-conflict-json": "^3.0.1", "proc-log": "^4.2.0", "qrcode-terminal": "^0.12.0", "read": "^3.0.1", - "semver": "^7.6.0", + "semver": "^7.6.2", "spdx-expression-parse": "^4.0.0", - "ssri": "^10.0.5", + "ssri": "^10.0.6", "supports-color": "^9.4.0", "tar": "^6.2.1", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", - "validate-npm-package-name": "^5.0.0", + "validate-npm-package-name": "^5.0.1", "which": "^4.0.0", "write-file-atomic": "^5.0.1" }, @@ -193,10 +193,10 @@ "devDependencies": { "@npmcli/docs": "^1.0.0", "@npmcli/eslint-config": "^4.0.2", - "@npmcli/git": "^5.0.6", + "@npmcli/git": "^5.0.7", "@npmcli/mock-globals": "^1.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.21.3", + "@npmcli/template-oss": "4.22.0", "@tufjs/repo-mock": "^2.0.0", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", @@ -253,7 +253,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", + "version": "4.22.0", "content": "./scripts/template-oss/root.js" }, "license": "Artistic-2.0", diff --git a/deps/npm/tap-snapshots/test/lib/cli/exit-handler.js.test.cjs b/deps/npm/tap-snapshots/test/lib/cli/exit-handler.js.test.cjs index cedb56642f26d7..fd68eea57795be 100644 --- a/deps/npm/tap-snapshots/test/lib/cli/exit-handler.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/cli/exit-handler.js.test.cjs @@ -7,10 +7,10 @@ 'use strict' exports[`test/lib/cli/exit-handler.js TAP handles unknown error with logs and debug file > debug file contents 1`] = ` XX timing npm:load:whichnode Completed in {TIME}ms -XX silly config:load:file:{CWD}/npmrc -XX silly config:load:file:{CWD}/prefix/.npmrc -XX silly config:load:file:{CWD}/home/.npmrc -XX silly config:load:file:{CWD}/global/etc/npmrc +XX silly config load:file:{CWD}/npmrc +XX silly config load:file:{CWD}/prefix/.npmrc +XX silly config load:file:{CWD}/home/.npmrc +XX silly config load:file:{CWD}/global/etc/npmrc XX timing npm:load:configload Completed in {TIME}ms XX timing npm:load:mkdirpcache Completed in {TIME}ms XX timing npm:load:mkdirplogs Completed in {TIME}ms @@ -20,27 +20,27 @@ XX timing npm:load:setTitle Completed in {TIME}ms XX verbose logfile logs-max:10 dir:{CWD}/cache/_logs/{DATE}- XX verbose logfile {CWD}/cache/_logs/{DATE}-debug-0.log XX timing npm:load Completed in {TIME}ms +XX timing command:root Completed in {TIME}ms XX verbose stack Error: Unknown error +XX error code ECODE +XX error Unknown error +XX timing npm Completed in {TIME}ms +XX info timing Timing info written to: {CWD}/cache/_logs/{DATE}-timing.json XX verbose cwd {CWD}/prefix -XX verbose {OS} +XX verbose os {OS} XX verbose {NODE-VERSION} XX verbose npm {NPM-VERSION} -XX error code ECODE -XX error ERR SUMMARY Unknown error -XX error ERR DETAIL Unknown error XX verbose exit 1 XX verbose code 1 -XX timing npm Completed in {TIME}ms -XX info timing Timing info written to: {CWD}/cache/_logs/{DATE}-timing.json XX error A complete log of this run can be found in: {CWD}/cache/_logs/{DATE}-debug-0.log ` exports[`test/lib/cli/exit-handler.js TAP handles unknown error with logs and debug file > logs 1`] = ` timing npm:load:whichnode Completed in {TIME}ms -silly config:load:file:{CWD}/npmrc -silly config:load:file:{CWD}/prefix/.npmrc -silly config:load:file:{CWD}/home/.npmrc -silly config:load:file:{CWD}/global/etc/npmrc +silly config load:file:{CWD}/npmrc +silly config load:file:{CWD}/prefix/.npmrc +silly config load:file:{CWD}/home/.npmrc +silly config load:file:{CWD}/global/etc/npmrc timing npm:load:configload Completed in {TIME}ms timing npm:load:mkdirpcache Completed in {TIME}ms timing npm:load:mkdirplogs Completed in {TIME}ms @@ -50,17 +50,17 @@ timing npm:load:setTitle Completed in {TIME}ms verbose logfile logs-max:10 dir:{CWD}/cache/_logs/{DATE}- verbose logfile {CWD}/cache/_logs/{DATE}-debug-0.log timing npm:load Completed in {TIME}ms +timing command:root Completed in {TIME}ms verbose stack Error: Unknown error +error code ECODE +error Unknown error +timing npm Completed in {TIME}ms +info timing Timing info written to: {CWD}/cache/_logs/{DATE}-timing.json verbose cwd {CWD}/prefix -verbose {OS} +verbose os {OS} verbose {NODE-VERSION} verbose npm {NPM-VERSION} -error code ECODE -error ERR SUMMARY Unknown error -error ERR DETAIL Unknown error verbose exit 1 verbose code 1 -timing npm Completed in {TIME}ms -info timing Timing info written to: {CWD}/cache/_logs/{DATE}-timing.json error A complete log of this run can be found in: {CWD}/cache/_logs/{DATE}-debug-0.log ` diff --git a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs index c018a356f7d21c..0d62bacd45fa19 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -8,6 +8,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches snapshot 1`] = ` { "cache": "{CACHE}", + "color": {COLOR}, "json": true, "projectloaded": "yes", "userloaded": "yes", @@ -29,7 +30,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "call": "", "cert": null, "cidr": null, - "color": {COLOR}, "commit-hooks": true, "cpu": null, "depth": null, @@ -192,7 +192,7 @@ cafile = null call = "" cert = null cidr = null -color = {COLOR} +; color = {COLOR} commit-hooks = true cpu = null depth = null @@ -345,6 +345,7 @@ projectloaded = "yes" ; "cli" config from command line options cache = "{CACHE}" +color = {COLOR} long = true ` @@ -355,6 +356,10 @@ globalloaded = "yes" ; "user" config from {CWD}/home/.npmrc +_auth = (protected) +//nerfdart:_auth = (protected) +//nerfdart:auth = (protected) +auth = (protected) userloaded = "yes" ; "project" config from {CWD}/prefix/.npmrc @@ -364,6 +369,7 @@ projectloaded = "yes" ; "cli" config from command line options cache = "{CACHE}" +color = {COLOR} ; node bin location = {NODE-BIN-LOCATION} ; node version = {NODE-VERSION} @@ -378,6 +384,7 @@ exports[`test/lib/commands/config.js TAP config list with publishConfig global > ; "cli" config from command line options cache = "{CACHE}" +color = {COLOR} global = true ; node bin location = {NODE-BIN-LOCATION} @@ -393,6 +400,7 @@ exports[`test/lib/commands/config.js TAP config list with publishConfig local > ; "cli" config from command line options cache = "{CACHE}" +color = {COLOR} ; node bin location = {NODE-BIN-LOCATION} ; node version = {NODE-VERSION} 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 index 0481c6d86823e8..0f5b9520516f23 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs @@ -121,7 +121,9 @@ Object { exports[`test/lib/commands/doctor.js TAP bad proxy > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -400,7 +402,9 @@ exports[`test/lib/commands/doctor.js TAP discrete checks git > output 1`] = ` exports[`test/lib/commands/doctor.js TAP discrete checks invalid environment > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Finding git in your PATH", @@ -514,7 +518,9 @@ current: v1.0.0, recommended: v1.0.0 exports[`test/lib/commands/doctor.js TAP error reading directory > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -616,7 +622,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP incorrect owner > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -686,6 +694,7 @@ Object { "doctor checkFilesPermission Missing permissions on {CWD}/global/node_modules (expect: readable)", "doctor checkFilesPermission Missing permissions on {CWD}/prefix/node_modules/.bin (expect: readable, writable, executable)", "doctor checkFilesPermission Missing permissions on {CWD}/global/bin (expect: executable)", + "Some problems found. See above for recommendations.", ], "info": Array [ "doctor Running checkup", @@ -710,7 +719,9 @@ Object { exports[`test/lib/commands/doctor.js TAP missing git > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -731,11 +742,6 @@ Object { "warn": Array [ String( doctor getGitPath Error: test error - doctor at {STACK} - doctor at {STACK} - doctor at {STACK} - doctor at {STACK} - doctor at {STACK} ), ], } @@ -776,7 +782,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP missing global directories > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -895,7 +903,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP node out of date - current > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -952,7 +962,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP node out of date - lts > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -1009,7 +1021,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP non-default registry > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -1066,7 +1080,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP npm out of date > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -1123,7 +1139,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP ping 404 > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -1181,7 +1199,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP ping 404 in color > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "/u001b[94mdoctor/u001b[39m Running checkup", "/u001b[94mdoctor/u001b[39m Pinging registry", @@ -1239,7 +1259,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP ping exception with code > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", @@ -1297,7 +1319,9 @@ verified 0 tarballs exports[`test/lib/commands/doctor.js TAP ping exception without code > logs 1`] = ` Object { - "error": Array [], + "error": Array [ + "Some problems found. See above for recommendations.", + ], "info": Array [ "doctor Running checkup", "doctor Pinging registry", diff --git a/deps/npm/tap-snapshots/test/lib/commands/run-script.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/run-script.js.test.cjs new file mode 100644 index 00000000000000..189e2f84d2901c --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/commands/run-script.js.test.cjs @@ -0,0 +1,274 @@ +/* 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/run-script.js TAP list scripts no args > basic report 1`] = ` +Lifecycle scripts included in x@1.2.3: + test + exit 2 + start + node server.js + stop + node kill-server.js +available via \`npm run-script\`: + preenv + echo before the env + postenv + echo after the env +` + +exports[`test/lib/commands/run-script.js TAP list scripts parseable > must match snapshot 1`] = ` +test:exit 2 +start:node server.js +stop:node kill-server.js +preenv:echo before the env +postenv:echo after the env +` + +exports[`test/lib/commands/run-script.js TAP list scripts warn json > json report 1`] = ` +{ + "test": "exit 2", + "start": "node server.js", + "stop": "node kill-server.js", + "preenv": "echo before the env", + "postenv": "echo after the env" +} +` + +exports[`test/lib/commands/run-script.js TAP list scripts, only commands > must match snapshot 1`] = ` +Lifecycle scripts included in x@1.2.3: + preversion + echo doing the version dance +` + +exports[`test/lib/commands/run-script.js TAP list scripts, only non-commands > must match snapshot 1`] = ` +Scripts available in x@1.2.3 via \`npm run-script\`: + glorp + echo doing the glerp glop +` + +exports[`test/lib/commands/run-script.js TAP workspaces failed workspace run with succeeded runs > should log error msgs for each workspace script 1`] = ` +Lifecycle script \`glorp\` failed with error: +code ERR +workspace a@1.0.0 +location {CWD}/prefix/packages/a +ERR +` + +exports[`test/lib/commands/run-script.js TAP workspaces list all scripts --json > must match snapshot 1`] = ` +{ + "a": { + "glorp": "echo a doing the glerp glop" + }, + "b": { + "glorp": "echo b doing the glerp glop" + }, + "c": { + "test": "exit 0", + "posttest": "echo posttest", + "lorem": "echo c lorem" + }, + "d": { + "test": "exit 0", + "posttest": "echo posttest" + }, + "e": { + "test": "exit 0", + "start": "echo start something" + }, + "noscripts": {} +} +` + +exports[`test/lib/commands/run-script.js TAP workspaces list all scripts --parseable > must match snapshot 1`] = ` +a:glorp:echo a doing the glerp glop +b:glorp:echo b doing the glerp glop +c:test:exit 0 +c:posttest:echo posttest +c:lorem:echo c lorem +d:test:exit 0 +d:posttest:echo posttest +e:test:exit 0 +e:start:echo start something +` + +exports[`test/lib/commands/run-script.js TAP workspaces list all scripts > must match snapshot 1`] = ` +Scripts available in a@1.0.0 via \`npm run-script\`: + glorp + echo a doing the glerp glop + +Scripts available in b@2.0.0 via \`npm run-script\`: + glorp + echo b doing the glerp glop + +Lifecycle scripts included in c@1.0.0: + test + exit 0 + posttest + echo posttest +available via \`npm run-script\`: + lorem + echo c lorem + +Lifecycle scripts included in d@1.0.0: + test + exit 0 + posttest + echo posttest + +Lifecycle scripts included in e: + test + exit 0 + start + echo start something +` + +exports[`test/lib/commands/run-script.js TAP workspaces list all scripts with colors > must match snapshot 1`] = ` +Scripts available in a@1.0.0 via \`npm run-script\`: + glorp + echo a doing the glerp glop + +Scripts available in b@2.0.0 via \`npm run-script\`: + glorp + echo b doing the glerp glop + +Lifecycle scripts included in c@1.0.0: + test + exit 0 + posttest + echo posttest +available via \`npm run-script\`: + lorem + echo c lorem + +Lifecycle scripts included in d@1.0.0: + test + exit 0 + posttest + echo posttest + +Lifecycle scripts included in e: + test + exit 0 + start + echo start something +` + +exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by name > must match snapshot 1`] = ` +Scripts available in a@1.0.0 via \`npm run-script\`: + glorp + echo a doing the glerp glop + +Scripts available in b@2.0.0 via \`npm run-script\`: + glorp + echo b doing the glerp glop +` + +exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by parent folder > must match snapshot 1`] = ` +Scripts available in a@1.0.0 via \`npm run-script\`: + glorp + echo a doing the glerp glop + +Scripts available in b@2.0.0 via \`npm run-script\`: + glorp + echo b doing the glerp glop + +Lifecycle scripts included in c@1.0.0: + test + exit 0 + posttest + echo posttest +available via \`npm run-script\`: + lorem + echo c lorem + +Lifecycle scripts included in d@1.0.0: + test + exit 0 + posttest + echo posttest + +Lifecycle scripts included in e: + test + exit 0 + start + echo start something +` + +exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by path > must match snapshot 1`] = ` +Scripts available in a@1.0.0 via \`npm run-script\`: + glorp + echo a doing the glerp glop +` + +exports[`test/lib/commands/run-script.js TAP workspaces missing scripts in all workspaces > should log error msgs for each workspace script 1`] = ` +Lifecycle script \`missing-script\` failed with error: +workspace a@1.0.0 +location {CWD}/prefix/packages/a +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=a@1.0.0 +Lifecycle script \`missing-script\` failed with error: +workspace b@2.0.0 +location {CWD}/prefix/packages/b +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=b@2.0.0 +Lifecycle script \`missing-script\` failed with error: +workspace c@1.0.0 +location {CWD}/prefix/packages/c +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=c@1.0.0 +Lifecycle script \`missing-script\` failed with error: +workspace d@1.0.0 +location {CWD}/prefix/packages/d +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=d@1.0.0 +Lifecycle script \`missing-script\` failed with error: +workspace e +location {CWD}/prefix/packages/e +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=e +Lifecycle script \`missing-script\` failed with error: +workspace noscripts@1.0.0 +location {CWD}/prefix/packages/noscripts +Missing script: "missing-script" +npm error +To see a list of scripts, run: + npm run --workspace=noscripts@1.0.0 +` + +exports[`test/lib/commands/run-script.js TAP workspaces missing scripts in some workspaces > should log error msgs for each workspace script 1`] = ` +Lifecycle script \`test\` failed with error: +workspace a@1.0.0 +location {CWD}/prefix/packages/a +Missing script: "test" +npm error +To see a list of scripts, run: + npm run --workspace=a@1.0.0 +Lifecycle script \`test\` failed with error: +workspace b@2.0.0 +location {CWD}/prefix/packages/b +Missing script: "test" +npm error +To see a list of scripts, run: + npm run --workspace=b@2.0.0 +` + +exports[`test/lib/commands/run-script.js TAP workspaces single failed workspace run > should log error msgs for each workspace script 1`] = ` +Lifecycle script \`test\` failed with error: +workspace c@1.0.0 +location {CWD}/prefix/packages/c +err +` 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 f0ac314925b28f..96b41b117d19b2 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 @@ -49,7 +49,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient upgrad "created a lockfile as npm-shrinkwrap.json with version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v1 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v1 -> v3" ] } ` @@ -98,7 +98,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing downg "created a lockfile as npm-shrinkwrap.json with version 1" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v1" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v1" ] } ` @@ -125,7 +125,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing upgra "created a lockfile as npm-shrinkwrap.json with version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v3" ] } ` @@ -188,7 +188,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient > "npm-shrinkwrap.json updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v1 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v1 -> v3" ] } ` @@ -217,7 +217,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient up "npm-shrinkwrap.json updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v1 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v1 -> v3" ] } ` @@ -266,7 +266,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing d "npm-shrinkwrap.json updated to version 1" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v1" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v1" ] } ` @@ -295,7 +295,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing u "npm-shrinkwrap.json updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v3" ] } ` @@ -322,7 +322,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient > mu "package-lock.json has been renamed to npm-shrinkwrap.json and updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v1 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v1 -> v3" ] } ` @@ -351,7 +351,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient upgr "package-lock.json has been renamed to npm-shrinkwrap.json and updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v1 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v1 -> v3" ] } ` @@ -400,7 +400,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing dow "package-lock.json has been renamed to npm-shrinkwrap.json and updated to version 1" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v1" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v1" ] } ` @@ -429,7 +429,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing upg "package-lock.json has been renamed to npm-shrinkwrap.json and updated to version 3" ], "warn": [ - "Converting lock file (npm-shrinkwrap.json) from v2 -> v3" + "shrinkwrap Converting lock file (npm-shrinkwrap.json) from v2 -> v3" ] } ` 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 3e06ecf5d054ee..54ceb893ae58a5 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 @@ -300,6 +300,25 @@ dist-tags: published over a year from now ` +exports[`test/lib/commands/view.js TAP package with single version full json > must match snapshot 1`] = ` +{ + "_id": "single-version", + "name": "single-version", + "dist-tags": { + "latest": "1.0.0" + }, + "versions": [ + "1.0.0" + ], + "version": "1.0.0", + "dist": { + "shasum": "123", + "tarball": "http://hm.single-version.com/1.0.0.tgz", + "fileCount": 1 + } +} +` + exports[`test/lib/commands/view.js TAP specific field names array field - 1 element > must match snapshot 1`] = ` claudia ` diff --git a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs index 5ae16bc2d2c729..58277cf5052d89 100644 --- a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs @@ -1262,7 +1262,7 @@ a semver. Like the \`rc\` in \`1.2.0-rc.8\`. * Type: Boolean When set to \`true\`, npm will display a progress bar during time intensive -operations, if \`process.stderr\` is a TTY. +operations, if \`process.stderr\` and \`process.stdout\` are a TTY. Set to \`false\` to suppress the progress bar. 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 e2301a60386582..954e95e7180070 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 @@ -28,10 +28,11 @@ Object { ], Array [ "404", - String( - - Note that you can also install from a - ), + "", + ], + Array [ + "404", + "Note that you can also install from a", ], Array [ "404", @@ -70,10 +71,11 @@ Object { ], Array [ "404", - String( - - Note that you can also install from a - ), + "", + ], + Array [ + "404", + "Note that you can also install from a", ], Array [ "404", @@ -112,10 +114,11 @@ Object { ], Array [ "404", - String( - - Note that you can also install from a - ), + "", + ], + Array [ + "404", + "Note that you can also install from a", ], Array [ "404", @@ -157,10 +160,11 @@ Object { ], Array [ "404", - String( - - Note that you can also install from a - ), + "", + ], + Array [ + "404", + "Note that you can also install from a", ], Array [ "404", @@ -1021,11 +1025,11 @@ Object { authentication token or enable two-factor authentication then that means you likely typed your password in incorrectly. Please try again, or recover your password at: - https://www.npmjs.com/forgot + https://www.npmjs.com/forgot If you were doing some other operation then your saved credentials are probably out of date. To correct this please try logging in again with: - npm login + npm login ), ], ], @@ -1045,7 +1049,7 @@ Object { "", String( To correct this please try logging in again with: - npm login + npm login ), ], ], @@ -1283,7 +1287,7 @@ Object { "typeerror", String( This is an error with npm itself. Please report this error at: - https://github.com/npm/cli/issues + https://github.com/npm/cli/issues ), ], ], @@ -1303,7 +1307,7 @@ Object { "typeerror", String( This is an error with npm itself. Please report this error at: - https://github.com/npm/cli/issues + https://github.com/npm/cli/issues ), ], ], @@ -1323,7 +1327,7 @@ Object { "typeerror", String( This is an error with npm itself. Please report this error at: - https://github.com/npm/cli/issues + https://github.com/npm/cli/issues ), ], ], @@ -1364,7 +1368,7 @@ Object { "typeerror", String( This is an error with npm itself. Please report this error at: - https://github.com/npm/cli/issues + https://github.com/npm/cli/issues ), ], ], @@ -1505,7 +1509,7 @@ Object { ], Array [ "publish fail", - " npm help version", + " npm help version", ], ], "summary": Array [ @@ -1535,7 +1539,7 @@ Object { ], Array [ "git", - " /some/path", + " /some/path", ], ], } diff --git a/deps/npm/tap-snapshots/test/lib/utils/open-url-prompt.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/open-url-prompt.js.test.cjs deleted file mode 100644 index cf5feed44cc373..00000000000000 --- a/deps/npm/tap-snapshots/test/lib/utils/open-url-prompt.js.test.cjs +++ /dev/null @@ -1,22 +0,0 @@ -/* 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/utils/open-url-prompt.js TAP does not error when opener can not find command > Outputs extra Browser unavailable message and url 1`] = ` -npm home: -https://www.npmjs.com -Browser unavailable. Please open the URL manually: - https://www.npmjs.com -` - -exports[`test/lib/utils/open-url-prompt.js TAP opens a url > must match snapshot 1`] = ` -npm home: -https://www.npmjs.com -` - -exports[`test/lib/utils/open-url-prompt.js TAP prints json output > must match snapshot 1`] = ` -{"title":"npm home","url":"https://www.npmjs.com"} -` diff --git a/deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs index f1560db686cde0..92511b9284c7a3 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs @@ -5,19 +5,33 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/utils/open-url.js TAP prints where to go when browser is disabled > printed expected message 1`] = ` +exports[`test/lib/utils/open-url.js TAP open url prints where to go when browser is disabled > printed expected message 1`] = ` npm home: - https://www.npmjs.com +https://www.npmjs.com ` -exports[`test/lib/utils/open-url.js TAP prints where to go when browser is disabled and json is enabled > printed expected message 1`] = ` -{ - "title": "npm home", - "url": "https://www.npmjs.com" -} +exports[`test/lib/utils/open-url.js TAP open url prints where to go when browser is disabled and json is enabled > printed expected message 1`] = ` +{"title":"npm home","url":"https://www.npmjs.com"} ` -exports[`test/lib/utils/open-url.js TAP prints where to go when given browser does not exist > printed expected message 1`] = ` +exports[`test/lib/utils/open-url.js TAP open url prints where to go when given browser does not exist > printed expected message 1`] = ` npm home: - https://www.npmjs.com +https://www.npmjs.com +` + +exports[`test/lib/utils/open-url.js TAP open url prompt does not error when opener can not find command > Outputs extra Browser unavailable message and url 1`] = ` +npm home: +https://www.npmjs.com + +Browser unavailable. Please open the URL manually: +https://www.npmjs.com +` + +exports[`test/lib/utils/open-url.js TAP open url prompt opens a url > must match snapshot 1`] = ` +npm home: +https://www.npmjs.com +` + +exports[`test/lib/utils/open-url.js TAP open url prompt prints json output > must match snapshot 1`] = ` +{"title":"npm home","url":"https://www.npmjs.com"} ` diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js index d8a4834a9abfff..674147781af4c8 100644 --- a/deps/npm/test/fixtures/mock-npm.js +++ b/deps/npm/test/fixtures/mock-npm.js @@ -2,8 +2,6 @@ const os = require('os') const fs = require('fs').promises const path = require('path') const tap = require('tap') -const { output, META } = require('proc-log') -const errorMessage = require('../../lib/utils/error-message') const mockLogs = require('./mock-logs.js') const mockGlobals = require('@npmcli/mock-globals') const tmock = require('./tmock') @@ -83,21 +81,6 @@ const getMockNpm = async (t, { mocks, init, load, npm: npmOpts }) => { await Promise.all(this.unrefPromises) return res } - - async exec (...args) { - const [res, err] = await super.exec(...args).then((r) => [r]).catch(e => [null, e]) - // This mimics how the exit handler flushes output for commands that have - // buffered output. It also uses the same json error processing from the - // error message fn. This is necessary for commands with buffered output - // to read the output after exec is called. This is not *exactly* how it - // works in practice, but it is close enough for now. - const jsonError = err && errorMessage(err, this).json - output.flush({ [META]: true, jsonError }) - if (err) { - throw err - } - return res - } } const npm = init ? new MockNpm() : null diff --git a/deps/npm/test/lib/cli/entry.js b/deps/npm/test/lib/cli/entry.js index 60a38b70abf895..87563fab59902a 100644 --- a/deps/npm/test/lib/cli/entry.js +++ b/deps/npm/test/lib/cli/entry.js @@ -8,16 +8,22 @@ const validateEngines = require('../../../lib/cli/validate-engines.js') const cliMock = async (t, opts) => { let exitHandlerArgs = null let npm = null - const exitHandlerMock = (...args) => { - exitHandlerArgs = args - npm.unload() - } - exitHandlerMock.setNpm = _npm => npm = _npm const { Npm, ...mock } = await loadMockNpm(t, { ...opts, init: false }) const cli = tmock(t, '{LIB}/cli/entry.js', { '{LIB}/npm.js': Npm, - '{LIB}/cli/exit-handler.js': exitHandlerMock, + '{LIB}/cli/exit-handler.js': class MockExitHandler { + exit (...args) { + exitHandlerArgs = args + npm.unload() + } + + registerUncaughtHandlers () {} + + setNpm (_npm) { + npm = _npm + } + }, }) return { @@ -113,21 +119,6 @@ t.test('print usage if no params provided', async t => { t.match(process.exitCode, 1) }) -t.test('print usage if non-command param provided', async t => { - const { cli, outputs, exitHandlerCalled, exitHandlerNpm } = await cliMock(t, { - globals: { - 'process.argv': ['node', 'npm', 'tset'], - }, - }) - await cli(process) - - t.match(outputs[0], 'Unknown command: "tset"') - t.match(outputs[0], 'Did you mean this?') - t.match(exitHandlerCalled(), [], 'should call exitHandler with no args') - t.ok(exitHandlerNpm(), 'exitHandler npm is set') - t.match(process.exitCode, 1) -}) - t.test('load error calls error handler', async t => { const err = new Error('test load error') const { cli, exitHandlerCalled } = await cliMock(t, { diff --git a/deps/npm/test/lib/cli/exit-handler.js b/deps/npm/test/lib/cli/exit-handler.js index 7b465643504c76..da050bbb0708e7 100644 --- a/deps/npm/test/lib/cli/exit-handler.js +++ b/deps/npm/test/lib/cli/exit-handler.js @@ -5,6 +5,8 @@ const os = require('node:os') const t = require('tap') const fsMiniPass = require('fs-minipass') const { output, time } = require('proc-log') +const errorMessage = require('../../../lib/utils/error-message.js') +const ExecCommand = require('../../../lib/commands/exec.js') const { load: loadMockNpm } = require('../../fixtures/mock-npm') const mockGlobals = require('@npmcli/mock-globals') const { cleanCwd, cleanDate } = require('../../fixtures/clean-snapshot') @@ -46,20 +48,52 @@ mockGlobals(t, { // these are process properties that are needed in the running code and tests // eslint-disable-next-line max-len ...pick(process, 'version', 'execPath', 'stdout', 'stderr', 'stdin', 'cwd', 'chdir', 'env', 'umask'), + pid: 123456, argv: ['/node', ...process.argv.slice(1)], kill: () => {}, reallyExit: (code) => process.exit(code), - pid: 123456, - exit: (code) => { - process.exitCode = code || process.exitCode || 0 - process.emit('exit', process.exitCode) + exit (code) { + this.emit('exit', code) }, }), }, { replace: true }) -const mockExitHandler = async (t, { config, mocks, files, ...opts } = {}) => { +const mockExitHandler = async (t, { + config, + mocks = {}, + files, + error, + command, + ...opts +} = {}) => { const errors = [] + mocks['{LIB}/utils/error-message.js'] = { + ...errorMessage, + errorMessage: (err) => ({ + ...errorMessage.errorMessage(err), + ...(files ? { files } : {}), + }), + getError: (...args) => ({ + ...errorMessage.getError(...args), + ...(files ? { files } : {}), + }), + } + + if (error) { + mocks[`{LIB}/commands/root.js`] = class { + async exec () { + throw error + } + } + mocks[`{LIB}/commands/exec.js`] = class extends ExecCommand { + async exec (...args) { + await super.exec(...args) + throw error + } + } + } + const { npm, ...rest } = await loadMockNpm(t, { ...opts, mocks, @@ -72,19 +106,10 @@ const mockExitHandler = async (t, { config, mocks, files, ...opts } = {}) => { }, }) - const exitHandler = tmock(t, '{LIB}/cli/exit-handler.js', { - '{LIB}/utils/error-message.js': (err) => ({ - summary: [['ERR SUMMARY', err.message]], - detail: [['ERR DETAIL', err.message]], - ...(files ? { files } : {}), - json: { - code: err.code, - summary: err.message, - detail: err.message, - }, - }), - ...mocks, - }) + const ExitHandler = tmock(t, '{LIB}/cli/exit-handler.js', mocks) + + const exitHandler = new ExitHandler({ process }) + exitHandler.registerUncaughtHandlers() if (npm) { exitHandler.setNpm(npm) @@ -103,9 +128,15 @@ const mockExitHandler = async (t, { config, mocks, files, ...opts } = {}) => { npm, // Make it async to make testing ergonomics a little easier so we dont need // to t.plan() every test to make sure we get process.exit called. - exitHandler: (...args) => new Promise(res => { + exitHandler: (argErr) => new Promise(res => { process.once('exit', res) - exitHandler(...args) + if (npm) { + npm.exec(command || 'root') + .then(() => exitHandler.exit()) + .catch((err) => exitHandler.exit(err)) + } else { + exitHandler.exit(argErr || error) + } }), } } @@ -126,9 +157,10 @@ const err = (message = '', options = {}, noStack = false) => { t.test('handles unknown error with logs and debug file', async (t) => { const { exitHandler, debugFile, logs } = await mockExitHandler(t, { config: { loglevel: 'silly', timing: true }, + error: err('Unknown error', 'ECODE'), }) - await exitHandler(err('Unknown error', 'ECODE')) + await exitHandler() const fileLogs = await debugFile() const fileLines = fileLogs.split('\n') @@ -148,74 +180,80 @@ t.test('handles unknown error with logs and debug file', async (t) => { t.equal(logs.length, parseInt(lastLog) + 1) t.match(logs.error, [ 'code ECODE', - 'ERR SUMMARY Unknown error', - 'ERR DETAIL Unknown error', + 'Unknown error', + 'A complete log of this run can be found in:', ]) t.match(fileLogs, /\d+ error code ECODE/) - t.match(fileLogs, /\d+ error ERR SUMMARY Unknown error/) - t.match(fileLogs, /\d+ error ERR DETAIL Unknown error/) + t.match(fileLogs, /\d+ error Unknown error/) t.matchSnapshot(logs, 'logs') t.matchSnapshot(fileLines.map(l => l.replace(lineNumber, 'XX ')), 'debug file contents') }) -t.test('exit handler never called - loglevel silent', async (t) => { - const { logs, errors } = await mockExitHandler(t, { - config: { loglevel: 'silent' }, +t.test('exit handler never called', async t => { + t.test('loglevel silent', async (t) => { + const { logs, errors } = await mockExitHandler(t, { + config: { loglevel: 'silent' }, + }) + process.emit('exit', 1) + t.strictSame(logs, []) + t.strictSame(errors(), [''], 'one empty string') }) - process.emit('exit', 1) - t.strictSame(logs.error, []) - t.strictSame(errors(), [''], 'one empty string') -}) -t.test('exit handler never called - loglevel notice', async (t) => { - const { logs, errors } = await mockExitHandler(t) - process.emit('exit', 1) - t.equal(process.exitCode, 1) - t.match(logs.error, [ - 'Exit handler never called!', - /error with npm itself/, - ]) - t.strictSame(errors(), ['', ''], 'two empty string on output') -}) + t.test('loglevel notice', async (t) => { + const { logs, errors } = await mockExitHandler(t) + process.emit('exit', 1) + t.equal(process.exitCode, 1) + t.match(logs.error, [ + 'Exit handler never called!', + /error with npm itself/, + ]) + t.strictSame(errors(), []) + }) -t.test('exit handler never called - no npm', async (t) => { - const { logs, errors } = await mockExitHandler(t, { init: false }) - process.emit('exit', 1) - t.equal(process.exitCode, 1) - t.strictSame(logs.error, []) - t.strictSame(errors(), [''], 'one empty string') + t.test('no npm', async (t) => { + const { logs, errors } = await mockExitHandler(t, { init: false }) + process.emit('exit', 1) + t.equal(process.exitCode, 1) + t.strictSame(logs.error, []) + t.match(errors(), [`Error: Process exited unexpectedly with code: 1`]) + }) }) -t.test('exit handler called - no npm', async (t) => { - const { exitHandler, errors } = await mockExitHandler(t, { init: false }) - await exitHandler() - t.equal(process.exitCode, 1) - t.equal(errors().length, 1) - t.match(errors(), [/Error: Exit prior to setting npm in exit handler/]) -}) +t.test('exit handler called and no npm', async t => { + t.test('no npm', async (t) => { + const { exitHandler, errors } = await mockExitHandler(t, { init: false }) + await exitHandler() + t.equal(process.exitCode, 1) + t.equal(errors().length, 1) + t.match(errors(), [/Exit prior to setting npm in exit handler/]) + }) -t.test('exit handler called - no npm with error', async (t) => { - const { exitHandler, errors } = await mockExitHandler(t, { init: false }) - await exitHandler(err('something happened')) - t.equal(process.exitCode, 1) - t.equal(errors().length, 1) - t.match(errors(), [/Error: something happened/]) -}) + t.test('with error', async (t) => { + const { exitHandler, errors } = await mockExitHandler(t, { init: false }) + await exitHandler(err('something happened')) + t.equal(process.exitCode, 1) + t.equal(errors().length, 1) + t.match(errors(), [/Exit prior to setting npm in exit handler/]) + t.match(errors(), [/something happened/]) + }) -t.test('exit handler called - no npm with error without stack', async (t) => { - const { exitHandler, errors } = await mockExitHandler(t, { init: false }) - await exitHandler(err('something happened', {}, true)) - t.equal(process.exitCode, 1) - t.equal(errors().length, 1) - t.match(errors(), [/something happened/]) + t.test('with error without stack', async (t) => { + const { exitHandler, errors } = await mockExitHandler(t, { init: false }) + await exitHandler(err('something happened', {}, true)) + t.equal(process.exitCode, 1) + t.equal(errors().length, 1) + t.match(errors(), [/Exit prior to setting npm in exit handler/]) + t.match(errors(), [/something happened/]) + }) }) t.test('standard output using --json', async (t) => { const { exitHandler, outputs } = await mockExitHandler(t, { config: { json: true }, + error: err('Error: EBADTHING Something happened'), }) - await exitHandler(err('Error: EBADTHING Something happened')) + await exitHandler() t.equal(process.exitCode, 1) t.same( @@ -224,7 +262,7 @@ t.test('standard output using --json', async (t) => { error: { code: 'EBADTHING', // should default error code to E[A-Z]+ summary: 'Error: EBADTHING Something happened', - detail: 'Error: EBADTHING Something happened', + detail: '', }, }, 'should output expected json output' @@ -234,13 +272,14 @@ t.test('standard output using --json', async (t) => { t.test('merges output buffers errors with --json', async (t) => { const { exitHandler, outputs } = await mockExitHandler(t, { config: { json: true }, + error: err('Error: EBADTHING Something happened'), }) output.buffer({ output_data: 1 }) - output.buffer(JSON.stringify({ more_data: 2 })) + output.buffer({ more_data: 2 }) output.buffer('not json, will be ignored') - await exitHandler(err('Error: EBADTHING Something happened')) + await exitHandler() t.equal(process.exitCode, 1) t.same( @@ -251,7 +290,7 @@ t.test('merges output buffers errors with --json', async (t) => { error: { code: 'EBADTHING', // should default error code to E[A-Z]+ summary: 'Error: EBADTHING Something happened', - detail: 'Error: EBADTHING Something happened', + detail: '', }, }, 'should output expected json output' @@ -259,12 +298,14 @@ t.test('merges output buffers errors with --json', async (t) => { }) t.test('output buffer without json', async (t) => { - const { exitHandler, outputs, logs } = await mockExitHandler(t) + const { exitHandler, outputs, logs } = await mockExitHandler(t, { + error: err('Error: EBADTHING Something happened'), + }) output.buffer('output_data') output.buffer('more_data') - await exitHandler(err('Error: EBADTHING Something happened')) + await exitHandler() t.equal(process.exitCode, 1) t.same( @@ -276,13 +317,15 @@ t.test('output buffer without json', async (t) => { }) t.test('throw a non-error obj', async (t) => { - const { exitHandler, logs } = await mockExitHandler(t) - - await exitHandler({ - code: 'ESOMETHING', - message: 'foo bar', + const { exitHandler, logs } = await mockExitHandler(t, { + error: { + code: 'ESOMETHING', + message: 'foo bar', + }, }) + await exitHandler() + t.equal(process.exitCode, 1) t.match(logs.error, [ "weird error { code: 'ESOMETHING', message: 'foo bar' }", @@ -290,9 +333,11 @@ t.test('throw a non-error obj', async (t) => { }) t.test('throw a string error', async (t) => { - const { exitHandler, logs } = await mockExitHandler(t) + const { exitHandler, logs } = await mockExitHandler(t, { + error: 'foo bar', + }) - await exitHandler('foo bar') + await exitHandler() t.equal(process.exitCode, 1) t.match(logs.error, [ @@ -308,9 +353,7 @@ t.test('update notification - shows even with loglevel error', async (t) => { await exitHandler() - t.match(logs.notice, [ - 'you should update npm!', - ]) + t.match(logs.notice, ['you should update npm!']) }) t.test('update notification - hidden with silent', async (t) => { @@ -333,25 +376,32 @@ t.test('npm.config not ready', async (t) => { t.equal(process.exitCode, 1) t.equal(errors().length, 1) + t.match(errors(), [ - /Error: Exit prior to config file resolving./, + /Exit prior to config file resolving/, ], 'should exit with config error msg') + t.match(errors(), [ + /call config.load\(\) before reading values/, + ], 'should exit with cause error msg') t.strictSame(logs, [], 'no logs if it doesnt load') }) t.test('no logs dir', async (t) => { const { exitHandler, logs } = await mockExitHandler(t, { config: { 'logs-max': 0 }, + error: new Error('an error'), }) - await exitHandler(new Error()) - - t.match(logs.error[2], - 'Log files were not written due to the config logs-max=0') + await exitHandler() + t.match(logs.error, [ + 'an error', + 'Log files were not written due to the config logs-max=0', + ]) t.match(logs.filter((l) => l.includes('npm.load.mkdirplogs')), []) }) t.test('timers fail to write', async (t) => { const { exitHandler, logs } = await mockExitHandler(t, { + error: new Error('an error'), config: (dirs) => ({ 'logs-dir': resolve(dirs.prefix, 'LOGS_DIR'), timing: true, @@ -373,13 +423,14 @@ t.test('timers fail to write', async (t) => { }, }) - await exitHandler(new Error()) + await exitHandler() t.match(logs.warn[0], `timing could not write timing file: Error: err`) }) t.test('log files fail to write', async (t) => { const { exitHandler, logs } = await mockExitHandler(t, { + error: new Error('an error'), config: (dirs) => ({ 'logs-dir': resolve(dirs.prefix, 'LOGS_DIR'), }), @@ -398,31 +449,32 @@ t.test('log files fail to write', async (t) => { }, }) - await exitHandler(new Error()) + await exitHandler() - t.match(logs.error[2], `error writing to the directory`) + t.match(logs.error, ['an error', `error writing to the directory`]) }) t.test('files from error message', async (t) => { const { exitHandler, logs, cache } = await mockExitHandler(t, { + error: err('Error message'), files: [ ['error-file.txt', '# error file content'], ], }) - await exitHandler(err('Error message')) + await exitHandler() const logFiles = fs.readdirSync(join(cache, '_logs')) const errorFileName = logFiles.find(f => f.endsWith('error-file.txt')) const errorFile = fs.readFileSync(join(cache, '_logs', errorFileName)).toString() - - t.match(logs[2], /For a full report see:\n.*-error-file\.txt/) + t.match(logs, ['Error message', /For a full report see:\n.*-error-file\.txt/]) t.match(errorFile, '# error file content') t.match(errorFile, 'Log files:') }) t.test('files from error message with error', async (t) => { const { exitHandler, logs } = await mockExitHandler(t, { + error: err('Error message'), config: (dirs) => ({ 'logs-dir': resolve(dirs.prefix, 'LOGS_DIR'), }), @@ -441,7 +493,7 @@ t.test('files from error message with error', async (t) => { }, }) - await exitHandler(err('Error message')) + await exitHandler() t.match(logs.warn[0], /Could not write error message to.*error-file\.txt.*err/) }) @@ -513,47 +565,54 @@ t.test('unfinished timers', async (t) => { }) t.test('uses code from errno', async (t) => { - const { exitHandler, logs } = await mockExitHandler(t) + const { exitHandler, logs } = await mockExitHandler(t, { + error: err('Error with errno', { errno: 127 }), + }) - await exitHandler(err('Error with errno', { errno: 127 })) + await exitHandler() t.equal(process.exitCode, 127) t.match(logs.error, ['errno 127']) }) t.test('uses code from number', async (t) => { - const { exitHandler, logs } = await mockExitHandler(t) + const { exitHandler, logs } = await mockExitHandler(t, { + error: err('Error with code type number', 404), + }) - await exitHandler(err('Error with code type number', 404)) + await exitHandler() t.equal(process.exitCode, 404) t.match(logs.error, ['code 404']) }) t.test('uses all err special properties', async t => { - const { exitHandler, logs } = await mockExitHandler(t) - const keys = ['code', 'syscall', 'file', 'path', 'dest', 'errno'] const properties = keys.reduce((acc, k) => { acc[k] = `${k}-hey` return acc }, {}) - await exitHandler(err('Error with code type number', properties)) + const { exitHandler, logs } = await mockExitHandler(t, { + error: err('Error with code type number', properties), + }) + + await exitHandler() t.equal(process.exitCode, 1) t.match(logs.error, keys.map((k) => `${k} ${k}-hey`), 'all special keys get logged') }) t.test('verbose logs replace info on err props', async t => { - const { exitHandler, logs } = await mockExitHandler(t, { - config: { loglevel: 'verbose' }, - }) - const keys = ['type', 'stack', 'pkgid'] const properties = keys.reduce((acc, k) => { acc[k] = `${k}-https://user:pass@registry.npmjs.org/` return acc }, {}) - await exitHandler(err('Error with code type number', properties)) + const { exitHandler, logs } = await mockExitHandler(t, { + error: err('Error with code type number', properties), + config: { loglevel: 'verbose' }, + }) + + await exitHandler() t.equal(process.exitCode, 1) t.match( logs.verbose.filter(l => !/^(logfile|title|argv)/.test(l)), @@ -571,12 +630,14 @@ t.test('call exitHandler with no error', async (t) => { t.match(logs.error, []) }) -t.test('defaults to log error msg if stack is missing when unloaded', async (t) => { - const { exitHandler, logs, errors } = await mockExitHandler(t, { load: false }) +t.test('defaults to log error msg if stack is missing when no npm', async (t) => { + const { exitHandler, logs, errors } = await mockExitHandler(t, { + init: false, + }) await exitHandler(err('Error with no stack', { code: 'ENOSTACK', errno: 127 }, true)) t.equal(process.exitCode, 127) - t.strictSame(errors(), ['Error with no stack'], 'should use error msg') + t.match(errors(), ['Error with no stack'], 'should use error msg') t.strictSame(logs.error, []) }) @@ -590,18 +651,22 @@ t.test('exits uncleanly when only emitting exit event', async (t) => { }) t.test('do no fancy handling for shellouts', async t => { - const mockShelloutExit = (t) => mockExitHandler(t, { + const mockShelloutExit = (t, opts) => mockExitHandler(t, { command: 'exec', - exec: true, argv: ['-c', 'exit'], config: { timing: false, + progress: false, + ...opts.config, }, + ...opts, }) t.test('shellout with a numeric error code', async t => { - const { exitHandler, logs, errors } = await mockShelloutExit(t) - await exitHandler(err('', 5)) + const { exitHandler, logs, errors } = await mockShelloutExit(t, { + error: err('', 5), + }) + await exitHandler() t.equal(process.exitCode, 5, 'got expected exit code') t.strictSame(logs.error, [], 'no noisy warnings') t.strictSame(logs.warn, [], 'no noisy warnings') @@ -609,19 +674,37 @@ t.test('do no fancy handling for shellouts', async t => { }) t.test('shellout without a numeric error code (something in npm)', async t => { - const { exitHandler, logs, errors } = await mockShelloutExit(t) - await exitHandler(err('', 'banana stand')) + const { exitHandler, logs, errors } = await mockShelloutExit(t, { + error: err('', 'banana stand'), + }) + await exitHandler() t.equal(process.exitCode, 1, 'got expected exit code') // should log some warnings and errors, because something weird happened t.strictNotSame(logs.error, [], 'bring the noise') - t.strictSame(errors(), ['']) + t.strictSame(errors(), []) }) t.test('shellout with code=0 (extra weird?)', async t => { - const { exitHandler, logs, errors } = await mockShelloutExit(t) - await exitHandler(Object.assign(new Error(), { code: 0 })) + const { exitHandler, logs, errors } = await mockShelloutExit(t, { + error: Object.assign(new Error(), { code: 0 }), + }) + await exitHandler() t.equal(process.exitCode, 1, 'got expected exit code') t.strictNotSame(logs.error, [], 'bring the noise') - t.strictSame(errors(), ['']) + t.strictSame(errors(), []) + }) + + t.test('shellout with json', async t => { + const { exitHandler, logs, outputs } = await mockShelloutExit(t, { + error: err('', 5), + config: { json: true }, + }) + await exitHandler() + t.equal(process.exitCode, 5, 'got expected exit code') + t.strictSame(logs.error, [], 'no noisy warnings') + t.strictSame(logs.warn, [], 'no noisy warnings') + t.match(JSON.parse(outputs), { + error: { code: 5, summary: '', detail: '' }, + }) }) }) diff --git a/deps/npm/test/lib/commands/adduser.js b/deps/npm/test/lib/commands/adduser.js index 410e8c4987ca64..3063cdbeeab5ea 100644 --- a/deps/npm/test/lib/commands/adduser.js +++ b/deps/npm/test/lib/commands/adduser.js @@ -9,9 +9,8 @@ const MockRegistry = require('@npmcli/mock-registry') const stream = require('stream') const mockAddUser = async (t, { stdin: stdinLines, registry: registryUrl, ...options } = {}) => { - let stdin if (stdinLines) { - stdin = new stream.PassThrough() + const stdin = new stream.PassThrough() for (const l of stdinLines) { stdin.write(l + '\n') } @@ -30,7 +29,6 @@ const mockAddUser = async (t, { stdin: stdinLines, registry: registryUrl, ...opt }) return { registry, - stdin, rc: () => ini.parse(fs.readFileSync(path.join(mock.home, '.npmrc'), 'utf8')), ...mock, } diff --git a/deps/npm/test/lib/commands/audit.js b/deps/npm/test/lib/commands/audit.js index 701d374ade9850..d8714cb61912a8 100644 --- a/deps/npm/test/lib/commands/audit.js +++ b/deps/npm/test/lib/commands/audit.js @@ -184,6 +184,7 @@ t.test('audit fix - bulk endpoint', async t => { tarballs: { '1.0.1': path.join(npm.prefix, 'test-dep-a-fixed'), }, + times: 2, }) const advisory = registry.advisory({ id: 100, vulnerable_versions: '1.0.0' }) registry.nock.post('/-/npm/v1/security/advisories/bulk', body => { diff --git a/deps/npm/test/lib/commands/bugs.js b/deps/npm/test/lib/commands/bugs.js index e2ebfb53065748..c624ba3f2d91da 100644 --- a/deps/npm/test/lib/commands/bugs.js +++ b/deps/npm/test/lib/commands/bugs.js @@ -63,7 +63,7 @@ t.test('open bugs urls & emails', async t => { const { npm } = await loadMockNpm(t, { mocks: { pacote, - '{LIB}/utils/open-url.js': openUrl, + '{LIB}/utils/open-url.js': { openUrl }, }, }) diff --git a/deps/npm/test/lib/commands/config.js b/deps/npm/test/lib/commands/config.js index 0806326e2e8e42..1a3644a07623b5 100644 --- a/deps/npm/test/lib/commands/config.js +++ b/deps/npm/test/lib/commands/config.js @@ -37,7 +37,7 @@ const loadMockNpm = (t, opts = {}) => _loadMockNpm(t, { // Reset configs that mock npm sets by default 'fetch-retries': undefined, loglevel: undefined, - color: undefined, + color: false, }, }) @@ -80,7 +80,13 @@ t.test('config list', async t => { }, }, homeDir: { - '.npmrc': 'userloaded=yes', + '.npmrc': [ + 'userloaded=yes', + 'auth=bad', + '_auth=bad', + '//nerfdart:auth=bad', + '//nerfdart:_auth=bad', + ].join('\n'), }, }) @@ -486,6 +492,12 @@ t.test('config get private key', async t => { 'rejects with protected string' ) + await t.rejects( + npm.exec('config', ['get', 'authToken']), + /authToken option is protected/, + 'rejects with protected string' + ) + await t.rejects( npm.exec('config', ['get', '//localhost:8080/:_password']), /_password option is protected/, @@ -493,6 +505,25 @@ t.test('config get private key', async t => { ) }) +t.test('config redacted values', async t => { + const { npm, joinedOutput, clearOutput } = await loadMockNpm(t) + + await npm.exec('config', ['set', 'proxy', 'https://proxy.npmjs.org/']) + await npm.exec('config', ['get', 'proxy']) + + t.equal(joinedOutput(), 'https://proxy.npmjs.org/') + clearOutput() + + await npm.exec('config', ['set', 'proxy', 'https://u:password@proxy.npmjs.org/']) + + await t.rejects(npm.exec('config', ['get', 'proxy']), /proxy option is protected/) + + await npm.exec('config', ['ls']) + + t.match(joinedOutput(), 'proxy = "https://u:***@proxy.npmjs.org/"') + clearOutput() +}) + t.test('config edit', async t => { const EDITOR = 'vim' const editor = spawk.spawn(EDITOR).exit(0) diff --git a/deps/npm/test/lib/commands/deprecate.js b/deps/npm/test/lib/commands/deprecate.js index 4ae146fd3aee0d..09aaeacfe8563f 100644 --- a/deps/npm/test/lib/commands/deprecate.js +++ b/deps/npm/test/lib/commands/deprecate.js @@ -155,7 +155,7 @@ t.test('deprecates all versions when no range is specified', async t => { }) t.test('does nothing if version does not actually exist', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { config: { ...auth } }) + const { npm, logs, joinedOutput } = await loadMockNpm(t, { config: { ...auth } }) const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry'), @@ -168,4 +168,5 @@ t.test('does nothing if version does not actually exist', async t => { await registry.package({ manifest, query: { write: true } }) await npm.exec('deprecate', ['foo@1.0.99', 'this should be ignored']) t.match(joinedOutput(), '') + t.equal(logs.warn[0], 'deprecate No version found for 1.0.99') }) diff --git a/deps/npm/test/lib/commands/docs.js b/deps/npm/test/lib/commands/docs.js index e11df6b07bc5e6..2a7951edeaf764 100644 --- a/deps/npm/test/lib/commands/docs.js +++ b/deps/npm/test/lib/commands/docs.js @@ -84,7 +84,7 @@ const setup = async (t, { prefixDir = fixtures.pkg, config } = {}) => { const res = await mockNpm(t, { prefixDir, mocks: { - '{LIB}/utils/open-url.js': openUrl, + '{LIB}/utils/open-url.js': { openUrl }, }, config, }) diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js index bf4ea46a918a17..7dd53e10457d0f 100644 --- a/deps/npm/test/lib/commands/doctor.js +++ b/deps/npm/test/lib/commands/doctor.js @@ -11,7 +11,7 @@ const cleanCacheSha = (str) => str.replace(/content-v2\/sha512\/[^"]+/g, 'content-v2/sha512/{sha}') t.cleanSnapshot = p => cleanCacheSha(cleanDate(cleanCwd(p))) - .replace(/(doctor\s+at\s).*$/gm, '$1{STACK}') + .replace(/^\s+(doctor\s+at\s).*$\n/gm, '') const npmManifest = (version) => { return { diff --git a/deps/npm/test/lib/commands/pack.js b/deps/npm/test/lib/commands/pack.js index 3ea67c78d996a3..fd525114cde9fb 100644 --- a/deps/npm/test/lib/commands/pack.js +++ b/deps/npm/test/lib/commands/pack.js @@ -82,7 +82,10 @@ t.test('should log scoped package output as valid json', async t => { }, }), }, - config: { json: true }, + config: { + json: true, + progress: false, + }, }) await npm.exec('pack', []) const filename = 'myscope-test-package-1.0.0.tgz' diff --git a/deps/npm/test/lib/commands/pkg.js b/deps/npm/test/lib/commands/pkg.js index 168870f59d9d1e..2941faf90c5841 100644 --- a/deps/npm/test/lib/commands/pkg.js +++ b/deps/npm/test/lib/commands/pkg.js @@ -7,7 +7,10 @@ const { cleanCwd } = require('../../fixtures/clean-snapshot') t.cleanSnapshot = (str) => cleanCwd(str) const mockNpm = async (t, { ...opts } = {}) => { - const res = await _mockNpm(t, opts) + const res = await _mockNpm(t, { + ...opts, + command: 'pkg', + }) const readPackageJson = (dir = '') => JSON.parse(readFileSync(resolve(res.prefix, dir, 'package.json'), 'utf8')) @@ -575,7 +578,7 @@ t.test('delete nested field', async t => { }) t.test('workspaces', async t => { - const { pkg, OUTPUT, readPackageJson } = await mockNpm(t, { + const mockWorkspaces = (t) => mockNpm(t, { prefixDir: { 'package.json': JSON.stringify({ name: 'root', @@ -602,68 +605,74 @@ t.test('workspaces', async t => { config: { workspaces: true }, }) - await pkg('get', 'name', 'version') + t.test('get', async t => { + const { pkg, OUTPUT } = await mockWorkspaces(t) + await pkg('get', 'name', 'version') + t.strictSame( + JSON.parse(OUTPUT()), + { + a: { + name: 'a', + version: '1.0.0', + }, + b: { + name: 'b', + version: '1.2.3', + }, + }, + 'should return expected result for configured workspaces' + ) + }) - t.strictSame( - JSON.parse(OUTPUT()), - { - a: { + t.test('set', async t => { + const { pkg, readPackageJson } = await mockWorkspaces(t) + + await pkg('set', 'funding=http://example.com') + + t.strictSame( + readPackageJson('packages/a'), + { name: 'a', version: '1.0.0', + funding: 'http://example.com', }, - b: { + 'should add field to workspace a' + ) + + t.strictSame( + readPackageJson('packages/b'), + { name: 'b', version: '1.2.3', + funding: 'http://example.com', }, - }, - 'should return expected result for configured workspaces' - ) + 'should add field to workspace b' + ) - await pkg('set', 'funding=http://example.com') + await pkg('delete', 'version') - t.strictSame( - readPackageJson('packages/a'), - { - name: 'a', - version: '1.0.0', - funding: 'http://example.com', - }, - 'should add field to workspace a' - ) - - t.strictSame( - readPackageJson('packages/b'), - { - name: 'b', - version: '1.2.3', - funding: 'http://example.com', - }, - 'should add field to workspace b' - ) - - await pkg('delete', 'version') - - t.strictSame( - readPackageJson('packages/a'), - { - name: 'a', - funding: 'http://example.com', - }, - 'should delete version field from workspace a' - ) + t.strictSame( + readPackageJson('packages/a'), + { + name: 'a', + funding: 'http://example.com', + }, + 'should delete version field from workspace a' + ) - t.strictSame( - readPackageJson('packages/b'), - { - name: 'b', - funding: 'http://example.com', - }, - 'should delete version field from workspace b' - ) + t.strictSame( + readPackageJson('packages/b'), + { + name: 'b', + funding: 'http://example.com', + }, + 'should delete version field from workspace b' + ) + }) }) t.test('single workspace', async t => { - const { pkg, OUTPUT } = await mockNpm(t, { + const mockWorkspace = (t) => mockNpm(t, { prefixDir: { 'package.json': JSON.stringify({ name: 'root', @@ -690,13 +699,27 @@ t.test('single workspace', async t => { config: { workspace: ['packages/a'] }, }) - await pkg('get', 'name', 'version') + t.test('multiple args', async t => { + const { pkg, OUTPUT } = await mockWorkspace(t) + await pkg('get', 'name', 'version') - t.strictSame( - JSON.parse(OUTPUT()), - { a: { name: 'a', version: '1.0.0' } }, - 'should only return info for one workspace' - ) + t.strictSame( + JSON.parse(OUTPUT()), + { a: { name: 'a', version: '1.0.0' } }, + 'should only return info for one workspace' + ) + }) + + t.test('single arg', async t => { + const { pkg, OUTPUT } = await mockWorkspace(t) + await pkg('get', 'version') + + t.strictSame( + JSON.parse(OUTPUT()), + { a: '1.0.0' }, + 'should only return info for one workspace' + ) + }) }) t.test('fix', async t => { diff --git a/deps/npm/test/lib/commands/publish.js b/deps/npm/test/lib/commands/publish.js index 85a66d88b8b340..9e7ba6b0705838 100644 --- a/deps/npm/test/lib/commands/publish.js +++ b/deps/npm/test/lib/commands/publish.js @@ -291,7 +291,7 @@ t.test('shows usage with wrong set of arguments', async t => { await t.rejects(publish.exec(['a', 'b', 'c']), publish.usage) }) -t.test('throws when invalid tag', async t => { +t.test('throws when invalid tag is semver', async t => { const { npm } = await loadMockNpm(t, { config: { tag: '0.0.13', @@ -306,6 +306,24 @@ t.test('throws when invalid tag', async t => { ) }) +t.test('throws when invalid tag when not url encodable', async t => { + const { npm } = await loadMockNpm(t, { + config: { + tag: '@test', + }, + prefixDir: { + 'package.json': JSON.stringify(pkgJson, null, 2), + }, + }) + await t.rejects( + npm.exec('publish', []), + { + /* eslint-disable-next-line max-len */ + message: 'Invalid tag name "@test" of package "test-package@@test": Tags may not have any characters that encodeURIComponent encodes.', + } + ) +}) + t.test('tarball', async t => { const { npm, joinedOutput, logs, home } = await loadMockNpm(t, { config: { diff --git a/deps/npm/test/lib/commands/repo.js b/deps/npm/test/lib/commands/repo.js index 114cdf919510af..f6e3ed753d0393 100644 --- a/deps/npm/test/lib/commands/repo.js +++ b/deps/npm/test/lib/commands/repo.js @@ -187,9 +187,11 @@ const loadMockNpm = async (t, prefixDir, config = {}) => { const mock = await mockNpm(t, { command: 'repo', mocks: { - '{LIB}/utils/open-url.js': async (_, url) => { - opened[url] = opened[url] || 0 - opened[url]++ + '{LIB}/utils/open-url.js': { + openUrl: async (_, url) => { + opened[url] = opened[url] || 0 + opened[url]++ + }, }, }, config, diff --git a/deps/npm/test/lib/commands/run-script.js b/deps/npm/test/lib/commands/run-script.js index c5bb2b488c053d..5009f132057478 100644 --- a/deps/npm/test/lib/commands/run-script.js +++ b/deps/npm/test/lib/commands/run-script.js @@ -30,7 +30,7 @@ const mockRs = async (t, { windows = false, runScript, ...opts } = {}) => { ...mock, RUN_SCRIPTS: () => RUN_SCRIPTS, runScript: mock['run-script'], - cleanLogs: () => mock.logs.error.map(cleanCwd), + cleanLogs: () => mock.logs.error.map(cleanCwd).join('\n'), } } @@ -418,50 +418,31 @@ t.test('list scripts', async t => { await mock.runScript.exec([]) - return mock.outputs + return mock.joinedOutput() } t.test('no args', async t => { const output = await mockList(t) - t.strictSame( - output, - [ - 'Lifecycle scripts included in x@1.2.3:', - ' test\n exit 2', - ' start\n node server.js', - ' stop\n node kill-server.js', - '\navailable via `npm run-script`:', - ' preenv\n echo before the env', - ' postenv\n echo after the env', - '', - ], - 'basic report' - ) + t.matchSnapshot(output, 'basic report') }) t.test('silent', async t => { - const outputs = await mockList(t, { silent: true }) - t.strictSame(outputs, []) + const output = await mockList(t, { silent: true }) + t.strictSame(output, '') }) t.test('warn json', async t => { - const outputs = await mockList(t, { json: true }) - t.strictSame(outputs, [JSON.stringify(scripts, 0, 2)], 'json report') + const output = await mockList(t, { json: true }) + t.matchSnapshot(output, 'json report') }) t.test('parseable', async t => { - const outputs = await mockList(t, { parseable: true }) - t.strictSame(outputs, [ - 'test:exit 2', - 'start:node server.js', - 'stop:node kill-server.js', - 'preenv:echo before the env', - 'postenv:echo after the env', - ]) + const output = await mockList(t, { parseable: true }) + t.matchSnapshot(output) }) }) t.test('list scripts when no scripts', async t => { - const { runScript, outputs } = await mockRs(t, { + const { runScript, joinedOutput } = await mockRs(t, { prefixDir: { 'package.json': JSON.stringify({ name: 'x', @@ -471,11 +452,11 @@ t.test('list scripts when no scripts', async t => { }) await runScript.exec([]) - t.strictSame(outputs, [], 'nothing to report') + t.strictSame(joinedOutput(), '', 'nothing to report') }) t.test('list scripts, only commands', async t => { - const { runScript, outputs } = await mockRs(t, { + const { runScript, joinedOutput } = await mockRs(t, { prefixDir: { 'package.json': JSON.stringify({ name: 'x', @@ -486,15 +467,11 @@ t.test('list scripts, only commands', async t => { }) await runScript.exec([]) - t.strictSame(outputs, [ - 'Lifecycle scripts included in x@1.2.3:', - ' preversion\n echo doing the version dance', - '', - ]) + t.matchSnapshot(joinedOutput()) }) t.test('list scripts, only non-commands', async t => { - const { runScript, outputs } = await mockRs(t, { + const { runScript, joinedOutput } = await mockRs(t, { prefixDir: { 'package.json': JSON.stringify({ name: 'x', @@ -505,11 +482,7 @@ t.test('list scripts, only non-commands', async t => { }) await runScript.exec([]) - t.strictSame(outputs, [ - 'Scripts available in x@1.2.3 via `npm run-script`:', - ' glorp\n echo doing the glerp glop', - '', - ]) + t.matchSnapshot(joinedOutput()) }) t.test('workspaces', async t => { @@ -590,154 +563,43 @@ t.test('workspaces', async t => { } t.test('list all scripts', async t => { - const { outputs } = await mockWorkspaces(t) - t.strictSame(outputs, [ - 'Scripts available in a@1.0.0 via `npm run-script`:', - ' glorp\n echo a doing the glerp glop', - '', - 'Scripts available in b@2.0.0 via `npm run-script`:', - ' glorp\n echo b doing the glerp glop', - '', - 'Lifecycle scripts included in c@1.0.0:', - ' test\n exit 0', - ' posttest\n echo posttest', - '\navailable via `npm run-script`:', - ' lorem\n echo c lorem', - '', - 'Lifecycle scripts included in d@1.0.0:', - ' test\n exit 0', - ' posttest\n echo posttest', - '', - 'Lifecycle scripts included in e:', - ' test\n exit 0', - ' start\n echo start something', - '', - ]) + const { joinedOutput } = await mockWorkspaces(t) + t.matchSnapshot(joinedOutput()) }) t.test('list regular scripts, filtered by name', async t => { - const { outputs } = await mockWorkspaces(t, { workspaces: ['a', 'b'] }) - t.strictSame(outputs, [ - 'Scripts available in a@1.0.0 via `npm run-script`:', - ' glorp\n echo a doing the glerp glop', - '', - 'Scripts available in b@2.0.0 via `npm run-script`:', - ' glorp\n echo b doing the glerp glop', - '', - ]) + const { joinedOutput } = await mockWorkspaces(t, { workspaces: ['a', 'b'] }) + t.matchSnapshot(joinedOutput()) }) t.test('list regular scripts, filtered by path', async t => { - const { outputs } = await mockWorkspaces(t, { workspaces: ['./packages/a'] }) - t.strictSame(outputs, [ - 'Scripts available in a@1.0.0 via `npm run-script`:', - ' glorp\n echo a doing the glerp glop', - '', - ]) + const { joinedOutput } = await mockWorkspaces(t, { workspaces: ['./packages/a'] }) + t.matchSnapshot(joinedOutput()) }) t.test('list regular scripts, filtered by parent folder', async t => { - const { outputs } = await mockWorkspaces(t, { workspaces: ['./packages'] }) - t.strictSame(outputs, [ - 'Scripts available in a@1.0.0 via `npm run-script`:', - ' glorp\n echo a doing the glerp glop', - '', - 'Scripts available in b@2.0.0 via `npm run-script`:', - ' glorp\n echo b doing the glerp glop', - '', - 'Lifecycle scripts included in c@1.0.0:', - ' test\n exit 0', - ' posttest\n echo posttest', - '\navailable via `npm run-script`:', - ' lorem\n echo c lorem', - '', - 'Lifecycle scripts included in d@1.0.0:', - ' test\n exit 0', - ' posttest\n echo posttest', - '', - 'Lifecycle scripts included in e:', - ' test\n exit 0', - ' start\n echo start something', - '', - ]) + const { joinedOutput } = await mockWorkspaces(t, { workspaces: ['./packages'] }) + t.matchSnapshot(joinedOutput()) }) t.test('list all scripts with colors', async t => { - const { outputs } = await mockWorkspaces(t, { color: 'always' }) - t.strictSame(outputs, [ - /* eslint-disable-next-line max-len */ - '\u001b[1mScripts\u001b[22m available in \x1B[32ma@1.0.0\x1B[39m via `\x1B[34mnpm run-script\x1B[39m`:', - ' glorp\n \x1B[2mecho a doing the glerp glop\x1B[22m', - '', - /* eslint-disable-next-line max-len */ - '\u001b[1mScripts\u001b[22m available in \x1B[32mb@2.0.0\x1B[39m via `\x1B[34mnpm run-script\x1B[39m`:', - ' glorp\n \x1B[2mecho b doing the glerp glop\x1B[22m', - '', - '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32mc@1.0.0\x1B[39m:', - ' test\n \x1B[2mexit 0\x1B[22m', - ' posttest\n \x1B[2mecho posttest\x1B[22m', - '\navailable via `\x1B[34mnpm run-script\x1B[39m`:', - ' lorem\n \x1B[2mecho c lorem\x1B[22m', - '', - '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32md@1.0.0\x1B[39m:', - ' test\n \x1B[2mexit 0\x1B[22m', - ' posttest\n \x1B[2mecho posttest\x1B[22m', - '', - '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32me\x1B[39m:', - ' test\n \x1B[2mexit 0\x1B[22m', - ' start\n \x1B[2mecho start something\x1B[22m', - '', - ]) + const { joinedOutput } = await mockWorkspaces(t, { color: 'always' }) + t.matchSnapshot(joinedOutput()) }) t.test('list all scripts --json', async t => { - const { outputs } = await mockWorkspaces(t, { json: true }) - t.strictSame(outputs, [ - - '{\n' + - ' "a": {\n' + - ' "glorp": "echo a doing the glerp glop"\n' + - ' },\n' + - ' "b": {\n' + - ' "glorp": "echo b doing the glerp glop"\n' + - ' },\n' + - ' "c": {\n' + - ' "test": "exit 0",\n' + - ' "posttest": "echo posttest",\n' + - ' "lorem": "echo c lorem"\n' + - ' },\n' + - ' "d": {\n' + - ' "test": "exit 0",\n' + - ' "posttest": "echo posttest"\n' + - ' },\n' + - ' "e": {\n' + - ' "test": "exit 0",\n' + - ' "start": "echo start something"\n' + - ' },\n' + - ' "noscripts": {}\n' + - '}', - - ]) + const { joinedOutput } = await mockWorkspaces(t, { json: true }) + t.matchSnapshot(joinedOutput()) }) t.test('list all scripts --parseable', async t => { - const { outputs } = await mockWorkspaces(t, { parseable: true }) - t.strictSame(outputs, [ - 'a:glorp:echo a doing the glerp glop', - 'b:glorp:echo b doing the glerp glop', - 'c:test:exit 0', - 'c:posttest:echo posttest', - 'c:lorem:echo c lorem', - 'd:test:exit 0', - 'd:posttest:echo posttest', - 'e:test:exit 0', - 'e:start:echo start something', - ]) + const { joinedOutput } = await mockWorkspaces(t, { parseable: true }) + t.matchSnapshot(joinedOutput()) }) t.test('list no scripts --loglevel=silent', async t => { - const { outputs } = await mockWorkspaces(t, { silent: true }) - t.strictSame(outputs, []) + const { joinedOutput } = await mockWorkspaces(t, { silent: true }) + t.strictSame(joinedOutput(), '') }) t.test('run scripts across all workspaces', async t => { @@ -777,34 +639,8 @@ t.test('workspaces', async t => { await runScript.exec(['missing-script']) t.match(RUN_SCRIPTS(), []) - t.strictSame( + t.matchSnapshot( cleanLogs(), - [ - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: a@1.0.0', - ' at location: {CWD}/prefix/packages/a', - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: b@2.0.0', - ' at location: {CWD}/prefix/packages/b', - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: c@1.0.0', - ' at location: {CWD}/prefix/packages/c', - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: d@1.0.0', - ' at location: {CWD}/prefix/packages/d', - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: e', - ' at location: {CWD}/prefix/packages/e', - 'Lifecycle script `missing-script` failed with error:', - 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: noscripts@1.0.0', - ' at location: {CWD}/prefix/packages/noscripts', - ], 'should log error msgs for each workspace script' ) }) @@ -816,18 +652,8 @@ t.test('workspaces', async t => { }) t.match(RUN_SCRIPTS(), []) - t.strictSame( + t.matchSnapshot( cleanLogs(), - [ - 'Lifecycle script `test` failed with error:', - 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: a@1.0.0', - ' at location: {CWD}/prefix/packages/a', - 'Lifecycle script `test` failed with error:', - 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run', - ' in workspace: b@2.0.0', - ' at location: {CWD}/prefix/packages/b', - ], 'should log error msgs for each workspace script' ) }) @@ -864,14 +690,8 @@ t.test('workspaces', async t => { workspaces: ['c'], }) - t.strictSame( + t.matchSnapshot( cleanLogs(), - [ - 'Lifecycle script `test` failed with error:', - 'Error: err', - ' in workspace: c@1.0.0', - ' at location: {CWD}/prefix/packages/c', - ], 'should log error msgs for each workspace script' ) }) @@ -887,14 +707,8 @@ t.test('workspaces', async t => { workspaces: ['a', 'b'], }) - t.strictSame( + t.matchSnapshot( cleanLogs(), - [ - 'Lifecycle script `glorp` failed with error:', - 'Error: ERR', - ' in workspace: a@1.0.0', - ' at location: {CWD}/prefix/packages/a', - ], 'should log error msgs for each workspace script' ) diff --git a/deps/npm/test/lib/commands/view.js b/deps/npm/test/lib/commands/view.js index c50668791bbe59..d15d62f8acdcba 100644 --- a/deps/npm/test/lib/commands/view.js +++ b/deps/npm/test/lib/commands/view.js @@ -252,6 +252,24 @@ const packument = (nv, opts) => { }, }, }, + 'single-version': { + _id: 'single-version', + name: 'single-version', + 'dist-tags': { + latest: '1.0.0', + }, + versions: { + '1.0.0': { + name: 'single-version', + version: '1.0.0', + dist: { + shasum: '123', + tarball: 'http://hm.single-version.com/1.0.0.tgz', + fileCount: 1, + }, + }, + }, + }, } if (nv.type === 'git') { return mocks[nv.hosted.project] @@ -357,6 +375,27 @@ t.test('package with --json and no versions', async t => { t.equal(joinedOutput(), '', 'no info to display') }) +t.test('package with single version', async t => { + t.test('full json', async t => { + const { view, joinedOutput } = await loadMockNpm(t, { config: { json: true } }) + await view.exec(['single-version']) + t.matchSnapshot(joinedOutput()) + }) + + t.test('json and versions arg', async t => { + const { view, joinedOutput } = await loadMockNpm(t, { config: { json: true } }) + await view.exec(['single-version', 'versions']) + const parsed = JSON.parse(joinedOutput()) + t.strictSame(parsed, ['1.0.0'], 'does not unwrap single item arrays in json') + }) + + t.test('no json and versions arg', async t => { + const { view, joinedOutput } = await loadMockNpm(t, { config: { json: false } }) + await view.exec(['single-version', 'versions']) + t.strictSame(joinedOutput(), '1.0.0', 'unwraps single item arrays in basic mode') + }) +}) + t.test('package in cwd', async t => { const prefixDir = { 'package.json': JSON.stringify({ diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index a965a79a3f528d..a4f12f01c500aa 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -559,3 +559,11 @@ t.test('usage', async t => { } }) }) + +t.test('print usage if non-command param provided', async t => { + const { npm, joinedOutput } = await loadMockNpm(t) + + await t.rejects(npm.exec('tset'), { command: 'tset', exitCode: 1 }) + t.match(joinedOutput(), 'Unknown command: "tset"') + t.match(joinedOutput(), 'Did you mean this?') +}) diff --git a/deps/npm/test/lib/utils/otplease.js b/deps/npm/test/lib/utils/auth.js similarity index 87% rename from deps/npm/test/lib/utils/otplease.js rename to deps/npm/test/lib/utils/auth.js index 6dc3ee0f0b069d..7d7f63d7ddfd50 100644 --- a/deps/npm/test/lib/utils/otplease.js +++ b/deps/npm/test/lib/utils/auth.js @@ -3,24 +3,21 @@ const setupMockNpm = require('../../fixtures/mock-npm') const tmock = require('../../fixtures/tmock') const setupOtplease = async (t, { otp = {}, ...rest }, fn) => { - const readUserInfo = { - otp: async () => '1234', - } - - const webAuth = async (opener) => { - opener() - return '1234' - } - - const otplease = tmock(t, '{LIB}/utils/otplease.js', { - '{LIB}/utils/read-user-info.js': readUserInfo, - '{LIB}/utils/open-url-prompt.js': () => {}, - '{LIB}/utils/web-auth': webAuth, + const { otplease } = tmock(t, '{LIB}/utils/auth.js', { + '{LIB}/utils/read-user-info.js': { + otp: async () => '1234', + }, + '{LIB}/utils/open-url.js': { + createOpener: () => () => {}, + }, + 'npm-profile': { + webAuthOpener: async (opener) => { + opener() + return '1234' + }, + }, }) - - const { npm } = await setupMockNpm(t, rest) - - return await otplease(npm, otp, fn) + return otplease(await setupMockNpm(t, rest).then(({ npm }) => npm), otp, fn) } t.test('returns function results on success', async (t) => { diff --git a/deps/npm/test/lib/utils/did-you-mean.js b/deps/npm/test/lib/utils/did-you-mean.js index d111c2f0029605..752999bf9c1432 100644 --- a/deps/npm/test/lib/utils/did-you-mean.js +++ b/deps/npm/test/lib/utils/did-you-mean.js @@ -1,54 +1,47 @@ const t = require('tap') - const dym = require('../../../lib/utils/did-you-mean.js') t.test('did-you-mean', async t => { t.test('with package.json', async t => { - const testdir = t.testdir({ - 'package.json': JSON.stringify({ - bin: { - npx: 'exists', - }, - scripts: { - install: 'exists', - posttest: 'exists', - }, - }), - }) + const pkg = { + bin: { + npx: 'exists', + }, + scripts: { + install: 'exists', + posttest: 'exists', + }, + } t.test('nistall', async t => { - const result = await dym(testdir, 'nistall') + const result = dym(pkg, 'nistall') t.match(result, 'npm install') }) t.test('sttest', async t => { - const result = await dym(testdir, 'sttest') + const result = dym(pkg, 'sttest') t.match(result, 'npm test') t.match(result, 'npm run posttest') }) t.test('npz', async t => { - const result = await dym(testdir, 'npxx') + const result = dym(pkg, 'npxx') t.match(result, 'npm exec npx') }) t.test('qwuijbo', async t => { - const result = await dym(testdir, 'qwuijbo') + const result = dym(pkg, 'qwuijbo') t.match(result, '') }) }) t.test('with no package.json', t => { - const testdir = t.testdir({}) t.test('nistall', async t => { - const result = await dym(testdir, 'nistall') + const result = dym(null, 'nistall') t.match(result, 'npm install') }) t.end() }) t.test('missing bin and script properties', async t => { - const testdir = t.testdir({ - 'package.json': JSON.stringify({ - name: 'missing-bin', - }), - }) - - const result = await dym(testdir, 'nistall') + const pkg = { + name: 'missing-bin', + } + const result = dym(pkg, 'nistall') t.match(result, 'npm install') }) }) diff --git a/deps/npm/test/lib/utils/error-message.js b/deps/npm/test/lib/utils/error-message.js index 1ba5865592edba..c99971fd412338 100644 --- a/deps/npm/test/lib/utils/error-message.js +++ b/deps/npm/test/lib/utils/error-message.js @@ -40,7 +40,7 @@ const loadMockNpm = async (t, { errorMocks, ...opts } = {}) => { }) return { ...res, - errorMessage: (er) => mockError(er, res.npm), + errorMessage: (er) => mockError.errorMessage(er, res.npm), } } @@ -93,17 +93,12 @@ t.test('just simple messages', async t => { t.test('replace message/stack sensistive info', async t => { const { errorMessage } = await loadMockNpm(t, { command: 'audit' }) - const path = '/some/path' - const pkgid = 'some@package' - const file = '/some/file' - const stack = 'dummy stack trace at https://user:pass@registry.npmjs.org/' - const message = 'Error at registry: https://user:pass@registry.npmjs.org/' - const er = Object.assign(new Error(message), { + const er = Object.assign(new Error('Error at registry: https://user:pass@registry.npmjs.org/'), { code: 'ENOAUDIT', - path, - pkgid, - file, - stack, + path: '/some/path', + pkgid: 'some@package', + file: '/some/file', + stack: 'dummy stack trace at https://user:pass@registry.npmjs.org/', }) t.matchSnapshot(errorMessage(er)) }) diff --git a/deps/npm/test/lib/utils/open-url-prompt.js b/deps/npm/test/lib/utils/open-url-prompt.js deleted file mode 100644 index 91058ec9e29a48..00000000000000 --- a/deps/npm/test/lib/utils/open-url-prompt.js +++ /dev/null @@ -1,156 +0,0 @@ -const t = require('tap') -const EventEmitter = require('events') -const tmock = require('../../fixtures/tmock') -const mockNpm = require('../../fixtures/mock-npm') - -const mockOpenUrlPrompt = async (t, { - questionShouldResolve = true, - openUrlPromptInterrupted = false, - openerResult = null, - isTTY = true, - emitter = null, - url: openUrl = 'https://www.npmjs.com', - ...config -}) => { - const mock = await mockNpm(t, { - globals: { - 'process.stdin.isTTY': isTTY, - 'process.stdout.isTTY': isTTY, - }, - config, - }) - - let openerUrl = null - let openerOpts = null - - const openUrlPrompt = tmock(t, '{LIB}/utils/open-url-prompt.js', { - '@npmcli/promise-spawn': { - open: async (url, options) => { - openerUrl = url - openerOpts = options - if (openerResult) { - throw openerResult - } - }, - }, - readline: { - createInterface: () => ({ - question: (_q, cb) => { - if (questionShouldResolve === true) { - cb() - } - }, - close: () => {}, - on: (_signal, cb) => { - if (openUrlPromptInterrupted && _signal === 'SIGINT') { - cb() - } - }, - }), - }, - }) - - let error - const args = [mock.npm, openUrl, 'npm home', 'prompt'] - if (emitter) { - mock.open = openUrlPrompt(...args, emitter) - } else { - await openUrlPrompt(...args).catch((er) => error = er) - } - - return { - ...mock, - openerUrl, - openerOpts, - OUTPUT: mock.joinedOutput(), - emitter, - error, - } -} - -t.test('does not open a url in non-interactive environments', async t => { - const { openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { isTTY: false }) - - t.equal(openerUrl, null, 'did not open') - t.same(openerOpts, null, 'did not open') -}) - -t.test('opens a url', async t => { - const { OUTPUT, openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { browser: true }) - - t.equal(openerUrl, 'https://www.npmjs.com', 'opened the given url') - t.same(openerOpts, { command: null }, 'passed command as null (the default)') - t.matchSnapshot(OUTPUT) -}) - -t.test('opens a url with browser string', async t => { - const { openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { browser: 'firefox' }) - - t.equal(openerUrl, 'https://www.npmjs.com', 'opened the given url') - // FIXME: browser string is parsed as a boolean in config layer - // this is a bug that should be fixed or the config should not allow it - t.same(openerOpts, { command: null }, 'passed command as null (the default)') -}) - -t.test('prints json output', async t => { - const { OUTPUT } = await mockOpenUrlPrompt(t, { json: true }) - - t.matchSnapshot(OUTPUT) -}) - -t.test('returns error for non-https url', async t => { - const { error, OUTPUT, openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { - url: 'ftp://www.npmjs.com', - }) - - t.match(error, /Invalid URL/, 'got the correct error') - t.equal(openerUrl, null, 'did not open') - t.same(openerOpts, null, 'did not open') - t.same(OUTPUT, '', 'printed no output') -}) - -t.test('does not open url if canceled', async t => { - const emitter = new EventEmitter() - const { openerUrl, openerOpts, open } = await mockOpenUrlPrompt(t, { - questionShouldResolve: false, - emitter, - }) - - emitter.emit('abort') - - await open - - t.equal(openerUrl, null, 'did not open') - t.same(openerOpts, null, 'did not open') -}) - -t.test('returns error when opener errors', async t => { - const { error, openerUrl } = await mockOpenUrlPrompt(t, { - openerResult: Object.assign(new Error('Opener failed'), { code: 1 }), - }) - - t.match(error, /Opener failed/, 'got the correct error') - t.equal(openerUrl, 'https://www.npmjs.com', 'did not open') -}) - -t.test('does not error when opener can not find command', async t => { - const { OUTPUT, error, openerUrl } = await mockOpenUrlPrompt(t, { - // openerResult: new Error('Opener failed'), - openerResult: Object.assign(new Error('Opener failed'), { code: 127 }), - }) - - t.notOk(error, 'Did not error') - t.equal(openerUrl, 'https://www.npmjs.com', 'did not open') - t.matchSnapshot(OUTPUT, 'Outputs extra Browser unavailable message and url') -}) - -t.test('throws "canceled" error on SIGINT', async t => { - const emitter = new EventEmitter() - const { open } = await mockOpenUrlPrompt(t, { - questionShouldResolve: false, - openUrlPromptInterrupted: true, - emitter, - }) - - await t.rejects(open, /canceled/, 'message is canceled') -}) diff --git a/deps/npm/test/lib/utils/open-url.js b/deps/npm/test/lib/utils/open-url.js index dab7b41b92f1fb..452a09fac97e55 100644 --- a/deps/npm/test/lib/utils/open-url.js +++ b/deps/npm/test/lib/utils/open-url.js @@ -1,6 +1,7 @@ const t = require('tap') const tmock = require('../../fixtures/tmock') const mockNpm = require('../../fixtures/mock-npm') +const EventEmitter = require('events') const mockOpenUrl = async (t, args, { openerResult, ...config } = {}) => { let openerUrl = null @@ -16,7 +17,7 @@ const mockOpenUrl = async (t, args, { openerResult, ...config } = {}) => { const mock = await mockNpm(t, { config }) - const openUrl = tmock(t, '{LIB}/utils/open-url.js', { + const { openUrl } = tmock(t, '{LIB}/utils/open-url.js', { '@npmcli/promise-spawn': { open }, }) @@ -34,110 +35,275 @@ const mockOpenUrl = async (t, args, { openerResult, ...config } = {}) => { } } -t.test('opens a url', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com', 'npm home']) - t.equal(openerUrl(), 'https://www.npmjs.com', 'opened the given url') - t.same(openerOpts(), { command: null }, 'passed command as null (the default)') - t.same(joinedOutput(), '', 'printed no output') -}) +const mockOpenUrlPrompt = async (t, { + questionShouldResolve = true, + openUrlPromptInterrupted = false, + openerResult = null, + isTTY = true, + abort = false, + url: openUrl = 'https://www.npmjs.com', + ...config +}) => { + const mock = await mockNpm(t, { + globals: { + 'process.stdin.isTTY': isTTY, + 'process.stdout.isTTY': isTTY, + }, + config, + }) -t.test('returns error for non-https url', async t => { - const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) - await t.rejects( - openUrl('ftp://www.npmjs.com', 'npm home'), - /Invalid URL/, - 'got the correct error' - ) - t.equal(openerUrl(), null, 'did not open') - t.same(openerOpts(), null, 'did not open') - t.same(joinedOutput(), '', 'printed no output') -}) + let openerUrl = null + let openerOpts = null -t.test('returns error for file url', async t => { - const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) - await t.rejects( - openUrl('file:///usr/local/bin/ls', 'npm home'), - /Invalid URL/, - 'got the correct error' - ) - t.equal(openerUrl(), null, 'did not open') - t.same(openerOpts(), null, 'did not open') - t.same(joinedOutput(), '', 'printed no output') -}) + const { openUrlPrompt } = tmock(t, '{LIB}/utils/open-url.js', { + '@npmcli/promise-spawn': { + open: async (url, options) => { + openerUrl = url + openerOpts = options + if (openerResult) { + throw openerResult + } + }, + }, + 'node:readline/promises': { + createInterface: () => { + return Object.assign(new EventEmitter(), { + question: async (p, { signal } = {}) => { + if (questionShouldResolve !== true) { + await new Promise((res, rej) => { + if (signal) { + signal.addEventListener('abort', () => { + const err = new Error('abort') + err.name = 'AbortError' + rej(err) + }) + } + }) + } + }, + close: () => {}, + once: function (event, cb) { + if (openUrlPromptInterrupted && event === 'SIGINT') { + cb() + } + }, + }) + }, + }, + }) -t.test('file url allowed if explicitly asked for', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['file:///man/page/npm-install', 'npm home', true]) - t.equal(openerUrl(), 'file:///man/page/npm-install', 'opened the given url') - t.same(openerOpts(), { command: null }, 'passed command as null (the default)') - t.same(joinedOutput(), '', 'printed no output') -}) + let error + const abortController = new AbortController() + const args = [mock.npm, openUrl, 'npm home', 'prompt', { signal: abortController.signal }] + if (abort) { + mock.open = openUrlPrompt(...args) + } else { + await openUrlPrompt(...args).catch((er) => error = er) + } -t.test('returns error for non-parseable url', async t => { - const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) - await t.rejects( - openUrl('git+ssh://user@host:repo.git', 'npm home'), - /Invalid URL/, - 'got the correct error' - ) - t.equal(openerUrl(), null, 'did not open') - t.same(openerOpts(), null, 'did not open') - t.same(joinedOutput(), '', 'printed no output') -}) + return { + ...mock, + openerUrl, + openerOpts, + OUTPUT: mock.joinedOutput(), + error, + abortController, + } +} -t.test('encodes non-URL-safe characters in url provided', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com/|cat', 'npm home']) - t.equal(openerUrl(), 'https://www.npmjs.com/%7Ccat', 'opened the encoded url') - t.same(openerOpts(), { command: null }, 'passed command as null (the default)') - t.same(joinedOutput(), '', 'printed no output') -}) +t.test('open url prompt', async t => { + t.test('does not open a url in non-interactive environments', async t => { + const { openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { isTTY: false }) -t.test('opens a url with the given browser', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com', 'npm home'], { browser: 'chrome' }) - t.equal(openerUrl(), 'https://www.npmjs.com', 'opened the given url') - // FIXME: browser string is parsed as a boolean in config layer - // this is a bug that should be fixed or the config should not allow it - t.same(openerOpts(), { command: null }, 'passed the given browser as command') - t.same(joinedOutput(), '', 'printed no output') -}) + t.equal(openerUrl, null, 'did not open') + t.same(openerOpts, null, 'did not open') + }) -t.test('prints where to go when browser is disabled', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com', 'npm home'], { browser: false }) - t.equal(openerUrl(), null, 'did not open') - t.same(openerOpts(), null, 'did not open') - t.matchSnapshot(joinedOutput(), 'printed expected message') -}) + t.test('opens a url', async t => { + const { OUTPUT, openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { browser: true }) -t.test('prints where to go when browser is disabled and json is enabled', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com', 'npm home'], { browser: false, json: true }) - t.equal(openerUrl(), null, 'did not open') - t.same(openerOpts(), null, 'did not open') - t.matchSnapshot(joinedOutput(), 'printed expected message') -}) + t.equal(openerUrl, 'https://www.npmjs.com', 'opened the given url') + t.same(openerOpts, { command: null }, 'passed command as null (the default)') + t.matchSnapshot(OUTPUT) + }) -t.test('prints where to go when given browser does not exist', async t => { - const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, - ['https://www.npmjs.com', 'npm home'], - { - openerResult: Object.assign(new Error('failed'), { code: 127 }), - } - ) + t.test('opens a url with browser string', async t => { + const { openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { browser: 'firefox' }) + + t.equal(openerUrl, 'https://www.npmjs.com', 'opened the given url') + // FIXME: browser string is parsed as a boolean in config layer + // this is a bug that should be fixed or the config should not allow it + t.same(openerOpts, { command: null }, 'passed command as null (the default)') + }) + + t.test('prints json output', async t => { + const { OUTPUT } = await mockOpenUrlPrompt(t, { json: true }) + + t.matchSnapshot(OUTPUT) + }) + + t.test('returns error for non-https url', async t => { + const { error, OUTPUT, openerUrl, openerOpts } = await mockOpenUrlPrompt(t, { + url: 'ftp://www.npmjs.com', + }) + + t.match(error, /Invalid URL/, 'got the correct error') + t.equal(openerUrl, null, 'did not open') + t.same(openerOpts, null, 'did not open') + t.same(OUTPUT, '', 'printed no output') + }) + + t.test('does not open url if canceled', async t => { + const { openerUrl, openerOpts, open, abortController } = await mockOpenUrlPrompt(t, { + questionShouldResolve: false, + abort: true, + }) + + abortController.abort() + + await open - t.equal(openerUrl(), 'https://www.npmjs.com', 'tried to open the correct url') - t.same(openerOpts(), { command: null }, 'tried to use the correct browser') - t.matchSnapshot(joinedOutput(), 'printed expected message') + t.equal(openerUrl, null, 'did not open') + t.same(openerOpts, null, 'did not open') + }) + + t.test('returns error when opener errors', async t => { + const { error, openerUrl } = await mockOpenUrlPrompt(t, { + openerResult: Object.assign(new Error('Opener failed'), { code: 1 }), + }) + + t.match(error, /Opener failed/, 'got the correct error') + t.equal(openerUrl, 'https://www.npmjs.com', 'did not open') + }) + + t.test('does not error when opener can not find command', async t => { + const { OUTPUT, error, openerUrl } = await mockOpenUrlPrompt(t, { + // openerResult: new Error('Opener failed'), + openerResult: Object.assign(new Error('Opener failed'), { code: 127 }), + }) + + t.notOk(error, 'Did not error') + t.equal(openerUrl, 'https://www.npmjs.com', 'did not open') + t.matchSnapshot(OUTPUT, 'Outputs extra Browser unavailable message and url') + }) + + t.test('throws "canceled" error on SIGINT', async t => { + const { open } = await mockOpenUrlPrompt(t, { + questionShouldResolve: false, + openUrlPromptInterrupted: true, + abort: true, + }) + + await t.rejects(open, /canceled/, 'message is canceled') + }) }) -t.test('handles unknown opener error', async t => { - const { openUrl } = await mockOpenUrl(t, null, { - browser: 'firefox', - openerResult: Object.assign(new Error('failed'), { code: 'ENOBRIAN' }), +t.test('open url', async t => { + t.test('opens a url', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com', 'npm home']) + t.equal(openerUrl(), 'https://www.npmjs.com', 'opened the given url') + t.same(openerOpts(), { command: null }, 'passed command as null (the default)') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('returns error for non-https url', async t => { + const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) + await t.rejects( + openUrl('ftp://www.npmjs.com', 'npm home'), + /Invalid URL/, + 'got the correct error' + ) + t.equal(openerUrl(), null, 'did not open') + t.same(openerOpts(), null, 'did not open') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('returns error for file url', async t => { + const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) + await t.rejects( + openUrl('file:///usr/local/bin/ls', 'npm home'), + /Invalid URL/, + 'got the correct error' + ) + t.equal(openerUrl(), null, 'did not open') + t.same(openerOpts(), null, 'did not open') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('file url allowed if explicitly asked for', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['file:///man/page/npm-install', 'npm home', true]) + t.equal(openerUrl(), 'file:///man/page/npm-install', 'opened the given url') + t.same(openerOpts(), { command: null }, 'passed command as null (the default)') + t.same(joinedOutput(), '', 'printed no output') }) - await t.rejects(openUrl('https://www.npmjs.com', 'npm home'), 'failed', 'got the correct error') + t.test('returns error for non-parseable url', async t => { + const { openUrl, openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t) + await t.rejects( + openUrl('git+ssh://user@host:repo.git', 'npm home'), + /Invalid URL/, + 'got the correct error' + ) + t.equal(openerUrl(), null, 'did not open') + t.same(openerOpts(), null, 'did not open') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('encodes non-URL-safe characters in url provided', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com/|cat', 'npm home']) + t.equal(openerUrl(), 'https://www.npmjs.com/%7Ccat', 'opened the encoded url') + t.same(openerOpts(), { command: null }, 'passed command as null (the default)') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('opens a url with the given browser', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com', 'npm home'], { browser: 'chrome' }) + t.equal(openerUrl(), 'https://www.npmjs.com', 'opened the given url') + // FIXME: browser string is parsed as a boolean in config layer + // this is a bug that should be fixed or the config should not allow it + t.same(openerOpts(), { command: null }, 'passed the given browser as command') + t.same(joinedOutput(), '', 'printed no output') + }) + + t.test('prints where to go when browser is disabled', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com', 'npm home'], { browser: false }) + t.equal(openerUrl(), null, 'did not open') + t.same(openerOpts(), null, 'did not open') + t.matchSnapshot(joinedOutput(), 'printed expected message') + }) + + t.test('prints where to go when browser is disabled and json is enabled', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com', 'npm home'], { browser: false, json: true }) + t.equal(openerUrl(), null, 'did not open') + t.same(openerOpts(), null, 'did not open') + t.matchSnapshot(joinedOutput(), 'printed expected message') + }) + + t.test('prints where to go when given browser does not exist', async t => { + const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t, + ['https://www.npmjs.com', 'npm home'], + { + openerResult: Object.assign(new Error('failed'), { code: 127 }), + } + ) + + t.equal(openerUrl(), 'https://www.npmjs.com', 'tried to open the correct url') + t.same(openerOpts(), { command: null }, 'tried to use the correct browser') + t.matchSnapshot(joinedOutput(), 'printed expected message') + }) + + t.test('handles unknown opener error', async t => { + const { openUrl } = await mockOpenUrl(t, null, { + browser: 'firefox', + openerResult: Object.assign(new Error('failed'), { code: 'ENOBRIAN' }), + }) + + await t.rejects(openUrl('https://www.npmjs.com', 'npm home'), 'failed', 'got the correct error') + }) }) diff --git a/deps/npm/test/lib/utils/web-auth.js b/deps/npm/test/lib/utils/web-auth.js deleted file mode 100644 index ec8c1d17e9fa1f..00000000000000 --- a/deps/npm/test/lib/utils/web-auth.js +++ /dev/null @@ -1,33 +0,0 @@ -const t = require('tap') -const tmock = require('../../fixtures/tmock') - -const webAuthCheckLogin = async () => { - return { token: 'otp-token' } -} - -const webauth = tmock(t, '{LIB}/utils/web-auth.js', { - 'npm-profile': { webAuthCheckLogin }, -}) - -const initialUrl = 'https://example.com/auth' -const doneUrl = 'https://example.com/done' -const opts = {} - -t.test('returns token on success', async (t) => { - const opener = async () => {} - const result = await webauth(opener, initialUrl, doneUrl, opts) - t.equal(result, 'otp-token') -}) - -t.test('closes opener when auth check finishes', async (t) => { - const opener = (_url, emitter) => { - return new Promise((resolve) => { - // the only way to finish this promise is to emit abort on the emitter - emitter.addListener('abort', () => { - resolve() - }) - }) - } - const result = await webauth(opener, initialUrl, doneUrl, opts) - t.equal(result, 'otp-token') -})