From 204c7fa5dfb1eedbd946da1277064b89dbde647f Mon Sep 17 00:00:00 2001 From: "ops+robot@npmjs.com" Date: Thu, 14 Apr 2022 21:57:02 +0000 Subject: [PATCH] deps: upgrade npm to 8.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/42744 Reviewed-By: Rich Trott Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen --- deps/npm/README.md | 7 +- deps/npm/docs/content/commands/npm-audit.md | 2 + deps/npm/docs/content/commands/npm-ci.md | 7 + deps/npm/docs/content/commands/npm-dedupe.md | 26 +- deps/npm/docs/content/commands/npm-diff.md | 2 + .../npm/docs/content/commands/npm-dist-tag.md | 2 + deps/npm/docs/content/commands/npm-docs.md | 2 + deps/npm/docs/content/commands/npm-exec.md | 2 + .../docs/content/commands/npm-find-dupes.md | 2 + deps/npm/docs/content/commands/npm-init.md | 2 + .../docs/content/commands/npm-install-test.md | 5 +- deps/npm/docs/content/commands/npm-install.md | 5 +- deps/npm/docs/content/commands/npm-link.md | 5 +- deps/npm/docs/content/commands/npm-ls.md | 2 + deps/npm/docs/content/commands/npm-pack.md | 2 + deps/npm/docs/content/commands/npm-prune.md | 2 + deps/npm/docs/content/commands/npm-publish.md | 2 + deps/npm/docs/content/commands/npm-rebuild.md | 2 + deps/npm/docs/content/commands/npm-repo.md | 2 + .../docs/content/commands/npm-run-script.md | 4 + .../docs/content/commands/npm-set-script.md | 2 + .../docs/content/commands/npm-uninstall.md | 7 +- deps/npm/docs/content/commands/npm-update.md | 5 +- deps/npm/docs/content/commands/npm-version.md | 2 + deps/npm/docs/content/commands/npm-view.md | 2 + deps/npm/docs/content/using-npm/config.md | 7 +- deps/npm/docs/output/commands/npm-audit.html | 1 + deps/npm/docs/output/commands/npm-ci.html | 6 + deps/npm/docs/output/commands/npm-dedupe.html | 23 +- deps/npm/docs/output/commands/npm-diff.html | 1 + .../docs/output/commands/npm-dist-tag.html | 1 + deps/npm/docs/output/commands/npm-docs.html | 1 + deps/npm/docs/output/commands/npm-exec.html | 1 + .../docs/output/commands/npm-find-dupes.html | 1 + deps/npm/docs/output/commands/npm-init.html | 1 + .../output/commands/npm-install-test.html | 4 +- .../npm/docs/output/commands/npm-install.html | 4 +- deps/npm/docs/output/commands/npm-link.html | 4 +- deps/npm/docs/output/commands/npm-ls.html | 3 +- deps/npm/docs/output/commands/npm-pack.html | 1 + deps/npm/docs/output/commands/npm-prune.html | 1 + .../npm/docs/output/commands/npm-publish.html | 1 + .../npm/docs/output/commands/npm-rebuild.html | 1 + deps/npm/docs/output/commands/npm-repo.html | 1 + .../docs/output/commands/npm-run-script.html | 2 + .../docs/output/commands/npm-set-script.html | 1 + .../docs/output/commands/npm-uninstall.html | 6 +- deps/npm/docs/output/commands/npm-update.html | 4 +- .../npm/docs/output/commands/npm-version.html | 1 + deps/npm/docs/output/commands/npm-view.html | 1 + deps/npm/docs/output/commands/npm.html | 2 +- deps/npm/docs/output/using-npm/config.html | 5 +- deps/npm/lib/auth/sso.js | 2 - deps/npm/lib/commands/cache.js | 2 +- deps/npm/lib/commands/completion.js | 6 +- deps/npm/lib/commands/config.js | 3 + deps/npm/lib/commands/dedupe.js | 13 +- deps/npm/lib/commands/doctor.js | 4 +- deps/npm/lib/commands/help-search.js | 8 +- deps/npm/lib/commands/install.js | 11 +- deps/npm/lib/commands/ls.js | 45 +- deps/npm/lib/commands/outdated.js | 15 +- deps/npm/lib/commands/profile.js | 4 +- deps/npm/lib/commands/publish.js | 29 +- deps/npm/lib/commands/token.js | 4 +- deps/npm/lib/commands/view.js | 53 +- deps/npm/lib/npm.js | 3 + deps/npm/lib/search/format-package-stream.js | 6 +- deps/npm/lib/search/package-filter.js | 2 +- deps/npm/lib/utils/config/definition.js | 2 +- deps/npm/lib/utils/config/definitions.js | 6 +- deps/npm/lib/utils/npm-usage.js | 2 +- deps/npm/lib/utils/tar.js | 4 +- deps/npm/lib/utils/update-notifier.js | 10 +- deps/npm/lib/workspaces/get-workspaces.js | 16 +- deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-audit.1 | 4 +- deps/npm/man/man1/npm-bin.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 | 9 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 28 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-diff.1 | 4 +- deps/npm/man/man1/npm-dist-tag.1 | 4 +- deps/npm/man/man1/npm-docs.1 | 4 +- deps/npm/man/man1/npm-doctor.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-exec.1 | 4 +- deps/npm/man/man1/npm-explain.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-find-dupes.1 | 4 +- 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 | 4 +- deps/npm/man/man1/npm-install-ci-test.1 | 2 +- deps/npm/man/man1/npm-install-test.1 | 7 +- deps/npm/man/man1/npm-install.1 | 7 +- deps/npm/man/man1/npm-link.1 | 7 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 6 +- 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 | 4 +- 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 | 4 +- deps/npm/man/man1/npm-publish.1 | 4 +- deps/npm/man/man1/npm-rebuild.1 | 4 +- deps/npm/man/man1/npm-repo.1 | 4 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 6 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-set-script.1 | 4 +- 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 | 9 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-unstar.1 | 2 +- deps/npm/man/man1/npm-update.1 | 7 +- deps/npm/man/man1/npm-version.1 | 4 +- deps/npm/man/man1/npm-view.1 | 4 +- 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-shrinkwrap-json.5 | 2 +- deps/npm/man/man5/npmrc.5 | 2 +- deps/npm/man/man5/package-json.5 | 2 +- deps/npm/man/man5/package-lock-json.5 | 2 +- deps/npm/man/man7/config.7 | 9 +- 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/registry.7 | 2 +- deps/npm/man/man7/removal.7 | 2 +- deps/npm/man/man7/scope.7 | 2 +- deps/npm/man/man7/scripts.7 | 2 +- deps/npm/man/man7/workspaces.7 | 2 +- .../node_modules/@npmcli/arborist/README.md | 4 + .../@npmcli/arborist/lib/audit-report.js | 75 +- .../node_modules/@npmcli/arborist/lib/edge.js | 5 + .../node_modules/@npmcli/arborist/lib/node.js | 3 + .../@npmcli/arborist/lib/retire-path.js | 2 +- .../@npmcli/arborist/lib/shrinkwrap.js | 4 +- .../@npmcli/arborist/lib/version-from-tgz.js | 2 +- .../@npmcli/arborist/package.json | 20 +- .../@npmcli/config/lib/env-replace.js | 4 +- .../node_modules/@npmcli/config/lib/index.js | 13 +- .../@npmcli/config/lib/parse-field.js | 2 +- .../node_modules/@npmcli/config/package.json | 28 +- .../disparity-colors/{ => lib}/index.js | 6 +- .../@npmcli/disparity-colors/package.json | 37 +- .../npm/node_modules/@npmcli/git/lib/clone.js | 8 +- .../@npmcli/git/lib/lines-to-revs.js | 6 +- .../npm/node_modules/@npmcli/git/lib/spawn.js | 12 +- .../npm/node_modules/@npmcli/git/package.json | 32 +- .../node_modules/minimatch/LICENSE | 15 - .../node_modules/minimatch/minimatch.js | 901 ---------- .../metavuln-calculator/lib/advisory.js | 44 +- .../@npmcli/metavuln-calculator/package.json | 27 +- .../@npmcli/move-file/{ => lib}/index.js | 59 +- .../@npmcli/move-file/package.json | 27 +- .../@npmcli/node-gyp/lib/index.js | 6 +- .../@npmcli/node-gyp/package.json | 32 +- .../@npmcli/package-json/lib/index.js | 9 +- .../package-json/lib/update-dependencies.js | 9 +- .../package-json/lib/update-scripts.js | 3 +- .../package-json/lib/update-workspaces.js | 3 +- .../@npmcli/package-json/package.json | 30 +- .../@npmcli/promise-spawn/{ => lib}/index.js | 16 +- .../@npmcli/promise-spawn/package.json | 30 +- .../@npmcli/run-script/lib/run-script.js | 3 +- .../@npmcli/run-script/lib/set-path.js | 2 +- .../@npmcli/run-script/package.json | 30 +- deps/npm/node_modules/ansicolors/LICENSE | 23 - .../npm/node_modules/ansicolors/ansicolors.js | 65 - deps/npm/node_modules/ansicolors/package.json | 23 - .../ansicolors/test/ansicolors.js | 71 - deps/npm/node_modules/ansistyles/LICENSE | 23 - .../npm/node_modules/ansistyles/ansistyles.js | 38 - deps/npm/node_modules/ansistyles/package.json | 23 - .../ansistyles/test/ansistyles.js | 15 - .../node_modules/bin-links/lib/check-bin.js | 10 +- .../node_modules/bin-links/lib/get-paths.js | 19 +- .../node_modules/bin-links/lib/link-mans.js | 2 +- deps/npm/node_modules/bin-links/package.json | 27 +- .../npm/node_modules/brace-expansion/index.js | 170 +- .../node_modules/brace-expansion/package.json | 7 +- deps/npm/node_modules/cacache/package.json | 10 +- .../node_modules/cmd-shim/{ => lib}/index.js | 23 +- .../cmd-shim/lib/to-batch-syntax.js | 78 +- deps/npm/node_modules/cmd-shim/package.json | 28 +- deps/npm/node_modules/dezalgo/package.json | 20 +- deps/npm/node_modules/dezalgo/test/basic.js | 29 - .../node_modules/brace-expansion/LICENSE | 0 .../node_modules/brace-expansion/index.js | 170 +- .../node_modules/brace-expansion/package.json | 7 +- .../node_modules/minimatch}/LICENSE | 0 .../glob/node_modules/minimatch/minimatch.js | 947 +++++++++++ .../node_modules/minimatch/package.json | 15 +- deps/npm/node_modules/graceful-fs/LICENSE | 2 +- .../node_modules/graceful-fs/graceful-fs.js | 27 +- .../npm/node_modules/graceful-fs/package.json | 2 +- .../npm/node_modules/graceful-fs/polyfills.js | 63 +- .../ignore-walk/{ => lib}/index.js | 26 +- .../npm/node_modules/ignore-walk/package.json | 41 +- deps/npm/node_modules/ini/{ => lib}/ini.js | 98 +- deps/npm/node_modules/ini/package.json | 33 +- deps/npm/node_modules/libnpmaccess/README.md | 3 +- .../node_modules/libnpmaccess/package.json | 11 +- deps/npm/node_modules/libnpmdiff/README.md | 4 +- .../libnpmdiff/lib/should-print-patch.js | 2 +- deps/npm/node_modules/libnpmdiff/package.json | 15 +- deps/npm/node_modules/libnpmexec/README.md | 3 +- deps/npm/node_modules/libnpmexec/package.json | 9 +- deps/npm/node_modules/libnpmfund/README.md | 3 +- deps/npm/node_modules/libnpmfund/package.json | 11 +- deps/npm/node_modules/libnpmhook/README.md | 2 +- deps/npm/node_modules/libnpmhook/lib/index.js | 2 +- deps/npm/node_modules/libnpmhook/package.json | 11 +- deps/npm/node_modules/libnpmorg/README.md | 3 +- deps/npm/node_modules/libnpmorg/package.json | 11 +- deps/npm/node_modules/libnpmpack/README.md | 3 +- deps/npm/node_modules/libnpmpack/package.json | 11 +- deps/npm/node_modules/libnpmpublish/README.md | 4 + .../libnpmpublish/lib/unpublish.js | 2 +- .../node_modules/libnpmpublish/package.json | 13 +- deps/npm/node_modules/libnpmsearch/README.md | 2 +- .../node_modules/libnpmsearch/package.json | 11 +- deps/npm/node_modules/libnpmteam/README.md | 3 +- deps/npm/node_modules/libnpmteam/package.json | 11 +- deps/npm/node_modules/libnpmversion/README.md | 4 + .../node_modules/libnpmversion/package.json | 14 +- deps/npm/node_modules/lru-cache/index.js | 19 +- deps/npm/node_modules/lru-cache/package.json | 4 +- .../make-fetch-happen/package.json | 8 +- deps/npm/node_modules/minimatch/LICENSE | 2 +- .../node_modules => }/minimatch/lib/path.js | 0 deps/npm/node_modules/minimatch/minimatch.js | 1512 ++++++++--------- deps/npm/node_modules/minimatch/package.json | 15 +- .../npm-install-checks/{ => lib}/index.js | 13 +- .../npm-install-checks/package.json | 29 +- .../node_modules/npm-package-arg/README.md | 86 - .../node_modules/npm-packlist/bin/index.js | 29 +- .../node_modules/npm-packlist/lib/index.js | 99 +- .../node_modules/npm-packlist/package.json | 31 +- .../npm-pick-manifest/package.json | 31 +- deps/npm/node_modules/pacote/lib/bin.js | 2 +- deps/npm/node_modules/pacote/lib/fetcher.js | 11 +- deps/npm/node_modules/pacote/lib/remote.js | 4 +- .../pacote/lib/util/trailing-slashes.js | 2 +- deps/npm/node_modules/pacote/package.json | 35 +- .../read-cmd-shim/{ => lib}/index.js | 12 +- .../node_modules/read-cmd-shim/package.json | 35 +- deps/npm/node_modules/semver/CHANGELOG.md | 111 -- deps/npm/node_modules/semver/README.md | 4 +- deps/npm/node_modules/semver/bin/semver.js | 25 +- .../node_modules/semver/classes/comparator.js | 5 +- deps/npm/node_modules/semver/classes/index.js | 2 +- deps/npm/node_modules/semver/classes/range.js | 53 +- deps/npm/node_modules/semver/functions/cmp.js | 12 +- .../node_modules/semver/functions/coerce.js | 5 +- .../node_modules/semver/functions/parse.js | 2 +- .../node_modules/semver/internal/constants.js | 4 +- .../semver/internal/identifiers.js | 2 +- .../semver/internal/parse-options.js | 6 +- deps/npm/node_modules/semver/internal/re.js | 6 +- .../semver/node_modules/lru-cache/index.js | 334 ---- .../node_modules/lru-cache/package.json | 34 - deps/npm/node_modules/semver/package.json | 59 +- .../node_modules/semver/ranges/min-version.js | 3 +- .../npm/node_modules/semver/ranges/outside.js | 2 +- .../node_modules/semver/ranges/simplify.js | 27 +- deps/npm/node_modules/semver/ranges/subset.js | 84 +- deps/npm/node_modules/ssri/LICENSE.md | 2 +- deps/npm/node_modules/ssri/{ => lib}/index.js | 75 +- deps/npm/node_modules/ssri/package.json | 43 +- .../node_modules/stringify-package/LICENSE | 13 - .../node_modules/stringify-package/index.js | 18 - .../stringify-package/package.json | 38 - deps/npm/node_modules/treeverse/index.js | 4 - .../npm/node_modules/treeverse/lib/breadth.js | 27 +- .../treeverse/lib/depth-descent.js | 27 +- deps/npm/node_modules/treeverse/lib/depth.js | 16 +- deps/npm/node_modules/treeverse/lib/index.js | 4 + deps/npm/node_modules/treeverse/package.json | 34 +- deps/npm/package.json | 44 +- .../smoke-tests/index.js.test.cjs | 784 --------- .../test/lib/commands/audit.js.test.cjs | 111 ++ .../test/lib/commands/config.js.test.cjs | 9 + .../test/lib/commands/doctor.js.test.cjs | 98 +- .../test/lib/commands/profile.js.test.cjs | 82 +- .../test/lib/commands/view.js.test.cjs | 8 +- .../test/lib/load-all-commands.js.test.cjs | 1 - .../lib/utils/config/definitions.js.test.cjs | 7 +- .../lib/utils/config/describe-all.js.test.cjs | 7 +- .../test/lib/utils/npm-usage.js.test.cjs | 1 - deps/npm/test/fixtures/mock-npm.js | 22 +- deps/npm/test/fixtures/mock-registry.js | 224 +++ deps/npm/test/lib/auth/sso.js | 28 - deps/npm/test/lib/commands/access.js | 296 ++-- deps/npm/test/lib/commands/adduser.js | 314 ++-- deps/npm/test/lib/commands/audit.js | 237 +-- deps/npm/test/lib/commands/completion.js | 19 +- deps/npm/test/lib/commands/dedupe.js | 104 +- deps/npm/test/lib/commands/deprecate.js | 1 - deps/npm/test/lib/commands/doctor.js | 6 +- deps/npm/test/lib/commands/find-dupes.js | 82 +- deps/npm/test/lib/commands/help-search.js | 4 +- deps/npm/test/lib/commands/hook.js | 1 - deps/npm/test/lib/commands/install.js | 7 +- deps/npm/test/lib/commands/ls.js | 224 +-- deps/npm/test/lib/commands/org.js | 1 - deps/npm/test/lib/commands/outdated.js | 25 +- deps/npm/test/lib/commands/owner.js | 3 - deps/npm/test/lib/commands/profile.js | 5 - deps/npm/test/lib/commands/publish.js | 39 +- deps/npm/test/lib/commands/team.js | 1 - deps/npm/test/lib/commands/token.js | 3 - deps/npm/test/lib/commands/unpublish.js | 281 +-- deps/npm/test/lib/commands/whoami.js | 29 +- deps/npm/test/lib/npm.js | 11 +- .../npm/test/lib/workspaces/get-workspaces.js | 183 +- 340 files changed, 4868 insertions(+), 6011 deletions(-) rename deps/npm/node_modules/@npmcli/disparity-colors/{ => lib}/index.js (87%) delete mode 100644 deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE delete mode 100644 deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/minimatch.js rename deps/npm/node_modules/@npmcli/move-file/{ => lib}/index.js (72%) rename deps/npm/node_modules/@npmcli/promise-spawn/{ => lib}/index.js (87%) delete mode 100644 deps/npm/node_modules/ansicolors/LICENSE delete mode 100644 deps/npm/node_modules/ansicolors/ansicolors.js delete mode 100644 deps/npm/node_modules/ansicolors/package.json delete mode 100644 deps/npm/node_modules/ansicolors/test/ansicolors.js delete mode 100644 deps/npm/node_modules/ansistyles/LICENSE delete mode 100644 deps/npm/node_modules/ansistyles/ansistyles.js delete mode 100644 deps/npm/node_modules/ansistyles/package.json delete mode 100644 deps/npm/node_modules/ansistyles/test/ansistyles.js rename deps/npm/node_modules/cmd-shim/{ => lib}/index.js (93%) delete mode 100644 deps/npm/node_modules/dezalgo/test/basic.js rename deps/npm/node_modules/{@npmcli/map-workspaces => glob}/node_modules/brace-expansion/LICENSE (100%) rename deps/npm/node_modules/{@npmcli/map-workspaces => glob}/node_modules/brace-expansion/index.js (54%) rename deps/npm/node_modules/{@npmcli/map-workspaces => glob}/node_modules/brace-expansion/package.json (90%) rename deps/npm/node_modules/{semver/node_modules/lru-cache => glob/node_modules/minimatch}/LICENSE (100%) create mode 100644 deps/npm/node_modules/glob/node_modules/minimatch/minimatch.js rename deps/npm/node_modules/{@npmcli/map-workspaces => glob}/node_modules/minimatch/package.json (70%) rename deps/npm/node_modules/ignore-walk/{ => lib}/index.js (91%) rename deps/npm/node_modules/ini/{ => lib}/ini.js (75%) rename deps/npm/node_modules/{@npmcli/map-workspaces/node_modules => }/minimatch/lib/path.js (100%) rename deps/npm/node_modules/npm-install-checks/{ => lib}/index.js (91%) delete mode 100644 deps/npm/node_modules/npm-package-arg/README.md rename deps/npm/node_modules/read-cmd-shim/{ => lib}/index.js (91%) delete mode 100644 deps/npm/node_modules/semver/CHANGELOG.md 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 rename deps/npm/node_modules/ssri/{ => lib}/index.js (91%) delete mode 100644 deps/npm/node_modules/stringify-package/LICENSE delete mode 100644 deps/npm/node_modules/stringify-package/index.js delete mode 100644 deps/npm/node_modules/stringify-package/package.json delete mode 100644 deps/npm/node_modules/treeverse/index.js create mode 100644 deps/npm/node_modules/treeverse/lib/index.js delete mode 100644 deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs create mode 100644 deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs create mode 100644 deps/npm/test/fixtures/mock-registry.js diff --git a/deps/npm/README.md b/deps/npm/README.md index 46846fa0087b50..fdc80bc796a268 100644 --- a/deps/npm/README.md +++ b/deps/npm/README.md @@ -1,7 +1,10 @@ -[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/npm/cli/Node%20CI/latest)](https://github.com/npm/cli/actions?query=workflow%3A%22Node+CI%22+branch%3Alatest) [![Coveralls github branch](https://img.shields.io/coveralls/github/npm/cli/latest)](https://coveralls.io/github/npm/cli?branch=latest) - # npm - a JavaScript package manager +[![npm version](https://img.shields.io/npm/v/npm.svg)](https://npm.im/npm) +[![license](https://img.shields.io/npm/l/npm.svg)](https://npm.im/npm) +[![CI - cli](https://github.com/npm/cli/actions/workflows/ci.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci.yml) +[![Benchmark Suite](https://github.com/npm/cli/actions/workflows/benchmark.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/benchmark.yml) + ### Requirements One of the following versions of [Node.js](https://nodejs.org/en/download/) must be installed to run **`npm`**: diff --git a/deps/npm/docs/content/commands/npm-audit.md b/deps/npm/docs/content/commands/npm-audit.md index 24b700ff5abd85..0f164ac9d3ec51 100644 --- a/deps/npm/docs/content/commands/npm-audit.md +++ b/deps/npm/docs/content/commands/npm-audit.md @@ -394,6 +394,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-ci.md b/deps/npm/docs/content/commands/npm-ci.md index 97d1aa5523dd72..b4ce811869bb2e 100644 --- a/deps/npm/docs/content/commands/npm-ci.md +++ b/deps/npm/docs/content/commands/npm-ci.md @@ -46,6 +46,13 @@ In short, the main differences between using `npm install` and `npm ci` are: * It will never write to `package.json` or any of the package-locks: installs are essentially frozen. +NOTE: If you create your `package-lock.json` file by running `npm install` +with flags that can affect the shape of your dependency tree, such as +`--legacy-peer-deps`, you _must_ provide the same flags to `npm ci` or you +are likely to encounter errors. An easy way to do this is to run +`npm config set legacy-peer-deps=true --location=project` and commit the +`.npmrc` file to your repo. + ### Example Make sure you have a package-lock and an up-to-date install: diff --git a/deps/npm/docs/content/commands/npm-dedupe.md b/deps/npm/docs/content/commands/npm-dedupe.md index b5a64831c0bbaa..b9768c25db88d6 100644 --- a/deps/npm/docs/content/commands/npm-dedupe.md +++ b/deps/npm/docs/content/commands/npm-dedupe.md @@ -80,11 +80,9 @@ result in new modules being installed. Using `npm find-dupes` will run the command in `--dry-run` mode. -Note that by default `npm dedupe` will not update the semver values of direct -dependencies in your project `package.json`, if you want to also update -values in `package.json` you can run: `npm dedupe --save` (or add the -`save=true` option to a [configuration file](/configuring-npm/npmrc) -to make that the default behavior). +Note: `npm dedupe` will never update the semver values of direct +dependencies in your project `package.json`, if you want to update +values in `package.json` you can run: `npm update --save` instead. ### Configuration @@ -158,22 +156,6 @@ This configuration does not affect `npm ci`. -#### `save` - -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` -* Type: Boolean - -Save installed packages to a `package.json` file as dependencies. - -When used with the `npm rm` command, removes the dependency from -`package.json`. - -Will also prevent writing to `package-lock.json` if set to `false`. - - - - #### `omit` * Default: 'dev' if the `NODE_ENV` environment variable is set to @@ -323,6 +305,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-diff.md b/deps/npm/docs/content/commands/npm-diff.md index c4c9eafdb3524d..7dcc8af7c3b4c7 100644 --- a/deps/npm/docs/content/commands/npm-diff.md +++ b/deps/npm/docs/content/commands/npm-diff.md @@ -335,6 +335,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-dist-tag.md b/deps/npm/docs/content/commands/npm-dist-tag.md index a0f306cd4970d5..b9caf1fbe7fa9c 100644 --- a/deps/npm/docs/content/commands/npm-dist-tag.md +++ b/deps/npm/docs/content/commands/npm-dist-tag.md @@ -159,6 +159,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-docs.md b/deps/npm/docs/content/commands/npm-docs.md index 8d5a278286a88b..790d563bdb1fb7 100644 --- a/deps/npm/docs/content/commands/npm-docs.md +++ b/deps/npm/docs/content/commands/npm-docs.md @@ -116,6 +116,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-exec.md b/deps/npm/docs/content/commands/npm-exec.md index 3645e336b9da97..8ccfa75c73386c 100644 --- a/deps/npm/docs/content/commands/npm-exec.md +++ b/deps/npm/docs/content/commands/npm-exec.md @@ -205,6 +205,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-find-dupes.md b/deps/npm/docs/content/commands/npm-find-dupes.md index f7366fa6375d1e..3549be47daae9c 100644 --- a/deps/npm/docs/content/commands/npm-find-dupes.md +++ b/deps/npm/docs/content/commands/npm-find-dupes.md @@ -229,6 +229,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-init.md b/deps/npm/docs/content/commands/npm-init.md index 71109cd360511d..5a7dd4c97ac60e 100644 --- a/deps/npm/docs/content/commands/npm-init.md +++ b/deps/npm/docs/content/commands/npm-init.md @@ -264,6 +264,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-install-test.md b/deps/npm/docs/content/commands/npm-install-test.md index 5ac31cbf08e25c..8975fc4ce61dec 100644 --- a/deps/npm/docs/content/commands/npm-install-test.md +++ b/deps/npm/docs/content/commands/npm-install-test.md @@ -42,8 +42,7 @@ takes exactly the same arguments as `npm install`. #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. @@ -315,6 +314,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-install.md b/deps/npm/docs/content/commands/npm-install.md index c85a592ededaec..259ac41eaf05df 100644 --- a/deps/npm/docs/content/commands/npm-install.md +++ b/deps/npm/docs/content/commands/npm-install.md @@ -432,8 +432,7 @@ These are some of the most common options related to installation. #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. @@ -705,6 +704,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-link.md b/deps/npm/docs/content/commands/npm-link.md index 892b55496c9b6f..fb7e46de04a090 100644 --- a/deps/npm/docs/content/commands/npm-link.md +++ b/deps/npm/docs/content/commands/npm-link.md @@ -125,8 +125,7 @@ workspace(s). #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. @@ -383,6 +382,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md index 0f06e131f414b2..8d4799777e20f0 100644 --- a/deps/npm/docs/content/commands/npm-ls.md +++ b/deps/npm/docs/content/commands/npm-ls.md @@ -280,6 +280,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-pack.md b/deps/npm/docs/content/commands/npm-pack.md index c834f643ac0bb1..fa6c005e9d2287 100644 --- a/deps/npm/docs/content/commands/npm-pack.md +++ b/deps/npm/docs/content/commands/npm-pack.md @@ -122,6 +122,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-prune.md b/deps/npm/docs/content/commands/npm-prune.md index a10a353801b7cd..81dccf889ce4d9 100644 --- a/deps/npm/docs/content/commands/npm-prune.md +++ b/deps/npm/docs/content/commands/npm-prune.md @@ -186,6 +186,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-publish.md b/deps/npm/docs/content/commands/npm-publish.md index ce6e1c1012c8e2..2995f6bc81551e 100644 --- a/deps/npm/docs/content/commands/npm-publish.md +++ b/deps/npm/docs/content/commands/npm-publish.md @@ -238,6 +238,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-rebuild.md b/deps/npm/docs/content/commands/npm-rebuild.md index d63e00b79d3867..bddd18c2bcaf43 100644 --- a/deps/npm/docs/content/commands/npm-rebuild.md +++ b/deps/npm/docs/content/commands/npm-rebuild.md @@ -157,6 +157,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-repo.md b/deps/npm/docs/content/commands/npm-repo.md index e14f07012a2484..404c724ff02906 100644 --- a/deps/npm/docs/content/commands/npm-repo.md +++ b/deps/npm/docs/content/commands/npm-repo.md @@ -103,6 +103,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-run-script.md b/deps/npm/docs/content/commands/npm-run-script.md index 79b7c9a25780e6..73c4b1c7a748a7 100644 --- a/deps/npm/docs/content/commands/npm-run-script.md +++ b/deps/npm/docs/content/commands/npm-run-script.md @@ -203,6 +203,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + @@ -218,6 +220,8 @@ it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-set-script.md b/deps/npm/docs/content/commands/npm-set-script.md index 2d8e87db852196..0fc267f760c81f 100644 --- a/deps/npm/docs/content/commands/npm-set-script.md +++ b/deps/npm/docs/content/commands/npm-set-script.md @@ -97,6 +97,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-uninstall.md b/deps/npm/docs/content/commands/npm-uninstall.md index 9316c686d4095c..572d9dd8aaa3d1 100644 --- a/deps/npm/docs/content/commands/npm-uninstall.md +++ b/deps/npm/docs/content/commands/npm-uninstall.md @@ -30,7 +30,7 @@ It also removes the package from the `dependencies`, `devDependencies`, `optionalDependencies`, and `peerDependencies` objects in your `package.json`. -Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm +Further, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm will update those files as well. `--no-save` will tell npm not to remove the package from your @@ -70,8 +70,7 @@ npm uninstall lodash --no-save #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. @@ -141,6 +140,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-update.md b/deps/npm/docs/content/commands/npm-update.md index aff46b1e5b5576..be0b0cb937eae2 100644 --- a/deps/npm/docs/content/commands/npm-update.md +++ b/deps/npm/docs/content/commands/npm-update.md @@ -171,8 +171,7 @@ be _downgraded_. #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. @@ -433,6 +432,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-version.md b/deps/npm/docs/content/commands/npm-version.md index 713e5ae410dfc4..8e3334d7889848 100644 --- a/deps/npm/docs/content/commands/npm-version.md +++ b/deps/npm/docs/content/commands/npm-version.md @@ -166,6 +166,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/commands/npm-view.md b/deps/npm/docs/content/commands/npm-view.md index b50b4bfb56c5d6..0ef17d8adfb39b 100644 --- a/deps/npm/docs/content/commands/npm-view.md +++ b/deps/npm/docs/content/commands/npm-view.md @@ -180,6 +180,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index 39870922c0253c..71dab98a3831e9 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -762,6 +762,8 @@ it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. +This value is not exported to the environment for child processes. + @@ -819,6 +821,8 @@ When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + @@ -1343,8 +1347,7 @@ The base URL of the npm registry. #### `save` -* Default: `true` unless when using `npm update` or `npm dedupe` where it - defaults to `false` +* Default: `true` unless when using `npm update` where it defaults to `false` * Type: Boolean Save installed packages to a `package.json` file as dependencies. diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html index 33c2a803c2a876..e9c7021a4256ff 100644 --- a/deps/npm/docs/output/commands/npm-audit.html +++ b/deps/npm/docs/output/commands/npm-audit.html @@ -439,6 +439,7 @@

include-workspace-root

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

+

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

diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html index bbacda33a5174e..8c57f50851462b 100644 --- a/deps/npm/docs/output/commands/npm-ci.html +++ b/deps/npm/docs/output/commands/npm-ci.html @@ -179,6 +179,12 @@

Description

  • It will never write to package.json or any of the package-locks: installs are essentially frozen.
  • +

    NOTE: If you create your package-lock.json file by running npm install +with flags that can affect the shape of your dependency tree, such as +--legacy-peer-deps, you must provide the same flags to npm ci or you +are likely to encounter errors. An easy way to do this is to run +npm config set legacy-peer-deps=true --location=project and commit the +.npmrc file to your repo.

    Example

    Make sure you have a package-lock and an up-to-date install:

    $ cd ./my/npm/project
    diff --git a/deps/npm/docs/output/commands/npm-dedupe.html b/deps/npm/docs/output/commands/npm-dedupe.html
    index 8d7e42ad46ac93..d364a10b2ce289 100644
    --- a/deps/npm/docs/output/commands/npm-dedupe.html
    +++ b/deps/npm/docs/output/commands/npm-dedupe.html
    @@ -142,7 +142,7 @@ 

    npm-dedupe

    Table of contents

    - +

    Synopsis

    @@ -197,11 +197,9 @@

    Description

    Note that this operation transforms the dependency tree, but will never result in new modules being installed.

    Using npm find-dupes will run the command in --dry-run mode.

    -

    Note that by default npm dedupe will not update the semver values of direct -dependencies in your project package.json, if you want to also update -values in package.json you can run: npm dedupe --save (or add the -save=true option to a configuration file -to make that the default behavior).

    +

    Note: npm dedupe will never update the semver values of direct +dependencies in your project package.json, if you want to update +values in package.json you can run: npm update --save instead.

    Configuration

    @@ -261,18 +259,6 @@

    package-lock

    This configuration does not affect npm ci.

    -

    save

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

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

    -

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

    -

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

    - -

    omit

    • Default: 'dev' if the NODE_ENV environment variable is set to @@ -394,6 +380,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-diff.html b/deps/npm/docs/output/commands/npm-diff.html index c26aa27e8a0011..13ed989c461801 100644 --- a/deps/npm/docs/output/commands/npm-diff.html +++ b/deps/npm/docs/output/commands/npm-diff.html @@ -407,6 +407,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-dist-tag.html b/deps/npm/docs/output/commands/npm-dist-tag.html index 8cadd42dcc4d26..8615aec686f79d 100644 --- a/deps/npm/docs/output/commands/npm-dist-tag.html +++ b/deps/npm/docs/output/commands/npm-dist-tag.html @@ -267,6 +267,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-docs.html b/deps/npm/docs/output/commands/npm-docs.html index c25f8abf9b7bfb..8155100d2259d9 100644 --- a/deps/npm/docs/output/commands/npm-docs.html +++ b/deps/npm/docs/output/commands/npm-docs.html @@ -233,6 +233,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-exec.html b/deps/npm/docs/output/commands/npm-exec.html index 4a5f14389c009e..7a5195ba4a2630 100644 --- a/deps/npm/docs/output/commands/npm-exec.html +++ b/deps/npm/docs/output/commands/npm-exec.html @@ -298,6 +298,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html index c5685458d9629f..02decff2e9158f 100644 --- a/deps/npm/docs/output/commands/npm-find-dupes.html +++ b/deps/npm/docs/output/commands/npm-find-dupes.html @@ -324,6 +324,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html index c8dece27945345..e2e9b01a04ea5d 100644 --- a/deps/npm/docs/output/commands/npm-init.html +++ b/deps/npm/docs/output/commands/npm-init.html @@ -348,6 +348,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html index 116cc24a81238d..507003bcae022e 100644 --- a/deps/npm/docs/output/commands/npm-install-test.html +++ b/deps/npm/docs/output/commands/npm-install-test.html @@ -174,8 +174,7 @@

      Configuration

      save

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

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

      @@ -397,6 +396,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html index 3fcc2ddf9cb821..de101873d98259 100644 --- a/deps/npm/docs/output/commands/npm-install.html +++ b/deps/npm/docs/output/commands/npm-install.html @@ -500,8 +500,7 @@

      Configuration

      save

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

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

      @@ -723,6 +722,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-link.html b/deps/npm/docs/output/commands/npm-link.html index a659cb16c26de1..daf2be56f2971d 100644 --- a/deps/npm/docs/output/commands/npm-link.html +++ b/deps/npm/docs/output/commands/npm-link.html @@ -229,8 +229,7 @@

      Configuration

      save

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

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

      @@ -440,6 +439,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 798b6f0f2ce357..51524a4f1304c3 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -166,7 +166,7 @@

      Description

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

      -
      npm@8.6.0 /path/to/npm
      +
      npm@8.7.0 /path/to/npm
       └─┬ init-package-json@0.0.4
         └── promzard@0.1.5
       
      @@ -363,6 +363,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-pack.html b/deps/npm/docs/output/commands/npm-pack.html index bdd4b01af46f04..86e45cb303ae36 100644 --- a/deps/npm/docs/output/commands/npm-pack.html +++ b/deps/npm/docs/output/commands/npm-pack.html @@ -240,6 +240,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-prune.html b/deps/npm/docs/output/commands/npm-prune.html index 08df537cf8c443..51f7798ce348d2 100644 --- a/deps/npm/docs/output/commands/npm-prune.html +++ b/deps/npm/docs/output/commands/npm-prune.html @@ -288,6 +288,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-publish.html b/deps/npm/docs/output/commands/npm-publish.html index f46fd310d0cd13..23e5f11ea0e927 100644 --- a/deps/npm/docs/output/commands/npm-publish.html +++ b/deps/npm/docs/output/commands/npm-publish.html @@ -355,6 +355,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-rebuild.html b/deps/npm/docs/output/commands/npm-rebuild.html index 139d1591ed3efc..1f0acc8d6a7102 100644 --- a/deps/npm/docs/output/commands/npm-rebuild.html +++ b/deps/npm/docs/output/commands/npm-rebuild.html @@ -269,6 +269,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-repo.html b/deps/npm/docs/output/commands/npm-repo.html index b5fedd5ac92ae6..bd2ea8644bab05 100644 --- a/deps/npm/docs/output/commands/npm-repo.html +++ b/deps/npm/docs/output/commands/npm-repo.html @@ -222,6 +222,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html index 07fc79127d0b6f..6211c2b55efcfc 100644 --- a/deps/npm/docs/output/commands/npm-run-script.html +++ b/deps/npm/docs/output/commands/npm-run-script.html @@ -290,6 +290,7 @@

      include-workspace-root

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

      +

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

      if-present

      @@ -303,6 +304,7 @@

      if-present

      it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup.

      +

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

      ignore-scripts

      diff --git a/deps/npm/docs/output/commands/npm-set-script.html b/deps/npm/docs/output/commands/npm-set-script.html index cb66491d07c406..51b29d87fa43e8 100644 --- a/deps/npm/docs/output/commands/npm-set-script.html +++ b/deps/npm/docs/output/commands/npm-set-script.html @@ -219,6 +219,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html index d8d6f7b5e6cc34..3128b7e9bb99c9 100644 --- a/deps/npm/docs/output/commands/npm-uninstall.html +++ b/deps/npm/docs/output/commands/npm-uninstall.html @@ -162,7 +162,7 @@

      Description

      It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json.

      -

      Futher, if you have an npm-shrinkwrap.json or package-lock.json, npm +

      Further, if you have an npm-shrinkwrap.json or package-lock.json, npm will update those files as well.

      --no-save will tell npm not to remove the package from your package.json, npm-shrinkwrap.json, or package-lock.json files.

      @@ -189,8 +189,7 @@

      Configuration

      save

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

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

      @@ -247,6 +246,7 @@

      include-workspace-root

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

      +

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

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

      Configuration

      save

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

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

      @@ -476,6 +475,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html index 2cb99f3bc07a66..3bab12fec165a7 100644 --- a/deps/npm/docs/output/commands/npm-version.html +++ b/deps/npm/docs/output/commands/npm-version.html @@ -276,6 +276,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html index e2b9a4ffec1ca8..0eb17026a77b39 100644 --- a/deps/npm/docs/output/commands/npm-view.html +++ b/deps/npm/docs/output/commands/npm-view.html @@ -270,6 +270,7 @@

      include-workspace-root

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

      +

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

      diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index c1f1667d85c708..be0e603ac59167 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -149,7 +149,7 @@

      Table of contents

      Version

      -

      8.6.0

      +

      8.7.0

      Description

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

      if-present

      it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup.

      +

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

      ignore-scripts

      @@ -805,6 +806,7 @@

      include-workspace-root

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

      +

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

      init-author-email

      @@ -1223,8 +1225,7 @@

      registry

      save

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

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

      diff --git a/deps/npm/lib/auth/sso.js b/deps/npm/lib/auth/sso.js index 795eb8972a2236..9812a18cb99ca6 100644 --- a/deps/npm/lib/auth/sso.js +++ b/deps/npm/lib/auth/sso.js @@ -36,8 +36,6 @@ function sleep (time) { } const login = async (npm, { creds, registry, scope }) => { - log.warn('deprecated', 'SSO --auth-type is deprecated') - const opts = { ...npm.flatOptions, creds, registry, scope } const { ssoType } = opts diff --git a/deps/npm/lib/commands/cache.js b/deps/npm/lib/commands/cache.js index b8f84abc1d9412..634c8dbb428096 100644 --- a/deps/npm/lib/commands/cache.js +++ b/deps/npm/lib/commands/cache.js @@ -177,7 +177,7 @@ class Cache extends BaseCommand { async verify () { const cache = path.join(this.npm.cache, '_cacache') const prefix = cache.indexOf(process.env.HOME) === 0 - ? `~${cache.substr(process.env.HOME.length)}` + ? `~${cache.slice(process.env.HOME.length)}` : cache const stats = await cacache.verify(cache) this.npm.output(`Cache verified and compressed (${prefix})`) diff --git a/deps/npm/lib/commands/completion.js b/deps/npm/lib/commands/completion.js index d0c68af6cebfc8..5b7e0d355c63c8 100644 --- a/deps/npm/lib/commands/completion.js +++ b/deps/npm/lib/commands/completion.js @@ -97,17 +97,17 @@ class Completion extends BaseCommand { const word = words[w] const line = COMP_LINE const point = +COMP_POINT - const partialLine = line.substr(0, point) + const partialLine = line.slice(0, point) const partialWords = words.slice(0, w) // figure out where in that last word the point is. const partialWordRaw = args[w] let i = partialWordRaw.length - while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) { + while (partialWordRaw.slice(0, i) !== partialLine.slice(-1 * i) && i > 0) { i-- } - const partialWord = unescape(partialWordRaw.substr(0, i)) + const partialWord = unescape(partialWordRaw.slice(0, i)) partialWords.push(partialWord) const opts = { diff --git a/deps/npm/lib/commands/config.js b/deps/npm/lib/commands/config.js index 690a69a3233e4f..0432abac391f38 100644 --- a/deps/npm/lib/commands/config.js +++ b/deps/npm/lib/commands/config.js @@ -266,6 +266,9 @@ ${defData} if (!long) { msg.push( `; node bin location = ${process.execPath}`, + `; node version = ${process.version}`, + `; npm local prefix = ${this.npm.localPrefix}`, + `; npm version = ${this.npm.version}`, `; cwd = ${process.cwd()}`, `; HOME = ${process.env.HOME}`, '; Run `npm config ls -l` to show all defaults.' diff --git a/deps/npm/lib/commands/dedupe.js b/deps/npm/lib/commands/dedupe.js index 4662ce3241b246..96d1ac2ae9a743 100644 --- a/deps/npm/lib/commands/dedupe.js +++ b/deps/npm/lib/commands/dedupe.js @@ -12,7 +12,6 @@ class Dedupe extends ArboristWorkspaceCmd { 'legacy-bundling', 'strict-peer-deps', 'package-lock', - 'save', 'omit', 'ignore-scripts', 'audit', @@ -29,19 +28,17 @@ class Dedupe extends ArboristWorkspaceCmd { throw er } - // In the context of `npm dedupe` the save - // config value should default to `false` - const save = this.npm.config.isDefault('save') - ? false - : this.npm.config.get('save') - const dryRun = this.npm.config.get('dry-run') const where = this.npm.prefix const opts = { ...this.npm.flatOptions, path: where, dryRun, - save, + // Saving during dedupe would only update if one of your direct + // dependencies was also duplicated somewhere in your tree. It would be + // confusing if running this were to also update your package.json. In + // order to reduce potential confusion we set this to false. + save: false, workspaces: this.workspaceNames, } const arb = new Arborist(opts) diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js index 22a25477e22e03..ca0438f1a24815 100644 --- a/deps/npm/lib/commands/doctor.js +++ b/deps/npm/lib/commands/doctor.js @@ -145,7 +145,7 @@ class Doctor extends BaseCommand { return '' } catch (er) { if (/^E\d{3}$/.test(er.code || '')) { - throw er.code.substr(1) + ' ' + er.message + throw er.code.slice(1) + ' ' + er.message } else { throw er.message } @@ -211,7 +211,7 @@ class Doctor extends BaseCommand { const gid = process.getgid() const files = new Set([root]) for (const f of files) { - tracker.silly('checkFilesPermission', f.substr(root.length + 1)) + tracker.silly('checkFilesPermission', f.slice(root.length + 1)) const st = await lstat(f).catch(er => { // if it can't be missing, or if it can and the error wasn't that it was missing if (!missingOk || er.code !== 'ENOENT') { diff --git a/deps/npm/lib/commands/help-search.js b/deps/npm/lib/commands/help-search.js index 9422b83561cc89..23b426eaa016db 100644 --- a/deps/npm/lib/commands/help-search.js +++ b/deps/npm/lib/commands/help-search.js @@ -1,6 +1,6 @@ const fs = require('fs') const path = require('path') -const color = require('ansicolors') +const chalk = require('chalk') const { promisify } = require('util') const glob = promisify(require('glob')) const readFile = promisify(fs.readFile) @@ -171,9 +171,9 @@ class HelpSearch extends BaseCommand { const finder = line.toLowerCase().split(arg.toLowerCase()) let p = 0 for (const f of finder) { - hilitLine.push(line.substr(p, f.length)) - const word = line.substr(p + f.length, arg.length) - const hilit = color.bgBlack(color.red(word)) + hilitLine.push(line.slice(p, p + f.length)) + const word = line.slice(p + f.length, p + f.length + arg.length) + const hilit = chalk.bgBlack.red(word) hilitLine.push(hilit) p += f.length + arg.length } diff --git a/deps/npm/lib/commands/install.js b/deps/npm/lib/commands/install.js index ebba02a1bd47d0..0a5c827bcc97b5 100644 --- a/deps/npm/lib/commands/install.js +++ b/deps/npm/lib/commands/install.js @@ -109,7 +109,6 @@ class Install extends ArboristWorkspaceCmd { const isGlobalInstall = this.npm.config.get('global') const where = isGlobalInstall ? globalTop : this.npm.prefix const forced = this.npm.config.get('force') - const isDev = this.npm.config.get('dev') const scriptShell = this.npm.config.get('script-shell') || undefined // be very strict about engines when trying to update npm itself @@ -140,14 +139,6 @@ class Install extends ArboristWorkspaceCmd { args = ['.'] } - // TODO: Add warnings for other deprecated flags? or remove this one? - if (isDev) { - log.warn( - 'install', - 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.' - ) - } - const opts = { ...this.npm.flatOptions, auditLevel: null, @@ -163,7 +154,7 @@ class Install extends ArboristWorkspaceCmd { 'preinstall', 'install', 'postinstall', - 'prepublish', // XXX should we remove this finally?? + 'prepublish', // XXX(npm9) should we remove this finally?? 'preprepare', 'prepare', 'postprepare', diff --git a/deps/npm/lib/commands/ls.js b/deps/npm/lib/commands/ls.js index e56c90dae16eaf..06268fe7e0ac0d 100644 --- a/deps/npm/lib/commands/ls.js +++ b/deps/npm/lib/commands/ls.js @@ -52,16 +52,12 @@ class LS extends ArboristWorkspaceCmd { const all = this.npm.config.get('all') const color = this.npm.color const depth = this.npm.config.get('depth') - const dev = this.npm.config.get('dev') - const development = this.npm.config.get('development') const global = this.npm.config.get('global') const json = this.npm.config.get('json') const link = this.npm.config.get('link') const long = this.npm.config.get('long') - const only = this.npm.config.get('only') + const omit = this.npm.flatOptions.omit const parseable = this.npm.config.get('parseable') - const prod = this.npm.config.get('prod') - const production = this.npm.config.get('production') const unicode = this.npm.config.get('unicode') const packageLockOnly = this.npm.config.get('package-lock-only') const workspacesEnabled = this.npm.flatOptions.workspacesEnabled @@ -138,15 +134,10 @@ class LS extends ArboristWorkspaceCmd { ? [] : [...(node.target).edgesOut.values()] .filter(filterBySelectedWorkspaces) - .filter(filterByEdgesTypes({ - currentDepth, - dev, - development, + .filter(currentDepth === 0 ? filterByEdgesTypes({ link, - prod, - production, - only, - })) + omit, + }) : () => true) .map(mapEdgesToNodes({ seenPaths })) .concat(appendExtraneousChildren({ node, seenPaths })) .sort(sortAlphabetically) @@ -399,27 +390,13 @@ const getJsonOutputItem = (node, { global, long }) => { return augmentItemWithIncludeMetadata(node, item) } -const filterByEdgesTypes = ({ - currentDepth, - dev, - development, - link, - prod, - production, - only, -}) => { - // filter deps by type, allows for: `npm ls --dev`, `npm ls --prod`, - // `npm ls --link`, `npm ls --only=dev`, etc - const filterDev = currentDepth === 0 && - (dev || development || /^dev(elopment)?$/.test(only)) - const filterProd = currentDepth === 0 && - (prod || production || /^prod(uction)?$/.test(only)) - const filterLink = currentDepth === 0 && link - - return (edge) => - (filterDev ? edge.dev : true) && - (filterProd ? (!edge.dev && !edge.peer && !edge.peerOptional) : true) && - (filterLink ? (edge.to && edge.to.isLink) : true) +const filterByEdgesTypes = ({ link, omit = [] }) => (edge) => { + for (const omitType of omit) { + if (edge[omitType]) { + return false + } + } + return link ? edge.to && edge.to.isLink : true } const appendExtraneousChildren = ({ node, seenPaths }) => diff --git a/deps/npm/lib/commands/outdated.js b/deps/npm/lib/commands/outdated.js index 0cb5b4247a0009..0953c17ca10d2a 100644 --- a/deps/npm/lib/commands/outdated.js +++ b/deps/npm/lib/commands/outdated.js @@ -2,8 +2,7 @@ const os = require('os') const path = require('path') const pacote = require('pacote') const table = require('text-table') -const color = require('chalk') -const styles = require('ansistyles') +const chalk = require('chalk') const npa = require('npm-package-arg') const pickManifest = require('npm-pick-manifest') const localeCompare = require('@isaacs/string-locale-compare')('en') @@ -106,7 +105,7 @@ class Outdated extends ArboristWorkspaceCmd { const outTable = [outHead].concat(outList) if (this.npm.color) { - outTable[0] = outTable[0].map(heading => styles.underline(heading)) + outTable[0] = outTable[0].map(heading => chalk.underline(heading)) } const tableOpts = { @@ -208,7 +207,7 @@ class Outdated extends ArboristWorkspaceCmd { : edge.dev ? 'devDependencies' : 'dependencies' - for (const omitType of this.npm.config.get('omit')) { + for (const omitType of this.npm.flatOptions.omit) { if (node[omitType]) { return } @@ -282,7 +281,7 @@ class Outdated extends ArboristWorkspaceCmd { : node.name return this.npm.color && humanOutput - ? color.green(workspaceName) + ? chalk.green(workspaceName) : workspaceName } @@ -307,9 +306,9 @@ class Outdated extends ArboristWorkspaceCmd { } if (this.npm.color) { - columns[0] = color[current === wanted ? 'yellow' : 'red'](columns[0]) // current - columns[2] = color.green(columns[2]) // wanted - columns[3] = color.magenta(columns[3]) // latest + columns[0] = chalk[current === wanted ? 'yellow' : 'red'](columns[0]) // current + columns[2] = chalk.green(columns[2]) // wanted + columns[3] = chalk.magenta(columns[3]) // latest } return columns diff --git a/deps/npm/lib/commands/profile.js b/deps/npm/lib/commands/profile.js index a82d31fd443a9e..fcf0eb7d53fa69 100644 --- a/deps/npm/lib/commands/profile.js +++ b/deps/npm/lib/commands/profile.js @@ -1,6 +1,6 @@ const inspect = require('util').inspect const { URL } = require('url') -const ansistyles = require('ansistyles') +const chalk = require('chalk') const log = require('../utils/log-shim.js') const npmProfile = require('npm-profile') const qrcodeTerminal = require('qrcode-terminal') @@ -163,7 +163,7 @@ class Profile extends BaseCommand { } else { const table = new Table() for (const key of Object.keys(cleaned)) { - table.push({ [ansistyles.bright(key)]: cleaned[key] }) + table.push({ [chalk.bold(key)]: cleaned[key] }) } this.npm.output(table.toString()) diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js index 1f26370e89a567..51861c5aa35547 100644 --- a/deps/npm/lib/commands/publish.js +++ b/deps/npm/lib/commands/publish.js @@ -102,19 +102,24 @@ class Publish extends BaseCommand { logTar(pkgContents, { unicode }) } - if (!dryRun) { - const resolved = npa.resolve(manifest.name, manifest.version) - const registry = npmFetch.pickRegistry(resolved, opts) - const creds = this.npm.config.getCredentialsByURI(registry) - const outputRegistry = replaceInfo(registry) - if (!creds.token && !creds.username) { - throw Object.assign( - new Error(`This command requires you to be logged in to ${outputRegistry}`), { - code: 'ENEEDAUTH', - } - ) + const resolved = npa.resolve(manifest.name, manifest.version) + const registry = npmFetch.pickRegistry(resolved, opts) + const creds = this.npm.config.getCredentialsByURI(registry) + const noCreds = !creds.token && !creds.username + const outputRegistry = replaceInfo(registry) + + if (noCreds) { + const msg = `This command requires you to be logged in to ${outputRegistry}` + if (dryRun) { + log.warn('', `${msg} (dry-run)`) + } else { + throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) } - log.notice('', `Publishing to ${outputRegistry}`) + } + + log.notice('', `Publishing to ${outputRegistry}${dryRun ? ' (dry-run)' : ''}`) + + if (!dryRun) { await otplease(opts, opts => libpub(manifest, tarballData, opts)) } diff --git a/deps/npm/lib/commands/token.js b/deps/npm/lib/commands/token.js index f57c212c49e458..edfb07b9d3a9a4 100644 --- a/deps/npm/lib/commands/token.js +++ b/deps/npm/lib/commands/token.js @@ -1,5 +1,5 @@ const Table = require('cli-table3') -const ansistyles = require('ansistyles') +const chalk = require('chalk') const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr') const log = require('../utils/log-shim.js') const profile = require('npm-profile') @@ -161,7 +161,7 @@ class Token extends BaseCommand { } else { const table = new Table() for (const k of Object.keys(result)) { - table.push({ [ansistyles.bright(k)]: String(result[k]) }) + table.push({ [chalk.bold(k)]: String(result[k]) }) } this.npm.output(table.toString()) } diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js index 99cf2981306fa5..403d09d813dc7e 100644 --- a/deps/npm/lib/commands/view.js +++ b/deps/npm/lib/commands/view.js @@ -3,7 +3,7 @@ // npm view [pkg [pkg ...]] -const color = require('ansicolors') +const chalk = require('chalk') const columns = require('cli-columns') const fs = require('fs') const jsonParse = require('json-parse-even-better-errors') @@ -13,7 +13,6 @@ const { resolve } = require('path') const formatBytes = require('../utils/format-bytes.js') const relativeDate = require('tiny-relative-date') const semver = require('semver') -const style = require('ansistyles') const { inspect, promisify } = require('util') const { packument } = require('pacote') @@ -318,34 +317,34 @@ class View extends BaseCommand { Object.keys(packument['dist-tags']).forEach((t) => { const version = packument['dist-tags'][t] - tags.push(`${style.bright(color.green(t))}: ${version}`) + tags.push(`${chalk.bold.green(t)}: ${version}`) }) const unpackedSize = manifest.dist.unpackedSize && formatBytes(manifest.dist.unpackedSize, true) const licenseField = manifest.license || 'Proprietary' const info = { - name: color.green(manifest.name), - version: color.green(manifest.version), - bins: Object.keys(manifest.bin || {}).map(color.yellow), - versions: color.yellow(packument.versions.length + ''), + name: chalk.green(manifest.name), + version: chalk.green(manifest.version), + bins: Object.keys(manifest.bin || {}), + versions: chalk.yellow(packument.versions.length + ''), description: manifest.description, deprecated: manifest.deprecated, - keywords: (packument.keywords || []).map(color.yellow), + keywords: packument.keywords || [], license: typeof licenseField === 'string' ? licenseField : (licenseField.type || 'Proprietary'), deps: Object.keys(manifest.dependencies || {}).map((dep) => { - return `${color.yellow(dep)}: ${manifest.dependencies[dep]}` + return `${chalk.yellow(dep)}: ${manifest.dependencies[dep]}` }), publisher: manifest._npmUser && unparsePerson({ - name: color.yellow(manifest._npmUser.name), - email: color.cyan(manifest._npmUser.email), + name: chalk.yellow(manifest._npmUser.name), + email: chalk.cyan(manifest._npmUser.email), }), modified: !packument.time ? undefined - : color.yellow(relativeDate(packument.time[manifest.version])), + : chalk.yellow(relativeDate(packument.time[manifest.version])), maintainers: (packument.maintainers || []).map((u) => unparsePerson({ - name: color.yellow(u.name), - email: color.cyan(u.email), + name: chalk.yellow(u.name), + email: chalk.cyan(u.email), })), repo: ( manifest.bugs && (manifest.bugs.url || manifest.bugs) @@ -356,47 +355,47 @@ class View extends BaseCommand { manifest.homepage && (manifest.homepage.url || manifest.homepage) ), tags, - tarball: color.cyan(manifest.dist.tarball), - shasum: color.yellow(manifest.dist.shasum), + tarball: chalk.cyan(manifest.dist.tarball), + shasum: chalk.yellow(manifest.dist.shasum), integrity: - manifest.dist.integrity && color.yellow(manifest.dist.integrity), + manifest.dist.integrity && chalk.yellow(manifest.dist.integrity), fileCount: - manifest.dist.fileCount && color.yellow(manifest.dist.fileCount), - unpackedSize: unpackedSize && color.yellow(unpackedSize), + manifest.dist.fileCount && chalk.yellow(manifest.dist.fileCount), + unpackedSize: unpackedSize && chalk.yellow(unpackedSize), } if (info.license.toLowerCase().trim() === 'proprietary') { - info.license = style.bright(color.red(info.license)) + info.license = chalk.bold.red(info.license) } else { - info.license = color.green(info.license) + info.license = chalk.green(info.license) } console.log('') console.log( - style.underline(style.bright(`${info.name}@${info.version}`)) + + chalk.underline.bold(`${info.name}@${info.version}`) + ' | ' + info.license + - ' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) + + ' | deps: ' + (info.deps.length ? chalk.cyan(info.deps.length) : chalk.green('none')) + ' | versions: ' + info.versions ) info.description && console.log(info.description) if (info.repo || info.site) { - info.site && console.log(color.cyan(info.site)) + info.site && console.log(chalk.cyan(info.site)) } const warningSign = unicode ? ' ⚠️ ' : '!!' info.deprecated && console.log( - `\n${style.bright(color.red('DEPRECATED'))}${ + `\n${chalk.bold.red('DEPRECATED')}${ warningSign } - ${info.deprecated}` ) if (info.keywords.length) { console.log('') - console.log('keywords:', info.keywords.join(', ')) + console.log('keywords:', chalk.yellow(info.keywords.join(', '))) } if (info.bins.length) { console.log('') - console.log('bin:', info.bins.join(', ')) + console.log('bin:', chalk.yellow(info.bins.join(', '))) } console.log('') diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 74825c97c2355f..c819a0807b507d 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -131,6 +131,7 @@ class Npm extends EventEmitter { const isGlobal = this.config.get('global') const workspacesEnabled = this.config.get('workspaces') + // if cwd is a workspace, the default is set to [that workspace] const implicitWorkspace = this.config.get('workspace', 'default').length > 0 const workspacesFilters = this.config.get('workspace') const includeWorkspaceRoot = this.config.get('include-workspace-root') @@ -138,6 +139,8 @@ class Npm extends EventEmitter { // or when it is implicit and not in our ignore list const hasWorkspaceFilters = workspacesFilters.length > 0 const invalidWorkspaceConfig = workspacesEnabled === false && hasWorkspaceFilters + + // (-ws || -w foo) && (cwd is not a workspace || command is not ignoring implicit workspaces) const filterByWorkspaces = (workspacesEnabled || hasWorkspaceFilters) && (!implicitWorkspace || !command.ignoreImplicitWorkspace) // normally this would go in the constructor, but our tests don't diff --git a/deps/npm/lib/search/format-package-stream.js b/deps/npm/lib/search/format-package-stream.js index 7ff44e9e2049dd..acead79e1a7706 100644 --- a/deps/npm/lib/search/format-package-stream.js +++ b/deps/npm/lib/search/format-package-stream.js @@ -111,7 +111,7 @@ function addColorMarker (str, arg, i) { if (arg.charAt(0) === '/') { return str.replace( - new RegExp(arg.substr(1, arg.length - 2), 'gi'), + new RegExp(arg.slice(1, -1), 'gi'), bit => markStart + bit + markEnd ) } @@ -121,9 +121,9 @@ function addColorMarker (str, arg, i) { var p = 0 return pieces.map(function (piece) { - piece = str.substr(p, piece.length) + piece = str.slice(p, p + piece.length) var mark = markStart + - str.substr(p + piece.length, arg.length) + + str.slice(p + piece.length, p + piece.length + arg.length) + markEnd p += piece.length + arg.length return piece + mark diff --git a/deps/npm/lib/search/package-filter.js b/deps/npm/lib/search/package-filter.js index 45a67835b8c4a0..bb0ae679bdccd9 100644 --- a/deps/npm/lib/search/package-filter.js +++ b/deps/npm/lib/search/package-filter.js @@ -36,7 +36,7 @@ function filterWords (data, include, exclude, opts) { function match (words, pattern) { if (pattern.charAt(0) === '/') { pattern = pattern.replace(/\/$/, '') - pattern = new RegExp(pattern.substr(1, pattern.length - 1)) + pattern = new RegExp(pattern.slice(1)) return words.match(pattern) } return words.indexOf(pattern) !== -1 diff --git a/deps/npm/lib/utils/config/definition.js b/deps/npm/lib/utils/config/definition.js index fc46bc3d6a5efa..f88d8334cf01fb 100644 --- a/deps/npm/lib/utils/config/definition.js +++ b/deps/npm/lib/utils/config/definition.js @@ -233,7 +233,7 @@ const wrapAll = s => { return ( '* ' + block - .substr(1) + .slice(1) .trim() .split('\n* ') .map(li => { diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index efc1f72a020594..7ff0eeb1283c5c 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -880,6 +880,7 @@ define('https-proxy', { define('if-present', { default: false, type: Boolean, + envExport: false, description: ` If true, npm will not exit with an error code when \`run-script\` is invoked for a script that isn't defined in the \`scripts\` section of @@ -938,6 +939,7 @@ define('include-staged', { define('include-workspace-root', { default: false, type: Boolean, + envExport: false, description: ` Include the workspace root when workspaces are enabled for a command. @@ -1605,8 +1607,8 @@ define('registry', { define('save', { default: true, - defaultDescription: `\`true\` unless when using \`npm update\` or - \`npm dedupe\` where it defaults to \`false\``, + defaultDescription: `\`true\` unless when using \`npm update\` where it + defaults to \`false\``, usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle', type: Boolean, short: 'S', diff --git a/deps/npm/lib/utils/npm-usage.js b/deps/npm/lib/utils/npm-usage.js index 8d31f0155098bd..431995ecf0bae3 100644 --- a/deps/npm/lib/utils/npm-usage.js +++ b/deps/npm/lib/utils/npm-usage.js @@ -53,7 +53,7 @@ const wrap = (arr) => { out[l] = c } } - return out.join('\n ').substr(2) + return out.join('\n ').slice(2) } const usages = async (npm) => { diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index 2f2773c6d49bca..0a74ce8c444343 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -48,9 +48,9 @@ const logTar = (tarball, opts = {}) => { { name: 'integrity:', value: - tarball.integrity.toString().substr(0, 20) + + tarball.integrity.toString().slice(0, 20) + '[...]' + - tarball.integrity.toString().substr(80), + tarball.integrity.toString().slice(80), }, tarball.bundled.length && { name: 'bundled deps:', value: tarball.bundled.length }, tarball.bundled.length && { diff --git a/deps/npm/lib/utils/update-notifier.js b/deps/npm/lib/utils/update-notifier.js index dde0202b76fe26..75e944407ffbd8 100644 --- a/deps/npm/lib/utils/update-notifier.js +++ b/deps/npm/lib/utils/update-notifier.js @@ -11,6 +11,8 @@ const stat = promisify(require('fs').stat) const writeFile = promisify(require('fs').writeFile) const { resolve } = require('path') +const SKIP = Symbol('SKIP') + const isGlobalNpmUpdate = npm => { return npm.flatOptions.global && ['install', 'update'].includes(npm.command) && @@ -38,7 +40,7 @@ const updateNotifier = async (npm, spec = 'latest') => { if (!npm.config.get('update-notifier') || isGlobalNpmUpdate(npm) || ciDetect()) { - return null + return SKIP } // if we're on a prerelease train, then updates are coming fast @@ -118,6 +120,12 @@ const updateNotifier = async (npm, spec = 'latest') => { // only update the notification timeout if we actually finished checking module.exports = async npm => { const notification = await updateNotifier(npm) + + // dont write the file if we skipped checking altogether + if (notification === SKIP) { + return null + } + // intentional. do not await this. it's a best-effort update. if this // fails, it's ok. might be using /dev/null as the cache or something weird // like that. diff --git a/deps/npm/lib/workspaces/get-workspaces.js b/deps/npm/lib/workspaces/get-workspaces.js index 0cddae2a462f11..373af1d689cc31 100644 --- a/deps/npm/lib/workspaces/get-workspaces.js +++ b/deps/npm/lib/workspaces/get-workspaces.js @@ -1,8 +1,11 @@ -const { resolve } = require('path') +const { resolve, relative } = require('path') const mapWorkspaces = require('@npmcli/map-workspaces') const minimatch = require('minimatch') const rpj = require('read-package-json-fast') +// minimatch wants forward slashes only for glob patterns +const globify = pattern => pattern.split('\\').join('/') + // Returns an Map of paths to workspaces indexed by workspace name // { foo => '/path/to/foo' } const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => { @@ -20,9 +23,16 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom for (const filterArg of filters) { for (const [workspaceName, workspacePath] of workspaces.entries()) { + let relativePath = relative(relativeFrom, workspacePath) + if (filterArg.startsWith('./')) { + relativePath = `./${relativePath}` + } + const relativeFilter = relative(path, filterArg) if (filterArg === workspaceName - || resolve(relativeFrom || path, filterArg) === workspacePath - || minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) { + || resolve(relativeFrom, filterArg) === workspacePath + || minimatch(relativePath, `${globify(relativeFilter)}/*`) + || minimatch(relativePath, `${globify(filterArg)}/*`) + ) { res.set(workspaceName, workspacePath) } } diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index ecf4b13f31a3f1..79ca419e53b813 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" "March 2022" "" "" +.TH "NPM\-ACCESS" "1" "April 2022" "" "" .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 d57a19f1ff3973..6e755bf90e968e 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" "March 2022" "" "" +.TH "NPM\-ADDUSER" "1" "April 2022" "" "" .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 0300ff2b54a75f..f16e4d847bcc43 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" "March 2022" "" "" +.TH "NPM\-AUDIT" "1" "April 2022" "" "" .SH "NAME" \fBnpm-audit\fR \- Run a security audit .SS Synopsis @@ -421,6 +421,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 2da563d0d630a6..b6229ecc46433f 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "March 2022" "" "" +.TH "NPM\-BIN" "1" "April 2022" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 7020651beac9b6..d211456d50e94f 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" "March 2022" "" "" +.TH "NPM\-BUGS" "1" "April 2022" "" "" .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 bb1f5f04cac7b3..a57d0343e0de72 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" "March 2022" "" "" +.TH "NPM\-CACHE" "1" "April 2022" "" "" .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 b45c68b611a4af..eac2197c2ad3f8 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" "March 2022" "" "" +.TH "NPM\-CI" "1" "April 2022" "" "" .SH "NAME" \fBnpm-ci\fR \- Install a project with a clean slate .SS Synopsis @@ -45,6 +45,13 @@ It will never write to \fBpackage\.json\fP or any of the package\-locks: installs are essentially frozen\. .RE +.P +NOTE: If you create your \fBpackage\-lock\.json\fP file by running \fBnpm install\fP +with flags that can affect the shape of your dependency tree, such as +\fB\-\-legacy\-peer\-deps\fP, you \fImust\fR provide the same flags to \fBnpm ci\fP or you +are likely to encounter errors\. An easy way to do this is to run +\fBnpm config set legacy\-peer\-deps=true \-\-location=project\fP and commit the +\fB\|\.npmrc\fP file to your repo\. .SS Example .P Make sure you have a package\-lock and an up\-to\-date install: diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index bf49d6f9d2b278..6b829353d44896 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" "March 2022" "" "" +.TH "NPM\-COMPLETION" "1" "April 2022" "" "" .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 aebd1b749270db..4517877124b65c 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" "March 2022" "" "" +.TH "NPM\-CONFIG" "1" "April 2022" "" "" .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 416a6dbfd8574c..4a49a555a2314a 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" "March 2022" "" "" +.TH "NPM\-DEDUPE" "1" "April 2022" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication in the package tree .SS Synopsis @@ -75,11 +75,9 @@ result in new modules being installed\. .P Using \fBnpm find\-dupes\fP will run the command in \fB\-\-dry\-run\fP mode\. .P -Note that by default \fBnpm dedupe\fP will not update the semver values of direct -dependencies in your project \fBpackage\.json\fP, if you want to also update -values in \fBpackage\.json\fP you can run: \fBnpm dedupe \-\-save\fP (or add the -\fBsave=true\fP option to a npm help configuration file -to make that the default behavior)\. +Note: \fBnpm dedupe\fP will never update the semver values of direct +dependencies in your project \fBpackage\.json\fP, if you want to update +values in \fBpackage\.json\fP you can run: \fBnpm update \-\-save\fP instead\. .SS Configuration .SS \fBglobal\-style\fP .RS 0 @@ -148,22 +146,6 @@ modules will also be disabled\. To remove extraneous modules with package\-locks disabled use \fBnpm prune\fP\|\. .P This configuration does not affect \fBnpm ci\fP\|\. -.SS \fBsave\fP -.RS 0 -.IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP -.IP \(bu 2 -Type: Boolean - -.RE -.P -Save installed packages to a \fBpackage\.json\fP file as dependencies\. -.P -When used with the \fBnpm rm\fP command, removes the dependency from -\fBpackage\.json\fP\|\. -.P -Will also prevent writing to \fBpackage\-lock\.json\fP if set to \fBfalse\fP\|\. .SS \fBomit\fP .RS 0 .IP \(bu 2 @@ -324,6 +306,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 9a7c6a9b0a6bca..bf7fcfe728cd0b 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" "March 2022" "" "" +.TH "NPM\-DEPRECATE" "1" "April 2022" "" "" .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 3c83d101dcd14d..6da0dd52e189e5 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" "March 2022" "" "" +.TH "NPM\-DIFF" "1" "April 2022" "" "" .SH "NAME" \fBnpm-diff\fR \- The registry diff command .SS Synopsis @@ -333,6 +333,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SH See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 5cdb18afd140af..7130524d2642df 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" "March 2022" "" "" +.TH "NPM\-DIST\-TAG" "1" "April 2022" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SS Synopsis @@ -159,6 +159,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 0886499fbb8012..62a633dff1c397 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" "March 2022" "" "" +.TH "NPM\-DOCS" "1" "April 2022" "" "" .SH "NAME" \fBnpm-docs\fR \- Open documentation for a package in a web browser .SS Synopsis @@ -111,6 +111,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 4911594cdf6714..6a3b9b20fb3bda 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" "March 2022" "" "" +.TH "NPM\-DOCTOR" "1" "April 2022" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your npm environment .SS Synopsis diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 093b4eee80ad87..433e8f7b4ae5c9 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" "March 2022" "" "" +.TH "NPM\-EDIT" "1" "April 2022" "" "" .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 d167e944d48593..01db093870fb9d 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" "March 2022" "" "" +.TH "NPM\-EXEC" "1" "April 2022" "" "" .SH "NAME" \fBnpm-exec\fR \- Run a command from a local or remote npm package .SS Synopsis @@ -215,6 +215,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS Examples .P Run the version of \fBtap\fP in the local dependencies, with the provided diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1 index 5ce2a82f87f95e..a8d343c1d19f5a 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" "March 2022" "" "" +.TH "NPM\-EXPLAIN" "1" "April 2022" "" "" .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 42587d6cfa43eb..cdb01df980fedb 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" "March 2022" "" "" +.TH "NPM\-EXPLORE" "1" "April 2022" "" "" .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 5c50a0854bc119..d52a9aa5260342 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" "March 2022" "" "" +.TH "NPM\-FIND\-DUPES" "1" "April 2022" "" "" .SH "NAME" \fBnpm-find-dupes\fR \- Find duplication in the package tree .SS Synopsis @@ -224,6 +224,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index a0b064f8b07dda..d501652230fa85 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" "March 2022" "" "" +.TH "NPM\-FUND" "1" "April 2022" "" "" .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 718afcb9669389..73ac93576c840d 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" "March 2022" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "April 2022" "" "" .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 bd97ddf9355131..8af1b37e83c135 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" "March 2022" "" "" +.TH "NPM\-HELP" "1" "April 2022" "" "" .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 f4423a7c174b22..32d92b03bc0fb4 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" "March 2022" "" "" +.TH "NPM\-HOOK" "1" "April 2022" "" "" .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 54e8ab0a028020..30d3890d21f12d 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" "March 2022" "" "" +.TH "NPM\-INIT" "1" "April 2022" "" "" .SH "NAME" \fBnpm-init\fR \- Create a package\.json file .SS Synopsis @@ -300,6 +300,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index f65e712ea5ec84..3c253a0364c1c2 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" "March 2022" "" "" +.TH "NPM\-INSTALL\-CI\-TEST" "1" "April 2022" "" "" .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 0bd50342fa63bf..7479f9371ea981 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" "March 2022" "" "" +.TH "NPM\-INSTALL\-TEST" "1" "April 2022" "" "" .SH "NAME" \fBnpm-install-test\fR \- Install package(s) and run tests .SS Synopsis @@ -27,8 +27,7 @@ takes exactly the same arguments as \fBnpm install\fP\|\. .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean @@ -315,6 +314,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 2f47c0865d6be3..cc83443f5447b8 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" "March 2022" "" "" +.TH "NPM\-INSTALL" "1" "April 2022" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SS Synopsis @@ -438,8 +438,7 @@ These are some of the most common options related to installation\. .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean @@ -726,6 +725,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS Algorithm .P Given a \fBpackage{dep}\fP structure: \fBA{B,C}, B{C}, C{D}\fP, diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index e565a454847932..5911d4751b7f6b 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" "March 2022" "" "" +.TH "NPM\-LINK" "1" "April 2022" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SS Synopsis @@ -116,8 +116,7 @@ workspace(s)\. .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean @@ -389,6 +388,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index e63b591fe72880..01dd67cdc1b481 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" "March 2022" "" "" +.TH "NPM\-LOGOUT" "1" "April 2022" "" "" .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 6e7e9acae0b61e..1a55f04bc023d8 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" "March 2022" "" "" +.TH "NPM\-LS" "1" "April 2022" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SS Synopsis @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@8\.6\.0 /path/to/npm +npm@8\.7\.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi @@ -284,6 +284,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 77701c6738bc8d..841a3b5d7a4251 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" "March 2022" "" "" +.TH "NPM\-ORG" "1" "April 2022" "" "" .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 330aca0503cd4a..46921b5a8ef0df 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" "March 2022" "" "" +.TH "NPM\-OUTDATED" "1" "April 2022" "" "" .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 b60b80f28378c1..d67b4cf339fd6e 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" "March 2022" "" "" +.TH "NPM\-OWNER" "1" "April 2022" "" "" .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 206c6057afb37e..3eabcc79878c30 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" "March 2022" "" "" +.TH "NPM\-PACK" "1" "April 2022" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SS Synopsis @@ -121,6 +121,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS Description .P For anything that's installable (that is, a package folder, tarball, diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 4ae37674989f0b..c564f5fdeacd20 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" "March 2022" "" "" +.TH "NPM\-PING" "1" "April 2022" "" "" .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 2bc2f48303c205..577e030d42c4b1 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" "March 2022" "" "" +.TH "NPM\-PKG" "1" "April 2022" "" "" .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 acc0c5fc7fb346..356ad4e8636b93 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" "March 2022" "" "" +.TH "NPM\-PREFIX" "1" "April 2022" "" "" .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 622880773bc411..d546955b8b6afd 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" "March 2022" "" "" +.TH "NPM\-PROFILE" "1" "April 2022" "" "" .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 f0f1583f8d8ac5..81850d8a836278 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" "March 2022" "" "" +.TH "NPM\-PRUNE" "1" "April 2022" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SS Synopsis @@ -184,6 +184,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index f879ff21168d1f..4fabf6e3687545 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" "March 2022" "" "" +.TH "NPM\-PUBLISH" "1" "April 2022" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SS Synopsis @@ -236,6 +236,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index b02aeeb7ddbf96..0ff22d856bbb68 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" "March 2022" "" "" +.TH "NPM\-REBUILD" "1" "April 2022" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SS Synopsis @@ -157,6 +157,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index e5d167428c0100..0b298e82969ef5 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" "March 2022" "" "" +.TH "NPM\-REPO" "1" "April 2022" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SS Synopsis @@ -98,6 +98,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 9fdf7db30c8b34..5ce2cc44c48ad3 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" "March 2022" "" "" +.TH "NPM\-RESTART" "1" "April 2022" "" "" .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 6a840aad12f426..dcc8c34de675bb 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" "March 2022" "" "" +.TH "NPM\-ROOT" "1" "April 2022" "" "" .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 c25ee88f66d3df..edf0561cec05b3 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" "March 2022" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "April 2022" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SS Synopsis @@ -212,6 +212,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS \fBif\-present\fP .RS 0 .IP \(bu 2 @@ -227,6 +229,8 @@ This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails\. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup\. +.P +This value is not exported to the environment for child processes\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index da2d25f5cfdff6..ae56a5687ea8c2 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" "March 2022" "" "" +.TH "NPM\-SEARCH" "1" "April 2022" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-set-script.1 b/deps/npm/man/man1/npm-set-script.1 index 61c17539914c87..e82c766a83fb46 100644 --- a/deps/npm/man/man1/npm-set-script.1 +++ b/deps/npm/man/man1/npm-set-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SET\-SCRIPT" "1" "March 2022" "" "" +.TH "NPM\-SET\-SCRIPT" "1" "April 2022" "" "" .SH "NAME" \fBnpm-set-script\fR \- Set tasks in the scripts section of package\.json .SS Synopsis @@ -98,6 +98,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index fc6d99e811032b..bd17cbf0090b62 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" "March 2022" "" "" +.TH "NPM\-SHRINKWRAP" "1" "April 2022" "" "" .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 fe5bf3652dffbc..0bae2d1c1ce292 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" "March 2022" "" "" +.TH "NPM\-STAR" "1" "April 2022" "" "" .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 a269c1b09bbbc5..65ed2aff68186c 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" "March 2022" "" "" +.TH "NPM\-STARS" "1" "April 2022" "" "" .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 cda6810098d953..4f2044a5435780 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" "March 2022" "" "" +.TH "NPM\-START" "1" "April 2022" "" "" .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 b324e2d5fb2d83..487837323a6f8a 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" "March 2022" "" "" +.TH "NPM\-STOP" "1" "April 2022" "" "" .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 c712b488b35121..31a27eaaf7b211 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" "March 2022" "" "" +.TH "NPM\-TEAM" "1" "April 2022" "" "" .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 88a938b77fc2cc..b2e4dd13f0996a 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" "March 2022" "" "" +.TH "NPM\-TEST" "1" "April 2022" "" "" .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 0a509895bcae6d..b95b41974f5512 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" "March 2022" "" "" +.TH "NPM\-TOKEN" "1" "April 2022" "" "" .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 0638b2f728ac79..2079d56b8a5cf2 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" "March 2022" "" "" +.TH "NPM\-UNINSTALL" "1" "April 2022" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SS Synopsis @@ -19,7 +19,7 @@ It also removes the package from the \fBdependencies\fP, \fBdevDependencies\fP, \fBoptionalDependencies\fP, and \fBpeerDependencies\fP objects in your \fBpackage\.json\fP\|\. .P -Futher, if you have an \fBnpm\-shrinkwrap\.json\fP or \fBpackage\-lock\.json\fP, npm +Further, if you have an \fBnpm\-shrinkwrap\.json\fP or \fBpackage\-lock\.json\fP, npm will update those files as well\. .P \fB\-\-no\-save\fP will tell npm not to remove the package from your @@ -58,8 +58,7 @@ npm uninstall lodash \-\-no\-save .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean @@ -139,6 +138,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index f7a6f6342e7123..7303db9137420b 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" "March 2022" "" "" +.TH "NPM\-UNPUBLISH" "1" "April 2022" "" "" .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 484c6335375c39..ed84041591e119 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" "March 2022" "" "" +.TH "NPM\-UNSTAR" "1" "April 2022" "" "" .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 39ab75c9be426a..073f791ac089b0 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" "March 2022" "" "" +.TH "NPM\-UPDATE" "1" "April 2022" "" "" .SH "NAME" \fBnpm-update\fR \- Update packages .SS Synopsis @@ -162,8 +162,7 @@ be \fIdowngraded\fR\|\. .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean @@ -439,6 +438,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 39bd8465b05845..8d24aed5274dea 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" "March 2022" "" "" +.TH "NPM\-VERSION" "1" "April 2022" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SS Synopsis @@ -165,6 +165,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS Description .P Run this in a package directory to bump the version and write the new data diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index f255dc4edb4a20..877d8a8aa3d870 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" "March 2022" "" "" +.TH "NPM\-VIEW" "1" "April 2022" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SS Synopsis @@ -198,6 +198,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS Output .P If only a single string field for a single version is output, then it diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 0d87635d567667..607d1a55c5e1e5 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" "March 2022" "" "" +.TH "NPM\-WHOAMI" "1" "April 2022" "" "" .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 cabc07a0110a85..c6adaa2b527d80 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,10 +1,10 @@ -.TH "NPM" "1" "March 2022" "" "" +.TH "NPM" "1" "April 2022" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis .SS Version .P -8\.6\.0 +8\.7\.0 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index cc364c8ef8d928..c1230a949228e3 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "March 2022" "" "" +.TH "NPX" "1" "April 2022" "" "" .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 87255b5e24653e..10e161c6796751 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "March 2022" "" "" +.TH "FOLDERS" "5" "April 2022" "" "" .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 831a879d1764f7..ccccf3a696fdad 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "March 2022" "" "" +.TH "INSTALL" "5" "April 2022" "" "" .SH "NAME" \fBinstall\fR \- Download and install node and npm .SS Description diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5 index ee0c2e1845a100..dcc5cca516ae0b 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" "March 2022" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "April 2022" "" "" .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 cdab17bb7fb1d0..0e3e8edefa21a3 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "March 2022" "" "" +.TH "NPMRC" "5" "April 2022" "" "" .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 99116b6a78517a..b799144aaa36c0 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" "March 2022" "" "" +.TH "PACKAGE\.JSON" "5" "April 2022" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SS Description diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index b4012e30616321..dd0d17b88cb4a2 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" "March 2022" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "April 2022" "" "" .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 e5e112c5ab0a5e..ee680d515c9a24 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "March 2022" "" "" +.TH "CONFIG" "7" "April 2022" "" "" .SH "NAME" \fBconfig\fR \- More than you probably want to know about npm configuration .SS Description @@ -821,6 +821,8 @@ This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails\. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup\. +.P +This value is not exported to the environment for child processes\. .SS \fBignore\-scripts\fP .RS 0 .IP \(bu 2 @@ -878,6 +880,8 @@ Include the workspace root when workspaces are enabled for a command\. When false, specifying individual workspaces via the \fBworkspace\fP config, or all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on the specified workspaces, and not on the root project\. +.P +This value is not exported to the environment for child processes\. .SS \fBinit\-author\-email\fP .RS 0 .IP \(bu 2 @@ -1405,8 +1409,7 @@ The base URL of the npm registry\. .SS \fBsave\fP .RS 0 .IP \(bu 2 -Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it -defaults to \fBfalse\fP +Default: \fBtrue\fP unless when using \fBnpm update\fP where it defaults to \fBfalse\fP .IP \(bu 2 Type: Boolean diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index cb75afe9d15bac..7b50a0dc6c5acf 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "March 2022" "" "" +.TH "DEVELOPERS" "7" "April 2022" "" "" .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 c410678f5daad7..41634c61a61bb9 100644 --- a/deps/npm/man/man7/logging.7 +++ b/deps/npm/man/man7/logging.7 @@ -1,4 +1,4 @@ -.TH "LOGGING" "7" "March 2022" "" "" +.TH "LOGGING" "7" "April 2022" "" "" .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 434668e735035f..0df926774952c2 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "March 2022" "" "" +.TH "ORGS" "7" "April 2022" "" "" .SH "NAME" \fBorgs\fR \- Working with Teams & Orgs .SS Description diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index 060d2cc3777e61..dcdb33934bea20 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "March 2022" "" "" +.TH "REGISTRY" "7" "April 2022" "" "" .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 699bac4d77797e..5743d339ecd144 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "March 2022" "" "" +.TH "REMOVAL" "7" "April 2022" "" "" .SH "NAME" \fBremoval\fR \- Cleaning the Slate .SS Synopsis diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index 35c40248e1149b..43faee6693540f 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "March 2022" "" "" +.TH "SCOPE" "7" "April 2022" "" "" .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 722faa7b165c96..9cedf62bc8cbf1 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "March 2022" "" "" +.TH "SCRIPTS" "7" "April 2022" "" "" .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 fbbcbdf7fb48ce..b5d6b3bde3ddb6 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "March 2022" "" "" +.TH "WORKSPACES" "7" "April 2022" "" "" .SH "NAME" \fBworkspaces\fR \- Working with workspaces .SS Description diff --git a/deps/npm/node_modules/@npmcli/arborist/README.md b/deps/npm/node_modules/@npmcli/arborist/README.md index ee79a3bf2f7ae8..e4a58239a0e085 100644 --- a/deps/npm/node_modules/@npmcli/arborist/README.md +++ b/deps/npm/node_modules/@npmcli/arborist/README.md @@ -1,5 +1,9 @@ # @npmcli/arborist +[![npm version](https://img.shields.io/npm/v/@npmcli/arborist.svg)](https://npm.im/@npmcli/arborist) +[![license](https://img.shields.io/npm/l/@npmcli/arborist.svg)](https://npm.im/@npmcli/arborist) +[![CI - @npmcli/arborist](https://github.com/npm/cli/actions/workflows/ci-npmcli-arborist.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-npmcli-arborist.yml) + Inspect and manage `node_modules` trees. ![a tree with the word ARBORIST superimposed on it](https://raw.githubusercontent.com/npm/arborist/main/docs/logo.svg?sanitize=true) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js index 4dc6dd177c1e46..9bef84686f4b41 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js @@ -134,16 +134,7 @@ class AuditReport extends Map { const seen = new Set() for (const advisory of advisories) { const { name, range } = advisory - - // don't flag the exact same name/range more than once - // adding multiple advisories with the same range is fine, but no - // need to search for nodes we already would have added. const k = `${name}@${range}` - if (seen.has(k)) { - continue - } - - seen.add(k) const vuln = this.get(name) || new Vuln({ name, advisory }) if (this.has(name)) { @@ -151,44 +142,50 @@ class AuditReport extends Map { } super.set(name, vuln) - const p = [] - for (const node of this.tree.inventory.query('packageName', name)) { - if (!shouldAudit(node, this[_omit], this.filterSet)) { - continue - } + // don't flag the exact same name/range more than once + // adding multiple advisories with the same range is fine, but no + // need to search for nodes we already would have added. + if (!seen.has(k)) { + const p = [] + for (const node of this.tree.inventory.query('packageName', name)) { + if (!shouldAudit(node, this[_omit], this.filterSet)) { + continue + } - // if not vulnerable by this advisory, keep searching - if (!advisory.testVersion(node.version)) { - continue - } + // if not vulnerable by this advisory, keep searching + if (!advisory.testVersion(node.version)) { + continue + } - // we will have loaded the source already if this is a metavuln - if (advisory.type === 'metavuln') { - vuln.addVia(this.get(advisory.dependency)) - } + // we will have loaded the source already if this is a metavuln + if (advisory.type === 'metavuln') { + vuln.addVia(this.get(advisory.dependency)) + } - // already marked this one, no need to do it again - if (vuln.nodes.has(node)) { - continue - } + // already marked this one, no need to do it again + if (vuln.nodes.has(node)) { + continue + } - // haven't marked this one yet. get its dependents. - vuln.nodes.add(node) - for (const { from: dep, spec } of node.edgesIn) { - if (dep.isTop && !vuln.topNodes.has(dep)) { - this[_checkTopNode](dep, vuln, spec) - } else { + // haven't marked this one yet. get its dependents. + vuln.nodes.add(node) + for (const { from: dep, spec } of node.edgesIn) { + if (dep.isTop && !vuln.topNodes.has(dep)) { + this[_checkTopNode](dep, vuln, spec) + } else { // calculate a metavuln, if necessary - const calc = this.calculator.calculate(dep.packageName, advisory) - p.push(calc.then(meta => { - if (meta.testVersion(dep.version, spec)) { - advisories.add(meta) - } - })) + const calc = this.calculator.calculate(dep.packageName, advisory) + p.push(calc.then(meta => { + if (meta.testVersion(dep.version, spec)) { + advisories.add(meta) + } + })) + } } } + await Promise.all(p) + seen.add(k) } - await Promise.all(p) // make sure we actually got something. if not, remove it // this can happen if you are loading from a lockfile created by diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/edge.js b/deps/npm/node_modules/@npmcli/arborist/lib/edge.js index 87439e7645366a..d72f312569466c 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/edge.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/edge.js @@ -215,6 +215,11 @@ class Edge { reload (hard = false) { this[_explanation] = null + if (this[_from].overrides) { + this.overrides = this[_from].overrides.getEdgeRule(this) + } else { + delete this.overrides + } const newTo = this[_from].resolve(this.name) if (newTo !== this[_to]) { if (this[_to]) { diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js index 45c288bcf6cf73..c79bc0bd3a00b3 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js @@ -792,6 +792,9 @@ class Node { target.root = root } + if (!this.overrides && this.parent && this.parent.overrides) { + this.overrides = this.parent.overrides.getNodeRule(this) + } // tree should always be valid upon root setter completion. treeCheck(this) treeCheck(root) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js b/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js index 5d583b151440d9..0c7a4a319e2798 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js @@ -7,7 +7,7 @@ const pathSafeHash = s => .update(s) .digest('base64') .replace(/[^a-zA-Z0-9]+/g, '') - .substr(0, 8) + .slice(0, 8) const retirePath = from => { const d = dirname(from) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index ead9aed36492f3..ab6c91935c78ec 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -807,7 +807,7 @@ class Shrinkwrap { const pathFixed = !resolved ? null : !/^file:/.test(resolved) ? resolved // resolve onto the metadata path - : `file:${resolve(this.path, resolved.substr(5))}` + : `file:${resolve(this.path, resolved.slice(5))}` // if we have one, only set the other if it matches // otherwise it could be for a completely different thing. @@ -1056,7 +1056,7 @@ class Shrinkwrap { // turn absolute file: paths into relative paths from the node // this especially shows up with workspace edges when the root // node is also a workspace in the set. - const p = resolve(node.realpath, spec.substr('file:'.length)) + const p = resolve(node.realpath, spec.slice('file:'.length)) set[k] = `file:${relpath(node.realpath, p)}` } else { set[k] = spec diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js b/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js index cdb59b7d4dcade..be4405cee998f2 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js @@ -16,7 +16,7 @@ module.exports = (name, tgz) => { // basename checking. Note that registries can // be mounted below the root url, so /a/b/-/x/y/foo/-/foo-1.2.3.tgz // is a potential option. - const tfsplit = u.path.substr(1).split('/-/') + const tfsplit = u.path.slice(1).split('/-/') if (tfsplit.length > 1) { const afterTF = tfsplit.pop() if (afterTF === base) { diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index 8913b4449e2381..01e3db329ad505 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,16 +1,16 @@ { "name": "@npmcli/arborist", - "version": "5.0.4", + "version": "5.0.6", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/map-workspaces": "^2.0.0", "@npmcli/metavuln-calculator": "^3.0.1", - "@npmcli/move-file": "^1.1.0", + "@npmcli/move-file": "^2.0.0", "@npmcli/name-from-folder": "^1.0.1", - "@npmcli/node-gyp": "^1.0.3", - "@npmcli/package-json": "^1.0.1", + "@npmcli/node-gyp": "^2.0.0", + "@npmcli/package-json": "^2.0.0", "@npmcli/run-script": "^3.0.0", "bin-links": "^3.0.0", "cacache": "^16.0.0", @@ -20,7 +20,7 @@ "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", "nopt": "^5.0.0", - "npm-install-checks": "^4.0.0", + "npm-install-checks": "^5.0.0", "npm-package-arg": "^9.0.0", "npm-pick-manifest": "^7.0.0", "npm-registry-fetch": "^13.0.0", @@ -34,18 +34,18 @@ "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", - "ssri": "^8.0.1", - "treeverse": "^1.0.4", + "ssri": "^9.0.0", + "treeverse": "^2.0.0", "walk-up-path": "^1.0.0" }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "benchmark": "^2.1.4", "chalk": "^4.1.0", "minify-registry-metadata": "^2.1.0", "nock": "^13.2.0", - "tap": "^15.1.2", + "tap": "^16.0.1", "tcompare": "^5.0.6" }, "scripts": { @@ -101,6 +101,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/env-replace.js b/deps/npm/node_modules/@npmcli/config/lib/env-replace.js index e0f7276b1ec2b4..c851f6e4d15011 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/env-replace.js +++ b/deps/npm/node_modules/@npmcli/config/lib/env-replace.js @@ -7,8 +7,8 @@ module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => { // consume the escape chars that are relevant. if (esc.length % 2) { - return orig.substr((esc.length + 1) / 2) + return orig.slice((esc.length + 1) / 2) } - return (esc.substr(esc.length / 2)) + val + return (esc.slice(esc.length / 2)) + val }) diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index 7c34de8014b8e7..5b7ea68e91e36e 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -366,7 +366,7 @@ class Config { if (!/^npm_config_/i.test(envKey) || envVal === '') { continue } - const key = envKey.substr('npm_config_'.length) + const key = envKey.slice('npm_config_'.length) .replace(/(?!^)_/g, '-') // don't replace _ at the start of the key .toLowerCase() conf[key] = envVal @@ -396,13 +396,13 @@ class Config { validate (where) { if (!where) { let valid = true - for (const [where] of this.data.entries()) { + for (const [entryWhere] of this.data.entries()) { // no need to validate our defaults, we know they're fine // cli was already validated when parsed the first time - if (where === 'default' || where === 'builtin' || where === 'cli') { + if (entryWhere === 'default' || entryWhere === 'builtin' || entryWhere === 'cli') { continue } - const ret = this.validate(where) + const ret = this.validate(entryWhere) valid = valid && ret } return valid @@ -506,10 +506,9 @@ class Config { } [_checkDeprecated] (key, where, obj, kv) { - // XXX a future npm version will make this a warning. - // An even more future npm version will make this an error. + // XXX(npm9+) make this throw an error if (this.deprecated[key]) { - log.verbose('config', key, this.deprecated[key]) + log.warn('config', key, this.deprecated[key]) } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/parse-field.js b/deps/npm/node_modules/@npmcli/config/lib/parse-field.js index 9428996c98a35c..0c905bf23cb107 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/parse-field.js +++ b/deps/npm/node_modules/@npmcli/config/lib/parse-field.js @@ -56,7 +56,7 @@ const parseField = (f, key, opts, listElement = false) => { if (isPath) { const homePattern = platform === 'win32' ? /^~(\/|\\)/ : /^~\// if (homePattern.test(f) && home) { - f = resolve(home, f.substr(2)) + f = resolve(home, f.slice(2)) } else { f = resolve(f) } diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index c36e06230a9760..2cc04e05be8c97 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,15 +1,15 @@ { "name": "@npmcli/config", - "version": "4.0.1", + "version": "4.1.0", "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "main": "lib/index.js", "description": "Configuration management for the npm cli", "repository": { "type": "git", - "url": "git+https://github.com/npm/config" + "url": "https://github.com/npm/config.git" }, "author": "GitHub Inc.", "license": "ISC", @@ -19,23 +19,24 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "lint": "eslint '**/*.js'", - "postlint": "npm-template-check", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", - "template-copy": "npm-template-copy --force" + "template-oss-apply": "template-oss-apply --force" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.8.1", - "tap": "^15.1.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.3.2", + "tap": "^16.0.1" }, "dependencies": { - "@npmcli/map-workspaces": "^2.0.1", - "ini": "^2.0.0", + "@npmcli/map-workspaces": "^2.0.2", + "ini": "^3.0.0", "mkdirp-infer-owner": "^2.0.0", "nopt": "^5.0.0", "proc-log": "^2.0.0", @@ -44,9 +45,10 @@ "walk-up-path": "^1.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { - "version": "2.8.1" + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/@npmcli/disparity-colors/index.js b/deps/npm/node_modules/@npmcli/disparity-colors/lib/index.js similarity index 87% rename from deps/npm/node_modules/@npmcli/disparity-colors/index.js rename to deps/npm/node_modules/@npmcli/disparity-colors/lib/index.js index a02b8f884d8ac4..3d2aa56be92536 100644 --- a/deps/npm/node_modules/@npmcli/disparity-colors/index.js +++ b/deps/npm/node_modules/@npmcli/disparity-colors/lib/index.js @@ -4,7 +4,7 @@ const colors = { removed: ansi.red, added: ansi.green, header: ansi.yellow, - section: ansi.magenta + section: ansi.magenta, } function colorize (str, opts) { @@ -13,10 +13,10 @@ function colorize (str, opts) { headerLength = 2 } - const color = (str, colorId) => { + const color = (colorStr, colorId) => { const { open, close } = colors[colorId] // avoid highlighting the "\n" (would highlight till the end of the line) - return str.replace(/[^\n\r]+/g, open + '$&' + close) + return colorStr.replace(/[^\n\r]+/g, open + '$&' + close) } // this RegExp will include all the `\n` chars into the lines, easier to join diff --git a/deps/npm/node_modules/@npmcli/disparity-colors/package.json b/deps/npm/node_modules/@npmcli/disparity-colors/package.json index 3f389a42c9f99b..2b45920a7e7839 100644 --- a/deps/npm/node_modules/@npmcli/disparity-colors/package.json +++ b/deps/npm/node_modules/@npmcli/disparity-colors/package.json @@ -1,14 +1,19 @@ { "name": "@npmcli/disparity-colors", - "version": "1.0.1", + "version": "2.0.0", + "main": "lib/index.js", "files": [ - "index.js" + "bin/", + "lib/" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "description": "Colorizes unified diff output", - "repository": "https://github.com/npm/disparity-colors", + "repository": { + "type": "git", + "url": "https://github.com/npm/disparity-colors.git" + }, "keywords": [ "disparity", "npm", @@ -24,7 +29,7 @@ "cli", "tty" ], - "author": "npm Inc. ", + "author": "GitHub Inc.", "contributors": [ { "name": "Ruy Adorno", @@ -34,27 +39,31 @@ ], "license": "ISC", "scripts": { - "lint": "standard index.js", + "lint": "eslint \"**/*.js\"", "pretest": "npm run lint", "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint" }, "tap": { "check-coverage": true }, - "standard": { - "ignore": [ - "/tap-snapshots/" - ] - }, "devDependencies": { - "standard": "^16.0.3", - "tap": "^14.11.0" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "dependencies": { "ansi-styles": "^4.3.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/@npmcli/git/lib/clone.js b/deps/npm/node_modules/@npmcli/git/lib/clone.js index ac5f86b14494c3..3f165dd70e3806 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/clone.js +++ b/deps/npm/node_modules/@npmcli/git/lib/clone.js @@ -20,9 +20,9 @@ const shallowHosts = new Set([ // we have to use url.parse until we add the same shim that hosted-git-info has // to handle scp:// urls const { parse } = require('url') // eslint-disable-line node/no-deprecated-api -const { basename, resolve } = require('path') +const path = require('path') -const revs = require('./revs.js') +const getRevs = require('./revs.js') const spawn = require('./spawn.js') const { isWindows } = require('./utils.js') @@ -31,7 +31,7 @@ const fs = require('fs') const mkdirp = require('mkdirp') module.exports = (repo, ref = 'HEAD', target = null, opts = {}) => - revs(repo, opts).then(revs => clone( + getRevs(repo, opts).then(revs => clone( repo, revs, ref, @@ -48,7 +48,7 @@ const maybeShallow = (repo, opts) => { } const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) => - resolve(cwd, basename(repo.replace(/[/\\]?\.git$/, ''))) + path.resolve(cwd, path.basename(repo.replace(/[/\\]?\.git$/, ''))) const clone = (repo, revs, ref, revDoc, target, opts) => { if (!revDoc) { diff --git a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js index 3cf3778fe91784..6bd7e7a4c15315 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js +++ b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js @@ -98,19 +98,19 @@ const lineToRevDoc = line => { // ignore the pointer. // For now, though, we have to save both, because some tags // don't have peels, if they were not annotated. - const ref = rawRef.substr('refs/tags/'.length) + const ref = rawRef.slice('refs/tags/'.length) return { sha, ref, rawRef, type } } if (type === 'branch') { - const ref = rawRef.substr('refs/heads/'.length) + const ref = rawRef.slice('refs/heads/'.length) return { sha, ref, rawRef, type } } if (type === 'pull') { // NB: merged pull requests installable with #pull/123/merge // for the merged pr, or #pull/123 for the PR head - const ref = rawRef.substr('refs/'.length).replace(/\/head$/, '') + const ref = rawRef.slice('refs/'.length).replace(/\/head$/, '') return { sha, ref, rawRef, type } } diff --git a/deps/npm/node_modules/@npmcli/git/lib/spawn.js b/deps/npm/node_modules/@npmcli/git/lib/spawn.js index 40972a509caa59..7098d7b8729427 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/spawn.js +++ b/deps/npm/node_modules/@npmcli/git/lib/spawn.js @@ -17,16 +17,16 @@ module.exports = (gitArgs, opts = {}) => { ? gitArgs : ['--no-replace-objects', ...gitArgs] - let retry = opts.retry - if (retry === null || retry === undefined) { - retry = { + let retryOpts = opts.retry + if (retryOpts === null || retryOpts === undefined) { + retryOpts = { retries: opts.fetchRetries || 2, factor: opts.fetchRetryFactor || 10, maxTimeout: opts.fetchRetryMaxtimeout || 60000, minTimeout: opts.fetchRetryMintimeout || 1000, } } - return promiseRetry((retry, number) => { + return promiseRetry((retryFn, number) => { if (number !== 1) { log.silly('git', `Retrying git command: ${ args.join(' ')} attempt # ${number}`) @@ -38,7 +38,7 @@ module.exports = (gitArgs, opts = {}) => { if (!gitError.shouldRetry(number)) { throw gitError } - retry(gitError) + retryFn(gitError) }) - }, retry) + }, retryOpts) } diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json index 02cd37fa225ad8..08525ae99e8ec3 100644 --- a/deps/npm/node_modules/@npmcli/git/package.json +++ b/deps/npm/node_modules/@npmcli/git/package.json @@ -1,44 +1,43 @@ { "name": "@npmcli/git", - "version": "3.0.0", + "version": "3.0.1", "main": "lib/index.js", "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "description": "a util for spawning git from npm CLI contexts", "repository": { "type": "git", - "url": "git+https://github.com/npm/git" + "url": "https://github.com/npm/git.git" }, "author": "GitHub Inc.", "license": "ISC", "scripts": { - "lint": "eslint '**/*.js'", - "lint:fix": "standard --fix", + "lint": "eslint \"**/*.js\"", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "preversion": "npm test", "snap": "tap", "test": "tap", "posttest": "npm run lint", - "postlint": "npm-template-check", - "template-copy": "npm-template-copy --force", - "lintfix": "npm run lint -- --fix" + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "template-oss-apply": "template-oss-apply --force" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "slash": "^3.0.0", - "standard": "^16.0.3", - "tap": "^15.1.6" + "tap": "^16.0.1" }, "dependencies": { - "@npmcli/promise-spawn": "^1.3.2", - "lru-cache": "^7.3.1", + "@npmcli/promise-spawn": "^3.0.0", + "lru-cache": "^7.4.4", "mkdirp": "^1.0.4", "npm-pick-manifest": "^7.0.0", "proc-log": "^2.0.0", @@ -48,10 +47,11 @@ "which": "^2.0.2" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "2.7.1" + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE b/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE deleted file mode 100644 index 9517b7d995bb03..00000000000000 --- a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/minimatch.js deleted file mode 100644 index f3b491dd1073ed..00000000000000 --- a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/minimatch.js +++ /dev/null @@ -1,901 +0,0 @@ -const minimatch = module.exports = (p, pattern, options = {}) => { - assertValidPattern(pattern) - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - return new Minimatch(pattern, options).match(p) -} - -module.exports = minimatch - -const path = require('./lib/path.js') -minimatch.sep = path.sep - -const GLOBSTAR = Symbol('globstar **') -minimatch.GLOBSTAR = GLOBSTAR -const expand = require('brace-expansion') - -const plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} - -// any single thing other than / -// don't need to escape / when using new RegExp() -const qmark = '[^/]' - -// * => any number of characters -const star = qmark + '*?' - -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - -// "abc" -> { a:true, b:true, c:true } -const charSet = s => s.split('').reduce((set, c) => { - set[c] = true - return set -}, {}) - -// characters that need to be escaped in RegExp. -const reSpecials = charSet('().*{}+?[]^$\\!') - -// characters that indicate we have to add the pattern start -const addPatternStartSet = charSet('[.(') - -// normalizes slashes. -const slashSplit = /\/+/ - -minimatch.filter = (pattern, options = {}) => - (p, i, list) => minimatch(p, pattern, options) - -const ext = (a, b = {}) => { - const t = {} - Object.keys(a).forEach(k => t[k] = a[k]) - Object.keys(b).forEach(k => t[k] = b[k]) - return t -} - -minimatch.defaults = def => { - if (!def || typeof def !== 'object' || !Object.keys(def).length) { - return minimatch - } - - const orig = minimatch - - const m = (p, pattern, options) => orig(p, pattern, ext(def, options)) - m.Minimatch = class Minimatch extends orig.Minimatch { - constructor (pattern, options) { - super(pattern, ext(def, options)) - } - } - m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch - m.filter = (pattern, options) => orig.filter(pattern, ext(def, options)) - m.defaults = options => orig.defaults(ext(def, options)) - m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options)) - m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options)) - m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options)) - - return m -} - - - - - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options) - -const braceExpand = (pattern, options = {}) => { - assertValidPattern(pattern) - - // Thanks to Yeting Li for - // improving this regexp to avoid a ReDOS vulnerability. - if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { - // shortcut. no need to expand. - return [pattern] - } - - return expand(pattern) -} - -const MAX_PATTERN_LENGTH = 1024 * 64 -const assertValidPattern = pattern => { - if (typeof pattern !== 'string') { - throw new TypeError('invalid pattern') - } - - if (pattern.length > MAX_PATTERN_LENGTH) { - throw new TypeError('pattern is too long') - } -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -const SUBPARSE = Symbol('subparse') - -minimatch.makeRe = (pattern, options) => - new Minimatch(pattern, options || {}).makeRe() - -minimatch.match = (list, pattern, options = {}) => { - const mm = new Minimatch(pattern, options) - list = list.filter(f => mm.match(f)) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} - -// replace stuff like \* with * -const globUnescape = s => s.replace(/\\(.)/g, '$1') -const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') - -class Minimatch { - constructor (pattern, options) { - assertValidPattern(pattern) - - if (!options) options = {} - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - this.partial = !!options.partial - - // make the set of regexps etc. - this.make() - } - - debug () {} - - make () { - const pattern = this.pattern - const options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - - // step 1: figure out negation, etc. - this.parseNegate() - - // step 2: expand braces - let set = this.globSet = this.braceExpand() - - if (options.debug) this.debug = (...args) => console.error(...args) - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(s => s.split(slashSplit)) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map((s, si, set) => s.map(this.parse, this)) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(s => s.indexOf(false) === -1) - - this.debug(this.pattern, set) - - this.set = set - } - - parseNegate () { - if (this.options.nonegate) return - - const pattern = this.pattern - let negate = false - let negateOffset = 0 - - for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate - } - - // set partial to true to test if, for example, - // "/a/b" matches the start of "/*/b/*/d" - // Partial means, if you run out of file before you run - // out of pattern, then that's fine, as long as all - // the parts match. - matchOne (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - /* istanbul ignore if */ - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } - - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] - - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } - - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - /* istanbul ignore if */ - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } - - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - hit = f === p - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } - - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else /* istanbul ignore else */ if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - return (fi === fl - 1) && (file[fi] === '') - } - - // should be unreachable. - /* istanbul ignore next */ - throw new Error('wtf?') - } - - braceExpand () { - return braceExpand(this.pattern, this.options) - } - - parse (pattern, isSub) { - assertValidPattern(pattern) - - const options = this.options - - // shortcuts - if (pattern === '**') { - if (!options.noglobstar) - return GLOBSTAR - else - pattern = '*' - } - if (pattern === '') return '' - - let re = '' - let hasMagic = !!options.nocase - let escaping = false - // ? => one single character - const patternListStack = [] - const negativeLists = [] - let stateChar - let inClass = false - let reClassStart = -1 - let classStart = -1 - let cs - let pl - let sp - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - const patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - - const clearStateChar = () => { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - this.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) - - // skip over any that are escaped. - if (escaping) { - /* istanbul ignore next - completely not allowed, even escaped. */ - if (c === '/') { - return false - } - - if (reSpecials[c]) { - re += '\\' - } - re += c - escaping = false - continue - } - - switch (c) { - /* istanbul ignore next */ - case '/': { - // Should already be path-split by now. - return false - } - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - this.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } - - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue - - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } - - clearStateChar() - hasMagic = true - pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue - - case '|': - if (inClass || !patternListStack.length) { - re += '\\|' - continue - } - - clearStateChar() - re += '|' - continue - - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - - if (inClass) { - re += '\\' + c - continue - } - - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - continue - } - - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - - default: - // swallow any state char that wasn't consumed - clearStateChar() - - if (reSpecials[c] && !(c === '^' && inClass)) { - re += '\\' - } - - re += c - break - - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } - - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - let tail - tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => { - /* istanbul ignore else - should already be done */ - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail, pl, re) - const t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } - - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } - - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - const addPatternStart = addPatternStartSet[re.charAt(0)] - - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (let n = negativeLists.length - 1; n > -1; n--) { - const nl = negativeLists[n] - - const nlBefore = re.slice(0, nl.reStart) - const nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - let nlAfter = re.slice(nl.reEnd) - const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - const openParensBefore = nlBefore.split('(').length - 1 - let cleanAfter = nlAfter - for (let i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter - - const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : '' - re = nlBefore + nlFirst + nlAfter + dollar + nlLast - } - - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } - - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } - - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } - - const flags = options.nocase ? 'i' : '' - try { - return Object.assign(new RegExp('^' + re + '$', flags), { - _glob: pattern, - _src: re, - }) - } catch (er) /* istanbul ignore next - should be impossible */ { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } - } - - makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - const set = this.set - - if (!set.length) { - this.regexp = false - return this.regexp - } - const options = this.options - - const twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - const flags = options.nocase ? 'i' : '' - - // coalesce globstars and regexpify non-globstar patterns - // if it's the only item, then we just do one twoStar - // if it's the first, and there are more, prepend (\/|twoStar\/)? to next - // if it's the last, append (\/twoStar|) to previous - // if it's in the middle, append (\/|\/twoStar\/) to previous - // then filter out GLOBSTAR symbols - let re = set.map(pattern => { - pattern = pattern.map(p => - typeof p === 'string' ? regExpEscape(p) - : p === GLOBSTAR ? GLOBSTAR - : p._src - ).reduce((set, p) => { - if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) { - set.push(p) - } - return set - }, []) - pattern.forEach((p, i) => { - if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) { - return - } - if (i === 0) { - if (pattern.length > 1) { - pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1] - } else { - pattern[i] = twoStar - } - } else if (i === pattern.length - 1) { - pattern[i-1] += '(?:\\\/|' + twoStar + ')?' - } else { - pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1] - pattern[i+1] = GLOBSTAR - } - }) - return pattern.filter(p => p !== GLOBSTAR).join('/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) /* istanbul ignore next - should be impossible */ { - this.regexp = false - } - return this.regexp - } - - match (f, partial = this.partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' - - if (f === '/' && partial) return true - - const options = this.options - - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } - - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) - - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. - - const set = this.set - this.debug(this.pattern, 'set', set) - - // Find the basename of the path by looking for the last non-empty segment - let filename - for (let i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - - for (let i = 0; i < set.length; i++) { - const pattern = set[i] - let file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - const hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate - } - - static defaults (def) { - return minimatch.defaults(def).Minimatch - } -} - -minimatch.Minimatch = Minimatch diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js index 5b58ef6370724a..d30838e7384f62 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js @@ -39,6 +39,8 @@ class Advisory { this.severity = source.severity || 'high' this.versions = [] this.vulnerableVersions = [] + this.cwe = source.cwe + this.cvss = source.cvss // advisories have the range, metavulns do not // if an advisory doesn't specify range, assume all are vulnerable @@ -326,7 +328,7 @@ class Advisory { list.push(v) } - for (const list of versionSets) { + for (const set of versionSets) { // it's common to have version lists like: // 1.0.0 // 1.0.1-alpha.0 @@ -340,54 +342,54 @@ class Advisory { // 1.0.2 // with a huge number of prerelease versions that are not installable // anyway. - // If mid has a prerelease tag, and list[0] does not, then walk it + // If mid has a prerelease tag, and set[0] does not, then walk it // back until we hit a non-prerelease version - // If mid has a prerelease tag, and list[list.length-1] does not, + // If mid has a prerelease tag, and set[set.length-1] does not, // then walk it forward until we hit a version without a prerelease tag // Similarly, if the head/tail is a prerelease, but there is a non-pr - // version in the list, then start there instead. + // version in the set, then start there instead. let h = 0 - const origHeadVuln = this.testVersion(list[h]) - while (h < list.length && /-/.test(String(list[h]))) { + const origHeadVuln = this.testVersion(set[h]) + while (h < set.length && /-/.test(String(set[h]))) { h++ } // don't filter out the whole list! they might all be pr's - if (h === list.length) { + if (h === set.length) { h = 0 } else if (origHeadVuln) { // if the original was vulnerable, assume so are all of these for (let hh = 0; hh < h; hh++) { - this[_markVulnerable](list[hh]) + this[_markVulnerable](set[hh]) } } - let t = list.length - 1 - const origTailVuln = this.testVersion(list[t]) - while (t > h && /-/.test(String(list[t]))) { + let t = set.length - 1 + const origTailVuln = this.testVersion(set[t]) + while (t > h && /-/.test(String(set[t]))) { t-- } // don't filter out the whole list! might all be pr's if (t === h) { - t = list.length - 1 + t = set.length - 1 } else if (origTailVuln) { // if original tail was vulnerable, assume these are as well - for (let tt = list.length - 1; tt > t; tt--) { - this[_markVulnerable](list[tt]) + for (let tt = set.length - 1; tt > t; tt--) { + this[_markVulnerable](set[tt]) } } const headVuln = h === 0 ? origHeadVuln - : this.testVersion(list[h]) + : this.testVersion(set[h]) - const tailVuln = t === list.length - 1 ? origTailVuln - : this.testVersion(list[t]) + const tailVuln = t === set.length - 1 ? origTailVuln + : this.testVersion(set[t]) // if head and tail both vulnerable, whole list is thrown out if (headVuln && tailVuln) { for (let v = h; v < t; v++) { - this[_markVulnerable](list[v]) + this[_markVulnerable](set[v]) } continue } @@ -397,9 +399,9 @@ class Advisory { continue } - const mid = Math.floor(list.length / 2) - const pre = list.slice(0, mid) - const post = list.slice(mid) + const mid = Math.floor(set.length / 2) + const pre = set.slice(0, mid) + const post = set.slice(mid) // if the parent list wasn't prereleases, then drop pr tags // from end of the pre list, and beginning of the post list, diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index 6c05ee529cc829..2c04e0fd420bfd 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -1,13 +1,16 @@ { "name": "@npmcli/metavuln-calculator", - "version": "3.0.1", + "version": "3.1.0", "main": "lib/index.js", "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "description": "Calculate meta-vulnerabilities from package security advisories", - "repository": "https://github.com/npm/metavuln-calculator", + "repository": { + "type": "git", + "url": "https://github.com/npm/metavuln-calculator.git" + }, "author": "GitHub Inc.", "license": "ISC", "scripts": { @@ -19,19 +22,20 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "eslint '**/*.js'", + "lint": "eslint \"**/*.js\"", "lintfix": "npm run lint -- --fix", - "postlint": "npm-template-check", - "template-copy": "npm-template-copy --force" + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.9.2", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.0", "require-inject": "^1.4.4", - "tap": "^15.1.6" + "tap": "^16.0.1" }, "dependencies": { "cacache": "^16.0.0", @@ -40,9 +44,10 @@ "semver": "^7.3.5" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { - "version": "2.9.2" + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.0" } } diff --git a/deps/npm/node_modules/@npmcli/move-file/index.js b/deps/npm/node_modules/@npmcli/move-file/lib/index.js similarity index 72% rename from deps/npm/node_modules/@npmcli/move-file/index.js rename to deps/npm/node_modules/@npmcli/move-file/lib/index.js index 95d1888c64cfd1..ecc55f0171da5f 100644 --- a/deps/npm/node_modules/@npmcli/move-file/index.js +++ b/deps/npm/node_modules/@npmcli/move-file/lib/index.js @@ -6,8 +6,6 @@ const { accessSync, copyFile: copyFile_, copyFileSync, - unlink: unlink_, - unlinkSync, readdir: readdir_, readdirSync, rename: rename_, @@ -19,12 +17,11 @@ const { symlink: symlink_, symlinkSync, readlink: readlink_, - readlinkSync + readlinkSync, } = require('fs') const access = promisify(access_) const copyFile = promisify(copyFile_) -const unlink = promisify(unlink_) const readdir = promisify(readdir_) const rename = promisify(rename_) const stat = promisify(stat_) @@ -61,7 +58,7 @@ const moveFile = async (source, destination, options = {}, root = true, symlinks options = { overwrite: true, - ...options + ...options, } if (!options.overwrite && await pathExists(destination)) { @@ -77,7 +74,9 @@ const moveFile = async (source, destination, options = {}, root = true, symlinks const sourceStat = await lstat(source) if (sourceStat.isDirectory()) { const files = await readdir(source) - await Promise.all(files.map((file) => moveFile(join(source, file), join(destination, file), options, false, symlinks))) + await Promise.all(files.map((file) => + moveFile(join(source, file), join(destination, file), options, false, symlinks) + )) } else if (sourceStat.isSymbolicLink()) { symlinks.push({ source, destination }) } else { @@ -89,17 +88,24 @@ const moveFile = async (source, destination, options = {}, root = true, symlinks } if (root) { - await Promise.all(symlinks.map(async ({ source, destination }) => { - let target = await readlink(source) - // junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination - if (isAbsolute(target)) - target = resolve(destination, relative(source, target)) - // try to determine what the actual file is so we can create the correct type of symlink in windows + await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => { + let target = await readlink(symSource) + // junction symlinks in windows will be absolute paths, so we need to + // make sure they point to the symlink destination + if (isAbsolute(target)) { + target = resolve(symDestination, relative(symSource, target)) + } + // try to determine what the actual file is so we can create the correct + // type of symlink in windows let targetStat try { - targetStat = await stat(resolve(dirname(source), target)) + targetStat = await stat(resolve(dirname(symSource), target)) } catch (err) {} - await symlink(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file') + await symlink( + target, + symDestination, + targetStat && targetStat.isDirectory() ? 'junction' : 'file' + ) })) await rimraf(source) } @@ -112,7 +118,7 @@ const moveFileSync = (source, destination, options = {}, root = true, symlinks = options = { overwrite: true, - ...options + ...options, } if (!options.overwrite && pathExistsSync(destination)) { @@ -142,17 +148,24 @@ const moveFileSync = (source, destination, options = {}, root = true, symlinks = } if (root) { - for (const { source, destination } of symlinks) { - let target = readlinkSync(source) - // junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination - if (isAbsolute(target)) - target = resolve(destination, relative(source, target)) - // try to determine what the actual file is so we can create the correct type of symlink in windows + for (const { source: symSource, destination: symDestination } of symlinks) { + let target = readlinkSync(symSource) + // junction symlinks in windows will be absolute paths, so we need to + // make sure they point to the symlink destination + if (isAbsolute(target)) { + target = resolve(symDestination, relative(symSource, target)) + } + // try to determine what the actual file is so we can create the correct + // type of symlink in windows let targetStat try { - targetStat = statSync(resolve(dirname(source), target)) + targetStat = statSync(resolve(dirname(symSource), target)) } catch (err) {} - symlinkSync(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file') + symlinkSync( + target, + symDestination, + targetStat && targetStat.isDirectory() ? 'junction' : 'file' + ) } rimrafSync(source) } diff --git a/deps/npm/node_modules/@npmcli/move-file/package.json b/deps/npm/node_modules/@npmcli/move-file/package.json index 0c066dbcfbfe60..1b1d377b0c7b2b 100644 --- a/deps/npm/node_modules/@npmcli/move-file/package.json +++ b/deps/npm/node_modules/@npmcli/move-file/package.json @@ -1,34 +1,47 @@ { "name": "@npmcli/move-file", - "version": "1.1.2", + "version": "2.0.0", "files": [ - "index.js" + "bin/", + "lib/" ], + "main": "lib/index.js", "description": "move a file (fork of move-file)", "dependencies": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" }, "devDependencies": { - "require-inject": "^1.4.4", - "tap": "^14.10.7" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "scripts": { "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint" }, "repository": { "type": "git", - "url": "git+https://github.com/npm/move-file" + "url": "https://github.com/npm/move-file.git" }, "tap": { "check-coverage": true }, "license": "MIT", "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/@npmcli/node-gyp/lib/index.js b/deps/npm/node_modules/@npmcli/node-gyp/lib/index.js index d4ebf14ed9af89..cdf18560e0ca23 100644 --- a/deps/npm/node_modules/@npmcli/node-gyp/lib/index.js +++ b/deps/npm/node_modules/@npmcli/node-gyp/lib/index.js @@ -1,8 +1,8 @@ const util = require('util') const fs = require('fs') -const {stat} = fs.promises || { stat: util.promisify(fs.stat) }; +const { stat } = fs.promises || { stat: util.promisify(fs.stat) } -async function isNodeGypPackage(path) { +async function isNodeGypPackage (path) { return await stat(`${path}/binding.gyp`) .then(st => st.isFile()) .catch(() => false) @@ -10,5 +10,5 @@ async function isNodeGypPackage(path) { module.exports = { isNodeGypPackage, - defaultGypInstallScript: 'node-gyp rebuild' + defaultGypInstallScript: 'node-gyp rebuild', } diff --git a/deps/npm/node_modules/@npmcli/node-gyp/package.json b/deps/npm/node_modules/@npmcli/node-gyp/package.json index 299a453b66cd3e..04eeec8ff808c2 100644 --- a/deps/npm/node_modules/@npmcli/node-gyp/package.json +++ b/deps/npm/node_modules/@npmcli/node-gyp/package.json @@ -1,12 +1,18 @@ { "name": "@npmcli/node-gyp", - "version": "1.0.3", + "version": "2.0.0", "description": "Tools for dealing with node-gyp packages", "scripts": { "test": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap", + "posttest": "npm run lint" }, "repository": { "type": "git", @@ -18,18 +24,22 @@ "node-gyp" ], "files": [ - "lib/**/*.js" + "bin/", + "lib/" ], "main": "lib/index.js", - "author": "Brian Jenkins ", + "author": "GitHub Inc.", "license": "ISC", - "tap": { - "check-coverage": true, - "coverage-map": "map.js" - }, "devDependencies": { - "require-inject": "^1.4.4", - "tap": "^14.10.6", - "tmp": "^0.2.1" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/index.js b/deps/npm/node_modules/@npmcli/package-json/lib/index.js index 87c3a630936886..e98308f3d3b843 100644 --- a/deps/npm/node_modules/@npmcli/package-json/lib/index.js +++ b/deps/npm/node_modules/@npmcli/package-json/lib/index.js @@ -73,13 +73,15 @@ class PackageJson { ) } - for (const step of knownSteps) + for (const step of knownSteps) { this[_manifest] = step({ content, originalContent: this[_manifest] }) + } // unknown properties will just be overwitten for (const [key, value] of Object.entries(content)) { - if (!knownKeys.has(key)) + if (!knownKeys.has(key)) { this[_manifest][key] = value + } } return this @@ -98,8 +100,9 @@ class PackageJson { }\n` .replace(/\n/g, eol) - if (fileContent.trim() !== this[_readFileContent].trim()) + if (fileContent.trim() !== this[_readFileContent].trim()) { return await writeFile(this[_filename], fileContent) + } } } diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js b/deps/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js index dac45a8bed7bf9..7259949ab661d8 100644 --- a/deps/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js +++ b/deps/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js @@ -28,8 +28,9 @@ const updateDependencies = ({ content, originalContent }) => { // optionalDependencies don't need to be repeated in two places if (pkg.dependencies) { if (pkg.optionalDependencies) { - for (const name of Object.keys(pkg.optionalDependencies)) + for (const name of Object.keys(pkg.optionalDependencies)) { delete pkg.dependencies[name] + } } } @@ -37,16 +38,18 @@ const updateDependencies = ({ content, originalContent }) => { // loop through all types of dependencies and update package json pkg for (const type of depTypes) { - if (pkg[type]) + if (pkg[type]) { result[type] = pkg[type] + } // prune empty type props from resulting object const emptyDepType = pkg[type] && typeof pkg === 'object' && Object.keys(pkg[type]).length === 0 - if (emptyDepType) + if (emptyDepType) { delete result[type] + } } // if original package.json had dep in peerDeps AND deps, preserve that. diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/update-scripts.js b/deps/npm/node_modules/@npmcli/package-json/lib/update-scripts.js index 3a88d3e9a17a80..30495e54cc3c78 100644 --- a/deps/npm/node_modules/@npmcli/package-json/lib/update-scripts.js +++ b/deps/npm/node_modules/@npmcli/package-json/lib/update-scripts.js @@ -1,8 +1,9 @@ const updateScripts = ({ content, originalContent = {} }) => { const newScripts = content.scripts - if (!newScripts) + if (!newScripts) { return originalContent + } // validate scripts content being appended const hasInvalidScripts = () => diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js b/deps/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js index 207dd94a236d79..04bf63230636fd 100644 --- a/deps/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js +++ b/deps/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js @@ -1,8 +1,9 @@ const updateWorkspaces = ({ content, originalContent = {} }) => { const newWorkspaces = content.workspaces - if (!newWorkspaces) + if (!newWorkspaces) { return originalContent + } // validate workspaces content being appended const hasInvalidWorkspaces = () => diff --git a/deps/npm/node_modules/@npmcli/package-json/package.json b/deps/npm/node_modules/@npmcli/package-json/package.json index 8708ec5eb6fb1b..d2c4b9da9db62a 100644 --- a/deps/npm/node_modules/@npmcli/package-json/package.json +++ b/deps/npm/node_modules/@npmcli/package-json/package.json @@ -1,10 +1,11 @@ { "name": "@npmcli/package-json", - "version": "1.0.1", + "version": "2.0.0", "description": "Programmatic API to update package.json", "main": "lib/index.js", "files": [ - "lib" + "bin/", + "lib/" ], "scripts": { "preversion": "npm test", @@ -12,11 +13,12 @@ "prepublishOnly": "git push origin --follow-tags", "snap": "tap", "test": "tap", - "npmclilint": "npmcli-lint", - "lint": "npm run npmclilint -- \"lib/*.*js\" \"test/*.*js\"", + "lint": "eslint \"**/*.js\"", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint --", - "postsnap": "npm run lintfix --" + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" }, "keywords": [ "npm", @@ -25,10 +27,22 @@ "author": "GitHub Inc.", "license": "ISC", "devDependencies": { - "@npmcli/lint": "^1.0.1", - "tap": "^15.0.9" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "dependencies": { "json-parse-even-better-errors": "^2.3.1" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/package-json.git" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/@npmcli/promise-spawn/index.js b/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js similarity index 87% rename from deps/npm/node_modules/@npmcli/promise-spawn/index.js rename to deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js index 6ad51b8e08ccff..84ddc83d10bab0 100644 --- a/deps/npm/node_modules/@npmcli/promise-spawn/index.js +++ b/deps/npm/node_modules/@npmcli/promise-spawn/lib/index.js @@ -1,5 +1,4 @@ -const {spawn} = require('child_process') - +const { spawn } = require('child_process') const inferOwner = require('infer-owner') const isPipe = (stdio = 'pipe', fd) => @@ -8,7 +7,7 @@ const isPipe = (stdio = 'pipe', fd) => : false // 'extra' object is for decorating the error a bit more -const promiseSpawn = (cmd, args, opts, extra = {}) => { +const promiseSpawn = (cmd, args, opts = {}, extra = {}) => { const cwd = opts.cwd || process.cwd() const isRoot = process.getuid && process.getuid() === 0 const { uid, gid } = isRoot ? inferOwner.sync(cwd) : {} @@ -16,11 +15,11 @@ const promiseSpawn = (cmd, args, opts, extra = {}) => { ...opts, cwd, uid, - gid + gid, }, extra) } -const stdioResult = (stdout, stderr, {stdioString, stdio}) => +const stdioResult = (stdout, stderr, { stdioString, stdio }) => stdioString ? { stdout: isPipe(stdio, 1) ? Buffer.concat(stdout).toString() : null, stderr: isPipe(stdio, 2) ? Buffer.concat(stderr).toString() : null, @@ -58,12 +57,13 @@ const promiseSpawnUid = (cmd, args, opts, extra) => { code, signal, ...stdioResult(stdout, stderr, opts), - ...extra + ...extra, } - if (code || signal) + if (code || signal) { rej(Object.assign(new Error('command failed'), result)) - else + } else { res(result) + } }) }) diff --git a/deps/npm/node_modules/@npmcli/promise-spawn/package.json b/deps/npm/node_modules/@npmcli/promise-spawn/package.json index be7342f56a0d88..4521b56d50560b 100644 --- a/deps/npm/node_modules/@npmcli/promise-spawn/package.json +++ b/deps/npm/node_modules/@npmcli/promise-spawn/package.json @@ -1,30 +1,46 @@ { "name": "@npmcli/promise-spawn", - "version": "1.3.2", + "version": "3.0.0", "files": [ - "index.js" + "bin/", + "lib/" ], + "main": "./lib/index.js", "description": "spawn processes the way the npm cli likes to do", "repository": { "type": "git", - "url": "git+https://github.com/npm/promise-spawn" + "url": "https://github.com/npm/promise-spawn.git" }, - "author": "Isaac Z. Schlueter (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" }, "tap": { "check-coverage": true }, "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "minipass": "^3.1.1", - "require-inject": "^1.4.4", - "tap": "^14.10.6" + "tap": "^16.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" }, "dependencies": { "infer-owner": "^1.0.4" diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js b/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js index 6bb4a2e666a202..e9d18261a2c1fd 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js @@ -7,7 +7,8 @@ const runScript = options => { validateOptions(options) const { pkg, path } = options return pkg ? runScriptPkg(options) - : rpj(path + '/package.json').then(pkg => runScriptPkg({ ...options, pkg })) + : rpj(path + '/package.json') + .then(readPackage => runScriptPkg({ ...options, pkg: readPackage })) } module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js index d5f8707efc84f5..07671f44579dc1 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js @@ -12,7 +12,7 @@ const setPATH = (projectPath, env) => { const delimiter = isWindows ? ';' : ':' const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p]) .map(p => env[p].split(delimiter)) - .reduce((set, p) => set.concat(p.filter(p => !set.includes(p))), []) + .reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), []) .join(delimiter) const pathArr = [] diff --git a/deps/npm/node_modules/@npmcli/run-script/package.json b/deps/npm/node_modules/@npmcli/run-script/package.json index 3f29f97113e53c..733b27e44a1b8b 100644 --- a/deps/npm/node_modules/@npmcli/run-script/package.json +++ b/deps/npm/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "3.0.1", + "version": "3.0.2", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", @@ -10,42 +10,44 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "eslint '**/*.js'", + "lint": "eslint \"**/*.js\"", "lintfix": "npm run lint -- --fix", - "postlint": "npm-template-check", - "template-copy": "npm-template-copy --force", + "postlint": "template-oss-check", "snap": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.9.1", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "minipass": "^3.1.6", "require-inject": "^1.4.4", - "tap": "^15.1.6" + "tap": "^16.0.1" }, "dependencies": { - "@npmcli/node-gyp": "^1.0.3", - "@npmcli/promise-spawn": "^1.3.2", + "@npmcli/node-gyp": "^2.0.0", + "@npmcli/promise-spawn": "^3.0.0", "node-gyp": "^9.0.0", "read-package-json-fast": "^2.0.3" }, "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "main": "lib/run-script.js", "repository": { "type": "git", - "url": "git+https://github.com/npm/run-script.git" + "url": "https://github.com/npm/run-script.git" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { - "version": "2.9.1" + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/ansicolors/LICENSE b/deps/npm/node_modules/ansicolors/LICENSE deleted file mode 100644 index 41702c5043478f..00000000000000 --- a/deps/npm/node_modules/ansicolors/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2013 Thorsten Lorenz. -All rights reserved. - -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/ansicolors/ansicolors.js b/deps/npm/node_modules/ansicolors/ansicolors.js deleted file mode 100644 index 16b2586f6b1637..00000000000000 --- a/deps/npm/node_modules/ansicolors/ansicolors.js +++ /dev/null @@ -1,65 +0,0 @@ -// ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm -'use strict'; - -var colorNums = { - white : 37 - , black : 30 - , blue : 34 - , cyan : 36 - , green : 32 - , magenta : 35 - , red : 31 - , yellow : 33 - , brightBlack : 90 - , brightRed : 91 - , brightGreen : 92 - , brightYellow : 93 - , brightBlue : 94 - , brightMagenta : 95 - , brightCyan : 96 - , brightWhite : 97 - } - , backgroundColorNums = { - bgBlack : 40 - , bgRed : 41 - , bgGreen : 42 - , bgYellow : 43 - , bgBlue : 44 - , bgMagenta : 45 - , bgCyan : 46 - , bgWhite : 47 - , bgBrightBlack : 100 - , bgBrightRed : 101 - , bgBrightGreen : 102 - , bgBrightYellow : 103 - , bgBrightBlue : 104 - , bgBrightMagenta : 105 - , bgBrightCyan : 106 - , bgBrightWhite : 107 - } - , open = {} - , close = {} - , colors = {} - ; - -Object.keys(colorNums).forEach(function (k) { - var o = open[k] = '\u001b[' + colorNums[k] + 'm'; - var c = close[k] = '\u001b[39m'; - - colors[k] = function (s) { - return o + s + c; - }; -}); - -Object.keys(backgroundColorNums).forEach(function (k) { - var o = open[k] = '\u001b[' + backgroundColorNums[k] + 'm'; - var c = close[k] = '\u001b[49m'; - - colors[k] = function (s) { - return o + s + c; - }; -}); - -module.exports = colors; -colors.open = open; -colors.close = close; diff --git a/deps/npm/node_modules/ansicolors/package.json b/deps/npm/node_modules/ansicolors/package.json deleted file mode 100644 index cda0c75b5850a1..00000000000000 --- a/deps/npm/node_modules/ansicolors/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ansicolors", - "version": "0.3.2", - "description": "Functions that surround a string with ansicolor codes so it prints in color.", - "main": "ansicolors.js", - "scripts": { - "test": "node test/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/thlorenz/ansicolors.git" - }, - "keywords": [ - "ansi", - "colors", - "highlight", - "string" - ], - "author": "Thorsten Lorenz (thlorenz.com)", - "license": "MIT", - "readmeFilename": "README.md", - "gitHead": "858847ca28e8b360d9b70eee0592700fa2ab087d" -} diff --git a/deps/npm/node_modules/ansicolors/test/ansicolors.js b/deps/npm/node_modules/ansicolors/test/ansicolors.js deleted file mode 100644 index 494539305d3acf..00000000000000 --- a/deps/npm/node_modules/ansicolors/test/ansicolors.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -var assert = require('assert') - , colors = require('..') - , open = colors.open - , close = colors.close - -console.log('Foreground colors ..'); - -assert.equal(colors.white('printed in white'), '\u001b[37mprinted in white\u001b[39m'); - -assert.equal(colors.black('printed in black'), '\u001b[30mprinted in black\u001b[39m'); -assert.equal(colors.brightBlack('printed in bright black'), '\u001b[90mprinted in bright black\u001b[39m'); - -assert.equal(colors.green('printed in green'), '\u001b[32mprinted in green\u001b[39m'); -assert.equal(colors.brightGreen('printed in bright green'), '\u001b[92mprinted in bright green\u001b[39m'); - -assert.equal(colors.red('printed in red'), '\u001b[31mprinted in red\u001b[39m'); -assert.equal(colors.brightRed('printed in bright red'), '\u001b[91mprinted in bright red\u001b[39m'); - -console.log('OK'); - -console.log('Background colors ..'); - -assert.equal( - colors.bgBlack('printed with black background') - , '\u001b[40mprinted with black background\u001b[49m' -); - -assert.equal( - colors.bgYellow('printed with yellow background') - , '\u001b[43mprinted with yellow background\u001b[49m' -); -assert.equal( - colors.bgBrightYellow('printed with bright yellow background') - , '\u001b[103mprinted with bright yellow background\u001b[49m' -); - -assert.equal( - colors.bgWhite('printed with white background') - , '\u001b[47mprinted with white background\u001b[49m' -); - -console.log('OK'); - -console.log('Mixing background and foreground colors ..'); - -assert.equal( - colors.blue(colors.bgYellow('printed in blue with yellow background')) - , '\u001b[34m\u001b[43mprinted in blue with yellow background\u001b[49m\u001b[39m' -); -assert.equal( - colors.bgYellow(colors.blue('printed in blue with yellow background again')) - , '\u001b[43m\u001b[34mprinted in blue with yellow background again\u001b[39m\u001b[49m' -); - -console.log('OK'); - -console.log('Open ...'); - -assert.equal(open.black, '\u001b[30m'); -assert.equal(open.bgYellow, '\u001b[43m'); - -console.log('OK'); - -console.log('Close ...'); - -assert.equal(close.black, '\u001b[39m'); -assert.equal(close.bgYellow, '\u001b[49m'); - -console.log('OK'); diff --git a/deps/npm/node_modules/ansistyles/LICENSE b/deps/npm/node_modules/ansistyles/LICENSE deleted file mode 100644 index 41702c5043478f..00000000000000 --- a/deps/npm/node_modules/ansistyles/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2013 Thorsten Lorenz. -All rights reserved. - -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/ansistyles/ansistyles.js b/deps/npm/node_modules/ansistyles/ansistyles.js deleted file mode 100644 index 5b8788c0f94194..00000000000000 --- a/deps/npm/node_modules/ansistyles/ansistyles.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -/* - * Info: http://www.termsys.demon.co.uk/vtansi.htm#colors - * Following caveats - * bright - brightens the color (bold-blue is same as brigthtBlue) - * dim - nothing on Mac or Linux - * italic - nothing on Mac or Linux - * underline - underlines string - * blink - nothing on Mac or linux - * inverse - background becomes foreground and vice versa - * - * In summary, the only styles that work are: - * - bright, underline and inverse - * - the others are only included for completeness - */ - -var styleNums = { - reset : [0, 22] - , bright : [1, 22] - , dim : [2, 22] - , italic : [3, 23] - , underline : [4, 24] - , blink : [5, 25] - , inverse : [7, 27] - } - , styles = {} - ; - -Object.keys(styleNums).forEach(function (k) { - styles[k] = function (s) { - var open = styleNums[k][0] - , close = styleNums[k][1]; - return '\u001b[' + open + 'm' + s + '\u001b[' + close + 'm'; - }; -}); - -module.exports = styles; diff --git a/deps/npm/node_modules/ansistyles/package.json b/deps/npm/node_modules/ansistyles/package.json deleted file mode 100644 index 2fe1f4da4fffaa..00000000000000 --- a/deps/npm/node_modules/ansistyles/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ansistyles", - "version": "0.1.3", - "description": "Functions that surround a string with ansistyle codes so it prints in style.", - "main": "ansistyles.js", - "scripts": { - "test": "node test/ansistyles.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/thlorenz/ansistyles.git" - }, - "keywords": [ - "ansi", - "style", - "terminal", - "console" - ], - "author": "Thorsten Lorenz (thlorenz.com)", - "license": "MIT", - "readmeFilename": "README.md", - "gitHead": "27bf1bc65231bcc7fd109bf13b13601b51f8cd04" -} diff --git a/deps/npm/node_modules/ansistyles/test/ansistyles.js b/deps/npm/node_modules/ansistyles/test/ansistyles.js deleted file mode 100644 index f769bf803b2095..00000000000000 --- a/deps/npm/node_modules/ansistyles/test/ansistyles.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -/*jshint asi: true */ -var assert = require('assert') - , styles = require('../') - -function inspect(obj, depth) { - console.log(require('util').inspect(obj, false, depth || 5, true)); -} - -assert.equal(styles.reset('reset'), '\u001b[0mreset\u001b[22m', 'reset') -assert.equal(styles.underline('underlined'), '\u001b[4munderlined\u001b[24m', 'underline') -assert.equal(styles.bright('bright'), '\u001b[1mbright\u001b[22m', 'bright') -assert.equal(styles.inverse('inversed'), '\u001b[7minversed\u001b[27m', 'inverse') - -console.log('OK'); diff --git a/deps/npm/node_modules/bin-links/lib/check-bin.js b/deps/npm/node_modules/bin-links/lib/check-bin.js index 8bbe45188a479c..750a34fbbff3a2 100644 --- a/deps/npm/node_modules/bin-links/lib/check-bin.js +++ b/deps/npm/node_modules/bin-links/lib/check-bin.js @@ -57,18 +57,18 @@ const checkShim = async ({ target, path }) => { target + '.cmd', target + '.ps1', ] - await Promise.all(shims.map(async target => { - const current = await readCmdShim(target) - .catch(er => handleReadCmdShimError({ er, target })) + await Promise.all(shims.map(async shim => { + const current = await readCmdShim(shim) + .catch(er => handleReadCmdShimError({ er, target: shim })) if (!current) { return } - const resolved = resolve(dirname(target), current.replace(/\\/g, '/')) + const resolved = resolve(dirname(shim), current.replace(/\\/g, '/')) if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { - return failEEXIST({ target }) + return failEEXIST({ target: shim }) } })) } diff --git a/deps/npm/node_modules/bin-links/lib/get-paths.js b/deps/npm/node_modules/bin-links/lib/get-paths.js index 631aef9f9117f5..b93e6982dce221 100644 --- a/deps/npm/node_modules/bin-links/lib/get-paths.js +++ b/deps/npm/node_modules/bin-links/lib/get-paths.js @@ -3,7 +3,7 @@ // are present, then we can assume that they're associated. const binTarget = require('./bin-target.js') const manTarget = require('./man-target.js') -const { resolve, basename } = require('path') +const { resolve, basename, extname } = require('path') const isWindows = require('./is-windows.js') module.exports = ({ path, pkg, global, top }) => { if (top && !global) { @@ -27,23 +27,14 @@ module.exports = ({ path, pkg, global, top }) => { const manSet = [] if (manTarg && pkg.man && Array.isArray(pkg.man) && pkg.man.length) { for (const man of pkg.man) { - const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) - // invalid entries invalidate the entire man set - if (!parseMan) { + if (!/.\.[0-9]+(\.gz)?$/.test(man)) { return binSet } - const stem = parseMan[1] - const sxn = parseMan[2] - const base = basename(stem) - const absFrom = resolve(path, man) + const section = extname(basename(man, '.gz')).slice(1) + const base = basename(man) - /* istanbul ignore if - should be impossible */ - if (absFrom.indexOf(path) !== 0) { - return binSet - } - - manSet.push(resolve(manTarg, 'man' + sxn, base)) + manSet.push(resolve(manTarg, 'man' + section, base)) } } diff --git a/deps/npm/node_modules/bin-links/lib/link-mans.js b/deps/npm/node_modules/bin-links/lib/link-mans.js index 54b17d1fc16d4f..656e179b6ca54b 100644 --- a/deps/npm/node_modules/bin-links/lib/link-mans.js +++ b/deps/npm/node_modules/bin-links/lib/link-mans.js @@ -11,7 +11,7 @@ const linkMans = ({ path, pkg, top, force }) => { // break any links to c:\\blah or /foo/blah or ../blah // and filter out duplicates const set = [...new Set(pkg.man.map(man => - man ? join('/', man).replace(/\\|:/g, '/').substr(1) : null) + man ? join('/', man).replace(/\\|:/g, '/').slice(1) : null) .filter(man => typeof man === 'string'))] return Promise.all(set.map(man => { diff --git a/deps/npm/node_modules/bin-links/package.json b/deps/npm/node_modules/bin-links/package.json index 0325ab4437656d..a86948de153c5c 100644 --- a/deps/npm/node_modules/bin-links/package.json +++ b/deps/npm/node_modules/bin-links/package.json @@ -1,6 +1,6 @@ { "name": "bin-links", - "version": "3.0.0", + "version": "3.0.1", "description": "JavaScript package binary linker", "main": "./lib/index.js", "scripts": { @@ -9,14 +9,15 @@ "prepublishOnly": "git push origin --follow-tags", "snap": "tap", "test": "tap", - "lint": "eslint '**/*.js'", - "postlint": "npm-template-check", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint" + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" }, "repository": { "type": "git", - "url": "git://github.com/npm/bin-links.git" + "url": "https://github.com/npm/bin-links.git" }, "keywords": [ "npm", @@ -25,15 +26,16 @@ ], "license": "ISC", "dependencies": { - "cmd-shim": "^4.0.1", + "cmd-shim": "^5.0.0", "mkdirp-infer-owner": "^2.0.0", "npm-normalize-package-bin": "^1.0.0", - "read-cmd-shim": "^2.0.0", + "read-cmd-shim": "^3.0.0", "rimraf": "^3.0.0", "write-file-atomic": "^4.0.0" }, "devDependencies": { - "@npmcli/template-oss": "^2.5.0", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "mkdirp": "^1.0.3", "require-inject": "^1.4.4", "tap": "^15.0.10" @@ -43,15 +45,16 @@ "coverage-map": "map.js" }, "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "author": "GitHub Inc.", "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "2.5.0" + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/brace-expansion/index.js b/deps/npm/node_modules/brace-expansion/index.js index 0478be81eabc2b..6c06dafcfb6e05 100644 --- a/deps/npm/node_modules/brace-expansion/index.js +++ b/deps/npm/node_modules/brace-expansion/index.js @@ -1,4 +1,3 @@ -var concatMap = require('concat-map'); var balanced = require('balanced-match'); module.exports = expandTop; @@ -79,10 +78,6 @@ function expandTop(str) { return expand(escapeBraces(str), true).map(unescapeBraces); } -function identity(e) { - return e; -} - function embrace(str) { return '{' + str + '}'; } @@ -101,42 +96,7 @@ function expand(str, isTop) { var expansions = []; var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. + if (!m) return [str]; // no need to expand pre, since it is guaranteed to be free of brace-sets var pre = m.pre; @@ -144,55 +104,97 @@ function expand(str, isTop) { ? expand(m.post, false) : ['']; - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } } } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); } - N.push(c); } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } } } diff --git a/deps/npm/node_modules/brace-expansion/package.json b/deps/npm/node_modules/brace-expansion/package.json index a18faa8fd67b82..7097d41e39de5d 100644 --- a/deps/npm/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/brace-expansion/package.json @@ -1,7 +1,7 @@ { "name": "brace-expansion", "description": "Brace expansion as known from sh/bash", - "version": "1.1.11", + "version": "2.0.1", "repository": { "type": "git", "url": "git://github.com/juliangruber/brace-expansion.git" @@ -14,11 +14,10 @@ "bench": "matcha test/perf/bench.js" }, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" }, "devDependencies": { - "matcha": "^0.7.0", + "@c4312/matcha": "^1.3.1", "tape": "^4.6.0" }, "keywords": [], diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index edae9a4f995b4e..3467f8af804edd 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "16.0.3", + "version": "16.0.4", "cache-version": { "content": "2", "index": "5" @@ -50,7 +50,7 @@ "license": "ISC", "dependencies": { "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^1.1.2", + "@npmcli/move-file": "^2.0.0", "chownr": "^2.0.0", "fs-minipass": "^2.1.0", "glob": "^7.2.0", @@ -64,13 +64,13 @@ "p-map": "^4.0.0", "promise-inflight": "^1.0.1", "rimraf": "^3.0.2", - "ssri": "^8.0.1", + "ssri": "^9.0.0", "tar": "^6.1.11", "unique-filename": "^1.1.1" }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.1.2", + "@npmcli/template-oss": "3.2.2", "benchmark": "^2.1.4", "chalk": "^4.1.2", "require-inject": "^1.4.4", @@ -87,7 +87,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "3.1.2" + "version": "3.2.2" }, "author": "GitHub Inc." } diff --git a/deps/npm/node_modules/cmd-shim/index.js b/deps/npm/node_modules/cmd-shim/lib/index.js similarity index 93% rename from deps/npm/node_modules/cmd-shim/index.js rename to deps/npm/node_modules/cmd-shim/lib/index.js index 4a7614b2f90730..10494e58ad548b 100644 --- a/deps/npm/node_modules/cmd-shim/index.js +++ b/deps/npm/node_modules/cmd-shim/lib/index.js @@ -8,7 +8,7 @@ // Write a binroot/pkg.bin + ".cmd" file that has this line in it: // @ %dp0% %* -const {promisify} = require('util') +const { promisify } = require('util') const fs = require('fs') const writeFile = promisify(fs.writeFile) const readFile = promisify(fs.readFile) @@ -16,10 +16,10 @@ const chmod = promisify(fs.chmod) const stat = promisify(fs.stat) const unlink = promisify(fs.unlink) -const {dirname, relative} = require('path') +const { dirname, relative } = require('path') const mkdir = require('mkdirp-infer-owner') -const toBatchSyntax = require('./lib/to-batch-syntax') -const shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+=[^ \t]+\s+)*\s*([^ \t]+)(.*)$/ +const toBatchSyntax = require('./to-batch-syntax') +const shebangExpr = /^#!\s*(?:\/usr\/bin\/env\s*((?:[^ \t=]+=[^ \t=]+\s+)*))?([^ \t]+)(.*)$/ const cmdShimIfExists = (from, to) => stat(from).then(() => cmdShim(from, to), () => {}) @@ -47,14 +47,15 @@ const writeShim = (from, to) => .then(data => { const firstLine = data.trim().split(/\r*\n/)[0] const shebang = firstLine.match(shebangExpr) - if (!shebang) return writeShim_(from, to) + if (!shebang) { + return writeShim_(from, to) + } const vars = shebang[1] || '' const prog = shebang[2] const args = shebang[3] || '' return writeShim_(from, to, prog, args, vars) }, er => writeShim_(from, to)) - const writeShim_ = (from, to, prog, args, variables) => { let shTarget = relative(dirname(to), from) let target = shTarget.split('/').join('\\') @@ -94,8 +95,8 @@ const writeShim_ = (from, to, prog, args, variables) => { let cmd if (longProg) { - shLongProg = shLongProg.trim(); - args = args.trim(); + shLongProg = shLongProg.trim() + args = args.trim() const variablesBatch = toBatchSyntax.convertToSetCommands(variables) cmd = head + variablesBatch @@ -110,7 +111,7 @@ const writeShim_ = (from, to, prog, args, variables) => { // prevent "Terminate Batch Job? (Y/n)" message // https://github.com/npm/cli/issues/969#issuecomment-737496588 + 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ' - + `"%_prog%" ${args} ${target} %*\r\n` + + `"%_prog%" ${args} ${target} %*\r\n` } else { cmd = `${head}${prog} ${args} ${target} %*\r\n` } @@ -128,7 +129,7 @@ const writeShim_ = (from, to, prog, args, variables) => { // exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@" // fi - let sh = "#!/bin/sh\n" + let sh = '#!/bin/sh\n' sh = sh + `basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")\n` @@ -182,7 +183,7 @@ const writeShim_ = (from, to, prog, args, variables) => { + '$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent\n' + '\n' + '$exe=""\n' - + 'if ($PSVersionTable.PSVersion -lt \"6.0\" -or $IsWindows) {\n' + + 'if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {\n' + ' # Fix case when both the Windows and Linux builds of Node\n' + ' # are installed in the same directory\n' + ' $exe=".exe"\n' diff --git a/deps/npm/node_modules/cmd-shim/lib/to-batch-syntax.js b/deps/npm/node_modules/cmd-shim/lib/to-batch-syntax.js index f3f5ffa63cbb59..86a3f01405de5e 100644 --- a/deps/npm/node_modules/cmd-shim/lib/to-batch-syntax.js +++ b/deps/npm/node_modules/cmd-shim/lib/to-batch-syntax.js @@ -2,50 +2,48 @@ exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair exports.convertToSetCommand = convertToSetCommand exports.convertToSetCommands = convertToSetCommands -function convertToSetCommand(key, value) { - var line = "" - key = key || "" - key = key.trim() - value = value || "" - value = value.trim() - if(key && value && value.length > 0) { - line = "@SET " + key + "=" + replaceDollarWithPercentPair(value) + "\r\n" - } - return line +function convertToSetCommand (key, value) { + var line = '' + key = key || '' + key = key.trim() + value = value || '' + value = value.trim() + if (key && value && value.length > 0) { + line = '@SET ' + key + '=' + replaceDollarWithPercentPair(value) + '\r\n' + } + return line } -function extractVariableValuePairs(declarations) { - var pairs = {} - declarations.map(function(declaration) { - var split = declaration.split("=") - pairs[split[0]]=split[1] - }) - return pairs +function extractVariableValuePairs (declarations) { + var pairs = {} + declarations.map(function (declaration) { + var split = declaration.split('=') + pairs[split[0]] = split[1] + }) + return pairs } -function convertToSetCommands(variableString) { - var variableValuePairs = extractVariableValuePairs(variableString.split(" ")) - var variableDeclarationsAsBatch = "" - Object.keys(variableValuePairs).forEach(function (key) { - variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key]) - }) - return variableDeclarationsAsBatch +function convertToSetCommands (variableString) { + var variableValuePairs = extractVariableValuePairs(variableString.split(' ')) + var variableDeclarationsAsBatch = '' + Object.keys(variableValuePairs).forEach(function (key) { + variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key]) + }) + return variableDeclarationsAsBatch } -function replaceDollarWithPercentPair(value) { - var dollarExpressions = /\$\{?([^\$@#\?\- \t{}:]+)\}?/g - var result = "" - var startIndex = 0 - do { - var match = dollarExpressions.exec(value) - if(match) { - var betweenMatches = value.substring(startIndex, match.index) || "" - result += betweenMatches + "%" + match[1] + "%" - startIndex = dollarExpressions.lastIndex - } - } while (dollarExpressions.lastIndex > 0) - result += value.substr(startIndex) - return result +function replaceDollarWithPercentPair (value) { + var dollarExpressions = /\$\{?([^$@#?\- \t{}:]+)\}?/g + var result = '' + var startIndex = 0 + do { + var match = dollarExpressions.exec(value) + if (match) { + var betweenMatches = value.substring(startIndex, match.index) || '' + result += betweenMatches + '%' + match[1] + '%' + startIndex = dollarExpressions.lastIndex + } + } while (dollarExpressions.lastIndex > 0) + result += value.slice(startIndex) + return result } - - diff --git a/deps/npm/node_modules/cmd-shim/package.json b/deps/npm/node_modules/cmd-shim/package.json index 11e17c8fbbdaa0..1bcbdc4342ceda 100644 --- a/deps/npm/node_modules/cmd-shim/package.json +++ b/deps/npm/node_modules/cmd-shim/package.json @@ -1,13 +1,19 @@ { "name": "cmd-shim", - "version": "4.1.0", + "version": "5.0.0", "description": "Used in npm for command line application support", "scripts": { "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint" }, "repository": { "type": "git", @@ -18,19 +24,27 @@ "mkdirp-infer-owner": "^2.0.0" }, "devDependencies": { - "rimraf": "~2.2.8", - "tap": "^14.10.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "rimraf": "^3.0.2", + "tap": "^16.0.1" }, "files": [ - "index.js", - "lib" + "bin/", + "lib/" ], + "main": "lib/index.js", "tap": { "before": "test/00-setup.js", "after": "test/zz-cleanup.js", "check-coverage": true }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/dezalgo/package.json b/deps/npm/node_modules/dezalgo/package.json index 634dd0d92fb40d..f8ba8ec2b6b7a4 100644 --- a/deps/npm/node_modules/dezalgo/package.json +++ b/deps/npm/node_modules/dezalgo/package.json @@ -1,8 +1,11 @@ { "name": "dezalgo", - "version": "1.0.3", + "version": "1.0.4", "description": "Contain async insanity so that the dark pony lord doesn't eat souls", "main": "dezalgo.js", + "files": [ + "dezalgo.js" + ], "directories": { "test": "test" }, @@ -11,7 +14,7 @@ "wrappy": "1" }, "devDependencies": { - "tap": "^1.2.0" + "tap": "^12.4.0" }, "scripts": { "test": "tap test/*.js" @@ -26,12 +29,13 @@ "the dark pony", "he comes", "asynchrony of all holy and good", - "T̯̪ͅo̯͖̹ ̻̮̖̲͢i̥̖n̢͈͇̝͍v͏͉ok̭̬̝ͅe̞͍̩̫͍̩͝ ̩̮̖̟͇͉́t͔͔͎̗h͏̗̟e̘͉̰̦̠̞͓ ͕h͉̟͎̪̠̱͠ḭ̮̩v̺͉͇̩e̵͖-̺̪m͍i̜n̪̲̲̲̮d̷ ̢r̠̼̯̹̦̦͘ͅe͓̳͓̙p̺̗̫͙͘ͅr͔̰͜e̴͓̞s͉̩̩͟ͅe͏̣n͚͇̗̭̺͍tì͙̣n͏̖̥̗͎̰̪g̞͓̭̱̯̫̕ ̣̱͜ͅc̦̰̰̠̮͎͙̀hao̺̜̻͍͙ͅs͉͓̘.͎̼̺̼͕̹͘", - "̠̞̱̰I͖͇̝̻n̦̰͍̰̟v̤̺̫̳̭̼̗͘ò̹̟̩̩͚k̢̥̠͍͉̦̬i̖͓͔̮̱̻͘n̶̳͙̫͎g̖̯̣̲̪͉ ̞͎̗͕͚ͅt̲͕̘̺̯̗̦h̘̦̲̜̻e̳͎͉̬͙ ̴̞̪̲̥f̜̯͓͓̭̭͢e̱̘͔̮e̜̤l̺̱͖̯͓͙͈͢i̵̦̬͉͔̫͚͕n͉g̨͖̙̙̹̹̟̤ ͉̪o̞̠͍̪̰͙ͅf̬̲̺ ͔͕̲͕͕̲̕c̙͉h̝͔̩̙̕ͅa̲͖̻̗̹o̥̼̫s̝̖̜̝͚̫̟.̺͚ ̸̱̲W̶̥̣͖̦i͏̤̬̱̳̣ͅt͉h̗̪̪ ̷̱͚̹̪ǫ͕̗̣̳̦͎u̼̦͔̥̮̕ţ͖͎̻͔͉ ̴͎̩òr̹̰̖͉͈͝d̷̲̦̖͓e̲͓̠r", - "̧͚̜͓̰̭̭Ṯ̫̹̜̮̟̮͝h͚̘̩̘̖̰́e ̥̘͓͉͔͙̼N̟̜̣̘͔̪e̞̞̤͢z̰̖̘͇p̠͟e̺̱̣͍͙̝ṛ̘̬͔̙͇̠d͝ḭ̯̱̥̗̩a̛ͅn͏̦ ̷̥hi̥v̖̳̹͉̮̱͝e̹̪̘̖̰̟-̴͙͓͚̜̻mi̗̺̻͙̺ͅn̪̯͈d ͏̘͓̫̳ͅơ̹͔̳̖̣͓f͈̹̘ ͕ͅc̗̤̠̜̮̥̥h̡͍̩̭̫͚̱a̤͉̤͔͜os͕̤̼͍̲̀ͅ.̡̱ ̦Za̯̱̗̭͍̣͚l̗͉̰̤g͏̣̭̬̗̲͖ͅo̶̭̩̳̟͈.̪̦̰̳", - "H̴̱̦̗̬̣͓̺e̮ ͉̠̰̞͎̖͟ẁh̛̺̯ͅo̖̫͡ ̢Ẁa̡̗i̸t͖̣͉̀ş͔̯̩ ̤̦̮͇̞̦̲B͎̭͇̦̼e̢hin͏͙̟̪d̴̰͓̻̣̮͕ͅ T͖̮̕h͖e̘̺̰̙͘ ̥Ẁ̦͔̻͚a̞͖̪͉l̪̠̻̰̣̠l̲͎͞", - "Z̘͍̼͎̣͔͝Ą̲̜̱̱̹̤͇L̶̝̰̭͔G͍̖͍O̫͜ͅ!̼̤ͅ", - "H̝̪̜͓̀̌̂̒E̢̙̠̣ ̴̳͇̥̟̠͍̐C̹̓̑̐̆͝Ó̶̭͓̚M̬̼Ĕ̖̤͔͔̟̹̽̿̊ͥ̍ͫS̻̰̦̻̖̘̱̒ͪ͌̅͟" + "To invoke the hive mind representing chaos", + "Invoking the feeling of chaos. /Without order", + "The Nezperdian Hive Mind of Chaos, (zalgo………………)", + "He who waits beyond the wall", + "ZALGO", + "HE COMES", + "there used to be some funky unicode keywords here, but it broke the npm website on chrome, so they were removed, sorry" ], "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "license": "ISC", diff --git a/deps/npm/node_modules/dezalgo/test/basic.js b/deps/npm/node_modules/dezalgo/test/basic.js deleted file mode 100644 index da09e724da3ee1..00000000000000 --- a/deps/npm/node_modules/dezalgo/test/basic.js +++ /dev/null @@ -1,29 +0,0 @@ -var test = require('tap').test -var dz = require('../dezalgo.js') - -test('the dark pony', function(t) { - - var n = 0 - function foo(i, cb) { - cb = dz(cb) - if (++n % 2) cb(true, i) - else process.nextTick(cb.bind(null, false, i)) - } - - var called = 0 - var order = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9] - var o = 0 - for (var i = 0; i < 10; i++) { - foo(i, function(cached, i) { - t.equal(i, order[o++]) - t.equal(i % 2, cached ? 0 : 1) - called++ - }) - t.equal(called, 0) - } - - setTimeout(function() { - t.equal(called, 10) - t.end() - }) -}) diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/LICENSE b/deps/npm/node_modules/glob/node_modules/brace-expansion/LICENSE similarity index 100% rename from deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/LICENSE rename to deps/npm/node_modules/glob/node_modules/brace-expansion/LICENSE diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/index.js b/deps/npm/node_modules/glob/node_modules/brace-expansion/index.js similarity index 54% rename from deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/index.js rename to deps/npm/node_modules/glob/node_modules/brace-expansion/index.js index 668fb1cb9d45a4..2b6f4f85c951fc 100644 --- a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/index.js +++ b/deps/npm/node_modules/glob/node_modules/brace-expansion/index.js @@ -1,3 +1,4 @@ +var concatMap = require('concat-map'); var balanced = require('balanced-match'); module.exports = expandTop; @@ -78,6 +79,10 @@ function expandTop(str) { return expand(escapeBraces(str), true).map(unescapeBraces); } +function identity(e) { + return e; +} + function embrace(str) { return '{' + str + '}'; } @@ -96,7 +101,42 @@ function expand(str, isTop) { var expansions = []; var m = balanced('{', '}', str); - if (!m) return [str]; + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. // no need to expand pre, since it is guaranteed to be free of brace-sets var pre = m.pre; @@ -104,97 +144,55 @@ function expand(str, isTop) { ? expand(m.post, false) : ['']; - if (/\$$/.test(m.pre)) { - for (var k = 0; k < post.length; k++) { - var expansion = pre+ '{' + m.body + '}' + post[k]; - expansions.push(expansion); - } - } else { - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; } } - N.push(c); - } - } else { - N = []; - - for (var j = 0; j < n.length; j++) { - N.push.apply(N, expand(n[j], false)); } + N.push(c); } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); } } diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/package.json b/deps/npm/node_modules/glob/node_modules/brace-expansion/package.json similarity index 90% rename from deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/package.json rename to deps/npm/node_modules/glob/node_modules/brace-expansion/package.json index 7097d41e39de5d..a18faa8fd67b82 100644 --- a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/glob/node_modules/brace-expansion/package.json @@ -1,7 +1,7 @@ { "name": "brace-expansion", "description": "Brace expansion as known from sh/bash", - "version": "2.0.1", + "version": "1.1.11", "repository": { "type": "git", "url": "git://github.com/juliangruber/brace-expansion.git" @@ -14,10 +14,11 @@ "bench": "matcha test/perf/bench.js" }, "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" }, "devDependencies": { - "@c4312/matcha": "^1.3.1", + "matcha": "^0.7.0", "tape": "^4.6.0" }, "keywords": [], diff --git a/deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/glob/node_modules/minimatch/LICENSE similarity index 100% rename from deps/npm/node_modules/semver/node_modules/lru-cache/LICENSE rename to deps/npm/node_modules/glob/node_modules/minimatch/LICENSE diff --git a/deps/npm/node_modules/glob/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/glob/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000000000..fda45ade7cfc35 --- /dev/null +++ b/deps/npm/node_modules/glob/node_modules/minimatch/minimatch.js @@ -0,0 +1,947 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/package.json b/deps/npm/node_modules/glob/node_modules/minimatch/package.json similarity index 70% rename from deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/package.json rename to deps/npm/node_modules/glob/node_modules/minimatch/package.json index 2cc856968c0b29..566efdfe45cb80 100644 --- a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/package.json +++ b/deps/npm/node_modules/glob/node_modules/minimatch/package.json @@ -2,7 +2,10 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me)", "name": "minimatch", "description": "a glob matcher in javascript", - "version": "5.0.1", + "version": "3.1.2", + "publishConfig": { + "tag": "v3-legacy" + }, "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -10,23 +13,21 @@ "main": "minimatch.js", "scripts": { "test": "tap", - "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "postpublish": "git push origin --all; git push origin --tags" }, "engines": { - "node": ">=10" + "node": "*" }, "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^1.1.7" }, "devDependencies": { "tap": "^15.1.6" }, "license": "ISC", "files": [ - "minimatch.js", - "lib" + "minimatch.js" ] } diff --git a/deps/npm/node_modules/graceful-fs/LICENSE b/deps/npm/node_modules/graceful-fs/LICENSE index 9d2c8036969bed..e906a25acfb5ee 100644 --- a/deps/npm/node_modules/graceful-fs/LICENSE +++ b/deps/npm/node_modules/graceful-fs/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 947cd94bb41bca..8d5b89e4fa7fdb 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -191,16 +191,35 @@ function patch (fs) { var fs$readdir = fs.readdir fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ function readdir (path, options, cb) { if (typeof options === 'function') cb = options, options = null + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + return go$readdir(path, options, cb) - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) else { if (files && files.sort) files.sort() @@ -208,7 +227,7 @@ function patch (fs) { if (typeof cb === 'function') cb.call(this, err, files) } - }) + } } } diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index e1cb584739202f..305785687247ce 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -1,7 +1,7 @@ { "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", + "version": "4.2.10", "repository": { "type": "git", "url": "https://github.com/isaacs/node-graceful-fs" diff --git a/deps/npm/node_modules/graceful-fs/polyfills.js b/deps/npm/node_modules/graceful-fs/polyfills.js index 26804ef0a68524..46dea36cc490f4 100644 --- a/deps/npm/node_modules/graceful-fs/polyfills.js +++ b/deps/npm/node_modules/graceful-fs/polyfills.js @@ -71,13 +71,13 @@ function patch (fs) { fs.lstatSync = statFixSync(fs.lstatSync) // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { + if (fs.chmod && !fs.lchmod) { fs.lchmod = function (path, mode, cb) { if (cb) process.nextTick(cb) } fs.lchmodSync = function () {} } - if (!fs.lchown) { + if (fs.chown && !fs.lchown) { fs.lchown = function (path, uid, gid, cb) { if (cb) process.nextTick(cb) } @@ -94,32 +94,38 @@ function patch (fs) { // CPU to a busy looping process, which can cause the program causing the lock // contention to be starved of CPU by node, so the contention doesn't resolve. if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) } // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { function read (fd, buffer, offset, length, position, callback_) { var callback if (callback_ && typeof callback_ === 'function') { @@ -140,7 +146,8 @@ function patch (fs) { return read })(fs.read) - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { var eagCounter = 0 while (true) { try { @@ -199,7 +206,7 @@ function patch (fs) { } function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { fs.lutimes = function (path, at, mt, cb) { fs.open(path, constants.O_SYMLINK, function (er, fd) { if (er) { @@ -233,7 +240,7 @@ function patch (fs) { return ret } - } else { + } else if (fs.futimes) { fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } fs.lutimesSync = function () {} } diff --git a/deps/npm/node_modules/ignore-walk/index.js b/deps/npm/node_modules/ignore-walk/lib/index.js similarity index 91% rename from deps/npm/node_modules/ignore-walk/index.js rename to deps/npm/node_modules/ignore-walk/lib/index.js index 13fc954c54798f..40a0726c3257f1 100644 --- a/deps/npm/node_modules/ignore-walk/index.js +++ b/deps/npm/node_modules/ignore-walk/lib/index.js @@ -64,7 +64,7 @@ class Walker extends EE { this.entries = entries if (entries.length === 0) { if (this.includeEmpty) { - this.result.add(this.path.substr(this.root.length + 1)) + this.result.add(this.path.slice(this.root.length + 1)) } this.emit('done', this.result) } else { @@ -108,7 +108,9 @@ class Walker extends EE { } const rules = data.split(/\r?\n/) .filter(line => !/^#|^$/.test(line.trim())) - .map(r => new Minimatch(r, mmopt)) + .map(rule => { + return new Minimatch(rule.trim(), mmopt) + }) this.ignoreRules[file] = rules @@ -156,7 +158,7 @@ class Walker extends EE { const abs = this.path + '/' + entry if (!st.isDirectory()) { if (file) { - this.result.add(abs.substr(this.root.length + 1)) + this.result.add(abs.slice(this.root.length + 1)) } then() } else { @@ -171,21 +173,21 @@ class Walker extends EE { stat ({ entry, file, dir }, then) { const abs = this.path + '/' + entry - fs.lstat(abs, (er, st) => { - if (er) { - this.emit('error', er) + fs.lstat(abs, (lstatErr, lstatResult) => { + if (lstatErr) { + this.emit('error', lstatErr) } else { - const isSymbolicLink = st.isSymbolicLink() + const isSymbolicLink = lstatResult.isSymbolicLink() if (this.follow && isSymbolicLink) { - fs.stat(abs, (er, st) => { - if (er) { - this.emit('error', er) + fs.stat(abs, (statErr, statResult) => { + if (statErr) { + this.emit('error', statErr) } else { - this.onstat({ st, entry, file, dir, isSymbolicLink }, then) + this.onstat({ st: statResult, entry, file, dir, isSymbolicLink }, then) } }) } else { - this.onstat({ st, entry, file, dir, isSymbolicLink }, then) + this.onstat({ st: lstatResult, entry, file, dir, isSymbolicLink }, then) } } }) diff --git a/deps/npm/node_modules/ignore-walk/package.json b/deps/npm/node_modules/ignore-walk/package.json index ec6923d19aae9d..1bf96eb211bbc3 100644 --- a/deps/npm/node_modules/ignore-walk/package.json +++ b/deps/npm/node_modules/ignore-walk/package.json @@ -1,26 +1,31 @@ { "name": "ignore-walk", - "version": "4.0.1", + "version": "5.0.1", "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.", - "main": "index.js", + "main": "lib/index.js", "devDependencies": { - "@npmcli/lint": "^1.0.2", - "mkdirp": "^0.5.1", - "mutate-fs": "^1.1.0", - "rimraf": "^2.6.1", - "tap": "^15.0.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "mkdirp": "^1.0.4", + "mutate-fs": "^2.1.1", + "rimraf": "^3.0.2", + "tap": "^16.0.1" }, "scripts": { "test": "tap", - "posttest": "npm run lint --", - "lint": "npm run npmclilint -- \"*.*js\" \"test/**/*.*js\"", + "posttest": "npm run lint", + "lint": "eslint \"**/*.js\"", "eslint": "eslint", "lintfix": "npm run lint -- --fix", "preversion": "npm test", "postversion": "npm publish", "postpublish": "git push origin --follow-tags", "npmclilint": "npmcli-lint", - "postsnap": "npm run lintfix --" + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap" }, "keywords": [ "ignorefile", @@ -30,17 +35,18 @@ ".npmignore", "glob" ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "author": "GitHub Inc.", "license": "ISC", "repository": { "type": "git", - "url": "git+https://github.com/isaacs/ignore-walk.git" + "url": "https://github.com/npm/ignore-walk.git" }, "files": [ - "index.js" + "bin/", + "lib/" ], "dependencies": { - "minimatch": "^3.0.4" + "minimatch": "^5.0.1" }, "tap": { "test-env": "LC_ALL=sk", @@ -49,6 +55,11 @@ "jobs": 1 }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2", + "windowsCI": false } } diff --git a/deps/npm/node_modules/ini/ini.js b/deps/npm/node_modules/ini/lib/ini.js similarity index 75% rename from deps/npm/node_modules/ini/ini.js rename to deps/npm/node_modules/ini/lib/ini.js index 7d05a719b066c7..965e702493b1de 100644 --- a/deps/npm/node_modules/ini/ini.js +++ b/deps/npm/node_modules/ini/lib/ini.js @@ -1,5 +1,6 @@ const { hasOwnProperty } = Object.prototype +/* istanbul ignore next */ const eol = typeof process !== 'undefined' && process.platform === 'win32' ? '\r\n' : '\n' @@ -22,16 +23,19 @@ const encode = (obj, opt) => { for (const k of Object.keys(obj)) { const val = obj[k] if (val && Array.isArray(val)) { - for (const item of val) - out += safe(k + '[]') + separator + safe(item) + '\n' - } else if (val && typeof val === 'object') + for (const item of val) { + out += safe(k + '[]') + separator + safe(item) + eol + } + } else if (val && typeof val === 'object') { children.push(k) - else + } else { out += safe(k) + separator + safe(val) + eol + } } - if (opt.section && out.length) + if (opt.section && out.length) { out = '[' + safe(opt.section) + ']' + eol + out + } for (const k of children) { const nk = dotSplit(k).join('\\.') @@ -41,8 +45,9 @@ const encode = (obj, opt) => { section, whitespace, }) - if (out.length && child.length) + if (out.length && child.length) { out += eol + } out += child } @@ -67,11 +72,13 @@ const decode = str => { const lines = str.split(/[\r\n]+/g) for (const line of lines) { - if (!line || line.match(/^\s*[;#]/)) + if (!line || line.match(/^\s*[;#]/)) { continue + } const match = line.match(re) - if (!match) + if (!match) { continue + } if (match[1] !== undefined) { section = unsafe(match[1]) if (section === '__proto__') { @@ -86,8 +93,9 @@ const decode = str => { const keyRaw = unsafe(match[2]) const isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]' const key = isArray ? keyRaw.slice(0, -2) : keyRaw - if (key === '__proto__') + if (key === '__proto__') { continue + } const valueRaw = match[3] ? unsafe(match[4]) : true const value = valueRaw === 'true' || valueRaw === 'false' || @@ -96,18 +104,20 @@ const decode = str => { // Convert keys with '[]' suffix to an array if (isArray) { - if (!hasOwnProperty.call(p, key)) + if (!hasOwnProperty.call(p, key)) { p[key] = [] - else if (!Array.isArray(p[key])) + } else if (!Array.isArray(p[key])) { p[key] = [p[key]] + } } // safeguard against resetting a previously defined // array by accidentally forgetting the brackets - if (Array.isArray(p[key])) + if (Array.isArray(p[key])) { p[key].push(value) - else + } else { p[key] = value + } } // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} @@ -116,55 +126,64 @@ const decode = str => { for (const k of Object.keys(out)) { if (!hasOwnProperty.call(out, k) || typeof out[k] !== 'object' || - Array.isArray(out[k])) + Array.isArray(out[k])) { continue + } // see if the parent section is also an object. // if so, add it to that, and mark this one for deletion const parts = dotSplit(k) - let p = out + p = out const l = parts.pop() const nl = l.replace(/\\\./g, '.') for (const part of parts) { - if (part === '__proto__') + if (part === '__proto__') { continue - if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') + } + if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') { p[part] = Object.create(null) + } p = p[part] } - if (p === out && nl === l) + if (p === out && nl === l) { continue + } p[nl] = out[k] remove.push(k) } - for (const del of remove) + for (const del of remove) { delete out[del] + } return out } -const isQuoted = val => - (val.charAt(0) === '"' && val.slice(-1) === '"') || - (val.charAt(0) === "'" && val.slice(-1) === "'") +const isQuoted = val => { + return (val.startsWith('"') && val.endsWith('"')) || + (val.startsWith("'") && val.endsWith("'")) +} -const safe = val => - (typeof val !== 'string' || +const safe = val => { + if ( + typeof val !== 'string' || val.match(/[=\r\n]/) || val.match(/^\[/) || - (val.length > 1 && - isQuoted(val)) || - val !== val.trim()) - ? JSON.stringify(val) - : val.replace(/;/g, '\\;').replace(/#/g, '\\#') + (val.length > 1 && isQuoted(val)) || + val !== val.trim() + ) { + return JSON.stringify(val) + } + return val.split(';').join('\\;').split('#').join('\\#') +} const unsafe = (val, doUnesc) => { val = (val || '').trim() if (isQuoted(val)) { // remove the single quotes before calling JSON.parse - if (val.charAt(0) === "'") - val = val.substr(1, val.length - 2) - + if (val.charAt(0) === "'") { + val = val.slice(1, -1) + } try { val = JSON.parse(val) } catch (_) {} @@ -175,21 +194,24 @@ const unsafe = (val, doUnesc) => { for (let i = 0, l = val.length; i < l; i++) { const c = val.charAt(i) if (esc) { - if ('\\;#'.indexOf(c) !== -1) + if ('\\;#'.indexOf(c) !== -1) { unesc += c - else + } else { unesc += '\\' + c + } esc = false - } else if (';#'.indexOf(c) !== -1) + } else if (';#'.indexOf(c) !== -1) { break - else if (c === '\\') + } else if (c === '\\') { esc = true - else + } else { unesc += c + } } - if (esc) + if (esc) { unesc += '\\' + } return unesc.trim() } diff --git a/deps/npm/node_modules/ini/package.json b/deps/npm/node_modules/ini/package.json index 59b7d5d0ad99b5..1fe32c8f162a36 100644 --- a/deps/npm/node_modules/ini/package.json +++ b/deps/npm/node_modules/ini/package.json @@ -1,36 +1,41 @@ { - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "author": "GitHub Inc.", "name": "ini", "description": "An ini encoder/decoder for node", - "version": "2.0.0", + "version": "3.0.0", "repository": { "type": "git", - "url": "git://github.com/isaacs/ini.git" + "url": "https://github.com/npm/ini.git" }, - "main": "ini.js", + "main": "lib/ini.js", "scripts": { "eslint": "eslint", - "lint": "npm run eslint -- ini.js test/*.js", + "lint": "eslint \"**/*.js\"", "lintfix": "npm run lint -- --fix", "test": "tap", + "snap": "tap", "posttest": "npm run lint", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" }, "devDependencies": { - "eslint": "^7.9.0", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^4.0.1", - "tap": "14" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "license": "ISC", "files": [ - "ini.js" + "bin/", + "lib/" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/libnpmaccess/README.md b/deps/npm/node_modules/libnpmaccess/README.md index c079344597968a..3e35562cfddbcb 100644 --- a/deps/npm/node_modules/libnpmaccess/README.md +++ b/deps/npm/node_modules/libnpmaccess/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmaccess.svg)](https://npm.im/libnpmaccess) [![license](https://img.shields.io/npm/l/libnpmaccess.svg)](https://npm.im/libnpmaccess) -[![GitHub Actions](https://github.com/npm/libnpmaccess/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmaccess/actions?query=workflow%3A%22Node+CI%22) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmaccess/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmaccess?branch=latest) +[![CI - libnpmaccess](https://github.com/npm/cli/actions/workflows/ci-libnpmaccess.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmaccess.yml) [`libnpmaccess`](https://github.com/npm/libnpmaccess) is a Node.js library that provides programmatic access to the guts of the npm CLI's `npm diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 68ac1c28902f7f..bb6837309821cd 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "6.0.2", + "version": "6.0.3", "description": "programmatic library for `npm access` commands", "author": "GitHub Inc.", "license": "ISC", @@ -20,9 +20,9 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "nock": "^13.2.4", - "tap": "^15.1.0" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -40,15 +40,12 @@ "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, - "tap": { - "check-coverage": true - }, "files": [ "bin/", "lib/" ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmdiff/README.md b/deps/npm/node_modules/libnpmdiff/README.md index d48ac092ca3646..0f8205c7004400 100644 --- a/deps/npm/node_modules/libnpmdiff/README.md +++ b/deps/npm/node_modules/libnpmdiff/README.md @@ -2,9 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmdiff.svg)](https://npm.im/libnpmdiff) [![license](https://img.shields.io/npm/l/libnpmdiff.svg)](https://npm.im/libnpmdiff) -[![GitHub Actions](https://github.com/npm/libnpmdiff/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmdiff/actions?query=workflow%3Anode-ci) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmdiff/badge.svg?branch=main)](https://coveralls.io/github/npm/libnpmdiff?branch=main) - +[![CI - libnpmdiff](https://github.com/npm/cli/actions/workflows/ci-libnpmdiff.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmdiff.yml) The registry diff lib. ## Table of Contents diff --git a/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js b/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js index a954811407d4f5..f8277a809eef6b 100644 --- a/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js +++ b/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js @@ -14,7 +14,7 @@ const shouldPrintPatch = (path, opts = {}) => { filename.startsWith('.') ? filename : extname(filename) - ).substr(1) + ).slice(1) return !binaryExtensions.includes(extension) } diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index eeddaf09fdc774..88968216f54ba0 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,6 +1,6 @@ { "name": "libnpmdiff", - "version": "4.0.2", + "version": "4.0.3", "description": "The registry diff", "repository": { "type": "git", @@ -44,26 +44,23 @@ "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", - "tap": "^15.0.9" + "@npmcli/template-oss": "3.3.2", + "tap": "^16.0.1" }, "dependencies": { - "@npmcli/disparity-colors": "^1.0.1", + "@npmcli/disparity-colors": "^2.0.0", "@npmcli/installed-package-contents": "^1.0.7", "binary-extensions": "^2.2.0", "diff": "^5.0.0", - "minimatch": "^3.0.4", + "minimatch": "^5.0.1", "npm-package-arg": "^9.0.1", "pacote": "^13.0.5", "tar": "^6.1.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmexec/README.md b/deps/npm/node_modules/libnpmexec/README.md index 74d6f5211e61dd..dc79d12cffc456 100644 --- a/deps/npm/node_modules/libnpmexec/README.md +++ b/deps/npm/node_modules/libnpmexec/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmexec.svg)](https://npm.im/libnpmexec) [![license](https://img.shields.io/npm/l/libnpmexec.svg)](https://npm.im/libnpmexec) -[![GitHub Actions](https://github.com/npm/libnpmexec/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmexec/actions?query=workflow%3Anode-ci) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmexec/badge.svg?branch=main)](https://coveralls.io/github/npm/libnpmexec?branch=main) +[![CI - libnpmexec](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml) The `npm exec` (`npx`) Programmatic API diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index 7245f15b2ed912..72a1ee983520e9 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,6 +1,6 @@ { "name": "libnpmexec", - "version": "4.0.2", + "version": "4.0.3", "files": [ "bin/", "lib/" @@ -46,14 +46,13 @@ }, "tap": { "color": true, - "check-coverage": true, "files": "test/*.js" }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "bin-links": "^3.0.0", - "tap": "^15.0.6" + "tap": "^16.0.1" }, "dependencies": { "@npmcli/arborist": "^5.0.0", @@ -71,6 +70,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmfund/README.md b/deps/npm/node_modules/libnpmfund/README.md index 8ab663f634d6fb..6072b11d9dee7d 100644 --- a/deps/npm/node_modules/libnpmfund/README.md +++ b/deps/npm/node_modules/libnpmfund/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmfund.svg)](https://npm.im/libnpmfund) [![license](https://img.shields.io/npm/l/libnpmfund.svg)](https://npm.im/libnpmfund) -[![GitHub Actions](https://github.com/npm/libnpmfund/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmfund/actions?query=workflow%3Anode-ci) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmfund/badge.svg?branch=master)](https://coveralls.io/github/npm/libnpmfund?branch=master) +[![CI - libnpmfund](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml) [`libnpmfund`](https://github.com/npm/libnpmfund) is a Node.js library for retrieving **funding** information for packages installed using diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index ddc95f2f0a3b7b..fe8e8d8e37056d 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,6 +1,6 @@ { "name": "libnpmfund", - "version": "3.0.1", + "version": "3.0.2", "main": "lib/index.js", "files": [ "bin/", @@ -43,13 +43,10 @@ "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", - "tap": "^15.0.9" + "@npmcli/template-oss": "3.3.2", + "tap": "^16.0.1" }, "dependencies": { "@npmcli/arborist": "^5.0.0" @@ -59,6 +56,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmhook/README.md b/deps/npm/node_modules/libnpmhook/README.md index ce6e8c1a519898..309f8041da08b2 100644 --- a/deps/npm/node_modules/libnpmhook/README.md +++ b/deps/npm/node_modules/libnpmhook/README.md @@ -2,7 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmhook.svg)](https://npm.im/libnpmhook) [![license](https://img.shields.io/npm/l/libnpmhook.svg)](https://npm.im/libnpmhook) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmhook/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmhook?branch=latest) +[![CI - libnpmhook](https://github.com/npm/cli/actions/workflows/ci-libnpmhook.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmhook.yml) [`libnpmhook`](https://github.com/npm/libnpmhook) is a Node.js library for programmatically managing the npm registry's server-side hooks. diff --git a/deps/npm/node_modules/libnpmhook/lib/index.js b/deps/npm/node_modules/libnpmhook/lib/index.js index 7cd18261d84827..091cdc49a80d1a 100644 --- a/deps/npm/node_modules/libnpmhook/lib/index.js +++ b/deps/npm/node_modules/libnpmhook/lib/index.js @@ -13,7 +13,7 @@ cmd.add = (name, endpoint, secret, opts = {}) => { } if (name[0] === '~') { type = 'owner' - name = name.substr(1) + name = name.slice(1) } return fetch.json('/-/npm/v1/hooks/hook', { ...opts, diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index 4071d38ee5250b..99efed490b3c4a 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,6 +1,6 @@ { "name": "libnpmhook", - "version": "8.0.2", + "version": "8.0.3", "description": "programmatic API for managing npm registry hooks", "main": "lib/index.js", "files": [ @@ -21,9 +21,6 @@ "posttest": "npm run lint", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "repository": { "type": "git", "url": "https://github.com/npm/cli.git", @@ -43,15 +40,15 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "nock": "^13.2.4", - "tap": "^15.1.0" + "tap": "^16.0.1" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmorg/README.md b/deps/npm/node_modules/libnpmorg/README.md index b2e1ed589b8e98..d5165523eec986 100644 --- a/deps/npm/node_modules/libnpmorg/README.md +++ b/deps/npm/node_modules/libnpmorg/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmorg.svg)](https://npm.im/libnpmorg) [![license](https://img.shields.io/npm/l/libnpmorg.svg)](https://npm.im/libnpmorg) -[![GitHub Actions](https://github.com/npm/libnpmorg/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmorg/workflows/Node%20CI/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmorg/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmorg?branch=latest) +[![CI - libnpmorg](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml) [`libnpmorg`](https://github.com/npm/libnpmorg) is a Node.js library for programmatically accessing the [npm Org membership diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 58ca5ec42e3af1..be6086c115cf0b 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "4.0.2", + "version": "4.0.3", "description": "Programmatic api for `npm org` commands", "author": "GitHub Inc.", "main": "lib/index.js", @@ -29,15 +29,12 @@ "bin/", "lib/" ], - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "minipass": "^3.1.1", "nock": "^13.2.4", - "tap": "^15.0.0" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -55,6 +52,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmpack/README.md b/deps/npm/node_modules/libnpmpack/README.md index 15c911a1eaaa88..949dd07d8b5198 100644 --- a/deps/npm/node_modules/libnpmpack/README.md +++ b/deps/npm/node_modules/libnpmpack/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmpack.svg)](https://npm.im/libnpmpack) [![license](https://img.shields.io/npm/l/libnpmpack.svg)](https://npm.im/libnpmpack) -[![GitHub Actions](https://github.com/npm/libnpmpack/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmpack/actions?query=workflow%3A%22Node+CI%22) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmpack/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmpack?branch=latest) +[![CI - libnpmpack](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml) [`libnpmpack`](https://github.com/npm/libnpmpack) is a Node.js library for programmatically packing tarballs from a local directory or from a registry or github spec. If packing from a local source, `libnpmpack` will also run the `prepack` and `postpack` lifecycles. diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 4ee093c74d6163..1aa1d306a412d1 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpack", - "version": "4.0.2", + "version": "4.0.3", "description": "Programmatic API for the bits behind npm pack", "author": "GitHub Inc.", "main": "lib/index.js", @@ -24,14 +24,11 @@ "snap": "tap", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "nock": "^13.0.7", - "tap": "^15.0.0" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -50,6 +47,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmpublish/README.md b/deps/npm/node_modules/libnpmpublish/README.md index 0da46e89d3b051..85fb73e52fdbea 100644 --- a/deps/npm/node_modules/libnpmpublish/README.md +++ b/deps/npm/node_modules/libnpmpublish/README.md @@ -1,5 +1,9 @@ # libnpmpublish +[![npm version](https://img.shields.io/npm/v/libnpmpublish.svg)](https://npm.im/libnpmpublish) +[![license](https://img.shields.io/npm/l/libnpmpublish.svg)](https://npm.im/libnpmpublish) +[![CI - libnpmpublish](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml) + [`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js library for programmatically publishing and unpublishing npm packages. Give it a manifest as an object and a tarball as a Buffer, and it'll put them on diff --git a/deps/npm/node_modules/libnpmpublish/lib/unpublish.js b/deps/npm/node_modules/libnpmpublish/lib/unpublish.js index 7fbeea503a3374..91f5252aa33fcf 100644 --- a/deps/npm/node_modules/libnpmpublish/lib/unpublish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/unpublish.js @@ -82,7 +82,7 @@ const unpublish = async (spec, opts) => { ...opts, query: { write: true }, }) - const tarballUrl = new URL(dist.tarball).pathname.substr(1) + const tarballUrl = new URL(dist.tarball).pathname.slice(1) await npmFetch(`${tarballUrl}/-rev/${_rev}`, { ...opts, method: 'DELETE', diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index bb911039e309c3..ba6e72297074fc 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "6.0.2", + "version": "6.0.3", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", @@ -26,16 +26,13 @@ "snap": "tap", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "libnpmpack": "^4.0.0", "lodash.clonedeep": "^4.5.0", "nock": "^13.2.4", - "tap": "^15" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -49,13 +46,13 @@ "npm-package-arg": "^9.0.1", "npm-registry-fetch": "^13.0.0", "semver": "^7.1.3", - "ssri": "^8.0.1" + "ssri": "^9.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmsearch/README.md b/deps/npm/node_modules/libnpmsearch/README.md index 31f44fe247923d..86d75b16a433e1 100644 --- a/deps/npm/node_modules/libnpmsearch/README.md +++ b/deps/npm/node_modules/libnpmsearch/README.md @@ -2,7 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmsearch.svg)](https://npm.im/libnpmsearch) [![license](https://img.shields.io/npm/l/libnpmsearch.svg)](https://npm.im/libnpmsearch) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmsearch/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmsearch?branch=latest) +[![CI - libnpmsearch](https://github.com/npm/cli/actions/workflows/ci-libnpmsearch.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmsearch.yml) [`libnpmsearch`](https://github.com/npm/libnpmsearch) is a Node.js library for programmatically accessing the npm search endpoint. It does **not** support diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index 7bf69ecb8af457..85918e2543a754 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "5.0.2", + "version": "5.0.3", "description": "Programmatic API for searching in npm and compatible registries.", "author": "GitHub Inc.", "main": "lib/index.js", @@ -27,14 +27,11 @@ "snap": "tap", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true - }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "nock": "^13.2.4", - "tap": "^15" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -51,6 +48,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmteam/README.md b/deps/npm/node_modules/libnpmteam/README.md index 603cf6622cd495..97323f82a646f0 100644 --- a/deps/npm/node_modules/libnpmteam/README.md +++ b/deps/npm/node_modules/libnpmteam/README.md @@ -2,8 +2,7 @@ [![npm version](https://img.shields.io/npm/v/libnpmteam.svg)](https://npm.im/libnpmteam) [![license](https://img.shields.io/npm/l/libnpmteam.svg)](https://npm.im/libnpmteam) -[![GitHub Actions](https://github.com/npm/libnpmteam/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmteam/workflows/Node%20CI/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmteam/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmteam?branch=latest) +[![CI - libnpmteam](https://github.com/npm/cli/actions/workflows/ci-libnpmteam.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmteam.yml) [`libnpmteam`](https://github.com/npm/libnpmteam) is a Node.js library that provides programmatic access to the guts of the npm CLI's `npm diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 7f8ee98f2868d3..52309e1646dd0d 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -1,7 +1,7 @@ { "name": "libnpmteam", "description": "npm Team management APIs", - "version": "4.0.2", + "version": "4.0.3", "author": "GitHub Inc.", "license": "ISC", "main": "lib/index.js", @@ -19,9 +19,9 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "nock": "^13.2.4", - "tap": "^15" + "tap": "^16.0.1" }, "repository": { "type": "git", @@ -40,11 +40,8 @@ "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, - "tap": { - "check-coverage": true - }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/libnpmversion/README.md b/deps/npm/node_modules/libnpmversion/README.md index 165d16a2b607c0..ac9ee50ae35d91 100644 --- a/deps/npm/node_modules/libnpmversion/README.md +++ b/deps/npm/node_modules/libnpmversion/README.md @@ -1,5 +1,9 @@ # libnpmversion +[![npm version](https://img.shields.io/npm/v/libnpmversion.svg)](https://npm.im/libnpmversion) +[![license](https://img.shields.io/npm/l/libnpmversion.svg)](https://npm.im/libnpmversion) +[![CI - libnpmversion](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml) + Library to do the things that 'npm version' does. ## USAGE diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 2a3a7716a13e27..431587f07c4c5a 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "3.0.1", + "version": "3.0.3", "main": "lib/index.js", "files": [ "bin/", @@ -27,28 +27,26 @@ "template-oss-apply": "template-oss-apply --force" }, "tap": { - "coverage-map": "map.js", - "check-coverage": true + "coverage-map": "map.js" }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "require-inject": "^1.4.4", - "tap": "^15" + "tap": "^16.0.1" }, "dependencies": { "@npmcli/git": "^3.0.0", "@npmcli/run-script": "^3.0.0", "json-parse-even-better-errors": "^2.3.1", "proc-log": "^2.0.0", - "semver": "^7.3.5", - "stringify-package": "^1.0.1" + "semver": "^7.3.5" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2" + "version": "3.3.2" } } diff --git a/deps/npm/node_modules/lru-cache/index.js b/deps/npm/node_modules/lru-cache/index.js index 978b8f4ee95955..2168fd3a67bb41 100644 --- a/deps/npm/node_modules/lru-cache/index.js +++ b/deps/npm/node_modules/lru-cache/index.js @@ -127,7 +127,7 @@ class LRUCache { throw new TypeError('cannot set sizeCalculation without setting maxSize') } if (typeof this.sizeCalculation !== 'function') { - throw new TypeError('sizeCalculating set to non-function') + throw new TypeError('sizeCalculation set to non-function') } } @@ -273,11 +273,18 @@ class LRUCache { this.sizes = new ZeroArray(this.max) this.removeItemSize = index => this.calculatedSize -= this.sizes[index] this.requireSize = (k, v, size, sizeCalculation) => { - if (sizeCalculation && !size) { - size = sizeCalculation(v, k) - } if (!isPosInt(size)) { - throw new TypeError('size must be positive integer') + if (sizeCalculation) { + if (typeof sizeCalculation !== 'function') { + throw new TypeError('sizeCalculation must be a function') + } + size = sizeCalculation(v, k) + if (!isPosInt(size)) { + throw new TypeError('sizeCalculation return invalid (expect positive integer)') + } + } else { + throw new TypeError('invalid size value (must be positive integer)') + } } return size } @@ -559,7 +566,7 @@ class LRUCache { if (this.isBackgroundFetch(v)) { return v } - const ac = new AbortController() + const ac = new AC() const fetchOpts = { signal: ac.signal, options, diff --git a/deps/npm/node_modules/lru-cache/package.json b/deps/npm/node_modules/lru-cache/package.json index 84d199c2b21b35..ca75abf0040219 100644 --- a/deps/npm/node_modules/lru-cache/package.json +++ b/deps/npm/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "7.7.1", + "version": "7.7.3", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -22,7 +22,7 @@ "devDependencies": { "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", - "clock-mock": "^1.0.3", + "clock-mock": "^1.0.4", "size-limit": "^7.0.8", "tap": "^15.1.6" }, diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json index 0e147be69889d2..720ba01f1b213f 100644 --- a/deps/npm/node_modules/make-fetch-happen/package.json +++ b/deps/npm/node_modules/make-fetch-happen/package.json @@ -1,6 +1,6 @@ { "name": "make-fetch-happen", - "version": "10.1.1", + "version": "10.1.2", "description": "Opinionated, caching, retrying fetch client", "main": "lib/index.js", "files": [ @@ -51,11 +51,11 @@ "negotiator": "^0.6.3", "promise-retry": "^2.0.1", "socks-proxy-agent": "^6.1.1", - "ssri": "^8.0.1" + "ssri": "^9.0.0" }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.0", + "@npmcli/template-oss": "3.2.2", "mkdirp": "^1.0.4", "nock": "^13.2.4", "rimraf": "^3.0.2", @@ -73,6 +73,6 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.0" + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/minimatch/LICENSE b/deps/npm/node_modules/minimatch/LICENSE index 19129e315fe593..9517b7d995bb03 100644 --- a/deps/npm/node_modules/minimatch/LICENSE +++ b/deps/npm/node_modules/minimatch/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/lib/path.js b/deps/npm/node_modules/minimatch/lib/path.js similarity index 100% rename from deps/npm/node_modules/@npmcli/map-workspaces/node_modules/minimatch/lib/path.js rename to deps/npm/node_modules/minimatch/lib/path.js diff --git a/deps/npm/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/minimatch/minimatch.js index fda45ade7cfc35..f3b491dd1073ed 100644 --- a/deps/npm/node_modules/minimatch/minimatch.js +++ b/deps/npm/node_modules/minimatch/minimatch.js @@ -1,15 +1,24 @@ -module.exports = minimatch -minimatch.Minimatch = Minimatch +const minimatch = module.exports = (p, pattern, options = {}) => { + assertValidPattern(pattern) + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } -var path = (function () { try { return require('path') } catch (e) {}}()) || { - sep: '/' + return new Minimatch(pattern, options).match(p) } + +module.exports = minimatch + +const path = require('./lib/path.js') minimatch.sep = path.sep -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = require('brace-expansion') +const GLOBSTAR = Symbol('globstar **') +minimatch.GLOBSTAR = GLOBSTAR +const expand = require('brace-expansion') -var plTypes = { +const plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, '?': { open: '(?:', close: ')?' }, '+': { open: '(?:', close: ')+' }, @@ -19,215 +28,71 @@ var plTypes = { // any single thing other than / // don't need to escape / when using new RegExp() -var qmark = '[^/]' +const qmark = '[^/]' // * => any number of characters -var star = qmark + '*?' +const star = qmark + '*?' // ** when dots are allowed. Anything goes, except .. and . // not (^ or / followed by one or two dots followed by $ or /), // followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' +const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' // not a ^ or / followed by a dot, // followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' +const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// "abc" -> { a:true, b:true, c:true } +const charSet = s => s.split('').reduce((set, c) => { + set[c] = true + return set +}, {}) // characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') +const reSpecials = charSet('().*{}+?[]^$\\!') -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} +// characters that indicate we have to add the pattern start +const addPatternStartSet = charSet('[.(') // normalizes slashes. -var slashSplit = /\/+/ +const slashSplit = /\/+/ -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} +minimatch.filter = (pattern, options = {}) => + (p, i, list) => minimatch(p, pattern, options) -function ext (a, b) { - b = b || {} - var t = {} - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) +const ext = (a, b = {}) => { + const t = {} + Object.keys(a).forEach(k => t[k] = a[k]) + Object.keys(b).forEach(k => t[k] = b[k]) return t } -minimatch.defaults = function (def) { +minimatch.defaults = def => { if (!def || typeof def !== 'object' || !Object.keys(def).length) { return minimatch } - var orig = minimatch - - var m = function minimatch (p, pattern, options) { - return orig(p, pattern, ext(def, options)) - } - - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - m.Minimatch.defaults = function defaults (options) { - return orig.defaults(ext(def, options)).Minimatch - } - - m.filter = function filter (pattern, options) { - return orig.filter(pattern, ext(def, options)) - } - - m.defaults = function defaults (options) { - return orig.defaults(ext(def, options)) - } - - m.makeRe = function makeRe (pattern, options) { - return orig.makeRe(pattern, ext(def, options)) - } - - m.braceExpand = function braceExpand (pattern, options) { - return orig.braceExpand(pattern, ext(def, options)) - } + const orig = minimatch - m.match = function (list, pattern, options) { - return orig.match(list, pattern, ext(def, options)) + const m = (p, pattern, options) => orig(p, pattern, ext(def, options)) + m.Minimatch = class Minimatch extends orig.Minimatch { + constructor (pattern, options) { + super(pattern, ext(def, options)) + } } + m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch + m.filter = (pattern, options) => orig.filter(pattern, ext(def, options)) + m.defaults = options => orig.defaults(ext(def, options)) + m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options)) + m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options)) + m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options)) return m } -Minimatch.defaults = function (def) { - return minimatch.defaults(def).Minimatch -} - -function minimatch (p, pattern, options) { - assertValidPattern(pattern) - - if (!options) options = {} - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - return new Minimatch(pattern, options).match(p) -} - -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - - assertValidPattern(pattern) - - if (!options) options = {} - - pattern = pattern.trim() - - // windows support: need to use /, not \ - if (!options.allowWindowsEscape && path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - this.partial = !!options.partial - - // make the set of regexps etc. - this.make() -} - -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - var pattern = this.pattern - var options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - // step 1: figure out negation, etc. - this.parseNegate() - // step 2: expand braces - var set = this.globSet = this.braceExpand() - if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - - this.debug(this.pattern, set) - - this.set = set -} - -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 - - if (options.nonegate) return - - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} // Brace expansion: // a{b,c}d -> abd acd @@ -239,24 +104,9 @@ function parseNegate () { // Invalid sets are not expanded. // a{2..}b -> a{2..}b // a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} - } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern +minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options) +const braceExpand = (pattern, options = {}) => { assertValidPattern(pattern) // Thanks to Yeting Li for @@ -269,8 +119,8 @@ function braceExpand (pattern, options) { return expand(pattern) } -var MAX_PATTERN_LENGTH = 1024 * 64 -var assertValidPattern = function (pattern) { +const MAX_PATTERN_LENGTH = 1024 * 64 +const assertValidPattern = pattern => { if (typeof pattern !== 'string') { throw new TypeError('invalid pattern') } @@ -291,657 +141,761 @@ var assertValidPattern = function (pattern) { // when it is the *only* thing in a path portion. Otherwise, any series // of * is equivalent to a single *. Globstar behavior is enabled by // default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - assertValidPattern(pattern) +const SUBPARSE = Symbol('subparse') - var options = this.options +minimatch.makeRe = (pattern, options) => + new Minimatch(pattern, options || {}).makeRe() - // shortcuts - if (pattern === '**') { - if (!options.noglobstar) - return GLOBSTAR - else - pattern = '*' +minimatch.match = (list, pattern, options = {}) => { + const mm = new Minimatch(pattern, options) + list = list.filter(f => mm.match(f)) + if (mm.options.nonull && !list.length) { + list.push(pattern) } - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false + return list +} + +// replace stuff like \* with * +const globUnescape = s => s.replace(/\\(.)/g, '$1') +const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') + +class Minimatch { + constructor (pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() + } + + debug () {} + + make () { + const pattern = this.pattern + const options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + let set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = (...args) => console.error(...args) + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(s => s.split(slashSplit)) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map((s, si, set) => s.map(this.parse, this)) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(s => s.indexOf(false) === -1) + + this.debug(this.pattern, set) + + this.set = set } - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) + parseNegate () { + if (this.options.nonegate) return - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue + const pattern = this.pattern + let negate = false + let negateOffset = 0 + + for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { + negate = !negate + negateOffset++ } - switch (c) { - /* istanbul ignore next */ - case '/': { - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - } + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate + } - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + matchOne (file, pattern, partial) { + var options = this.options - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) - if (!stateChar) { - re += '\\(' - continue - } + this.debug('matchOne', file.length, pattern.length) - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true } - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } } - pl.reEnd = re.length - continue - - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true } + return false + } - clearStateChar() - re += '|' - continue + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() + if (!hit) return false + } - if (inClass) { - re += '\\' + c - continue - } + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') + } - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue + braceExpand () { + return braceExpand(this.pattern, this.options) + } + + parse (pattern, isSub) { + assertValidPattern(pattern) + + const options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + let re = '' + let hasMagic = !!options.nocase + let escaping = false + // ? => one single character + const patternListStack = [] + const negativeLists = [] + let stateChar + let inClass = false + let reClassStart = -1 + let classStart = -1 + let cs + let pl + let sp + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + const patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + + const clearStateChar = () => { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break } + this.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } - // finish up the class. - hasMagic = true - inClass = false - re += c - continue + for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) - default: - // swallow any state char that wasn't consumed - clearStateChar() + // skip over any that are escaped. + if (escaping) { + /* istanbul ignore next - completely not allowed, even escaped. */ + if (c === '/') { + return false + } - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { + if (reSpecials[c]) { re += '\\' } - re += c + escaping = false + continue + } - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } + switch (c) { + /* istanbul ignore next */ + case '/': { + // Should already be path-split by now. + return false + } - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } + case '\\': + clearStateChar() + escaping = true + continue - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + this.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '[': case '.': case '(': addPatternStart = true - } + if (!stateChar) { + re += '\\(' + continue + } - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] - - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) - - nlLast += nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } + clearStateChar() + hasMagic = true + pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } + case '|': + if (inClass || !patternListStack.length) { + re += '\\|' + continue + } - if (addPatternStart) { - re = patternStart + re - } + clearStateChar() + re += '|' + continue - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } + if (inClass) { + re += '\\' + c + continue + } - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) /* istanbul ignore next - should be impossible */ { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + continue + } - regExp._glob = pattern - regExp._src = re + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } - return regExp -} + // finish up the class. + hasMagic = true + inClass = false + re += c + continue -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} + default: + // swallow any state char that wasn't consumed + clearStateChar() -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp + if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\' + } - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set + re += c + break + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options - - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) /* istanbul ignore next - should be impossible */ { - this.regexp = false - } - return this.regexp -} + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + let tail + tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => { + /* istanbul ignore else - should already be done */ + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + const t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } -Minimatch.prototype.match = function match (f, partial) { - if (typeof partial === 'undefined') partial = this.partial - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } - if (f === '/' && partial) return true + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + const addPatternStart = addPatternStartSet[re.charAt(0)] + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (let n = negativeLists.length - 1; n > -1; n--) { + const nl = negativeLists[n] + + const nlBefore = re.slice(0, nl.reStart) + const nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + let nlAfter = re.slice(nl.reEnd) + const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + const openParensBefore = nlBefore.split('(').length - 1 + let cleanAfter = nlAfter + for (let i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter - var options = this.options + const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : '' + re = nlBefore + nlFirst + nlAfter + dollar + nlLast + } - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) + if (addPatternStart) { + re = patternStart + re + } - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } - var set = this.set - this.debug(this.pattern, 'set', set) + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break + const flags = options.nocase ? 'i' : '' + try { + return Object.assign(new RegExp('^' + re + '$', flags), { + _glob: pattern, + _src: re, + }) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } } - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] + makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + const set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate + const options = this.options + + const twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + const flags = options.nocase ? 'i' : '' + + // coalesce globstars and regexpify non-globstar patterns + // if it's the only item, then we just do one twoStar + // if it's the first, and there are more, prepend (\/|twoStar\/)? to next + // if it's the last, append (\/twoStar|) to previous + // if it's in the middle, append (\/|\/twoStar\/) to previous + // then filter out GLOBSTAR symbols + let re = set.map(pattern => { + pattern = pattern.map(p => + typeof p === 'string' ? regExpEscape(p) + : p === GLOBSTAR ? GLOBSTAR + : p._src + ).reduce((set, p) => { + if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) { + set.push(p) + } + return set + }, []) + pattern.forEach((p, i) => { + if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) { + return + } + if (i === 0) { + if (pattern.length > 1) { + pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1] + } else { + pattern[i] = twoStar + } + } else if (i === pattern.length - 1) { + pattern[i-1] += '(?:\\\/|' + twoStar + ')?' + } else { + pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1] + pattern[i+1] = GLOBSTAR + } + }) + return pattern.filter(p => p !== GLOBSTAR).join('/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false } + return this.regexp } - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} + match (f, partial = this.partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - /* istanbul ignore if */ - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } + if (f === '/' && partial) return true - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] + const options = this.options - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - /* istanbul ignore if */ - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false + const set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + let filename + for (let i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break } - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - hit = f === p - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) + for (let i = 0; i < set.length; i++) { + const pattern = set[i] + let file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + const hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } } - if (!hit) return false + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate } - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else /* istanbul ignore else */ if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - return (fi === fl - 1) && (file[fi] === '') + static defaults (def) { + return minimatch.defaults(def).Minimatch } - - // should be unreachable. - /* istanbul ignore next */ - throw new Error('wtf?') } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} - -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} +minimatch.Minimatch = Minimatch diff --git a/deps/npm/node_modules/minimatch/package.json b/deps/npm/node_modules/minimatch/package.json index 566efdfe45cb80..2cc856968c0b29 100644 --- a/deps/npm/node_modules/minimatch/package.json +++ b/deps/npm/node_modules/minimatch/package.json @@ -2,10 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me)", "name": "minimatch", "description": "a glob matcher in javascript", - "version": "3.1.2", - "publishConfig": { - "tag": "v3-legacy" - }, + "version": "5.0.1", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -13,21 +10,23 @@ "main": "minimatch.js", "scripts": { "test": "tap", + "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" + "prepublishOnly": "git push origin --follow-tags" }, "engines": { - "node": "*" + "node": ">=10" }, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "devDependencies": { "tap": "^15.1.6" }, "license": "ISC", "files": [ - "minimatch.js" + "minimatch.js", + "lib" ] } diff --git a/deps/npm/node_modules/npm-install-checks/index.js b/deps/npm/node_modules/npm-install-checks/lib/index.js similarity index 91% rename from deps/npm/node_modules/npm-install-checks/index.js rename to deps/npm/node_modules/npm-install-checks/lib/index.js index 732888ef57b8a8..728e8cf3f86826 100644 --- a/deps/npm/node_modules/npm-install-checks/index.js +++ b/deps/npm/node_modules/npm-install-checks/lib/index.js @@ -1,4 +1,3 @@ -const {format} = require('util') const semver = require('semver') const checkEngine = (target, npmVer, nodeVer, force = false) => { @@ -16,7 +15,7 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => { pkgid: target._id, current: { node: nodeVer, npm: npmVer }, required: eng, - code: 'EBADENGINE' + code: 'EBADENGINE', }) } } @@ -36,13 +35,13 @@ const checkPlatform = (target, force = false) => { pkgid: target._id, current: { os: platform, - cpu: arch + cpu: arch, }, required: { os: target.os, - cpu: target.cpu + cpu: target.cpu, }, - code: 'EBADPLATFORM' + code: 'EBADPLATFORM', }) } } @@ -62,7 +61,7 @@ const checkList = (value, list) => { const negate = entry.charAt(0) === '!' const test = negate ? entry.slice(1) : entry if (negate) { - negated ++ + negated++ if (value === test) { return false } @@ -75,5 +74,5 @@ const checkList = (value, list) => { module.exports = { checkEngine, - checkPlatform + checkPlatform, } diff --git a/deps/npm/node_modules/npm-install-checks/package.json b/deps/npm/node_modules/npm-install-checks/package.json index 0eb597ae83480a..ce33718514b4a6 100644 --- a/deps/npm/node_modules/npm-install-checks/package.json +++ b/deps/npm/node_modules/npm-install-checks/package.json @@ -1,23 +1,32 @@ { "name": "npm-install-checks", - "version": "4.0.0", + "version": "5.0.0", "description": "Check the engines and platform fields in package.json", - "main": "index.js", + "main": "lib/index.js", "dependencies": { "semver": "^7.1.1" }, "devDependencies": { - "tap": "^14.10.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "scripts": { "test": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "posttest": "npm run lint" }, "repository": { "type": "git", - "url": "git://github.com/npm/npm-install-checks.git" + "url": "https://github.com/npm/npm-install-checks.git" }, "keywords": [ "npm,", @@ -25,9 +34,15 @@ ], "license": "BSD-2-Clause", "files": [ - "index.js" + "bin/", + "lib/" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/npm-package-arg/README.md deleted file mode 100644 index 3f00b61d54dfa4..00000000000000 --- a/deps/npm/node_modules/npm-package-arg/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# npm-package-arg - -[![Build Status](https://travis-ci.org/npm/npm-package-arg.svg?branch=master)](https://travis-ci.org/npm/npm-package-arg) - -Parses package name and specifier passed to commands like `npm install` or -`npm cache add`, or as found in `package.json` dependency sections. - -## EXAMPLES - -```javascript -var assert = require("assert") -var npa = require("npm-package-arg") - -// Pass in the descriptor, and it'll return an object -try { - var parsed = npa("@bar/foo@1.2") -} catch (ex) { - … -} -``` - -## USING - -`var npa = require('npm-package-arg')` - -### var result = npa(*arg*[, *where*]) - -* *arg* - a string that you might pass to `npm install`, like: -`foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`, -`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz`, -`../foo/bar/` or `bar`. If the *arg* you provide doesn't have a specifier -part, eg `foo` then the specifier will default to `latest`. -* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()` - -**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported. - -### var result = npa.resolve(*name*, *spec*[, *where*]) - -* *name* - The name of the module you want to install. For example: `foo` or `@bar/foo`. -* *spec* - The specifier indicating where and how you can get this module. Something like: -`1.2`, `^1.7.17`, `http://x.com/foo.tgz`, `git+https://github.com/user/foo`, -`bitbucket:user/foo`, `file:foo.tar.gz` or `file:../foo/bar/`. If not -included then the default is `latest`. -* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()` - -**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported. - -## RESULT OBJECT - -The objects that are returned by npm-package-arg contain the following -keys: - -* `type` - One of the following strings: - * `git` - A git repo - * `tag` - A tagged version, like `"foo@latest"` - * `version` - A specific version number, like `"foo@1.2.3"` - * `range` - A version range, like `"foo@2.x"` - * `file` - A local `.tar.gz`, `.tar` or `.tgz` file. - * `directory` - A local directory. - * `remote` - An http url (presumably to a tgz) - * `alias` - A specifier with an alias, like `myalias@npm:foo@1.2.3` -* `registry` - If true this specifier refers to a resource hosted on a - registry. This is true for `tag`, `version` and `range` types. -* `name` - If known, the `name` field expected in the resulting pkg. -* `scope` - If a name is something like `@org/module` then the `scope` - field will be set to `@org`. If it doesn't have a scoped name, then - scope is `null`. -* `escapedName` - A version of `name` escaped to match the npm scoped packages - specification. Mostly used when making requests against a registry. When - `name` is `null`, `escapedName` will also be `null`. -* `rawSpec` - The specifier part that was parsed out in calls to `npa(arg)`, - or the value of `spec` in calls to `npa.resolve(name, spec). -* `saveSpec` - The normalized specifier, for saving to package.json files. - `null` for registry dependencies. -* `fetchSpec` - The version of the specifier to be used to fetch this - resource. `null` for shortcuts to hosted git dependencies as there isn't - just one URL to try with them. -* `gitRange` - If set, this is a semver specifier to match against git tags with -* `gitCommittish` - If set, this is the specific committish to use with a git dependency. -* `hosted` - If `from === 'hosted'` then this will be a `hosted-git-info` - object. This property is not included when serializing the object as - JSON. -* `raw` - The original un-modified string that was provided. If called as - `npa.resolve(name, spec)` then this will be `name + '@' + spec`. -* `subSpec` - If `type === 'alias'`, this is a Result Object for parsing the - target specifier for the alias. diff --git a/deps/npm/node_modules/npm-packlist/bin/index.js b/deps/npm/node_modules/npm-packlist/bin/index.js index a42f5b74ce80e8..48a6b879aa823c 100755 --- a/deps/npm/node_modules/npm-packlist/bin/index.js +++ b/deps/npm/node_modules/npm-packlist/bin/index.js @@ -1,4 +1,7 @@ #!/usr/bin/env node +'use strict' + +const packlist = require('../') const dirs = [] let doSort = false @@ -15,12 +18,22 @@ process.argv.slice(2).forEach(arg => { const sort = list => doSort ? list.sort((a, b) => a.localeCompare(b, 'en')) : list -const packlist = require('../') -if (!dirs.length) { - console.log(sort(packlist.sync({ path: process.cwd() })).join('\n')) -} else { - dirs.forEach(path => { - console.log(`> ${path}`) - console.log(sort(packlist.sync({ path })).join('\n')) - }) +const main = async () => { + if (!dirs.length) { + const results = await packlist({ path: process.cwd() }) + console.log(sort(results).join('\n')) + } else { + for (const dir of dirs) { + console.group(`> ${dir}`) + const results = await packlist({ path: dir }) + console.log(sort(results).join('\n')) + console.groupEnd() + } + } } + +// coverage disabled for catch handler because we don't need to test that +main().catch(/* istanbul ignore next */(err) => { + process.exitCode = 1 + console.error(err.stack) +}) diff --git a/deps/npm/node_modules/npm-packlist/lib/index.js b/deps/npm/node_modules/npm-packlist/lib/index.js index 1b67e4e71e04d3..30d99dc873f267 100644 --- a/deps/npm/node_modules/npm-packlist/lib/index.js +++ b/deps/npm/node_modules/npm-packlist/lib/index.js @@ -7,11 +7,9 @@ const bundleWalk = require('npm-bundled') const BundleWalker = bundleWalk.BundleWalker -const BundleWalkerSync = bundleWalk.BundleWalkerSync const ignoreWalk = require('ignore-walk') const IgnoreWalker = ignoreWalk.Walker -const IgnoreWalkerSync = ignoreWalk.WalkerSync const rootBuiltinRules = Symbol('root-builtin-rules') const packageNecessaryRules = Symbol('package-necessary-rules') @@ -34,6 +32,24 @@ const packageMustHavesRE = new RegExp(`^(${packageMustHaveFileNames})(\\..*[^~$] const fs = require('fs') const glob = require('glob') +const pathHasPkg = (input) => { + if (!input.startsWith('node_modules/')) { + return false + } + + const segments = input.slice('node_modules/'.length).split('/', 2) + return segments[0].startsWith('@') + ? segments.length === 2 + : true +} + +const pkgFromPath = (input) => { + const segments = input.slice('node_modules/'.length).split('/', 2) + return segments[0].startsWith('@') + ? segments.join('/') + : segments[0] +} + const defaultRules = [ '.npmignore', '.gitignore', @@ -65,8 +81,7 @@ const defaultRules = [ // There may be others, but :?|<> are handled by node-tar const nameIsBadForWindows = file => /\*/.test(file) -// a decorator that applies our custom rules to an ignore walker -const npmWalker = Class => class Walker extends Class { +class Walker extends IgnoreWalker { constructor (opt) { opt = opt || {} @@ -90,7 +105,7 @@ const npmWalker = Class => class Walker extends Class { // hierarchy (ie, not in test/foo/node_modules/ or something). const followRe = /^(?:\/node_modules\/(?:@[^/]+\/[^/]+|[^/]+)\/)*\/node_modules(?:\/@[^/]+)?$/ const rootPath = opt.parent ? opt.parent.root : opt.path - const followTestPath = opt.path.replace(/\\/g, '/').substr(rootPath.length) + const followTestPath = opt.path.replace(/\\/g, '/').slice(rootPath.length) opt.follow = followRe.test(followTestPath) super(opt) @@ -224,7 +239,7 @@ const npmWalker = Class => class Walker extends Class { const patterns = Array.from(new Set(pkg.files)).reduce((set, pattern) => { const excl = pattern.match(/^!+/) if (excl) { - pattern = pattern.substr(excl[0].length) + pattern = pattern.slice(excl[0].length) } // strip off any / from the start of the pattern. /foo => foo pattern = pattern.replace(/^\/+/, '') @@ -248,8 +263,8 @@ const npmWalker = Class => class Walker extends Class { processResults(results) } } - const processResults = results => { - for (const { negate, fileList } of results) { + const processResults = processed => { + for (const { negate, fileList } of processed) { if (negate) { fileList.forEach(f => { f = f.replace(/\/+$/, '') @@ -283,11 +298,11 @@ const npmWalker = Class => class Walker extends Class { filterEntry (entry, partial) { // get the partial path from the root of the walk - const p = this.path.substr(this.root.length + 1) - const pkgre = /^node_modules\/(@[^/]+\/?[^/]+|[^/]+)(\/.*)?$/ + const p = this.path.slice(this.root.length + 1) const { isProject } = this - const pkg = isProject && pkgre.test(entry) ? - entry.replace(pkgre, '$1') : null + const pkg = isProject && pathHasPkg(entry) + ? pkgFromPath(entry) + : null const rootNM = isProject && entry === 'node_modules' const rootPJ = isProject && entry === 'package.json' @@ -399,11 +414,19 @@ const npmWalker = Class => class Walker extends Class { } sort (a, b) { - return sort(a, b) + // optimize for compressibility + // extname, then basename, then locale alphabetically + // https://twitter.com/isntitvacant/status/1131094910923231232 + const exta = path.extname(a).toLowerCase() + const extb = path.extname(b).toLowerCase() + const basea = path.basename(a).toLowerCase() + const baseb = path.basename(b).toLowerCase() + + return exta.localeCompare(extb, 'en') || + basea.localeCompare(baseb, 'en') || + a.localeCompare(b, 'en') } -} -class Walker extends npmWalker(IgnoreWalker) { globFiles (pattern, cb) { glob(pattern, { dot: true, cwd: this.path, nocase: true }, cb) } @@ -418,26 +441,6 @@ class Walker extends npmWalker(IgnoreWalker) { } } -class WalkerSync extends npmWalker(IgnoreWalkerSync) { - globFiles (pattern, cb) { - cb(null, glob.sync(pattern, { dot: true, cwd: this.path, nocase: true })) - } - - readPackageJson (entries) { - const p = this.path + '/package.json' - try { - this.onReadPackageJson(entries, null, fs.readFileSync(p)) - } catch (er) { - this.onReadPackageJson(entries, er) - } - } - - walker (entry, opt, then) { - new WalkerSync(this.walkerOpt(entry, opt)).start() - then() - } -} - const walk = (options, callback) => { options = options || {} const p = new Promise((resolve, reject) => { @@ -452,31 +455,5 @@ const walk = (options, callback) => { return callback ? p.then(res => callback(null, res), callback) : p } -const walkSync = options => { - options = options || {} - const bw = new BundleWalkerSync(options).start() - options.bundled = bw.result - options.packageJsonCache = bw.packageJsonCache - const walker = new WalkerSync(options) - walker.start() - return walker.result -} - -// optimize for compressibility -// extname, then basename, then locale alphabetically -// https://twitter.com/isntitvacant/status/1131094910923231232 -const sort = (a, b) => { - const exta = path.extname(a).toLowerCase() - const extb = path.extname(b).toLowerCase() - const basea = path.basename(a).toLowerCase() - const baseb = path.basename(b).toLowerCase() - - return exta.localeCompare(extb, 'en') || - basea.localeCompare(baseb, 'en') || - a.localeCompare(b, 'en') -} - module.exports = walk -walk.sync = walkSync walk.Walker = Walker -walk.WalkerSync = WalkerSync diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index ab270f60713b6a..632524d789ca81 100644 --- a/deps/npm/node_modules/npm-packlist/package.json +++ b/deps/npm/node_modules/npm-packlist/package.json @@ -1,6 +1,6 @@ { "name": "npm-packlist", - "version": "4.0.0", + "version": "5.0.0", "description": "Get a list of the files to add from a folder into an npm package", "directories": { "test": "test" @@ -8,20 +8,21 @@ "main": "lib", "dependencies": { "glob": "^7.2.0", - "ignore-walk": "^4.0.1", + "ignore-walk": "^5.0.1", "npm-bundled": "^1.1.2", "npm-normalize-package-bin": "^1.0.1" }, "author": "GitHub Inc.", "license": "ISC", "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "devDependencies": { - "@npmcli/template-oss": "^2.9.2", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "mutate-fs": "^2.1.1", - "tap": "^15.1.6" + "tap": "^16.0.1" }, "scripts": { "test": "tap", @@ -32,33 +33,29 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "eslint '**/*.js'", + "lint": "eslint \"**/*.js\"", "lintfix": "npm run lint -- --fix", "npmclilint": "npmcli-lint", - "postlint": "npm-template-check", - "template-copy": "npm-template-copy --force" + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" }, "repository": { "type": "git", - "url": "git+https://github.com/npm/npm-packlist.git" + "url": "https://github.com/npm/npm-packlist.git" }, "tap": { "test-env": [ "LC_ALL=sk" - ], - "check-coverage": true, - "nyc-arg": [ - "--include=index.js", - "--include=bin/index.js" ] }, "bin": { "npm-packlist": "bin/index.js" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { - "version": "2.9.2" + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/npm-pick-manifest/package.json b/deps/npm/node_modules/npm-pick-manifest/package.json index ece1d174dbc0c2..79867d9cebaf24 100644 --- a/deps/npm/node_modules/npm-pick-manifest/package.json +++ b/deps/npm/node_modules/npm-pick-manifest/package.json @@ -1,26 +1,29 @@ { "name": "npm-pick-manifest", - "version": "7.0.0", + "version": "7.0.1", "description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.", "main": "./lib", "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "scripts": { "coverage": "tap", - "lint": "eslint '**/*.js'", + "lint": "eslint \"**/*.js\"", "test": "tap", "posttest": "npm run lint", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "postlint": "npm-template-check", - "template-copy": "npm-template-copy --force", + "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", - "snap": "tap" + "snap": "tap", + "template-oss-apply": "template-oss-apply --force" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/npm-pick-manifest.git" }, - "repository": "https://github.com/npm/npm-pick-manifest", "keywords": [ "npm", "semver", @@ -29,22 +32,24 @@ "author": "GitHub Inc.", "license": "ISC", "dependencies": { - "npm-install-checks": "^4.0.0", + "npm-install-checks": "^5.0.0", "npm-normalize-package-bin": "^1.0.1", "npm-package-arg": "^9.0.0", "semver": "^7.3.5" }, "devDependencies": { - "@npmcli/template-oss": "^2.7.1", - "tap": "^15.1.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "tap": { "check-coverage": true }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { - "version": "2.7.1" + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/pacote/lib/bin.js b/deps/npm/node_modules/pacote/lib/bin.js index 369304adaa879a..4a1f911e42bc52 100755 --- a/deps/npm/node_modules/pacote/lib/bin.js +++ b/deps/npm/node_modules/pacote/lib/bin.js @@ -110,7 +110,7 @@ const parseArg = arg => { const k = split.shift() const v = split.join('=') const no = /^no-/.test(k) && !v - const key = (no ? k.substr(3) : k) + const key = (no ? k.slice(3) : k) .replace(/^tag$/, 'defaultTag') .replace(/-([a-z])/g, (_, c) => c.toUpperCase()) const value = v ? v.replace(/^~/, process.env.HOME) : !no diff --git a/deps/npm/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/pacote/lib/fetcher.js index 78b13a9637c4f4..65e97e205204e4 100644 --- a/deps/npm/node_modules/pacote/lib/fetcher.js +++ b/deps/npm/node_modules/pacote/lib/fetcher.js @@ -105,6 +105,9 @@ class FetcherBase { this[_readPackageJson] = readPackageJsonFast } + // config values: npmjs (default), never + this.replaceRegistryHost = opts.replaceRegistryHost === 'never' ? 'never' : 'npmjs' + this.defaultTag = opts.defaultTag || 'latest' this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org') @@ -325,18 +328,18 @@ class FetcherBase { } return this.resolve().then(() => retry(tryAgain => streamHandler(this[_istream](this[_tarballFromResolved]())) - .catch(er => { + .catch(streamErr => { // Most likely data integrity. A cache ENOENT error is unlikely // here, since we're definitely not reading from the cache, but it // IS possible that the fetch subsystem accessed the cache, and the // entry got blown away or something. Try one more time to be sure. - if (this.isRetriableError(er)) { + if (this.isRetriableError(streamErr)) { log.warn('tarball', `tarball data for ${ this.spec } (${this.integrity}) seems to be corrupted. Trying again.`) - return this.cleanupCached().then(() => tryAgain(er)) + return this.cleanupCached().then(() => tryAgain(streamErr)) } - throw er + throw streamErr }), { retries: 1, minTimeout: 0, maxTimeout: 0 })) } diff --git a/deps/npm/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/pacote/lib/remote.js index 5cabfe4fcda44a..3404ea9474944a 100644 --- a/deps/npm/node_modules/pacote/lib/remote.js +++ b/deps/npm/node_modules/pacote/lib/remote.js @@ -13,7 +13,9 @@ class RemoteFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) this.resolved = this.spec.fetchSpec - if (magic.test(this.resolved) && !magic.test(this.registry + '/')) { + if (this.replaceRegistryHost === 'npmjs' + && magic.test(this.resolved) + && !magic.test(this.registry + '/')) { this.resolved = this.resolved.replace(magic, this.registry + '/') } diff --git a/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js b/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js index ff75dfd9c0fbcc..c50cb6173b92eb 100644 --- a/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js +++ b/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js @@ -2,7 +2,7 @@ const removeTrailingSlashes = (input) => { // in order to avoid regexp redos detection let output = input while (output.endsWith('/')) { - output = output.substr(0, output.length - 1) + output = output.slice(0, -1) } return output } diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index f49c23147a80ca..af8166d4ea19e8 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "13.0.5", + "version": "13.1.1", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -14,25 +14,28 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "lint": "eslint '**/*.js'", - "postlint": "npm-template-check", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", - "template-copy": "npm-template-copy --force" + "template-oss-apply": "template-oss-apply --force" }, "tap": { "timeout": 300, "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.9.2", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "hosted-git-info": "^5.0.0", "mutate-fs": "^2.1.1", + "nock": "^13.2.4", "npm-registry-mock": "^1.3.1", - "tap": "^15.1.6" + "tap": "^16.0.1" }, "files": [ - "bin", - "lib" + "bin/", + "lib/" ], "keywords": [ "packages", @@ -42,7 +45,7 @@ "dependencies": { "@npmcli/git": "^3.0.0", "@npmcli/installed-package-contents": "^1.0.7", - "@npmcli/promise-spawn": "^1.2.0", + "@npmcli/promise-spawn": "^3.0.0", "@npmcli/run-script": "^3.0.1", "cacache": "^16.0.0", "chownr": "^2.0.0", @@ -51,7 +54,7 @@ "minipass": "^3.1.6", "mkdirp": "^1.0.4", "npm-package-arg": "^9.0.0", - "npm-packlist": "^4.0.0", + "npm-packlist": "^5.0.0", "npm-pick-manifest": "^7.0.0", "npm-registry-fetch": "^13.0.1", "proc-log": "^2.0.0", @@ -59,15 +62,19 @@ "read-package-json": "^5.0.0", "read-package-json-fast": "^2.0.3", "rimraf": "^3.0.2", - "ssri": "^8.0.1", + "ssri": "^9.0.0", "tar": "^6.1.11" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/pacote.git" }, - "repository": "git@github.com:npm/pacote", "templateOSS": { - "version": "2.9.2", + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2", "windowsCI": false } } diff --git a/deps/npm/node_modules/read-cmd-shim/index.js b/deps/npm/node_modules/read-cmd-shim/lib/index.js similarity index 91% rename from deps/npm/node_modules/read-cmd-shim/index.js rename to deps/npm/node_modules/read-cmd-shim/lib/index.js index 4ac050fc3846e0..782d4c36dced5c 100644 --- a/deps/npm/node_modules/read-cmd-shim/index.js +++ b/deps/npm/node_modules/read-cmd-shim/lib/index.js @@ -1,6 +1,6 @@ const fs = require('fs') -const {promisify} = require('util') -const {readFileSync} = fs +const { promisify } = require('util') +const { readFileSync } = fs const readFile = promisify(fs.readFile) const extractPath = (path, cmdshimContents) => { @@ -53,7 +53,9 @@ const readCmdShim = path => { Error.captureStackTrace(er, readCmdShim) return readFile(path).then(contents => { const destination = extractPath(path, contents.toString()) - if (destination) return destination + if (destination) { + return destination + } return Promise.reject(notaShim(path, er)) }, readFileEr => Promise.reject(wrapError(readFileEr, er))) } @@ -61,7 +63,9 @@ const readCmdShim = path => { const readCmdShimSync = path => { const contents = readFileSync(path) const destination = extractPath(path, contents.toString()) - if (!destination) throw notaShim(path) + if (!destination) { + throw notaShim(path) + } return destination } diff --git a/deps/npm/node_modules/read-cmd-shim/package.json b/deps/npm/node_modules/read-cmd-shim/package.json index 2a76dc3b1632ed..fee454f017c2f9 100644 --- a/deps/npm/node_modules/read-cmd-shim/package.json +++ b/deps/npm/node_modules/read-cmd-shim/package.json @@ -1,29 +1,46 @@ { "name": "read-cmd-shim", - "version": "2.0.0", + "version": "3.0.0", "description": "Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.", - "main": "index.js", + "main": "lib/index.js", "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", "cmd-shim": "^4.0.0", "rimraf": "^3.0.0", - "tap": "^14.10.6" + "tap": "^16.0.1" }, "scripts": { - "preversion": "npm t", + "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push --follow-tags", - "test": "tap" + "prepublishOnly": "git push origin --follow-tags", + "test": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap", + "posttest": "npm run lint" }, "tap": { "check-coverage": true }, "repository": { "type": "git", - "url": "git+https://github.com/npm/read-cmd-shim.git" + "url": "https://github.com/npm/read-cmd-shim.git" }, "license": "ISC", "homepage": "https://github.com/npm/read-cmd-shim#readme", "files": [ - "index.js" - ] + "bin/", + "lib/" + ], + "author": "GitHub Inc.", + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" + } } diff --git a/deps/npm/node_modules/semver/CHANGELOG.md b/deps/npm/node_modules/semver/CHANGELOG.md deleted file mode 100644 index 220af176f748ec..00000000000000 --- a/deps/npm/node_modules/semver/CHANGELOG.md +++ /dev/null @@ -1,111 +0,0 @@ -# changes log - -## 7.3.0 - -* Add `subset(r1, r2)` method to determine if `r1` range is entirely - contained by `r2` range. - -## 7.2.3 - -* Fix handling of `includePrelease` mode where version ranges like `1.0.0 - - 2.0.0` would include `3.0.0-pre` and not `1.0.0-pre`. - -## 7.2.2 - -* Fix bug where `2.0.0-pre` would be included in `^1.0.0` if - `includePrerelease` was set to true. - -## 7.2.0 - -* Add `simplifyRange` method to attempt to generate a more human-readable - range expression that is equivalent to a supplied range, for a given set - of versions. - -## 7.1.2 - -* Remove fancy lazy-loading logic, as it was causing problems for webpack - users. - -## 7.1.0 - -* Add `require('semver/preload')` to load the entire module without using - lazy getter methods. - -## 7.0.0 - -* Refactor module into separate files for better tree-shaking -* Drop support for very old node versions, use const/let, `=>` functions, - and classes. - -## 6.3.0 - -* Expose the token enum on the exports - -## 6.2.0 - -* Coerce numbers to strings when passed to semver.coerce() -* Add `rtl` option to coerce from right to left - -## 6.1.3 - -* Handle X-ranges properly in includePrerelease mode - -## 6.1.2 - -* Do not throw when testing invalid version strings - -## 6.1.1 - -* Add options support for semver.coerce() -* Handle undefined version passed to Range.test - -## 6.1.0 - -* Add semver.compareBuild function -* Support `*` in semver.intersects - -## 6.0 - -* Fix `intersects` logic. - - This is technically a bug fix, but since it is also a change to behavior - that may require users updating their code, it is marked as a major - version increment. - -## 5.7 - -* Add `minVersion` method - -## 5.6 - -* Move boolean `loose` param to an options object, with - backwards-compatibility protection. -* Add ability to opt out of special prerelease version handling with - the `includePrerelease` option flag. - -## 5.5 - -* Add version coercion capabilities - -## 5.4 - -* Add intersection checking - -## 5.3 - -* Add `minSatisfying` method - -## 5.2 - -* Add `prerelease(v)` that returns prerelease components - -## 5.1 - -* Add Backus-Naur for ranges -* Remove excessively cute inspection methods - -## 5.0 - -* Remove AMD/Browserified build artifacts -* Fix ltr and gtr when using the `*` range -* Fix for range `*` with a prerelease identifier diff --git a/deps/npm/node_modules/semver/README.md b/deps/npm/node_modules/semver/README.md index 9bef045af21acd..df54e7a0938962 100644 --- a/deps/npm/node_modules/semver/README.md +++ b/deps/npm/node_modules/semver/README.md @@ -264,7 +264,9 @@ provided tuple parts. Any of `X`, `x`, or `*` may be used to "stand in" for one of the numeric values in the `[major, minor, patch]` tuple. -* `*` := `>=0.0.0` (Any version satisfies) +* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless + `includePrerelease` is specified, in which case any version at all + satisfies) * `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version) * `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions) diff --git a/deps/npm/node_modules/semver/bin/semver.js b/deps/npm/node_modules/semver/bin/semver.js index 73fe29538ad574..779b8b0cdc2aa0 100755 --- a/deps/npm/node_modules/semver/bin/semver.js +++ b/deps/npm/node_modules/semver/bin/semver.js @@ -27,10 +27,12 @@ const semver = require('../') let reverse = false -const options = {} +let options = {} const main = () => { - if (!argv.length) return help() + if (!argv.length) { + return help() + } while (argv.length) { let a = argv.shift() const indexOfEqualSign = a.indexOf('=') @@ -85,26 +87,31 @@ const main = () => { } } - const options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } versions = versions.map((v) => { return coerce ? (semver.coerce(v, options) || { version: v }).version : v }).filter((v) => { return semver.valid(v) }) - if (!versions.length) return fail() - if (inc && (versions.length !== 1 || range.length)) { return failInc() } + if (!versions.length) { + return fail() + } + if (inc && (versions.length !== 1 || range.length)) { + return failInc() + } for (let i = 0, l = range.length; i < l; i++) { versions = versions.filter((v) => { return semver.satisfies(v, range[i], options) }) - if (!versions.length) return fail() + if (!versions.length) { + return fail() + } } return success(versions) } - const failInc = () => { console.error('--inc can only be used on a single version with no range') fail() @@ -120,7 +127,9 @@ const success = () => { return semver.clean(v, options) }).map((v) => { return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach((v, i, _) => { console.log(v) }) + }).forEach((v, i, _) => { + console.log(v) + }) } const help = () => console.log( diff --git a/deps/npm/node_modules/semver/classes/comparator.js b/deps/npm/node_modules/semver/classes/comparator.js index dbbef2d8fe20e6..62cd204d9b7969 100644 --- a/deps/npm/node_modules/semver/classes/comparator.js +++ b/deps/npm/node_modules/semver/classes/comparator.js @@ -4,6 +4,7 @@ class Comparator { static get ANY () { return ANY } + constructor (comp, options) { options = parseOptions(options) @@ -80,7 +81,7 @@ class Comparator { if (!options || typeof options !== 'object') { options = { loose: !!options, - includePrerelease: false + includePrerelease: false, } } @@ -128,7 +129,7 @@ class Comparator { module.exports = Comparator const parseOptions = require('../internal/parse-options') -const {re, t} = require('../internal/re') +const { re, t } = require('../internal/re') const cmp = require('../functions/cmp') const debug = require('../internal/debug') const SemVer = require('./semver') diff --git a/deps/npm/node_modules/semver/classes/index.js b/deps/npm/node_modules/semver/classes/index.js index 198b84d6645cf4..5e3f5c9b19cef1 100644 --- a/deps/npm/node_modules/semver/classes/index.js +++ b/deps/npm/node_modules/semver/classes/index.js @@ -1,5 +1,5 @@ module.exports = { SemVer: require('./semver.js'), Range: require('./range.js'), - Comparator: require('./comparator.js') + Comparator: require('./comparator.js'), } diff --git a/deps/npm/node_modules/semver/classes/range.js b/deps/npm/node_modules/semver/classes/range.js index aa04f6bff94461..7dc24bc714b023 100644 --- a/deps/npm/node_modules/semver/classes/range.js +++ b/deps/npm/node_modules/semver/classes/range.js @@ -29,9 +29,9 @@ class Range { // First, split based on boolean or || this.raw = range this.set = range - .split(/\s*\|\|\s*/) + .split('||') // map the range to a 2d array of comparators - .map(range => this.parseRange(range.trim())) + .map(r => this.parseRange(r.trim())) // throw out any comparator lists that are empty // this generally means that it was not a valid range, which is allowed // in loose mode, but will still throw if the WHOLE range is invalid. @@ -46,9 +46,9 @@ class Range { // keep the first one, in case they're all null sets const first = this.set[0] this.set = this.set.filter(c => !isNullSet(c[0])) - if (this.set.length === 0) + if (this.set.length === 0) { this.set = [first] - else if (this.set.length > 1) { + } else if (this.set.length > 1) { // if we have any that are *, then the range is just * for (const c of this.set) { if (c.length === 1 && isAny(c[0])) { @@ -84,8 +84,9 @@ class Range { const memoOpts = Object.keys(this.options).join(',') const memoKey = `parseRange:${memoOpts}:${range}` const cached = cache.get(memoKey) - if (cached) + if (cached) { return cached + } const loose = this.options.loose // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` @@ -94,7 +95,7 @@ class Range { debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + debug('comparator trim', range) // `~ 1.2.3` => `~1.2.3` range = range.replace(re[t.TILDETRIM], tildeTrimReplace) @@ -108,30 +109,37 @@ class Range { // At this point, the range is completely trimmed and // ready to be split into comparators. - const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const rangeList = range + let rangeList = range .split(' ') .map(comp => parseComparator(comp, this.options)) .join(' ') .split(/\s+/) // >=0.0.0 is equivalent to * .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { // in loose mode, throw out any that are not valid comparators - .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) - .map(comp => new Comparator(comp, this.options)) + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) // if any comparators are the null set, then replace with JUST null set // if more than one comparator, remove any * comparators // also, don't include the same comparator more than once - const l = rangeList.length const rangeMap = new Map() - for (const comp of rangeList) { - if (isNullSet(comp)) + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { return [comp] + } rangeMap.set(comp.value, comp) } - if (rangeMap.size > 1 && rangeMap.has('')) + if (rangeMap.size > 1 && rangeMap.has('')) { rangeMap.delete('') + } const result = [...rangeMap.values()] cache.set(memoKey, result) @@ -196,7 +204,7 @@ const { t, comparatorTrimReplace, tildeTrimReplace, - caretTrimReplace + caretTrimReplace, } = require('../internal/re') const isNullSet = c => c.value === '<0.0.0-0' @@ -245,8 +253,8 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*' // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 const replaceTildes = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceTilde(comp, options) + comp.trim().split(/\s+/).map((c) => { + return replaceTilde(c, options) }).join(' ') const replaceTilde = (comp, options) => { @@ -284,8 +292,8 @@ const replaceTilde = (comp, options) => { // ^1.2.3 --> >=1.2.3 <2.0.0-0 // ^1.2.0 --> >=1.2.0 <2.0.0-0 const replaceCarets = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceCaret(comp, options) + comp.trim().split(/\s+/).map((c) => { + return replaceCaret(c, options) }).join(' ') const replaceCaret = (comp, options) => { @@ -343,8 +351,8 @@ const replaceCaret = (comp, options) => { const replaceXRanges = (comp, options) => { debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map((comp) => { - return replaceXRange(comp, options) + return comp.split(/\s+/).map((c) => { + return replaceXRange(c, options) }).join(' ') } @@ -405,8 +413,9 @@ const replaceXRange = (comp, options) => { } } - if (gtlt === '<') + if (gtlt === '<') { pr = '-0' + } ret = `${gtlt + M}.${m}.${p}${pr}` } else if (xm) { diff --git a/deps/npm/node_modules/semver/functions/cmp.js b/deps/npm/node_modules/semver/functions/cmp.js index 3b89db779108a0..40119094747dd0 100644 --- a/deps/npm/node_modules/semver/functions/cmp.js +++ b/deps/npm/node_modules/semver/functions/cmp.js @@ -8,17 +8,21 @@ const lte = require('./lte') const cmp = (a, op, b, loose) => { switch (op) { case '===': - if (typeof a === 'object') + if (typeof a === 'object') { a = a.version - if (typeof b === 'object') + } + if (typeof b === 'object') { b = b.version + } return a === b case '!==': - if (typeof a === 'object') + if (typeof a === 'object') { a = a.version - if (typeof b === 'object') + } + if (typeof b === 'object') { b = b.version + } return a !== b case '': diff --git a/deps/npm/node_modules/semver/functions/coerce.js b/deps/npm/node_modules/semver/functions/coerce.js index 106ca71c9af92e..2e01452fddad68 100644 --- a/deps/npm/node_modules/semver/functions/coerce.js +++ b/deps/npm/node_modules/semver/functions/coerce.js @@ -1,6 +1,6 @@ const SemVer = require('../classes/semver') const parse = require('./parse') -const {re, t} = require('../internal/re') +const { re, t } = require('../internal/re') const coerce = (version, options) => { if (version instanceof SemVer) { @@ -43,8 +43,9 @@ const coerce = (version, options) => { re[t.COERCERTL].lastIndex = -1 } - if (match === null) + if (match === null) { return null + } return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) } diff --git a/deps/npm/node_modules/semver/functions/parse.js b/deps/npm/node_modules/semver/functions/parse.js index 11f20f03745ab2..a66663aa5918fb 100644 --- a/deps/npm/node_modules/semver/functions/parse.js +++ b/deps/npm/node_modules/semver/functions/parse.js @@ -1,4 +1,4 @@ -const {MAX_LENGTH} = require('../internal/constants') +const { MAX_LENGTH } = require('../internal/constants') const { re, t } = require('../internal/re') const SemVer = require('../classes/semver') diff --git a/deps/npm/node_modules/semver/internal/constants.js b/deps/npm/node_modules/semver/internal/constants.js index 49df215ad554da..4f0de59b56949f 100644 --- a/deps/npm/node_modules/semver/internal/constants.js +++ b/deps/npm/node_modules/semver/internal/constants.js @@ -4,7 +4,7 @@ const SEMVER_SPEC_VERSION = '2.0.0' const MAX_LENGTH = 256 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 +/* istanbul ignore next */ 9007199254740991 // Max safe segment length for coercion. const MAX_SAFE_COMPONENT_LENGTH = 16 @@ -13,5 +13,5 @@ module.exports = { SEMVER_SPEC_VERSION, MAX_LENGTH, MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH + MAX_SAFE_COMPONENT_LENGTH, } diff --git a/deps/npm/node_modules/semver/internal/identifiers.js b/deps/npm/node_modules/semver/internal/identifiers.js index ed130942175207..e612d0a3d83619 100644 --- a/deps/npm/node_modules/semver/internal/identifiers.js +++ b/deps/npm/node_modules/semver/internal/identifiers.js @@ -19,5 +19,5 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) module.exports = { compareIdentifiers, - rcompareIdentifiers + rcompareIdentifiers, } diff --git a/deps/npm/node_modules/semver/internal/parse-options.js b/deps/npm/node_modules/semver/internal/parse-options.js index 42d2ebd6fa32f8..bbd9ec77a3ff44 100644 --- a/deps/npm/node_modules/semver/internal/parse-options.js +++ b/deps/npm/node_modules/semver/internal/parse-options.js @@ -4,8 +4,8 @@ const opts = ['includePrerelease', 'loose', 'rtl'] const parseOptions = options => !options ? {} : typeof options !== 'object' ? { loose: true } - : opts.filter(k => options[k]).reduce((options, k) => { - options[k] = true - return options + : opts.filter(k => options[k]).reduce((o, k) => { + o[k] = true + return o }, {}) module.exports = parseOptions diff --git a/deps/npm/node_modules/semver/internal/re.js b/deps/npm/node_modules/semver/internal/re.js index 54d4176deaf232..ed88398a9dbf5b 100644 --- a/deps/npm/node_modules/semver/internal/re.js +++ b/deps/npm/node_modules/semver/internal/re.js @@ -10,7 +10,7 @@ let R = 0 const createToken = (name, value, isGlobal) => { const index = R++ - debug(index, value) + debug(name, index, value) t[name] = index src[index] = value re[index] = new RegExp(value, isGlobal ? 'g' : undefined) @@ -178,5 +178,5 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + // Star ranges basically just allow anything at all. createToken('STAR', '(<|>)?=?\\s*\\*') // >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') 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 4e1154195a5f17..b04e0d328268fd 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.3.5", + "version": "7.3.6", "description": "The semantic version parser used by npm.", "main": "index.js", "scripts": { @@ -8,34 +8,67 @@ "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" }, "devDependencies": { - "tap": "^14.10.7" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.0" }, "license": "ISC", - "repository": "https://github.com/npm/node-semver", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, "bin": { "semver": "bin/semver.js" }, "files": [ - "bin/**/*.js", - "range.bnf", - "classes/**/*.js", - "functions/**/*.js", - "internal/**/*.js", - "ranges/**/*.js", + "bin/", + "classes/", + "functions/", + "internal/", + "ranges/", "index.js", - "preload.js" + "preload.js", + "range.bnf" ], "tap": { "check-coverage": true, "coverage-map": "map.js" }, "engines": { - "node": ">=10" + "node": "^10.0.0 || ^12.0.0 || ^14.0.0 || >=16.0.0" }, "dependencies": { - "lru-cache": "^6.0.0" + "lru-cache": "^7.4.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2", + "ciVersions": [ + "10.0.0", + "10.x", + "12.x", + "14.x", + "16.x" + ], + "distPaths": [ + "bin/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ] } } diff --git a/deps/npm/node_modules/semver/ranges/min-version.js b/deps/npm/node_modules/semver/ranges/min-version.js index 2fac412914fe25..350e1f78368ea2 100644 --- a/deps/npm/node_modules/semver/ranges/min-version.js +++ b/deps/npm/node_modules/semver/ranges/min-version.js @@ -47,8 +47,9 @@ const minVersion = (range, loose) => { throw new Error(`Unexpected operation: ${comparator.operator}`) } }) - if (setMin && (!minver || gt(minver, setMin))) + if (setMin && (!minver || gt(minver, setMin))) { minver = setMin + } } if (minver && range.test(minver)) { diff --git a/deps/npm/node_modules/semver/ranges/outside.js b/deps/npm/node_modules/semver/ranges/outside.js index 2a4b0a13f9e298..ae99b10a5b9e6a 100644 --- a/deps/npm/node_modules/semver/ranges/outside.js +++ b/deps/npm/node_modules/semver/ranges/outside.js @@ -1,6 +1,6 @@ const SemVer = require('../classes/semver') const Comparator = require('../classes/comparator') -const {ANY} = Comparator +const { ANY } = Comparator const Range = require('../classes/range') const satisfies = require('../functions/satisfies') const gt = require('../functions/gt') diff --git a/deps/npm/node_modules/semver/ranges/simplify.js b/deps/npm/node_modules/semver/ranges/simplify.js index b792f972964542..618d5b62735518 100644 --- a/deps/npm/node_modules/semver/ranges/simplify.js +++ b/deps/npm/node_modules/semver/ranges/simplify.js @@ -5,38 +5,41 @@ const satisfies = require('../functions/satisfies.js') const compare = require('../functions/compare.js') module.exports = (versions, range, options) => { const set = [] - let min = null + let first = null let prev = null const v = versions.sort((a, b) => compare(a, b, options)) for (const version of v) { const included = satisfies(version, range, options) if (included) { prev = version - if (!min) - min = version + if (!first) { + first = version + } } else { if (prev) { - set.push([min, prev]) + set.push([first, prev]) } prev = null - min = null + first = null } } - if (min) - set.push([min, null]) + if (first) { + set.push([first, null]) + } const ranges = [] for (const [min, max] of set) { - if (min === max) + if (min === max) { ranges.push(min) - else if (!max && min === v[0]) + } else if (!max && min === v[0]) { ranges.push('*') - else if (!max) + } else if (!max) { ranges.push(`>=${min}`) - else if (min === v[0]) + } else if (min === v[0]) { ranges.push(`<=${max}`) - else + } else { ranges.push(`${min} - ${max}`) + } } const simplified = ranges.join(' || ') const original = typeof range.raw === 'string' ? range.raw : String(range) diff --git a/deps/npm/node_modules/semver/ranges/subset.js b/deps/npm/node_modules/semver/ranges/subset.js index 532fd1364ce754..e0dea43c2b6a89 100644 --- a/deps/npm/node_modules/semver/ranges/subset.js +++ b/deps/npm/node_modules/semver/ranges/subset.js @@ -41,8 +41,9 @@ const compare = require('../functions/compare.js') // - Else return true const subset = (sub, dom, options = {}) => { - if (sub === dom) + if (sub === dom) { return true + } sub = new Range(sub, options) dom = new Range(dom, options) @@ -52,73 +53,84 @@ const subset = (sub, dom, options = {}) => { for (const simpleDom of dom.set) { const isSub = simpleSubset(simpleSub, simpleDom, options) sawNonNull = sawNonNull || isSub !== null - if (isSub) + if (isSub) { continue OUTER + } } // the null set is a subset of everything, but null simple ranges in // a complex range should be ignored. so if we saw a non-null range, // then we know this isn't a subset, but if EVERY simple range was null, // then it is a subset. - if (sawNonNull) + if (sawNonNull) { return false + } } return true } const simpleSubset = (sub, dom, options) => { - if (sub === dom) + if (sub === dom) { return true + } if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) + if (dom.length === 1 && dom[0].semver === ANY) { return true - else if (options.includePrerelease) - sub = [ new Comparator('>=0.0.0-0') ] - else - sub = [ new Comparator('>=0.0.0') ] + } else if (options.includePrerelease) { + sub = [new Comparator('>=0.0.0-0')] + } else { + sub = [new Comparator('>=0.0.0')] + } } if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) + if (options.includePrerelease) { return true - else - dom = [ new Comparator('>=0.0.0') ] + } else { + dom = [new Comparator('>=0.0.0')] + } } const eqSet = new Set() let gt, lt for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') + if (c.operator === '>' || c.operator === '>=') { gt = higherGT(gt, c, options) - else if (c.operator === '<' || c.operator === '<=') + } else if (c.operator === '<' || c.operator === '<=') { lt = lowerLT(lt, c, options) - else + } else { eqSet.add(c.semver) + } } - if (eqSet.size > 1) + if (eqSet.size > 1) { return null + } let gtltComp if (gt && lt) { gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) + if (gtltComp > 0) { return null - else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { return null + } } // will iterate one or zero times for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) + if (gt && !satisfies(eq, String(gt), options)) { return null + } - if (lt && !satisfies(eq, String(lt), options)) + if (lt && !satisfies(eq, String(lt), options)) { return null + } for (const c of dom) { - if (!satisfies(eq, String(c), options)) + if (!satisfies(eq, String(c), options)) { return false + } } return true @@ -154,10 +166,12 @@ const simpleSubset = (sub, dom, options) => { } if (c.operator === '>' || c.operator === '>=') { higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) + if (higher === c && higher !== gt) { return false - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { return false + } } if (lt) { if (needDomLTPre) { @@ -170,37 +184,44 @@ const simpleSubset = (sub, dom, options) => { } if (c.operator === '<' || c.operator === '<=') { lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) + if (lower === c && lower !== lt) { return false - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { return false + } } - if (!c.operator && (lt || gt) && gtltComp !== 0) + if (!c.operator && (lt || gt) && gtltComp !== 0) { return false + } } // if there was a < or >, and nothing in the dom, then must be false // UNLESS it was limited by another range in the other direction. // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) + if (gt && hasDomLT && !lt && gtltComp !== 0) { return false + } - if (lt && hasDomGT && !gt && gtltComp !== 0) + if (lt && hasDomGT && !gt && gtltComp !== 0) { return false + } // we needed a prerelease range in a specific tuple, but didn't get one // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) + if (needDomGTPre || needDomLTPre) { return false + } return true } // >=1.2.3 is lower than >1.2.3 const higherGT = (a, b, options) => { - if (!a) + if (!a) { return b + } const comp = compare(a.semver, b.semver, options) return comp > 0 ? a : comp < 0 ? b @@ -210,8 +231,9 @@ const higherGT = (a, b, options) => { // <=1.2.3 is higher than <1.2.3 const lowerLT = (a, b, options) => { - if (!a) + if (!a) { return b + } const comp = compare(a.semver, b.semver, options) return comp < 0 ? a : comp > 0 ? b diff --git a/deps/npm/node_modules/ssri/LICENSE.md b/deps/npm/node_modules/ssri/LICENSE.md index 8d28acf866d932..e335388869f50f 100644 --- a/deps/npm/node_modules/ssri/LICENSE.md +++ b/deps/npm/node_modules/ssri/LICENSE.md @@ -1,6 +1,6 @@ ISC License -Copyright (c) npm, Inc. +Copyright 2021 (c) npm, Inc. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the diff --git a/deps/npm/node_modules/ssri/index.js b/deps/npm/node_modules/ssri/lib/index.js similarity index 91% rename from deps/npm/node_modules/ssri/index.js rename to deps/npm/node_modules/ssri/lib/index.js index 2b309849c012a8..e2732fd072b120 100644 --- a/deps/npm/node_modules/ssri/index.js +++ b/deps/npm/node_modules/ssri/lib/index.js @@ -19,7 +19,7 @@ const defaultOpts = { pickAlgorithm: getPrioritizedHash, sep: ' ', single: false, - strict: false + strict: false, } const ssriOpts = (opts = {}) => ({ ...defaultOpts, ...opts }) @@ -51,7 +51,7 @@ class IntegrityStream extends MiniPass { const { integrity, size, - options + options, } = { ...defaultOpts, ...this.opts } // For verification @@ -64,7 +64,9 @@ class IntegrityStream extends MiniPass { } emit (ev, data) { - if (ev === 'end') this[_onEnd]() + if (ev === 'end') { + this[_onEnd]() + } return super.emit(ev, data) } @@ -84,6 +86,7 @@ class IntegrityStream extends MiniPass { // Integrity verification mode const match = this.goodSri && newSri.match(this.sri, this.opts) if (typeof this.expectedSize === 'number' && this.size !== this.expectedSize) { + /* eslint-disable-next-line max-len */ const err = new Error(`stream size mismatch when checking ${this.sri}.\n Wanted: ${this.expectedSize}\n Found: ${this.size}`) err.code = 'EBADSIZE' err.found = this.size @@ -91,6 +94,7 @@ class IntegrityStream extends MiniPass { err.sri = this.sri this.emit('error', err) } else if (this.sri && !match) { + /* eslint-disable-next-line max-len */ const err = new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${newSri}. (${this.size} bytes)`) err.code = 'EINTEGRITY' err.found = newSri @@ -107,7 +111,10 @@ class IntegrityStream extends MiniPass { } class Hash { - get isHash () { return true } + get isHash () { + return true + } + constructor (hash, opts) { opts = ssriOpts(opts) const strict = !!opts.strict @@ -126,8 +133,12 @@ class Hash { ? STRICT_SRI_REGEX : SRI_REGEX ) - if (!match) { return } - if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return } + if (!match) { + return + } + if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { + return + } this.algorithm = match[1] this.digest = match[2] @@ -175,7 +186,10 @@ class Hash { } class Integrity { - get isIntegrity () { return true } + get isIntegrity () { + return true + } + toJSON () { return this.toString() } @@ -255,7 +269,9 @@ class Integrity { module.exports.parse = parse function parse (sri, opts) { - if (!sri) return null + if (!sri) { + return null + } opts = ssriOpts(opts) if (typeof sri === 'string') { return _parse(sri, opts) @@ -278,7 +294,9 @@ function _parse (integrity, opts) { const hash = new Hash(string, opts) if (hash.algorithm && hash.digest) { const algo = hash.algorithm - if (!acc[algo]) { acc[algo] = [] } + if (!acc[algo]) { + acc[algo] = [] + } acc[algo].push(hash) } return acc @@ -324,9 +342,11 @@ function fromData (data, opts) { * just calculated with an algo did not have an algo or digest. */ if (hash.algorithm && hash.digest) { - const algo = hash.algorithm - if (!acc[algo]) { acc[algo] = [] } - acc[algo].push(hash) + const hashAlgo = hash.algorithm + if (!acc[hashAlgo]) { + acc[hashAlgo] = [] + } + acc[hashAlgo].push(hash) } return acc }, new Integrity()) @@ -341,7 +361,9 @@ function fromStream (stream, opts) { stream.on('error', reject) istream.on('error', reject) let sri - istream.on('integrity', s => { sri = s }) + istream.on('integrity', s => { + sri = s + }) istream.on('end', () => resolve(sri)) istream.on('data', () => {}) }) @@ -355,7 +377,7 @@ function checkData (data, sri, opts) { if (opts.error) { throw Object.assign( new Error('No valid integrity hashes to check against'), { - code: 'EINTEGRITY' + code: 'EINTEGRITY', } ) } else { @@ -369,6 +391,7 @@ function checkData (data, sri, opts) { if (match || !opts.error) { return match } else if (typeof opts.size === 'number' && (data.length !== opts.size)) { + /* eslint-disable-next-line max-len */ const err = new Error(`data size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${data.length}`) err.code = 'EBADSIZE' err.found = data.length @@ -376,6 +399,7 @@ function checkData (data, sri, opts) { err.sri = sri throw err } else { + /* eslint-disable-next-line max-len */ const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`) err.code = 'EINTEGRITY' err.found = newSri @@ -394,7 +418,7 @@ function checkStream (stream, sri, opts) { if (!sri || !Object.keys(sri).length) { return Promise.reject(Object.assign( new Error('No valid integrity hashes to check against'), { - code: 'EINTEGRITY' + code: 'EINTEGRITY', } )) } @@ -403,9 +427,11 @@ function checkStream (stream, sri, opts) { stream.pipe(checker) stream.on('error', reject) checker.on('error', reject) - let sri - checker.on('verified', s => { sri = s }) - checker.on('end', () => resolve(sri)) + let verified + checker.on('verified', s => { + verified = s + }) + checker.on('end', () => resolve(verified)) checker.on('data', () => {}) }) } @@ -439,15 +465,17 @@ function createIntegrity (opts) { * just calculated with an algo did not have an algo or digest. */ if (hash.algorithm && hash.digest) { - const algo = hash.algorithm - if (!acc[algo]) { acc[algo] = [] } - acc[algo].push(hash) + const hashAlgo = hash.algorithm + if (!acc[hashAlgo]) { + acc[hashAlgo] = [] + } + acc[hashAlgo].push(hash) } return acc }, new Integrity()) return integrity - } + }, } } @@ -460,10 +488,11 @@ const DEFAULT_PRIORITY = [ // for the algorithm, so we guesswork it based on the OpenSSL names. 'sha3', 'sha3-256', 'sha3-384', 'sha3-512', - 'sha3_256', 'sha3_384', 'sha3_512' + 'sha3_256', 'sha3_384', 'sha3_512', ].filter(algo => NODE_HASHES.has(algo)) function getPrioritizedHash (algo1, algo2) { + /* eslint-disable-next-line max-len */ return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) ? algo1 : algo2 diff --git a/deps/npm/node_modules/ssri/package.json b/deps/npm/node_modules/ssri/package.json index 4af1a3c4c2e4fb..84448afc3cf047 100644 --- a/deps/npm/node_modules/ssri/package.json +++ b/deps/npm/node_modules/ssri/package.json @@ -1,23 +1,34 @@ { "name": "ssri", - "version": "8.0.1", + "version": "9.0.0", "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", - "main": "index.js", - "files": [], + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], "scripts": { "prerelease": "npm t", "postrelease": "npm publish", - "prepublishOnly": "git push --follow-tags", + "prepublishOnly": "git push origin --follow-tags", "posttest": "npm run lint", - "release": "standard-version -s", "test": "tap", "coverage": "tap", - "lint": "standard" + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "preversion": "npm test", + "postversion": "npm publish", + "snap": "tap" }, "tap": { "check-coverage": true }, - "repository": "https://github.com/npm/ssri", + "repository": { + "type": "git", + "url": "https://github.com/npm/ssri.git" + }, "keywords": [ "w3c", "web", @@ -32,21 +43,21 @@ "sri generator", "html" ], - "author": { - "name": "Kat Marchán", - "email": "kzm@sykosomatic.org", - "twitter": "maybekatz" - }, + "author": "GitHub Inc.", "license": "ISC", "dependencies": { "minipass": "^3.1.1" }, "devDependencies": { - "standard": "^16.0.3", - "standard-version": "^9.1.0", - "tap": "^14.10.6" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "engines": { - "node": ">= 8" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" } } diff --git a/deps/npm/node_modules/stringify-package/LICENSE b/deps/npm/node_modules/stringify-package/LICENSE deleted file mode 100644 index 209e4477f39c1a..00000000000000 --- a/deps/npm/node_modules/stringify-package/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright npm, Inc - -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/stringify-package/index.js b/deps/npm/node_modules/stringify-package/index.js deleted file mode 100644 index cd291f295a59ca..00000000000000 --- a/deps/npm/node_modules/stringify-package/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -module.exports = stringifyPackage - -const DEFAULT_INDENT = 2 -const CRLF = '\r\n' -const LF = '\n' - -function stringifyPackage (data, indent, newline) { - indent = indent || (indent === 0 ? 0 : DEFAULT_INDENT) - const json = JSON.stringify(data, null, indent) - - if (newline === CRLF) { - return json.replace(/\n/g, CRLF) + CRLF - } - - return json + LF -} diff --git a/deps/npm/node_modules/stringify-package/package.json b/deps/npm/node_modules/stringify-package/package.json deleted file mode 100644 index c0e5622b475628..00000000000000 --- a/deps/npm/node_modules/stringify-package/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "stringify-package", - "version": "1.0.1", - "description": "stringifies npm-written json files", - "main": "index.js", - "files": [ - "index.js" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/npm/stringify-package.git" - }, - "keywords": [ - "npm", - "json", - "stringify", - "package.json" - ], - "author": "Kat Marchán ", - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/stringify-package/issues" - }, - "homepage": "https://github.com/npm/stringify-package", - "scripts": { - "prerelease": "npm t", - "release": "standard-version -s", - "postrelease": "npm publish", - "postpublish": "git push --follow-tags", - "pretest": "standard", - "test": "tap -J --coverage --100 test/*.js" - }, - "devDependencies": { - "standard": "11", - "standard-version": "4", - "tap": "12" - } -} diff --git a/deps/npm/node_modules/treeverse/index.js b/deps/npm/node_modules/treeverse/index.js deleted file mode 100644 index ca0229e02c90fe..00000000000000 --- a/deps/npm/node_modules/treeverse/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - breadth: require('./lib/breadth.js'), - depth: require('./lib/depth.js'), -} diff --git a/deps/npm/node_modules/treeverse/lib/breadth.js b/deps/npm/node_modules/treeverse/lib/breadth.js index 56c02ec627c8ca..6681f8cf7d6236 100644 --- a/deps/npm/node_modules/treeverse/lib/breadth.js +++ b/deps/npm/node_modules/treeverse/lib/breadth.js @@ -28,27 +28,28 @@ const breadth = ({ return seen.get(tree) } - const visitNode = (tree) => { - if (seen.has(tree)) - return seen.get(tree) + const visitNode = (visitTree) => { + if (seen.has(visitTree)) { + return seen.get(visitTree) + } - seen.set(tree, null) - const res = visit ? visit(tree) : tree + seen.set(visitTree, null) + const res = visit ? visit(visitTree) : visitTree if (isPromise(res)) { - const fullResult = res.then(res => { - seen.set(tree, res) - return kidNodes(tree) + const fullResult = res.then(resThen => { + seen.set(visitTree, resThen) + return kidNodes(visitTree) }) - seen.set(tree, fullResult) + seen.set(visitTree, fullResult) return fullResult } else { - seen.set(tree, res) - return kidNodes(tree) + seen.set(visitTree, res) + return kidNodes(visitTree) } } - const kidNodes = (tree) => { - const kids = getChildren(tree, seen.get(tree)) + const kidNodes = (kidTree) => { + const kids = getChildren(kidTree, seen.get(kidTree)) return isPromise(kids) ? kids.then(processKids) : processKids(kids) } diff --git a/deps/npm/node_modules/treeverse/lib/depth-descent.js b/deps/npm/node_modules/treeverse/lib/depth-descent.js index 8ac3af014ebf9f..361d6bf342f1b2 100644 --- a/deps/npm/node_modules/treeverse/lib/depth-descent.js +++ b/deps/npm/node_modules/treeverse/lib/depth-descent.js @@ -49,27 +49,28 @@ const depth = ({ return seen.get(tree) } - const visitNode = (tree) => { - if (seen.has(tree)) - return seen.get(tree) + const visitNode = (visitTree) => { + if (seen.has(visitTree)) { + return seen.get(visitTree) + } - seen.set(tree, null) - const res = visit ? visit(tree) : tree + seen.set(visitTree, null) + const res = visit ? visit(visitTree) : visitTree if (isPromise(res)) { - const fullResult = res.then(res => { - seen.set(tree, res) - return kidNodes(tree) + const fullResult = res.then(resThen => { + seen.set(visitTree, resThen) + return kidNodes(visitTree) }) - seen.set(tree, fullResult) + seen.set(visitTree, fullResult) return fullResult } else { - seen.set(tree, res) - return kidNodes(tree) + seen.set(visitTree, res) + return kidNodes(visitTree) } } - const kidNodes = (tree) => { - const kids = getChildren(tree, seen.get(tree)) + const kidNodes = (kidTree) => { + const kids = getChildren(kidTree, seen.get(kidTree)) return isPromise(kids) ? kids.then(processKids) : processKids(kids) } diff --git a/deps/npm/node_modules/treeverse/lib/depth.js b/deps/npm/node_modules/treeverse/lib/depth.js index dbab1c28a2d151..ecd138811ae039 100644 --- a/deps/npm/node_modules/treeverse/lib/depth.js +++ b/deps/npm/node_modules/treeverse/lib/depth.js @@ -23,19 +23,21 @@ const depth = ({ getChildren, tree, }) => { - if (!leave) + if (!leave) { return depthDescent({ visit, filter, getChildren, tree }) + } - if (seen.has(tree)) + if (seen.has(tree)) { return seen.get(tree) + } seen.set(tree, null) const visitNode = () => { const res = visit ? visit(tree) : tree if (isPromise(res)) { - const fullResult = res.then(res => { - seen.set(tree, res) + const fullResult = res.then(resThen => { + seen.set(tree, resThen) return kidNodes() }) seen.set(tree, fullResult) @@ -51,9 +53,9 @@ const depth = ({ return isPromise(kids) ? kids.then(processKids) : processKids(kids) } - const processKids = kidNodes => { - const kids = (kidNodes || []).filter(filter).map(kid => - depth({visit, leave, filter, seen, getChildren, tree: kid})) + const processKids = nodes => { + const kids = (nodes || []).filter(filter).map(kid => + depth({ visit, leave, filter, seen, getChildren, tree: kid })) return kids.some(isPromise) ? Promise.all(kids).then(leaveNode) : leaveNode(kids) diff --git a/deps/npm/node_modules/treeverse/lib/index.js b/deps/npm/node_modules/treeverse/lib/index.js new file mode 100644 index 00000000000000..f8e631578bcc92 --- /dev/null +++ b/deps/npm/node_modules/treeverse/lib/index.js @@ -0,0 +1,4 @@ +module.exports = { + breadth: require('./breadth.js'), + depth: require('./depth.js'), +} diff --git a/deps/npm/node_modules/treeverse/package.json b/deps/npm/node_modules/treeverse/package.json index 337194cfde9708..97269b335fc4b1 100644 --- a/deps/npm/node_modules/treeverse/package.json +++ b/deps/npm/node_modules/treeverse/package.json @@ -1,37 +1,51 @@ { "name": "treeverse", - "version": "1.0.4", + "version": "2.0.0", "description": "Walk any kind of tree structure depth- or breadth-first. Supports promises and advanced map-reduce operations with a very small API.", - "author": "Isaac Z. Schlueter (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "repository": { "type": "git", - "url": "git+https://github.com/npm/treeverse.git" + "url": "https://github.com/npm/treeverse.git" }, "scripts": { "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint" }, "tap": { "100": true, - "coverage-map": "map.js" + "coverage-map": "test/coverage-map.js" }, "devDependencies": { - "tap": "^14.10.6", - "tcompare": "^2.3.0" + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.2.2", + "tap": "^16.0.1" }, "files": [ - "index.js", + "bin/", "lib/" ], - "main": "index.js", + "main": "lib/index.js", "keywords": [ "tree", "traversal", "depth first search", "breadth first search" - ] + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.2.2" + } } diff --git a/deps/npm/package.json b/deps/npm/package.json index 9d4ff2f1de31be..da2cba63e220a1 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,9 +1,10 @@ { - "version": "8.6.0", + "version": "8.7.0", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ "docs", + "smoke-tests", "workspaces/*" ], "files": [ @@ -57,16 +58,14 @@ "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^5.0.4", "@npmcli/ci-detect": "^2.0.0", - "@npmcli/config": "^4.0.1", + "@npmcli/config": "^4.1.0", "@npmcli/fs": "^2.1.0", "@npmcli/map-workspaces": "^2.0.2", - "@npmcli/package-json": "^1.0.1", + "@npmcli/package-json": "^2.0.0", "@npmcli/run-script": "^3.0.1", "abbrev": "~1.1.1", - "ansicolors": "~0.3.2", - "ansistyles": "~0.1.3", "archy": "~1.0.0", - "cacache": "^16.0.3", + "cacache": "^16.0.4", "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^4.0.0", @@ -74,9 +73,9 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "hosted-git-info": "^5.0.0", - "ini": "^2.0.0", + "ini": "^3.0.0", "init-package-json": "^3.0.2", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", @@ -91,7 +90,7 @@ "libnpmsearch": "^5.0.2", "libnpmteam": "^4.0.2", "libnpmversion": "^3.0.1", - "make-fetch-happen": "^10.1.1", + "make-fetch-happen": "^10.1.2", "minipass": "^3.1.6", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -100,15 +99,15 @@ "node-gyp": "^9.0.0", "nopt": "^5.0.0", "npm-audit-report": "^3.0.0", - "npm-install-checks": "^4.0.0", - "npm-package-arg": "^9.0.1", - "npm-pick-manifest": "^7.0.0", + "npm-install-checks": "^5.0.0", + "npm-package-arg": "^9.0.2", + "npm-pick-manifest": "^7.0.1", "npm-profile": "^6.0.2", "npm-registry-fetch": "^13.1.0", "npm-user-validate": "^1.0.1", "npmlog": "^6.0.1", "opener": "^1.5.2", - "pacote": "^13.0.5", + "pacote": "^13.1.1", "parse-conflict-json": "^2.0.2", "proc-log": "^2.0.1", "qrcode-terminal": "^0.12.0", @@ -117,12 +116,12 @@ "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", - "semver": "^7.3.5", - "ssri": "^8.0.1", + "semver": "^7.3.6", + "ssri": "^9.0.0", "tar": "^6.1.11", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", - "treeverse": "^1.0.4", + "treeverse": "^2.0.0", "validate-npm-package-name": "^4.0.0", "which": "^2.0.2", "write-file-atomic": "^4.0.1" @@ -137,8 +136,6 @@ "@npmcli/package-json", "@npmcli/run-script", "abbrev", - "ansicolors", - "ansistyles", "archy", "cacache", "chalk", @@ -203,15 +200,15 @@ ], "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.3.2", "licensee": "^8.2.0", "nock": "^13.2.4", "spawk": "^1.7.1", - "tap": "^15.2.3" + "tap": "^16.0.1" }, "scripts": { "dumpconf": "env | grep npm | sort | uniq", - "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", + "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"chore: update AUTHORS\" || true", "licenses": "licensee --production --errors-only", "test": "tap", "test-all": "npm run test --if-present --workspaces --include-workspace-root", @@ -225,8 +222,7 @@ "lintfix": "npm run lint -- --fix", "lint-all": "npm run lint --if-present --workspaces --include-workspace-root", "prelint": "rimraf test/npm_cache*", - "resetdeps": "bash scripts/resetdeps.sh", - "smoke-tests": "tap smoke-tests/index.js --no-coverage" + "resetdeps": "bash scripts/resetdeps.sh" }, "tap": { "test-env": [ @@ -240,7 +236,7 @@ "templateOSS": { "rootRepo": false, "rootModule": false, - "version": "3.2.2" + "version": "3.3.2" }, "license": "Artistic-2.0", "engines": { diff --git a/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs b/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs deleted file mode 100644 index 2bcf58cb4919b0..00000000000000 --- a/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs +++ /dev/null @@ -1,784 +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[`smoke-tests/index.js TAP npm (no args) > should have expected no args output 1`] = ` -npm - -Usage: - -npm install install all the dependencies in your project -npm install add the dependency to your project -npm test run this project's tests -npm run run the script named -npm -h quick help on -npm -l display usage info for all commands -npm help search for help on -npm help npm more involved overview - -All commands: - - access, adduser, audit, bin, bugs, cache, ci, completion, - config, dedupe, deprecate, diff, dist-tag, docs, doctor, - edit, exec, explain, explore, find-dupes, fund, get, help, - hook, init, install, install-ci-test, install-test, link, - ll, login, logout, ls, org, outdated, owner, pack, ping, - pkg, prefix, profile, prune, publish, rebuild, repo, - restart, root, run-script, search, set, set-script, - shrinkwrap, star, stars, start, stop, team, test, token, - uninstall, unpublish, unstar, update, version, view, whoami - -Specify configs in the ini-formatted file: - {CWD}/smoke-tests/tap-testdir-index/.npmrc -or on the command line via: npm --key=value - -More configuration info: npm help config -Configuration fields: npm help 7 config - -npm {CWD} - -` - -exports[`smoke-tests/index.js TAP npm ci > should throw mismatch deps in lock file error 1`] = ` -npm ERR! \`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing. -npm ERR! -npm ERR! Invalid: lock file's abbrev@1.0.4 does not satisfy abbrev@1.1.1 -npm ERR! - -npm ERR! A complete log of this run can be found in: - - -` - -exports[`smoke-tests/index.js TAP npm diff > should have expected diff output 1`] = ` -diff --git a/package.json b/package.json -index v1.0.4..v1.1.1 100644 ---- a/package.json -+++ b/package.json -@@ -1,15 +1,21 @@ - { - "name": "abbrev", -- "version": "1.0.4", -+ "version": "1.1.1", - "description": "Like ruby's abbrev module, but in js", - "author": "Isaac Z. Schlueter ", -- "main": "./lib/abbrev.js", -+ "main": "abbrev.js", - "scripts": { -- "test": "node lib/abbrev.js" -+ "test": "tap test.js --100", -+ "preversion": "npm test", -+ "postversion": "npm publish", -+ "postpublish": "git push origin --all; git push origin --tags" - }, - "repository": "http://github.com/isaacs/abbrev-js", -- "license": { -- "type": "MIT", -- "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE" -- } -+ "license": "ISC", -+ "devDependencies": { -+ "tap": "^10.1" -+ }, -+ "files": [ -+ "abbrev.js" -+ ] - } -diff --git a/LICENSE b/LICENSE -index v1.0.4..v1.1.1 100644 ---- a/LICENSE -+++ b/LICENSE -@@ -1,4 +1,27 @@ --Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -+This software is dual-licensed under the ISC and MIT licenses. -+You may use this software under EITHER of the following licenses. -+ -+---------- -+ -+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. -+ -+---------- -+ -+Copyright Isaac Z. Schlueter and Contributors - All rights reserved. - - Permission is hereby granted, free of charge, to any person -diff --git a/lib/abbrev.js b/lib/abbrev.js -deleted file mode 100644 -index v1.0.4..v1.1.1 ---- a/lib/abbrev.js -+++ b/lib/abbrev.js -@@ -1,111 +0,0 @@ -- --module.exports = exports = abbrev.abbrev = abbrev -- --abbrev.monkeyPatch = monkeyPatch -- --function monkeyPatch () { -- Object.defineProperty(Array.prototype, 'abbrev', { -- value: function () { return abbrev(this) }, -- enumerable: false, configurable: true, writable: true -- }) -- -- Object.defineProperty(Object.prototype, 'abbrev', { -- value: function () { return abbrev(Object.keys(this)) }, -- enumerable: false, configurable: true, writable: true -- }) --} -- --function abbrev (list) { -- if (arguments.length !== 1 || !Array.isArray(list)) { -- list = Array.prototype.slice.call(arguments, 0) -- } -- for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { -- args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) -- } -- -- // sort them lexicographically, so that they're next to their nearest kin -- args = args.sort(lexSort) -- -- // walk through each, seeing how much it has in common with the next and previous -- var abbrevs = {} -- , prev = "" -- for (var i = 0, l = args.length ; i < l ; i ++) { -- var current = args[i] -- , next = args[i + 1] || "" -- , nextMatches = true -- , prevMatches = true -- if (current === next) continue -- for (var j = 0, cl = current.length ; j < cl ; j ++) { -- var curChar = current.charAt(j) -- nextMatches = nextMatches && curChar === next.charAt(j) -- prevMatches = prevMatches && curChar === prev.charAt(j) -- if (!nextMatches && !prevMatches) { -- j ++ -- break -- } -- } -- prev = current -- if (j === cl) { -- abbrevs[current] = current -- continue -- } -- for (var a = current.substr(0, j) ; j <= cl ; j ++) { -- abbrevs[a] = current -- a += current.charAt(j) -- } -- } -- return abbrevs --} -- --function lexSort (a, b) { -- return a === b ? 0 : a > b ? 1 : -1 --} -- -- --// tests --if (module === require.main) { -- --var assert = require("assert") --var util = require("util") -- --console.log("running tests") --function test (list, expect) { -- var actual = abbrev(list) -- assert.deepEqual(actual, expect, -- "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "/n"+ -- "actual: "+util.inspect(actual)) -- actual = abbrev.apply(exports, list) -- assert.deepEqual(abbrev.apply(exports, list), expect, -- "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "/n"+ -- "actual: "+util.inspect(actual)) --} -- --test([ "ruby", "ruby", "rules", "rules", "rules" ], --{ rub: 'ruby' --, ruby: 'ruby' --, rul: 'rules' --, rule: 'rules' --, rules: 'rules' --}) --test(["fool", "foom", "pool", "pope"], --{ fool: 'fool' --, foom: 'foom' --, poo: 'pool' --, pool: 'pool' --, pop: 'pope' --, pope: 'pope' --}) --test(["a", "ab", "abc", "abcd", "abcde", "acde"], --{ a: 'a' --, ab: 'ab' --, abc: 'abc' --, abcd: 'abcd' --, abcde: 'abcde' --, ac: 'acde' --, acd: 'acde' --, acde: 'acde' --}) -- --console.log("pass") -- --} -/ No newline at end of file -diff --git a/abbrev.js b/abbrev.js -new file mode 100644 -index v1.0.4..v1.1.1 ---- a/abbrev.js -+++ b/abbrev.js -@@ -0,0 +1,61 @@ -+module.exports = exports = abbrev.abbrev = abbrev -+ -+abbrev.monkeyPatch = monkeyPatch -+ -+function monkeyPatch () { -+ Object.defineProperty(Array.prototype, 'abbrev', { -+ value: function () { return abbrev(this) }, -+ enumerable: false, configurable: true, writable: true -+ }) -+ -+ Object.defineProperty(Object.prototype, 'abbrev', { -+ value: function () { return abbrev(Object.keys(this)) }, -+ enumerable: false, configurable: true, writable: true -+ }) -+} -+ -+function abbrev (list) { -+ if (arguments.length !== 1 || !Array.isArray(list)) { -+ list = Array.prototype.slice.call(arguments, 0) -+ } -+ for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { -+ args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) -+ } -+ -+ // sort them lexicographically, so that they're next to their nearest kin -+ args = args.sort(lexSort) -+ -+ // walk through each, seeing how much it has in common with the next and previous -+ var abbrevs = {} -+ , prev = "" -+ for (var i = 0, l = args.length ; i < l ; i ++) { -+ var current = args[i] -+ , next = args[i + 1] || "" -+ , nextMatches = true -+ , prevMatches = true -+ if (current === next) continue -+ for (var j = 0, cl = current.length ; j < cl ; j ++) { -+ var curChar = current.charAt(j) -+ nextMatches = nextMatches && curChar === next.charAt(j) -+ prevMatches = prevMatches && curChar === prev.charAt(j) -+ if (!nextMatches && !prevMatches) { -+ j ++ -+ break -+ } -+ } -+ prev = current -+ if (j === cl) { -+ abbrevs[current] = current -+ continue -+ } -+ for (var a = current.substr(0, j) ; j <= cl ; j ++) { -+ abbrevs[a] = current -+ a += current.charAt(j) -+ } -+ } -+ return abbrevs -+} -+ -+function lexSort (a, b) { -+ return a === b ? 0 : a > b ? 1 : -1 -+} - -` - -exports[`smoke-tests/index.js TAP npm explain > should have expected explain output 1`] = ` -abbrev@1.0.4 -node_modules/abbrev - abbrev@"^1.0.4" from the root project - -` - -exports[`smoke-tests/index.js TAP npm fund > should have expected fund output 1`] = ` -project@1.0.0 -\`-- https://github.com/sponsors/isaacs - \`-- promise-all-reject-late@1.0.1 - - -` - -exports[`smoke-tests/index.js TAP npm init > should have successful npm init result 1`] = ` -Wrote to {CWD}/smoke-tests/tap-testdir-index/project/package.json: - -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} - - - -` - -exports[`smoke-tests/index.js TAP npm install dev dep > should have expected dev dep added lockfile result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "project", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "devDependencies": { - "promise-all-reject-late": "^1.0.1" - } - }, - "node_modules/abbrev": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz", - "integrity": "sha1-vVWuXkE7oXIu5Mq6H26hBBSlns0=" - }, - "node_modules/promise-all-reject-late": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", - "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - } - }, - "dependencies": { - "abbrev": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz", - "integrity": "sha1-vVWuXkE7oXIu5Mq6H26hBBSlns0=" - }, - "promise-all-reject-late": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", - "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", - "dev": true - } - } -} - -` - -exports[`smoke-tests/index.js TAP npm install dev dep > should have expected dev dep added package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "devDependencies": { - "promise-all-reject-late": "^1.0.1" - } -} - -` - -exports[`smoke-tests/index.js TAP npm install dev dep > should have expected dev dep added reify output 1`] = ` - -added 1 package - -1 package is looking for funding - run \`npm fund\` for details - -` - -exports[`smoke-tests/index.js TAP npm install prodDep@version > should have expected install reify output 1`] = ` - -added 1 package - -` - -exports[`smoke-tests/index.js TAP npm install prodDep@version > should have expected lockfile result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "project", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - } - }, - "node_modules/abbrev": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz", - "integrity": "sha1-vVWuXkE7oXIu5Mq6H26hBBSlns0=" - } - }, - "dependencies": { - "abbrev": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz", - "integrity": "sha1-vVWuXkE7oXIu5Mq6H26hBBSlns0=" - } - } -} - -` - -exports[`smoke-tests/index.js TAP npm install prodDep@version > should have expected package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - } -} - -` - -exports[`smoke-tests/index.js TAP npm ls > should have expected ls output 1`] = ` -project@1.0.0 {CWD}/smoke-tests/tap-testdir-index/project -+-- abbrev@1.0.4 -\`-- promise-all-reject-late@1.0.1 - - -` - -exports[`smoke-tests/index.js TAP npm outdated > should have expected outdated output 1`] = ` -Package Current Wanted Latest Location Depended by -abbrev 1.0.4 1.1.1 1.1.1 node_modules/abbrev project - -` - -exports[`smoke-tests/index.js TAP npm pkg > should have expected npm pkg delete modified package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - } -} - -` - -exports[`smoke-tests/index.js TAP npm pkg > should have expected npm pkg set modified package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "tap": { - "test-env": [ - "LC_ALL=sk" - ] - } -} - -` - -exports[`smoke-tests/index.js TAP npm pkg > should have expected pkg delete output 1`] = ` - -` - -exports[`smoke-tests/index.js TAP npm pkg > should have expected pkg get output 1`] = ` -"ISC" - -` - -exports[`smoke-tests/index.js TAP npm pkg > should have expected pkg set output 1`] = ` - -` - -exports[`smoke-tests/index.js TAP npm pkg > should print package.json contents 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "ma", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "tap": { - "test-env": [ - "LC_ALL=sk" - ] - } -} - -` - -exports[`smoke-tests/index.js TAP npm prefix > should have expected prefix output 1`] = ` -{CWD}/smoke-tests/tap-testdir-index/project - -` - -exports[`smoke-tests/index.js TAP npm run-script > should have expected run-script output 1`] = ` - -> project@1.0.0 hello -> echo Hello - -Hello - -` - -exports[`smoke-tests/index.js TAP npm set-script > should have expected script added package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "devDependencies": { - "promise-all-reject-late": "^1.0.1" - } -} - -` - -exports[`smoke-tests/index.js TAP npm set-script > should have expected set-script output 1`] = ` - -` - -exports[`smoke-tests/index.js TAP npm uninstall > should have expected uninstall lockfile result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "project", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - } - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - } - } -} - -` - -exports[`smoke-tests/index.js TAP npm uninstall > should have expected uninstall package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - } -} - -` - -exports[`smoke-tests/index.js TAP npm uninstall > should have expected uninstall reify output 1`] = ` - -removed 1 package - -` - -exports[`smoke-tests/index.js TAP npm update dep > should have expected update lockfile result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "project", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "devDependencies": { - "promise-all-reject-late": "^1.0.1" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "node_modules/promise-all-reject-late": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", - "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - } - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "promise-all-reject-late": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", - "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", - "dev": true - } - } -} - -` - -exports[`smoke-tests/index.js TAP npm update dep > should have expected update package.json result 1`] = ` -{ - "name": "project", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo /"Error: no test specified/" && exit 1", - "hello": "echo Hello" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.4" - }, - "devDependencies": { - "promise-all-reject-late": "^1.0.1" - } -} - -` - -exports[`smoke-tests/index.js TAP npm update dep > should have expected update reify output 1`] = ` - -changed 1 package - -1 package is looking for funding - run \`npm fund\` for details - -` - -exports[`smoke-tests/index.js TAP npm view > should have expected view output 1`] = ` - -abbrev@1.0.4 | MIT | deps: none | versions: 8 -Like ruby's abbrev module, but in js -https://github.com/isaacs/abbrev-js#readme - -dist -.tarball: https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz -.shasum: bd55ae5e413ba1722ee4caba1f6ea10414a59ecd - -maintainers: -- nlf <quitlahok@gmail.com> -- ruyadorno <ruyadorno@hotmail.com> -- darcyclarke <darcy@darcyclarke.me> -- adam_baldwin <evilpacket@gmail.com> -- isaacs <i@izs.me> - -dist-tags: -latest: 1.1.1 - -published over a year ago by isaacs <i@izs.me> - -` diff --git a/deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs new file mode 100644 index 00000000000000..d98c16f7905a5b --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs @@ -0,0 +1,111 @@ +/* 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/audit.js TAP audit fix > lockfile has test-dep-a@1.0.1 1`] = ` +{ + "name": "test-dep", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "test-dep", + "version": "1.0.0", + "dependencies": { + "test-dep-a": "*" + } + }, + "node_modules/test-dep-a": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz" + } + }, + "dependencies": { + "test-dep-a": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz" + } + } +} + +` + +exports[`test/lib/commands/audit.js TAP audit fix > must match snapshot 1`] = ` + +added 1 package, and audited 2 packages in xxx + +found 0 vulnerabilities +` + +exports[`test/lib/commands/audit.js TAP json audit > must match snapshot 1`] = ` +{ + "auditReportVersion": 2, + "vulnerabilities": { + "test-dep-a": { + "name": "test-dep-a", + "severity": "high", + "isDirect": true, + "via": [ + { + "source": 100, + "name": "test-dep-a", + "dependency": "test-dep-a", + "title": "Test advisory 100", + "url": "https://github.com/advisories/GHSA-100", + "severity": "high", + "cwe": [ + "cwe-0" + ], + "cvss": { + "score": 0 + }, + "range": "*" + } + ], + "effects": [], + "range": "*", + "nodes": [ + "node_modules/test-dep-a" + ], + "fixAvailable": false + } + }, + "metadata": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 1, + "critical": 0, + "total": 1 + }, + "dependencies": { + "prod": 2, + "dev": 0, + "optional": 0, + "peer": 0, + "peerOptional": 0, + "total": 1 + } + } +} +` + +exports[`test/lib/commands/audit.js TAP normal audit > must match snapshot 1`] = ` +# npm audit report + +test-dep-a * +Severity: high +Test advisory 100 - https://github.com/advisories/GHSA-100 +No fix available +node_modules/test-dep-a + +1 high severity vulnerability + +Some issues need review, and may require choosing +a different dependency. +` 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 8d62c7ff7e15f7..444d1f1db7c701 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 @@ -342,6 +342,9 @@ prefix = "{LOCALPREFIX}" userconfig = "{HOME}/.npmrc" ; node bin location = {EXECPATH} +; node version = {NODE-VERSION} +; npm local prefix = {LOCALPREFIX} +; npm version = {NPM-VERSION} ; cwd = {NPMDIR} ; HOME = {HOME} ; Run \`npm config ls -l\` to show all defaults. @@ -355,6 +358,9 @@ prefix = "{LOCALPREFIX}" userconfig = "{HOME}/.npmrc" ; node bin location = {EXECPATH} +; node version = {NODE-VERSION} +; npm local prefix = {LOCALPREFIX} +; npm version = {NPM-VERSION} ; cwd = {NPMDIR} ; HOME = {HOME} ; Run \`npm config ls -l\` to show all defaults. @@ -383,6 +389,9 @@ prefix = "{LOCALPREFIX}" userconfig = "{HOME}/.npmrc" ; node bin location = {EXECPATH} +; node version = {NODE-VERSION} +; npm local prefix = {LOCALPREFIX} +; npm version = {NPM-VERSION} ; cwd = {NPMDIR} ; HOME = {HOME} ; Run \`npm config ls -l\` to show all defaults. 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 a28654e5d9b29d..d84d7d368580c8 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 @@ -467,7 +467,7 @@ node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) which git ok /path/to/git Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache (should be owned by current user) -Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules (should be owned by current user) +Perms check on local node_modules ok Perms check on global node_modules ok Perms check on local bin folder ok Perms check on global bin folder ok @@ -514,106 +514,10 @@ Object { ], ], "warn": Array [ - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache", - ], Array [ "checkFilesPermission", "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache", ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/tmp", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs/{DATE}-debug-0.log", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be/ccdeeea0a01ebb0e365e566161f7c68ddcbbe04206d8542742d98875f03f", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03/5c781820370e585dc2323edbbc80669bf714da5b47d56510c7d0bd7521ee", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/.bin", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testLink", - ], - Array [ - "checkFilesPermission", - "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir/testFile", - ], ], } ` diff --git a/deps/npm/tap-snapshots/test/lib/commands/profile.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/profile.js.test.cjs index 31205b7fedc05c..2103ccdd32e334 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/profile.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/profile.js.test.cjs @@ -47,56 +47,56 @@ github https://github.com/npm ` exports[`test/lib/commands/profile.js TAP profile get no args default output > should output table with contents 1`] = ` -name: foo -email: foo@github.com (verified) -two-factor auth: auth-and-writes -fullname: Foo Bar -homepage: https://github.com -freenode: foobar -twitter: https://twitter.com/npmjs -github: https://github.com/npm -created: 2015-02-26T01:26:37.384Z -updated: 2020-08-12T16:19:35.326Z +name: foo +email: foo@github.com (verified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z ` exports[`test/lib/commands/profile.js TAP profile get no args no tfa enabled > should output expected profile values 1`] = ` -name: foo -email: foo@github.com (verified) -two-factor auth: disabled -fullname: Foo Bar -homepage: https://github.com -freenode: foobar -twitter: https://twitter.com/npmjs -github: https://github.com/npm -created: 2015-02-26T01:26:37.384Z -updated: 2020-08-12T16:19:35.326Z +name: foo +email: foo@github.com (verified) +two-factor auth: disabled +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z ` exports[`test/lib/commands/profile.js TAP profile get no args profile has cidr_whitelist item > should output table with contents 1`] = ` -name: foo -email: foo@github.com (verified) -two-factor auth: auth-and-writes -fullname: Foo Bar -homepage: https://github.com -freenode: foobar -twitter: https://twitter.com/npmjs -github: https://github.com/npm -created: 2015-02-26T01:26:37.384Z -updated: 2020-08-12T16:19:35.326Z -cidr_whitelist: 192.168.1.1 +name: foo +email: foo@github.com (verified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z +cidr_whitelist: 192.168.1.1 ` exports[`test/lib/commands/profile.js TAP profile get no args unverified email > should output table with contents 1`] = ` -name: foo -email: foo@github.com(unverified) -two-factor auth: auth-and-writes -fullname: Foo Bar -homepage: https://github.com -freenode: foobar -twitter: https://twitter.com/npmjs -github: https://github.com/npm -created: 2015-02-26T01:26:37.384Z -updated: 2020-08-12T16:19:35.326Z +name: foo +email: foo@github.com(unverified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z ` exports[`test/lib/commands/profile.js TAP profile set writable key --parseable > should output parseable set key success msg 1`] = ` diff --git a/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/view.js.test.cjs index 229a9d323dbaee..5868e7b04babe3 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 @@ -127,7 +127,7 @@ green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:colors, green, crayola bin:green @@ -209,7 +209,7 @@ green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:colors, green, crayola bin:green @@ -440,7 +440,7 @@ green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:colors, green, crayola bin:green @@ -508,7 +508,7 @@ green is a very important color DEPRECATED!! - true -keywords:colors, green, crayola +keywords:colors, green, crayola bin:green diff --git a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 0ad87b945fce75..cd8b0592c36e8e 100644 --- a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -161,7 +161,6 @@ npm dedupe Options: [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] -[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index d7c43080298eb0..91f0d782878a3f 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -795,6 +795,8 @@ This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. + +This value is not exported to the environment for child processes. ` exports[`test/lib/utils/config/definitions.js TAP > config description for ignore-scripts 1`] = ` @@ -848,6 +850,8 @@ Include the workspace root when workspaces are enabled for a command. When false, specifying individual workspaces via the \`workspace\` config, or all workspaces via the \`workspaces\` flag, will cause npm to operate only on the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. ` exports[`test/lib/utils/config/definitions.js TAP > config description for init-author-email 1`] = ` @@ -1424,8 +1428,7 @@ The base URL of the npm registry. exports[`test/lib/utils/config/definitions.js TAP > config description for save 1`] = ` #### \`save\` -* Default: \`true\` unless when using \`npm update\` or \`npm dedupe\` where it - defaults to \`false\` +* Default: \`true\` unless when using \`npm update\` where it defaults to \`false\` * Type: Boolean Save installed packages to a \`package.json\` file as dependencies. diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index 2647bc31bcdb85..7b13c34daf6821 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -636,6 +636,8 @@ it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. +This value is not exported to the environment for child processes. + @@ -693,6 +695,8 @@ When false, specifying individual workspaces via the \`workspace\` config, or all workspaces via the \`workspaces\` flag, will cause npm to operate only on the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. + @@ -1217,8 +1221,7 @@ The base URL of the npm registry. #### \`save\` -* Default: \`true\` unless when using \`npm update\` or \`npm dedupe\` where it - defaults to \`false\` +* Default: \`true\` unless when using \`npm update\` where it defaults to \`false\` * Type: Boolean Save installed packages to a \`package.json\` file as dependencies. diff --git a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index d1de45413a93fc..244469f83cd9e3 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -293,7 +293,6 @@ All commands: Options: [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] - [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js index 13f8a0ea01c7e6..b6742a425aa9a0 100644 --- a/deps/npm/test/fixtures/mock-npm.js +++ b/deps/npm/test/fixtures/mock-npm.js @@ -61,6 +61,7 @@ const LoadMockNpm = async (t, { init = true, load = init, prefixDir = {}, + homeDir = {}, cacheDir = {}, globalPrefixDir = {}, config = {}, @@ -70,6 +71,12 @@ const LoadMockNpm = async (t, { // Mock some globals with their original values so they get torn down // back to the original at the end of the test since they are manipulated // by npm itself + const npmConfigEnv = {} + for (const key in process.env) { + if (key.startsWith('npm_config_')) { + npmConfigEnv[key] = undefined + } + } mockGlobals(t, { process: { title: process.title, @@ -77,12 +84,17 @@ const LoadMockNpm = async (t, { env: { npm_command: process.env.npm_command, COLOR: process.env.COLOR, + ...npmConfigEnv, }, }, }) const { Npm, ...rest } = RealMockNpm(t, mocks) + // We want to fail fast when writing tests. Default this to 0 unless it was + // explicitly set in a test. + config = { 'fetch-retries': 0, ...config } + if (!init && load) { throw new Error('cant `load` without `init`') } @@ -90,14 +102,21 @@ const LoadMockNpm = async (t, { // Set log level as early as possible since setLoglevel(t, config.loglevel) - const dir = t.testdir({ prefix: prefixDir, cache: cacheDir, global: globalPrefixDir }) + const dir = t.testdir({ + home: homeDir, + prefix: prefixDir, + cache: cacheDir, + global: globalPrefixDir, + }) const prefix = path.join(dir, 'prefix') const cache = path.join(dir, 'cache') const globalPrefix = path.join(dir, 'global') + const home = path.join(dir, 'home') // Set cache to testdir via env var so it is available when load is run // XXX: remove this for a solution where cache argv is passed in mockGlobals(t, { + 'process.env.HOME': home, 'process.env.npm_config_cache': cache, ...(globals ? result(globals, { prefix, cache }) : {}), // Some configs don't work because they can't be set via npm.config.set until @@ -136,6 +155,7 @@ const LoadMockNpm = async (t, { ...rest, Npm, npm, + home, prefix, globalPrefix, testdir: dir, diff --git a/deps/npm/test/fixtures/mock-registry.js b/deps/npm/test/fixtures/mock-registry.js new file mode 100644 index 00000000000000..6b6722fcbbc3c3 --- /dev/null +++ b/deps/npm/test/fixtures/mock-registry.js @@ -0,0 +1,224 @@ +/* + * Mock registry class + * + * This should end up as the centralized place where we generate test fixtures + * for tests against any registry data. + */ +const pacote = require('pacote') +class MockRegistry { + #tap + #nock + #registry + #authorization + + constructor (opts) { + if (!opts.registry) { + throw new Error('mock registry requires a registry value') + } + this.#registry = (new URL(opts.registry)).origin + this.#authorization = opts.authorization + // Required for this.package + this.#tap = opts.tap + } + + get nock () { + if (!this.#nock) { + if (!this.#tap) { + throw new Error('cannot mock packages without a tap fixture') + } + const tnock = require('./tnock.js') + const reqheaders = {} + if (this.#authorization) { + reqheaders.authorization = `Bearer ${this.#authorization}` + } + this.#nock = tnock(this.#tap, this.#registry, { reqheaders }) + } + return this.#nock + } + + set nock (nock) { + this.#nock = nock + } + + whoami ({ username }) { + this.nock = this.nock.get('/-/whoami').reply(200, { username }) + } + + access ({ spec, access, publishRequires2fa }) { + const body = {} + if (access !== undefined) { + body.access = access + } + if (publishRequires2fa !== undefined) { + body.publish_requires_tfa = publishRequires2fa + } + this.nock = this.nock.post( + `/-/package/${encodeURIComponent(spec)}/access`, + body + ).reply(200) + } + + grant ({ spec, team, permissions }) { + if (team.startsWith('@')) { + team = team.slice(1) + } + const [scope, teamName] = team.split(':') + this.nock = this.nock.put( + `/-/team/${encodeURIComponent(scope)}/${encodeURIComponent(teamName)}/package`, + { package: spec, permissions } + ).reply(200) + } + + revoke ({ spec, team }) { + if (team.startsWith('@')) { + team = team.slice(1) + } + const [scope, teamName] = team.split(':') + this.nock = this.nock.delete( + `/-/team/${encodeURIComponent(scope)}/${encodeURIComponent(teamName)}/package`, + { package: spec } + ).reply(200) + } + + couchlogin ({ username, password, email, otp, token = 'npm_default-test-token' }) { + this.nock = this.nock + .post('/-/v1/login').reply(401, { error: 'You must be logged in to publish packages.' }) + if (otp) { + // TODO otp failure results in a 401 with + // {"ok":false,"error":"failed to authenticate: Could not authenticate ${username}: bad otp"} + } + this.nock = this.nock.put(`/-/user/org.couchdb.user:${username}`, body => { + this.#tap.match(body, { + _id: `org.couchdb.user:${username}`, + name: username, + password, + type: 'user', + roles: [], + }) + if (!body.date) { + return false + } + return true + }).reply(201, { + ok: true, + id: 'org.couchdb.user:undefined', + rev: '_we_dont_use_revs_any_more', + token, + }) + } + + // team can be a team or a username + lsPackages ({ team, packages = {} }) { + if (team.startsWith('@')) { + team = team.slice(1) + } + const [scope, teamName] = team.split(':') + let uri + if (teamName) { + uri = `/-/team/${encodeURIComponent(scope)}/${encodeURIComponent(teamName)}/package` + } else { + uri = `/-/org/${encodeURIComponent(scope)}/package` + } + this.nock = this.nock.get(uri).query({ format: 'cli' }).reply(200, packages) + } + + lsCollaborators ({ spec, user, collaborators = {} }) { + const query = { format: 'cli' } + if (user) { + query.user = user + } + this.nock = this.nock.get(`/-/package/${encodeURIComponent(spec)}/collaborators`) + .query(query) + .reply(200, collaborators) + } + + advisory (advisory = {}) { + const id = advisory.id || parseInt(Math.random() * 1000000) + return { + id, + url: `https://github.com/advisories/GHSA-${id}`, + title: `Test advisory ${id}`, + severity: 'high', + vulnerable_versions: '*', + cwe: [ + 'cwe-0', + ], + cvss: { + score: 0, + }, + ...advisory, + } + } + + async package ({ manifest, times = 1, query, tarballs }) { + let nock = this.nock + nock = nock.get(`/${manifest.name}`).times(times) + if (query) { + nock = nock.query(query) + } + nock = nock.reply(200, manifest) + if (tarballs) { + for (const version in tarballs) { + // for (const version in manifest.versions) { + const packument = manifest.versions[version] + const dist = new URL(packument.dist.tarball) + const tarball = await pacote.tarball(tarballs[version]) + nock.get(dist.pathname).reply(200, tarball) + } + } + this.nock = nock + } + + // the last packument in the packuments array will be tagged as latest + manifest ({ name = 'test-package', packuments } = {}) { + packuments = this.packuments(packuments, name) + const latest = packuments.slice(-1)[0] + const manifest = { + _id: `${name}@${latest.version}`, + _rev: '00-testdeadbeef', + name, + description: 'test package mock manifest', + dependencies: {}, + versions: {}, + time: {}, + 'dist-tags': { latest: latest.version }, + ...latest, + } + + for (const packument of packuments) { + manifest.versions[packument.version] = { + _id: `${name}@${packument.version}`, + name, + description: 'test package mock manifest', + dependencies: {}, + dist: { + tarball: `${this.#registry}/${name}/-/${name}-${packument.version}.tgz`, + }, + ...packument, + } + manifest.time[packument.version] = new Date() + } + + return manifest + } + + packuments (packuments = ['1.0.0'], name) { + return packuments.map(p => this.packument(p, name)) + } + + // Generate packument from shorthand + packument (packument, name = 'test-package') { + if (!packument.version) { + packument = { version: packument } + } + return { + name, + version: '1.0.0', + description: 'mocked test package', + dependencies: {}, + ...packument, + } + } +} + +module.exports = MockRegistry diff --git a/deps/npm/test/lib/auth/sso.js b/deps/npm/test/lib/auth/sso.js index 473c8cc2414676..8d70077ad205fe 100644 --- a/deps/npm/test/lib/auth/sso.js +++ b/deps/npm/test/lib/auth/sso.js @@ -1,7 +1,6 @@ const t = require('tap') let log = '' -let warn = '' const _flatOptions = { ssoType: 'oauth', @@ -15,9 +14,6 @@ const sso = t.mock('../../../lib/auth/sso.js', { info: (...msgs) => { log += msgs.join(' ') + '\n' }, - warn: (...msgs) => { - warn += msgs.join(' ') - }, }, 'npm-profile': profile, 'npm-registry-fetch': npmFetch, @@ -29,16 +25,6 @@ const sso = t.mock('../../../lib/auth/sso.js', { ) } }, - '../../../lib/utils/otplease.js': (opts, fn) => { - if (opts) { - return fn({ ...opts, otp: '1234' }) - } else { - throw Object.assign( - new Error('failed retrieving otp'), - { code: 'ERROR' } - ) - } - }, }) const npm = { @@ -54,15 +40,8 @@ t.test('empty login', async (t) => { 'should throw if no sso-type defined in flatOptions' ) - t.equal( - warn, - 'deprecated SSO --auth-type is deprecated', - 'should print deprecation warning' - ) - _flatOptions.ssoType = 'oauth' log = '' - warn = '' }) t.test('simple login', async (t) => { @@ -75,7 +54,6 @@ t.test('simple login', async (t) => { opts, { creds: {}, - otp: '1234', registry: 'https://registry.npmjs.org/', scope: '', ssoType: 'oauth', @@ -115,7 +93,6 @@ t.test('simple login', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -162,7 +139,6 @@ t.test('polling retry', async (t) => { }) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -185,7 +161,6 @@ t.test('polling error', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) @@ -204,7 +179,6 @@ t.test('no token retrieved from loginCouch', async (t) => { ) log = '' - warn = '' delete profile.loginCouch }) @@ -222,7 +196,6 @@ t.test('no sso url retrieved from loginCouch', async (t) => { ) log = '' - warn = '' delete profile.loginCouch }) @@ -258,7 +231,6 @@ t.test('scoped login', async (t) => { ) log = '' - warn = '' delete profile.loginCouch delete npmFetch.json }) diff --git a/deps/npm/test/lib/commands/access.js b/deps/npm/test/lib/commands/access.js index f89b53e9690718..130522b3be3e4d 100644 --- a/deps/npm/test/lib/commands/access.js +++ b/deps/npm/test/lib/commands/access.js @@ -1,6 +1,9 @@ const t = require('tap') const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') +const MockRegistry = require('../../fixtures/mock-registry.js') + +const auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' } t.test('completion', async t => { const { npm } = await loadMockNpm(t) @@ -75,27 +78,23 @@ t.test('access public on unscoped package', async t => { }) t.test('access public on scoped package', async t => { - t.plan(2) const name = '@scoped/npm-access-public-pkg' - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - public: (pkg, { registry }) => { - t.equal(pkg, name, 'should use pkg name ref') - t.equal( - registry, - 'https://registry.npmjs.org/', - 'should forward correct options' - ) - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, prefixDir: { 'package.json': JSON.stringify({ name }), }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.access({ spec: name, access: 'public' }) await npm.exec('access', ['public']) + t.equal(joinedOutput(), '') }) t.test('access public on missing package.json', async t => { @@ -137,27 +136,23 @@ t.test('access restricted on unscoped package', async t => { }) t.test('access restricted on scoped package', async t => { - t.plan(2) const name = '@scoped/npm-access-restricted-pkg' - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - restricted: (pkg, { registry }) => { - t.equal(pkg, name, 'should use pkg name ref') - t.equal( - registry, - 'https://registry.npmjs.org/', - 'should forward correct options' - ) - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, prefixDir: { 'package.json': JSON.stringify({ name }), }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.access({ spec: name, access: 'restricted' }) await npm.exec('access', ['restricted']) + t.equal(joinedOutput(), '') }) t.test('access restricted on missing package.json', async t => { @@ -184,61 +179,41 @@ t.test('access restricted on invalid package.json', async t => { }) t.test('access grant read-only', async t => { - t.plan(3) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - grant: (spec, team, permissions) => { - t.equal(spec, '@scoped/another', 'should use expected spec') - t.equal(team, 'myorg:myteam', 'should use expected team') - t.equal(permissions, 'read-only', 'should forward permissions') - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) - await npm.exec('access', [ - 'grant', - 'read-only', - 'myorg:myteam', - '@scoped/another', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.grant({ spec: '@scoped/another', team: 'myorg:myteam', permissions: 'read-only' }) + await npm.exec('access', ['grant', 'read-only', 'myorg:myteam', '@scoped/another']) + t.equal(joinedOutput(), '') }) t.test('access grant read-write', async t => { - t.plan(3) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - grant: (spec, team, permissions) => { - t.equal(spec, '@scoped/another', 'should use expected spec') - t.equal(team, 'myorg:myteam', 'should use expected team') - t.equal(permissions, 'read-write', 'should forward permissions') - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) - await npm.exec('access', [ - 'grant', - 'read-write', - 'myorg:myteam', - '@scoped/another', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.grant({ spec: '@scoped/another', team: 'myorg:myteam', permissions: 'read-write' }) + await npm.exec('access', ['grant', 'read-write', 'myorg:myteam', '@scoped/another']) + t.equal(joinedOutput(), '') }) t.test('access grant current cwd', async t => { - t.plan(3) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - grant: (spec, team, permissions) => { - t.equal(spec, 'yargs', 'should use expected spec') - t.equal(team, 'myorg:myteam', 'should use expected team') - t.equal(permissions, 'read-write', 'should forward permissions') - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, prefixDir: { 'package.json': JSON.stringify({ @@ -246,11 +221,14 @@ t.test('access grant current cwd', async t => { }), }, }) - await npm.exec('access', [ - 'grant', - 'read-write', - 'myorg:myteam', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.grant({ spec: 'yargs', team: 'myorg:myteam', permissions: 'read-write' }) + await npm.exec('access', ['grant', 'read-write', 'myorg:myteam']) + t.equal(joinedOutput(), '') }) t.test('access grant others', async t => { @@ -295,44 +273,52 @@ t.test('access grant malformed team arg', async t => { ) }) -t.test('access 2fa-required/2fa-not-required', async t => { - t.plan(2) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - tfaRequired: (spec) => { - t.equal(spec, '@scope/pkg', 'should use expected spec') - return true - }, - tfaNotRequired: (spec) => { - t.equal(spec, 'unscoped-pkg', 'should use expected spec') - return true - }, - }, +t.test('access 2fa-required', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.access({ spec: '@scope/pkg', publishRequires2fa: true }) await npm.exec('access', ['2fa-required', '@scope/pkg']) - await npm.exec('access', ['2fa-not-required', 'unscoped-pkg']) + t.equal(joinedOutput(), '') +}) + +t.test('access 2fa-not-required', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, + }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.access({ spec: '@scope/pkg', publishRequires2fa: false }) + await npm.exec('access', ['2fa-not-required', '@scope/pkg']) + t.equal(joinedOutput(), '') }) t.test('access revoke', async t => { - t.plan(2) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - revoke: (spec, team) => { - t.equal(spec, '@scoped/another', 'should use expected spec') - t.equal(team, 'myorg:myteam', 'should use expected team') - return true - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) - await npm.exec('access', [ - 'revoke', - 'myorg:myteam', - '@scoped/another', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.revoke({ spec: '@scoped/another', team: 'myorg:myteam' }) + await npm.exec('access', ['revoke', 'myorg:myteam', '@scoped/another']) + t.equal(joinedOutput(), '') }) t.test('access revoke missing team args', async t => { @@ -362,49 +348,46 @@ t.test('access revoke malformed team arg', async t => { }) t.test('npm access ls-packages with no team', async t => { - t.plan(1) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - lsPackages: (entity) => { - t.equal(entity, 'foo', 'should use expected entity') - return {} - }, - }, - '../../lib/utils/get-identity.js': () => Promise.resolve('foo'), + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const team = 'foo' + const packages = { 'test-package': 'read-write' } + registry.whoami({ username: team }) + registry.lsPackages({ team, packages }) await npm.exec('access', ['ls-packages']) + t.match(JSON.parse(joinedOutput()), packages) }) t.test('access ls-packages on team', async t => { - t.plan(1) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - lsPackages: (entity) => { - t.equal(entity, 'myorg:myteam', 'should use expected entity') - return {} - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) - await npm.exec('access', [ - 'ls-packages', - 'myorg:myteam', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const team = 'myorg:myteam' + const packages = { 'test-package': 'read-write' } + registry.lsPackages({ team, packages }) + await npm.exec('access', ['ls-packages', 'myorg:myteam']) + t.match(JSON.parse(joinedOutput()), packages) }) t.test('access ls-collaborators on current', async t => { - t.plan(1) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - lsCollaborators: (spec) => { - t.equal(spec, 'yargs', 'should use expected spec') - return {} - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, prefixDir: { 'package.json': JSON.stringify({ @@ -412,23 +395,30 @@ t.test('access ls-collaborators on current', async t => { }), }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const collaborators = { 'test-user': 'read-write' } + registry.lsCollaborators({ spec: 'yargs', collaborators }) await npm.exec('access', ['ls-collaborators']) + t.match(JSON.parse(joinedOutput()), collaborators) }) t.test('access ls-collaborators on spec', async t => { - t.plan(1) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmaccess: { - lsCollaborators: (spec) => { - t.equal(spec, 'yargs', 'should use expected spec') - return {} - }, - }, + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + ...auth, }, }) - await npm.exec('access', [ - 'ls-collaborators', - 'yargs', - ]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const collaborators = { 'test-user': 'read-write' } + registry.lsCollaborators({ spec: 'yargs', collaborators }) + await npm.exec('access', ['ls-collaborators', 'yargs']) + t.match(JSON.parse(joinedOutput()), collaborators) }) diff --git a/deps/npm/test/lib/commands/adduser.js b/deps/npm/test/lib/commands/adduser.js index f88508d15a6fec..ca07199b2c9fbd 100644 --- a/deps/npm/test/lib/commands/adduser.js +++ b/deps/npm/test/lib/commands/adduser.js @@ -1,190 +1,176 @@ const t = require('tap') -const { getCredentialsByURI, setCredentialsByURI } = - require('@npmcli/config').prototype +const path = require('path') +const fs = require('fs') +const os = require('os') -let result = '' - -const _flatOptions = { - authType: 'legacy', - registry: 'https://registry.npmjs.org/', - scope: '', - fromFlatOptions: true, -} - -let failSave = false -let deletedConfig = {} -let registryOutput = '' -let setConfig = {} -const authDummy = (npm, options) => { - if (!options.fromFlatOptions) { - throw new Error('did not pass full flatOptions to auth function') - } - - return Promise.resolve({ - message: 'success', - newCreds: { - username: 'u', - password: 'p', - email: 'u@npmjs.org', - }, - }) -} - -const deleteMock = (key, where) => { - deletedConfig = { - ...deletedConfig, - [key]: where, - } -} -const npm = { - flatOptions: _flatOptions, - config: { - delete: deleteMock, - get (key, where) { - if (!where || where === 'user') { - return _flatOptions[key] - } - }, - getCredentialsByURI, - async save () { - if (failSave) { - throw new Error('error saving user config') - } - }, - set (key, value, where) { - setConfig = { - ...setConfig, - [key]: { - value, - where, - }, - } - }, - setCredentialsByURI, - }, - output: msg => { - result = msg - }, -} - -const AddUser = t.mock('../../../lib/commands/adduser.js', { - npmlog: { - clearProgress: () => null, - disableProgress: () => null, - }, - 'proc-log': { - notice: (_, msg) => { - registryOutput = msg - }, - }, - '../../../lib/auth/legacy.js': authDummy, -}) - -const adduser = new AddUser(npm) - -t.afterEach(() => { - _flatOptions.authType = 'legacy' - _flatOptions.scope = '' - registryOutput = '' - deletedConfig = {} - setConfig = {} - result = '' - failSave = false -}) +const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') +const mockGlobals = require('../../fixtures/mock-globals.js') +const MockRegistry = require('../../fixtures/mock-registry.js') +const stream = require('stream') t.test('usage', async t => { + const { npm } = await loadMockNpm(t) + const adduser = await npm.cmd('adduser') t.match(adduser.usage, 'adduser', 'usage has command name in it') }) t.test('simple login', async t => { - await adduser.exec([]) - t.equal( - registryOutput, - 'Log in on https://registry.npmjs.org/', - 'should have correct message result' - ) - - t.same( - deletedConfig, - { - _token: 'user', - _password: 'user', - username: 'user', - _auth: 'user', - _authtoken: 'user', - '-authtoken': 'user', - _authToken: 'user', - '//registry.npmjs.org/:-authtoken': 'user', - '//registry.npmjs.org/:_authToken': 'user', - '//registry.npmjs.org/:_authtoken': 'user', - '//registry.npmjs.org/:always-auth': 'user', - '//registry.npmjs.org/:email': 'user', + const stdin = new stream.PassThrough() + stdin.write('test-user\n') + stdin.write('test-password\n') + stdin.write('test-email@npmjs.org\n') + mockGlobals(t, { + 'process.stdin': stdin, + 'process.stdout': new stream.PassThrough(), // to quiet readline + }, { replace: true }) + const { npm, home } = await loadMockNpm(t, { + homeDir: { + // These all get cleaned up by config.setCredentialsByURI + '.npmrc': [ + '_token=user', + '_password=user', + 'username=user', + '_auth=user', + '_authtoken=user', + '-authtoken=user', + '_authToken=user', + '//registry.npmjs.org/:-authtoken=user', + '//registry.npmjs.org/:_authToken=user', + '//registry.npmjs.org/:_authtoken=user', + '//registry.npmjs.org/:always-auth=user', + '//registry.npmjs.org/:email=test-email-old@npmjs.org', + ].join('\n'), }, - 'should delete token in user config' - ) - + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + registry.couchlogin({ + username: 'test-user', + password: 'test-password', + email: 'test-email@npmjs.org', + token: 'npm_test-token', + }) + await npm.exec('adduser', []) + t.same(npm.config.get('email'), 'test-email-old@npmjs.org') + t.same(npm.config.get('//registry.npmjs.org/:_authToken'), 'npm_test-token') + const rc = fs.readFileSync(path.join(home, '.npmrc'), 'utf8') t.same( - setConfig, - { - '//registry.npmjs.org/:_password': { value: 'cA==', where: 'user' }, - '//registry.npmjs.org/:username': { value: 'u', where: 'user' }, - email: { value: 'u@npmjs.org', where: 'user' }, - }, - 'should set expected user configs' - ) - - t.equal( - result, - 'success', - 'should output auth success msg' + rc.trim().split(os.EOL), [ + '//registry.npmjs.org/:_authToken=npm_test-token', + 'email=test-email-old@npmjs.org', + ], 'should only have token and un-nerfed old email' ) }) t.test('bad auth type', async t => { - _flatOptions.authType = 'foo' - - await t.rejects( - adduser.exec([]), - /no such auth module/, - 'should throw bad auth type error' - ) + const { npm } = await loadMockNpm(t, { + config: { + 'auth-type': 'foo', + }, + }) + await t.rejects(npm.exec('adduser', []), { + message: 'no such auth module', + }) }) t.test('scoped login', async t => { - _flatOptions.scope = '@myscope' - - await adduser.exec([]) - + const stdin = new stream.PassThrough() + stdin.write('test-user\n') + stdin.write('test-password\n') + stdin.write('test-email@npmjs.org\n') + mockGlobals(t, { + 'process.stdin': stdin, + 'process.stdout': new stream.PassThrough(), // to quiet readline + }, { replace: true }) + const { npm, home } = await loadMockNpm(t, { + config: { + scope: '@myscope', + }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + registry.couchlogin({ + username: 'test-user', + password: 'test-password', + email: 'test-email@npmjs.org', + token: 'npm_test-token', + }) + await npm.exec('adduser', []) + t.same(npm.config.get('//registry.npmjs.org/:_authToken'), 'npm_test-token') + t.same(npm.config.get('@myscope:registry'), 'https://registry.npmjs.org/') + const rc = fs.readFileSync(path.join(home, '.npmrc'), 'utf8') t.same( - setConfig['@myscope:registry'], - { value: 'https://registry.npmjs.org/', where: 'user' }, - 'should set scoped registry config' - ) + rc.trim().split(os.EOL), [ + '//registry.npmjs.org/:_authToken=npm_test-token', + '@myscope:registry=https://registry.npmjs.org/', + ], 'should only have token and scope:registry') }) t.test('scoped login with valid scoped registry config', async t => { - _flatOptions['@myscope:registry'] = 'https://diff-registry.npmjs.com/' - _flatOptions.scope = '@myscope' - - t.teardown(() => { - delete _flatOptions['@myscope:registry'] + const stdin = new stream.PassThrough() + stdin.write('test-user\n') + stdin.write('test-password\n') + stdin.write('test-email@npmjs.org\n') + mockGlobals(t, { + 'process.stdin': stdin, + 'process.stdout': new stream.PassThrough(), // to quiet readline + }, { replace: true }) + const { npm, home } = await loadMockNpm(t, { + homeDir: { + '.npmrc': '@myscope:registry=https://diff-registry.npmjs.org', + }, + config: { + scope: '@myscope', + }, }) - - await adduser.exec([]) - - t.same( - setConfig['@myscope:registry'], - { value: 'https://diff-registry.npmjs.com/', where: 'user' }, - 'should keep scoped registry config' - ) + const registry = new MockRegistry({ + tap: t, + registry: 'https://diff-registry.npmjs.org', + }) + registry.couchlogin({ + username: 'test-user', + password: 'test-password', + email: 'test-email@npmjs.org', + token: 'npm_test-token', + }) + await npm.exec('adduser', []) + t.same(npm.config.get('//diff-registry.npmjs.org/:_authToken'), 'npm_test-token') + t.same(npm.config.get('@myscope:registry'), 'https://diff-registry.npmjs.org') + const rc = fs.readFileSync(path.join(home, '.npmrc'), 'utf8') + t.same(rc.trim().split(os.EOL), + [ + '@myscope:registry=https://diff-registry.npmjs.org', + '//diff-registry.npmjs.org/:_authToken=npm_test-token', + ], 'should only have token and scope:registry') }) t.test('save config failure', async t => { - failSave = true - - await t.rejects( - adduser.exec([]), - /error saving user config/, - 'should throw config.save error' - ) + const stdin = new stream.PassThrough() + stdin.write('test-user\n') + stdin.write('test-password\n') + stdin.write('test-email@npmjs.org\n') + mockGlobals(t, { + 'process.stdin': stdin, + 'process.stdout': new stream.PassThrough(), // to quiet readline + }, { replace: true }) + const { npm } = await loadMockNpm(t, { + homeDir: { + '.npmrc': {}, + }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + registry.couchlogin({ + username: 'test-user', + password: 'test-password', + email: 'test-email@npmjs.org', + token: 'npm_test-token', + }) + await t.rejects(npm.exec('adduser', [])) }) diff --git a/deps/npm/test/lib/commands/audit.js b/deps/npm/test/lib/commands/audit.js index 05f268d6bcd0e0..1afb8d333b7cea 100644 --- a/deps/npm/test/lib/commands/audit.js +++ b/deps/npm/test/lib/commands/audit.js @@ -1,139 +1,156 @@ const t = require('tap') -const { load: _loadMockNpm } = require('../../fixtures/mock-npm') -t.test('should audit using Arborist', async t => { - let ARB_ARGS = null - let AUDIT_CALLED = false - let REIFY_FINISH_CALLED = false - let AUDIT_REPORT_CALLED = false - let ARB_OBJ = null +const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const MockRegistry = require('../../fixtures/mock-registry.js') +const util = require('util') +const zlib = require('zlib') +const gzip = util.promisify(zlib.gzip) +const path = require('path') +const fs = require('fs') - const loadMockNpm = (t) => _loadMockNpm(t, { - mocks: { - 'npm-audit-report': () => { - AUDIT_REPORT_CALLED = true - return { - report: 'there are vulnerabilities', - exitCode: 0, - } +t.cleanSnapshot = str => str.replace(/packages in [0-9]+[a-z]+/g, 'packages in xxx') + +const tree = { + 'package.json': JSON.stringify({ + name: 'test-dep', + version: '1.0.0', + dependencies: { + 'test-dep-a': '*', + }, + }), + 'package-lock.json': JSON.stringify({ + name: 'test-dep', + version: '1.0.0', + lockfileVersion: 2, + requires: true, + packages: { + '': { + xname: 'scratch', + version: '1.0.0', + dependencies: { + 'test-dep-a': '*', + }, + devDependencies: {}, }, - '@npmcli/arborist': function (args) { - ARB_ARGS = args - ARB_OBJ = this - this.audit = () => { - AUDIT_CALLED = true - this.auditReport = {} - } + 'node_modules/test-dep-a': { + name: 'test-dep-a', + version: '1.0.0', }, - '../../lib/utils/reify-finish.js': (npm, arb) => { - if (arb !== ARB_OBJ) { - throw new Error('got wrong object passed to reify-output') - } - - REIFY_FINISH_CALLED = true + }, + dependencies: { + 'test-dep-a': { + version: '1.0.0', }, }, - }) + }), + 'test-dep-a': { + 'package.json': JSON.stringify({ + name: 'test-dep-a', + version: '1.0.1', + }), + 'fixed.txt': 'fixed test-dep-a', + }, +} - t.test('audit', async t => { - const { npm, outputs } = await loadMockNpm(t) - await npm.exec('audit', []) - t.match(ARB_ARGS, { audit: true, path: npm.prefix }) - t.equal(AUDIT_CALLED, true, 'called audit') - t.equal(AUDIT_REPORT_CALLED, true, 'called audit report') - t.match(outputs, [['there are vulnerabilities']]) +t.test('normal audit', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: tree, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - t.test('audit fix', async t => { - const { npm } = await loadMockNpm(t) - await npm.exec('audit', ['fix']) - t.equal(REIFY_FINISH_CALLED, true, 'called reify output') + const manifest = registry.manifest({ + name: 'test-dep-a', + packuments: [{ version: '1.0.0' }, { version: '1.0.1' }], }) + await registry.package({ manifest }) + const advisory = registry.advisory({ id: 100 }) + const bulkBody = await gzip(JSON.stringify({ 'test-dep-a': ['1.0.0'] })) + registry.nock.post('/-/npm/v1/security/advisories/bulk', bulkBody) + .reply(200, { + 'test-dep-a': [advisory], + }) + + await npm.exec('audit', []) + t.ok(process.exitCode, 'would have exited uncleanly') + process.exitCode = 0 + t.matchSnapshot(joinedOutput()) }) -t.test('should audit - json', async t => { - t.plan(1) - const { npm } = await _loadMockNpm(t, { - mocks: { - 'npm-audit-report': (_, opts) => { - t.match(opts.reporter, 'json') - return { - report: 'there are vulnerabilities', - exitCode: 0, - } - }, - '@npmcli/arborist': function () { - this.audit = () => { - this.auditReport = {} - } - }, - '../../lib/utils/reify-output.js': () => {}, - }, +t.test('json audit', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: tree, config: { json: true, }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + const manifest = registry.manifest({ + name: 'test-dep-a', + packuments: [{ version: '1.0.0' }, { version: '1.0.1' }], + }) + await registry.package({ manifest }) + const advisory = registry.advisory({ id: 100 }) + const bulkBody = await gzip(JSON.stringify({ 'test-dep-a': ['1.0.0'] })) + registry.nock.post('/-/npm/v1/security/advisories/bulk', bulkBody) + .reply(200, { + 'test-dep-a': [advisory], + }) + await npm.exec('audit', []) + t.ok(process.exitCode, 'would have exited uncleanly') + process.exitCode = 0 + t.matchSnapshot(joinedOutput()) }) -t.test('report endpoint error', async t => { - const loadMockNpm = (t, options) => _loadMockNpm(t, { - mocks: { - 'npm-audit-report': () => { - throw new Error('should not call audit report when there are errors') - }, - '@npmcli/arborist': function () { - this.audit = () => { - this.auditReport = { - error: { - message: 'hello, this didnt work', - method: 'POST', - uri: 'https://example.com/', - headers: { - head: ['ers'], - }, - statusCode: 420, - body: 'this is a string', - }, - } - } - }, - '../../lib/utils/reify-output.js': () => {}, - }, - ...options, +t.test('audit fix', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: tree, }) - - t.test('json=false', async t => { - const { npm, outputs, logs } = await loadMockNpm(t, { config: { json: false } }) - await t.rejects(npm.exec('audit', []), 'audit endpoint returned an error') - t.match(logs.warn, [['audit', 'hello, this didnt work']]) - t.strictSame(outputs, [['this is a string']]) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), }) - - t.test('json=true', async t => { - const { npm, outputs, logs } = await loadMockNpm(t, { config: { json: true } }) - await t.rejects(npm.exec('audit', []), 'audit endpoint returned an error') - t.match(logs.warn, [['audit', 'hello, this didnt work']]) - t.strictSame(outputs, [[ - '{\n' + - ' "message": "hello, this didnt work",\n' + - ' "method": "POST",\n' + - ' "uri": "https://example.com/",\n' + - ' "headers": {\n' + - ' "head": [\n' + - ' "ers"\n' + - ' ]\n' + - ' },\n' + - ' "statusCode": 420,\n' + - ' "body": "this is a string"\n' + - '}', - ], - ]) + const manifest = registry.manifest({ + name: 'test-dep-a', + packuments: [{ version: '1.0.0' }, { version: '1.0.1' }], + }) + await registry.package({ + manifest, + tarballs: { + '1.0.1': path.join(npm.prefix, 'test-dep-a'), + }, }) + const advisory = registry.advisory({ id: 100, vulnerable_versions: '1.0.0' }) + // Can't validate this request body because it changes with each node + // version/npm version and nock's body validation is not async, while + // zlib.gunzip is + registry.nock.post('/-/npm/v1/security/advisories/bulk') + .reply(200, { // first audit + 'test-dep-a': [advisory], + }) + .post('/-/npm/v1/security/advisories/bulk') + .reply(200, { // after fix + 'test-dep-a': [advisory], + }) + await npm.exec('audit', ['fix']) + t.matchSnapshot(joinedOutput()) + const pkg = fs.readFileSync(path.join(npm.prefix, 'package-lock.json'), 'utf8') + t.matchSnapshot(pkg, 'lockfile has test-dep-a@1.0.1') + t.ok( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-a', 'fixed.txt')), + 'has test-dep-a@1.0.1 on disk' + ) }) t.test('completion', async t => { - const { npm } = await _loadMockNpm(t) + const { npm } = await loadMockNpm(t) const audit = await npm.cmd('audit') t.test('fix', async t => { await t.resolveMatch( diff --git a/deps/npm/test/lib/commands/completion.js b/deps/npm/test/lib/commands/completion.js index d4e6f1199c4577..6cc1677552e8a7 100644 --- a/deps/npm/test/lib/commands/completion.js +++ b/deps/npm/test/lib/commands/completion.js @@ -6,20 +6,19 @@ const completionScript = fs .readFileSync(path.resolve(__dirname, '../../../lib/utils/completion.sh'), { encoding: 'utf8' }) .replace(/^#!.*?\n/, '') -const { load: _loadMockNpm } = require('../../fixtures/mock-npm') +const { load: loadMockNpm } = require('../../fixtures/mock-npm') const mockGlobals = require('../../fixtures/mock-globals') const loadMockCompletion = async (t, o = {}) => { - const { globals, windows, ...options } = o + const { globals = {}, windows, ...options } = o let resetGlobals = {} - if (globals) { - resetGlobals = mockGlobals(t, globals).reset - } - const res = await _loadMockNpm(t, { - mocks: { - '../../lib/utils/is-windows.js': { isWindowsShell: !!windows }, - ...options.mocks, - }, + resetGlobals = mockGlobals(t, { + 'process.platform': windows ? 'win32' : 'posix', + 'process.env.term': 'notcygwin', + 'process.env.msystem': 'nogmingw', + ...globals, + }).reset + const res = await loadMockNpm(t, { ...options, }) const completion = await res.npm.cmd('completion') diff --git a/deps/npm/test/lib/commands/dedupe.js b/deps/npm/test/lib/commands/dedupe.js index bf6964081ca79e..0ca51245cc8188 100644 --- a/deps/npm/test/lib/commands/dedupe.js +++ b/deps/npm/test/lib/commands/dedupe.js @@ -1,5 +1,9 @@ const t = require('tap') +const path = require('path') +const fs = require('fs') + const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const MockRegistry = require('../../fixtures/mock-registry.js') t.test('should throw in global mode', async (t) => { const { npm } = await loadMockNpm(t, { @@ -14,45 +18,79 @@ t.test('should throw in global mode', async (t) => { ) }) -t.test('should remove dupes using Arborist', async (t) => { - t.plan(5) - const { npm } = await loadMockNpm(t, { - mocks: { - '@npmcli/arborist': function (args) { - t.ok(args, 'gets options object') - t.ok(args.path, 'gets path option') - t.ok(args.dryRun, 'gets dryRun from user') - this.dedupe = () => { - t.ok(true, 'dedupe is called') - } - }, - '../../lib/utils/reify-finish.js': (npm, arb) => { - t.ok(arb, 'gets arborist tree') +const treeWithDupes = { + 'package.json': JSON.stringify({ + name: 'test-top', + version: '1.0.0', + dependencies: { + 'test-dep-a': '*', + 'test-dep-b': '*', + }, + }), + node_modules: { + 'test-dep-a': { + 'package.json': JSON.stringify({ + name: 'test-dep-a', + version: '1.0.1', + dependencies: { 'test-sub': '*' }, + }), + node_modules: { + 'test-sub': { + 'package.json': JSON.stringify({ + name: 'test-sub', + version: '1.0.0', + }), + }, }, }, - config: { - 'dry-run': 'true', + 'test-dep-b': { + 'package.json': JSON.stringify({ + name: 'test-dep-b', + version: '1.0.0', + dependencies: { 'test-sub': '*' }, + }), + node_modules: { + 'test-sub': { + 'package.json': JSON.stringify({ + name: 'test-sub', + version: '1.0.0', + }), + }, + }, }, + }, +} + +t.test('dedupe', async (t) => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: treeWithDupes, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + const manifestSub = registry.manifest({ + name: 'test-sub', + packuments: [{ version: '1.0.0' }], }) - await npm.exec('dedupe', []) -}) -t.test('should remove dupes using Arborist - no arguments', async (t) => { - t.plan(2) - const { npm } = await loadMockNpm(t, { - mocks: { - '@npmcli/arborist': function (args) { - t.ok(args.dryRun, 'gets dryRun from config') - t.ok(args.save, 'gets user-set save value from config') - this.dedupe = () => {} - }, - '../../lib/utils/reify-output.js': () => {}, - '../../lib/utils/reify-finish.js': () => {}, - }, - config: { - 'dry-run': true, - save: true, + await registry.package({ + manifest: manifestSub, + tarballs: { + '1.0.0': path.join(npm.prefix, 'node_modules', 'test-dep-a', 'node_modules', 'test-sub'), }, }) await npm.exec('dedupe', []) + t.match(joinedOutput(), /added 1 package, and removed 2 packages/) + t.ok( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-sub')), + 'test-sub was hoisted' + ) + t.notOk( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-a', 'node_modules', 'test-sub')), + 'test-dep-a/test-sub was removed' + ) + t.notOk( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-b', 'node_modules', 'test-sub')), + 'test-dep-b/test-sub was removed') }) diff --git a/deps/npm/test/lib/commands/deprecate.js b/deps/npm/test/lib/commands/deprecate.js index 180629a7488f95..37a407c3b6a1a1 100644 --- a/deps/npm/test/lib/commands/deprecate.js +++ b/deps/npm/test/lib/commands/deprecate.js @@ -19,7 +19,6 @@ npmFetch.json = async (uri, opts) => { const Deprecate = t.mock('../../../lib/commands/deprecate.js', { '../../../lib/utils/get-identity.js': async () => getIdentityImpl(), - '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmaccess: { lsPackages: async () => ({ foo: 'write', bar: 'write', baz: 'write', buzz: 'read' }), }, diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js index 620d908d3030e9..eaf2ee6c6f8a2a 100644 --- a/deps/npm/test/lib/commands/doctor.js +++ b/deps/npm/test/lib/commands/doctor.js @@ -359,8 +359,10 @@ t.test('incorrect owner', async t => { ...fs, lstat: (p, cb) => { const stat = fs.lstatSync(p) - stat.uid += 1 - stat.gid += 1 + if (p.endsWith('_cacache')) { + stat.uid += 1 + stat.gid += 1 + } return cb(null, stat) }, }, diff --git a/deps/npm/test/lib/commands/find-dupes.js b/deps/npm/test/lib/commands/find-dupes.js index 06bd097b6ca595..228ac662b44540 100644 --- a/deps/npm/test/lib/commands/find-dupes.js +++ b/deps/npm/test/lib/commands/find-dupes.js @@ -1,28 +1,84 @@ const t = require('tap') +const path = require('path') +const fs = require('fs') const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const MockRegistry = require('../../fixtures/mock-registry.js') -t.test('should run dedupe in dryRun mode', async (t) => { - t.plan(5) - const { npm } = await loadMockNpm(t, { - mocks: { - '@npmcli/arborist': function (args) { - t.ok(args, 'gets options object') - t.ok(args.path, 'gets path option') - t.ok(args.dryRun, 'is called in dryRun mode') - this.dedupe = () => { - t.ok(true, 'dedupe is called') - } +const treeWithDupes = { + 'package.json': JSON.stringify({ + name: 'test-top', + version: '1.0.0', + dependencies: { + 'test-dep-a': '*', + 'test-dep-b': '*', + }, + }), + node_modules: { + 'test-dep-a': { + 'package.json': JSON.stringify({ + name: 'test-dep-a', + version: '1.0.1', + dependencies: { 'test-sub': '*' }, + }), + node_modules: { + 'test-sub': { + 'package.json': JSON.stringify({ + name: 'test-sub', + version: '1.0.0', + }), + }, }, - '../../lib/utils/reify-finish.js': (npm, arb) => { - t.ok(arb, 'gets arborist tree') + }, + 'test-dep-b': { + 'package.json': JSON.stringify({ + name: 'test-dep-b', + version: '1.0.0', + dependencies: { 'test-sub': '*' }, + }), + node_modules: { + 'test-sub': { + 'package.json': JSON.stringify({ + name: 'test-sub', + version: '1.0.0', + }), + }, }, }, + }, +} + +t.test('should run dedupe in dryRun mode', async (t) => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: treeWithDupes, config: { // explicitly set to false so we can be 100% sure it's always true when it // hits arborist 'dry-run': false, }, }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + }) + + const manifestSub = registry.manifest({ + name: 'test-sub', + manifests: [{ name: 'test-sub', version: '1.0.0' }], + }) + + await registry.package({ manifest: manifestSub }) await npm.exec('find-dupes', []) + t.match(joinedOutput(), /added 1 package, and removed 2 packages/) + t.notOk( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-sub')), + 'test-sub was not hoisted' + ) + t.ok( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-a', 'node_modules', 'test-sub')), + 'test-dep-a/test-sub was not removed' + ) + t.ok( + fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-b', 'node_modules', 'test-sub')), + 'test-dep-b/test-sub was not removed') }) diff --git a/deps/npm/test/lib/commands/help-search.js b/deps/npm/test/lib/commands/help-search.js index 8d13009a222521..7fbeb195d23c7d 100644 --- a/deps/npm/test/lib/commands/help-search.js +++ b/deps/npm/test/lib/commands/help-search.js @@ -1,7 +1,7 @@ const t = require('tap') const { join } = require('path') const { fake: mockNpm } = require('../../fixtures/mock-npm') -const ansicolors = require('ansicolors') +const chalk = require('chalk') const OUTPUT = [] const output = msg => { @@ -106,7 +106,7 @@ t.test('npm help-search long output with color', async t => { await helpSearch.exec(['help-search']) - const highlightedText = ansicolors.bgBlack(ansicolors.red('help-search')) + const highlightedText = chalk.bgBlack.red('help-search') t.equal( OUTPUT.some(line => line.includes(highlightedText)), true, diff --git a/deps/npm/test/lib/commands/hook.js b/deps/npm/test/lib/commands/hook.js index 60a59a3fe7a3b8..95bac83d7b6ebc 100644 --- a/deps/npm/test/lib/commands/hook.js +++ b/deps/npm/test/lib/commands/hook.js @@ -63,7 +63,6 @@ const libnpmhook = { } const Hook = t.mock('../../../lib/commands/hook.js', { - '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmhook, }) const hook = new Hook(npm) diff --git a/deps/npm/test/lib/commands/install.js b/deps/npm/test/lib/commands/install.js index d5db3af673caa5..afb6adb4fb0a56 100644 --- a/deps/npm/test/lib/commands/install.js +++ b/deps/npm/test/lib/commands/install.js @@ -12,7 +12,7 @@ t.test('with args, dev=true', async t => { let REIFY_CALLED = false let ARB_OBJ = null - const { npm, logs } = await loadMockNpm(t, { + const { npm } = await loadMockNpm(t, { '@npmcli/run-script': ({ event }) => { SCRIPTS.push(event) }, @@ -41,10 +41,7 @@ t.test('with args, dev=true', async t => { npm.prefix = path.resolve(t.testdir({})) await npm.exec('install', ['fizzbuzz']) - t.match( - logs.warn, - [['install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.']] - ) + t.match( ARB_ARGS, { global: false, path: npm.prefix, auditLevel: null }, diff --git a/deps/npm/test/lib/commands/ls.js b/deps/npm/test/lib/commands/ls.js index 9fd4db167df6f1..412d5ce6532a04 100644 --- a/deps/npm/test/lib/commands/ls.js +++ b/deps/npm/test/lib/commands/ls.js @@ -99,14 +99,12 @@ const LS = t.mock('../../../lib/commands/ls.js', { const config = { all: true, color: false, - dev: false, depth: Infinity, global: false, json: false, link: false, - only: null, + omit: [], parseable: false, - production: false, 'package-lock-only': false, } const flatOptions = { @@ -456,7 +454,7 @@ t.test('ls', t => { }) t.test('--dev', async t => { - config.dev = true + flatOptions.omit = ['peer', 'prod', 'optional'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -479,34 +477,7 @@ t.test('ls', t => { }) await ls.exec([]) t.matchSnapshot(redactCwd(result), 'should output tree containing dev deps') - config.dev = false - }) - - t.test('--only=development', async t => { - config.only = 'development' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.matchSnapshot(redactCwd(result), 'should output tree containing only development deps') - config.only = null + flatOptions.omit = [] }) t.test('--link', async t => { @@ -581,7 +552,7 @@ t.test('ls', t => { }) t.test('--production', async t => { - config.production = true + flatOptions.omit = ['dev', 'peer'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -604,34 +575,7 @@ t.test('ls', t => { }) await ls.exec([]) t.matchSnapshot(redactCwd(result), 'should output tree containing production deps') - config.production = false - }) - - t.test('--only=prod', async t => { - config.only = 'prod' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.matchSnapshot(redactCwd(result), 'should output tree containing only prod deps') - config.only = null + flatOptions.omit = [] }) t.test('--long', async t => { @@ -1484,12 +1428,12 @@ t.test('ls', t => { t.matchSnapshot(redactCwd(result), 'should list --all workspaces properly') // --production - config.production = true + flatOptions.omit = ['dev', 'peer', 'optional'] await ls.exec([]) t.matchSnapshot(redactCwd(result), 'should list only prod deps of workspaces') - config.production = false + flatOptions.omit = [] // filter out a single workspace using args await ls.exec(['d']) @@ -1811,7 +1755,7 @@ t.test('ls --parseable', t => { }) t.test('--dev', async t => { - config.dev = true + flatOptions.omit = ['peer', 'prod', 'optional'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -1834,34 +1778,7 @@ t.test('ls --parseable', t => { }) await ls.exec([]) t.matchSnapshot(redactCwd(result), 'should output tree containing dev deps') - config.dev = false - }) - - t.test('--only=development', async t => { - config.only = 'development' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.matchSnapshot(redactCwd(result), 'should output tree containing only development deps') - config.only = null + flatOptions.omit = [] }) t.test('--link', async t => { @@ -1902,7 +1819,7 @@ t.test('ls --parseable', t => { }) t.test('--production', async t => { - config.production = true + flatOptions.omit = ['dev', 'peer'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -1925,34 +1842,7 @@ t.test('ls --parseable', t => { }) await ls.exec([]) t.matchSnapshot(redactCwd(result), 'should output tree containing production deps') - config.production = false - }) - - t.test('--only=prod', async t => { - config.only = 'prod' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.matchSnapshot(redactCwd(result), 'should output tree containing only prod deps') - config.only = null + flatOptions.omit = [] }) t.test('--long', async t => { @@ -2935,7 +2825,7 @@ t.test('ls --json', t => { }) t.test('--dev', async t => { - config.dev = true + flatOptions.omit = ['prod', 'optional', 'peer'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -2976,52 +2866,7 @@ t.test('ls --json', t => { }, 'should output json containing dev deps' ) - config.dev = false - }) - - t.test('--only=development', async t => { - config.only = 'development' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.same( - jsonParse(result), - { - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'dev-dep': { - version: '1.0.0', - dependencies: { - foo: { - version: '1.0.0', - dependencies: { dog: { version: '1.0.0' } }, - }, - }, - }, - }, - }, - 'should output json containing only development deps' - ) - config.only = null + flatOptions.omit = [] }) t.test('--link', async t => { @@ -3075,7 +2920,7 @@ t.test('ls --json', t => { }) t.test('--production', async t => { - config.production = true + flatOptions.omit = ['dev', 'peer'] npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-npm-ls', @@ -3110,46 +2955,7 @@ t.test('ls --json', t => { }, 'should output json containing production deps' ) - config.production = false - }) - - t.test('--only=prod', async t => { - config.only = 'prod' - npm.prefix = t.testdir({ - 'package.json': JSON.stringify({ - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - 'prod-dep': '^1.0.0', - chai: '^1.0.0', - }, - devDependencies: { - 'dev-dep': '^1.0.0', - }, - optionalDependencies: { - 'optional-dep': '^1.0.0', - }, - peerDependencies: { - 'peer-dep': '^1.0.0', - }, - }), - ...diffDepTypesNmFixture, - }) - await ls.exec([]) - t.same( - jsonParse(result), - { - name: 'test-npm-ls', - version: '1.0.0', - dependencies: { - chai: { version: '1.0.0' }, - 'optional-dep': { version: '1.0.0' }, - 'prod-dep': { version: '1.0.0', dependencies: { dog: { version: '2.0.0' } } }, - }, - }, - 'should output json containing only prod deps' - ) - config.only = null + flatOptions.omit = [] }) t.test('from lockfile', async t => { diff --git a/deps/npm/test/lib/commands/org.js b/deps/npm/test/lib/commands/org.js index 3ae951dd5c4533..cd25fc23aa3344 100644 --- a/deps/npm/test/lib/commands/org.js +++ b/deps/npm/test/lib/commands/org.js @@ -43,7 +43,6 @@ const libnpmorg = { } const Org = t.mock('../../../lib/commands/org.js', { - '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmorg, }) const org = new Org(npm) diff --git a/deps/npm/test/lib/commands/outdated.js b/deps/npm/test/lib/commands/outdated.js index 3bf42b10a26015..14647ce6cef28c 100644 --- a/deps/npm/test/lib/commands/outdated.js +++ b/deps/npm/test/lib/commands/outdated.js @@ -84,10 +84,6 @@ const globalDir = t.testdir({ }, }) -const flatOptions = { - workspacesEnabled: true, -} - const outdated = (dir, opts) => { logs = '' const Outdated = t.mock('../../../lib/commands/outdated.js', { @@ -95,11 +91,22 @@ const outdated = (dir, opts) => { packument, }, }) + if (opts.config && opts.config.omit) { + opts.flatOptions = { + omit: opts.config.omit, + ...opts.flatOptions, + } + delete opts.config.omit + } const npm = mockNpm({ ...opts, localPrefix: dir, prefix: dir, - flatOptions, + flatOptions: { + workspacesEnabled: true, + omit: [], + ...opts.flatOptions, + }, globalDir: `${globalDir}/node_modules`, output, }) @@ -529,14 +536,16 @@ t.test('workspaces', async t => { t.matchSnapshot(logs, 'should display ws outdated deps human output') t.equal(process.exitCode, 1) - flatOptions.workspacesEnabled = false - await outdated(testDir, {}).exec([]) + await outdated(testDir, { + flatOptions: { + workspacesEnabled: false, + }, + }).exec([]) // TODO: This should display dog, but doesn't because arborist filters // workspace deps even if they're also root deps // This will be fixed in a future arborist version t.matchSnapshot(logs, 'should display only root outdated when ws disabled') - flatOptions.workspacesEnabled = true await outdated(testDir, { config: { diff --git a/deps/npm/test/lib/commands/owner.js b/deps/npm/test/lib/commands/owner.js index 83f4d880f74ad3..eadfa2bf08b560 100644 --- a/deps/npm/test/lib/commands/owner.js +++ b/deps/npm/test/lib/commands/owner.js @@ -21,7 +21,6 @@ const mocks = { 'proc-log': log, 'npm-registry-fetch': npmFetch, pacote, - '../../../lib/utils/otplease.js': async (opts, fn) => fn({ otp: '123456', opts }), '../../../lib/utils/read-package-name.js': async (prefix) => { readPackageNamePrefix = prefix return readPackageNameResponse @@ -193,7 +192,6 @@ t.test('owner add ', async t => { _rev: '1-foobaaa1', maintainers: npmcliMaintainers, }, - otp: '123456', spec: { name: '@npmcli/map-workspaces', }, @@ -507,7 +505,6 @@ t.test('owner rm ', async t => { body: { _rev: '1-foobaaa1', }, - otp: '123456', spec: { name: '@npmcli/map-workspaces', }, diff --git a/deps/npm/test/lib/commands/profile.js b/deps/npm/test/lib/commands/profile.js index 82ac4954209286..09fd08cfc5329e 100644 --- a/deps/npm/test/lib/commands/profile.js +++ b/deps/npm/test/lib/commands/profile.js @@ -19,7 +19,6 @@ const npm = mockNpm({ }, }) const mocks = { - ansistyles: { bright: a => a }, npmlog: { gauge: { show () {} }, }, @@ -41,10 +40,6 @@ const mocks = { .join('\n') } }, - '../../../lib/utils/pulse-till-done.js': { - withPromise: async a => a, - }, - '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), '../../../lib/utils/read-user-info.js': { async password () {}, async otp () {}, diff --git a/deps/npm/test/lib/commands/publish.js b/deps/npm/test/lib/commands/publish.js index 0acce8b0019216..64eb7c60cb0621 100644 --- a/deps/npm/test/lib/commands/publish.js +++ b/deps/npm/test/lib/commands/publish.js @@ -163,9 +163,9 @@ t.test('if loglevel=info and json, should not output package contents', async t t.test( /* eslint-disable-next-line max-len */ - 'if loglevel=silent and dry-run, should not output package contents or publish or validate credentials, should log tarball contents', + 'if loglevel=silent and dry-run, should not output package contents or publish, should log tarball contents', async t => { - t.plan(1) + t.plan(2) const testDir = t.testdir({ 'package.json': JSON.stringify( @@ -199,8 +199,9 @@ t.test( throw new Error('should not output in dry run mode') }, }, t) - npm.config.getCredentialsByURI = () => { - throw new Error('should not call getCredentialsByURI in dry run') + npm.config.getCredentialsByURI = uri => { + t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry') + return { token: 'some.registry.token' } } const publish = new Publish(npm) @@ -213,7 +214,7 @@ t.test( /* eslint-disable-next-line max-len */ 'if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents', async t => { - t.plan(2) + t.plan(3) const testDir = t.testdir({ 'package.json': JSON.stringify( @@ -226,6 +227,18 @@ t.test( ), }) + const npm = mockNpm({ + config: { 'dry-run': true, loglevel: 'info' }, + output: () => { + t.pass('output fn is called') + }, + }, t) + const registry = npm.config.get('registry') + npm.config.getCredentialsByURI = uri => { + t.same(uri, registry, 'gets credentials for expected registry') + return { /* no token will call log.warn */ } + } + const Publish = t.mock('../../../lib/commands/publish.js', { '../../../lib/utils/tar.js': { getContents: () => ({ @@ -234,6 +247,12 @@ t.test( logTar: () => { t.pass('logTar is called') }, + 'proc-log': { + warn (_, msg) { + t.match(msg, + `This command requires you to be logged in to ${registry} (dry-run)`) + }, + }, }, libnpmpublish: { publish: () => { @@ -241,15 +260,7 @@ t.test( }, }, }) - const npm = mockNpm({ - config: { 'dry-run': true, loglevel: 'info' }, - output: () => { - t.pass('output fn is called') - }, - }, t) - npm.config.getCredentialsByURI = () => { - throw new Error('should not call getCredentialsByURI in dry run') - } + const publish = new Publish(npm) await publish.exec([testDir]) diff --git a/deps/npm/test/lib/commands/team.js b/deps/npm/test/lib/commands/team.js index 592dbc3a0ec2e7..792418788bcd10 100644 --- a/deps/npm/test/lib/commands/team.js +++ b/deps/npm/test/lib/commands/team.js @@ -22,7 +22,6 @@ const npm = mockNpm({ const mocks = { libnpmteam, 'cli-columns': a => a.join(' '), - '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), } t.afterEach(() => { diff --git a/deps/npm/test/lib/commands/token.js b/deps/npm/test/lib/commands/token.js index 65a094a0bca247..c32c0b74a96f42 100644 --- a/deps/npm/test/lib/commands/token.js +++ b/deps/npm/test/lib/commands/token.js @@ -10,9 +10,6 @@ const npm = { } const mockToken = (otherMocks) => t.mock('../../../lib/commands/token.js', { - '../../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, '../../../lib/utils/read-user-info.js': mocks.readUserInfo, 'npm-profile': mocks.profile, ...otherMocks, diff --git a/deps/npm/test/lib/commands/unpublish.js b/deps/npm/test/lib/commands/unpublish.js index 71be4a5d6908dd..829d41c5bb875c 100644 --- a/deps/npm/test/lib/commands/unpublish.js +++ b/deps/npm/test/lib/commands/unpublish.js @@ -1,36 +1,7 @@ const t = require('tap') const { load: loadMockNpm } = require('../../fixtures/mock-npm') -const tnock = require('../../fixtures/tnock.js') - -const pkgManifest = (name, version = '1.0.0') => { - return { - _id: `${name}@${version}`, - _rev: '00-testdeadbeef', - name, - versions: { - '1.0.0': { - name, - version: '1.0.0', - dist: { - tarball: `https://registry.npmjs.org/${name}/-/${name}-1.0.0.tgz`, - }, - }, - [version]: { - name, - version: version, - dist: { - tarball: `https://registry.npmjs.org/${name}/-/${name}-${version}.tgz`, - }, - }, - }, - time: { - '1.0.0': new Date(), - [version]: new Date(), - }, - 'dist-tags': { latest: version }, - } -} +const MockRegistry = require('../../fixtures/mock-registry.js') const user = 'test-user' const pkg = 'test-package' const auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' } @@ -49,12 +20,14 @@ t.test('no args --force success', async t => { }, }) - const manifest = pkgManifest(pkg) - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) - .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) - + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true } }) + registry.nock.delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', []) t.equal(joinedOutput(), '- test-package@1.0.0') }) @@ -116,14 +89,20 @@ t.test('unpublish @version not the last version', async t => { ...auth, }, }) - const manifest = pkgManifest(pkg, '1.0.1') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).times(3).reply(200, manifest) - .put(`/${pkg}/-rev/${manifest._rev}`, body => { - // sets latest and deletes version 1.0.1 - return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined - }).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ + name: pkg, + packuments: ['1.0.0', '1.0.1'], + }) + await registry.package({ manifest, query: { write: true }, times: 3 }) + registry.nock.put(`/${pkg}/-rev/${manifest._rev}`, body => { + // sets latest and deletes version 1.0.1 + return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined + }).reply(201) .intercept(`/${pkg}/-/${pkg}-1.0.1.tgz/-rev/${manifest._rev}`, 'DELETE').reply(201) await npm.exec('unpublish', ['test-package@1.0.1']) @@ -136,10 +115,13 @@ t.test('unpublish @version last version', async t => { ...auth, }, }) - const manifest = pkgManifest(pkg) - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true } }) await t.rejects( npm.exec('unpublish', ['test-package@1.0.0']), @@ -159,13 +141,14 @@ t.test('no version found in package.json', async t => { }, null, 2), }, }) - - const manifest = pkgManifest(pkg) - - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) - .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true } }) + registry.nock.delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', []) t.equal(joinedOutput(), '- test-package') @@ -178,11 +161,14 @@ t.test('unpublish --force no version set', async t => { ...auth, }, }) - const manifest = pkgManifest(pkg) - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).times(2).reply(200, manifest) - .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true }, times: 2 }) + registry.nock.delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', ['test-package']) t.equal(joinedOutput(), '- test-package') @@ -196,14 +182,20 @@ t.test('silent', async t => { ...auth, }, }) - const manifest = pkgManifest(pkg, '1.0.1') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).times(3).reply(200, manifest) - .put(`/${pkg}/-rev/${manifest._rev}`, body => { - // sets latest and deletes version 1.0.1 - return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined - }).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ + name: pkg, + packuments: ['1.0.0', '1.0.1'], + }) + await registry.package({ manifest, query: { write: true }, times: 3 }) + registry.nock.put(`/${pkg}/-rev/${manifest._rev}`, body => { + // sets latest and deletes version 1.0.1 + return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined + }).reply(201) .delete(`/${pkg}/-/${pkg}-1.0.1.tgz/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', ['test-package@1.0.1']) @@ -261,16 +253,19 @@ t.test('workspaces', async t => { }, prefixDir, }) - const manifestA = pkgManifest('workspace-a') - const manifestB = pkgManifest('workspace-b') - const manifestN = pkgManifest('workspace-n') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/workspace-a?write=true').times(2).reply(200, manifestA) - .delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201) - .get('/workspace-b?write=true').times(2).reply(200, manifestB) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifestA = registry.manifest({ name: 'workspace-a' }) + const manifestB = registry.manifest({ name: 'workspace-b' }) + const manifestN = registry.manifest({ name: 'workspace-n' }) + await registry.package({ manifest: manifestA, query: { write: true }, times: 2 }) + await registry.package({ manifest: manifestB, query: { write: true }, times: 2 }) + await registry.package({ manifest: manifestN, query: { write: true }, times: 2 }) + registry.nock.delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201) .delete(`/workspace-b/-rev/${manifestB._rev}`).reply(201) - .get('/workspace-n?write=true').times(2).reply(200, manifestN) .delete(`/workspace-n/-rev/${manifestN._rev}`).reply(201) await npm.exec('unpublish', []) @@ -286,11 +281,14 @@ t.test('workspaces', async t => { }, prefixDir, }) - const manifestA = pkgManifest('workspace-a') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/workspace-a?write=true').times(2).reply(200, manifestA) - .delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifestA = registry.manifest({ name: 'workspace-a' }) + await registry.package({ manifest: manifestA, query: { write: true }, times: 2 }) + registry.nock.delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201) await npm.exec('unpublish', []) t.equal(joinedOutput(), '- workspace-a') @@ -304,11 +302,16 @@ t.test('dryRun with spec', async t => { ...auth, }, }) - - const manifest = pkgManifest(pkg, '1.0.1') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ + name: pkg, + packuments: ['1.0.0', '1.0.1'], + }) + await registry.package({ manifest, query: { write: true } }) await npm.exec('unpublish', ['test-package@1.0.1']) t.equal(joinedOutput(), '- test-package@1.0.1') @@ -338,7 +341,6 @@ t.test('publishConfig no spec', async t => { const { joinedOutput, npm } = await loadMockNpm(t, { config: { force: true, - 'fetch-retries': 0, '//other.registry.npmjs.org/:_authToken': 'test-other-token', }, prefixDir: { @@ -352,11 +354,14 @@ t.test('publishConfig no spec', async t => { }, }) - const manifest = pkgManifest(pkg) - tnock(t, alternateRegistry, - { reqheaders: { authorization: 'Bearer test-other-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) - .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: alternateRegistry, + authorization: 'test-other-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true } }) + registry.nock.delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', []) t.equal(joinedOutput(), '- test-package@1.0.0') }) @@ -366,7 +371,6 @@ t.test('publishConfig with spec', async t => { const { joinedOutput, npm } = await loadMockNpm(t, { config: { force: true, - 'fetch-retries': 0, '//other.registry.npmjs.org/:_authToken': 'test-other-token', }, prefixDir: { @@ -380,11 +384,14 @@ t.test('publishConfig with spec', async t => { }, }) - const manifest = pkgManifest(pkg) - tnock(t, alternateRegistry, - { reqheaders: { authorization: 'Bearer test-other-token' } }) - .get(`/${pkg}?write=true`).reply(200, manifest) - .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) + const registry = new MockRegistry({ + tap: t, + registry: alternateRegistry, + authorization: 'test-other-token', + }) + const manifest = registry.manifest({ name: pkg }) + await registry.package({ manifest, query: { write: true }, times: 2 }) + registry.nock.delete(`/${pkg}/-rev/${manifest._rev}`).reply(201) await npm.exec('unpublish', ['test-package']) t.equal(joinedOutput(), '- test-package') }) @@ -406,12 +413,18 @@ t.test('completion', async t => { } t.test('completing with multiple versions from the registry', async t => { - const manifest = pkgManifest(pkg, '1.0.1') - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ + name: pkg, + packuments: ['1.0.0', '1.0.1'], + }) + await registry.package({ manifest, query: { write: true } }) + registry.nock.get('/-/whoami').reply(200, { username: user }) .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write' }) - .get(`/${pkg}?write=true`).reply(200, manifest) await testComp(t, { argv: ['npm', 'unpublish'], @@ -424,13 +437,16 @@ t.test('completion', async t => { }) t.test('no versions retrieved', async t => { - const manifest = pkgManifest(pkg) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + const manifest = registry.manifest({ name: pkg }) manifest.versions = {} - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) + await registry.package({ manifest, query: { write: true } }) + registry.nock.get('/-/whoami').reply(200, { username: user }) .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write' }) - .get(`/${pkg}?write=true`).reply(200, manifest) await testComp(t, { argv: ['npm', 'unpublish'], @@ -443,9 +459,12 @@ t.test('completion', async t => { }) t.test('packages starting with same letters', async t => { - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.nock.get('/-/whoami').reply(200, { username: user }) .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write', [`${pkg}a`]: 'write', @@ -464,10 +483,13 @@ t.test('completion', async t => { }) t.test('no packages retrieved', async t => { - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) - .get('/-/org/test-user/package?format=cli').reply(200, {}) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.nock.get('/-/whoami').reply(200, { username: user }) + registry.nock.get('/-/org/test-user/package?format=cli').reply(200, {}) await testComp(t, { argv: ['npm', 'unpublish'], @@ -478,9 +500,12 @@ t.test('completion', async t => { }) t.test('no pkg name to complete', async t => { - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.nock.get('/-/whoami').reply(200, { username: user }) .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write', [`${pkg}a`]: 'write', @@ -495,9 +520,12 @@ t.test('completion', async t => { }) t.test('no pkg names retrieved from user account', async t => { - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(200, { username: user }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.nock.get('/-/whoami').reply(200, { username: user }) .get('/-/org/test-user/package?format=cli').reply(200, null) await testComp(t, { @@ -509,9 +537,12 @@ t.test('completion', async t => { }) t.test('logged out user', async t => { - tnock(t, npm.config.get('registry'), - { reqheaders: { authorization: 'Bearer test-auth-token' } }) - .get('/-/whoami').reply(404) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.nock.get('/-/whoami').reply(404) await testComp(t, { argv: ['npm', 'unpublish'], diff --git a/deps/npm/test/lib/commands/whoami.js b/deps/npm/test/lib/commands/whoami.js index 66c3f0c6b30bf1..f483bd46d5c4ba 100644 --- a/deps/npm/test/lib/commands/whoami.js +++ b/deps/npm/test/lib/commands/whoami.js @@ -1,24 +1,35 @@ const t = require('tap') -const { load: _loadMockNpm } = require('../../fixtures/mock-npm') +const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const MockRegistry = require('../../fixtures/mock-registry.js') const username = 'foo' -const loadMockNpm = (t, options) => _loadMockNpm(t, { - mocks: { - '../../lib/utils/get-identity.js': () => Promise.resolve(username), - }, - ...options, -}) +const auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' } t.test('npm whoami', async (t) => { - const { npm, joinedOutput } = await loadMockNpm(t) + const { npm, joinedOutput } = await loadMockNpm(t, { config: auth }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', + }) + registry.whoami({ username }) await npm.exec('whoami', []) t.equal(joinedOutput(), username, 'should print username') }) t.test('npm whoami --json', async (t) => { const { npm, joinedOutput } = await loadMockNpm(t, { - config: { json: true }, + config: { + json: true, + ...auth, + }, + }) + const registry = new MockRegistry({ + tap: t, + registry: npm.config.get('registry'), + authorization: 'test-auth-token', }) + registry.whoami({ username }) await npm.exec('whoami', []) t.equal(JSON.parse(joinedOutput()), username, 'should print username') }) diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index 998e96314d2b41..1966ca96000886 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -609,16 +609,14 @@ t.test('implicit workspace rejection', async t => { workspaces: ['./packages/a'], }), }, - globals: { + globals: ({ prefix }) => ({ + 'process.cwd': () => join(prefix, 'packages', 'a'), 'process.argv': [ process.execPath, process.argv[1], '--color', 'false', '--workspace', './packages/a', ], - }, - config: ({ prefix }) => ({ - workspace: { value: [join(prefix, 'packages', 'a')], where: 'default' }, }), }) await t.rejects( @@ -646,16 +644,13 @@ t.test('implicit workspace accept', async t => { }), }, globals: ({ prefix }) => ({ - 'process.cwd': () => prefix, + 'process.cwd': () => join(prefix, 'packages', 'a'), 'process.argv': [ process.execPath, process.argv[1], '--color', 'false', ], }), - config: ({ prefix }) => ({ - workspace: { value: [join(prefix, 'packages', 'a')], where: 'default' }, - }), }) await t.rejects(mock.npm.exec('org', []), /.*Usage/) }) diff --git a/deps/npm/test/lib/workspaces/get-workspaces.js b/deps/npm/test/lib/workspaces/get-workspaces.js index 0d1bba3144d832..4e48b1c4b7707e 100644 --- a/deps/npm/test/lib/workspaces/get-workspaces.js +++ b/deps/npm/test/lib/workspaces/get-workspaces.js @@ -17,67 +17,67 @@ const clean = (res, path) => { return cleaned } -t.test('get-workspaces', async t => { - const path = t.testdir({ - packages: { - a: { - 'package.json': JSON.stringify({ - name: 'a', - version: '1.0.0', - scripts: { glorp: 'echo a doing the glerp glop' }, - }), - }, - b: { - 'package.json': JSON.stringify({ - name: 'b', - version: '2.0.0', - scripts: { glorp: 'echo b doing the glerp glop' }, - }), - }, - c: { - 'package.json': JSON.stringify({ - name: 'c', - version: '1.0.0', - scripts: { - test: 'exit 0', - posttest: 'echo posttest', - lorem: 'echo c lorem', - }, - }), - }, - d: { - 'package.json': JSON.stringify({ - name: 'd', - version: '1.0.0', - scripts: { - test: 'exit 0', - posttest: 'echo posttest', - }, - }), - }, - e: { - 'package.json': JSON.stringify({ - name: 'e', - scripts: { test: 'exit 0', start: 'echo start something' }, - }), - }, - noscripts: { - 'package.json': JSON.stringify({ - name: 'noscripts', - version: '1.0.0', - }), - }, +const path = t.testdir({ + packages: { + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + scripts: { glorp: 'echo a doing the glerp glop' }, + }), }, - 'package.json': JSON.stringify({ - name: 'x', - version: '1.2.3', - workspaces: ['packages/*'], - }), - }) + b: { + 'package.json': JSON.stringify({ + name: 'b', + version: '2.0.0', + scripts: { glorp: 'echo b doing the glerp glop' }, + }), + }, + c: { + 'package.json': JSON.stringify({ + name: 'c', + version: '1.0.0', + scripts: { + test: 'exit 0', + posttest: 'echo posttest', + lorem: 'echo c lorem', + }, + }), + }, + d: { + 'package.json': JSON.stringify({ + name: 'd', + version: '1.0.0', + scripts: { + test: 'exit 0', + posttest: 'echo posttest', + }, + }), + }, + e: { + 'package.json': JSON.stringify({ + name: 'e', + scripts: { test: 'exit 0', start: 'echo start something' }, + }), + }, + noscripts: { + 'package.json': JSON.stringify({ + name: 'noscripts', + version: '1.0.0', + }), + }, + }, + 'package.json': JSON.stringify({ + name: 'x', + version: '1.2.3', + workspaces: ['packages/*'], + }), +}) - let workspaces +let workspaces - workspaces = await getWorkspaces(['a', 'b'], { path }) +t.test('filter by package name', async t => { + workspaces = await getWorkspaces(['a', 'b'], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -86,8 +86,11 @@ t.test('get-workspaces', async t => { })), 'should filter by package name' ) +}) - workspaces = await getWorkspaces(['a', 'b'], { path, includeWorkspaceRoot: true }) +t.test('include workspace root', async t => { + workspaces = await getWorkspaces(['a', 'b'], + { path, includeWorkspaceRoot: true, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -97,8 +100,10 @@ t.test('get-workspaces', async t => { })), 'include rootspace root' ) +}) - workspaces = await getWorkspaces(['./packages/c'], { path }) +t.test('filter by package directory', async t => { + workspaces = await getWorkspaces(['./packages/c'], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -106,8 +111,10 @@ t.test('get-workspaces', async t => { })), 'should filter by package directory' ) +}) - workspaces = await getWorkspaces(['packages/c'], { path }) +t.test('filter by rel package directory', async t => { + workspaces = await getWorkspaces(['packages/c'], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -115,8 +122,10 @@ t.test('get-workspaces', async t => { })), 'should filter by rel package directory' ) +}) - workspaces = await getWorkspaces([resolve(path, 'packages/c')], { path }) +t.test('filter by absolute package directory', async t => { + workspaces = await getWorkspaces([resolve(path, 'packages/c')], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -124,8 +133,10 @@ t.test('get-workspaces', async t => { })), 'should filter by absolute package directory' ) +}) - workspaces = await getWorkspaces(['packages'], { path }) +t.test('filter by parent directory name', async t => { + workspaces = await getWorkspaces(['packages'], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -138,8 +149,10 @@ t.test('get-workspaces', async t => { })), 'should filter by parent directory name' ) +}) - workspaces = await getWorkspaces(['./packages/'], { path }) +t.test('filter by parent directory path', async t => { + workspaces = await getWorkspaces(['./packages/'], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -152,8 +165,10 @@ t.test('get-workspaces', async t => { })), 'should filter by parent directory path' ) +}) - workspaces = await getWorkspaces([resolve(path, './packages')], { path }) +t.test('filter by absolute parent directory path', async t => { + workspaces = await getWorkspaces([resolve(path, './packages')], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -166,8 +181,10 @@ t.test('get-workspaces', async t => { })), 'should filter by absolute parent directory path' ) +}) - workspaces = await getWorkspaces([], { path }) +t.test('no filter set', async t => { + workspaces = await getWorkspaces([], { path, relativeFrom: path }) t.same( clean(workspaces, path), new Map(Object.entries({ @@ -180,32 +197,26 @@ t.test('get-workspaces', async t => { })), 'should return all workspaces if no filter set' ) +}) - try { - await getWorkspaces(['missing'], { path }) - throw new Error('missed throw') - } catch (err) { - t.match( - err, - /No workspaces found/, - 'should throw no workspaces found error' - ) - } +t.test('missing workspace', async t => { + await t.rejects( + getWorkspaces(['missing'], { path, relativeFrom: path }), + /No workspaces found/, + 'should throw no workspaces found error' + ) +}) +t.test('no workspaces configured', async t => { const unconfiguredWorkspaces = t.testdir({ 'package.json': JSON.stringify({ name: 'no-configured-workspaces', version: '1.0.0', }), }) - try { - await getWorkspaces([], { path: unconfiguredWorkspaces }) - throw new Error('missed throw') - } catch (err) { - t.match( - err, - /No workspaces found/, - 'should throw no workspaces found error' - ) - } + await t.rejects( + getWorkspaces([], { path: unconfiguredWorkspaces, relativeFrom: path }), + /No workspaces found/, + 'should throw no workspaces found error' + ) })